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

    Hi,

    Have a look at "Interacting with QML Objects from C++":http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html.



  • I published my third course on Qt this month. The final course is on "Integrating Qt Quick with C++":http://bit.ly/qtquickcpp. 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.