Important: Please read the Qt Code of Conduct -

QML with C++ backend - dynamic components

  • I am quite new to QML and am trying to write some code that features dynamic components with a C++ backend.

    Let's assume I want to write a program where:

    • The user presses a button that opens a dialogue where he fills in a name N, and position X, Y
    • When OK is pressed a component that is a rectangle with the text N from the dialogue is created at position X,Y with color C="blue"
    • N rectangles can be created by using the steps above (fully dynamic)
    • There is a C++ backed that has a list of these rectangles and can by some C++ logic change the X,Y,C properties of the rectangles or even add new rectangles or delete some created ones.

    I've read probably all documents that I could google that describe QML and C++ integration but didn't find an example that was close enough to what I need.

    I appreciate your guidelines of how to implement the desired behavior.

    Thanks in advance!

Log in to reply