| 210 | } |
| 211 | |
| 212 | QRect ScriptItemDelegate::getIconRect(int type, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 213 | { |
| 214 | QPoint startPos = getIconStartPos(option, index); |
| 215 | bool hasSetting = index.data(ScriptHasSettingRole).toBool(); |
| 216 | bool hasMenu = index.data(ScriptHasMenuRole).toBool(); |
| 217 | |
| 218 | if (type == 0) // setting |
| 219 | { |
| 220 | return hasSetting ? QRect(startPos, QSize(iconSize, iconSize)) : QRect(); |
| 221 | } |
| 222 | else if (type == 1) // menu |
| 223 | { |
| 224 | QPoint move{hasSetting ? iconSize + space : 0, 0}; |
| 225 | return hasMenu ? QRect(startPos + move, QSize(iconSize, iconSize)) : QRect(); |
| 226 | } |
| 227 | return QRect(); |
| 228 | } |