C++ QGraphicsView和Qgraphicscene

C++ QGraphicsView和Qgraphicscene,c++,qt5,qgraphicsview,C++,Qt5,Qgraphicsview,我对QGraphicsView有疑问。如果我放置坐标为:(0,0200200)的场景,场景从左上方e 9px开始减少9px,如图所示: QGraphicsScene *myScene= new QGraphicsScene(); CustomAnimation *ca = new CustomAnimation(); //inherits from QGraphicsWidget myScene->addItem(ca); myScene->setSceneRect(0,0,200,

我对QGraphicsView有疑问。如果我放置坐标为:(0,0200200)的场景,场景从左上方e 9px开始减少9px,如图所示:

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);


但是如果我使用setscenright(9,9200200),场景的位置就正确了。有什么问题吗?

我建议您先清理一下项目,然后再编译。Clean选项位于Qt creator的Build菜单下。不,我尝试过,但得到了相同的结果