Debian Codegraph @

src/xmpsolve/ApproximationList.qml

raw
1 import QtQuick 2.1
2
3 Column {
4
5 /**
6 * @brief Update the description of the approximations.
7 *
8 * @param count The number of items in the list.
9 */
10 function updateText(count) {
11 if (count > 0) {
12 approximationTitle.text = "List of approximations: ";
13 approximationTitle.font.pointSize = "14";
14 }
15 else {
16 approximationTitle.text = "No approximations computed.\nInsert a polynomial to see some data here!"
17 approximationTitle.font.pointSize = "10";
18 }
19 }
20
21 property alias model : resultsView.model
22 spacing: 16
23
24 Text {
25 id: approximationTitle
26 }
27
28 ListView {
29 id: resultsView
30 delegate: approximationDelegate
31 spacing: 6
32 clip: true
33
34 height: 420
35 width: parent.width
36
37 onCountChanged: {
38 updateText(count)
39 }
40
41 Component {
42 id: approximationDelegate
43
44 Rectangle {
45
46 width: parent.width
47 height: 48
48 color: "#4d4"
49 opacity: .9
50 radius: 6
51
52 Column {
53
54 spacing: 6
55
56 anchors.margins: 6
57 anchors.fill: parent
58
59 Text {
60 id: approximationItem
61 text: short_approximation
62 height: 14
63 font.pointSize: 11
64 }
65
66 Text {
67 text: "Inclusion radius: " + inclusion_radius + ", Status: " + status
68 font.pointSize: 9
69 color: "#444"
70 height: 14
71 }
72
73 }
74
75 MouseArea {
76 anchors.fill: parent
77 onClicked: {
78 rootsModel.markRoot(index);
79 switchableView.toggleView();
80 }
81 }
82 }
83 }
84 }
85 }