I have a problem customizing tooltips for QListView.

I had to add a custom tooltip object to my list view in order to show some information when the cursor is over some columns in the list view.

For the other columns I want the default behavior, I mean show the tooltip with the cell text if the text is truncated.

The problem is that the new tooltip object override the default one. I tried to use in the maybetip function of my custom tooltip the code of the tooltip in the QListView class, but it accesses some private fields of the QListViewItem in order to determine whether the text is truncated.

I tried also to use the following code to determine whether the text is truncated

Qt Code:
  1. ...
  2. if( view->header()->sectionSize( colIndex ) < item->width( view->fontMetrics(), view, colIndex ) )
  3. tip( rect, item->text(colIndex) );
  4. ...
To copy to clipboard, switch view to plain text mode 

it is working for all the columns except for the first one, because it does not take into account the box size of the QCheckListItem, the decorator size (+ or -) and the depth of the item.

Thanks in advance for your suggestions!