Performance tip Use Loaders

From Qt Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

Note: See also http://doc.qt.io/qt-5/qml-qtquick-loader.html

QML applications can start slowly if there is a lot of QML to be parsed. This can happen if the whole application is implemented in one huge QML file. Partition our application wisely into logical entities, load minimum QML at start and load more as you need it using Loaders.

  • The Loader item can be used to dynamically load and unload visual QML components defined in a QML file or items/components defined within a QML file. This dynamical behavior allows the developer to control the memory usage and startup speed of an application.
  • Partition your application into several QML files so that each file contains a logical UI entity. This way loading and unloading are easier to control. DO NOT have one huge QML file per application.
  • Load absolutely minimum amount of QML at application start to make your application start as quickly as possible. You can connect to network and show spinner etc. after the application UI is visible.
  • If your first view is very complex and requires lots of QML to be loaded, show a splash screen to give user the feeling that something is happening
  • You should load pieces of UI only by demand e.g. when the user navigates to another view, but on the other hand it may require more time to navigate between views