Skip to content

Commit

Permalink
Turn the extent checkboxes into radiobuttons
Browse files Browse the repository at this point in the history
more coherent with their behaviour (they are mutually exclusive)
  • Loading branch information
DelazJ committed Sep 29, 2021
1 parent 6826531 commit 508dd0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
19 changes: 5 additions & 14 deletions src/app/mesh/qgsmeshcalculatordialog.cpp
Expand Up @@ -63,8 +63,7 @@ QgsMeshCalculatorDialog::QgsMeshCalculatorDialog( QgsMeshLayer *meshLayer, QWidg
connect( mAllTimesButton, &QPushButton::clicked, this, &QgsMeshCalculatorDialog::mAllTimesButton_clicked );
connect( mExpressionTextEdit, &QTextEdit::textChanged, this, &QgsMeshCalculatorDialog::updateInfoMessage );

connect( useMaskCb, &QCheckBox::stateChanged, this, &QgsMeshCalculatorDialog::toggleExtendMask );
connect( useExtentCb, &QCheckBox::stateChanged, this, &QgsMeshCalculatorDialog::toggleExtendMask );
connect( useMaskCb, &QRadioButton::toggled, this, &QgsMeshCalculatorDialog::toggleExtendMask );
maskBox->setVisible( false );

mXMaxSpinBox->setShowClearButton( false );
Expand Down Expand Up @@ -279,19 +278,11 @@ void QgsMeshCalculatorDialog::datasetGroupEntry( const QModelIndex &index )
mExpressionTextEdit->insertPlainText( QStringLiteral( " %1 " ).arg( group ) );
}

void QgsMeshCalculatorDialog::toggleExtendMask( int state )
void QgsMeshCalculatorDialog::toggleExtendMask()
{
Q_UNUSED( state )
if ( useMaskCb->checkState() == Qt::Checked )
{
extendBox->setVisible( false );
maskBox->setVisible( true );
}
else
{
extendBox->setVisible( true );
maskBox->setVisible( false );
}
bool visible = useMaskCb->isChecked();
extendBox->setVisible( !visible );
maskBox->setVisible( visible );
}

void QgsMeshCalculatorDialog::updateInfoMessage()
Expand Down
2 changes: 1 addition & 1 deletion src/app/mesh/qgsmeshcalculatordialog.h
Expand Up @@ -45,7 +45,7 @@ class APP_EXPORT QgsMeshCalculatorDialog: public QDialog, private Ui::QgsMeshCal
void datasetGroupEntry( const QModelIndex &index );
void mCurrentLayerExtentButton_clicked();
void mAllTimesButton_clicked();
void toggleExtendMask( int state );
void toggleExtendMask();
void updateInfoMessage();
void onOutputRadioButtonChange();
void onOutputFormatChange();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/mesh/qgsmeshcalculatordialogbase.ui
Expand Up @@ -100,7 +100,7 @@
<widget class="QWidget" name="horizontalWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="useExtentCb">
<widget class="QRadioButton" name="useExtentCb">
<property name="text">
<string>Current extent</string>
</property>
Expand All @@ -113,7 +113,7 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="useMaskCb">
<widget class="QRadioButton" name="useMaskCb">
<property name="text">
<string>Mask layer</string>
</property>
Expand Down

0 comments on commit 508dd0f

Please sign in to comment.