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
Forum Updated to NodeBB v4.3 + New Features

QPointF to Point2D

Scheduled Pinned Locked Moved Solved General and Desktop
qt quickpoint2dqpointf
5 Posts 4 Posters 2.2k 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.
  • A Offline
    A Offline
    AlvaroS
    wrote on 21 Jun 2016, 10:02 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
    • J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 21 Jun 2016, 11:00 last edited by
      #2

      What is Point2D?

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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Joel Bodenmann
        wrote on 21 Jun 2016, 11:45 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

        K 1 Reply Last reply 21 Jun 2016, 11:55
        0
        • J Joel Bodenmann
          21 Jun 2016, 11:45

          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.

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 21 Jun 2016, 11:55 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

          A 1 Reply Last reply 22 Jun 2016, 08:49
          1
          • K kshegunov
            21 Jun 2016, 11:55

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

            A Offline
            A Offline
            AlvaroS
            wrote on 22 Jun 2016, 08:49 last edited by
            #5

            @kshegunov yes, thanks to everyone!

            1 Reply Last reply
            0

            1/5

            21 Jun 2016, 10:02

            • Login

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