Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setpos() problem with scene position

Setpos() problem with scene position

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 990 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V. B. MacitV Offline
    V. B. MacitV Offline
    V. B. Macit
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What do you mean exactly by wrong position ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      V. B. MacitV 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        What do you mean exactly by wrong position ?

        V. B. MacitV Offline
        V. B. MacitV Offline
        V. B. Macit
        wrote on last edited by V. B. Macit
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          By how much is it off ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved