Setpos() problem with scene position



  • hi,
    I want to put some points when user click and user can drag it that way I add point with this code this is working

     ClickPoint=mapToScene(event->pos());
    OriginShowedPoint=new vkf2DCephePoint(ClickPoint.x()-Size/2.0, ClickPoint.y()+Size/2.0, Size, Size);
    scene()->addItem(OriginShowedPoint);
    

    but when I want to re-set position of item with setpos it moves the wrong posion in the scene with this code

    OriginShowedPoint->setPos(ClickPoint.x()-Size/2.0, ClickPoint.y()+Size/2.0);
    

    I didnt understant what really problem is when the position working with initial position but not working when I try to set position with setPos()


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What do you mean exactly by wrong position ?



  • @SGaist hi i am getting the position of clickpoint from event with event->pos() then I map to that point to scene point and I want to drag a point the point which is under curser when i create first the position is right but after I want to move item with set pos it moves to wrong place(not the point selected with mouse curser)


  • Lifetime Qt Champion

    By how much is it off ?


Log in to reply
 

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