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.
This commit is contained in:
Kimmo Varis 2011-08-24 23:14:28 +03:00
parent 1f4e1e0ffe
commit 047984ea89
2 changed files with 7 additions and 5 deletions

View File

@ -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)

View File

@ -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