Show widget or label above all widget
-
I want to display a loading screen every time a user presses a button (a process that takes a few seconds runs).
QSplashScreen
does not help me because that is only used before opening the application and a QDialog is not useful for me because I want that by dragging the window the application will move along with the message Loading... -
QSplashScreen does not help me because that is only used before opening the application
Although I'm not saying it will do what you want, you can use
QSplashScreen
at any point in an application.You should look at QProgressDialog, and try to use that as it's ready-made for you. You may have to set it modal to get your drag behaviour. At least under Linux/GNOME, dragging a modal dialog drags it's parent window with it.
-
@Flanagan
I think you will have no choice about this under Windows then. Either you won't be able to move the back (main) window at all, or you will be able to move it but it won't take the fore dialog with it (like it does under GNOME). I don't know why you want to be able to drag the back window while something is happening and have it take the dialog with it, but if you do I would look at have the dialog modeless and write your own code so that if the main window is moved you respond by moving the dialog yourself. -
Hi
As an alternative, you can also use a custom overlay widget
https://stackoverflow.com/questions/19362455/dark-transparent-layer-over-a-qmainwindow-in-qt/19367454#19367454You can disable setAttribute(Qt::WA_TransparentForMouseEvents);
and user cannot click on MainWin while its up.
Its inside MainWin so it follows on move.
It uses event filter to resize it self to parent automatically.You can alter paint event, to only darken a sub rect if you want only part of the main looking covered.