From 28270e53a98a285e17663acd5044782c949016c2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 17 Oct 2020 20:06:53 +0200 Subject: [PATCH] Gui: [skip ci] workaround for Qt5.12.9 that causes a crash in the parameter editor for right clicks in an empty area --- src/Gui/DlgParameterImp.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 6054c4f39736..4fdbf8dcd3ee 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -701,10 +701,17 @@ bool ParameterValue::edit ( const QModelIndex & index, EditTrigger trigger, QEve void ParameterValue::contextMenuEvent ( QContextMenuEvent* event ) { QTreeWidgetItem* item = currentItem(); - if (item && item->isSelected()) + if (item && item->isSelected()) { menuEdit->popup(event->globalPos()); - else - menuNew->popup(event->globalPos()); + } + else { + // There is a regression in Qt 5.12.9 where it isn't checked that a sub-menu (here menuNew) + // can be popped up without its parent menu (menuEdit) and thus causes a crash. + // A workaround is to simply call exec() instead. + // + //menuNew->popup(event->globalPos()); + menuNew->exec(event->globalPos()); + } } void ParameterValue::keyPressEvent (QKeyEvent* event)