diff --git a/src/gui/qgsattributedialog.cpp b/src/gui/qgsattributedialog.cpp index f1f8c6691182..8738944636ec 100644 --- a/src/gui/qgsattributedialog.cpp +++ b/src/gui/qgsattributedialog.cpp @@ -125,3 +125,13 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, const restoreGeometry(); focusNextChild(); } + +bool QgsAttributeDialog::event( QEvent* e ) +{ + if ( e->type() == QEvent::WindowActivate && mHighlight ) + mHighlight->show(); + else if ( e->type() == QEvent::WindowDeactivate && mHighlight ) + mHighlight->hide(); + + return QDialog::event( e ); +} diff --git a/src/gui/qgsattributedialog.h b/src/gui/qgsattributedialog.h index 90838854b288..8f8b3675851a 100644 --- a/src/gui/qgsattributedialog.h +++ b/src/gui/qgsattributedialog.h @@ -118,6 +118,15 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog */ void setEditCommandMessage( const QString& message ) { mAttributeForm->setEditCommandMessage( message ); } + /** + * Intercept window activate/deactive events to show/hide the highlighted feature. + * + * @param e The event + * + * @return The same as the parent QDialog + */ + virtual bool event( QEvent *e ) override; + public slots: void accept() override;