forked from qt-creator/qt-creator
QmlDesigner: Fix Connections status in ContextMenu
Task-number: QDS-8521 Change-Id: Id0b835fb14b18563d4ecc0c1b2039b9bb181c32c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <QImageReader>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
#include <QScopeGuard>
|
||||
|
||||
#include <exception>
|
||||
|
||||
@@ -610,31 +611,29 @@ public:
|
||||
{
|
||||
menu()->clear();
|
||||
|
||||
menu()->setEnabled(true);
|
||||
|
||||
const auto selection = selectionContext();
|
||||
|
||||
bool showMenu = false;
|
||||
auto cleanup = qScopeGuard([&]{ menu()->setEnabled(showMenu); });
|
||||
|
||||
if (!selection.isValid())
|
||||
return;
|
||||
if (!selection.singleNodeIsSelected())
|
||||
return;
|
||||
if (!action()->isEnabled())
|
||||
return;
|
||||
|
||||
ModelNode currentNode = selection.currentSingleSelectedNode();
|
||||
|
||||
if (!currentNode.isValid())
|
||||
return;
|
||||
if (!currentNode.hasId())
|
||||
return;
|
||||
showMenu = true;
|
||||
|
||||
QmlObjectNode currentObjectNode(currentNode);
|
||||
|
||||
QStringList signalsList = getSignalsList(currentNode);
|
||||
QList<SlotList> slotsLists = getSlotsLists(currentNode);
|
||||
|
||||
if (!currentNode.hasId()) {
|
||||
menu()->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const ModelNode &connectionNode : currentObjectNode.getAllConnections()) {
|
||||
for (const AbstractProperty &property : connectionNode.properties()) {
|
||||
if (property.isSignalHandlerProperty() && property.name() != "target") {
|
||||
|
Reference in New Issue
Block a user