QmlDesigner: Expand and hide root item

Hide and expand root item in the tree model of the connections editor
search result.

Change-Id: If6591077fee59542153f2167dfd43c8132b66c95
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2023-09-11 12:45:25 +02:00
committed by Henning Gründl
parent 41ee64b8a4
commit 28933f2d4d
3 changed files with 12 additions and 34 deletions

View File

@@ -16,17 +16,6 @@ Column {
property var backend
/* replaced by ConnectionModelStatementDelegate defined in C++
enum ActionType {
CallFunction,
Assign,
ChangeState,
SetProperty,
PrintMessage,
Custom
} */
y: StudioTheme.Values.popupMargin
width: parent.width
spacing: root.verticalSpacing

View File

@@ -9,36 +9,24 @@ import StudioTheme as StudioTheme
T.TreeViewDelegate {
id: control
hoverEnabled: true
implicitWidth: 200
implicitHeight: 30
//implicitWidth: leftMargin + __contentIndent + implicitContentWidth + rightPadding + rightMargin
//implicitHeight: Math.max(indicator ? indicator.height : 0, implicitContentHeight) * 1.25
indentation: 12
//leftMargin: 4
//rightMargin: 4
//spacing: 4
//topPadding: contentItem ? (height - contentItem.implicitHeight) / 2 : 0
leftPadding: control.leftMargin + control.__contentIndent
//required property int row
//required property var model
readonly property int customDepth: control.depth - 1
readonly property real __contentIndent: !control.isTreeNode ? 0
: (control.depth * control.indentation)
: (control.customDepth * control.indentation)
+ (control.indicator ? control.indicator.width + control.spacing : 0)
indicator: Item {
readonly property real __indicatorIndent: control.leftMargin + (control.depth * control.indentation)
x: __indicatorIndent
x: control.leftMargin + (control.customDepth * control.indentation)
width: 30
height: 30
Text {
id: caret
id: icon
font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: StudioTheme.Values.smallIconFontSize
color: control.hovered ? "#111111" : "white" // TODO colors

View File

@@ -168,12 +168,13 @@ Controls.Popup {
clip: true
model: root.treeModel
// This is currently a workaround and should be cleaned up. Calling
// expandRecursively every time the filter changes is performance wise not good.
//Connections {
// target: proxyModel
// function onFilterChanged() { treeView.expandRecursively() }
//}
onLayoutChanged: function() {
treeView.expand(0)
}
rowHeightProvider: function(row) {
return (row <= 0) ? 0 : -1
}
delegate: MyTreeViewDelegate {
id: treeViewDelegate