on xenial help sign in
Make the rowHeight be the headerHeight if we have it

Shuffle a bit the margins in headerHeight/fixedHeaderHeight

commit0e3eeac2139d9f60e8978ab1113075a6b287603c authorAlbert Astals <albert.astals@canonical.com> dateWed 18 Jun 2014, 12:26 (12 years ago) parent98fccf5
7 files changed+17−12
plugins/Dash/CardCreator.js+8−6 qml/Dash/CardVerticalJournal.qml+1 tests/plugins/Dash/cardcreator/1.res+1−1 tests/plugins/Dash/cardcreator/2.res+2−1 tests/plugins/Dash/cardcreator/3.res+1−1 tests/plugins/Dash/cardcreator/4.res+2−1 tests/plugins/Dash/cardcreator/5.res+2−2
plugins/Dash/CardCreator.js+8−6
@@ -108,7 +108,7 @@ var kOverlayLoaderCode = 'Loader { \n\
108108 visible: showHeader && status == Loader.Ready; \n\
109109 sourceComponent: ShaderEffect { \n\
110110 id: overlay; \n\
111− height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight; \n\
111+ height: fixedHeaderHeight != -1 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight; \n\
112112 opacity: 0.6; \n\
113113 property var source: ShaderEffectSource { \n\
114114 id: shaderSource; \n\
@@ -145,6 +145,7 @@ var kHeaderRow2Code = 'Row { \n\
145145 objectName: "outerRow"; \n\
146146 property real margins: units.gu(1); \n\
147147 spacing: margins; \n\
148+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
148149 anchors { %1 } \n\
149150 anchors.right: parent.right; \n\
150151 anchors.margins: margins;\n\
@@ -163,6 +164,7 @@ var kHeaderRow3Code = 'Row { \n\
163164 objectName: "outerRow"; \n\
164165 property real margins: units.gu(1); \n\
165166 spacing: margins; \n\
167+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
166168 anchors { %1 } \n\
167169 anchors.right: parent.right; \n\
168170 anchors.margins: margins;\n\
@@ -315,7 +317,7 @@ function cardString(template, components) {
315317 anchors = 'left: parent.left';
316318 if (hasMascot || hasTitle) {
317319 widthCode = 'height * artShape.aspect'
318− heightCode = 'headerHeight';
320+ heightCode = 'headerHeight + 2 * units.gu(1)';
319321 } else {
320322 // This side of the else is a bit silly, who wants an horizontal layout without mascot and title?
321323 // So we define a "random" height of the image height + 2 gu for the margins
@@ -366,13 +368,13 @@ function cardString(template, components) {
366368 }
367369
368370 if (hasHeaderRow) {
369− code += 'readonly property int headerHeight: row.height + row.margins * 2;\n'
371+ code += 'readonly property int headerHeight: row.height;\n'
370372 } else if (hasMascot) {
371− code += 'readonly property int headerHeight: mascotImage.height + units.gu(1) * 2;\n'
373+ code += 'readonly property int headerHeight: mascotImage.height;\n'
372374 } else if (hasSubtitle) {
373− code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n'
375+ code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n'
374376 } else if (hasTitle) {
375− code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;\n'
377+ code += 'readonly property int headerHeight: titleLabel.height;\n'
376378 } else {
377379 code += 'readonly property int headerHeight: 0;\n'
378380 }
qml/Dash/CardVerticalJournal.qml+1
@@ -66,6 +66,7 @@ DashRenderer {
6666 item.width = Qt.binding(function() { return cardTool.cardWidth; });
6767 item.height = Qt.binding(function() { return cardTool.cardHeight; });
6868 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
69+ item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
6970 item.cardData = Qt.binding(function() { return model; });
7071 item.template = Qt.binding(function() { return cardTool.template; });
7172 item.components = Qt.binding(function() { return cardTool.components; });
tests/plugins/Dash/cardcreator/1.res+1−1
@@ -56,7 +56,7 @@ Item {
5656 }
5757 }
5858 }
59−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;
59+readonly property int headerHeight: titleLabel.height;
6060Label {
6161 id: titleLabel;
6262 objectName: "titleLabel";
tests/plugins/Dash/cardcreator/2.res+2−1
@@ -46,12 +46,13 @@ Loader {
4646 }
4747 }
4848readonly property size artShapeSize: Qt.size(-1, -1);
49−readonly property int headerHeight: row.height + row.margins * 2;
49+readonly property int headerHeight: row.height;
5050Row {
5151 id: row;
5252 objectName: "outerRow";
5353 property real margins: units.gu(1);
5454 spacing: margins;
55+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5556 anchors { top: parent.top;
5657 topMargin: units.gu(1);
5758 left: parent.left;
tests/plugins/Dash/cardcreator/3.res+1−1
@@ -56,7 +56,7 @@ Item {
5656 }
5757 }
5858 }
59−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;
59+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
6060Label {
6161 id: titleLabel;
6262 objectName: "titleLabel";
tests/plugins/Dash/cardcreator/4.res+2−1
@@ -13,12 +13,13 @@ AbstractButton {
1313 property bool showHeader: true;
1414 implicitWidth: childrenRect.width;
1515readonly property size artShapeSize: Qt.size(-1, -1);
16−readonly property int headerHeight: row.height + row.margins * 2;
16+readonly property int headerHeight: row.height;
1717Row {
1818 id: row;
1919 objectName: "outerRow";
2020 property real margins: units.gu(1);
2121 spacing: margins;
22+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
2223 anchors { top: parent.top;
2324 topMargin: units.gu(1);
2425 left: parent.left;
tests/plugins/Dash/cardcreator/5.res+2−2
@@ -68,7 +68,7 @@ Loader {
6868 visible: showHeader && status == Loader.Ready;
6969 sourceComponent: ShaderEffect {
7070 id: overlay;
71− height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight;
71+ height: fixedHeaderHeight != -1 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight;
7272 opacity: 0.6;
7373 property var source: ShaderEffectSource {
7474 id: shaderSource;
@@ -96,7 +96,7 @@ Loader {
9696 }";
9797 }
9898 }
99−readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2 + subtitleLabel.height + subtitleLabel.anchors.topMargin;
99+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
100100Label {
101101 id: titleLabel;
102102 objectName: "titleLabel";