QmlDesigner: Correct item library spacings

Regression caused by db6ad528bb

Fixes: QDS-3855
Change-Id: I4a91a66fcfaf6cbd013bc54a65344cb7f3171798
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2021-03-19 18:47:22 +02:00
parent 1ad6133161
commit 9e960d09a3
2 changed files with 13 additions and 14 deletions

View File

@@ -159,8 +159,6 @@ ScrollView {
: StudioTheme.Values.themeTextColor : StudioTheme.Values.themeTextColor
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: 0
bottomPadding: 0
expanded: importExpanded expanded: importExpanded
expandOnClick: false expandOnClick: false
onToggleExpand: { onToggleExpand: {
@@ -184,8 +182,8 @@ ScrollView {
hideHeader: categoryModel.rowCount() <= 1 hideHeader: categoryModel.rowCount() <= 1
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: 0 addTopPadding: categoryModel.rowCount() > 1
bottomPadding: 0 addBottomPadding: index != categoryModel.rowCount() - 1
caption: categoryName + " (" + itemModel.rowCount() + ")" caption: categoryName + " (" + itemModel.rowCount() + ")"
visible: categoryVisible visible: categoryVisible
expanded: categoryExpanded expanded: categoryExpanded

View File

@@ -40,15 +40,15 @@ Item {
property alias showArrow: arrow.visible property alias showArrow: arrow.visible
property int leftPadding: 8 property int leftPadding: 8
property int topPadding: 4
property int rightPadding: 0 property int rightPadding: 0
property int bottomPadding: 4
property bool expanded: true property bool expanded: true
property int level: 0 property int level: 0
property int levelShift: 10 property int levelShift: 10
property bool hideHeader: false property bool hideHeader: false
property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead
property bool addTopPadding: true
property bool addBottomPadding: true
onHideHeaderChanged: onHideHeaderChanged:
{ {
@@ -120,11 +120,12 @@ Item {
readonly property alias contentItem: row readonly property alias contentItem: row
implicitHeight: Math.round(row.height + header.height + topRow.height + bottomRow.height) implicitHeight: Math.round(row.height + header.height + topSpacer.height + bottomSpacer.height)
Row {
id: topRow Item {
height: StudioTheme.Values.sectionHeadSpacerHeight id: topSpacer
height: addTopPadding && row.height > 0 ? StudioTheme.Values.sectionHeadSpacerHeight : 0
anchors.top: header.bottom anchors.top: header.bottom
} }
@@ -134,12 +135,12 @@ Item {
anchors.leftMargin: section.leftPadding anchors.leftMargin: section.leftPadding
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: section.rightPadding anchors.rightMargin: section.rightPadding
anchors.top: topRow.bottom anchors.top: topSpacer.bottom
} }
Row { Item {
id: bottomRow id: bottomSpacer
height: StudioTheme.Values.sectionHeadSpacerHeight height: addBottomPadding && row.height > 0 ? StudioTheme.Values.sectionHeadSpacerHeight : 0
anchors.top: row.bottom anchors.top: row.bottom
} }