MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / editorEvent

Method editorEvent

src/plugins/core/notify/gui/itemdelegate.cpp:50–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool ItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
51{
52 if (event->type() == QEvent::MouseMove || event->type() == QEvent::MouseButtonPress) {
53 Q_EMIT model->layoutChanged({ QPersistentModelIndex(index) });
54 return false;
55 } else if (event->type() == QEvent::MouseButtonRelease) {
56 const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
57 if (mouseEvent->button() == Qt::LeftButton) {
58 auto entity = index.data(kEntityRole).value<EntityPtr>();
59 QPoint mousePos = view->mapFromGlobal(QCursor::pos());
60 const auto &closeRect = closeButtonRect(option.rect);
61 if (closeRect.contains(mousePos)) {
62 Q_EMIT view->processed(entity);
63 return true;
64 }
65
66 const auto &actInfoList = actionInfoList(option, index);
67 for (const auto &info : actInfoList) {
68 if (info.rect.contains(mousePos)) {
69 Q_EMIT view->actionInvoked(entity, info.id);
70 Q_EMIT view->processed(entity);
71 return true;
72 }
73 }
74 }
75 }
76
77 return false;
78}
79
80QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
81{

Callers

nothing calls this directly

Calls 3

typeMethod · 0.45
dataMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected