Facing problems with switching through multiple windows in my GUI
-
Hi and welcome to devnet,
Are you doing some kind of wizard ?
Or do you want to go back and forth with them ?
-
Hello, @SGaist, thank you for your reply.
No, It's not a wizard. I should be able to go back and forth. -
Then it looks like you should rather use a QStackedWidget rather than re-create the widgets all the time and handle the switching at a higher level.
-
@SGaist You're absolutely right. The transition is much smoother now.
One more question please, my first window is a loading screen like the one shown in the picture attached, and then the software windows themselves are in the QStackedWidget.
In many other software, while the loading screen is showing, the software icon doesn't actually appear in the taskbar, instead it only appears once the actual software has started (The QStackedWidget in my case).
Do you happen to know how to hide the icon from the taskbar while showing my loading screen (which is a QMainWindow btw) and then showing it later on?
Thanks a lot. -
-
I think loading screen should be separated from other windows.
Are you aware that there is a QSplashScreen class?
https://doc.qt.io/qt-5/qsplashscreen.html -
Hey @Bonnie, I did not know of this class. I started reading about it, and I believe that this would be better for my software. Here's another useful example for PyQt5 if someone is interested:
https://stackoverflow.com/questions/58661539/create-splash-screen-in-pyqt5Quick question though, I am planing on building my loading screen (QSplashScreen) on MainWindow1 and then have the rest of my windows in QStackedWidget built on MainWindow2. I have read in an article that using multiple Mainwindows in your software is bad practice. Is this correct? or I can just go forward with my plan?
-
@Ahmed-Zeid said in Facing problems with switching through multiple windows in my GUI:
using multiple Mainwindows in your software is bad practice. Is this correct?
In my opinion, yes.
Don't put QSplashScreen in any window. Itself is a window, just without title bar / window frame / taskbar item. -
@Ahmed-Zeid
You should only need one main window. (Splash screen is outside of main window, as @Bonnie said.)and then have the rest of my windows in QStackedWidget built on MainWindow2
What do you mean by "built on"? Your main window should have a
QStackedWidget
as its main/central widget, and then your various "pages" should just beQWidget
s placed in the stacked widget, notQMainWindow
s themselves. The main window's framework is around the outside of the stacked widget. -
Hello, @JonB, thanks a lot for your reply. Yes, this is exactly what I meant.
Sorry for being unclear before.
11/11