diff options
author | Ali Kianian <ali.kianian@qt.io> | 2024-04-18 11:37:49 +0300 |
---|---|---|
committer | Ali Kianian <ali.kianian@qt.io> | 2024-04-29 10:00:26 +0000 |
commit | 1c34bbbc350b59150f8eb6b1a1ca7606549dafa3 (patch) | |
tree | 845bfb3063a2d97c235d27d9077748de80d390a9 | |
parent | fce30cb9d93b589b990eb37a66378e138ff3d140 (diff) |
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 <ci_patchbuild_bot@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
3 files changed, 20 insertions, 27 deletions
diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml index fd969382e6..71499cc47e 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 { @@ -226,15 +209,6 @@ Item { } }, 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 e9bdfdc675..84a3f7f0d1 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsView.qml @@ -361,6 +361,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 ColorViewDelegate {} @@ -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 573b78012f..7e565e3a47 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 |