Debian Codegraph @

src/xmpsolve/SwitchableApproximationView.qml

raw
1 import QtQuick 2.1
2 import QtQuick.Controls 1.0
3 import MPSolve 1.0
4
5 Column {
6
7 function toggleView() {
8 switch (stackView.state) {
9 case 0:
10 stackView.push(approximationList)
11 break;
12 case 1:
13 stackView.push(rootsRenderer);
14 break;
15 }
16
17 stackView.state = (stackView.state + 1) % 2;
18 }
19
20 spacing: 16
21
22 StackView {
23 id: stackView
24 initialItem: rootsRenderer
25
26 property int state: 0;
27
28 ApproximationList {
29 id: approximationList
30 model: rootsModel
31 clip: true
32 visible: false
33 }
34
35 QQuickRootsRenderer {
36 id: rootsRenderer
37 model: rootsModel
38 }
39 }
40
41 Button {
42 text: "Toggle Graphics / Approximation list"
43 width: parent.width
44 height: 32
45
46 onClicked: toggleView()
47 }
48
49 }