pos() is already in the parent's coordinate space. It's equivalent to:
Qt Code:
To copy to clipboard, switch view to plain text mode
pos() is already in the parent's coordinate space. It's equivalent to:
Qt Code:
To copy to clipboard, switch view to plain text mode
Thanks, but even without the map, as I wrote, the result is QPoint(0, 0). Are the QAbstractView's scrollbars part of the viewport, or are they outside of them? Basically, for testing purposes I'd like to do:
Qt Code:
painter.fillRect(rect(), Qt::yellow);To copy to clipboard, switch view to plain text mode
Of course, this doesn't work because of the QAbstractScrollArea. So how could I erase the background of QAbstractViewItem manually?
EDIT:
Would it be possible to filter paint events of the viewport() or the both *ScrollBar()s and do some painting before forwarding the event?
Last edited by ugluk; 12th September 2011 at 16:24.
By default, QAbstractItemView derivatives all erase their backgrounds at every repaint event. But what, if the view is custom and the view's items themselves erase their backgrounds? The view's erase is then superfluous. But if I do:
Qt Code:
setAttribute(Qt::WA_NoSystemBackground);To copy to clipboard, switch view to plain text mode
on the view, the backgrounds of the view's scrollbars will not erase. Therefore, I wanted to erase their backgrounds "manually" (via fillRect()), while leaving the view's items to erase their own backgrounds.
What if there are not enough items to cover all the view or some items have transparent background?
Then set the attribute on the view's viewport and not on the view itself. However I don't think this optimalization is worth the effort you are putting into it.The view's erase is then superfluous. But if I do:
Qt Code:
setAttribute(Qt::WA_NoSystemBackground);To copy to clipboard, switch view to plain text mode
on the view, the backgrounds of the view's scrollbars will not erase. Therefore, I wanted to erase their backgrounds "manually" (via fillRect()), while leaving the view's items to erase their own backgrounds.
Bookmarks