Tristan Heitzinger
Tristan Heitzinger

Reputation: 115

Show Qml-Window nicely after components are created

i want to start my Qt Quick application in fullscreen mode on a very slow hardware. This means you can literally watch the UI getting constructed. Thats not nice. I have already experimented with setting the visiblity= true in the OnCompletion of my window but it did not help.

I want to show my app nicely when every loading and layouting is completely done.

Thanks for any help

Upvotes: 1

Views: 635

Answers (1)

Mitch
Mitch

Reputation: 24396

There was a blog post written a while back about optimising Qt Quick applications. Here are the do's and don'ts from that list:

Do:

  • Design your application to start fast from the beginning. Think what is it that you want the user to see first.
  • Make startup animations to allow parallel loading.
  • Use chain loading. Run only as many loaders as you have cores in your CPU (e.g two cores: two loaders running at the same time).
  • First loader should not be asynchronous. Trigger the rest of the loaders.
  • Create QML plugins that are loaded when required.
  • Connect to back-end services only when required.
  • Let the QML plugins start up non-critical services and close those down when not required anymore.
  • Optimize your png / jpg images.
  • Optimize your 3d models by reducing the amount of vertices and removing parts that are not visible.
  • Optimise the 3D model loading by using glTF.
  • Use Qt Quick Controls 2.0. These are designed for embedded use and the creation times are a lot better than in Quick Controls 1.0 for embedded use cases.
  • Limit the usage of clip & opacity.
  • Measure GPU limitations and take those into account when designing the UI.
  • Use Qt Quick Compiler to pre-compile the QML files.
  • Investigate if static linking is possible for your architecture.
  • Strive for declarative bindings instead of imperative signal handlers.
  • Keep property bindings simple. In general, keep QML code simple, fun and readable. Good performance follows.
  • When targeting multiple platforms and form factors, use file selectors instead of loaders and dynamic component instantiation. Don’t be shy to “duplicate” simple QML code and use file selectors to load tailored versions.

Do not:

  • Go overboard with QML. Even if you use QML, you don’t need to do absolutely everything in QML.
  • Initialize everything in your main.cpp.
  • Create big singletons that contain all the require interfaces.
  • Create complex delegates for Listviews.
  • Use Qt Quick Controls 1.0 for embedded.
  • Clip should be avoided altogether if possible. (98% of the use cases this should be possible).
  • Fall into the common trap of overusing Loaders. Loader is great for lazy-loading larger things like application pages, but introduces too much overhead for loading simple things. It’s not black magic that speeds up anything and everything. It’s an extra item with an extra QML context.
  • Overdo re-use. Maximum code re-use often leads to more bindings, more complexity, and less performance.

There's also a page about performance in the Qt docs:

Performance Considerations And Suggestions

Upvotes: 2

Related Questions