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>
This commit is contained in:
Ali Kianian
2024-04-18 11:37:49 +03:00
parent fce30cb9d9
commit 1c34bbbc35
3 changed files with 20 additions and 27 deletions

View File

@@ -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 { component EditorPopup: T.Popup {
@@ -225,15 +208,6 @@ Item {
sourceComponent: realEditor sourceComponent: realEditor
} }
}, },
State {
name: "bool"
when: columnType === CollectionDetails.DataType.Boolean
PropertyChanges {
target: editorLoader
sourceComponent: boolEditor
}
},
State { State {
name: "color" name: "color"
when: columnType === CollectionDetails.DataType.Color when: columnType === CollectionDetails.DataType.Color

View File

@@ -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 { Component {
id: colorEditorComponent id: colorEditorComponent
@@ -369,6 +387,8 @@ Rectangle {
function resetSource() { function resetSource() {
if (columnType === CollectionDetails.DataType.Color) if (columnType === CollectionDetails.DataType.Color)
cellContentLoader.sourceComponent = colorEditorComponent cellContentLoader.sourceComponent = colorEditorComponent
else if (columnType === CollectionDetails.DataType.Boolean)
cellContentLoader.sourceComponent = checkBoxComponent
else else
cellContentLoader.sourceComponent = cellText cellContentLoader.sourceComponent = cellText
} }

View File

@@ -14,7 +14,6 @@ T.CheckBox {
// This property is used to indicate the global hover state // This property is used to indicate the global hover state
property bool hover: control.hovered && control.enabled property bool hover: control.hovered && control.enabled
property bool edit: false
property alias actionIndicatorVisible: actionIndicator.visible property alias actionIndicatorVisible: actionIndicator.visible
property real __actionIndicatorWidth: control.style.actionIndicatorSize.width property real __actionIndicatorWidth: control.style.actionIndicatorSize.width