goldhappywang
28th April 2009, 03:18
hi all:
I set a file(*.jpg) at the background of QGraphicsScene, but the picture as tiling on the scene , I want to tensilie the picture on the scene, what to do it?
thanks a lot.
the code :
int screen_width = QApplication::desktop()->width();
int screen_height = QApplication::desktop()->height();
scene = new QGraphicsScene(0,0,screen_width,screen_height);
airview = new QGraphicsView();
setCentralWidget(airview);
QPixmap pim("./images/airport.jpg");
scene->setBackgroundBrush(pim.scaled(screen_width,screen_ height,Qt::IgnoreAspectRatio,Qt::SmoothTransformat ion));
airview->setScene(scene);
I set a file(*.jpg) at the background of QGraphicsScene, but the picture as tiling on the scene , I want to tensilie the picture on the scene, what to do it?
thanks a lot.
the code :
int screen_width = QApplication::desktop()->width();
int screen_height = QApplication::desktop()->height();
scene = new QGraphicsScene(0,0,screen_width,screen_height);
airview = new QGraphicsView();
setCentralWidget(airview);
QPixmap pim("./images/airport.jpg");
scene->setBackgroundBrush(pim.scaled(screen_width,screen_ height,Qt::IgnoreAspectRatio,Qt::SmoothTransformat ion));
airview->setScene(scene);