How to display icons in QTableView via a custom QAbstractItemModel?
I’m building a custom QAbstractItemModel model.
The first column contains icons, the second one – text.
This is the code of the data method:
- {
- int col = index.column();
- if (col == 0)
- {
- }
- else if (col == 1)
- {
- return "TEXT";
- }
- }
But all I get in the resulting Table View is just text in the second column. There’s no folder icon in the first column.
I know I have to use Qt::DecorationRole, however I never receive it in the role parameter!
2 replies
You must log in to post a reply. Not a member yet? Register here!
