[ENDED]set tooltip on an icon
I'm currently working on a QTableWidget.
Some of the QTableWidgetItems have an icon ( with the function setICon ) that indicate the type of item.(some items represent a desk, some other chairs... etc)
The icon could be not obvious enough for some users so I would like to set a tooltip on it that also say what type it is. (for example display "chair" as tooltip ont the icon of the chair)
I can't find a way to do it.
I also don't want to set the tooltip to the entire item, just on the icon.
Does "QTableWidgetItem::setToolTip() ":http://doc.qt.nokia.com/4.7/qtablewidgetitem.html#setToolTip do the trick?
Nope that's what I meant by my last sentance.
I want to use the tooltip of the rest of the QTableWidgetItem for another contextual help.
I need another tooltip that appears when the cursor is specificaly on the icon.
I over-read that, sorry. And I'm sorry again - there is no builtin solution for your problem, the tooltip is for the whole item.
To achieve this, I would switch from the QTableWidget to QTableView, create a model, add a custom role to that one (IconToolTipRole). One would probably have to subclass the table view and reimplement viewportEvent (see the implementation of "QAbstractItemView::viewportEvent() ":http://doc.qt.nokia.com/4.7/qabstractitemview.html#viewportEvent, it handles the tool tip request) to get the actual position of the mouse pointer.
Thnaks for the advices Volker.
Anyway, I'll stick with QTableWidget and will change all the presentation because QGraphicsViews messes with my head. I'm not experimented enough to work with it.