QSqlRelationalDelegate-subclass-for-QSqlRelationalTableModel: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 16:39, 14 January 2015

QSqlRelationalDelegate subclass that works with QSqlRelationalTableModel

When you are using a QSqlRelationalTableModel in combination with QSortFilterProxyModel, you lose the automatic combobox that is displayed in a QTableView.

This is a subclass of QSqlRelationalDelegate, that works:

COMMENT: To use it with another proxy model (my own QXTreeProxyModel that converts a table to a tree that can be displayed by QTreeView), I replaced QSortFilterProxyModel by QAbstractProxyModel throughout the code in mysqlrelationaldelegate.cpp; no other changes were necessary. BTW, QXTreeProxyModel is available on https://github.com/Al-/QXTreeProxyModel

Header:

Source:

Categories: