From 6c1458d9c96509d660e824fd6db7007f9d532515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 23 Sep 2008 14:28:18 +0000 Subject: [PATCH] Context Menus when no object has been clicked git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3019 383ad7c9-94d9-4d36-a494-682f7c89f535 --- common/Types.hh | 2 +- widgets/coreWidget/ContextMenu.cc | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/Types.hh b/common/Types.hh index 45355821..e06cf86f 100644 --- a/common/Types.hh +++ b/common/Types.hh @@ -58,7 +58,7 @@ * type an object has, get the dataType from it. */ enum DataType { - /// Empty Objects (Should not be used) + /// None of the other Objects DATA_NONE = 0 , /// Items used for Grouping DATA_GROUP = 1 , diff --git a/widgets/coreWidget/ContextMenu.cc b/widgets/coreWidget/ContextMenu.cc index d93a59f8..74b94c03 100644 --- a/widgets/coreWidget/ContextMenu.cc +++ b/widgets/coreWidget/ContextMenu.cc @@ -140,8 +140,21 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) { } } } else { - contextMenu_->removeAction(typeEntry); - contextMenu_->removeAction(entrySeparator); + + emit updateContextMenu(-1); + + // Add real context Menus first + for ( uint i = 0 ; i < contextMenus_.size(); ++i ) { + if ( contextMenus_[i].contextType == DATA_NONE ) { + contextMenu_->addMenu( contextMenus_[i].menu ); + topLevelAdded++; + } + } + + if ( topLevelAdded == 0 ) { + contextMenu_->removeAction(typeEntry); + contextMenu_->removeAction(entrySeparator); + } } if ( contextSelectionMenu_->isEmpty() ) -- GitLab