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. Sync of 2 qgraphicsview drawing
Forum Updated to NodeBB v4.3 + New Features

Sync of 2 qgraphicsview drawing

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.1k Views 1 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.
  • G Offline
    G Offline
    gr8dane
    wrote on last edited by
    #1

    I have 2 qgraphicsviews, one right underneath the other. I have a line on both views at the same x position. When the user drags the line across the X axis on the top graphics view I want the bottom one to follow exactly.

    In the itemChange function of the top line if I set the X position of the bottom line in ItemPositionChange the bottom line is slightly offset to one side while moving (settles in to correct position once I let go).

    If I use ItemPositionHasChanged instead the line is slightly offset to the other side while moving (settles in to correct position once I let go).

    How can I keep the two lines completely in sync while dragging?

    Any help greatly appreciated!

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

      Hi and welcome to devnet,

      Are your two graphics view showing the content of different QGraphicsScene ?

      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
      • G Offline
        G Offline
        gr8dane
        wrote on last edited by
        #3

        Yes, the two stacked graphicsviews are showing different content, I have two lines, one on bottom and one on top, that should appear as one line. When dragging the top line the bottom one appear to be either one frame behind or one frame ahead depending on if I use ItemPositionChange or ItemPositionHasChanged to set the matching X position of the bottom line.

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

          AFAIK, it's pretty much unavoidable since you have to transmit the new position while moving thus trigger a new paint event.

          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