| 197 | } |
| 198 | |
| 199 | QPoint ScriptItemDelegate::getIconStartPos(const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 200 | { |
| 201 | int totalWidth = 0; |
| 202 | bool hasSetting = index.data(ScriptHasSettingRole).toBool(); |
| 203 | bool hasMenu = index.data(ScriptHasMenuRole).toBool(); |
| 204 | if (hasSetting) totalWidth += space + iconSize; |
| 205 | if (hasMenu) totalWidth += space + iconSize; |
| 206 | |
| 207 | int x = (option.rect.width() - totalWidth) / 2 + option.rect.x(); |
| 208 | int y = (option.rect.height() - iconSize) / 2 + option.rect.y(); |
| 209 | return QPoint(x, y); |
| 210 | } |
| 211 | |
| 212 | QRect ScriptItemDelegate::getIconRect(int type, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 213 | { |