mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
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:
@@ -1145,7 +1145,14 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
m_context_menu -> addActions(qde -> m_selection_actions_group.actions());
|
||||
}
|
||||
|
||||
// affiche le menu contextuel
|
||||
//Remove from the context menu the actions which are disabled.
|
||||
const QList<QAction *> actions = m_context_menu->actions();
|
||||
for(QAction *action : actions)
|
||||
{
|
||||
if(!action->isEnabled())
|
||||
m_context_menu->removeAction(action);
|
||||
}
|
||||
|
||||
m_context_menu -> popup(e -> globalPos());
|
||||
}
|
||||
e -> accept();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user