From 047984ea8947a49202a34266bd66530dde10dda6 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Wed, 24 Aug 2011 23:14:28 +0300 Subject: [PATCH] GUI: Fix extra menu separator in File-menu. The extra menu separator was added before the MRU menu items. When updating the (menu) MRU items existing items were first removed and new items added back. But the added separator was not removed. --- gui/mainwindow.cpp | 5 +++-- gui/mainwindow.h | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a6e6a4f73..08ba05cfc 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -145,6 +145,7 @@ MainWindow::MainWindow() : connect(mRecentProjectActs[i], SIGNAL(triggered()), this, SLOT(OpenRecentProject())); } + mRecentProjectActs[MaxRecentProjects] = NULL; // The separator mUI.mActionProjectMRU->setVisible(false); UpdateMRUMenuItems(); } @@ -1042,7 +1043,7 @@ void MainWindow::OpenRecentProject() void MainWindow::UpdateMRUMenuItems() { - for (int i = 0; i < MaxRecentProjects; i++) + for (int i = 0; i < MaxRecentProjects + 1; i++) { if (mRecentProjectActs[i] != NULL) mUI.mMenuFile->removeAction(mRecentProjectActs[i]); @@ -1061,7 +1062,7 @@ void MainWindow::UpdateMRUMenuItems() } if (numRecentProjects > 1) - mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU); + mRecentProjectActs[numRecentProjects] = mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU); } void MainWindow::AddProjectMRU(const QString &project) diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 9abbdb450..1c9ca2ad3 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -473,9 +473,10 @@ private: bool mExiting; /** - * @brief Project MRU menu actions. - */ - QAction *mRecentProjectActs[MaxRecentProjects]; + * @brief Project MRU menu actions. + * List of MRU menu actions. Needs also to store the separator. + */ + QAction *mRecentProjectActs[MaxRecentProjects + 1]; }; /// @} #endif // MAINWINDOW_H