From 650dabdc254174bc1304f61a7a3702ef72d51c5e Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 14 Sep 2023 11:35:01 +0200 Subject: [PATCH] QmlDesigner: Add scroll bars to SuggestionPopup * Add scroll bars * Fix focus style for expression builder Change-Id: I08f4334b3d480e4395a0c017634dd42f8eff74bb Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Thomas Hartmann --- .../connectionseditor/ExpressionBuilder.qml | 2 +- .../connectionseditor/SuggestionPopup.qml | 38 ++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/connectionseditor/ExpressionBuilder.qml b/share/qtcreator/qmldesigner/connectionseditor/ExpressionBuilder.qml index dac40865daa..bd367debb75 100644 --- a/share/qtcreator/qmldesigner/connectionseditor/ExpressionBuilder.qml +++ b/share/qtcreator/qmldesigner/connectionseditor/ExpressionBuilder.qml @@ -54,7 +54,7 @@ Rectangle { if (!root.conditionListModel.valid) return StudioTheme.Values.themeError - if (focusScope.activeFocus || popup.searchActive) + if (focusScope.activeFocus) return root.style.border.interaction if (mouseArea.containsMouse) diff --git a/share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml b/share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml index 511e92ced98..fb9643ca14b 100644 --- a/share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml +++ b/share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml @@ -124,10 +124,27 @@ Controls.Popup { id: listView visible: search.empty width: stack.width - implicitHeight: Math.min(380, childrenRect.height) + implicitHeight: Math.min(180, childrenRect.height) clip: true model: root.listModel + HoverHandler { id: listViewHoverHandler } + + boundsMovement: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds + + ScrollBar.vertical: HelperWidgets.ScrollBar { + id: listScrollBar + parent: listView + x: listView.width - listScrollBar.width + y: 0 + height: listView.availableHeight + orientation: Qt.Vertical + + show: (listViewHoverHandler.hovered || listView.focus || listScrollBar.inUse) + && listScrollBar.isNeeded + } + delegate: MyListViewDelegate { id: listViewDelegate @@ -167,10 +184,27 @@ Controls.Popup { id: treeView visible: !search.empty width: stack.width - implicitHeight: Math.min(380, childrenRect.height) + implicitHeight: Math.min(180, childrenRect.height) clip: true model: root.treeModel + HoverHandler { id: treeViewHoverHandler } + + boundsMovement: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds + + ScrollBar.vertical: HelperWidgets.ScrollBar { + id: treeScrollBar + parent: treeView + x: treeView.width - treeScrollBar.width + y: 0 + height: treeView.availableHeight + orientation: Qt.Vertical + + show: (treeViewHoverHandler.hovered || treeView.focus || treeScrollBar.inUse) + && treeScrollBar.isNeeded + } + onLayoutChanged: function() { treeView.expand(0) }