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

Low performance of dynamic component creation



  • Hello,

    I have a dynamic component creation on my app. This app is design to run on an embedded device. On the computer my app is working perfectly but as soon as it runs on the embedded device the dynamic component creation is slow.

    I do create some kind of pop up window when I click on a button and the pop up shows up only after 1 to 2 seconds after I press the button.

    Is this delay normal ? Is there a way to improve the perfomance or I should go with a visibility change instead ?

    Here is the code I use to create the component

      function createComponent(){
            var component
            component = Qt.createComponent("MyComponent.qml");
            if (component.status === Component.Ready)
                finishCreation(component);
            else
                component.statusChanged.connect(finishCreation);
        }
    
    
        function finishCreation(component){
            var myComponent
            if (component.status === Component.Ready) {
                myComponent= component.createObject(pompage, {"x": 0, "y": 0});
                myComponent.property1= 1
                myComponent.property2= checkbox.checked
                if (myComponent=== null) {
                    // Error Handling
                    console.log("Error creating object");
                }
            } else if (component.status === Component.Error) {
                // Error Handling
                console.log("Error loading component:", component.errorString());
            }
        }
    

Log in to reply