From 2e8505378ea91424f31be82f2041572fe9950319 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 20 Oct 2015 13:00:00 +0200 Subject: [PATCH] Only highlight feature of active attribute dialog Fix #13634 --- src/gui/qgsattributedialog.cpp | 10 ++++++++++ src/gui/qgsattributedialog.h | 9 +++++++++ 2 files changed, 19 insertions(+) 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;