Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QListView: Add tooltips to each entry
Forum Updated to NodeBB v4.3 + New Features

QListView: Add tooltips to each entry

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 801 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    buhtz
    wrote on last edited by
    #1

    I want to have each entry of a QListView its own tooltip.
    I found some quit old examples in the wild that using the mouse cursors actual position determining the item under it and creating their own QToolTip instance.

    I don't want to hack like this and hope that today in Qt6 there is an easier solution via just adding a tooltip string to an item object. But I couldn't find something like this.

    Any ideas?

    Christian EhrlicherC C 2 Replies Last reply
    0
    • B buhtz

      I want to have each entry of a QListView its own tooltip.
      I found some quit old examples in the wild that using the mouse cursors actual position determining the item under it and creating their own QToolTip instance.

      I don't want to hack like this and hope that today in Qt6 there is an easier solution via just adding a tooltip string to an item object. But I couldn't find something like this.

      Any ideas?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      @buhtz said in QListView: Add tooltips to each entry:

      I want to have each entry of a QListView its own tooltip.

      So what's wrong with QListWidgetItem::setToolTip()?

      /edit: I misread it as QListWidget

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        What about using the Qt::TooltipRole in your model ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • B buhtz

          I want to have each entry of a QListView its own tooltip.
          I found some quit old examples in the wild that using the mouse cursors actual position determining the item under it and creating their own QToolTip instance.

          I don't want to hack like this and hope that today in Qt6 there is an easier solution via just adding a tooltip string to an item object. But I couldn't find something like this.

          Any ideas?

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          Further to @SGaist's suggestion: if you do not want those tool tips in every view using the model, or you have no control over the original model, you may be able to use a QIdentityProxyModel sub-class to inject tooltips into the Qt::TooltipRole.

          1 Reply Last reply
          3
          • B Offline
            B Offline
            buhtz
            wrote on last edited by
            #5

            Wow a lot of oportunities.
            Thanks a lot. I will check this out.

            Sorry, I was really locking into the docs but wasn't able to find the related constructs. On the other hand I have to explain, to my defense, I have not constructed that specific ListView myself. It is code I took over.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved