QmlDesigner: Fix the right margin for the AssetsView

Task-number: QDS-8352
Change-Id: If08cf7c39cea9dde8e241214c775685b4b1fd4f8
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Samuel Ghinet
2022-12-19 20:21:43 +02:00
parent c4cc576825
commit f9a0b325d7

View File

@@ -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