summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2018-10-30 16:42:24 +0100
committerAleix Pol <[email protected]>2018-10-30 16:42:24 +0100
commita24ececbe953e06e5b484a553e955467abc17bd6 (patch)
tree1878842a68ba2e3e1d5d8792e18f739d695aed0b
parente25ff28e1064496124400db7befc71c72af56832 (diff)
Simplify LabelBackground by using Control
-rw-r--r--discover/qml/LabelBackground.qml37
1 files changed, 18 insertions, 19 deletions
diff --git a/discover/qml/LabelBackground.qml b/discover/qml/LabelBackground.qml
index d8d9466..7005ea1 100644
--- a/discover/qml/LabelBackground.qml
+++ b/discover/qml/LabelBackground.qml
@@ -23,34 +23,33 @@ import QtQuick.Layouts 1.1
import org.kde.discover.app 1.0
import org.kde.kirigami 2.0 as Kirigami
-Item
+Control
{
+ id: root
property alias text: theLabel.text
property real progress: 1.
- readonly property real margin: Kirigami.Units.smallSpacing * 1.5
- implicitWidth: theLabel.implicitWidth + margin*2
- implicitHeight: theLabel.implicitHeight + margin*2
- width: implicitWidth
- height: implicitHeight
+ padding: Kirigami.Units.smallSpacing * 1.5
- Rectangle {
- color: Kirigami.Theme.disabledTextColor
- anchors.fill: parent
- radius: parent.margin
- }
+ background: Item {
+ Rectangle {
+ color: Kirigami.Theme.disabledTextColor
+ anchors.fill: parent
+ radius: root.padding
+ }
- Rectangle {
- anchors {
- fill: parent
- rightMargin: (1-parent.progress) * parent.width
+ Rectangle {
+ anchors {
+ fill: parent
+ rightMargin: (1-root.progress) * parent.width
+ }
+ color: Kirigami.Theme.highlightColor
+ radius: root.padding
}
- color: Kirigami.Theme.highlightColor
- radius: parent.margin
}
- Label {
+ contentItem: Label {
id: theLabel
- anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
color: Kirigami.Theme.highlightedTextColor
}
}