From c19eb60d2fe797c475881cfa46666133e410fc70 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Thu, 29 Jan 2015 16:57:04 +0100 Subject: [PATCH] Fix graphical glitches caused by empty menu on attribute dialog Fix #12061 --- src/gui/qgsattributedialog.cpp | 10 +++++++--- src/gui/qgsattributedialog.h | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/qgsattributedialog.cpp b/src/gui/qgsattributedialog.cpp index f18acbbb303..52343bc3bc8 100644 --- a/src/gui/qgsattributedialog.cpp +++ b/src/gui/qgsattributedialog.cpp @@ -109,12 +109,16 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); - mMenuBar = new QMenuBar( this ); QgsActionMenu* menu = new QgsActionMenu( layer, &mAttributeForm->feature(), this ); if ( menu->actions().size() > 0 ) { - mMenuBar->addMenu( menu ); - layout()->setMenuBar( mMenuBar ); + QMenuBar* menuBar = new QMenuBar( this ); + menuBar->addMenu( menu ); + layout()->setMenuBar( menuBar ); + } + else + { + delete menu; } restoreGeometry(); diff --git a/src/gui/qgsattributedialog.h b/src/gui/qgsattributedialog.h index 4faa5fdd471..c570d5428af 100644 --- a/src/gui/qgsattributedialog.h +++ b/src/gui/qgsattributedialog.h @@ -135,7 +135,6 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog bool mShowDialogButtons; QString mReturnvarname; QgsAttributeForm* mAttributeForm; - QMenuBar* mMenuBar; QgsFeature *mOwnedFeature; // true if this dialog is editable