Solved problem setting the visibility of widget.
-
i have copule of widget in ui file.
so i use setVisible to false to hide some of them.then i later tried to show them by using setVisible(1) .
but it dose not shows the widget.ui->calandarW->setVisible(0); ui->timeW->setVisible(0); ui->batteryW->setVisible(0); ui->sysW->setVisible(0); ui->networkW->setVisible(0); ui->timeW->setVisible(0); if(sm.getShowTime() == 1){//getting bool from qsetting ui->timeW->setVisible(1); }
note : sure, setting is giving me true.
i also tried this .
//hiding all the widgets ui->calculatorW->setVisible(1); ui->calandarW->setVisible(0); ui->timeW->setVisible(0); ui->batteryW->setVisible(0); ui->sysW->setVisible(0); ui->networkW->setVisible(0); //then only showing the calculatorW ui->calculatorW->setVisible(1);
not working. not showing the "calculatorW" widget.
HERE IS THE CPP FILE GITHUB
what is the problem?
-
@saber Is the
coreaction
widget visible? If it is hidden, then all of its child widgets will be hidden too.Note: You can replace
setVisible(1)
withshow()
, andsetVisible(0)
withhide()
. -
coreaction widget is shown on start up then after 8 second it's hidden.
-
@saber
Hi
Just so we are clear. All Widgets within another widget cannot be visible
unless the parent widget is. So there is no need to hide all children.
You can just hide/show the parent.
setVisible is proven to work so its something else in your code.Does it work if you dont try to hide anything from start ? All is shown?
-
@mrjj
if i not hide or setVisible(0) then all the widget shows just fine.u could see the cpp file coreaction cpp
-
@saber said in problem setting the visibility of widget.:
coreaction widget is shown on start up then after 8 second it's hidden.
When the
coreaction
widget is not visible,ui->calculatorW->setVisible(1);
will not makecalculatorW
visible. -
i found the problem.
i put most of the widget in battery widget.
so if battery widget is shown most of the widget is shown.it happened in ui.
silly mistake .
sorry everyone.