PDA

View Full Version : Custom role in custom QAbstractTableModel



hailflex
10th December 2009, 02:54
Hello,

i have a customized QAbstractTableModel and in the lines of a column i want to display an QIcon and a QImage and some text, side by side. Im using Qt::DecorationRole for the QIcon and Qt::DisplayRole for the text, but i don't really know how can i include the QImage too. Any help? I tried to create a custom role, but i couldn't make it work :T

wysota
10th December 2009, 10:05
You don't create custom roles, you just use them. You need to provide a delegate that will be aware of your custom role and will render it to the item.

hailflex
10th December 2009, 11:56
Okay... how do i make this delegate?

wysota
10th December 2009, 12:09
Well... you implement it.