mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +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:
@@ -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