Nominate our 2022 Qt Champions!

How to paint in QML Canvas form C++?

  • I need to paint on QML canvas figure that creates like many lines. I have an array in C++ code that is points of endings of these lines. How i can send this points to QML code and paint on it?Please give me how i can do it, what classes to use or anything else. Thank you.

  • Moderators


    Have a look at "Interacting with QML Objects from C++":

  • I published my third course on Qt this month. The final course is on "Integrating Qt Quick with C++": Watching it might save you some time. While it's probably not obvious from the table of contents interacting with the Canvas via a C++ class is covered in the 5th module "Registering C++ Types". It might be a little confusing to jump into the middle of the course but I still think you'll find it helpful. Of course I think you should watch the entire course but that's a little self-serving.

    Pluralsight is a subscription site but they have a free ten-day trial (limited to 4 hours) and I also have some VIP passes left. The VIP pass is good for a week but includes the ability to watch unlimited hours during the week, download the course materials, and watch offline (offline content will expire with the pass). If you want a pass, just send me an email through this forum.

Log in to reply