Making child windows/widgets appear when unminimizing a window.
-
I've got a program where a QMainWindow instance is well, the main window of the application. There are a few child windows (sublcasses of QWidget) that have the window flag Qt::Tool set to them, because of that those windows don't appear in the task bar, just the QMainWindow.
This causes a problem though when I want to unminimize the QMainWindow, the child windows will not appear (i.e. they are stuck behind some other application's window. How can I fix this so that the child windows will show when I click the taskbar button for the QMainWindow?
-
Hi,
That's intriguing, you could try to call "raise":http://doc.qt.io/qt-5/qwidget.html#raise on them
Hope it helps
-
The problem mainly is regarding "catching," when the QMainWindow is unminimized.
I tried overloading the "changeEvent()":http://doc.qt.io/qt-5/qwidget.html#changeEvent and discovered that a "QEvent::ActivationChange":http://doc.qt.io/qt-5/qevent.html#Type-enum is sent everytime when unminimizing. But it seems to be whenever I click on the QMainWindow an ActivationChange event will be sent.
The other issue too is that solution will never allow for the QMainWindow to be on top or selected.
-
What about the showEvent and checking the spontaneous flag ?
-
QMainWindow::showEvent() isn't called when un-minizming from the taskbar.
Is there some window flag I could supply to the Qt::Tool windows that makes sure the windows are always on top?
-
That's strange, it should be.
However, did you check the spontaneus flag in the changeEvent ?
-
Yes.
The spontanious flag wasn't set.