mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30: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());
|
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());
|
m_context_menu -> popup(e -> globalPos());
|
||||||
}
|
}
|
||||||
e -> accept();
|
e -> accept();
|
||||||
|
|||||||
@@ -415,7 +415,8 @@ void QETElementEditor::setupMenus() {
|
|||||||
* @brief QETElementEditor::contextMenuEvent
|
* @brief QETElementEditor::contextMenuEvent
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
void QETElementEditor::contextMenu(QPoint p) {
|
void QETElementEditor::contextMenu(QPoint p)
|
||||||
|
{
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
menu.addAction(undo);
|
menu.addAction(undo);
|
||||||
menu.addAction(redo);
|
menu.addAction(redo);
|
||||||
@@ -432,6 +433,14 @@ void QETElementEditor::contextMenu(QPoint p) {
|
|||||||
menu.addMenu(paste_from_menu);
|
menu.addMenu(paste_from_menu);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addActions(m_depth_ag -> actions());
|
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);
|
menu.exec(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user