Important: Please read the Qt Code of Conduct -

Using Qt.callLater ?

  • Is it safe to use Qt.callLater? Does it have any disadvantages?
    Eg: If i have one QML which loads another QML using loader. Can I provide the source of the loader using a Qt.callLater Function?

  • Hi @fcarney,

    So in My application there are multiple UI updates that happen, so when i want to open a page(Like a Menu), i would like to open the Menu, Just by loading the Title Bar first and the contents of the Menu just after, without any visible Glitch.

    So i would load the TitleBar and on the component.oncompleted of the TitleBar, i would perform a callLater for the contents of the same.

    So my question is : When i write callLater to load the contents of the page under the Title bar, will it occur immediately after the titlebar or will the operation be puushed to the end of the Events queue, due to which i could possibly see a visible delay? Currently in my application i do not see any delay, but in case of long runs/ heavy operations , is it possible that there might be a delay?

  • You will have to test this by loading your system. The next event loop iteration might be milliseconds away. You will have to read up on the event loop as to how long that is and if that is acceptable.

  • I wonder why you are using Component.onCompleted to load data? I would think a demand driven model based upon QAbstractListModel/ItemModel might be better.

  • Hi @fcarney ,
    Yes I will check the same . Thank you for the Input.

    No Actually I am loading another qml on the completion of the load of a titlebar page.
    So My QMl looks like :
    id:loadId : titleRect.bottom

    function setSource()
    loadId.source = "Menu_Page1.qml"

    @fcarney : Thanks for your inputs. :)

Log in to reply