Commit 77f6a432 authored by Marco Benelli's avatar Marco Benelli

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's avatarUlf Hermann <ulf.hermann@qt.io>
parent 33bb20ba
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment