Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.12
-
None
-
-
0392a744530ac4868e33d5345c7197ac14d7320d (qt/qtbase/5.15)
Description
QAbstractItemDelegate::helpEvent() does not hide the current tool tip when the new index is invalid or does not return a value for Qt::ToolTipRole. This means that a wrong tooltip may be shown for a cell.
The attached testcase shows the problem - start it with an argument count > 1 (it's a testcase for an enhancement, therefore this small hack), move the cursor to a cell in column 0 and wait until the tooltip is shown. Then move your mouse to an area where no cell is drawn or to column 1. The tooltip will not disappear which looks wrong.
QGraphicsScene::helpEvent() does it correct:
// Show or hide the tooltip
QString text;
QPoint point;
if (toolTipItem && !toolTipItem->toolTip().isEmpty()) {
text = toolTipItem->toolTip();
point = helpEvent->screenPos();
}
QToolTip::showText(point, text, helpEvent->widget());
helpEvent->setAccepted(!text.isEmpty());