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

Method helpEvent

src/plugins/smartut/common/projectitemdelegate.cpp:103–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103bool ProjectItemDelegate::helpEvent(QHelpEvent *event,
104 QAbstractItemView *view,
105 const QStyleOptionViewItem &option,
106 const QModelIndex &index)
107{
108 if (event->type() == QEvent::ToolTip) {
109 auto opt = option;
110 opt.rect.adjust(10, 0, -10, 0);
111 QRect stateRect = itemStateRect(opt.rect);
112 if (index.data(ItemStateRole) == Failed && stateRect.contains(event->pos())) {
113 auto model = qobject_cast<ProjectItemModel *>(view->model());
114 auto item = model->itemForIndex(index);
115 QToolTip::showText(event->globalPos(), item->userCache, view);
116 return true;
117 }
118 }
119
120 return DStyledItemDelegate::helpEvent(event, view, option, index);
121}
122
123void ProjectItemDelegate::drawBackground(QPainter *painter, const QStyleOptionViewItem &option) const
124{

Callers

nothing calls this directly

Calls 5

typeMethod · 0.45
dataMethod · 0.45
containsMethod · 0.45
modelMethod · 0.45
itemForIndexMethod · 0.45

Tested by

no test coverage detected