Skip to content

Commit 75f3705

Browse files
boutinbPabRod
andauthored
Add an advanced section in LoadingData to show how to play with variables in QML (#23)
* Add an advanced section in LoadingData * Fix minor typo --------- Co-authored-by: Pablo Rodríguez Sánchez <pablo.rodriguez.sanchez@gmail.com>
1 parent 32926b7 commit 75f3705

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

inst/qml/LoadingData.qml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,63 @@ Form
5151
}
5252
}
5353

54+
Section
55+
{
56+
title : qsTr("Advanced")
57+
columns: 1
58+
59+
Text { text: qsTr("This example shows how to get the factors of a variable") }
60+
61+
DropDown
62+
{
63+
id : nominalOrOrdinalVariables
64+
name : "nominalOrOrdinalVariables"
65+
label : "Nominal or Ordinal variable"
66+
addEmptyValue : true
67+
placeholderText : qsTr("Select one variable")
68+
source : [{isDataSetVariables: true, use: "type=nominal|ordinal" } ]
69+
info : qsTr("Only nominal or ordinal variable are available. Choose one of them.")
70+
}
71+
72+
Text
73+
{
74+
text : qsTr("<b>Warning</b>: No nominal or ordinal variable in your dataset.<br>Either change a variable type from scale to nominal (or ordinal), or load another dataset")
75+
visible : nominalOrOrdinalVariables.count === 1 // Empty value is already 1 element.
76+
}
77+
78+
Group
79+
{
80+
visible : nominalOrOrdinalVariables.value !== ""
81+
82+
ComponentsList
83+
{
84+
id : valuePerLevel
85+
title : "Set value for each factor"
86+
name : "values"
87+
source : nominalOrOrdinalVariables.value !== "" ? [{values: [nominalOrOrdinalVariables.value], use: "levels" }] : []
88+
headerLabels : [qsTr("Check"), qsTr("Value")]
89+
90+
rowComponent: RowLayout
91+
{
92+
Text { text: rowValue ; Layout.preferredWidth: 100 * jaspTheme.uiScale }
93+
CheckBox { name: "check" ; Layout.preferredWidth: 100 * jaspTheme.uiScale }
94+
DoubleField { name: "double" }
95+
}
96+
}
97+
98+
Text
99+
{
100+
text : qsTr("The factors checked in the list above will be present in the dropdown below")
101+
}
102+
103+
DropDown
104+
{
105+
label : "Checked factors"
106+
name : "checkedFactor"
107+
source : [{ name: "values", condition: "check"}]
108+
addEmptyValue : true
109+
}
110+
}
111+
}
112+
54113
}

0 commit comments

Comments
 (0)