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. QPointF to Point2D
QtWS25 Last Chance

QPointF to Point2D

Scheduled Pinned Locked Moved Solved General and Desktop
qt quickpoint2dqpointf
5 Posts 4 Posters 2.1k Views
  • 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.
  • AlvaroSA Offline
    AlvaroSA Offline
    AlvaroS
    wrote on last edited by koahnig
    #1

    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
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What is Point2D?

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

      1 Reply Last reply
      0
      • Joel BodenmannJ Offline
        Joel BodenmannJ Offline
        Joel Bodenmann
        wrote on last edited by Joel Bodenmann
        #3

        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

        kshegunovK 1 Reply Last reply
        0
        • Joel BodenmannJ 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.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @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

          AlvaroSA 1 Reply Last reply
          1
          • kshegunovK kshegunov

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

            AlvaroSA Offline
            AlvaroSA Offline
            AlvaroS
            wrote on last edited by
            #5

            @kshegunov yes, thanks to everyone!

            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