Hi,
I'm stuck when trying to set background image to my graphicsview.
Graphicsview is part of my ui. I have tested basicly the same without using ui-file and it worked, but this isn't. Below my code, what I'm missing?
QPixmap bgPix
(":/Time-For-Lunch-2.jpg");
ui
->GraphicsView
->setViewportUpdateMode
(QGraphicsView::BoundingRectViewportUpdate);
ui
->GraphicsView
->setBackgroundBrush
(QBrush(bgPix
));
ui
->GraphicsView
->setRenderHints
(QPainter::Antialiasing |
QPainter::SmoothPixmapTransform);
ui->GraphicsView->show();
QPixmap bgPix(":/Time-For-Lunch-2.jpg");
ui->GraphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
ui->GraphicsView->setBackgroundBrush(QBrush(bgPix));
ui->GraphicsView->setCacheMode(QGraphicsView::CacheBackground);
ui->GraphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
ui->GraphicsView->show();
To copy to clipboard, switch view to plain text mode
I also have tried to create scene and setBackground to it, then setting the scene to view. Didn't work 
Thanks
Bookmarks