kapseli
24th September 2010, 23:04
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::BoundingRectV iewportUpdate);
ui->GraphicsView->setBackgroundBrush(QBrush(bgPix));
ui->GraphicsView->setCacheMode(QGraphicsView::CacheBackground);
ui->GraphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
ui->GraphicsView->show();
I also have tried to create scene and setBackground to it, then setting the scene to view. Didn't work :(
Thanks
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::BoundingRectV iewportUpdate);
ui->GraphicsView->setBackgroundBrush(QBrush(bgPix));
ui->GraphicsView->setCacheMode(QGraphicsView::CacheBackground);
ui->GraphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
ui->GraphicsView->show();
I also have tried to create scene and setBackground to it, then setting the scene to view. Didn't work :(
Thanks