Skip to content
Permalink
Browse files

Move symmetric widgets into a collapsible group box

These are advanced settings which we don't want to show
up front, at risk of hurting UI simplicity
  • Loading branch information
nyalldawson committed Sep 14, 2018
1 parent 0f15735 commit f2c916098c3ffa25dff1f9b14b096ff7860f0f2c
Showing with 69 additions and 95 deletions.
  1. +13 −10 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
  2. +56 −85 src/ui/qgsgraduatedsymbolrendererv2widget.ui
@@ -524,6 +524,9 @@ QgsGraduatedSymbolRendererWidget::QgsGraduatedSymbolRendererWidget( QgsVectorLay
// initialize from previously set renderer
updateUiFromRenderer();

// default to collapsed symmetric group for ui simplicity
mGroupBoxSymmetric->setCollapsed( true ); //

// menus for data-defined rotation/size
QMenu *advMenu = new QMenu( this );

@@ -580,7 +583,7 @@ void QgsGraduatedSymbolRendererWidget::connectUpdateHandlers()
connect( mModel, &QgsGraduatedSymbolRendererModel::rowsMoved, this, &QgsGraduatedSymbolRendererWidget::rowsMoved );
connect( mModel, &QAbstractItemModel::dataChanged, this, &QgsGraduatedSymbolRendererWidget::modelDataChanged );

connect( cbxClassifySymmetric, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
connect( mGroupBoxSymmetric, &QGroupBox::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
connect( cbxAstride, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
connect( cboSymmetryPointForPretty, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
connect( spinSymmetryPointForOtherMethods, static_cast<void( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
@@ -601,7 +604,7 @@ void QgsGraduatedSymbolRendererWidget::disconnectUpdateHandlers()
disconnect( mModel, &QgsGraduatedSymbolRendererModel::rowsMoved, this, &QgsGraduatedSymbolRendererWidget::rowsMoved );
disconnect( mModel, &QAbstractItemModel::dataChanged, this, &QgsGraduatedSymbolRendererWidget::modelDataChanged );

disconnect( cbxClassifySymmetric, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
disconnect( mGroupBoxSymmetric, &QGroupBox::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
disconnect( cbxAstride, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
disconnect( cboSymmetryPointForPretty, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
disconnect( spinSymmetryPointForOtherMethods, static_cast<void( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
@@ -626,7 +629,7 @@ void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )
case QgsGraduatedSymbolRenderer::EqualInterval:
case QgsGraduatedSymbolRenderer::StdDev:
{
cbxClassifySymmetric->setVisible( true );
mGroupBoxSymmetric->setVisible( true );
cbxAstride->setVisible( true );
cboSymmetryPointForPretty->setVisible( false );
spinSymmetryPointForOtherMethods->setVisible( true );
@@ -636,7 +639,7 @@ void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )

case QgsGraduatedSymbolRenderer::Pretty:
{
cbxClassifySymmetric->setVisible( true );
mGroupBoxSymmetric->setVisible( true );
cbxAstride->setVisible( true );
spinSymmetryPointForOtherMethods->setVisible( false );
cboSymmetryPointForPretty->setVisible( true );
@@ -651,7 +654,7 @@ void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )
case QgsGraduatedSymbolRenderer::Jenks:
case QgsGraduatedSymbolRenderer::Custom:
{
cbxClassifySymmetric->setVisible( false );
mGroupBoxSymmetric->setVisible( false );
cbxAstride->setVisible( false );
cboSymmetryPointForPretty->setVisible( false );
spinSymmetryPointForOtherMethods->setVisible( false );
@@ -662,14 +665,14 @@ void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )

if ( mRenderer->useSymmetricMode() )
{
cbxClassifySymmetric->setChecked( true );
mGroupBoxSymmetric->setChecked( true );
spinSymmetryPointForOtherMethods->setEnabled( true );
cbxAstride->setEnabled( true );
cboSymmetryPointForPretty->setEnabled( true );
}
else
{
cbxClassifySymmetric->setChecked( false );
mGroupBoxSymmetric->setChecked( false );
spinSymmetryPointForOtherMethods->setEnabled( false );
cbxAstride->setEnabled( false );
cboSymmetryPointForPretty->setEnabled( false );
@@ -903,7 +906,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
if ( spinSymmetryPointForOtherMethods->value() < ( minimum + ( maximum - minimum ) / 100. ) || spinSymmetryPointForOtherMethods->value() > ( maximum - ( maximum - minimum ) / 100. ) )
spinSymmetryPointForOtherMethods->setValue( minimum + ( maximum - minimum ) / 2. );

if ( cbxClassifySymmetric->isChecked() )
if ( mGroupBoxSymmetric->isChecked() )
{
useSymmetricMode = true;
symmetryPoint = spinSymmetryPointForOtherMethods->value();
@@ -926,7 +929,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
if ( spinSymmetryPointForOtherMethods->value() < ( minimum + ( maximum - minimum ) / 100. ) || spinSymmetryPointForOtherMethods->value() > ( maximum - ( maximum - minimum ) / 100. ) )
spinSymmetryPointForOtherMethods->setValue( minimum + ( maximum - minimum ) / 2. );

if ( cbxClassifySymmetric->isChecked() )
if ( mGroupBoxSymmetric->isChecked() )
{
useSymmetricMode = true;
symmetryPoint = spinSymmetryPointForOtherMethods->value();
@@ -938,7 +941,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
case QgsGraduatedSymbolRenderer::Pretty:
{
mode = QgsGraduatedSymbolRenderer::Pretty;
if ( cbxClassifySymmetric->isChecked() )
if ( mGroupBoxSymmetric->isChecked() )
{
useSymmetricMode = true;
astride = cbxAstride->isChecked();
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>952</width>
<height>554</height>
<width>482</width>
<height>618</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -369,87 +369,52 @@ Negative rounds to powers of 10</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<widget class="QgsCollapsibleGroupBoxBasic" name="mGroupBoxSymmetric">
<property name="title">
<string>Symmetic Classification</string>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
<property name="checkable">
<bool>true</bool>
</property>
<item>
<widget class="QCheckBox" name="cbxClassifySymmetric">
<property name="enabled">
<bool>true</bool>
</property>
<property name="visible">
<bool>true</bool>
</property>
<property name="text">
<string>Symmetric around:</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QgsDoubleSpinBox" name="spinSymmetryPointForOtherMethods">
<property name="specialValueText">
<string/>
</property>
<property name="minimum">
<double>-99999999999999995164818811802792197885196090803013355167206819763650035712.000000000000000</double>
</property>
<property name="maximum">
<double>99999999999999995164818811802792197885196090803013355167206819763650035712.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboSymmetryPointForPretty"/>
</item>
<item>
<widget class="QCheckBox" name="cbxAstride">
<property name="text">
<string>with a class astride that value</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
<item row="0" column="1">
<widget class="QgsDoubleSpinBox" name="spinSymmetryPointForOtherMethods">
<property name="specialValueText">
<string/>
</property>
<property name="minimum">
<double>-99999999999999995164818811802792197885196090803013355167206819763650035712.000000000000000</double>
</property>
<property name="maximum">
<double>99999999999999995164818811802792197885196090803013355167206819763650035712.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Around</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="cboSymmetryPointForPretty"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="cbxAstride">
<property name="text">
<string>Create class astride symmetry value</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -548,15 +513,15 @@ Negative rounds to powers of 10</string>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsFieldExpressionWidget</class>
<class>QgsUnitSelectionWidget</class>
<extends>QWidget</extends>
<header>qgsfieldexpressionwidget.h</header>
<header>qgsunitselectionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
<class>QgsFieldExpressionWidget</class>
<extends>QWidget</extends>
<header>qgsunitselectionwidget.h</header>
<header>qgsfieldexpressionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
@@ -571,6 +536,12 @@ Negative rounds to powers of 10</string>
<header>qgsgraduatedhistogramwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mExpressionWidget</tabstop>

0 comments on commit f2c9160

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