Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78722

QToolTip does not hide when cursor is on invalid index

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.12
    • Widgets: Itemviews
    • None
    • All
    • 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());
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chehrlic Christian Ehrlicher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes