QAbstractItemModel Decoration Tooltip
-
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?
-
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. -
It's a mess.
You need to subclass the view and reimplement
viewportEvent()to captureQEvent::ToolTipthen 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)