From 356973a1bd2389eec058872f7a0b79e66b6fa8ec Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 8 Jun 2014 18:30:09 +0200 Subject: [PATCH] Remove GUI Editor menu when unloading the plugin. --- .../src/plugins/gui_editor/gui_editor_window.cpp | 11 +++++++++++ .../studio/src/plugins/gui_editor/gui_editor_window.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp index 24ecc5cfc..e48a37ba6 100644 --- a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -55,6 +55,7 @@ namespace GUIEditor GUIEditorWindow::GUIEditorWindow(QWidget *parent) : QMainWindow(parent) { + menu = NULL; m_ui.setupUi(this); messageProcessor = new CEditorMessageProcessor; m_undoStack = new QUndoStack(this); @@ -112,6 +113,8 @@ namespace GUIEditor { writeSettings(); + removeMenus(); + delete messageProcessor; messageProcessor = NULL; @@ -382,8 +385,16 @@ namespace GUIEditor a = new QAction( "Add Widget", this ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) ); m->addAction( a ); + + menu = m; } } + + void GUIEditorWindow::removeMenus() + { + delete menu; + menu = NULL; + } void GUIEditorWindow::readSettings() { diff --git a/code/studio/src/plugins/gui_editor/gui_editor_window.h b/code/studio/src/plugins/gui_editor/gui_editor_window.h index e1a8b8b2d..1362e4671 100644 --- a/code/studio/src/plugins/gui_editor/gui_editor_window.h +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.h @@ -26,6 +26,8 @@ class QtTreePropertyBrowser; +class QMenu; + namespace GUIEditor { @@ -66,6 +68,7 @@ private Q_SLOTS: private: void createMenus(); + void removeMenus(); void readSettings(); @@ -88,6 +91,8 @@ private: CPropBrowserCtrl browserCtrl; QString currentProject; QString currentProjectFile; + + QMenu *menu; }; }