Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Passing x,y pixel coordinates to QML

Passing x,y pixel coordinates to QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 1.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.
  • H Offline
    H Offline
    Hoyt
    wrote on last edited by
    #1

    I am developing an app that has etch-a-sketch like functionality. I need to pass (x, y) pixel coordinates to QML so that lines can be drawn between the points.

    I initially thought that I would create an array in QML to store the pixel coordinates. However, I understand that dynamic array functionality is limited in QML.

    Any suggestions as to an efficient data structure to dynamically store (x, y) coordinates so that lines can be drawn in QML?

    Thank you.

    Hoyt

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      use mouse.x and mouse.y.

      H 1 Reply Last reply
      0
      • ? A Former User

        use mouse.x and mouse.y.

        H Offline
        H Offline
        Hoyt
        wrote on last edited by
        #3

        @Bhushan99

        Bhushan,

        I have no issues obtaining the current (x, y) pixel coordinates. However, I have not found a suitable data structure to dynamically store 1000+ coordinates so that I can efficiently draw lines between the pixel coordinates in a for loop.

        Hoyt

        Pablo J. RoginaP 1 Reply Last reply
        0
        • H Hoyt

          @Bhushan99

          Bhushan,

          I have no issues obtaining the current (x, y) pixel coordinates. However, I have not found a suitable data structure to dynamically store 1000+ coordinates so that I can efficiently draw lines between the pixel coordinates in a for loop.

          Hoyt

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @Hoyt what about using C++ backend to store the list of points and then QML using that model list to do the drawing?

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          2
          • H Offline
            H Offline
            Hoyt
            wrote on last edited by
            #5

            Pablo,

            Thank you for the suggestion. I will try the model list and let you know how it goes. Thanks again.

            Hoyt

            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