Fix vanishing transitions when zooming to state

The main design issue in this plugin is that
there is no clear separation between model (which
pretent to be ScxmlDocument and his childern of
ScxmlTag type) and its views (GraphicsScene
and its children of BaseItem subclasses).
When the "Zoom to State" action is invoked,
the new view is being created, showing just
a part of the ScxmlDocument model. However,
some validation is done only on the view part,
checking that BaseItems belong to the common
GraphicsScene. In case the transition was defined
from internal state node to somewhere outside,
we don't have for it an BaseItem on the gui side,
as we just show the part of the scene. That's why
the validation vanishes the transition when
viewing a zoom.

In general, all the validations should be moved
from gui to the ScxmlDocument / ScxmlTag part.
This in general would require really big refactoring,
or even rewrite.

This patch moves some checks into a model side and
disables direct modifications of the model when
it's not desired.

Fixes: QTCREATORBUG-21676
Change-Id: Ica0771f637a9802dcc0fb87ad04b0ee77a21cda2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Jarek Kobus
2021-01-12 12:12:56 +01:00
parent 484d40258a
commit 2b2cacfc09
7 changed files with 40 additions and 10 deletions

View File

@@ -163,6 +163,7 @@ public:
*/
ScxmlTag *rootTag() const;
ScxmlTag *scxmlRootTag() const;
ScxmlTag *tagForId(const QString &id) const;
void pushRootTag(ScxmlTag *tag);
ScxmlTag *popRootTag();