MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / helpEvent

Method helpEvent

src/modcontenticondelegate.cpp:33–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33bool ModContentIconDelegate::helpEvent(QHelpEvent* event, QAbstractItemView* view,
34 const QStyleOptionViewItem& option,
35 const QModelIndex& index)
36{
37 if (!event || !view) {
38 return false;
39 }
40 if (event->type() == QEvent::ToolTip) {
41 // this code is from QAbstractItemDelegate::helpEvent, only the the way
42 // text is retrieved has been changed
43 QHelpEvent* he = static_cast<QHelpEvent*>(event);
44 const int precision = inherits("QItemDelegate")
45 ? 10
46 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp
47 const QString tooltip =
48 index.isValid() ? m_view->contentsTooltip(index) : QString();
49 QRect rect;
50 if (index.isValid()) {
51 const QRect r = view->visualRect(index);
52 rect = QRect(view->mapToGlobal(r.topLeft()), r.size());
53 }
54 QToolTip::showText(he->globalPos(), tooltip, view, rect);
55 event->setAccepted(!tooltip.isEmpty());
56 return true;
57 } else {
58 return IconDelegate::helpEvent(event, view, option, index);
59 }
60}

Callers

nothing calls this directly

Calls 7

QStringClass · 0.85
contentsTooltipMethod · 0.80
visualRectMethod · 0.80
typeMethod · 0.45
isValidMethod · 0.45
sizeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected