From 77f6a4321eba9c9d74d93e4668bc5edc3583d35f Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Thu, 10 Aug 2017 14:05:59 +0200 Subject: [PATCH] SCXML editor: allow eventless transitions According to SCXML specification (https://www.w3.org/TR/scxml/), the 'event' attribute is not mandatory in 'transition' tags. Also, as specified in section 3.12.1, eventless transitions are handled differently, and will be taken whenever the 'cond' attribute evaluates to 'true'. This patch removes the automatic assignment of 'event' property in the tag constructors, but restore it when a new transition is done in the editor. In this way, the user can delete the unneeded events without them being restored when reloading the document. Task-number: QTCREATORBUG-18345 Change-Id: I96d6860ad3ed58ab49e83d3328e88ef984f40fa4 Reviewed-by: Ulf Hermann --- src/plugins/scxmleditor/plugin_interface/connectableitem.cpp | 1 + src/plugins/scxmleditor/plugin_interface/scxmltag.cpp | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp index 853d9d1b252..82200f2a57d 100644 --- a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp +++ b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp @@ -230,6 +230,7 @@ bool ConnectableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event) else newTag = new ScxmlTag(Transition, tag()->document()); newTag->setAttribute("type", "external"); + newTag->setAttribute("event", tag()->document()->nextUniqueId("Transition")); m_newTransition->init(newTag); tag()->document()->addTag(tag(), newTag); diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp index 0548972ad01..f44ca314b67 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp +++ b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp @@ -168,9 +168,6 @@ void ScxmlTag::initId() case History: setAttribute("id", m_document->nextUniqueId("History")); break; - case Transition: - setAttribute("event", m_document->nextUniqueId("Transition")); - break; case Final: setAttribute("id", m_document->nextUniqueId("Final")); break;