QWidget findChildren shows non existing childs
Hi!
I need to catch if child widget is open and I use findChildren from parent.
In first loop, after child widget is initialized in 1 time - I find it with findChildren, and it's ok.
But after closing child widget with close() - the findChildren still shows child object in generated list.
After open child widget in 2 time findChildren shows two copies of child objects.
How findChildren works?
Why findChildren didn't remove a non-existing child objects?
Re: QWidget findChildren shows non existing childs
Quote:
Originally Posted by
Goodwin
Why findChildren didn't remove a non-existing child objects?
It does only find existing objects.
close() doesn't remove a widget.
Cheers,
_
Re: QWidget findChildren shows non existing childs
So how can I close widget and ?destroy? it?
Re: QWidget findChildren shows non existing childs
you can set Qt::WA_DeleteOnClose property to the widget (child). then widget will be deleted when it is closed.
or if you still want to use the object & do not want to delete it on close. you can use QWidget::isvisible() after you find children to make sure it has close or not.
Re: QWidget findChildren shows non existing childs
Thanks a lot for your help.
I'm self-taught, and I was not familiar with this option.
Thanks man