on xenial help sign in
Improve CardHeader layout: don't indent header when no mascot.
commit119a21d62d7e4a5375cee3fdbaef21fec5c96fb0 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 30 Jan 2014, 21:05 (13 years ago) parent515e5bd
2 files changed+13−6
qml/Dash/CardHeader.qml+10−3 tests/qmltests/Dash/tst_CardHeader.qml+3−3
qml/Dash/CardHeader.qml+10−3
@@ -27,14 +27,21 @@ Item {
2727 property alias altPrice: altPriceLabel.text
2828
2929 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
3131
3232 Row {
3333 id: row
3434 objectName: "outerRow"
3535
36− anchors { top: parent.top; left: parent.left; right: parent.right; margins: spacing }
37− spacing: units.gu(1)
36+ property real margins: 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
3845
3946 UbuntuShape {
4047 id: mascotShape
tests/qmltests/Dash/tst_CardHeader.qml+3−3
@@ -120,9 +120,9 @@ Rectangle {
120120
121121 function test_dimensions_data() {
122122 return [
123− { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
124− { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" },
125− { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.spacing * 2 } },
123+ { tag: "Column width", object: column, width: cardHeader.width },
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.margins * 2 } },
126126 ]
127127 }
128128