| 155 | } |
| 156 | |
| 157 | QSize ScriptItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 158 | { |
| 159 | if (index.column() == static_cast<int>(ScriptModel::Columns::OPERATE)) |
| 160 | { |
| 161 | int totalWidth = iconSize + space * 2; |
| 162 | if (index.data(ScriptHasSettingRole).toBool()) totalWidth += space + iconSize; |
| 163 | if (index.data(ScriptHasMenuRole).toBool()) totalWidth += space + iconSize; |
| 164 | |
| 165 | return QSize(totalWidth, iconSize + space * 2); |
| 166 | |
| 167 | } |
| 168 | return KTreeviewItemDelegate::sizeHint(option, index); |
| 169 | } |
| 170 | |
| 171 | bool ScriptItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) |
| 172 | { |