Follow these steps to display information from a database on a model view widget:
We will be using the database table called
employee, which we used in the previous example. This time, we need a lot more data in the
employeetable. Open up your web browser and log in to your phpMyAdmin control panel. Add data for a few more employees so that we can display it later in our program:
After that, open up Qt Creator, create a new Qt Widgets Application project, and then add the SQL module to your project.
Next, open up
mainwindow.uiand add a table widget (not table view) from Item Widget (Item-Based) under the Widget box pane. Select the main window on the canvas and click on either the Layout Vertically or Layout Horizontally button to make the table widget stick to the size of the main window, even...