Commit af29121c authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Better visual look and feel for I/O table delegates

parent 2e4a896c
......@@ -162,6 +162,12 @@ Project {
"components/DelegatePhyMarkerTable.qml",
"components/DelegatePhyValTable.qml",
"components/DelegatePropertyHelp.qml",
"components/DelegateRawAinTable.qml",
"components/DelegateRawAoutTable.qml",
"components/DelegateRawBoardTable.qml",
"components/DelegateRawDinTable.qml",
"components/DelegateRawDoutTable.qml",
"components/DelegateRawNodeTable.qml",
"components/DelegateRoutineOnCanFrame.qml",
"components/DelegateRoutineOnCanOpenNmtStateChange.qml",
"components/DelegateRoutineOnCanOpenObdValChange.qml",
......
......@@ -6,13 +6,14 @@ import QtCAN.CanTestBench 2.0;
MouseArea {
id: delegatePhyValTable;
height: implicitHeight;
visible: (current || editable || !toggleShowOnlyEditable.checked);
visible: shouldBeVisible;
hoverEnabled: true;
implicitHeight: (layoutValPhyTable.height + layoutValPhyTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
onCurrentChanged: {
if (current) {
timerEnsureVisible.restart ();
editValPhy.forceActiveFocus ();
}
}
Component.onCompleted: {
......@@ -24,6 +25,8 @@ MouseArea {
property PhysicalValue phyVal : null;
readonly property bool shouldBeVisible : (current || editable || !toggleShowOnlyEditable.checked);
readonly property bool current : (phyVal === highlightPhyVal);
readonly property bool editable : (phyVal.min !== phyVal.max);
......
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
id: base;
height: implicitHeight;
hoverEnabled: true;
implicitHeight: (layoutIoTable.height + layoutIoTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
property AnalogInput io : null;
Rectangle {
color: Style.colorSecondary;
opacity: 0.15;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
Rectangle {
color: Style.opacify (Style.colorHighlight, 0.35);
visible: base.containsMouse;
anchors.fill: parent;
}
StretchRowContainer {
id: layoutIoTable;
spacing: Style.spacingNormal;
anchors.margins: Style.spacingSmall;
anchors.verticalCenter: parent.verticalCenter;
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
color: Style.colorForeground;
visible: linkSource.visible;
anchors.verticalCenter: parent.verticalCenter;
}
ClickableTextLabel {
id: linkSource;
text: (io.link && io.link.source
? io.link.source.uid
: "");
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightSensor = null;
highlightSensor = io.link.source;
}
}
Stretcher { }
TextLabel {
text: (io.resolutionInPoints + " points");
color: Style.colorBorder;
visible: io.isAnalog;
anchors.verticalCenter: parent.verticalCenter;
}
Stretcher { implicitWidth: (Style.spacingBig * 3); }
NumberBox {
padding: Style.spacingSmall;
minValue: io.minRaw;
maxValue: io.maxRaw;
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.valRaw = value; }
Binding on value { value: io.valRaw; }
}
}
}
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
id: base;
height: implicitHeight;
hoverEnabled: true;
implicitHeight: (layoutIoTable.height + layoutIoTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
property AbstractIO io : null;
Rectangle {
color: Style.colorSecondary;
opacity: 0.15;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
Rectangle {
color: Style.opacify (Style.colorHighlight, 0.35);
visible: base.containsMouse;
anchors.fill: parent;
}
StretchRowContainer {
id: layoutIoTable;
spacing: Style.spacingNormal;
anchors.margins: Style.spacingSmall;
anchors.verticalCenter: parent.verticalCenter;
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link &&
io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
color: Style.colorForeground;
visible: linkTarget.visible;
anchors.verticalCenter: parent.verticalCenter;
}
ClickableTextLabel {
id: linkTarget;
text: (io.link && io.link.target
? io.link.target.uid
: "");
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightActuator = null;
highlightActuator = io.link.target;
}
}
Stretcher { }
TextLabel {
text: (io.resolutionInPoints + " points");
color: Style.colorBorder;
visible: io.isAnalog;
anchors.verticalCenter: parent.verticalCenter;
}
Stretcher { implicitWidth: (Style.spacingBig * 3); }
NumberBox {
padding: Style.spacingSmall;
visible: io.isAnalog;
minValue: io.minRaw;
maxValue: io.maxRaw;
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.valRaw = value; }
Binding on value { value: io.valRaw; }
}
}
}
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
uidLabel {
text: board.uid;
emphasis: true;
font.italic: true;
}
titleLabel {
text: board.title;
font.italic: true;
}
ExtraAnchors.horizontalFill: parent;
property Board board : null;
signal needVisible (Item item);
Repeater {
model: board.ios;
delegate: InstanceCreator {
component: {
switch (io.type) {
case ObjectType.ANALOG:
switch (io.direction) {
case ObjectDirection.INPUT: return compoDelegateRawAinTable;
case ObjectDirection.OUTPUT: return compoDelegateRawAoutTable;
}
break;
case ObjectType.DIGITAL:
switch (io.direction) {
case ObjectDirection.INPUT: return compoDelegateRawDinTable;
case ObjectDirection.OUTPUT: return compoDelegateRawDoutTable;
}
break;
}
return null;
}
properties: ({ "io" : io });
ExtraAnchors.horizontalFill: parent;
readonly property AbstractIO io : modelData;
}
}
}
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
id: base;
height: implicitHeight;
hoverEnabled: true;
implicitHeight: (layoutIoTable.height + layoutIoTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
property DigitalInput io : null;
Rectangle {
color: Style.colorSecondary;
opacity: 0.15;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
Rectangle {
color: Style.opacify (Style.colorHighlight, 0.35);
visible: base.containsMouse;
anchors.fill: parent;
}
StretchRowContainer {
id: layoutIoTable;
spacing: Style.spacingNormal;
anchors.margins: Style.spacingSmall;
anchors.verticalCenter: parent.verticalCenter;
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
color: Style.colorForeground;
visible: linkSource.visible;
anchors.verticalCenter: parent.verticalCenter;
}
ClickableTextLabel {
id: linkSource;
text: (io.link && io.link.source
? io.link.source.uid
: "");
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightSensor = null;
highlightSensor = io.link.source;
}
}
Stretcher { }
CheckableBox {
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.value = value; }
Binding on value { value: io.value; }
}
}
}
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
id: base;
height: implicitHeight;
hoverEnabled: true;
implicitHeight: (layoutIoTable.height + layoutIoTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
property DigitalOutput io : null;
Rectangle {
color: Style.colorSecondary;
opacity: 0.15;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
Rectangle {
color: Style.opacify (Style.colorHighlight, 0.35);
visible: base.containsMouse;
anchors.fill: parent;
}
StretchRowContainer {
id: layoutIoTable;
spacing: Style.spacingNormal;
anchors.margins: Style.spacingSmall;
anchors.verticalCenter: parent.verticalCenter;
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
color: Style.colorForeground;
visible: linkTarget.visible;
anchors.verticalCenter: parent.verticalCenter;
}
ClickableTextLabel {
id: linkTarget;
text: (io.link && io.link.target
? io.link.target.uid
: "");
visible: (text !== "");
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
highlightActuator = null;
highlightActuator = io.link.target;
}
}
Stretcher { }
Stretcher { implicitWidth: (Style.spacingBig * 3); }
CheckableBox {
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.value = value; }
Binding on value { value: io.value; }
}
}
}
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
uidLabel {
text: node.uid;
emphasis: true;
font.pixelSize: Style.fontSizeBig;
}
titleLabel {
text: node.title;
font.pixelSize: Style.fontSizeBig;
}
ExtraAnchors.horizontalFill: parent;
property Node node : null;
signal needVisible (Item item);
Repeater {
model: node.boards;
delegate: InstanceCreator {
component: compoDelegateRawBoardTable;
properties: ({ "board" : modelData });
ExtraAnchors.horizontalFill: parent;
}
}
}
......@@ -22,15 +22,17 @@ Repeater {
Repeater {
id: repeaterDimensionsPhyVal;
model: modelData ["phyValList"];
delegate: DelegatePhyValTable {
id: delegatePhyValTable
phyVal: modelData;
ExtraAnchors.horizontalFill: parent;
onNeedVisible: {
delegateDimensionTable.expanded = true;
base.needVisible (item);
delegate: InstanceCreator {
visible: (instance && instance ["shouldBeVisible"]);
component: DelegatePhyValTable {
onNeedVisible: {
delegateDimensionTable.expanded = true;
base.needVisible (item);
}
onValueEdited: { base.valueEdited (delegateDimensionTable.dimension, phyVal, value); }
}
onValueEdited: { base.valueEdited (delegateDimensionTable.dimension, modelData, value); }
properties: ({ "phyVal" : modelData });
ExtraAnchors.horizontalFill: parent;
}
}
}
......
This diff is collapsed.
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