Here is a complete listing of the example source file.
import QtQuick 2.11
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
ColumnLayout {
anchors.fill: parent
property real quadrat: Theme.units.quadrat
Column {
Layout.alignment:
Qt.AlignCenter
spacing: 10
Slider {
id: slider
anchors.left: parent.left
anchors.right: parent.right
from: 0
to: 100
}
Item {
width: quadrat * 2.5
height: quadrat * 3.75
id: sidePropNumberDisplay
anchors.horizontalCenter: parent.horizontalCenter
leftPadding: quadrat * 0.25
rightPadding: quadrat * 0.25
bottomPadding: quadrat * 0.5
integralWidth: 4
fractionalWidth: 0
unit: "kWh"
warning: value > 500
alarm: value > 800
}
}
id: element
anchors.top: sidePropNumberDisplay.bottom
width: parent.width
height: parent.height - sidePropNumberDisplay.height - propNumberDisplay.height
active: slider.value > 0
warning: slider.value > 80
alarm: slider.value > 90
id: numberDisplay
anchors.centerIn: parent
warning: value > 30
alarm: value > 70
}
}
id: propNumberDisplay
anchors.top: element.bottom
anchors.horizontalCenter: parent.horizontalCenter
topPadding: quadrat * 0.25
fractionalWidth: 2
unit: "Pa"
warning: value > 60
alarm: value > 90
}
}
}
}
Component.onCompleted: {
Theme.units.quadrat = 80
}
}
Definition: RectangularElement.qml:4