Skip to content

Commit

Permalink
Autoraise map unit scale tool buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 31, 2018
1 parent 91cebc4 commit 4e3d61c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/gui/qgsunitselectionwidget.cpp
Expand Up @@ -136,7 +136,7 @@ QgsUnitSelectionWidget::QgsUnitSelectionWidget( QWidget *parent )
setFocusProxy( mUnitCombo );

connect( mUnitCombo, static_cast < void ( QComboBox::* )( int ) > ( &QComboBox::currentIndexChanged ), this, &QgsUnitSelectionWidget::toggleUnitRangeButton );
connect( mMapScaleButton, &QPushButton::clicked, this, &QgsUnitSelectionWidget::showDialog );
connect( mMapScaleButton, &QToolButton::clicked, this, &QgsUnitSelectionWidget::showDialog );
connect( mUnitCombo, static_cast < void ( QComboBox::* )( int ) > ( &QComboBox::currentIndexChanged ), this, &QgsUnitSelectionWidget::changed );
}

Expand Down Expand Up @@ -196,7 +196,7 @@ QgsUnitTypes::RenderUnit QgsUnitSelectionWidget::unit() const
QVariant currentData = mUnitCombo->currentData();
if ( currentData.isValid() )
{
return ( QgsUnitTypes::RenderUnit ) currentData.toInt();
return static_cast< QgsUnitTypes::RenderUnit >( currentData.toInt() );
}
//unknown
return QgsUnitTypes::RenderUnknownUnit;
Expand All @@ -211,7 +211,7 @@ void QgsUnitSelectionWidget::setUnit( int unitIndex )

void QgsUnitSelectionWidget::setUnit( QgsUnitTypes::RenderUnit unit )
{
int idx = mUnitCombo->findData( QVariant( ( int ) unit ) );
int idx = mUnitCombo->findData( QVariant( static_cast< int >( unit ) ) );
mUnitCombo->setCurrentIndex( idx == -1 ? 0 : idx );
}

Expand Down
5 changes: 4 additions & 1 deletion src/ui/qgsunitselectionwidget.ui
Expand Up @@ -46,7 +46,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="mMapScaleButton">
<widget class="QToolButton" name="mMapScaleButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
Expand All @@ -63,6 +63,9 @@
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionOptions.svg</normaloff>:/images/themes/default/mActionOptions.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 4e3d61c

Please sign in to comment.