From 1c34bbbc350b59150f8eb6b1a1ca7606549dafa3 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Thu, 18 Apr 2024 11:37:49 +0300 Subject: [PATCH] QmlDesigner: Add Boolean delegate for the model editor * Also the edit property of the StudioControls.CheckBox is removed, because it might override the edit property of the item. Fixes: QDS-12059 Change-Id: I2fe66061e2018cdbea44a51ffca2fb0e696d5bbc Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri --- .../CollectionDetailsEditDelegate.qml | 26 ------------------- .../CollectionDetailsView.qml | 20 ++++++++++++++ .../imports/StudioControls/CheckBox.qml | 1 - 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml index fd969382e63..71499cc47e8 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml @@ -135,23 +135,6 @@ Item { } } } - - Component { - id: boolEditor - - EditorPopup { - - editor: boolField - - StudioControls.CheckBox { - id: boolField - - property alias editValue: boolField.checked - - actionIndicatorVisible: false - } - } - } } component EditorPopup: T.Popup { @@ -225,15 +208,6 @@ Item { sourceComponent: realEditor } }, - State { - name: "bool" - when: columnType === CollectionDetails.DataType.Boolean - - PropertyChanges { - target: editorLoader - sourceComponent: boolEditor - } - }, State { name: "color" when: columnType === CollectionDetails.DataType.Color diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml index e9bdfdc675a..84a3f7f0d10 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml @@ -360,6 +360,24 @@ Rectangle { } } + Component { + id: checkBoxComponent + + StudioControls.CheckBox { + id: checkBoxDelegate + + readonly property bool editValue: edit + + text: "" + actionIndicatorVisible: false + checked: checkBoxDelegate.editValue + onCheckedChanged: { + if (checkBoxDelegate.editValue !== checkBoxDelegate.checked) + edit = checkBoxDelegate.checked + } + } + } + Component { id: colorEditorComponent @@ -369,6 +387,8 @@ Rectangle { function resetSource() { if (columnType === CollectionDetails.DataType.Color) cellContentLoader.sourceComponent = colorEditorComponent + else if (columnType === CollectionDetails.DataType.Boolean) + cellContentLoader.sourceComponent = checkBoxComponent else cellContentLoader.sourceComponent = cellText } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/CheckBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/CheckBox.qml index 573b78012f3..7e565e3a47d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/CheckBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/CheckBox.qml @@ -14,7 +14,6 @@ T.CheckBox { // This property is used to indicate the global hover state property bool hover: control.hovered && control.enabled - property bool edit: false property alias actionIndicatorVisible: actionIndicator.visible property real __actionIndicatorWidth: control.style.actionIndicatorSize.width