mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
Hide Draw on Canvas option from QgsExtentWidget in modal dialogs
When widget is shown in a modal dialog, we can't offer the option to draw the extent on the canvas Refs #59063
This commit is contained in:
parent
a09a33757a
commit
fbe47ef20c
@ -238,6 +238,8 @@ to permit access to the map canvas)
|
||||
|
||||
virtual void dropEvent( QDropEvent *event );
|
||||
|
||||
virtual void showEvent( QShowEvent *event );
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -238,6 +238,8 @@ to permit access to the map canvas)
|
||||
|
||||
virtual void dropEvent( QDropEvent *event );
|
||||
|
||||
virtual void showEvent( QShowEvent *event );
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -585,8 +585,7 @@ void QgsExtentWidget::setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOptio
|
||||
mCurrentExtentButton->setVisible( true );
|
||||
|
||||
mUseCanvasExtentAction->setVisible( true );
|
||||
if ( drawOnCanvasOption )
|
||||
mDrawOnCanvasAction->setVisible( true );
|
||||
mDrawOnCanvasAction->setVisible( drawOnCanvasOption && !mBlockDrawOnCanvas );
|
||||
|
||||
mCondensedToolButton->setToolTip( tr( "Set to current map canvas extent" ) );
|
||||
mCondensedToolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapIdentification.svg" ) ) );
|
||||
@ -667,3 +666,20 @@ void QgsExtentWidget::dropEvent( QDropEvent *event )
|
||||
mCondensedLineEdit->setHighlighted( false );
|
||||
update();
|
||||
}
|
||||
|
||||
void QgsExtentWidget::showEvent( QShowEvent * )
|
||||
{
|
||||
if ( mFirstShow )
|
||||
{
|
||||
// we don't support select on canvas if the dialog is modal
|
||||
if ( QWidget *parentWindow = window() )
|
||||
{
|
||||
if ( parentWindow->isModal() )
|
||||
{
|
||||
mBlockDrawOnCanvas = true;
|
||||
mDrawOnCanvasAction->setVisible( false );
|
||||
}
|
||||
}
|
||||
mFirstShow = false;
|
||||
}
|
||||
}
|
||||
|
@ -241,6 +241,7 @@ class GUI_EXPORT QgsExtentWidget : public QWidget, private Ui::QgsExtentGroupBox
|
||||
void dragEnterEvent( QDragEnterEvent *event ) override;
|
||||
void dragLeaveEvent( QDragLeaveEvent *event ) override;
|
||||
void dropEvent( QDropEvent *event ) override;
|
||||
void showEvent( QShowEvent *event ) override;
|
||||
|
||||
private slots:
|
||||
|
||||
@ -292,6 +293,10 @@ class GUI_EXPORT QgsExtentWidget : public QWidget, private Ui::QgsExtentGroupBox
|
||||
bool mHasFixedOutputCrs = false;
|
||||
|
||||
QRegularExpression mCondensedRe;
|
||||
|
||||
bool mFirstShow = true;
|
||||
bool mBlockDrawOnCanvas = false;
|
||||
|
||||
void setValid( bool valid );
|
||||
|
||||
void setExtentToLayerExtent( const QString &layerId );
|
||||
|
Loading…
x
Reference in New Issue
Block a user