AppendProxyModel

class qte.AppendProxyModel(parent=None)

This proxy model provides an interface to append rows.

For the most part, data is mapped straight the source model. However, this model always provides an additional empty row at the end which can be used to enter new data. Every time the data is changed in this row, the appendDataChanged signal is emitted. The source model is expected to emit PySide.QtGui.QAbstractProxyModel.rowsInserted if the append data was accepted, so if the source model emits this signal to indicate appending a single row, the pending data is cleared.

Members

Properties

AppendProxyModel.defaults

A dict containing default value to use when editing pending data.

Each value in this dict should be keyed by the column number. If no default is set, None is used.

New Methods

AppendProxyModel.clear(column=None)

Clear pending data by column. If column is omitted, then clear everything.

AppendProxyModel.setView(view)

Called when the model is set to a DataView.

AppendProxyModel.unsetView(view)

Called when the model is removed from a DataView.

Re-implemented Methods

AppendProxyModel.columnCount(parent=None)
AppendProxyModel.data(index, role)

Return data at index for role.

If index refers any row except the pending row, the source model data is returned. For the pending row, the return value is as follows:

Role  
BackgroundRole A brush using PySide.QtGui.QPalette.Midlight
EditRole Pending, default or None, depending what has been set.
DisplayRole Pending or an empty string, depending what has been set.
AppendProxyModel.flags(index)

Return the source model’s flags for all but the last row. The last row returns Qt.ItemIsEnabled and Qt.ItemIsEditable.

AppendProxyModel.headerData(section, orientation, role)

Return header data from the source model.

In addition, the vertical header at the append row has a “clear” icon. The PySide.QtGui.QHeaderView.sectionClicked signal for this header should be connected to clear for it to work. This is done automatically if used with DataView.

AppendProxyModel.mapColumnFromSource(column)

Map column from the source model to the proxy model.

AppendProxyModel.mapColumnToSource(column)

Map column to the source model.

AppendProxyModel.mapFromSource(index)

Map index from the source model to the proxy model.

AppendProxyModel.mapRowFromSource(row)

Map row from the source model to the proxy model.

AppendProxyModel.mapRowToSource(row)

Map row to the source model.

AppendProxyModel.mapToSource(index)

Map index to the source model.

Signals

AppendProxyModel.appendDataChanged(dict)

Project Versions

Table Of Contents

Previous topic

Classes

Next topic

Application

This Page