O'Reilly logo

PySide GUI Application Development by Venkateshwaran Loganathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Form view

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 see how to create a dialog form that displays the records one-by-one and also learn about how to add, edit, and delete records using the form dialog. We will use the same employee table created in our previous example.

We will not discuss the layout used in this program as our main aim is to discuss the form view. The model is created using QSqlTableModel and set the sort factor with the column first_name 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 Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required