diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-22 18:18:41 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-22 18:29:07 +0200 |
commit | 125672b91ddb3ef4a39b41fe1434114cb1cc1f9d (patch) | |
tree | ffbd81e9c532f2ae8a1381d9f438720eb63b42a4 /examples | |
parent | cd7497a84382f2f2061ae0071d90602eb96aad5b (diff) |
Finish FlowDecision dialog
Change-Id: I55fef0870258bcff000da1e822e48907ede1a738
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/imports/FlowView/FlowDecision.qml | 80 | ||||
-rw-r--r-- | examples/imports/FlowView/FlowTransition.qml | 12 | ||||
-rw-r--r-- | examples/imports/FlowView/designer/FlowDecisionSpecifics.qml | 27 | ||||
-rw-r--r-- | examples/imports/FlowView/designer/FlowTransitionSpecifics.qml | 128 |
4 files changed, 188 insertions, 59 deletions
diff --git a/examples/imports/FlowView/FlowDecision.qml b/examples/imports/FlowView/FlowDecision.qml index 6bf7072..7292c4a 100644 --- a/examples/imports/FlowView/FlowDecision.qml +++ b/examples/imports/FlowView/FlowDecision.qml @@ -28,6 +28,7 @@ ****************************************************************************/ import QtQuick 2.10 +import QtQuick.Window 2.14 QtObject { id: root @@ -35,4 +36,83 @@ QtObject { property list<FlowTransition> targets readonly property bool isFlowDecision: true + + property string dialogTitle: qsTr("Title") + + function trigger() { + var hasDialog = false + for (var i = 0; i < root.targets.length; ++i) { + if (root.targets[i].question !== "") + hasDialog = true + } + + if (hasDialog) { + loader.show() + } + } + + property Loader loader: Loader { + active: false + function show() { + active = true + item.show() + item.raise() + item.requestActivate() + } + + sourceComponent: windowComponent + } + + property Component windowComponent: Component { + + Window { + + id: dialog + + title: root.dialogTitle + modality: Qt.WindowModal + transientParent: root.Window.window + + width: 400 + height: 100 + + minimumWidth: 400 + minimumHeight: 100 + flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.WindowTitleHint + + Rectangle { + id: background + anchors.fill: parent + Column { + Repeater { + model: targets + Rectangle { + visible: root.targets[index].question !== "" + width: background.width + height: 20 + opacity: mouseArea.containsMouse ? 1 : 0.8 + color: index / 2 ? "#ebecf0" : "white" + MouseArea { + id: mouseArea + hoverEnabled: true + onClicked: { + root.targets[index].trigger() + loader.item.close() + loader.active = false + } + anchors.fill: parent + } + + Text { + height: 20 + text: root.targets[index].question + verticalAlignment: Text.AlignVCenter + } + } + } + } + } + } + + } } diff --git a/examples/imports/FlowView/FlowTransition.qml b/examples/imports/FlowView/FlowTransition.qml index ed80ca6..cadbe35 100644 --- a/examples/imports/FlowView/FlowTransition.qml +++ b/examples/imports/FlowView/FlowTransition.qml @@ -45,6 +45,10 @@ QtObject { property real progress: effect.progress + property bool condition: true + + property string question + function __start() { print("start " + this) root.effect.start() @@ -76,16 +80,12 @@ QtObject { } function trigger() { - print("hmm") - if (root.from === null) - return; - if (root.to === null) - return; + var fromEmpty = root.from.length === 0 if (to[0].isFlowDecision === true) to[0].trigger(); - if (__checkInclude(root.from, transitionView.currentItem)) + if (fromEmpty || __checkInclude(root.from, transitionView.currentItem)) transitionView.gotoPage(root) } diff --git a/examples/imports/FlowView/designer/FlowDecisionSpecifics.qml b/examples/imports/FlowView/designer/FlowDecisionSpecifics.qml index 37e9807..0454475 100644 --- a/examples/imports/FlowView/designer/FlowDecisionSpecifics.qml +++ b/examples/imports/FlowView/designer/FlowDecisionSpecifics.qml @@ -38,14 +38,35 @@ Column { Section { anchors.left: parent.left anchors.right: parent.right + caption: qsTr("Flow Decision") + + SectionLayout { + rows: 1 + columns: 2 + + Label { + text: qsTr("Dialog title") + tooltip: qsTr("Sets the title of the dialog.") + } + LineEdit { + backendValue: backendValues.dialogTitle + Layout.fillWidth: true + } + + } + } + + Section { + anchors.left: parent.left + anchors.right: parent.right caption: qsTr("Outline Color") ColorEditor { backendValue: backendValues.color__AUX supportGradient: false } - } - Section { + } + Section { anchors.left: parent.left anchors.right: parent.right caption: qsTr("Fill Color") @@ -54,5 +75,5 @@ Column { backendValue: backendValues.fillColor__AUX supportGradient: false } - } + } } diff --git a/examples/imports/FlowView/designer/FlowTransitionSpecifics.qml b/examples/imports/FlowView/designer/FlowTransitionSpecifics.qml index b6f0c9f..06e683a 100644 --- a/examples/imports/FlowView/designer/FlowTransitionSpecifics.qml +++ b/examples/imports/FlowView/designer/FlowTransitionSpecifics.qml @@ -44,66 +44,94 @@ Column { backendValue: backendValues.color__AUX supportGradient: false } - } + } + Section { + anchors.left: parent.left + anchors.right: parent.right + caption: qsTr("Transition") + + SectionLayout { + Label { + text: qsTr("Condition") + tooltip: qsTr("Determines whether the transition is active or not.") + } + CheckBox { + Layout.fillWidth: true + text: qsTr("Transtion Active") + backendValue: backendValues.condition + } + + Label { + text: qsTr("Question") + tooltip: qsTr("The transition will pop up dialog with the question") + } + LineEdit { + backendValue: backendValues.question + Layout.fillWidth: true + } + } + } + + Section { anchors.left: parent.left anchors.right: parent.right caption: qsTr("Transition Parameters") - SectionLayout { - rows: 4 - columns: 2 + SectionLayout { + rows: 4 + columns: 2 - Label { - text: qsTr("Line Width") - tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") - } - SpinBox { - backendValue: backendValues.width__AUX - maximumValue: 22 - minimumValue: 1 - } + Label { + text: qsTr("Line Width") + tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") + } + SpinBox { + backendValue: backendValues.width__AUX + maximumValue: 22 + minimumValue: 1 + } Label { - text: qsTr("In Offset") - tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") - } - SpinBox { - backendValue: backendValues.inOffset__AUX - maximumValue: 128 - minimumValue: -128 - } + text: qsTr("In Offset") + tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") + } + SpinBox { + backendValue: backendValues.inOffset__AUX + maximumValue: 128 + minimumValue: -128 + } - Label { - text: qsTr("Out Offset") - tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") - } - SpinBox { - backendValue: backendValues.outOffset__AUX - maximumValue: 128 - minimumValue: -128 - } + Label { + text: qsTr("Out Offset") + tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") + } + SpinBox { + backendValue: backendValues.outOffset__AUX + maximumValue: 128 + minimumValue: -128 + } - Label { - text: qsTr("Break Offset") - tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") - } - SpinBox { - backendValue: backendValues.breakPoint__AUX - maximumValue: 100 - minimumValue: 0 - } + Label { + text: qsTr("Break Offset") + tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") + } + SpinBox { + backendValue: backendValues.breakPoint__AUX + maximumValue: 100 + minimumValue: 0 + } - Label { - text: qsTr("Dash Line") - tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") - } - CheckBox { - Layout.fillWidth: true - text: backendValues.dash__AUX.value - backendValue: backendValues.dash__AUX - } + Label { + text: qsTr("Dash Line") + tooltip: qsTr("Sets the margin, in pixels, around the text in the TextEdit..") + } + CheckBox { + Layout.fillWidth: true + text: backendValues.dash__AUX.value + backendValue: backendValues.dash__AUX + } - } - } + } + } } |