77 QVariant Model::data(const QModelIndex& index, int role) const |
77 QVariant Model::data(const QModelIndex& index, int role) const |
78 { |
78 { |
79 const ldraw::Object* object = (*this)[index.row()]; |
79 const ldraw::Object* object = (*this)[index.row()]; |
80 switch(role) |
80 switch(role) |
81 { |
81 { |
|
82 case Qt::DecorationRole: |
|
83 return QPixmap{object->iconName()}.scaledToHeight(24); |
82 case Qt::DisplayRole: |
84 case Qt::DisplayRole: |
83 return object->textRepresentation(); |
85 return object->textRepresentation(); |
84 case Qt::ForegroundRole: |
86 case Qt::ForegroundRole: |
85 return object->textRepresentationForeground(); |
87 return object->textRepresentationForeground(); |
86 case Qt::BackgroundRole: |
88 case Qt::BackgroundRole: |