-
Book Overview & Buying
-
Table Of Contents
Pyside GUI Application Development- Second Edition - Second Edition
By :
The form view is useful when you want to traverse the records one by one and perform some modifications to it. In this section, we will look at how to create a dialog form that displays, and we will also learn about how to add, edit, and delete records using the form dialog. We will use the same employee table that was created in our previous example.
We will not discuss the layout that is used in this program as our main aim is to discuss the form view. The model is created using the QSqlTableModel, setting the sort factor with the first_name column in the ascending order:
self.model = QSqlTableModel(self)
self.model.setTable("employee")
self.model.setSort(FIRST_NAME, Qt.AscendingOrder)
self.model.select()Next, we set the mapping of the form values with the column using the QDataWidgetMapper class. This class is used to provide mapping between a section of a data model to widgets. The addMapping(widget, section) function maps the widget to the section from...
Change the font size
Change margin width
Change background colour