Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Loader vs createObject ?
Forum Updated to NodeBB v4.3 + New Features

Loader vs createObject ?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nutcracker
    wrote on last edited by
    #1

    I wish to have QML UI pages that I create and display for switching to different screens. There are two methods to do that namely using a Loader element or dynamically creating your objects using Javascript. What the main pros and cons of these approaches? Its not really laid out in the documentation.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      Hi Nutcracker,
      Loader can make use of multithreading (property asynchronous: true) and createObject() can't. Note that there is also incubateObject() for asynchronous object creation.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nutcracker
        wrote on last edited by
        #3

        Thanks Wieland,
        Yeah so the asynchronous object creation is possible for both. The only major difference which I could find by studying the doc was that the instantiated qml component is destroyed when the Loader's source property is changed but you have complete control of the lifetime of the qml component when you explicitly manage the lifetime via javascript.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved