QmlDesigner: Remove redundancy

Remove redudant occurrences of QtQuick.Window.Window/QtQuick.Dialogs.Dialog

Change-Id: I6d3c37f2badfc90d53993d55679e1bc97d70705f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2019-03-20 13:20:00 +01:00
parent 75043690e3
commit 613e15dba6
3 changed files with 6 additions and 14 deletions

View File

@@ -72,7 +72,7 @@ WidgetInfo StatesEditorView::widgetInfo()
void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
{ {
checkForWindow(); checkForStatesAvailability();
} }
void StatesEditorView::toggleStatesViewExpanded() void StatesEditorView::toggleStatesViewExpanded()
@@ -200,12 +200,10 @@ void StatesEditorView::duplicateCurrentState()
setCurrentState(newState); setCurrentState(newState);
} }
void StatesEditorView::checkForWindow() void StatesEditorView::checkForStatesAvailability()
{ {
if (m_statesEditorWidget) if (m_statesEditorWidget)
m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Window") m_statesEditorWidget->showAddNewStatesButton(rootModelNode().metaInfo().isSubclassOf("QtQuick.Item"));
&& !rootModelNode().metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog")
&& !rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Popup"));
} }
void StatesEditorView::setCurrentState(const QmlModelState &state) void StatesEditorView::setCurrentState(const QmlModelState &state)
@@ -315,7 +313,7 @@ void StatesEditorView::modelAttached(Model *model)
if (m_statesEditorWidget) if (m_statesEditorWidget)
m_statesEditorWidget->setNodeInstanceView(nodeInstanceView()); m_statesEditorWidget->setNodeInstanceView(nodeInstanceView());
checkForWindow(); checkForStatesAvailability();
resetModel(); resetModel();
} }

View File

@@ -93,7 +93,7 @@ private:
void resetModel(); void resetModel();
void addState(); void addState();
void duplicateCurrentState(); void duplicateCurrentState();
void checkForWindow(); void checkForStatesAvailability();
private: private:
QPointer<StatesEditorModel> m_statesEditorModel; QPointer<StatesEditorModel> m_statesEditorModel;

View File

@@ -51,13 +51,7 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
if (modelNode.metaInfo().isSubclassOf("QtQuick.Item")) if (modelNode.metaInfo().isSubclassOf("QtQuick.Item"))
return true; return true;
if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode()) if (modelNode.metaInfo().isGraphicalItem() && modelNode.isRootNode())
return true;
if (modelNode.metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog") && modelNode.isRootNode())
return true;
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Popup"))
return true; return true;
return false; return false;