Commit 8a159bef authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Fix a lot of QML warnings on reset

parent cf311516
......@@ -7,16 +7,16 @@ ExpandableGroup {
id: base;
expandable: (dims.shouldBeVisible || !Shared.showOnlyEditable);
iconItem: Rectangle {
color: block.color;
color: (block ? block.color : Style.colorNone);
implicitWidth: Style.iconSize (1);
implicitHeight: Style.iconSize (1);
}
uidLabel {
text: block.uid;
text: (block ? block.uid : "");
font.pixelSize: Style.fontSizeBig;
}
titleLabel {
text: block.title;
text: (block ? block.title : "");
font.pixelSize: Style.fontSizeBig;
}
ExtraAnchors.horizontalFill: parent;
......@@ -27,12 +27,14 @@ ExpandableGroup {
DimensionsList {
id: dims;
dimensionsList: [
block.pivotPos,
block.size,
block.angle,
block.absoluteAngle,
];
dimensionsList: (block
? [
block.pivotPos,
block.size,
block.angle,
block.absoluteAngle,
]
: []);
onNeedVisible: {
base.expanded = true;
base.needVisible (item);
......
......@@ -11,12 +11,12 @@ ExpandableGroup {
color: Style.colorForeground;
}
uidLabel {
text: group.uid;
text: (group ? group.uid : "");
emphasis: true;
font.pixelSize: Style.fontSizeBig;
}
titleLabel {
text: group.title;
text: (group ? group.title : "");
font.pixelSize: Style.fontSizeBig;
}
ExtraAnchors.horizontalFill: parent;
......@@ -26,7 +26,7 @@ ExpandableGroup {
signal needVisible (Item item);
Repeater {
model: group.subObjects;
model: (group ? group.subObjects : 0);
delegate: InstanceCreator {
id: creator;
component: {
......
......@@ -12,11 +12,11 @@ ExpandableGroup {
color: Style.colorForeground;
}
uidLabel {
text: marker.uid;
text: (marker ? marker.uid : "");
font.pixelSize: Style.fontSizeBig;
}
titleLabel {
text: marker.title;
text: (marker ? marker.title : "");
font.pixelSize: Style.fontSizeBig;
}
ExtraAnchors.horizontalFill: parent;
......@@ -27,10 +27,12 @@ ExpandableGroup {
DimensionsList {
id: dims;
dimensionsList: [
marker.relativePos,
marker.absolutePos,
];
dimensionsList: (marker
? [
marker.relativePos,
marker.absolutePos,
]
: []);
onNeedVisible: {
base.expanded = true;
base.needVisible (item);
......
......@@ -17,15 +17,17 @@ MouseArea {
}
}
Component.onCompleted: {
Shared.manager.setDelegateForPath (phyVal.path, base);
if (phyVal) {
Shared.manager.setDelegateForPath (phyVal.path, base);
}
}
property PhysicalValue phyVal : null;
readonly property bool shouldBeVisible : (current || editable || !Shared.showOnlyEditable);
readonly property bool current : (phyVal === Shared.highlightPhyVal);
readonly property bool editable : (phyVal.min !== phyVal.max);
readonly property bool current : (phyVal ? phyVal === Shared.highlightPhyVal : false);
readonly property bool editable : (phyVal ? phyVal.min !== phyVal.max : false);
signal needVisible (Item item);
signal valueEdited (real value);
......@@ -52,13 +54,13 @@ MouseArea {
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: base.phyVal.uid;
text: (phyVal ? phyVal.uid : "");
anchors.verticalCenter: parent.verticalCenter;
Rectangle {
z: -1;
color: Style.colorHighlight;
visible: base.current;
visible: current;
anchors {
fill: parent;
margins: -Style.spacingSmall;
......@@ -71,24 +73,24 @@ MouseArea {
anchors.verticalCenter: parent.verticalCenter;
}
TextLabel {
text: base.phyVal.val.toFixed (2);
visible: !base.editable;
text: (phyVal ? phyVal.val.toFixed (2) : "");
visible: !editable;
anchors.verticalCenter: parent.verticalCenter;
}
NumberBox {
id: editValPhy;
padding: Style.spacingSmall;
visible: base.editable;
visible: editable;
decimals: 2;
minValue: base.phyVal.min;
maxValue: base.phyVal.max;
minValue: (phyVal ? phyVal.min : 0);
maxValue: (phyVal ? phyVal.max : 1);
anchors.verticalCenter: parent.verticalCenter;
onEdited: {
base.valueEdited (value);
value = base.phyVal.val;
value = phyVal.val;
}
Binding on value { value: base.phyVal.val; }
Binding on value { value: (phyVal ? phyVal.val : 0); }
}
}
}
......@@ -34,12 +34,12 @@ MouseArea {
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
text: (io ? io.uid : "");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
icon: (io && io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
......@@ -49,7 +49,7 @@ MouseArea {
}
ClickableTextLabel {
id: linkSource;
text: (io.link && io.link.source
text: (io && io.link && io.link.source
? io.link.source.uid
: "");
visible: (text !== "");
......@@ -61,20 +61,19 @@ MouseArea {
}
Stretcher { }
TextLabel {
text: (io.resolutionInPoints + " points");
text: (io ? 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;
minValue: (io ? io.minRaw : 0);
maxValue: (io ? io.maxRaw : 1);
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.valRaw = value; }
Binding on value { value: io.valRaw; }
Binding on value { value: (io ? io.valRaw : 0); }
}
}
}
......@@ -34,13 +34,12 @@ MouseArea {
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
text: (io ? io.uid : "");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link &&
io.link.reversed
icon: (io && io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
......@@ -50,7 +49,7 @@ MouseArea {
}
ClickableTextLabel {
id: linkTarget;
text: (io.link && io.link.target
text: (io && io.link && io.link.target
? io.link.target.uid
: "");
visible: (text !== "");
......@@ -62,21 +61,19 @@ MouseArea {
}
Stretcher { }
TextLabel {
text: (io.resolutionInPoints + " points");
text: (io ? 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;
minValue: (io ? io.minRaw : 0);
maxValue: (io ? io.maxRaw : 1);
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.valRaw = value; }
Binding on value { value: io.valRaw; }
Binding on value { value: (io ? io.valRaw: 0); }
}
}
}
......@@ -6,12 +6,12 @@ import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
uidLabel {
text: board.uid;
text: (board ? board.uid : "");
emphasis: true;
font.italic: true;
}
titleLabel {
text: board.title;
text: (board ? board.title : "");
font.italic: true;
}
ExtraAnchors.horizontalFill: parent;
......@@ -21,7 +21,7 @@ ExpandableGroup {
signal needVisible (Item item);
Repeater {
model: board.ios;
model: (board ? board.ios : 0);
delegate: InstanceCreator {
component: {
switch (io.type) {
......
......@@ -34,12 +34,12 @@ MouseArea {
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
text: (io ? io.uid : "");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
icon: (io && io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
......@@ -49,7 +49,7 @@ MouseArea {
}
ClickableTextLabel {
id: linkSource;
text: (io.link && io.link.source
text: (io && io.link && io.link.source
? io.link.source.uid
: "");
visible: (text !== "");
......@@ -64,7 +64,7 @@ MouseArea {
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.value = value; }
Binding on value { value: io.value; }
Binding on value { value: (io ? io.value : false); }
}
}
}
......@@ -34,12 +34,12 @@ MouseArea {
ExtraAnchors.horizontalFill: parent;
TextLabel {
text: io.uid;
text: (io ? io.uid : "");
emphasis: true;
anchors.verticalCenter: parent.verticalCenter;
}
SvgIconLoader {
icon: (io.link && io.link.reversed
icon: (io && io.link && io.link.reversed
? "qrc:///icons/reverse.svg"
: "qrc:///icons/normal.svg");
size: Style.fontSizeSmall;
......@@ -49,7 +49,7 @@ MouseArea {
}
ClickableTextLabel {
id: linkTarget;
text: (io.link && io.link.target
text: (io && io.link && io.link.target
? io.link.target.uid
: "");
visible: (text !== "");
......@@ -65,7 +65,7 @@ MouseArea {
anchors.verticalCenter: parent.verticalCenter;
onEdited: { io.value = value; }
Binding on value { value: io.value; }
Binding on value { value: (io ? io.value : false); }
}
}
}
......@@ -6,12 +6,12 @@ import QtCAN.CanTestBench 2.0;
ExpandableGroup {
id: base;
uidLabel {
text: node.uid;
text: (node ? node.uid : 0);
emphasis: true;
font.pixelSize: Style.fontSizeBig;
}
titleLabel {
text: node.title;
text: (node ? node.title : 0);
font.pixelSize: Style.fontSizeBig;
}
ExtraAnchors.horizontalFill: parent;
......@@ -21,7 +21,7 @@ ExpandableGroup {
signal needVisible (Item item);
Repeater {
model: node.boards;
model: (node ? node.boards : 0);
delegate: InstanceCreator {
component: Components.delegateRawBoardTable;
properties: ({ "board" : modelData });
......
......@@ -1078,7 +1078,7 @@ Item {
z: -1;
color: Style.colorHighlight;
radius: Style.roundness;
visible: (highlightIO === modelData);
visible: (Shared.highlightIO === modelData);
antialiasing: radius;
anchors {
fill: parent;
......
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