Skip to content
Permalink
Browse files
Only make the extent widget menu a menu button popup is a canvas is p…
…resent
  • Loading branch information
nirvn committed Jan 6, 2022
1 parent d8ad923 commit 678f95eecdc3c81aeebb38d592a3960c0a9d74fc
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/gui/qgsextentwidget.cpp
@@ -83,12 +83,8 @@ QgsExtentWidget::QgsExtentWidget( QWidget *parent, WidgetStyle style )
mMenu->addAction( mDrawOnCanvasAction );
mMenu->addAction( mUseCurrentExtentAction );

mCondensedToolButton->setToolTip( tr( "Set to current map canvas extent" ) );
mCondensedToolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapIdentification.svg" ) ) );
connect( mCondensedToolButton, &QAbstractButton::clicked, this, &QgsExtentWidget::setOutputExtentFromCurrent );

mCondensedToolButton->setMenu( mMenu );
mCondensedToolButton->setPopupMode( QToolButton::MenuButtonPopup );
mCondensedToolButton->setPopupMode( QToolButton::InstantPopup );

mXMinLineEdit->setValidator( new QgsDoubleValidator( this ) );
mXMaxLineEdit->setValidator( new QgsDoubleValidator( this ) );
@@ -539,13 +535,23 @@ void QgsExtentWidget::setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOptio
mUseCanvasExtentAction->setVisible( true );
if ( drawOnCanvasOption )
mDrawOnCanvasAction->setVisible( true );

mCondensedToolButton->setToolTip( tr( "Set to current map canvas extent" ) );
mCondensedToolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapIdentification.svg" ) ) );
connect( mCondensedToolButton, &QAbstractButton::clicked, this, &QgsExtentWidget::setOutputExtentFromCurrent );
mCondensedToolButton->setPopupMode( QToolButton::MenuButtonPopup );
}
else
{
mButtonDrawOnCanvas->setVisible( false );
mCurrentExtentButton->setVisible( false );
mUseCanvasExtentAction->setVisible( false );
mUseCanvasExtentAction->setVisible( false );

mCondensedToolButton->setToolTip( QString() );
mCondensedToolButton->setIcon( QIcon() );
disconnect( mCondensedToolButton, &QAbstractButton::clicked, this, &QgsExtentWidget::setOutputExtentFromCurrent );
mCondensedToolButton->setPopupMode( QToolButton::InstantPopup );
}
}

0 comments on commit 678f95e

Please sign in to comment.