17#include "moc_qgsmeshdatasetgrouptreewidget.cpp"
36 connect( mAddDatasetButton, &QToolButton::clicked,
this, &QgsMeshDatasetGroupTreeWidget::addDataset );
37 connect( mCollapseButton, &QToolButton::clicked, mDatasetGroupTreeView, &QTreeView::collapseAll );
38 connect( mExpandButton, &QToolButton::clicked, mDatasetGroupTreeView, &QTreeView::expandAll );
41 connect( mResetDefaultButton, &QToolButton::clicked,
this, [
this]
43 this->mDatasetGroupTreeView->resetDefault( this->mMeshLayer );
51 mMeshLayer = meshLayer;
52 mDatasetGroupTreeView->syncToLayer( meshLayer );
61void QgsMeshDatasetGroupTreeWidget::addDataset()
67 const QString openFileDir = settings.
value( QStringLiteral(
"lastMeshDatasetDir" ), QDir::homePath(),
QgsSettings::App ).toString();
68 const QString openFileString = QFileDialog::getOpenFileName(
nullptr,
69 tr(
"Load mesh datasets" ),
73 if ( openFileString.isEmpty() )
78 const QFileInfo openFileInfo( openFileString );
80 const QFile datasetFile( openFileString );
84 QMessageBox::information(
this, tr(
"Load mesh datasets" ), tr(
"Datasets successfully added to the mesh layer" ) );
89 QMessageBox::warning(
this, tr(
"Load mesh datasets" ), tr(
"Could not read mesh dataset." ) );
Represents a mesh layer supporting display of data on structured or unstructured meshes.
bool addDatasets(const QString &path, const QDateTime &defaultReferenceTime=QDateTime())
Adds datasets to the mesh from file with path.
void setDatasetGroupTreeRootItem(QgsMeshDatasetGroupTreeItem *rootItem)
Sets the root items of the dataset group tree item.
QgsMeshDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
QgsDateTimeRange temporalRange() const
Returns the project's temporal range, which indicates the earliest and latest datetime ranges associa...
static QgsProject * instance()
Returns the QgsProject singleton instance.
const QgsProjectTimeSettings * timeSettings() const
Returns the project's time settings, which contains the project's temporal range and other time based...
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
T begin() const
Returns the beginning of the range.