I've been struggling with figuring out what the best way to implement a Qt MainWindow program is that is more complex then what most examples show.
Let's say I would be trying to create a simple customer database. Examples would suggest to create a QMainWindow that contains all the QAction's, QToolBar's, and QMenu's and then the "form" widget set as the central widget.
Easy enough, but what if I want show a different "form". Let's say I'm also tracking the customer's investment information. Let's also add in a "form" that let's me browse/search through all the customers.
So I would have 3 "forms":
- browse/search form
- customer view/edit form
- customer's investment view/edit form
I can think of a few different ways to implement this.
First, you could use the QMainWindow's central widget to just be the browse/search form and then pop-up new QWidget windows when the user wants to access the other "forms". This approach seems very dated and ugly to me.
Second, you could use a QTabWidget or QStackedWidget to make everything happen in the central widget portion of the QMainWindow. I really like this approach but run into problems with the action's, menu's, and toolbar's. If I include all the code for each action in the QMainWindow I end up having huge amounts of unrelated code.
Maybe I'm approaching this entirely wrong so that is why I ask for help.
To better illustrate what I'm thinking about, take a look at the Kontact program for KDE. When you click on an item in the sidebar it jumps to different "forms" or sections in the program, each with it's own menu's toolbars, etc. So to make a long story short, how do I emulate this functionality "properly" in Qt.
Bookmarks