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

Document refresh or script earlier than onCompleted



  • My project is an extension to a black box application (Traktor). By black box, I mean a lot of the classes being used are coming from a compiled c++ library (no source available). The files in this project are very long and repetitive. Adding loops for object creation will exponentially cut down on the file complexity.

    Using Repeaters would work, but the objects I am creating are not derived from Item. Is there a way around that?

    Within Component.onCompleted I am able to create objects and get then assigned to the right parents with commands like below

    Qt.createQmlObject('import CSI 1.0; import QtQuick 2.12; ButtonScriptAdapter {name: "'+ "PadFX3" +'"; brightness:1; color:colorToLED(preferences.iFX3Color), module, PadFX3}',
    
    for(var i=1; i<9; i++){
         var obj = Qt.createQmlObject('import CSI 1.0; import QtQuick 2.12; Wire{ from:"'+ surface +'.pads.'+ i +'"; to: "PadFX'+ i +'" }', wiresS1, "PadFX" + i); 
    }
    

    The problem is, it seems Component.onCompleted is too late. After I add my Wire components, is it possible to make the document execute those lines? I feel they are being added to the module correctly, but not getting executed.


Log in to reply