Hi, I'm trying to put a background image in a QTreeView, but I can't use styles because the image needs to be loaded from a QByteArray. I've implemented this paint event, and the image gets drawn, but when I scroll the tree view, it doesn't re-draw the image. It just scrolls off the view and disappears. When I click inside the tree view or re-size, it gets re-drawn where it's supposed to be. Any ideas on how I can make the tree view redraw the image while scrolling? Thank you in advance!
{
painter.drawImage(imageLeftMargin, imageTopMargin, image);
painter.end();
event->accept();
};
void TreeView::paintEvent(QPaintEvent *event)
{
QPainter painter(viewport());
painter.drawImage(imageLeftMargin, imageTopMargin, image);
painter.end();
QTreeView::paintEvent(event);
event->accept();
};
To copy to clipboard, switch view to plain text mode
Bookmarks