Unsolved What's the best way for doing this?
-
Hello. Look at this form:
Imagine that's a fully working form, whose class is MainWindow, with everything encapsulated inside.
Now, let's say I need another identical form but for a distinct entity (i.e., another instance of MainWindow).
I create the new instance with some different properties set (identifying the new entity), so another window is shown with distinct data, etc.
I could group many forms this way inside a MDI window.
But what if I want each form content tabbed in a normal, parent window? Just imagine the full MainWindow contents (the client area) in one tab, another MainWindow instance contents in another tab, etc.
Is that possible and how?
Thanks for reading.
-
Hi,
You can have as many QMainWindow as you want however it's rather unusual to have more than one.
-
@SGaist You are not following me.
Look at this:
.See how the contents of each "Entity" tab contain what was in the original MainWindow?
The class is basically ready. How do I put an instance of that in each Entity tab? I know it's a weird, probably stupid question, though.
BTW, it's named MainWindow but it could be any window with an associated class.
-
So you want each Entity widget in a QTabWidget ?
-
@SGaist If by "Entity widget" you mean whatever is inside the current MainWindow form/class, then yes.
How do I do that? I could probably do this programmatically (by inserting the widgets, etc.) but the idea is, one, using the already finished MainWindow class (that can be named something else, you know); and two, still being able to use the form editor to modify elements in that form.
-
@Alvein Create a QWidget containing what you want to put into MainWindow and these Entities. Then you can edit this QWidget in designer and you can add it to your entities and MainWindow as you like.