QGraphicsScene --setting the position of items



  • Hi all,I am trying to set the position of items in my scene but no matter what i try they stay in the center .The relevant part of my code is as follows:

    @

    scene=new MyScene(this);
    view =new QGraphicsView(this);
    view->setFixedSize(width(),height());
    view->setScene(scene);

    QGraphicsTextItem* mTextItem = scene->addText("boomba");
    mTextItem->setParent(view);
    mTextItem->setPos(QPointF(300,600));

    @

    I simply want to be in control of where those item go in my scene.The doc talks about mapping between scene and view but all I have tried has failed so far.
    Any hints /advice would be appreciated.



  • Hi!

    If I remember correctly, you must set size to your scene(setSceneRect method).
    If not, scene will be dynamically extended while items are being added. First one will always be in centre.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.