forked from qt-creator/qt-creator
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:
@@ -649,6 +649,14 @@ ScxmlTag *ScxmlDocument::scxmlRootTag() const
|
||||
return tag;
|
||||
}
|
||||
|
||||
ScxmlTag *ScxmlDocument::tagForId(const QString &id) const
|
||||
{
|
||||
if (id.isEmpty())
|
||||
return nullptr;
|
||||
ScxmlTag *root = scxmlRootTag();
|
||||
return root ? root->tagForId(id) : nullptr;
|
||||
}
|
||||
|
||||
ScxmlTag *ScxmlDocument::rootTag() const
|
||||
{
|
||||
return m_rootTags.isEmpty() ? 0 : m_rootTags.last();
|
||||
|
||||
Reference in New Issue
Block a user