on xenial help sign in
move the code that sets headerHeight a bit
fd487f2Albert Astals
plugins/Dash/CardCreator.js+8−8
@@ -222,6 +222,14 @@ function cardString(template, components) {
222 ' + headerLeftAnchor + '\
222 ' + headerLeftAnchor + '\
223 anchors.right: parent.right; \
223 anchors.right: parent.right; \
224 anchors.margins: margins;';
224 anchors.margins: margins;';
225+ } else if (hasMascot) {
226+ code += 'readonly property int headerHeight: mascotImage.height + units.gu(1) * 2;'
227+ } else if (hasSubtitle) {
228+ code += 'readonly property int headerHeight: subtitleLabel.y + subtitleLabel.height - titleLabel.y + titleLabel.anchors.topMargin * 2 + subtitleLabel.anchors.topMargin;'
229+ } else if (hasTitle) {
230+ code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;'
231+ } else {
232+ code += 'readonly property int headerHeight: 0;'
225 }
233 }
226
234
227 if (hasMascot) {
235 if (hasMascot) {
@@ -231,7 +239,6 @@ function cardString(template, components) {
231 anchors += headerLeftAnchor;
239 anchors += headerLeftAnchor;
232 anchors += 'anchors.leftMargin: units.gu(1);'
240 anchors += 'anchors.leftMargin: units.gu(1);'
233 anchors += headerVerticalAnchors;
241 anchors += headerVerticalAnchors;
234− code += 'readonly property int headerHeight: mascotImage.height + units.gu(1) * 2;'
235 } else {
242 } else {
236 anchors = "anchors.verticalCenter: parent.verticalCenter;"
243 anchors = "anchors.verticalCenter: parent.verticalCenter;"
237 }
244 }
@@ -317,13 +324,6 @@ function cardString(template, components) {
317 anchors.top: titleLabel.bottom; \
324 anchors.top: titleLabel.bottom; \
318 anchors.topMargin: units.dp(2);';
325 anchors.topMargin: units.dp(2);';
319 }
326 }
320− if (!hasHeaderRow) {
321− if (hasSubtitle) {
322− code += 'readonly property int headerHeight: subtitleLabel.y + subtitleLabel.height - titleLabel.y + titleLabel.anchors.topMargin * 2 + subtitleLabel.anchors.topMargin;'
323− } else {
324− code += 'readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMargin * 2;'
325− }
326− }
327
327
328 code += 'Label { \
328 code += 'Label { \
329 id: titleLabel; \
329 id: titleLabel; \