1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import QtQuick 2.10
- import QtQuick.Controls 2.3
- import QtQuick.Layouts 1.3
- import UM 1.2 as UM
- Item
- {
- id: base
- property var model: null
- property string modelKey: ""
- property int itemSize: 14
- height: childrenRect.height
- RowLayout
- {
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 0
- Repeater
- {
- id: repeater
- model: base.model
- Item
- {
- Layout.fillWidth: true
- Layout.maximumWidth: Math.round(index + 1 === repeater.count || repeater.count <= 1 ? itemSize : base.width / (repeater.count - 1))
- height: label.height
- Label
- {
- id: label
- text: model[modelKey]
- color: UM.Theme.getColor("text")
- font: UM.Theme.getFont("default")
- renderType: Text.NativeRendering
- height: contentHeight
- anchors
- {
-
-
-
-
-
-
- right: index + 1 === repeater.count ? parent.right: undefined
- left: index + 1 === repeater.count || index === 0 ? undefined: parent.left
- leftMargin: Math.round((itemSize - contentWidth) * 0.5)
-
-
- verticalCenter: parent.verticalCenter
- }
- }
- }
- }
- }
- }
|