| 31 | } |
| 32 | |
| 33 | bool 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 | } |
nothing calls this directly
no test coverage detected