Commit fae5ae38 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Add new StringValueDisplay component for dashboard

parent 3336c395
......@@ -185,6 +185,7 @@ Project {
"import/QtCAN/CanTestBench.2/Oscilloscope.qml",
"import/QtCAN/CanTestBench.2/PlotParams.qml",
"import/QtCAN/CanTestBench.2/RotativeKnob.qml",
"import/QtCAN/CanTestBench.2/StringValueDisplay.qml",
"import/QtCAN/CanTestBench.2/TicksJauge.qml",
"import/QtCAN/CanTestBench.2/qmldir",
"ui_testBench.qml",
......
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtCAN.CanTestBench 2.0;
Item {
implicitWidth: (column.width + column.anchors.margins * 2);
implicitHeight: (column.height + column.anchors.margins * 2);
property int size : 50;
property string value : "";
property int len : 0;
property color background : Style.colorWindow;
property string unit : "";
property string legend : "";
Rectangle {
radius: Math.round (size * 0.15);
antialiasing: radius;
border {
width: Math.max (Style.lineSize, Style.lineSize / Shared.manager.dashboardZoom) * 2;
color: Style.colorBorder;
}
gradient: Gradient {
GradientStop { position: 0; color: Qt.darker (background, 1.15); }
GradientStop { position: 1; color: Qt.lighter (background, 1.15); }
}
anchors.fill: parent;
}
Column {
id: column;
spacing: Style.spacingSmall;
anchors.centerIn: parent;
anchors.margins: Style.spacingNormal;
Repeater {
model: value.trim ().split ("\n");
delegate: TextLabel {
id: lblHolder;
text: {
var ret = "";
for (var charIdx = 0; charIdx < len; ++charIdx) {
ret += "W";
}
return ret;
}
color: Style.colorNone;
font.pixelSize: size;
anchors.horizontalCenter: parent.horizontalCenter;
TextLabel {
id: lblValue;
text: modelData.substring (0, len).trim ();
color: lblLegend.color;
horizontalAlignment: TextInput.AlignHCenter;
font.pixelSize: size;
anchors.fill: parent;
}
}
}
TextLabel {
id: lblLegend;
text: legend;
color: (((background.r + background.g + background.b) / 3) < 0.5 ? "white" : "black");
visible: (text !== "");
opacity: 0.65;
font.pixelSize: (size * 0.35);
anchors.horizontalCenter: parent.horizontalCenter;
}
}
}
......@@ -4,6 +4,7 @@ CircleButton 2.0 CircleButton.qml
CircularGauge 2.0 CircularGauge.qml
LedLight 2.0 LedLight.qml
LinearGauge 2.0 LinearGauge.qml
StringValueDisplay 2.0 StringValueDisplay.qml
NumberValueDisplay 2.0 NumberValueDisplay.qml
NumberValueInput 2.0 NumberValueInput.qml
OnOffSwitcher 2.0 OnOffSwitcher.qml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment