18 #include <QFileDialog>
19 #include <QMessageBox>
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 );
60 void 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." ) );