Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QPointF to Point2D

    General and Desktop
    qt quick point2d qpointf
    4
    5
    1717
    Loading More Posts
    • 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.
    • AlvaroS
      AlvaroS last edited by koahnig

      hello everyone.

      I have the points from a scene which type is QPointF.
      i need these points in Point2D.

      Is there any form to do this conversion?

      Thanks a lot.

      1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion last edited by

        What is Point2D?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • Joel Bodenmann
          Joel Bodenmann last edited by Joel Bodenmann

          As @jsulm pointed out there is no Point2D type in Qt. I assume that you either want to use QPoint or QVector2D.
          QPoint is the integer precision equivalent to QPointF. You can use QPointF::toPoint() to "convert" a QPointF to QPoint (you will obviously loose precision).
          QVector2D has constructors that take a QPoint or QPointF.

          Industrial process automation software: https://simulton.com
          Embedded Graphics & GUI library: https://ugfx.io

          kshegunov 1 Reply Last reply Reply Quote 0
          • kshegunov
            kshegunov Moderators @Joel Bodenmann last edited by

            @Joel-Bodenmann @jsulm

            He's probably talking about this.

            @AlvaroS

            Just transfer the coordinates from one object to the other, I know of no explicit conversion functions.

            Read and abide by the Qt Code of Conduct

            AlvaroS 1 Reply Last reply Reply Quote 1
            • AlvaroS
              AlvaroS @kshegunov last edited by

              @kshegunov yes, thanks to everyone!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post