QListView and QStyledItemDelegate - item is greater than option rect, problems with painting
Hello! I have a little problem with Qt... The problem is that my itemdelegate sizeHint() has greater width than listView (and therefore so is option), so there is a scrollbar. And now I don't have any idea how to paint it. I managed to write something like this:
QSize size(sizeHint(option, index));
QRect horizontalRect = option.rect;
QRect headerRect = horizontalRect;
But the problem is that option.rect.left() is set to 0, so every time I scroll, text is painted at the beginning of the visible area. To make it working, I should have (for view scrolled to right edge) horizontalRect.left() set to -(size.width() - options.rect.width()) and right() to (options.width()). Is there any way to do it? Or at least a way to get scrollbar scroll between <0; 1> to just calculate correct left edge of horizontalRect?
I don't believe nobody experienced this issue. :(