
Originally Posted by
ArnSpin
Would you have a short example. I am not sure to understand clearly how to use delegate here.
Not a delegate in the model/view concept's sense, but delegating the call.
Something like:
int MyModel
::columnCount(const QModelIndex &index
) const {
return QFileSystemModel::columnCount(index) + 2; // two additional columns.
}
{
if (index.column() >= QFileSystemModel::columnCount(index)) {
// handle custom columns
} else {
return QFileSystemModel::data(index, role);
}
}
int MyModel::columnCount(const QModelIndex &index) const
{
return QFileSystemModel::columnCount(index) + 2; // two additional columns.
}
QVariant data(const QModelIndex &index, int role) const
{
if (index.column() >= QFileSystemModel::columnCount(index)) {
// handle custom columns
} else {
return QFileSystemModel::data(index, role);
}
}
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks