From f9a0b325d715fad239aebc133e2c653cfb3964d3 Mon Sep 17 00:00:00 2001 From: Samuel Ghinet Date: Mon, 19 Dec 2022 20:21:43 +0200 Subject: [PATCH] QmlDesigner: Fix the right margin for the AssetsView Task-number: QDS-8352 Change-Id: If08cf7c39cea9dde8e241214c775685b4b1fd4f8 Reviewed-by: Mahmoud Badri --- .../itemLibraryQmlSources/AssetDelegate.qml | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml index 7bfec10aa32..2bbfff5223c 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml @@ -26,7 +26,12 @@ TreeViewDelegate { readonly property int __dirItemHeight: 21 implicitHeight: root.__isDirectory ? root.__dirItemHeight : root.__fileItemHeight - implicitWidth: root.assetsView.width > 0 ? root.assetsView.width : 10 + implicitWidth: { + if (root.assetsView.verticalScrollBar.scrollBarVisible) + return root.assetsView.width - root.indentation - root.assetsView.verticalScrollBar.width + else + return root.assetsView.width - root.indentation + } leftMargin: root.__isDirectory ? 0 : thumbnailImage.width @@ -54,17 +59,6 @@ TreeViewDelegate { } } - onImplicitWidthChanged: { - // a small hack, to fix a glitch: when resizing the width of the tree view, - // the widths of the delegate items remain the same as before, unless we re-set - // that width explicitly. - var newWidth = root.implicitWidth - (root.assetsView.verticalScrollBar.scrollBarVisible - ? root.assetsView.verticalScrollBar.width - : 0) - bg.width = newWidth - bg.implicitWidth = newWidth - } - onDepthChanged: { if (root.depth > root.initialDepth && root.initialDepth >= 0) root.depth = root.initialDepth @@ -73,6 +67,8 @@ TreeViewDelegate { background: Rectangle { id: bg + width: root.implicitWidth + color: { if (root.__isDirectory && (root.isHighlighted || root.hasChildWithDropHover)) return StudioTheme.Values.themeInteraction