Element editor and diagram editor : context menu display only enabled actions

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5283 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-03-31 11:21:55 +00:00
parent 819c6c6f86
commit 250b2d42fe
2 changed files with 19 additions and 3 deletions

View File

@@ -415,7 +415,8 @@ void QETElementEditor::setupMenus() {
* @brief QETElementEditor::contextMenuEvent
* @param event
*/
void QETElementEditor::contextMenu(QPoint p) {
void QETElementEditor::contextMenu(QPoint p)
{
QMenu menu(this);
menu.addAction(undo);
menu.addAction(redo);
@@ -432,6 +433,14 @@ void QETElementEditor::contextMenu(QPoint p) {
menu.addMenu(paste_from_menu);
menu.addSeparator();
menu.addActions(m_depth_ag -> actions());
//Remove from the context menu the actions which are disabled.
const QList<QAction *>actions = menu.actions();
for(QAction *action : actions)
{
if(!action->isEnabled())
menu.removeAction(action);
}
menu.exec(p);
}