on xenial help sign in
Improve CardHeader layout: don't indent header when no mascot.
119a21dMichał Sawicz
qml/Dash/CardHeader.qml+10−3
@@ -27,14 +27,21 @@ Item {
27 property alias altPrice: altPriceLabel.text
27 property alias altPrice: altPriceLabel.text
28
28
29 visible: mascotImage.status === Image.Ready || title || price
29 visible: mascotImage.status === Image.Ready || title || price
30− height: row.height > 0 ? row.height + row.spacing * 2 : 0
30+ height: row.height > 0 ? row.height + row.margins * 2 : 0
31
31
32 Row {
32 Row {
33 id: row
33 id: row
34 objectName: "outerRow"
34 objectName: "outerRow"
35
35
36− anchors { top: parent.top; left: parent.left; right: parent.right; margins: spacing }
36+ property real margins: units.gu(1)
37− spacing: units.gu(1)
37+
38+ anchors {
39+ top: parent.top; left: parent.left; right: parent.right
40+ margins: margins
41+ leftMargin: spacing
42+ rightMargin: spacing
43+ }
44+ spacing: mascotShape.visible ? margins : 0
38
45
39 UbuntuShape {
46 UbuntuShape {
40 id: mascotShape
47 id: mascotShape
tests/qmltests/Dash/tst_CardHeader.qml+3−3
@@ -120,9 +120,9 @@ Rectangle {
120
120
121 function test_dimensions_data() {
121 function test_dimensions_data() {
122 return [
122 return [
123− { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
123+ { tag: "Column width", object: column, width: cardHeader.width },
124− { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" },
124+ { tag: "Column width with mascot", object: column, width: cardHeader.width - mascot.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
125− { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.spacing * 2 } },
125+ { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.margins * 2 } },
126 ]
126 ]
127 }
127 }
128
128