Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Not sure: off screen drawing? in c++?



  • Hello,

    For my application, I need to test different solutions off screen .
    Think of it like a puzzle (but my app is not about it): I create the puzzle off screen, make a lot of tests with collisions (boundingRect..), shapes, transforms and when satisfied with the result, send it to a canvas or whatever so that the user sees it.
    It doesn't matter how long it takes as far as it is not longer than 10 seconds (the user is presented with a waiting animation).

    I read that QtQuick is better than QPainter but is it able to fulfill my need (offscreen test)?

    New to it.

    Thank you!



  • I think I will use the c++ QQuickPainted API or a widget QGraphicScene (to handle collisions) to set and test my elements up, give back a QVariant to QML describing those elements and dynamically draw in QML..


  • Qt Champions 2018

    Have you looked at Box2D to analyze collisions between shapes, that's what I would use instead of painting stuff like QQuickPaintedItem or QGraphicsScene.



  • @GrecKo interesting; what class do you draw shapes with?



  • haha, it seems that I can't create a graphicscene inside my qtquick app because it will lead to a crash.

    It would have been very convenient to use that class for collision detection though..



  • box2D is the answer :)
    I will mark this post as answered when my test will be done



  • Actually, I decided to go the QRect route and ask for the intersects method with local objects for performance reasons.

    As for the translations/rotations I created my methods.

    Subject closed!


Log in to reply