Ensure the Label bar uses the theme

CURA-6598
This commit is contained in:
Jaime van Kessel 2019-07-29 16:12:39 +02:00
parent ae406e2480
commit 3b93a1914a

View file

@ -1,7 +1,7 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.2 as UM
// The labelBar shows a set of labels that are evenly spaced from oneother. // The labelBar shows a set of labels that are evenly spaced from oneother.
// The first item is aligned to the left, the last is aligned to the right. // The first item is aligned to the left, the last is aligned to the right.
// It's intended to be used together with RadioCheckBar. As such, it needs // It's intended to be used together with RadioCheckBar. As such, it needs
@ -10,10 +10,14 @@ Item
{ {
id: base id: base
property var model: null property var model: null
property string modelKey: ""
property int itemSize: 14 property int itemSize: 14
height: childrenRect.height
RowLayout RowLayout
{ {
anchors.fill: parent anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
spacing: 0 spacing: 0
Repeater Repeater
{ {
@ -25,12 +29,14 @@ Item
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumWidth: index + 1 === repeater.count ? itemSize: 200000000 Layout.maximumWidth: index + 1 === repeater.count ? itemSize: 200000000
height: childrenRect.height
Label Label
{ {
id: label id: label
text: model.text text: model[modelKey]
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
height: contentHeight
anchors anchors
{ {
// Some magic to ensure that the items are aligned properly. // Some magic to ensure that the items are aligned properly.