I made a small update on the code. In the delegate I reworked the highlight section:
QAbstractTextDocumentLayout::PaintContext ctx; QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4); painter->save(); painter->translate(textRect.topLeft()); painter->setClipRect(textRect.translated(-textRect.topLeft())); // Highlighting text if item is selected if (optionV4.state & QStyle::State_Selected){ ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText)); QStyleOptionViewItem toolTip = option; initStyleOption(&toolTip, index.sibling(index.row(),2)); QToolTip::showText(QPoint(textRect.right() + 15, textRect.top()), toolTip.text ); } doc.documentLayout()->draw(painter, ctx); painter->restore();This gives me a nice tool tip but not at the right location. I want it next to the completer but I cannot figure out how to get the coordinates. Since the delegate is not a widget I cannot use this->maptoglobal(). Any ideas on how I could position the tool tip next to the highlighted element?