Add second window in same ui file or create new .ui file?
-
wrote on 20 Sept 2022, 12:42 last edited by WorldTeacher
I am creating a UI using the Qt designer and want to make a second window to configure settings. Can I create the UI in the same file as my main UI or do I have to create a new .ui file and load it in the code?
-
I am creating a UI using the Qt designer and want to make a second window to configure settings. Can I create the UI in the same file as my main UI or do I have to create a new .ui file and load it in the code?
wrote on 20 Sept 2022, 12:45 last edited by@WorldTeacher
If you want a quite independent, separate widget in Designer you must design it as separate file. And do whatever in code you want for displaying it when. Depending on your usage, you might design in same.ui
file if you choose to use aQStackedWidget
in Designer. -
@WorldTeacher
If you want a quite independent, separate widget in Designer you must design it as separate file. And do whatever in code you want for displaying it when. Depending on your usage, you might design in same.ui
file if you choose to use aQStackedWidget
in Designer.wrote on 20 Sept 2022, 12:52 last edited by@JonB When I created the main UI, I used the "templates/Main Window". I'll create a second file and figure out how to call it. Thanks for the help ^^
-
@JonB When I created the main UI, I used the "templates/Main Window". I'll create a second file and figure out how to call it. Thanks for the help ^^
wrote on 20 Sept 2022, 12:58 last edited by JonB@WorldTeacher
Well think about how/when you do want to call it, e.g. maybe it's on a button press from the first window? And think about its widget/window kind, e.g. is it supposed to be a dialog or an independent window? It will help if you decide things before you choose what kind of widget to design and having to change that choice later. -
@WorldTeacher
Well think about how/when you do want to call it, e.g. maybe it's on a button press from the first window? And think about its widget/window kind, e.g. is it supposed to be a dialog or an independent window? It will help if you decide things before you choose what kind of widget to design and having to change that choice later.wrote on 20 Sept 2022, 13:03 last edited by@JonB When I designed the original "Main" Window, I was planning on using json files to configure settings. But in the process of development some coworkers expressed interest in using the program and they are not realy comfortable with editing "random" files, so I thought I'd be able to add a second window for the settings. I'll do some testing and will probably figure something out.
-
@JonB When I designed the original "Main" Window, I was planning on using json files to configure settings. But in the process of development some coworkers expressed interest in using the program and they are not realy comfortable with editing "random" files, so I thought I'd be able to add a second window for the settings. I'll do some testing and will probably figure something out.
wrote on 20 Sept 2022, 14:23 last edited by@WorldTeacher
That in itself is fine. The question is how that editing window is to be shown relative to the main window, whether it should maybe be a modal dialog, etc. -
@WorldTeacher
That in itself is fine. The question is how that editing window is to be shown relative to the main window, whether it should maybe be a modal dialog, etc.wrote on 20 Sept 2022, 16:38 last edited by@JonB I'll give that some thought and work on something. It'll probably be some dialog window with a "save" button and some Labels and lineEdit Fields.
-
Hi,
The usual logic is to create as many custom widgets as you need so in your case they will all have their own .ui files as well. Then you can use them as any other widget.
1/8