mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-23 00:04:25 -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 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 dropEvent( QDropEvent *event );
|
||||||
|
|
||||||
|
virtual void showEvent( QShowEvent *event );
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -585,8 +585,7 @@ void QgsExtentWidget::setMapCanvas( QgsMapCanvas *canvas, bool drawOnCanvasOptio
|
|||||||
mCurrentExtentButton->setVisible( true );
|
mCurrentExtentButton->setVisible( true );
|
||||||
|
|
||||||
mUseCanvasExtentAction->setVisible( true );
|
mUseCanvasExtentAction->setVisible( true );
|
||||||
if ( drawOnCanvasOption )
|
mDrawOnCanvasAction->setVisible( drawOnCanvasOption && !mBlockDrawOnCanvas );
|
||||||
mDrawOnCanvasAction->setVisible( true );
|
|
||||||
|
|
||||||
mCondensedToolButton->setToolTip( tr( "Set to current map canvas extent" ) );
|
mCondensedToolButton->setToolTip( tr( "Set to current map canvas extent" ) );
|
||||||
mCondensedToolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapIdentification.svg" ) ) );
|
mCondensedToolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapIdentification.svg" ) ) );
|
||||||
@ -667,3 +666,20 @@ void QgsExtentWidget::dropEvent( QDropEvent *event )
|
|||||||
mCondensedLineEdit->setHighlighted( false );
|
mCondensedLineEdit->setHighlighted( false );
|
||||||
update();
|
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 dragEnterEvent( QDragEnterEvent *event ) override;
|
||||||
void dragLeaveEvent( QDragLeaveEvent *event ) override;
|
void dragLeaveEvent( QDragLeaveEvent *event ) override;
|
||||||
void dropEvent( QDropEvent *event ) override;
|
void dropEvent( QDropEvent *event ) override;
|
||||||
|
void showEvent( QShowEvent *event ) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
@ -292,6 +293,10 @@ class GUI_EXPORT QgsExtentWidget : public QWidget, private Ui::QgsExtentGroupBox
|
|||||||
bool mHasFixedOutputCrs = false;
|
bool mHasFixedOutputCrs = false;
|
||||||
|
|
||||||
QRegularExpression mCondensedRe;
|
QRegularExpression mCondensedRe;
|
||||||
|
|
||||||
|
bool mFirstShow = true;
|
||||||
|
bool mBlockDrawOnCanvas = false;
|
||||||
|
|
||||||
void setValid( bool valid );
|
void setValid( bool valid );
|
||||||
|
|
||||||
void setExtentToLayerExtent( const QString &layerId );
|
void setExtentToLayerExtent( const QString &layerId );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user