How do you handle applications where you need to change the window as per the user
-
Sorry if the Question is lame. I am a beginner and was learning PyQT6. I am building a simple phone directory as a sample test project. It has various windows like editing screen, contact creation screen, all contacts screen etc.
Initially I used QMainWindow for each of the screen and a central controller. Later I realized that whenever I changed the QMainWindow, It first closed the previous app from the task bar and then created a new instance for the new window which is ofc not intuitive and weird. Moreover I also wanted to implement a back button but couldn't figure out how.
At the end I just settled by converting all the windows into a QWidgets and then using a stack in the main controller screen to handle to multiple screens and to implement the back button. This approach though working is just a duck tape fix.
Before starting something new, I want to ask whether there is a way to handle such stuff. I am not following any course so I may have missed something crucial.
-
@krish_garg
There are many ways to implement this, depending on what UI you want (e.g separate widgets/windows/dialogs, MDI,QStackedWidget
). Since you mention a "back" button, the one Qt class which gives this is QWizard Class if what you want is a step-by-step guiding the user through a number of sequential pages, which allows user to go back to change their answers. That does not address e.g. a separate "all contacts screen" but might be what you want for adding/editing.