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. QAbstractItemModel Decoration Tooltip

QAbstractItemModel Decoration Tooltip

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 835 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.
  • J Offline
    J Offline
    JonathanOS
    wrote on last edited by
    #1

    I am trying to display a tooltip for a QAbstractItem but only when I hover over the decoration.

    If I set the Qt::ToolTipRole then I get the tooltip if I hover over the entire item.

    The call to model::data(..) only takes and index and role so I cant specify the area for the tool tip to be valid within.

    Has anyone managed to do something like this before?

    I have a delegate set up for the model too and thought I could use the editor event but that doesn't catch the QEvent::Tooltip ?

    Perhaps just an eventfilter applied to the delegate or view could help?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I would try eventfiler on
      TheView->viewport() // not its not directly on the View, but its viewport.
      and see if that catches the tooltip.
      Worked with other events but i didnt try tooltip.

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        It's a mess.

        You need to subclass the view and reimplement viewportEvent() to capture QEvent::ToolTip then you need to load the delegate for that index and get him to tell you where the decoration is (it's hidden inside the style so I'm not even sure you can extract it)

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        1

        • Login

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