Important: Please read the Qt Code of Conduct -

Qt Quick as OpenGL GUI library

  • Hi guys,

    I was looking around for an OpenGL GUI library when I accidentally came across Qt Quick. I think that QML combined with QML Components for Desktop can perfectly fit my needs. Therefore I have some questions:

    1. Do you think that QML can be easily integrated into OpenGL application (written in C++). I want QML to be used only for the UI (i.e. for dialogs, sliders, check boxes, radio buttons) so the user can easily modify some of the properties/settings of the program. Absolutely no other logic.

    2. What will be the performance penalty? Do you think that QML will show down dramatically the application frame rate?

    3. I found very nice looking Qt Quick applications here: (Qt5 Cinematic Experience is my favourite). Unfortunately the whole application is written entirely using QML (there is not C++ backend). Can you point me out some demos (preferably with source code) where QML is mixed up with C++ and OpenGL and Qt Quick is used only for the GUI?

    Thanks in advance for any advice, answer or guidance.

  • Moderators

    I don't know about this one. You would have to experiment with this, but it definitely seems possible (take a look at QDeclarativeView/QQuickView).

    Impossible to say. How would you judge the penalty? What would you compare it to? In general, Qt QUICK 1 is painted using Qt's raster engine, which is very fast, but software-bound. Qt QUICK 2 is based on Qt Scenegraph, which paints using OpenGL. That does not answer your question, though, and I don't know what would. Of course, QML comes with it's own engine, JS engine and hooks up to meta object system, but I can't say how it will affect performance in your project.

    It's probably too complicated an example,but you can take a look at my "CCF": Logic is mixed, but right now I moved most out of QML into C++. Either way, it's rather straightforward. I find it easy and fast to prototype using QML with JavaScript, and then, when API solidifies, I move it to c++. Mostly for fun, as there is no visible performance loss at that level of complexity. QML also comes with good documentation on integration with C++, you can see it "here": There is more, of course, but that's a good starting point.

  • Hi,

    Take a look at "QtMediaHub": for a decent example of mixing QtQuick and C++ in a real-world application.


Log in to reply