aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-10-21 09:13:03 +0200
committerEike Ziller <eike.ziller@qt.io>2021-10-21 09:13:03 +0200
commitbb9774de92dd2c8da85c5231ca5646b078cb42a3 (patch)
treee43470cf6f3a7c965b7dc8a349593dadd03ee65e /share
parentf41bebc843a8b4ab1ab29562ba200b032b5ab5ac (diff)
parent5377253612801b2f92e0b55e40c3ce0dd2574b09 (diff)
Merge remote-tracking branch 'origin/6.0'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri Change-Id: If8baed5564470e550a0ba5c7720915217eec2412
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AdjustableArrow.qml2
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AreaLightHandle.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/CameraFrustum.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/DirectionalDraggable.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml3
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/FadeHandle.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/HelperGrid.qml4
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/LightModel.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/Line3D.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/PlanarDraggable.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateGizmo.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateRing.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleGizmo.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleRod.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SelectionBox.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SpotLightHandle.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp29
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h3
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp4
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp42
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp37
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp27
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h11
-rw-r--r--share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml61
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml1
-rw-r--r--share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml2
30 files changed, 140 insertions, 104 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AdjustableArrow.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AdjustableArrow.qml
index d71b245d33..fe5d3bd5ed 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AdjustableArrow.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AdjustableArrow.qml
@@ -31,6 +31,7 @@ DirectionalDraggable {
id: arrowRoot
Model {
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: LineGeometry {
id: lineGeometry
name: "Edit 3D ScalableArrow"
@@ -43,6 +44,7 @@ DirectionalDraggable {
Model {
id: arrowHead
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cone"
materials: [ arrowRoot.material ]
y: arrowRoot.length - 3
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AreaLightHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AreaLightHandle.qml
index 78e97e81d4..c2f55bdd43 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AreaLightHandle.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/AreaLightHandle.qml
@@ -42,6 +42,7 @@ DirectionalDraggable {
Model {
id: handle
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/CameraFrustum.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/CameraFrustum.qml
index adf3d53ab9..2e53ff5d40 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/CameraFrustum.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/CameraFrustum.qml
@@ -35,6 +35,7 @@ Model {
property Node targetNode: null
property Node scene: null
property bool selected: false
+ readonly property bool _edit3dLocked: true // Make this non-pickable
function updateGeometry()
{
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/DirectionalDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/DirectionalDraggable.qml
index 5a2f0911dd..2be5344521 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/DirectionalDraggable.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/DirectionalDraggable.qml
@@ -41,6 +41,7 @@ Model {
property real offset: 0
readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering
+ readonly property bool _edit3dLocked: true // Make this non-pickable
property vector3d _scenePosPressed
property real _posPressed
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml
index ebc406c5ad..cd3ec158a4 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml
@@ -721,6 +721,7 @@ Item {
Model {
id: pivotCap
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
scale: pivotAutoScale.getScale(Qt.vector3d(0.03, 0.03, 0.03))
position: pivotLine.startPos
@@ -760,7 +761,7 @@ Item {
onPressed: (mouse)=> {
if (viewRoot.editView) {
- var pickResult = viewRoot.editView.pick(mouse.x, mouse.y);
+ var pickResult = _generalHelper.pickViewAt(viewRoot.editView, mouse.x, mouse.y);
handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit),
mouse.modifiers & Qt.ControlModifier);
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/FadeHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/FadeHandle.qml
index c50406c147..9ad2cd18bb 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/FadeHandle.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/FadeHandle.qml
@@ -41,6 +41,7 @@ DirectionalDraggable {
Model {
id: handle
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/HelperGrid.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/HelperGrid.qml
index b7807d8192..10c7afd65b 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/HelperGrid.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/HelperGrid.qml
@@ -39,6 +39,7 @@ Node {
// Note: Only one instance of HelperGrid is supported, as the geometry names are fixed
Model { // Main grid lines
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
id: gridGeometry
name: "3D Edit View Helper Grid"
@@ -55,6 +56,7 @@ Node {
}
Model { // Subdivision lines
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
lines: gridGeometry.lines
step: gridGeometry.step
@@ -73,6 +75,7 @@ Node {
}
Model { // Z Axis
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
lines: gridGeometry.lines
step: gridGeometry.step
@@ -89,6 +92,7 @@ Node {
]
}
Model { // X Axis
+ readonly property bool _edit3dLocked: true // Make this non-pickable
eulerRotation.z: 90
geometry: GridGeometry {
lines: gridGeometry.lines
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/LightModel.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/LightModel.qml
index c500f6fbb0..f517f318d2 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/LightModel.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/LightModel.qml
@@ -33,6 +33,7 @@ Model {
property alias geometryName: lightGeometry.name // Name must be unique for each geometry
property alias geometryType: lightGeometry.lightType
property Material material
+ readonly property bool _edit3dLocked: true // Make this non-pickable
function updateGeometry()
{
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/Line3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/Line3D.qml
index 7e034ff75f..f3325bfb34 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/Line3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/Line3D.qml
@@ -36,6 +36,7 @@ Node {
property alias color: lineMat.diffuseColor
Model {
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: LineGeometry {
id: lineGeometry
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
index 7b5e2a15b2..6103df98c2 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
@@ -52,6 +52,7 @@ View3D {
Model {
id: model
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: previewMaterial
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
index 657b0f4c94..7fe6a11416 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
@@ -82,6 +82,7 @@ View3D {
Model {
id: model
+ readonly property bool _edit3dLocked: true // Make this non-pickable
eulerRotation.y: 45
source: sourceModel.source
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/PlanarDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/PlanarDraggable.qml
index 1a1fea9f9c..e66d1962a3 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/PlanarDraggable.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/PlanarDraggable.qml
@@ -40,6 +40,7 @@ Model {
property alias mouseArea: mouseArea
readonly property bool hovering: mouseArea.hovering
+ readonly property bool _edit3dLocked: true // Make this non-pickable
property vector3d _scenePosPressed
property vector2d _planePosPressed
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateGizmo.qml
index 4998974dab..d77ebc17fb 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateGizmo.qml
@@ -189,6 +189,7 @@ Node {
Model {
id: freeRotator
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: DefaultMaterial {
id: material
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateRing.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateRing.qml
index 385806008e..8003839a89 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateRing.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/RotateRing.qml
@@ -45,6 +45,7 @@ Model {
property vector3d _targetPosOnScreen
property vector3d _startRotation
property bool _trackBall
+ readonly property bool _edit3dLocked: true // Make this non-pickable
signal rotateCommit()
signal rotateChange()
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleGizmo.qml
index e76809f32f..a71001689d 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleGizmo.qml
@@ -166,6 +166,7 @@ Node {
Model {
id: centerCube
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cube"
scale: Qt.vector3d(0.024, 0.024, 0.024)
materials: DefaultMaterial {
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleRod.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleRod.qml
index 1857bfddda..9cc5ec0e06 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleRod.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ScaleRod.qml
@@ -39,6 +39,7 @@ DirectionalDraggable {
property vector3d _startScale
Model {
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cube"
y: 10
scale: Qt.vector3d(0.020, 0.020, 0.020)
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SelectionBox.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SelectionBox.qml
index 1e7cc7b11a..dd3300fd94 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SelectionBox.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SelectionBox.qml
@@ -45,6 +45,7 @@ Node {
Model {
id: selectionBoxModel
+ readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: selectionBoxGeometry
scale: selectionBox.targetNode ? selectionBox.targetNode.scale : Qt.vector3d(1, 1, 1)
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SpotLightHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SpotLightHandle.qml
index 1c7322f4e2..314b4166eb 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SpotLightHandle.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/SpotLightHandle.qml
@@ -41,6 +41,7 @@ DirectionalDraggable {
Model {
id: handle
+ readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
index 02e6f2df59..d3a8b4e8f5 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
@@ -267,6 +267,31 @@ void GeneralHelper::delayedPropertySet(QObject *obj, int delay, const QString &p
});
}
+// Returns the first valid QQuick3DPickResult from view at (posX, PosY).
+QQuick3DPickResult GeneralHelper::pickViewAt(QQuick3DViewport *view, float posX, float posY)
+{
+ if (!view)
+ return QQuick3DPickResult();
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)
+ // Make sure global picking is on
+ view->setGlobalPickingEnabled(true);
+
+ // With Qt 6.2+, select first suitable result from all picked objects
+ auto pickResults = view->pickAll(posX, posY);
+ for (auto pickResult : pickResults) {
+ if (isPickable(pickResult.objectHit()))
+ return pickResult;
+ }
+#else
+ // With older Qt version we'll just pick the single object
+ auto pickResult = view->pick(posX, posY);
+ if (isPickable(pickResult.objectHit()))
+ return pickResult;
+#endif
+ return QQuick3DPickResult();
+}
+
QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode)
{
if (pickNode) {
@@ -315,6 +340,10 @@ bool GeneralHelper::isHidden(QQuick3DNode *node)
return false;
}
+bool GeneralHelper::isPickable(QQuick3DNode *node) {
+ return (node && !isLocked(node) && !isHidden(node) && node->visible());
+}
+
void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool, const QVariant &state,
int delay)
{
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
index 6e888980f8..c22f310edd 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
@@ -35,6 +35,7 @@
#include <QTimer>
#include <QVariant>
#include <QVector3D>
+#include <QtQuick3D/private/qquick3dpickresult_p.h>
QT_BEGIN_NAMESPACE
class QQuick3DCamera;
@@ -74,12 +75,14 @@ public:
Q_INVOKABLE bool fuzzyCompare(double a, double b);
Q_INVOKABLE void delayedPropertySet(QObject *obj, int delay, const QString &property,
const QVariant& value);
+ Q_INVOKABLE QQuick3DPickResult pickViewAt(QQuick3DViewport *view, float posX, float posY);
Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode);
Q_INVOKABLE void registerGizmoTarget(QQuick3DNode *node);
Q_INVOKABLE void unregisterGizmoTarget(QQuick3DNode *node);
Q_INVOKABLE bool isLocked(QQuick3DNode *node);
Q_INVOKABLE bool isHidden(QQuick3DNode *node);
+ Q_INVOKABLE bool isPickable(QQuick3DNode *node);
Q_INVOKABLE void storeToolState(const QString &sceneId, const QString &tool,
const QVariant &state, int delayEmit = 0);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
index 19e864e638..ee20e5636c 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
@@ -2047,8 +2047,10 @@ void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInst
// as changes in the node tree (reparenting, adding new nodes) can make the previously set
// hide status based on ancestor unreliable.
node->setProperty("_edit3dHidden", edit3dHidden);
+#if QT_VERSION < QT_VERSION_CHECK(6, 2, 1)
if (auto model = qobject_cast<QQuick3DModel *>(node))
model->setPickable(!edit3dHidden); // allow 3D objects to receive mouse clicks
+#endif
const auto childItems = node->childItems();
for (auto childItem : childItems) {
const ServerNodeInstance quick3dInstance = getQuick3DInstanceAndHidden(childItem);
@@ -2070,7 +2072,9 @@ void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInst
value = QVariant::fromValue(node);
// Specify the actual pick target with dynamic property
checkModel->setProperty("_pickTarget", value);
+#if QT_VERSION < QT_VERSION_CHECK(6, 2, 1)
checkModel->setPickable(!edit3dHidden);
+#endif
}
};
if (auto childNode = qobject_cast<QQuick3DNode *>(childItem))
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
index 2e1e03fa63..9f8f5caf52 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
@@ -37,7 +37,6 @@
#include <addimportcontainer.h>
#include <createscenecommand.h>
#include <reparentinstancescommand.h>
-#include <removeinstancescommand.h>
#include <clearscenecommand.h>
#include <QDebug>
@@ -194,32 +193,6 @@ QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
return QList<QQuickItem*>();
}
-void Qt5NodeInstanceServer::markRepeaterParentDirty(qint32 id) const
-{
- if (!hasInstanceForId(id))
- return;
-
- ServerNodeInstance instance = instanceForId(id);
- if (!instance.isValid())
- return;
-
- ServerNodeInstance parentInstance = instance.parent();
- if (!parentInstance.isValid())
- return;
-
- // If a Repeater instance was moved/removed, the old parent must be marked dirty to rerender it
- const QByteArray type("QQuickRepeater");
- if (ServerNodeInstance::isSubclassOf(instance.internalObject(), type))
- DesignerSupport::addDirty(parentInstance.rootQuickItem(), QQuickDesignerSupport::Content);
-
- // Repeater's parent must also be dirtied when a child of a repeater was moved/removed.
- if (ServerNodeInstance::isSubclassOf(parentInstance.internalObject(), type)) {
- ServerNodeInstance parentsParent = parentInstance.parent();
- if (parentsParent.isValid())
- DesignerSupport::addDirty(parentsParent.rootQuickItem(), QQuickDesignerSupport::Content);
- }
-}
-
bool Qt5NodeInstanceServer::initRhi(RenderViewData &viewData)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -550,23 +523,8 @@ void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command)
void Qt5NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
{
- const QVector<ReparentContainer> &containerVector = command.reparentInstances();
- for (const ReparentContainer &container : containerVector)
- markRepeaterParentDirty(container.instanceId());
-
NodeInstanceServer::reparentInstances(command.reparentInstances());
startRenderTimer();
}
-void Qt5NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
-{
- const QVector<qint32> &idVector = command.instanceIds();
- for (const qint32 id : idVector)
- markRepeaterParentDirty(id);
-
- NodeInstanceServer::removeInstances(command);
- startRenderTimer();
-}
-
-
} // QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h
index d93ecad84e..4af451b61a 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h
@@ -67,7 +67,6 @@ public:
void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override;
- void removeInstances(const RemoveInstancesCommand &command) override;
QImage grabWindow() override;
QImage grabItem(QQuickItem *item) override;
@@ -80,7 +79,6 @@ protected:
void resetAllItems();
void setupScene(const CreateSceneCommand &command) override;
QList<QQuickItem*> allItems() const;
- void markRepeaterParentDirty(qint32 id) const;
struct RenderViewData {
QPointer<QQuickWindow> window = nullptr;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
index 1dae931af3..d40d182126 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
@@ -777,6 +777,8 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
setMovable(true);
}
+ markRepeaterParentDirty();
+
ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
if (!newParentInstance)
@@ -841,6 +843,8 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q
if (name == "layer.enabled" || name == "layer.effect")
setAllNodesDirtyRecursive(quickItem());
+ markRepeaterParentDirty();
+
ObjectNodeInstance::setPropertyVariant(name, value);
refresh();
@@ -860,6 +864,8 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q
if (name.startsWith("anchors.") && isRootNodeInstance())
return;
+ markRepeaterParentDirty();
+
ObjectNodeInstance::setPropertyBinding(name, expression);
refresh();
@@ -937,6 +943,8 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name)
resetVertical();
}
+ markRepeaterParentDirty();
+
ObjectNodeInstance::resetProperty(name);
if (isInLayoutable())
@@ -1013,6 +1021,35 @@ QQuickItem *QuickItemNodeInstance::quickItem() const
return static_cast<QQuickItem*>(object());
}
+void QuickItemNodeInstance::markRepeaterParentDirty() const
+{
+ const qint32 id = instanceId();
+ if (id <= 0 && !isValid())
+ return;
+
+ QQuickItem *item = quickItem();
+ if (!item)
+ return;
+
+ QQuickItem *parentItem = item->parentItem();
+ if (!parentItem)
+ return;
+
+ // If a Repeater instance was changed in any way, the parent must be marked dirty to rerender it
+ const QByteArray type("QQuickRepeater");
+ if (ServerNodeInstance::isSubclassOf(item, type))
+ DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
+
+ // Repeater's parent must also be dirtied when a child of a repeater was changed
+ if (ServerNodeInstance::isSubclassOf(parentItem, type)) {
+ QQuickItem *parentsParent = parentItem->parentItem();
+ if (parentsParent)
+ DesignerSupport::addDirty(parentsParent, QQuickDesignerSupport::Content);
+ }
+}
+
+
+
} // namespace Internal
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
index 77d3a3fc6b..46b22b8c9a 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
@@ -130,6 +130,7 @@ protected:
double x() const;
double y() const;
bool checkIfRefFromEffect(qint32 id);
+ void markRepeaterParentDirty() const;
private: //variables
QPointer<QQuickItem> m_contentItem;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
index 2aa17d9e2b..97b5031260 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
@@ -234,6 +234,25 @@ bool isInPathList(const QStringList &pathList, const QString &componentPath)
});
}
+bool canBeCreatedAsPrimitive(const QStringList &pathList,
+ const InstanceContainer &instanceContainer,
+ QQmlContext *context,
+ QObject *&object)
+{
+ if (isInPathList(pathList, instanceContainer.componentPath())) {
+ object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(
+ instanceContainer.type()),
+ instanceContainer.majorNumber(),
+ instanceContainer.minorNumber(),
+ context);
+
+ if (object)
+ return true;
+
+ }
+ return false;
+}
+
ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceServer,
const InstanceContainer &instanceContainer,
ComponentWrap componentWrap)
@@ -249,8 +268,8 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
if (object == nullptr)
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId());
} else if (!instanceContainer.componentPath().isEmpty()
- && !isInPathList(nodeInstanceServer->engine()->importPathList(),
- instanceContainer.componentPath())) {
+ && !canBeCreatedAsPrimitive(nodeInstanceServer->engine()->importPathList(),
+ instanceContainer, nodeInstanceServer->context(), object)) {
object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context());
if (object == nullptr) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
@@ -260,7 +279,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId());
}
}
- } else {
+ } else if (!object) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
if (object == nullptr)
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Item could not be created."), instanceContainer.instanceId());
@@ -498,7 +517,7 @@ QDebug operator <<(QDebug debug, const ServerNodeInstance &instance)
return debug.space();
}
-uint qHash(const ServerNodeInstance &instance)
+ServerNodeInstance::QHashValueType qHash(const ServerNodeInstance &instance)
{
return ::qHash(instance.instanceId());
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
index 52ead77e12..7fd6453daa 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
@@ -67,6 +67,13 @@ namespace Internal {
class ServerNodeInstance
{
+public:
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+using QHashValueType = uint;
+#else
+using QHashValueType = size_t;
+#endif
+
friend class NodeInstanceServer;
friend class Qt4NodeInstanceServer;
friend class Qt4PreviewNodeInstanceServer;
@@ -76,7 +83,7 @@ class ServerNodeInstance
friend class Qt5CapturePreviewNodeInstanceServer;
friend class Qt5TestNodeInstanceServer;
friend class QHash<qint32, ServerNodeInstance>;
- friend uint qHash(const ServerNodeInstance &instance);
+ friend QHashValueType qHash(const ServerNodeInstance &instance);
friend bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second);
friend QDebug operator<<(QDebug debug, const ServerNodeInstance &instance);
friend class NodeMetaInfo;
@@ -220,7 +227,7 @@ private: // variables
QSharedPointer<Internal::ObjectNodeInstance> m_nodeInstance;
};
-uint qHash(const ServerNodeInstance &instance);
+ServerNodeInstance::QHashValueType qHash(const ServerNodeInstance &instance);
bool operator ==(const ServerNodeInstance &first, const ServerNodeInstance &second);
bool operator <(const ServerNodeInstance &first, const ServerNodeInstance &second);
QDebug operator <<(QDebug debug, const ServerNodeInstance &instance);
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml
index de9d50f042..815d4427ad 100644
--- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml
+++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml
@@ -78,15 +78,10 @@ Item {
property string importToRemove: ""
property string importToAdd: ""
- property var currentItem: null
property var currentCategory: null
property var currentImport: null
property bool isHorizontalView: false
- // horizontal component lib variables
- property var selectedCategory: null
- property var selectedCategoryImport: null
-
// called from C++ to close context menu on focus out
function closeContextMenu()
{
@@ -94,21 +89,6 @@ Item {
itemContextMenu.close()
}
- function showImportCategories()
- {
- if (itemLibraryModel.isAllCategoriesHidden()) {
- itemsView.currentImport.importCatVisibleState = true
- if (!itemLibraryModel.getIsAnyCategoryHidden())
- itemLibraryModel.isAnyCategoryHidden = false
-
- itemsView.selectedCategory = itemLibraryModel.selectImportFirstVisibleCategory()
- }
-
- itemsView.currentImport.importCatVisibleState = true
- if (!itemLibraryModel.getIsAnyCategoryHidden())
- itemLibraryModel.isAnyCategoryHidden = false
- }
-
onWidthChanged: {
itemsView.isHorizontalView = itemsView.width > widthLimit
}
@@ -135,10 +115,7 @@ Item {
visible: itemsView.currentCategory === null
height: visible ? implicitHeight : 0
enabled: itemsView.importToRemove !== ""
- onTriggered: {
- showImportCategories()
- rootView.removeImport(itemsView.importToRemove)
- }
+ onTriggered: rootView.removeImport(itemsView.importToRemove)
}
StudioControls.MenuSeparator {
@@ -169,12 +146,8 @@ Item {
text: qsTr("Hide Category")
visible: itemsView.currentCategory
height: visible ? implicitHeight : 0
- onTriggered: {
- itemLibraryModel.isAnyCategoryHidden = true
- itemsView.currentCategory.categoryVisible = false
- itemsView.currentCategory.categorySelected = false
- itemsView.selectedCategory = itemLibraryModel.selectImportFirstVisibleCategory()
- }
+ onTriggered: itemLibraryModel.hideCategory(itemsView.currentImport.importUrl,
+ itemsView.currentCategory.categoryName)
}
StudioControls.MenuSeparator {
@@ -184,23 +157,14 @@ Item {
StudioControls.MenuItem {
text: qsTr("Show Module Hidden Categories")
- enabled: itemsView.currentImport && !itemsView.currentImport.importCatVisibleState
- onTriggered: showImportCategories()
+ enabled: itemsView.currentImport && !itemsView.currentImport.allCategoriesVisible
+ onTriggered: itemLibraryModel.showImportHiddenCategories(itemsView.currentImport.importUrl)
}
StudioControls.MenuItem {
text: qsTr("Show All Hidden Categories")
enabled: itemLibraryModel.isAnyCategoryHidden
- onTriggered: {
- if (itemLibraryModel.isAllCategoriesHidden()) {
- itemLibraryModel.showHiddenCategories()
- itemsView.selectedCategory = itemLibraryModel.selectImportFirstVisibleCategory()
- itemLibraryModel.isAnyCategoryHidden = false
- }
-
- itemLibraryModel.isAnyCategoryHidden = false
- itemLibraryModel.showHiddenCategories()
- }
+ onTriggered: itemLibraryModel.showAllHiddenCategories()
}
}
@@ -419,8 +383,6 @@ Item {
onClicked: (mouse) => {
itemLibraryModel.selectImportCategory(parent.parent.currentImportModel.importUrl, model.index)
- itemsView.selectedCategory = model
- itemsView.selectedCategoryImport = parent.parent.currentImportModel
if (mouse.button === Qt.RightButton && !rootView.isSearchActive() && categoryModel.rowCount() !== 1) {
itemsView.currentCategory = model
@@ -428,13 +390,6 @@ Item {
moduleContextMenu.popup()
}
}
- Component.onCompleted: {
- if (categorySelected)
- categorySelected = !categorySelected
- itemsView.selectedCategory = itemLibraryModel.selectImportFirstVisibleCategory()
- if (itemsView.selectedCategory === categorySelected)
- itemsView.selectedCategoryImport = itemsView.selectedCategory.parent.currentImportModel
- }
}
}
}
@@ -473,10 +428,10 @@ Item {
rowSpacing: 7
Repeater {
- model: itemsView.selectedCategory ? itemsView.selectedCategory.itemModel : null
+ model: itemLibraryModel.itemsModel
delegate: ItemDelegate {
visible: itemVisible
- textColor: itemsView.selectedCategoryImport && itemsView.selectedCategoryImport.importUnimported
+ textColor: itemLibraryModel.importUnimportedSelected
? StudioTheme.Values.themeUnimportedModuleColor : StudioTheme.Values.themeTextColor
width: styleConstants.cellWidth + hItemGrid.flexibleWidth
height: styleConstants.cellHeight
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml
index 748f835614..bdefc13a97 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml
@@ -164,6 +164,7 @@ Item {
bindingEditor.showWidget()
bindingEditor.text = backendValue.expression
bindingEditor.prepareBindings()
+ bindingEditor.updateWindowName()
}
BindingEditor {
diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
index 5cbefc03d1..2deb46b212 100644
--- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
+++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
@@ -110,6 +110,7 @@ Rectangle {
bindingEditor.showWidget()
bindingEditor.text = delegateWhenConditionString
bindingEditor.prepareBindings()
+ bindingEditor.updateWindowName()
}
}
@@ -309,6 +310,7 @@ Rectangle {
}
stateModelNodeProperty: statesEditorModel.stateModelNode()
+ stateNameProperty: myRoot.delegateStateName
onRejected: {
hideWidget()