Skip to content
Permalink
Browse files

collapse static dataset group box

  • Loading branch information
vcloarec authored and nyalldawson committed Jun 3, 2020
1 parent 7cc27af commit dc4c6d10600e0204183c280c83c99c034853b3e8
@@ -54,7 +54,8 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
mRendererMeshPropertiesWidget = new QgsRendererMeshPropertiesWidget( mMeshLayer, canvas, this );
mOptsPage_StyleContent->layout()->addWidget( mRendererMeshPropertiesWidget );

mStaticScalarWidget->setLayer( mMeshLayer );
mStaticDatasetWidget->setLayer( mMeshLayer );
mIsMapSettingsTemporal = mMeshLayer && canvas && canvas->mapSettings().isTemporal();

mTemporalProviderTimeUnitComboBox->addItem( tr( "Seconds" ), QgsUnitTypes::TemporalSeconds );
mTemporalProviderTimeUnitComboBox->addItem( tr( "Minutes" ), QgsUnitTypes::TemporalMinutes );
@@ -79,9 +80,10 @@ 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, mStaticScalarWidget, &QgsMeshStaticDatasetWidget::setScalarDatasetGroup );
connect( mMeshLayer, &QgsMeshLayer::activeVectorDatasetGroupChanged, mStaticScalarWidget, &QgsMeshStaticDatasetWidget::setVectorDatasetGroup );
connect( mMeshLayer, &QgsMeshLayer::activeScalarDatasetGroupChanged, mStaticDatasetWidget, &QgsMeshStaticDatasetWidget::setScalarDatasetGroup );
connect( mMeshLayer, &QgsMeshLayer::activeVectorDatasetGroupChanged, mStaticDatasetWidget, &QgsMeshStaticDatasetWidget::setVectorDatasetGroup );

#ifdef HAVE_3D
mMesh3DWidget = new QgsMeshLayer3DRendererWidget( mMeshLayer, canvas, mOptsPage_3DView );
@@ -216,8 +218,9 @@ void QgsMeshLayerProperties::syncToLayer()
mComboBoxTemporalDatasetMatchingMethod->setCurrentIndex(
mComboBoxTemporalDatasetMatchingMethod->findData( temporalProperties->matchingMethod() ) );

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

void QgsMeshLayerProperties::loadDefaultStyle()
@@ -373,7 +376,7 @@ void QgsMeshLayerProperties::apply()
mMeshLayer->dataProvider()->setTemporalUnit(
static_cast<QgsUnitTypes::TemporalUnit>( mTemporalProviderTimeUnitComboBox->currentData().toInt() ) );

mStaticScalarWidget->apply();
mStaticDatasetWidget->apply();
bool needEmitRendererChanged = mMeshLayer->temporalProperties()->isActive() == mTemporalStaticDatasetCheckBox->isChecked();
mMeshLayer->temporalProperties()->setIsActive( !mTemporalStaticDatasetCheckBox->isChecked() );
mMeshLayer->setTemporalMatchingMethod( static_cast<QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod>(
@@ -461,3 +464,8 @@ void QgsMeshLayerProperties::onTimeReferenceChange()
mTemporalDateTimeStart->setDateTime( timeExtent.begin() );
mTemporalDateTimeEnd->setDateTime( timeExtent.end() );
}

void QgsMeshLayerProperties::onStaticDatasetCheckBoxChanged()
{
mStaticDatasetGroupBox->setCollapsed( !mTemporalStaticDatasetCheckBox->isChecked() && mIsMapSettingsTemporal );
}
@@ -74,6 +74,7 @@ class APP_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U

void onTimeReferenceChange();

void onStaticDatasetCheckBoxChanged();
private:
//! Pointer to the mesh styling widget
QgsRendererMeshPropertiesWidget *mRendererMeshPropertiesWidget = nullptr;
@@ -89,6 +90,8 @@ class APP_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U
* was loaded but dialog is canceled */
QgsMapLayerStyle mOldStyle;

bool mIsMapSettingsTemporal = false;

friend class TestQgsMeshLayerPropertiesDialog;

void showHelp();
@@ -342,13 +342,23 @@ border-radius: 2px;</string>
<widget class="QgsMeshDatasetGroupTreeWidget" name="mDatasetGroupTreeWidget" native="true"/>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QCheckBox" name="mTemporalStaticDatasetCheckBox">
<property name="toolTip">
<string>Static dataset even if the temporal navigation is on</string>
</property>
<property name="text">
<string>Force Static Dataset with Temporal Navigation</string>
</property>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mStaticDatasetGroupBox">
<property name="title">
<string>Static Dataset</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QgsMeshStaticDatasetWidget" name="mStaticScalarWidget" native="true">
<widget class="QgsMeshStaticDatasetWidget" name="mStaticDatasetWidget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
@@ -357,16 +367,6 @@ border-radius: 2px;</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mTemporalStaticDatasetCheckBox">
<property name="toolTip">
<string>Static dataset even if the temporal navigation is on</string>
</property>
<property name="text">
<string>Force Static Dataset with Temporal Navigation</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -378,7 +378,7 @@ border-radius: 2px;</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
<height>40</height>
</size>
</property>
</spacer>
@@ -810,6 +810,12 @@ border-radius: 2px;</string>
<header>qgsmeshdatasetgrouptreewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mSearchLineEdit</tabstop>

0 comments on commit dc4c6d1

Please sign in to comment.
You can’t perform that action at this time.