| 112 | } |
| 113 | |
| 114 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
| 115 | { |
| 116 | if (hasIndex(index.row(), index.column(), index.parent())) { |
| 117 | const Item &item(m_items[index.row()]); |
| 118 | |
| 119 | switch (role) { |
| 120 | // Return a pixmap so the view will draw it at the given size instead of the view icon size |
| 121 | case Qt::DecorationRole: |
| 122 | return item.pixmap; |
| 123 | case Qt::ForegroundRole: |
| 124 | return item.pen.brush(); |
| 125 | case Qt::DisplayRole: |
| 126 | return LegendModel::tr(item.label.constData()); |
| 127 | case Qt::SizeHintRole: |
| 128 | return QSize(-1, (item.pixmap.height() / item.pixmap.devicePixelRatio()) + (2 * 2)); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | return QVariant(); |
| 133 | } |
| 134 | |
| 135 | void setSettings(const QuickDecorationsSettings &settings) |
| 136 | { |