QmlDesigner: Add chevron to items with children

Add chevron to the ItemDelegates of the SuggestionPopup if items have
children. This indicates that the user can click on it and go deeper.

Change-Id: I905769b8190b81a92025861a3fc38817de5b56ed
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2023-09-15 09:55:47 +02:00
committed by Henning Gründl
parent fc981ee54a
commit 5ed667c554
3 changed files with 45 additions and 17 deletions

View File

@@ -3,27 +3,52 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts
import StudioTheme as StudioTheme
ItemDelegate { ItemDelegate {
id: control id: control
hoverEnabled: true
contentItem: Text { property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
hoverEnabled: true
verticalPadding: 0
rightPadding: 10 // ScrollBar thickness
contentItem: RowLayout {
Text {
Layout.fillWidth: true
leftPadding: 8 leftPadding: 8
rightPadding: 8 rightPadding: 8
text: control.text text: control.text
font: control.font font: control.font
opacity: enabled ? 1.0 : 0.3 opacity: enabled ? 1.0 : 0.3
color: control.hovered ? "#111111" : "white" color: control.hovered ? control.style.text.selectedText : control.style.text.idle
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
} }
Item {
visible: control.childCount
width: 30
height: 30
Text {
id: chevronLeft
font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: control.style.baseIconFontSize
color: control.hovered ? control.style.text.selectedText : control.style.text.idle
text: StudioTheme.Constants.forward_medium
anchors.centerIn: parent
}
}
}
background: Rectangle { background: Rectangle {
implicitWidth: 200 implicitWidth: 200
implicitHeight: 30 implicitHeight: 30
opacity: enabled ? 1 : 0.3 opacity: enabled ? 1 : 0.3
color: control.hovered ? "#4DBFFF" : "transparent" color: control.hovered ? control.style.interaction : "transparent"
} }
} }

View File

@@ -8,6 +8,9 @@ import StudioTheme as StudioTheme
T.TreeViewDelegate { T.TreeViewDelegate {
id: control id: control
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
hoverEnabled: true hoverEnabled: true
implicitWidth: 200 implicitWidth: 200
implicitHeight: 30 implicitHeight: 30
@@ -28,8 +31,8 @@ T.TreeViewDelegate {
Text { Text {
id: icon id: icon
font.family: StudioTheme.Constants.iconFont.family font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: StudioTheme.Values.smallIconFontSize font.pixelSize: control.style.smallIconFontSize
color: control.hovered ? "#111111" : "white" // TODO colors color: control.hovered ? control.style.text.selectedText : control.style.text.idle
text: StudioTheme.Constants.sectionToggle text: StudioTheme.Constants.sectionToggle
rotation: control.expanded ? 0 : -90 rotation: control.expanded ? 0 : -90
anchors.centerIn: parent anchors.centerIn: parent
@@ -39,14 +42,14 @@ T.TreeViewDelegate {
background: Rectangle { background: Rectangle {
implicitWidth: 200 implicitWidth: 200
implicitHeight: 30 implicitHeight: 30
color: control.hovered ? "#4DBFFF" : "transparent" color: control.hovered ? control.style.interaction : "transparent"
} }
contentItem: Text { contentItem: Text {
text: control.text text: control.text
font: control.font font: control.font
opacity: enabled ? 1.0 : 0.3 opacity: enabled ? 1.0 : 0.3
color: control.hovered ? "#111111" : "white" color: control.hovered ? control.style.text.selectedText : control.style.text.idle
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight

View File

@@ -80,7 +80,7 @@ Controls.Popup {
onClicked: { onClicked: {
stack.pop(Controls.StackView.Immediate) stack.pop(Controls.StackView.Immediate)
root.listModel.goUp() //treeModel.pop() root.listModel.goUp()
} }
} }