Skip to content

Commit

Permalink
Replace the checkbox + groupbox by a checkable groupbox
Browse files Browse the repository at this point in the history
for setting mesh static dataset groups
  • Loading branch information
DelazJ authored and nyalldawson committed Nov 5, 2021
1 parent 02b68ae commit 79b93c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
13 changes: 3 additions & 10 deletions src/gui/mesh/qgsmeshlayerproperties.cpp
Expand Up @@ -86,7 +86,6 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMeshLayerProperties::showHelp );

connect( mTemporalReloadButton, &QPushButton::clicked, this, &QgsMeshLayerProperties::reloadTemporalProperties );
connect( mTemporalStaticDatasetCheckBox, &QCheckBox::toggled, this, &QgsMeshLayerProperties::onStaticDatasetCheckBoxChanged );
connect( mTemporalDateTimeReference, &QDateTimeEdit::dateTimeChanged, this, &QgsMeshLayerProperties::onTimeReferenceChange );
connect( mMeshLayer, &QgsMeshLayer::activeScalarDatasetGroupChanged, mStaticDatasetWidget, &QgsMeshStaticDatasetWidget::setScalarDatasetGroup );
connect( mMeshLayer, &QgsMeshLayer::activeVectorDatasetGroupChanged, mStaticDatasetWidget, &QgsMeshStaticDatasetWidget::setVectorDatasetGroup );
Expand Down Expand Up @@ -239,8 +238,7 @@ void QgsMeshLayerProperties::syncToLayer()
mComboBoxTemporalDatasetMatchingMethod->findData( temporalProperties->matchingMethod() ) );

mStaticDatasetWidget->syncToLayer();
mTemporalStaticDatasetCheckBox->setChecked( !mMeshLayer->temporalProperties()->isActive() );
mStaticDatasetGroupBox->setCollapsed( mIsMapSettingsTemporal && mMeshLayer->temporalProperties()->isActive() );
mStaticDatasetGroupBox->setChecked( !mMeshLayer->temporalProperties()->isActive() );
}

void QgsMeshLayerProperties::loadDefaultStyle()
Expand Down Expand Up @@ -389,8 +387,8 @@ void QgsMeshLayerProperties::apply()
static_cast<QgsUnitTypes::TemporalUnit>( mTemporalProviderTimeUnitComboBox->currentData().toInt() ) );

mStaticDatasetWidget->apply();
bool needEmitRendererChanged = mMeshLayer->temporalProperties()->isActive() == mTemporalStaticDatasetCheckBox->isChecked();
mMeshLayer->temporalProperties()->setIsActive( !mTemporalStaticDatasetCheckBox->isChecked() );
bool needEmitRendererChanged = mMeshLayer->temporalProperties()->isActive() == mStaticDatasetGroupBox->isChecked();
mMeshLayer->temporalProperties()->setIsActive( !mStaticDatasetGroupBox->isChecked() );
mMeshLayer->setTemporalMatchingMethod( static_cast<QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod>(
mComboBoxTemporalDatasetMatchingMethod->currentData().toInt() ) );

Expand Down Expand Up @@ -479,11 +477,6 @@ void QgsMeshLayerProperties::onTimeReferenceChange()
mTemporalDateTimeEnd->setDateTime( timeExtent.end() );
}

void QgsMeshLayerProperties::onStaticDatasetCheckBoxChanged()
{
mStaticDatasetGroupBox->setCollapsed( !mTemporalStaticDatasetCheckBox->isChecked() && mIsMapSettingsTemporal );
}

void QgsMeshLayerProperties::urlClicked( const QUrl &url )
{
QFileInfo file( url.toLocalFile() );
Expand Down
2 changes: 0 additions & 2 deletions src/gui/mesh/qgsmeshlayerproperties.h
Expand Up @@ -87,8 +87,6 @@ class GUI_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U

void onTimeReferenceChange();

void onStaticDatasetCheckBoxChanged();

void urlClicked( const QUrl &url );
void loadMetadata();
void saveMetadataAs();
Expand Down
18 changes: 7 additions & 11 deletions src/ui/mesh/qgsmeshlayerpropertiesbase.ui
Expand Up @@ -376,19 +376,15 @@
<widget class="QgsMeshDatasetGroupTreeWidget" name="mDatasetGroupTreeWidget" native="true"/>
</item>
<item>
<widget class="QCheckBox" name="mTemporalStaticDatasetCheckBox">
<widget class="QgsCollapsibleGroupBoxBasic" name="mStaticDatasetGroupBox">
<property name="toolTip">
<string>Static dataset even if the temporal navigation is on</string>
</property>
<property name="text">
<string>Always treat as a static dataset, regardless of temporal properties</string>
<string>Always treat as a static dataset even if the temporal navigation is on</string>
</property>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mStaticDatasetGroupBox">
<property name="title">
<string>Static Dataset</string>
<string>Treat as Static Dataset</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
Expand Down Expand Up @@ -881,7 +877,7 @@
<tabstop>mLayerOrigNameLineEd</tabstop>
<tabstop>mCrsGroupBox</tabstop>
<tabstop>mCrsSelector</tabstop>
<tabstop>mTemporalStaticDatasetCheckBox</tabstop>
<tabstop>mStaticDatasetGroupBox</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>mSimplifyMeshGroupBox</tabstop>
<tabstop>mSimplifyReductionFactorSpinBox</tabstop>
Expand Down

0 comments on commit 79b93c6

Please sign in to comment.