Skip to content
Permalink
Browse files
Use a checkbox to create virtual mesh in mesh calculator (#45492)
  • Loading branch information
DelazJ committed Oct 14, 2021
1 parent 0f3011b commit 8f37bba3964570fe64f4e0322052dc175134598f
Showing with 26 additions and 36 deletions.
  1. +9 −7 src/app/mesh/qgsmeshcalculatordialog.cpp
  2. +2 −2 src/app/mesh/qgsmeshcalculatordialog.h
  3. +15 −27 src/ui/mesh/qgsmeshcalculatordialogbase.ui
@@ -116,8 +116,8 @@ QgsMeshCalculatorDialog::QgsMeshCalculatorDialog( QgsMeshLayer *meshLayer, QWidg
onOutputFormatChange();
connect( mOutputDatasetFileWidget, &QgsFileWidget::fileChanged, this, &QgsMeshCalculatorDialog::updateInfoMessage );

connect( mOutputOnFileRadioButton, &QRadioButton::toggled, this, &QgsMeshCalculatorDialog::onOutputRadioButtonChange );
onOutputRadioButtonChange();
connect( mUseVirtualProviderCheckBox, &QCheckBox::clicked, this, &QgsMeshCalculatorDialog::onVirtualCheckboxChange );
onVirtualCheckboxChange();
}

QgsMeshCalculatorDialog::~QgsMeshCalculatorDialog() = default;
@@ -204,7 +204,7 @@ std::unique_ptr<QgsMeshCalculator> QgsMeshCalculatorDialog::calculator() const
std::unique_ptr<QgsMeshCalculator> calc;
QgsMeshDatasetGroup::Type destination = QgsMeshDatasetGroup::Persistent;

if ( mOutputVirtualRadioButton->isChecked() )
if ( mUseVirtualProviderCheckBox->isChecked() )
destination = QgsMeshDatasetGroup::Virtual;

switch ( destination )
@@ -304,7 +304,7 @@ void QgsMeshCalculatorDialog::updateInfoMessage()
const bool expressionValid = result == QgsMeshCalculator::Success;

// selected driver is appropriate
const bool notInFile = !mOutputOnFileRadioButton->isChecked();
const bool notInFile = mUseVirtualProviderCheckBox->isChecked();
bool driverValid = false;
if ( expressionValid )
{
@@ -354,10 +354,12 @@ void QgsMeshCalculatorDialog::updateInfoMessage()
}
}

void QgsMeshCalculatorDialog::onOutputRadioButtonChange()
void QgsMeshCalculatorDialog::onVirtualCheckboxChange()
{
mOutputDatasetFileWidget->setEnabled( mOutputOnFileRadioButton->isChecked() );
mOutputFormatComboBox->setEnabled( mOutputOnFileRadioButton->isChecked() );
mOutputDatasetFileWidget->setVisible( !mUseVirtualProviderCheckBox->isChecked() );
mOutputDatasetFileLabel->setVisible( !mUseVirtualProviderCheckBox->isChecked() );
mOutputFormatComboBox->setVisible( !mUseVirtualProviderCheckBox->isChecked() );
mOutputFormatLabel->setVisible( !mUseVirtualProviderCheckBox->isChecked() );
updateInfoMessage();
}

@@ -20,7 +20,6 @@

#include "ui_qgsmeshcalculatordialogbase.h"
#include "qgsmeshcalculator.h"
#include "qgshelp.h"
#include "qgis_app.h"

//! A dialog to enter a mesh calculation expression
@@ -47,7 +46,8 @@ class APP_EXPORT QgsMeshCalculatorDialog: public QDialog, private Ui::QgsMeshCal
void mAllTimesButton_clicked();
void toggleExtendMask();
void updateInfoMessage();
void onOutputRadioButtonChange();
//! Disables some options that are not required if using Virtual Provider
void onVirtualCheckboxChange();
void onOutputFormatChange();

//calculator buttons
@@ -40,6 +40,19 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="mUseVirtualProviderCheckBox">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Create on-the-fly mesh instead of writing layer to disk</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mOutputFormatLabel_2">
<property name="text">
@@ -54,41 +67,17 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="mOutputOnFileRadioButton">
<property name="text">
<string>On file</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QgsFileWidget" name="mOutputDatasetFileWidget" native="true"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mOutputDatasetLabel">
<property name="text">
<string>Output dataset</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="mOutputFormatComboBox"/>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="mOutputVirtualRadioButton">
<property name="text">
<string>Virtual</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="mOutputGroupNameLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="mOutputDatasetFileLabel">
<property name="text">
<string>Output file</string>
</property>
@@ -685,8 +674,7 @@
</customwidgets>
<tabstops>
<tabstop>mDatasetsListWidget</tabstop>
<tabstop>mOutputOnFileRadioButton</tabstop>
<tabstop>mOutputVirtualRadioButton</tabstop>
<tabstop>mUseVirtualProviderCheckBox</tabstop>
<tabstop>mOutputFormatComboBox</tabstop>
<tabstop>mOutputGroupNameLineEdit</tabstop>
<tabstop>useExtentCb</tabstop>

0 comments on commit 8f37bba

Please sign in to comment.