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.Controls
import QtQuick.Layouts
import StudioTheme as StudioTheme
ItemDelegate {
id: control
hoverEnabled: true
contentItem: Text {
leftPadding: 8
rightPadding: 8
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.hovered ? "#111111" : "white"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
hoverEnabled: true
verticalPadding: 0
rightPadding: 10 // ScrollBar thickness
contentItem: RowLayout {
Text {
Layout.fillWidth: true
leftPadding: 8
rightPadding: 8
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.hovered ? control.style.text.selectedText : control.style.text.idle
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
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 {
implicitWidth: 200
implicitHeight: 30
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 {
id: control
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
hoverEnabled: true
implicitWidth: 200
implicitHeight: 30
@@ -28,8 +31,8 @@ T.TreeViewDelegate {
Text {
id: icon
font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: StudioTheme.Values.smallIconFontSize
color: control.hovered ? "#111111" : "white" // TODO colors
font.pixelSize: control.style.smallIconFontSize
color: control.hovered ? control.style.text.selectedText : control.style.text.idle
text: StudioTheme.Constants.sectionToggle
rotation: control.expanded ? 0 : -90
anchors.centerIn: parent
@@ -39,14 +42,14 @@ T.TreeViewDelegate {
background: Rectangle {
implicitWidth: 200
implicitHeight: 30
color: control.hovered ? "#4DBFFF" : "transparent"
color: control.hovered ? control.style.interaction : "transparent"
}
contentItem: Text {
text: control.text
font: control.font
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
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight

View File

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