QmlDesigner: Add support for Dialog

Change-Id: I8a2972f80ae79835018870eda7b11a817353bf94
Task-numbner: QTCREATORBUG-22120
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2019-03-20 12:56:12 +01:00
parent 9e3b6d77e1
commit 4c746531d8
6 changed files with 60 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.1
Rectangle {
property string title
property var clickedButton
property var modality
property var standardButtons
property alias contentItem: contentArea
property int maximumWidth: 0
property int minimumWidth: 0
property int maximumHeight: 0
property int minimumHeight: 0
Item {
id: contentArea
anchors.top: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.top
}
}

View File

@@ -622,10 +622,12 @@ QObject *ObjectNodeInstance::createPrimitive(const QString &typeName, int majorN
|| typeName == "QtQuick.Controls/Drawer" || typeName == "QtQuick.Controls/Drawer"
|| typeName == "QtQuick.Controls/Dialog" || typeName == "QtQuick.Controls/Dialog"
|| typeName == "QtQuick.Controls/Menu" || typeName == "QtQuick.Controls/Menu"
|| typeName == "QtQuick.Controls/Pane"
|| typeName == "QtQuick.Controls/ToolTip") || typeName == "QtQuick.Controls/ToolTip")
polishTypeName = "QtQuick/Item"; polishTypeName = "QtQuick/Item";
const QHash<QString, QString> mockHash = {{"QtQuick.Controls/SwipeView","qrc:/qtquickplugin/mockfiles/SwipeView.qml"}}; const QHash<QString, QString> mockHash = {{"QtQuick.Controls/SwipeView","qrc:/qtquickplugin/mockfiles/SwipeView.qml"},
{"QtQuick.Dialogs/Dialog","qrc:/qtquickplugin/mockfiles/Dialog.qml"}};
QObject *object = nullptr; QObject *object = nullptr;

View File

@@ -6,5 +6,6 @@
<file>mockfiles/Window.qml</file> <file>mockfiles/Window.qml</file>
<file>mockfiles/SwipeView.qml</file> <file>mockfiles/SwipeView.qml</file>
<file>mockfiles/GenericBackend.qml</file> <file>mockfiles/GenericBackend.qml</file>
<file>mockfiles/Dialog.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -204,6 +204,7 @@ void StatesEditorView::checkForWindow()
{ {
if (m_statesEditorWidget) if (m_statesEditorWidget)
m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Window") m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Window")
&& !rootModelNode().metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog")
&& !rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Popup")); && !rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Popup"));
} }

View File

@@ -1550,6 +1550,7 @@ bool NodeMetaInfo::isGraphicalItem() const
{ {
return isSubclassOf("QtQuick.Item") return isSubclassOf("QtQuick.Item")
|| isSubclassOf("QtQuick.Window.Window") || isSubclassOf("QtQuick.Window.Window")
|| isSubclassOf("QtQuick.Dialogs.Dialog")
|| isSubclassOf("QtQuick.Controls.Popup"); || isSubclassOf("QtQuick.Controls.Popup");
} }

View File

@@ -54,6 +54,9 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode()) if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode())
return true; return true;
if (modelNode.metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog") && modelNode.isRootNode())
return true;
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Popup")) if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Popup"))
return true; return true;