PDA

View Full Version : HIde WIdget from another Widget



gab74
12th September 2011, 18:00
Good mornig,
i've a widget with a button that opens another widget:

when i click to the button i set the property Childwidget->show() and all works well; (the child widget is shown)

when i click the button again (it is a qpushbutton checkable) i want the widget to be hidden so i set Childwidget->hide() but the widget doesent disappear...

Whith the debug i see the code is executed correctly...


if(mybutton->isChecked()) {

ChildWidget->show();
}
else {

ChildWidget->close(); /// i try also ChildWidget->Hide()
}

but the widget using hide or close doesent disappear..at all...

What is the problem ?
Thanks !!!

stampede
12th September 2011, 18:05
Does the ChildWidget class have custom implementation for closeEvent ( or close() | hide() | event() | event filters installed etc ) ?

gab74
12th September 2011, 20:21
What do you mean ?
No i've not implemented any custom method....
Please can you explain what you mean ?
i do not understand...
Thanks Gabriele

stampede
13th September 2011, 08:37
What exactly is a ChildWidget ? (I mean what class)
What I meant is:
1) does this class use custom implementations of "close()", "hide()", "closeEvent()" ?
2) do you have any event filters installed on the ChildWidget object (or qApp object) ?
I'm asking because you have used a method ChildWidget->Hide(), which I think is something you have implemented.

Whith the debug i see the code is executed correctly...
So you can see those messages correctly ?


if(mybutton->isChecked()) {
ChildWidget->show();
qDebug() << "show()";
}
else {
ChildWidget->close(); /// i try also ChildWidget->Hide()
qDebug() << "close()";
}

kalgorithmist
14th September 2011, 19:51
Try: ChildWidget->setVisible (false). Though it's better to post more code since it's not normal that hide() or close() don't work.