Quite often I find that I need to show and bring a window to a front. For example when the user attempts to reload the same document I simply bring up the old one. To do this I have code like this:
widget->raise();
widget->activateWindow();
widget->showNormal();
It's starting to feel like I'm missing a shortcut function. Surely this type of behaviour is quite common. Is there some preferred function that will do all of the above and/or just do the right thing on each target OS?
Note: I've just noticed a defect, thus a special function is even more important now. If the window is minimized, activateWindow
does not work. This happens even if you reorder the above to showNormal
first.
this is a working "shortcut" :
widget->setWindowState(Qt::WindowActive) ;
You can couple it with the last Qt::WindowState
of the window.
This notation is not very explicit though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With