QGraphicsView\Scene drawBackground bitmap as geomap
have some code..
declaration
QPixmap map;
QGraphicsView
in MainWin construct
view->setDragMode(QGraphicsView::ScrollHandDrag);
view->centerOn(0,0);// after it tha map is drawing to 0,0 on left,top on the scene
but if move the scrolls then map is spoiled and repaint to left,top of visible area of QGraphicsView
I need to paint map to 0,0 always.
Code:
{
map.load(name);
}
{
painter->drawPixmap(rect.left(),rect.top(),map);
}
if I override Scene::drawBackground effect is the same.
I made painting map as brush:
view->setBackgroundBrush(QPixmap("C:/RUSMAP1.bmp"));
it's cool and working great but map is tiled :) I need one tile in the left,top corner
Re: QGraphicsView\Scene drawBackground bitmap as geomap
found solutuon:
void cene::drawBackground(QPainter *painter, const QRectF &rect)
{
int w=img.width();
int h=img.height();
QRectF r;
r.setRect(0,0,w,h);
painter->drawImage(r,img);
}