on xenial help sign in
Do not create subtitle if not needed
commit57e3f5ea32362c89cb5bfca14d291315ba9718ed authorAlbert Astals <albert.astals@canonical.com> dateTue 1 Apr 2014, 10:31 (13 years ago) parentf0632f5
1 file changed+13−10
qml/Dash/CardHeader.qml+13−10
qml/Dash/CardHeader.qml+13−10
@@ -21,7 +21,7 @@ Item {
2121 id: root
2222 property alias mascot: mascotImage.source
2323 property alias title: titleLabel.text
24− property alias subtitle: subtitleLabel.text
24+ property var subtitle
2525
2626 property alias titleWeight: titleLabel.font.weight
2727 property alias titleSize: titleLabel.fontSize
@@ -103,16 +103,19 @@ Item {
103103 color: fontColor
104104 }
105105
106− Label {
107− id: subtitleLabel
108− objectName: "subtitleLabel"
106+ Loader {
107+ active: titleLabel.text && root.subtitle
109108 anchors { left: parent.left; right: parent.right }
110− elide: Text.ElideRight
111− fontSize: "small"
112− font.weight: Font.Light
113− visible: titleLabel.text && text
114− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
115− color: fontColor
109+ sourceComponent: Label {
110+ id: subtitleLabel
111+ objectName: "subtitleLabel"
112+ elide: Text.ElideRight
113+ fontSize: "small"
114+ font.weight: Font.Light
115+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
116+ color: fontColor
117+ text: root.subtitle
118+ }
116119 }
117120 }
118121 }