Scope
17th May 2016, 09:19
Hi,
I have QFileSystemModel and Custom delegate which inherits from QAbstractItemDelegate and inside paint function I try to paint item icon like that
// ICON
QIcon ic = QIcon(qvariant_cast<QPixmap>(index.data(Qt::DecorationRole)));
r = option.rect.adjusted(2, 2, -2, -2);
ic.paint(painter, r, Qt::AlignVCenter|Qt::AlignLeft);
but it does nothing, ic.name() return empty string.
Without setting delegate I see "standard" icons provides by QFileSystemModel so problem is in my delegate implementation.
I have QFileSystemModel and Custom delegate which inherits from QAbstractItemDelegate and inside paint function I try to paint item icon like that
// ICON
QIcon ic = QIcon(qvariant_cast<QPixmap>(index.data(Qt::DecorationRole)));
r = option.rect.adjusted(2, 2, -2, -2);
ic.paint(painter, r, Qt::AlignVCenter|Qt::AlignLeft);
but it does nothing, ic.name() return empty string.
Without setting delegate I see "standard" icons provides by QFileSystemModel so problem is in my delegate implementation.