QGraphicsView和QGraphicsScene

时间:2014-11-04 12:28:03

标签: c++ qt5 qgraphicsview

我对QGraphicsView有疑问。如果我使用坐标:(0,0,200,200)放置场景,场景从左边的顶部e 9px减少9px,如图像所示:

enter image description here

QGraphicsScene *myScene= new QGraphicsScene();
CustomAnimation *ca = new CustomAnimation(); //inherits from QGraphicsWidget
myScene->addItem(ca);
myScene->setSceneRect(0,0,200,200);
ui->gfx_animation->setScene(myScene);
ui->gfx_animation->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->gfx_animation->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

但如果我使用setSceneRect(9,9,200,200),则场景正确定位。有什么问题?

0 个答案:

没有答案