Search code examples
c++performanceqtqmlqtwidgets

Qt: Is QML faster than c++ widget?


Should I make a qwidget and reimplement its paint function or make a qml widget and plug it in as a qwidget in consideration of performance.


Solution

  • Depends on what you mean by "faster" and "performance". QML offers better framerates, because it uses a renderer which minimizes the costly context switches. But at the same time, QML is considerably slower to instantiate, and uses significantly more memory. Even though you can compile QML code to C++, this is currently not available in the "free" version, only in "professional" and "enterprise" licenses.

    But development time should also be considered, many regard it as the most expansive resource, and are right to do so. UI with QML is tremendously faster to implement compared to QtWidgets when you need custom UI elements with animations, effects and so on. For standard widgets and desktop applications you can use the Designer, which makes QtWidgets comparable to QML in this regard.