Hi,guys:
I have a mainwindow with some child windows in QWorkspace.
I want that any child will be hidden instead of being closed when the 'X' button pressed.
Any suggestion please?
Thanks in Advance.
Hi,guys:
I have a mainwindow with some child windows in QWorkspace.
I want that any child will be hidden instead of being closed when the 'X' button pressed.
Any suggestion please?
Thanks in Advance.
"closed" and "hidden" are synonyms, so in reality they are hidden when you close them, unless you pass a destructive close flag to them. But if you insist on making sure of that, override their closeEvent and call hide() there (remember to ignore the event afterwards). Just make sure you don't disable closing the window completely (meaning that at some point the closeEvent will have to be accepted).
iGoo (26th July 2006)
two points please:Originally Posted by wysota
1 、how to "ignore the event afterwards"
2 、"Just make sure you don't disable closing the window completely"
when the mainwindow closed,together with QWorkspace destroyed,can the child be
clean completely?
Thanks!
QEvent::ignore()Originally Posted by iGooIf you ignore the close event, the close event of the parent will be ignored too automatically (AFAIR), so you might run into a problem of not being able to close your application without killing it. IMO you shouldn't reimplement the close event just to be able to call hide(), as close() does exactly the same thing (the only difference is with the destructive close flag set).2 、"Just make sure you don't disable closing the window completely"
when the mainwindow closed,together with QWorkspace destroyed,can the child be
clean completely?
"the only difference is with the destructive close flag set"
I just notice the statement above,thanks.
I want all of my child windows to receive some messages while work thread processing,but I don't want the user to see all of them except the user want.
So I want to "hide" but not "close" the window in which situation,the message sent
to them may be lost.
I will try now.
Thanks again.
Bookmarks