A trivial implementation will look like
{
Q_OBJECT
public:
explicit SortFilterProxyModel
(QObject * parent
= 0) {
;
}
QVariant headerData
(int section, Qt
::Orientation orientation,
int role
= Qt
::DisplayRole) const {
if((orientation == Qt::Vertical) and
(role == Qt::DisplayRole) )
return section + 1;
return sourceModel()->headerData(section, orientation, role); //<<<<<< TODO: Make sure sourceModel() is valid
}
};
class SortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit SortFilterProxyModel(QObject * parent = 0)
: QSortFilterProxyModel(parent)
{
;
}
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
{
if((orientation == Qt::Vertical) and
(role == Qt::DisplayRole) )
return section + 1;
return sourceModel()->headerData(section, orientation, role); //<<<<<< TODO: Make sure sourceModel() is valid
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks