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

helpEvent for QStyledItemDelegate should use displayText instead of toString when showing tooltips

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 5.6.2
    • 4.7.1
    • Widgets: Itemviews
    • None
    • 695d85363e537b51b5d0ae6ab08a9a1e7d9e8354

    Description

      When setting the same value for DisplayRole and ToolTipRole, the tooltip can actually display very different text from the displayed text.

      The reason for this is tooltip handling is implemented in QAbstractItemDelegate and uses a toString function to convert QVariant to QString. On the other hand, painting is implemented in QStyledItemDelegate and uses a custom displayText function to convert the QVariant value to QString. The results are very different for QDateTime values, as an example.

      Simplest solution would be to override helpEvent in QStyledItemDelegate and use the displayText function there instead of the toString function.

      Attachments

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

        Activity

          People

            avolkov Alexander Volkov
            petr.broz Petr Brož
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes