35 connect( mAddDatasetButton, &QToolButton::clicked,
this, &QgsMeshDatasetGroupTreeWidget::addDataset );
36 connect( mCollapseButton, &QToolButton::clicked, mDatasetGroupTreeView, &QTreeView::collapseAll );
37 connect( mExpandButton, &QToolButton::clicked, mDatasetGroupTreeView, &QTreeView::expandAll );
40 connect( mResetDefaultButton, &QToolButton::clicked,
this, [
this]
42 this->mDatasetGroupTreeView->resetDefault( this->mMeshLayer );
50 mMeshLayer = meshLayer;
51 mDatasetGroupTreeView->syncToLayer( meshLayer );
60void QgsMeshDatasetGroupTreeWidget::addDataset()
66 const QString openFileDir = settings.
value( QStringLiteral(
"lastMeshDatasetDir" ), QDir::homePath(),
QgsSettings::App ).toString();
67 const QString openFileString = QFileDialog::getOpenFileName(
nullptr,
68 tr(
"Load mesh datasets" ),
72 if ( openFileString.isEmpty() )
77 const QFileInfo openFileInfo( openFileString );
79 const QFile datasetFile( openFileString );
83 QMessageBox::information(
this, tr(
"Load mesh datasets" ), tr(
"Datasets successfully added to the mesh layer" ) );
88 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.