Commit 03742180 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Better look and feel for most delegates

Make routines delegates foldable
parent 8a159bef
......@@ -128,6 +128,7 @@ Project {
files: [
"components/AbstractDelegateRoutine.qml",
"components/AbstractDialogDetailsIO.qml",
"components/BorderedBackground.qml",
"components/Circle.qml",
"components/ClickableTextLabel.qml",
"components/Components.qml",
......
import QtQuick 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
Item {
id: base;
property bool active : false;
property bool alternate : false;
property bool rounded : false;
Rectangle {
color: (active
? Style.colorHighlight
: (alternate
? Style.colorWindow
: Style.colorSecondary));
radius: (rounded ? Style.roundness : 0);
antialiasing: rounded;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
}
......@@ -27,6 +27,7 @@ ExpandableGroup {
DimensionsList {
id: dims;
alternate: !base.alternate;
dimensionsList: (block
? [
block.pivotPos,
......
......@@ -40,10 +40,10 @@ ExpandableGroup {
}
properties: {
switch (modelData ["family"]) {
case ObjectFamily.VALUE: return ({ "phyVal" : modelData });
case ObjectFamily.GROUP: return ({ "group" : modelData });
case ObjectFamily.BLOCK: return ({ "block" : modelData });
case ObjectFamily.MARKER: return ({ "marker" : modelData });
case ObjectFamily.VALUE: return ({ "phyVal" : modelData, "alternate" : !base.alternate });
case ObjectFamily.GROUP: return ({ "group" : modelData, "alternate" : !base.alternate });
case ObjectFamily.BLOCK: return ({ "block" : modelData, "alternate" : !base.alternate });
case ObjectFamily.MARKER: return ({ "marker" : modelData, "alternate" : !base.alternate });
default: return ({});
}
}
......
......@@ -27,6 +27,7 @@ ExpandableGroup {
DimensionsList {
id: dims;
alternate: !base.alternate;
dimensionsList: (marker
? [
marker.relativePos,
......
......@@ -3,11 +3,11 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
BorderedBackground {
id: base;
active: clicker.containsMouse;
height: implicitHeight;
visible: shouldBeVisible;
hoverEnabled: true;
implicitHeight: (layoutValPhyTable.height + layoutValPhyTable.anchors.margins * 2);
ExtraAnchors.horizontalFill: parent;
onCurrentChanged: {
......@@ -32,18 +32,9 @@ MouseArea {
signal needVisible (Item item);
signal valueEdited (real value);
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;
MouseArea {
id: clicker;
hoverEnabled: true;
anchors.fill: parent;
}
StretchRowContainer {
......@@ -67,11 +58,7 @@ MouseArea {
}
}
}
Line {
opacity: 0.65;
implicitWidth: -1;
anchors.verticalCenter: parent.verticalCenter;
}
Stretcher { }
TextLabel {
text: (phyVal ? phyVal.val.toFixed (2) : "");
visible: !editable;
......
......@@ -3,27 +3,18 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
BorderedBackground {
id: base;
height: implicitHeight;
hoverEnabled: true;
active: clicker.containsMouse;
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;
MouseArea {
id: clicker;
hoverEnabled: true;
anchors.fill: parent;
}
StretchRowContainer {
......
......@@ -3,27 +3,18 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
BorderedBackground {
id: base;
height: implicitHeight;
hoverEnabled: true;
active: clicker.containsMouse;
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;
MouseArea {
id: clicker;
hoverEnabled: true;
anchors.fill: parent;
}
StretchRowContainer {
......
......@@ -40,7 +40,7 @@ ExpandableGroup {
}
return null;
}
properties: ({ "io" : io });
properties: ({ "io" : io, "alternate" : !base.alternate });
ExtraAnchors.horizontalFill: parent;
readonly property AbstractIO io : modelData;
......
......@@ -3,27 +3,18 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
BorderedBackground {
id: base;
height: implicitHeight;
hoverEnabled: true;
active: clicker.containsMouse;
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;
MouseArea {
id: clicker;
hoverEnabled: true;
anchors.fill: parent;
}
StretchRowContainer {
......
......@@ -3,27 +3,18 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
MouseArea {
BorderedBackground {
id: base;
height: implicitHeight;
hoverEnabled: true;
active: clicker.containsMouse;
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;
MouseArea {
id: clicker;
hoverEnabled: true;
anchors.fill: parent;
}
StretchRowContainer {
......
......@@ -24,7 +24,7 @@ ExpandableGroup {
model: (node ? node.boards : 0);
delegate: InstanceCreator {
component: Components.delegateRawBoardTable;
properties: ({ "board" : modelData });
properties: ({ "board" : modelData, "alternate" : !base.alternate });
ExtraAnchors.horizontalFill: parent;
}
}
......
......@@ -8,6 +8,7 @@ Repeater {
model: physicalValuesTree;
delegate: ExpandableGroup {
id: delegateDimensionTable;
alternate: base.alternate;
visible: (modelData ["highlightCount"] > 0 ||
modelData ["editableCount"] > 0 ||
!Shared.showOnlyEditable);
......@@ -31,7 +32,7 @@ Repeater {
}
onValueEdited: { base.valueEdited (delegateDimensionTable.dimension, phyVal, value); }
}
properties: ({ "phyVal" : modelData });
properties: ({ "phyVal" : modelData, "alternate" : !delegateDimensionTable.alternate });
ExtraAnchors.horizontalFill: parent;
}
}
......@@ -83,6 +84,8 @@ Repeater {
return ret;
}
property bool alternate : false;
readonly property int shouldBeVisible : {
var ret = false;
physicalValuesTree.forEach (function (entry) {
......
......@@ -3,8 +3,9 @@ import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
Item {
BorderedBackground {
id: base;
rounded: true;
implicitHeight: (layoutMain.height + layoutMain.anchors.margins * 2);
property alias iconItem : icoLoader.component;
......@@ -16,20 +17,11 @@ Item {
default property alias content : layoutItems.data;
Rectangle {
color: Style.colorSecondary;
opacity: 0.15;
border {
width: Style.lineSize;
color: Style.colorBorder;
}
anchors.fill: parent;
}
Column {
id: layoutMain;
spacing: Style.spacingNormal;
anchors {
margins: Style.spacingSmall;
margins: Style.spacingNormal;
verticalCenter: parent.verticalCenter;
}
ExtraAnchors.horizontalFill: parent;
......
......@@ -29,6 +29,7 @@ Window {
PropertyChanges {
target: Style;
useDarkTheme: Shared.rememberTheme;
roundness: 5;
spacingSmall: 4;
spacingNormal: 6;
spacingBig: 16;
......
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