forked from qt-creator/qt-creator
QmlDesigner: Add Loader and Repeater to component library
Also fixes some issues with Repeater usage. Fixes: QDS-5149 Change-Id: I259dcb73be634150dd0c5e602165b63112ec958c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -91,6 +91,9 @@ void FormEditorView::modelAttached(Model *model)
|
||||
//This function does the setup of the initial FormEditorItem tree in the scene
|
||||
void FormEditorView::setupFormEditorItemTree(const QmlItemNode &qmlItemNode)
|
||||
{
|
||||
if (!qmlItemNode.hasFormEditorItem())
|
||||
return;
|
||||
|
||||
if (qmlItemNode.isFlowTransition()) {
|
||||
m_scene->addFormEditorItem(qmlItemNode, FormEditorScene::FlowTransition);
|
||||
if (qmlItemNode.hasNodeParent())
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
bool canBeDroppedInView3D() const;
|
||||
bool isMovable() const;
|
||||
bool isResizable() const;
|
||||
bool hasFormEditorItem() const;
|
||||
bool isStackedContainer() const;
|
||||
bool canBeReparentedTo(const ModelNode &potenialParent);
|
||||
QString indexPropertyForStackedContainer() const;
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
bool modelIsResizable() const;
|
||||
bool modelIsRotatable() const;
|
||||
bool modelIsInLayout() const;
|
||||
bool hasFormEditorItem() const;
|
||||
|
||||
QRectF instanceBoundingRect() const;
|
||||
QRectF instanceSceneBoundingRect() const;
|
||||
|
||||
@@ -183,6 +183,11 @@ bool NodeHints::isResizable() const
|
||||
return evaluateBooleanExpression("isResizable", true);
|
||||
}
|
||||
|
||||
bool NodeHints::hasFormEditorItem() const
|
||||
{
|
||||
return evaluateBooleanExpression("hasFormEditorItem", true);
|
||||
}
|
||||
|
||||
bool NodeHints::isStackedContainer() const
|
||||
{
|
||||
if (!isValid())
|
||||
|
||||
@@ -395,6 +395,11 @@ bool QmlItemNode::modelIsInLayout() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlItemNode::hasFormEditorItem() const
|
||||
{
|
||||
return NodeHints::fromModelNode(modelNode()).hasFormEditorItem();
|
||||
}
|
||||
|
||||
QRectF QmlItemNode::instanceBoundingRect() const
|
||||
{
|
||||
return QRectF(QPointF(0, 0), nodeInstance().size());
|
||||
|
||||
@@ -448,4 +448,35 @@ MetaInfo {
|
||||
version: "2.0"
|
||||
}
|
||||
}
|
||||
|
||||
Type {
|
||||
name: "QtQuick.Loader"
|
||||
icon: ":/qtquickplugin/images/item-icon16.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "Loader"
|
||||
category: "e.Qt Quick - Component"
|
||||
libraryIcon: ":/qtquickplugin/images/item-icon.png"
|
||||
version: "2.0"
|
||||
Property { name: "width"; type: "int"; value: 200; }
|
||||
Property { name: "height"; type: "int"; value: 200; }
|
||||
}
|
||||
}
|
||||
|
||||
Type {
|
||||
name: "QtQuick.Repeater"
|
||||
icon: ":/qtquickplugin/images/item-icon16.png"
|
||||
|
||||
Hints {
|
||||
canBeDroppedInFormEditor: false
|
||||
hasFormEditorItem: false
|
||||
}
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "Repeater"
|
||||
category: "e.Qt Quick - Component"
|
||||
libraryIcon: ":/qtquickplugin/images/item-icon.png"
|
||||
version: "2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user