Basic design recommendations wanted
-
I just can't seem to get my head around the proper (Qt) way of designing the user interface. I want to create an application that will use an SQLite database with 5 tables. Of course, I want to be able to CRUD the data in these tables. The 5th table will be comprised of some user input but primarily assembled from the data in the other tables. So far, that seems the easy part.
What I can't figure out is how to present the first four tables to the user. Pouring through the tutorials, there are plenty of examples of placing widgets but all of them are on the main window. Is that how it's supposed to work? Do I create some sort of widget for each table? Seems like I should create a window that can be called, do the process required and then deleted, but I can't seem to find a window class that does that. It doesn't seem that a mainWindow is right.
Sorry this is so long. I really need a jump start!
Bart -
I just can't seem to get my head around the proper (Qt) way of designing the user interface. I want to create an application that will use an SQLite database with 5 tables. Of course, I want to be able to CRUD the data in these tables. The 5th table will be comprised of some user input but primarily assembled from the data in the other tables. So far, that seems the easy part.
What I can't figure out is how to present the first four tables to the user. Pouring through the tutorials, there are plenty of examples of placing widgets but all of them are on the main window. Is that how it's supposed to work? Do I create some sort of widget for each table? Seems like I should create a window that can be called, do the process required and then deleted, but I can't seem to find a window class that does that. It doesn't seem that a mainWindow is right.
Sorry this is so long. I really need a jump start!
Bart@bart.hollis If you want to create a window you can create a dialog (see http://doc.qt.io/qt-5/qdialog.html)
-
Hi,
there are plenty of examples of placing widgets but all of them are on the main window. Is that how it's supposed to work?
At least that's one way, for simple GUI. Once the GUI gets more complex, with a lot of widgets to handle, we usually prefer to distribute the work. Like the mainWindow would contain a widget A and a widget B. But A and B both contain other widgets. Widgets containing other widgets is the heart of Qt GUI.
Do I create some sort of widget for each table?
That's probably what I would do if I were (was? I never know) in your shoes.
I should create a window that can be called, do the process required and then deleted
You can do that (any widget can be deleted, see http://doc.qt.io/qt-5/qwidget.html#dtor.QWidget), but are you sure you need to delete it yourself? Most of the time, you can just hide a widget when it's not useful, and show it again when it is.
-
Check out QTableView and QSqlTableModel and the examples that use them for displaying your first four tables.