| 169 | } |
| 170 | |
| 171 | bool ScriptItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) |
| 172 | { |
| 173 | QMouseEvent *pEvent = static_cast<QMouseEvent *> (event); |
| 174 | switch (event->type()) |
| 175 | { |
| 176 | case QEvent::MouseMove: |
| 177 | { |
| 178 | mousePos = pEvent->pos(); |
| 179 | break; |
| 180 | } |
| 181 | case QEvent::MouseButtonPress: |
| 182 | { |
| 183 | if (pEvent->button() == Qt::LeftButton && !(pEvent->modifiers()&Qt::ControlModifier) && !(pEvent->modifiers()&Qt::ShiftModifier)) |
| 184 | { |
| 185 | QRect settingRect(getIconRect(0, option, index)), menuRect(getIconRect(1, option, index)); |
| 186 | if (settingRect.isValid() && settingRect.contains(pEvent->pos())) |
| 187 | emit settingClicked(index); |
| 188 | else if (menuRect.isValid() && menuRect.contains(pEvent->pos())) |
| 189 | emit menuClicked(index); |
| 190 | } |
| 191 | break; |
| 192 | } |
| 193 | default: |
| 194 | break; |
| 195 | } |
| 196 | return KTreeviewItemDelegate::editorEvent(event,model,option,index); |
| 197 | } |
| 198 | |
| 199 | QPoint ScriptItemDelegate::getIconStartPos(const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 200 | { |