- Old ape Python Bowen directory
- Column: Using PyQt Python GUI application development
- Old ape Python blog address
I. Overview
QListView is theoretically possible and all QAbstractItemModel derived classes such as QStringListModel, QDirModel, QFileSystemModel, QStandardItemModel such as docking, but QListView can actually show data only a little for complex hierarchical tree using the Model using QListView to show significance. This section describes the process to QListView / Model developed by several cases of simple code.
二、QListView/QStringListModel
2.1, QStringListModel introduction
QStringListModel Qt has been achieved is provided a QAbstractItemModel Model of interfaces, adapted to show a series of simplified view of the object and the character string as QListView QComboBox objects.
Providing all the standard functions QStringListModel editable model, the data is stored as a list of strings in a plurality of rows model.
Use index (int row, int column = 0, QModelIndex parent = () QModelIndex) acquires model index function corresponding to the entry, using flags (QModelIndex index) acquired item flag; use data () function to read the data item, and the setData () writes data entry using rowCount () function Interview