Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[needs-docs][ui] Better placement for the method combobox and auto op…
…en action

(this is a follow up to PR #33643) better combobox / checkbox placement
  • Loading branch information
nirvn authored and nyalldawson committed Jan 10, 2020
1 parent c9bba3c commit 0bb554c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
17 changes: 14 additions & 3 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -325,10 +325,10 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
connect( cmbIdentifyMode, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsIdentifyResultsDialog::cmbIdentifyMode_currentIndexChanged );
connect( cmbViewMode, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsIdentifyResultsDialog::cmbViewMode_currentIndexChanged );
connect( mExpandNewAction, &QAction::triggered, this, &QgsIdentifyResultsDialog::mExpandNewAction_triggered );
connect( cbxAutoFeatureForm, &QCheckBox::toggled, this, &QgsIdentifyResultsDialog::cbxAutoFeatureForm_toggled );
connect( mExpandAction, &QAction::triggered, this, &QgsIdentifyResultsDialog::mExpandAction_triggered );
connect( mCollapseAction, &QAction::triggered, this, &QgsIdentifyResultsDialog::mCollapseAction_triggered );
connect( mActionCopy, &QAction::triggered, this, &QgsIdentifyResultsDialog::mActionCopy_triggered );
connect( mActionAutoFeatureForm, &QAction::toggled, this, &QgsIdentifyResultsDialog::mActionAutoFeatureForm_toggled );

mOpenFormAction->setDisabled( true );

Expand Down Expand Up @@ -383,7 +383,6 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
cmbIdentifyMode->addItem( tr( "Top down" ), QgsMapToolIdentify::TopDownAll );
cmbIdentifyMode->addItem( tr( "Layer selection" ), QgsMapToolIdentify::LayerSelection );
cmbIdentifyMode->setCurrentIndex( cmbIdentifyMode->findData( identifyMode ) );
cbxAutoFeatureForm->setChecked( mySettings.value( QStringLiteral( "Map/identifyAutoFeatureForm" ), false ).toBool() );

// view modes
cmbViewMode->addItem( tr( "Tree" ), 0 );
Expand Down Expand Up @@ -417,6 +416,18 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
connect( mHelpToolButton, &QAbstractButton::clicked, this, &QgsIdentifyResultsDialog::showHelp );

initSelectionModes();

QMenu *settingsMenu = new QMenu();
QToolButton *settingsButton = new QToolButton();
settingsButton->setAutoRaise( true );
settingsButton->setToolTip( tr( "Identify Settings" ) );
settingsButton->setMenu( settingsMenu );
settingsButton->setPopupMode( QToolButton::InstantPopup );
settingsButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
mIdentifyToolbar->addWidget( settingsButton );

settingsMenu->addAction( mActionAutoFeatureForm );
mActionAutoFeatureForm->setChecked( mySettings.value( QStringLiteral( "Map/identifyAutoFeatureForm" ), false ).toBool() );
}

QgsIdentifyResultsDialog::~QgsIdentifyResultsDialog()
Expand Down Expand Up @@ -2051,7 +2062,7 @@ void QgsIdentifyResultsDialog::cmbViewMode_currentIndexChanged( int index )
stackedWidget->setCurrentIndex( index );
}

void QgsIdentifyResultsDialog::cbxAutoFeatureForm_toggled( bool checked )
void QgsIdentifyResultsDialog::mActionAutoFeatureForm_toggled( bool checked )
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Map/identifyAutoFeatureForm" ), checked );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsidentifyresultsdialog.h
Expand Up @@ -242,7 +242,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti

void mExpandNewAction_triggered( bool checked );

void cbxAutoFeatureForm_toggled( bool checked );
void mActionAutoFeatureForm_toggled( bool checked );

void mExpandAction_triggered( bool checked ) { Q_UNUSED( checked ) expandAll(); }
void mCollapseAction_triggered( bool checked ) { Q_UNUSED( checked ) collapseAll(); }
Expand Down
45 changes: 15 additions & 30 deletions src/ui/qgsidentifyresultsbase.ui
Expand Up @@ -72,6 +72,7 @@
<addaction name="separator"/>
<addaction name="mActionCopy"/>
<addaction name="mActionPrint"/>
<addaction name="separator"/>
</widget>
</item>
<item>
Expand Down Expand Up @@ -115,6 +116,12 @@
</item>
<item>
<widget class="QComboBox" name="cmbIdentifyMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
</property>
Expand All @@ -123,36 +130,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_43">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="cbxAutoFeatureForm">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblAutoFeatureForm">
<property name="text">
<string>Auto open form</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -388,6 +365,14 @@
<string>Identify Features by Radius</string>
</property>
</action>
<action name="mActionAutoFeatureForm">
<property name="text">
<string>Auto open form for single feature results</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down

0 comments on commit 0bb554c

Please sign in to comment.