Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Correctly mapping QPointF coords to a QGraphicsScene
Qt 6.11 is out! See what's new in the release blog

Correctly mapping QPointF coords to a QGraphicsScene

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 835 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.
  • NiagarerN Offline
    NiagarerN Offline
    Niagarer
    wrote on last edited by Niagarer
    #1

    Hi,
    I am trying to implement a paint feature on a QGraphicsView for stylus pens. The scene can get zoomed and panned around, so I need to map event positions to the scene. The event parameter in QGraphicsView.tabletEvent() provides a posF() which is important for precision when drawing. But QGraphicsView's mapToScene() method only works for QPoints (aka it rounds QPointF) which results in a fuzzy line drawn with a pen instead of a precise clean one.
    Does someone know a convenient way to correctly map a QPointF position to the QGraphicsScene?
    Thank you!

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

      Hi,

      Taking a look at the method implementation, it looks like if would be simpler to add an overload to QGraphicsView for it.

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

        Thanks! I am using Python though, not sure how to do it there/if that's even possible (how to get that Q_D d_func() method, sorry I'm really not into this)

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

          Sorry, I missed that you posted on the Qt for Python.

          These macro are used to grab the private class containing the implementation details of the public API. My suggestion implied that you would have had to rebuild Qt and in your case the bindings as well.

          One thing you can do is check the bug report system to see if there's something related. If not, you can open a feature request explaining your situation.

          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