Verified Commit 89419f38 authored by SZPYRKA Jean-Luc's avatar SZPYRKA Jean-Luc
Browse files

added a readonly toggle test

parent 1cdfe5fa
Pipeline #131127 passed with stage
in 0 seconds
......@@ -157,7 +157,7 @@ void setup(dtkApplication *application)
application->window()->setCentralWidget(area);
menu_bar->touch();
//menu_bar->touch();
params["button_hiding"]->connect( [=] (QVariant v) {
......@@ -170,29 +170,18 @@ void setup(dtkApplication *application)
}
});
/*
// check the dtkWidgetsMenuBar::touch() bug
params["menubar_touch_bool"]->connect( [=] (QVariant v) {
qDebug() << Q_FUNC_INFO << "Clicked on menubar_touch_bool, waiting 0.5 sec";
QThread::usleep(500000);
qDebug() << Q_FUNC_INFO << "End of sleep in menubar_touch_bool";
menu_bar->touch();
});
// check the dtkWidgetsMenuBar::touch() bug
params["menubar_touch_int"]->connect( [=] (QVariant v) {
qDebug() << Q_FUNC_INFO << "Clicked on menubar_touch_int , waiting 0.5 sec";
QThread::usleep(500000);
qDebug() << Q_FUNC_INFO << "End of sleep in menubar_touch_int";
menu_bar->touch();
});
// this qDebug tests that the spinbox is updated upon losing focus.
params["prec"]->connect( [=] (QVariant v) {
double val = v.value<dtk::d_real>();
qDebug() << Q_FUNC_INFO << "new prec: " << val;
params["checkbox_ro_toggle"]->connect( [=] (QVariant v) {
bool visible = v.value<dtk::d_bool>();
if(visible) {
//params["slider_double_ro_and_rw"]->setReadOnly(false);
params["slider_double_ro_and_rw"]->setLabel("Slider READWRITE");
params["checkbox_ro_toggle"]->setDocumentation("Next widget is READWRITE");
} else {
//params["slider_double_ro_and_rw"]->setReadOnly(true);
params["slider_double_ro_and_rw"]->setLabel("Slider READONLY");
params["checkbox_ro_toggle"]->setDocumentation("Next widget is READONLY");
}
});
*/
QObject::connect(application->window()->menubar(), &dtkWidgetsMenuBar::entered, [=] (dtkWidgetsMenu *target) {
......
......@@ -158,6 +158,21 @@
"max": 10.0,
"decimals": 2
},
"checkbox_ro_toggle":{
"label": "toggle RO/RW of next parameter",
"doc": "It's a checkbox",
"value": true,
"type": "dtk::d_bool"
},
"slider_double_ro_and_rw": {
"type": "dtk::d_real",
"doc": "It's a slider of double, which is READONLY or not",
"label": "Slider double (Read Write)",
"min": -10.0,
"value": 3.0,
"max": 10.0,
"decimals": 2
},
......
......@@ -74,6 +74,22 @@
"advanced": false,
"widget_read_only": true
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterBoolCheckBox",
"uid": "checkbox_ro_toggle",
"advanced": false,
"widget_read_only": false
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterDoubleSlider",
"uid": "slider_double_ro_and_rw",
"advanced": false,
"widget_read_only": false
}
}
],
"uid": "Read-only parameters",
......
Supports Markdown
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