| 101 | } |
| 102 | |
| 103 | bool 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 | |
| 123 | void ProjectItemDelegate::drawBackground(QPainter *painter, const QStyleOptionViewItem &option) const |
| 124 | { |
nothing calls this directly
no test coverage detected