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

Table view

In the preceding sections we discussed various model classes. Now, we will look at how to present the data to the users using the QTableView widget. The data source for the QTableView widget is provided by any of the model classes. The table view is the most used view format as this represents a virtual representation of the 2D SQL table structure. We will have a look at the code first, and then discuss its functionality.

import sys from PySide.QtGui import * from PySide.QtCore import Qt from PySide.QtSql import * def initializeModel(model): model.setTable("employee") model.setEditStrategy(QSqlTableModel.OnManualSubmit) model.select() model.setHeaderData(0, Qt.Horizontal, "ID") model.setHeaderData(1, Qt.Horizontal, "First Name") model.setHeaderData(2, ...

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