Qt Creator 3.6 RC1 released

We are happy to announce the release of Qt Creator 3.6 RC1.

Since the beta, we have fixed many bugs, including an ugly, evasive crash that could happen on code completion, depending on how you used the mouse while typing function arguments (QTCREATORBUG-15275).

We simplified the activation of the Clang code model, and added a global option for additional arguments. You can for example use this to disable warnings that you do not care about, or to enable warnings that Qt Creator disables by default.

For an overview of what has changed in 3.6 compared to 3.5 please take a look at the Qt Creator 3.6 Beta1 blog post or our change log.

You find the opensource version on the Qt download page, and commercially licensed packages on the Qt Account Portal. Please post issues in our bug tracker. You can also find us on IRC on #qt-creator on irc.freenode.net, and on the Qt Creator mailing list.

Note: Starting with Qt Creator 3.6 we no longer provide prebuilt binaries for Linux 32-bit. Building Qt Creator on that platform is still supported though.

The post Qt Creator 3.6 RC1 released appeared first on Qt Blog.

Qt Quick Controls Re-engineered – Status Update

Since announcing research on Qt Quick Controls optimized for embedded use, we’ve made good progress towards achieving feature parity with the original Qt Quick Controls. We’ve also added some new controls that didn’t exist (Drawer, RangeSlider, and SwipeView, to name a few).

The previous blog post cited performance reasons as the motivation for having one fixed style. However, we have found a way to make multiple styles available without sacrificing performance. So far, two new styles have been merged, implementing both Google’s Material Design and Microsoft’s Universal Design.



Material style


Universal style

It’s important to note that these styles are not claiming to be native, but instead a 100% cross-platform implementation of the Material and Universal design guidelines. For example, the Material style does not adapt to any Sony or Samsung theme on Android. You can run these styles on any platform and they will look more or less identical.

We’re also working on a neutral, optimised base style, and a fancier “Qt” style, both in cooperation with our designers.

Earlier, we talked about separating the C++ logic and the visual QML layer. Thanks to the feedback from our users, we have realized the power of a pure C++ logic layer and have decided to expose it separately for those wanting to build their own custom user experience. We’ve named this layer “templates”. A template is the foundation of a control. They encapsulate the behaviour of controls and provide an interface for styles to do their thing, allowing a true separation of concerns. For an introduction to this concept, take a look at the following video taken from the 2015 Qt World Summit:

The styling system now uses a technique similar to file selectors to choose which style to load at application startup. There are currently two ways to choose the application style:

  • An environment variable:
  • The “-style” application argument:
    -style material

A manifest file for specifying the preferred style and style-specific attributes is also being considered as a future addition.

The more complex beasts like TableView and TreeView are on our to-do list. We realise that these are some of the most important controls, remaining quite relevant even on touch devices. Given the great opportunity that we have (to completely redesign all of the controls), we’d like to take the time to design these particular controls to be as lean as possible. After all, they are typically showing the most data. Not using Loaders has already given us a substantial head start in this area.

Popups are also getting some love, with a new approach that uses Qt Quick items instead of native top-level windows. What this means is that:

  • All platforms will have full access to menus, even embedded systems that don’t support multiple top-level windows.
  • Controls like ComboBox will be fully styleable, which was not possible with native windows in Qt Quick Controls.
  • Internal focus and key event handling is simplified.
  • It is easier to auto test things like menus, resulting in greater test coverage.
  • Popups will be bound to the window in which they were created.

Controls that will take advantage of this approach include Menu, ComboBox and PieMenu, with ToolTip also being considered as a new addition.

Finally, with the new infrastructure, we’ve decided to consolidate some of the controls from Qt Quick Extras into the module, resulting in one less import to remember. Not all of the controls made the cut, as we’d like to get an idea of which of these are in demand so that we can focus on the core areas of the module. Creating suggestions on our bug tracker (under the component “QtQuick: Controls 2“) is a great way to let us know what you’d like to see as part of the offering.

Here’s a small example of a Qt Labs Controls application:

import Qt.labs.controls 1.0

ApplicationWindow {
    visible: true

    Button {
        text: "Hello World!"

We will be releasing a technical preview of the new controls in Qt 5.6 (with the working title of Qt Labs Controls), with a proper release planned for 5.7. We’ve had some early adopters trying out what we have so far, and giving us feedback via the bug tracker, which is great! If you’d like to do the same, try out the latest Qt 5.6 snapshot.

The post Qt Quick Controls Re-engineered – Status Update appeared first on Qt Blog.

Desktops DevRoom @ FOSDEM 2016: Have you submitted your talk yet?

FOSDEM 2016 is going to be great (again!) and you still have the chance to be one of the stars.

Have you submitted your talk to the Desktops DevRoom yet?


Remember: we will only accept proposals until December 6th. After that, the Organization Team will get busy and vote and choose the talks.

Here is the full Call for Participation, in case you need to check the details on how to submit:

FOSDEM Desktops DevRoom 2016 Call for Participation

Topics include anything related to the Desktop: desktop environments, software development for desktop/cross-platform, applications, UI, etc

Efficiency Matters!

It’s every programmer’s worst nightmare. Your beautiful app is running at a snail’s pace, crippled by virtual memory swapping. Even worse, you’ve added one last bitmap resource, and suddenly unrelated chunks of the UX aren’t showing up!

Desktop machines have become powerful enough that programmers rarely worry about performance issues, and today’s embedded systems usually have enough horsepower at their disposal. But in constructing sophisticated user interfaces with more and more elaborate imagery and high-definition backgrounds, we are often sapping one resource that’s always scarce: RAM. That’s especially true for the dedicated video RAM (VRAM) that sits on the GPU.

Example of modern user interface that could benefit from compressed textures

Holoplot UX – Example of modern user interface that could benefit from compressed textures. (KDAB designed UX, photo courtesy of Holoplot.)

With ever-increasing screen densities, it’s easy to see why VRAM is in such demand. An iPad with a retina display is 2048×1536 pixels, and at 4 bytes per pixel, that’s a whopping 12.5MB of RAM for just a static background image. Toss in a few more large bitmaps, masks, or textures, and you can be consuming dozens or hundreds of megabytes of VRAM, not to mention regular RAM.

“Not me! All my images are compressed JPEGs or PNGs,” you say. Yes, but Qt Quick 2 (QQ2) uncompresses images on loading them, so your svelte, skinny PNGs uncompress into giant blocks of RAM on program start. And those bitmaps take an equivalent bite out of VRAM when they’re displayed. Making one-bit deep masks or using a 16- or 8-bit color depth doesn’t really help, as everything gets expanded out into 32-bit RGBA on loading.

What’s an enterprising Qt Quick 2 programmer to do? Take a tip from our game engine friends, that’s what. Modern video games load and manage hundreds of large, high-quality textures, and they get away with it by using custom compressed textures. The textures are directly loaded off disk and left in a compressed format that the GPU can understand. These formats aren’t JPEG or PNG—they’re highly specialized formats that need a time-consuming conversion process. But the GPU can directly read those formats and uncompress them to the display on-the-fly, meaning that your RAM (and VRAM) only takes the hit for the compressed sizes, not the fully expanded size. That can result in dramatic savings of both RAM and VRAM.

We don’t want to reinvent all Qt’s display machinery, so unless we can convince Qt to compress textures, any possible savings would be academically nice, but practically impossible. Fortunately, through the QOpenGLTexture class (a KDAB contribution, btw), QQ2, provides all the necessary APIs to let us change the underlying behavior to use compressed textures without mucking around in the internals.

Overriding the QSGTexture class

    class CompressedSGTexture : public QSGTexture
        CompressedSGTexture(const PKMImage &image);
        void bind() Q_DECL_OVERRIDE;
        bool hasAlphaChannel() const Q_DECL_OVERRIDE;
        bool hasMipmaps() const Q_DECL_OVERRIDE;
        int textureId() const Q_DECL_OVERRIDE;
        QSize textureSize() const Q_DECL_OVERRIDE;
        PKMImage m_image;
        QScopedPointer ⟨QOpenGLTexture⟩ m_texture;

The first step is to compress the images using a GPU-friendly compression scheme. Unfortunately there are a number of these formats, many are proprietary and not well documented, and they aren’t readily exportable from common image-editing tools like GIMP or Photoshop. Thankfully though, ARM includes, as part of their ARMMali visual technology suite, a freely available and great tool that deals with a number of the most encountered compression formats: the Mali GPU Texture Compression Tool. Using the Mali GPU Texture compression tool to compress some samples images at the highest quality setting took over 30 minutes on a decent machine, so you may want to settle for slightly less than perfection!

Loading compressed NVIDIA GPU PKM files for the texture provider

QQuickTextureFactory *CompressedTextureImageProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize)

    QFile imageFile(QStringLiteral(“:/%1.pkm”).arg(id));
    if (!imageFile.open(QFile::ReadOnly))
        return 0;

    QByteArray header = imageFile.read(PKM_HEADER_LENGTH);
    if (header.length() != PKM_HEADER_LENGTH) {
        qWarning() ⟨⟨ “PKM header too short”;
        return 0;

    PKMImage image;
    const char *headerData = header.constData();

    // Parse the PKM header
    if (memcmp(headerData, PKM_HEADER_PREAMBLE, PKM_HEADER_PREAMBLE_LENGTH) != 0) {
        qWarning() ⟨⟨ “Malformed PKM header (missing heading)”;
        return 0;
    headerData += 4;

    if (memcmp(headerData, PKM_HEADER_VERSION, PKM_HEADER_VERSION_LENGTH) != 0) {
        qWarning() ⟨⟨ “Malformed PKM header (wrong version)”;
        return 0;
    headerData += 2;

#define UCC(x) (reinterpret_cast⟨const uchar *⟩(x))
    const quint16 dataType = qFromBigEndian⟨quint16⟩(UCC(headerData));
    if (dataType != PKM_ETC2_RGB_NO_MIPMAPS) {
        qWarning() ⟨⟨ “Malformed PKM header (wrong data type)”;
        return 0;
    headerData += 2;

    image.effectiveSize.rwidth() = qFromBigEndian⟨quint16⟩(UCC(headerData));
    headerData += 2;
    image.effectiveSize.rheight() = qFromBigEndian⟨quint16⟩(UCC(headerData));
    headerData += 2;
    image.originalSize.rwidth() = qFromBigEndian⟨quint16⟩(UCC(headerData));
    headerData += 2;
    image.originalSize.rheight() = qFromBigEndian⟨quint16⟩(UCC(headerData));
    headerData += 2;
#undef UCC

    Q_ASSERT(image.effectiveSize.width() % 4 == 0);
    Q_ASSERT(image.effectiveSize.height() % 4 == 0);
    Q_ASSERT(headerData == header.constEnd());

    // Read out the payload
    const qint64 imageDataLength = ((image.effectiveSize.width() / 4) * (image.effectiveSize.height() / 4)) * 8;
    image.data = imageFile.read(imageDataLength);
    if (image.data.length() != imageDataLength) {
        qWarning() ⟨⟨ “Malformed PKM file: payload too short”;
        return 0;

    if (!imageFile.atEnd()) {
        qWarning() ⟨⟨ “Malformed PKM file: data after the payload”;
        return 0;

    if (size)
        *size = image.effectiveSize;

    return new CompressedTextureFactory(image);

Once you have your images compressed in a GPU-digestible way, the QQ2-related code is pretty straightforward with QOpenGLTexture doing most of the heavy lifting. Here’s sample code (including all the assorted code snippets) with the tweaks you’ll need. Note that this sample code is not a full executing sample and just a proof of concept, so #include <all standard disclaimers> …

To pull off the compressed texture magic, we need a custom image provider (CompressedTextureImageProvider), a custom texture provider (derived from QQuickTextureFactory), and a custom QSGTexture subclass (CompressedSGTexture in the sample code). Although the compressed texture is nearly the same size as the original PNG, the RAM/VRAM savings for a background image during runtime is about 12MB!

Compressed Texture Factory

class CompressedTextureFactory : public QQuickTextureFactory

    CompressedTextureFactory(const PKMImage &amp;amp;image);

    QSGTexture *createTexture(QQuickWindow *window) const Q_DECL_OVERRIDE;
    QImage image() const Q_DECL_OVERRIDE;
    int textureByteCount() const Q_DECL_OVERRIDE;
    QSize textureSize() const Q_DECL_OVERRIDE;

    PKMImage m_image;

CompressedTextureFactory::CompressedTextureFactory(const PKMImage &amp;amp;image)
    : m_image(image)

QSGTexture *CompressedTextureFactory::createTexture(QQuickWindow *window) const
    return new CompressedSGTexture(m_image);

QImage CompressedTextureFactory::image() const
    // FIXME/TODO: we can't easily get a QImage out of compressed texture data;
    // uncompressing image left as an exercise for the reader. This function
    // isn't called under normal circumstances...
    return QImage();

int CompressedTextureFactory::textureByteCount() const
    return m_image.data.length();

QSize CompressedTextureFactory::textureSize() const
    return m_image.effectiveSize;

The other big advantage of compressed textures is CPU utilization, especially during program initialization. Everyone appreciates faster program start times, and that’s especially true on constrained devices like tablets, mobiles, or embedded devices. Not only are we skipping the decompression step during the load phase, but we’re also minimizing the size of copies between RAM and VRAM.

Tons less memory and faster execution for a sprinkling of calls and an extra step added to the build process. Not a bad payoff!

About KDAB

KDAB is a consulting company dedicated to Qt and offering a wide variety of services and providing training courses in:

KDAB believes that it is critical for our business to invest into Qt3D and Qt, in general, to keep pushing the technology forward and to ensure it remains competitive.

The post Efficiency Matters! appeared first on KDAB.

Embedded Linux news in Qt 5.6

With Qt 5.6 approaching, it is time to look at some of the new exciting features for systems running an Embedded Linux variant, just like we did for Qt 5.5 a while ago.

Support for NVIDIA Jetson Pro boards

Boards like the Jetson TK1 Pro running a Yocto-generated Vibrante Linux image have support for X11, Wayland, and even running with plain EGL without a full windowing system. The latter is accomplished by doing modesetting via the well-known DRM/KMS path and combining it with the EGL device extensions. This is different than what the eglfs platform plugin’s existing KMS backend, relying on GBM, offers. Therefore Qt 5.5 is not functional in this environment. For more information on the details, check out this presentation.

Wayland presents a similar challenge: while Weston works fine due to having been patched by NVIDIA, Qt-based compositors built with the Qt Compositor framework cannot function out of the box since the compositor has to use the EGLStream APIs instead of Mesa’s traditional EGLImage-based path.

With Qt 5.6 this is all going to change. With the introduction of a new eglfs backed based on EGLDevice + EGLOutput + EGLStream, Qt applications will just work, similarly to other embedded boards:

eglfs on the Jetson K1 Pro

The well-known Qt Cinematic Experience demo running with Qt 5.6 and eglfs on a Jetson K1 Pro

Cross-compilation is facilitated by the new device makespec linux-jetson-tk1-pro-g++.

Wayland is going to be fully functional too, thanks to the patches that add support for EGL_KHR_stream, EGL_KHR_stream_cross_process_fd, and EGL_KHR_stream_consumer_gltexture in the existing wayland-egl backend of Qt Compositor.

Wayland on the Jetson with Qt

The qwindow-compositor example running on the Jetson with some Qt clients

All this is not the end of the story. There is room for future improvements, for example when it comes to supporting multiple outputs and direct rendering (i.e. skipping GL-based compositing and connecting the stream directly to an output layer à la eglfs to improve performance). These will be covered in future Qt releases.

Note that Wayland support on the Jetson should be treated as a technical preview for the time being. Compositors using the unofficial C++ APIs, like the qwindow-compositor example shown above, will work fine. However, QML and Qt Quick support is still work in progress at the time of writing.

Support for Intel NUC

Some of the Intel NUC devices make an excellent embedded platform too, thanks to the meta-intel and the included meta-nuc layers for Yocto. While these are ordinary x86-64 targets, they can be treated and used like ARM-based boards. When configuring Qt for cross-compilation, use the new linux-nuc-g++ device spec. Graphics-wise everything is expected to work like on an Intel GPU-based desktop system running Mesa. This includes both eglfs (using the DRM/KMS/GBM backend introduced in Qt 5.5) and Wayland.

Wayland on boards based on the i.MX6

Systems based on Freescale’s i.MX6 processors include a Vivante GC2000 GPU and driver support for Wayland. Qt applications have traditionally been working fine on the Weston reference compositor, see for example this previous post for Qt 5.4, but getting Qt-based compositors up and running is somewhat tricky due to some driver specifics that do not play well with QPA and eglfs. With Qt 5.6 this issue is eliminated as well: in addition to the regular Vivante-specific backend (eglfs_viv), eglfs now has an additional backend (eglfs_viv_wl) which transparently ensures proper functionality when running compositor applications built with the Qt Compositor framework. This backend will need to be requested explicitly, so for example to run the qwindow-compositor example, do QT_QPA_EGLFS_INTEGRATION=eglfs_viv_wl ./qwindow-compositor -platform eglfs (the -platform can likely be omitted since eglfs is typically the default).

OpenGL ES 3.0 and 3.1

As presented earlier, OpenGL ES 3 support is greatly enhanced in Qt 5.6. Using the new QOpenGLExtraFunctions class applications targeting embedded devices with GLES 3 capable drivers can now take the full API into use in a cross-platform manner.


Qt 5.5 introduced support for libinput when it comes to getting input events from keyboards, mice, touchpads, and touchscreens. Qt 5.6 takes this one step further: when libinput is available at build time, it will be set as the default choice in eglfs and linuxfb, replacing Qt’s own evdevkeyboard, mouse, and touch backends.

In some rare cases this will not be desirable (for example when using evdevkeyboard-specific keyboard layouts from the Qt 4 QWS times), and therefore the QT_QPA_EGLFS_NO_LIBINPUT environment variable is provided as a means to disable this and force the pre-5.6 behavior.

That’s it for now. Hope you will find the new Embedded Linux features useful. Happy hacking!

P.S. the Qt World Summit 2015 had a number of exciting talks regarding embedded development, for example Qt for Device Creation, Choosing the right Embedded Linux platform for your next project and many more. Browse the full session list here.

The post Embedded Linux news in Qt 5.6 appeared first on Qt Blog.

A Minuet for KDE

A Minuet for KDE

Update: Minuet has been moved to KDE Edu playground. You can clone it from git://anongit.kde.org/minuet.

A Minuet is a musical form (occasionally with an accompanying social dance for two people) originated in the 17th-century France, initially introduced to opera but later also to suites such some of those from Johann Sebastian Bach. Although composing a minuet for KDE wouldn't be bad at all :), my musical skills don't make me feel like doing so by no means and, therefore, this post is gonna be about - you know - software and KDE! But software for music :)

Three years ago, I tried to push one of my students into developing a KDE software for music education. It was named Spinet, had even some nice features for MIDI manipulation and we managed to build it in both Linux and Windows. We couldn't move it forward though, the student lost energy and I was in the darkest times of my PhD research. But ... now I'm an idle professor :) looking for some fun and trying to put two awesome things together: computers and music. Exactly fifteen days ago I started the development of Minuet - a software for music education built upon the amazing technology provided by Qt and KDE.

What's Minuet about?

First of all, Minuet isn't a music/media player or a music organizer. It's intended to help music teachers and students in their journey towards the grasp of many theoretical and practical aspects of music teaching/learning by integrating technology, content, and teaching methods. It's something along the lines of GNU Solfege (nice content but nasty UX), Online Ear Training (nice method but limited extensibility), Transcribe! (nice features for transcribing music), and EarMaster (the widely adopted proprietary :( solution for music education).

So, it works :) That's what it looks like so far:

A Minuet for KDE

How does it work?

Minuet capabilities highly depend on the use of MIDI. With that, we are able of fully control played notes, their pitch, volume, and tempo, setting the underlying infrastructure required to define exercises, classes, and other educational instruments. Supporting cross-platform MIDI functionalities isn't that easy and Minuet relies on the Drumstick library for such a challenge work. Drumstick is a Qt5-based wrapper facade with backends for both libasound (ALSA library for writing MIDI clients) and Windows' mmsystem.

One of major drivers in Minuet architecture design is the definition of a highly extensible core in order to support the seamlessly integration of new content from music teachers. Currently, music exercises are completely defined in JSON files, which are loaded during Minuet start up and passed to a bunch of dynamic QML magic code for rendering the exercises menu and the main exercise screen. It's simply amazing to see how QML really makes things much easier and integrates well with using JSONObjects as models.

This is an example of defining a Minuet ear training exercise for intervals and scales in JSON:

        "name":"Ascending Melodic Intervals",
            "name":"Seconds", "options":[{
                "name":"Minor Second", "sequenceFromRoot":"1"
                "name":"Major Second", "sequenceFromRoot":"2"
            "name":"Thirds", "options":[{
                "name":"Minor Third", "sequenceFromRoot":"3"
                "name":"Major Third", "sequenceFromRoot":"4"
            "name":"Tritone and Sevenths", "options":[{
                "name":"Tritone", "sequenceFromRoot":"6"
                "name":"Minor Seventh", "sequenceFromRoot":"10"
                "name":"Major Seventh", "sequenceFromRoot":"11"

This JSON file define three exercises: "Seconds", "Thirds" and "Tritone and Sevenths", which evaluate the student perception regarding four types of music intervals. These exercises will be presented in the menu along the path "Intervals" -> "Ascending Melodic Intervals". Each exercise consists in playing a randomly chosen interval (for the types selected) and asking the student to identify that interval among a number of options presented. The root parameter identifies the pitch range from which the interval's root note will be selected. The options array defines the possible answers for the exercise, along with the delta (from the root) which characterizes the interval. For instance, a 2nd minor interval is located 1 half tone above the root note, while a tritone interval is located 6 half tones above the root note. Minuet's core takes care of randomly picking up a possible answer, playing that to the user, and checking if he/she chose the right answer.

Such a JSON file allows for extending the tool with new exercises without changing a single line of code in the Minuet's core. Furthermore, we can define new exercises at a crazy very fast speed. This is how an exercise with 24 possible answers is rendered in Minuet. Pretty cool, an? :)

A Minuet for KDE

I'm currently using TiMidity++ and Freepats as a MIDI client for playing notes, but you can use virtually any ALSA-compatible MIDI device including your synthesizer or MIDI controller. Here, I was pretty lucky and could answer a major 3rd interval - I'm good with thirds :)

A Minuet for KDE

I can't say the same for identifying tritones :)

A Minuet for KDE

So, what's next?

Well, Minuet works and you can actually get a lot of fun already :) Just clone it from git://anongit.kde.org/scratch/sandroandrade/minuet.git, install Drumstick, TiMidity++/freepats and build Minuet. Start the TiMidity client with timidity -iA and then enjoy enhancing your music skills :)

A lot of nifty features crop up in my mind regarding the future of Minuet:

  • A class/exercise editor for generating JSON files and easing the teacher's work.
  • Signal processing algorithms for singing (for intervals and solfa) and clap (for rhythm) analysis.
  • Enhanced integration with MIDI hardware.
  • Upload and download of classes/exercises via GHNS.
  • Integration with play-along features for rehearsal support.
  • Addition of new types of content (music analysis, composition, etc).
  • Implementation of new instrument-specific views (for guitar, bass, etc).

Yes, a lot of work ahead. For now, and following the motto of "release early, release often", I'll do the required polishing for having a first release as soon as possible.

Currently, I have the valuable support of three members of Genos - a multidisciplinary research group from the Music School of Federal University of Bahia. They will help me to define the major educational contents to be provided and suitable pedagogical techniques.

So, contributions are quite welcome of course. If you like music and (of course) if you like KDE, please don't hesitate to join me in such an adventure :)

See you,

Embedding QML: Why, Where, and How

If you’re already using QML in Qt, you know that it can help quickly create flexible user interfaces using little or no C++ programming. With a basic text file and some JavaScript logic, you can put together a pretty sophisticated interface like that shown in the Qt Quick Clock demo (below) with a minimum of fuss. But did you know you can compress your plainly readable QML and hide it away inside a binary?



Figure 1: Qt Quick Clock screen

If substantial portions of the application are in a plain text file, they could be examined or modified by the user. That’s a concern if your UX contains sensitive information. Perhaps you want to remove any temptation to “tinker” with the interface, ensuring there are no unnecessary support calls. Is there any opportunity to more tightly bundle those QML resources along with the executable? Thankfully, the answer is a resounding “yes”.

Standard Qt resources—icons, bitmaps, audio files, translation tables, etc—can be compressed and linked to the executable, allowing you to create a distribution with fewer external dependencies. Not only is this simpler to manage for versioning and installation, but it provides a measure of confidence that your application will always have the resources it depends on to run properly.

With just a bit of creativity, the Qt resource capability can also be used to insert QML files into an accompanying library, making the QML a bit more protected while retaining the interface definition separate from the executable. The trick is to subvert the QML plugin capability to bind your QML into the app. You still need a bit of a QML stub to get the process kicked off. However, the main logic and content gets pulled into the app through the QML plugin, turning it into an “invisible” resource.

Here’s a little example of this approach by merging the QMLExtensionPlugins and Qt Quick Clock examples so you can see this technique in action.

First of all, we insert a line in our Qt project files (src.pro) to add an “install” directory:

target.path = $$OUT_PWD/../install

Now we’ll be able to run “make install” to create our plugin. But what goes in the plugin? The plugins directory from the example contains the files needed to manage and install the Qt plugin process, so we copy those directly. Again, we need to adapt those to integrate our Clock example, so here are the files we need:


Clock.qml is our QML file that we’ll incorporate into our plugin, and the png images are referenced in the QML for drawing the clock face.

We need to create a resource file that we’ll call qmlqtimeexampleplugin.qrc that pulls in our Clock.qml as well as the other resources referenced by our QML:

   <qresource prefix="/clock">

In this case, we don’t need a prefix when referring to the resource as they’re in the same directory as the QML. (If you do need to access something in a specific QtResource path, you can prepend “qrc:///<path>” to your resource name when you reference it.)

We also need to create a qmldir file in the TimeExample directory to define our module:

module TimeExample
Clock 1.0 qrc:///clock/Clock.qml
plugin qmlqtimeexampleplugin

We keep the qmldir module definition file separated from the Qt Resources so our application can find the plugin.

After handling all of the above details, and doing a build to create the plugin shared object, we’re left with the following files for the main application to use:


We won’t step through the entire Qt plugin mechanism in this blog, but we will quickly review the other bits needed to take advantage of our new plugin:

  • qrc lists the program resources; in this case it’s just the plugins.qml file below
  • qml provides the interface to our QML resource. Of course the implementation is provided within the libqmlqtimeexampleplugin.so file that we’ve just created
  • imports/plugin.cpp is the C++ implementation that ties things together

Now that we have all of the QML and plugin components in place, our main.cpp file puts the gears in motion like this:


We’ve now got our user interface safely encapsulated in a .so, safe from tampering, compressed for size, and bundled with all the resources it needs. No more excuses for not jumping on the QML bandwagon!

About KDAB

KDAB is a consulting company dedicated to Qt and offering a wide variety of services and providing training courses in:

KDAB believes that it is critical for our business to invest into Qt3D and Qt, in general, to keep pushing the technology forward and to ensure it remains competitive.

The post Embedding QML: Why, Where, and How appeared first on KDAB.

Tips from the Experts

You want to build the cleanest code, the smartest code, the fastest code. You’re the alpha geek on your team, or maybe you aspire to be. You have an all-encompassing need to know.

Let me introduce a new series we’re going to be running here on the KDAB blog. I’m Andy Gryc, and for the majority of my career I was a software engineer. Now, among other things, I’m a writer. A writer who understands software. I’m going to be working with some of the brilliant engineers at KDAB to help turn their great ideas into blog posts: new tools, great insights, cool demos. Great articles you can anticipate every other week that will help you learn timesaving tricks, clever optimizations, and state-of-the-art techniques for building great Qt programs.

Why not just have those experts blog themselves? Two reasons. The biggest is time. Taking an idea and turning it into an easily read blog takes some time, time that then becomes unavailable for making brilliant software. The other reason, simply stated, is that your skill as a developer doesn’t always translate into your artistry in the English language. ‘Nuff said.

So if you’re wondering why the developer you’ve been chatting with now seems a bit more eloquent in the KDAB blog, just remember: this blog is a joint project. I’ll be interviewing our KDABian pros to create some KDABian prose. The words (and the mistakes) may be mine, but the content is all theirs.

We’re looking forward to exposing some gems hidden in the KDAB knowledge base. And we’d love feedback too—tell us if you find these tips useful, or what dramatic results you’ve achieved. We love to help, and we love hearing stories about how we helped. Your feedback helps us know that we’re on the right track.



The post Tips from the Experts appeared first on KDAB.

FOSDEM Desktops DevRoom 2016 Call for Participation

FOSDEM is one of the largest gatherings of Free Software contributors in the world and happens each February in Brussels (Belgium, Europe). One of the tracks will be the Desktops DevRoom (formerly known as “CrossDesktop DevRoom”), which will host Desktop-related talks.

We are now inviting proposals for talks about Free/Libre/Open-source Software on the topics of Desktop development, Desktop applications and interoperability amongst Desktop Environments. This is a unique opportunity to show novel ideas and developments to a wide technical audience.

Topics accepted include, but are not limited to:

  • Open Desktops: Gnome, KDE, Unity, Enlightenment, XFCE, Razor, MATE, Cinnamon, ReactOS, etc
  • Closed desktops: Windows, Mac OS X, CDE, MorphOS, etc (when talking about a FLOSS topic)
  • Software development for the desktop
  • Development tools
  • Applications that enhance desktops
  • General desktop matters
  • Cross-platform software development
  • Web

Talks can be very specific, such as the advantages/disadvantages of development with Qt on Wayland over X11/Mir; or as general as predictions for the fusion of Desktop and web in 5 years time. Topics that are of interest to the users and developers of all desktop environments are especially welcome. The FOSDEM 2015 schedule might give you some inspiration.


Please include the following information when submitting a proposal:

  • Your name
  • The title of your talk (please be descriptive, as titles will be listed with around 400 from other projects)
  • Short abstract of one or two paragraphs
  • Short bio (with photo)
  • Requested time: from 15 to 45 minutes. Normal duration is 30 minutes. Longer duration requests must be properly justified. You may be assigned LESS time than you request.

How to submit

All submissions are made in the Pentabarf event planning tool: https://penta.fosdem.org/submission/FOSDEM16

When submitting your talk, make sure to select the “Desktops” devroom as the “Track”. Otherwise your talk will not be even considered for any devroom.

If you already have a Pentabarf account from a previous year, even if your talk was not accepted, please reuse it. Create an account if, and only if, you don’t have one from a previous year. If you have any issues with Pentabarf, please contact pgquiles at elpauer dot org.


The deadline for submissions is December 6th 2015. FOSDEM will be held on the weekend of January 30th and 31st 2015 and the Desktops DevRoom will take place on Sunday, January 31st 2015.

We will contact every submitter with a “yes” or “no” before December 18th 2015.

Recording permission

The talks in the Desktops devroom will be audio and video recorded, and possibly streamed live too.

By submitting a proposal you consent to be recorded and agree to license the content of your talk under a Creative Commons (CC-BY) license.

If you want us to stop the recording in the Q & A part (should you have one), please tell us. We can do that but only for the Q & A part.

More information

The official communication channel for the Desktops DevRoom is its mailing list desktops-devroom@lists.fosdem.org.

Use this page to manage your subscription: https://lists.fosdem.org/listinfo/desktops-devroom


The Desktops DevRoom 2016 is managed by a team representing the most notable open desktops:

  • Pau Garcia i Quiles, KDE
  • Christophe Fergeau, Gnome
  • Michael Zanetti, Unity
  • Philippe Caseiro, Enlightenment
  • Jérome Leclanche, Razor

If you want to join the team, please contact pgquiles at elpauer dot org

The Best Tech Talks of the Qt World Summit 2015

Qt World Summit 2015 has already come and gone. Don’t worry if you missed the Summit though, we’ve got all the highlights for you right here! Check out Chris’s V-Play tech talk to find out how to boost your user retention and develop for multiple screen resolutions. You can also check out the list of our favorite tech talks from the world’s biggest Qt conference. Watch all of these presentations in full and for free!

If you just want to get a quick look at what we brought to this year’s World Summit, you can also check out the slides from the presentation below!

The V-Play Tech Talk

Chris gave a talk at Qt World Summit 2015 called “How to Develop with Qt for Multiple Screen Resolutions and Increase & Measure your Cross-Platform App Success (In-Depth Tech Session)“. In this tech talk, he talked about the Do’s and Dont’s of developing for different screen sizes using V-Play. He also shared some user retention techniques that can be achieved using features only available with V-Play.

Using the new V-Play Showcase App as an example, Chris showed how the V-Play team developed one app that recreates the native UI and UX of a Twitter app on all major mobile platforms. He outlined the guidelines the team followed and the advantages of the density independent approach that they took.

You can also get a look at our new test at runtime feature, which allows you to test native appearance and performance by simulating different mobile platforms on desktop.

In the second half of the talk, Chris highlighted the advantages of implementing V-Play features such as the V-Play Game Network, V-Play Level Editor, and V-Play Multiplayer. These features improve the user retention capabilities of your app or game and can be implemented in a few minutes. He also talked about the effective use of Push Notifications to retain users.

Watch the full talk now to find out even more about retaining your users and developing for different resolution devices.

The Best Talks from Qt World Summit 15

You can find all of the tech talks from Qt World Summit 2015 here.  Below are some of our favorite talks from the event. You can hear the experts give tips on using Qt for all kinds of mobile development as well as integrating geo-location features and more.

Introduction to Qt Creator  (Tobias Hunger)
Getting Started with Qt on Android (BogDan Vatra, KDAB)
Mastering Qt on Android (BogDan Vatra, KDAB)
Qt on IOS A to Z (Mike Krus, KDAB)
Qt and Windows 10 (Maurice Kalinowski, The Qt Company)
The 8 Mistakes of QtQuick Newcomers (Luca Ottaviano, Develer)
Behavior Driven GUI Testing of Embedded, Mobile and Desktop Qt HMIs (Reginald Stadlbauer, froglogic)
Are You Testing Enough? Qt Application Quality Assurance (Harri Porten, froglogic)
Developing with Qt Location (Laszlo Agocs, The Qt Company)
Lightning Talk – Qt & Mapbox (Konstantin Käfer, Mapbox)
Effective QML (Thomas McGuire, KDAB)
A Deep Dive into QML Memory Management Internals (Frank Meerkötter, basysKom)

The V-Play Slide-Show

If you’d like a quick look at what V-Play had to offer at the Qt World Summit 2015, you can download our presentation or just check out our SlideShare below:



The post The Best Tech Talks of the Qt World Summit 2015 appeared first on V-Play Game Engine.

Qt Creator 3.6 Beta1 released

We are happy to announce the release of Qt Creator 3.6 Beta1.

Clang Diagnostic WarningClang FixIt integrationIn addition to getting many under the hood improvements and fixes, the Clang based code model now shows more detailed diagnostics in the code editor. We turned on diagnostics for many more warnings, the text is more detailed, and the code editor shows the affected code and its context in different styles. Additionally we integrated the Clang Fix-its into Qt Creator’s refactoring actions. If you haven’t already done so, you can enable the Clang code model plugin via Help > About Plugins (Qt Creator > About Plugins on OS X), and set it active for C++ file types in the C++ options (see also our documentation).

Qt Quick Designer now has an action for switching between a .ui.qml file and the usage in the corresponding .qml file, similar to the Switch Source/Form action in Qt Designer for widgets. We also made the previously commercial-only connection editor and path editor available to all users.

This release also features a bigger contribution: The model editor plugin, which you can use to create UML-style diagrams. Many thanks to Jochen Becher! You can read more about it in our documentation. It is in experimental state, so you need to turn it on in Help > About Plugins (Qt Creator > About Plugins on OS X). After restarting you can begin with creating a new diagram set with New File or Project > Modeling > Model.

Qt Creator 3.6 brings many more enhancements and fixes. Please have a look at our change log for a more detailed overview.

You find the opensource version on the Qt download page, and commercially licensed packages on the Qt Account Portal. Please post issues in our bug tracker. You can also find us on IRC on #qt-creator on irc.freenode.net, and on the Qt Creator mailing list.

Note: Starting with Qt Creator 3.6 we no longer provide prebuilt binaries for Linux 32-bit. Building Qt Creator on that platform is still supported though.

The post Qt Creator 3.6 Beta1 released appeared first on Qt Blog.

Announcement: Marble ships the oldest existent historic Globe

KDE Project:

Today I have the pleasure to announce that Marble is the first popular virtual globe that ships and visualizes the Behaim Globe. The Behaim Globe is the oldest surviving terrestrial globe on earth. It was created between 1492 and 1493 - yes at the same time when Christopher Columbus made his first voyage towards the west and "discovered" America. This fact makes the Behaim Globe very special and also subject to scientific research: It documents European cartography during that era and it's probably the only historic globe which completely lacks the American continent.

These days the Behaim globe can be visited in the Germanisches Nationalmuseum in Nuremberg, Germany. The Germanisches Nationalmuseum (GNM) has kindly granted the Marble project permission to release the photo scan material of the Behaim Globe under the CC BY-SA 3.0 license and they have supported us in bringing it for the first time to the users of a widely deployed virtual globe: Marble. Right now our users can immediately download the Behaim Globe from inside Marble by entering File->Download Maps (or download it via our maps download website.).

Starting with the next Marble release scheduled for December 2015 the Behaim Globe map theme will become a regular part of the map themes that are shipped with the Marble installation package by default.

In addition the Marble project released a special Behaim Marble version in the Google Play Store. So users of Android devices – like smartphones and tablets – can enjoy the Behaim Globe, too! This also marks the first public release of a Marble based application on Android devices.
The Behaim map theme for Marble was created as part of the master thesis (Diplomarbeit) 3D Modelling of the Behaim Globe using Marble by Halimatou Poussami. The map theme allows to pan and zoom the whole Behaim Globe - curiously the whole globe is almost fully covered with detailed inscriptions in early modern German. Via checkboxes in the legend tab inside Marble our users can also overlay today's accurate coastlines. This allows to compare the Behaim cartography with today's known actual coastlines. Quite obviously the Behaim map depicts the continents stretched in longitude. So the creators of the Behaim Globe have probably based their globe on an earth radius value that was too small.

The photographic material of the Behaim Globe is based on digital scans made by the Friedrich Alexander University (FAU) in Erlangen-Nuremberg and the IPF TU Wien. These scans were performed using polarized light. This is also part of the reason for the vibrant colors that you can see in the map theme - visually the colors of the Behaim globe are much more subdued. During the past centuries the Behaim Globe has been subject to several "restoration attempts" and "editing", which also resulted e.g. in text changes. Therefore today's scientific research also focuses on the Behaim globe as a palimpsest. Using Marble's legend tab our users can compare the photomaterial of the Behaim Globe with facsimile drawings from 1853 and 1908 which also reveals differences.

The Marble Team would like to thank the Germanisches Nationalmuseum for its decision to release the Behaim imagery under the CC BY-SA 3.0 license. In particular we'd like to thank Dr. Thomas Eser (GNM), Prof. Dr. Günther Görz (FAU) and Halimatou Poussami for their active support in bringing the Behaim Globe to our Marble users and to the public!

Get it on Google Play

Qt in the Driver’s Seat | TU Automotive Europe 2015

Join the Qt team in Stuttgart from November 2 – 3 for TU-Automotive Europe (formerly Telematics Munich), Europe’s largest conference & exhibition dedicated to the future of auto mobility, where you can meet the entire telematics ecosystem under one roof.

We’re excited to give TU Automotive Europe attendees a closed up look at the recently announced Qt Automotive Suite, which supports common In-Vehicle-Infotainment (IVI) system development needs of automotive OEMs & Tier1’s. Qt Automotive Suite aims to unite & simplify the tools and software components needed to create stunning, highly-performing and quickly adaptable IVI user interfaces devices to enable profitable growth & innovation. Features include, but are not limited to: additional Qt libraries & plugins, Over-The-Air (OTA) updates, GENIVI/AGL Linux Compliance and much more.

We welcome you to stop by with your questions and to learn more about the awesome announcement made at Qt World Summit 2015.

(Watch Now: Qt Automotive Suite Keynote @ #QtWS15)

We look forward to seeing you in Stuttgart!

The post Qt in the Driver’s Seat | TU Automotive Europe 2015 appeared first on Qt Blog.

Qt World Summit 2015 talks on-line

Beginning of October we sponsored, exhibited and talked at the Qt World Summit in Berlin. It was a great event and we are already now looking forward to next year’s event.

The Qt Company now published the videos of all talks. You can view the talks given by us here:

FOSDEM Desktops DevRoom 2016

It is now official: KDE will be present again at FOSDEM in the 2016 edition, on the 30th and 31st of January, 2016.

Talks will take place at the Desktops DevRoom, on Sunday the 31st, but not exclusively: in past years, there were Qt and KDE-related talks at the mobile devroom, lightning talks, distributions, open document editors and more.

KDE will be sharing the room with other desktop environments, as usual: Gnome, Unity, Enlightenment, Razor, etc. Representatives from those communities will be helping me in managing and organizing the devroom: Christophe Fergeau, Michael Zanetti, Philippe Caseiro and Jérome Leclanche.

I would like to extend the invitation to any other free/open source desktop environment and/or related stuff. Check last year’s schedule for an example. Closed-source shops (Microsoft, Apple, Oracle, etc) are ALSO invited, provided that you will talk about something related to open source.

We will publish the Call for Talks for the Desktops DevRoom 2016 soon. Stay tuned.

In the meanwhile, you can subscribe to the Desktops DevRoom mailing list to be informed of important and useful information, and talk about FOSDEM and specific issues of the Desktops DevRoom.

All Qt World Summit 2015 session videos now available

***Update: Slides are currently available exclusively for attendees and later for Qt Account holders. QtWS15 attendees may send their request to qtws@theqtcompany.com***

Two weeks ago we wrapped up the Qt World Summit where we had a variety of sessions covering everything from technology strategy and product life-cycle management to in-depth technical talks on new APIs, best practices and live coding sessions – all presented by Qt contributors and industry experts from around the world.

In case you missed the event itself or just a session while you were there, we have now made video recordings of all the sessions for you to watch on-demand. You can take advantage of the various track collections, recommended playlists that we have pulled together for you, or simply browse the full session listing.


The post All Qt World Summit 2015 session videos now available appeared first on Qt Blog.

Highlights of CppCon 2015

Oh my, how time flies by! One month ago, I had the pleasure to travel to Bellevue, Washington, to attend CppCon 2015. It was a blast, and as a C++ developer, easily the best conference I ever attended. Below, I try to summarize my personal highlights of the talks I attended live. Note however that there were up to six sessions running in parallel, meaning I missed most of the conference. Thankfully, nearly all sessions were recorded in high quality and are already accessible online. So, be sure to not only look at the small selection of my personal highlights below, but also look at the ton of other high-quality talks that I missed!

C++ Core Guidelines

This year’s biggest announcement for the C++ community at large was in my opinion the release of the C++ Core Guidelines. There were two keynotes on that topic, one by Bjarne Stroustrup on Writing Good C++14 and the other one by Herb Sutter on Writing Good C++14… By Default.

These guidelines are aiming at advocating a “smaller, simpler, safer language” subset of C++. Potentially this effort can fix a whole plethora of common bugs found in C++ code. Note however, that the hundreds of rules are not meant to be read like a book cover to cover. But they will be useful for cross-referencing from within code reviews, tools and real books.

One astonishing example of how they can be applied to produce safer code is the Guideline Support Library (GSL). Together with static code analysis tools, currently developed by Microsoft, they give a foundation to prevent stack overflows, resource leaks and more, and that at close to no runtime overhead. If you want to dig deeper, there have been more talks on this topic which I sadly missed to see live:

To me, it is interesting to see how much Microsoft is investing in that area, and I really welcome that they plan to open source their static code analysis tool which will be released in the coming weeks for Visual Studio 2015. See Neil MacIntosh’s talk on Static Analysis and C++: More Than Lint for more information.

I’m also really looking forward to seeing how the guidelines will evolve over time, and hope to be able to try them out soon on non-Windows platforms with Clang and/or GCC. Furthermore, it will be interesting to see how we can apply the rules to Qt.

Other Highlights

The other keynotes of CppCon were also all of very high quality. I’m a big fan of Sean Parent’s previous talks on Better Code. As such, it comes without surprise that his keynote on Better Code: Data Structures was again truly inspirational. Similarly, the elegance of the solution Eric Niebler’s presentation on Ranges for the Standard Library proposes for a specific problem again took me by surprise. Coming up with ideas on how to improve Qt to allow similar code, e.g. by wrapping it within reactive frameworks such as RxCpp, sounds again like an interesting research project for the future.

Then, as a big fan of the Linux perf subsystem and accompanying tools, it was a pleasure for me to listen to Chandler Carruth talking about Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!. This talk, together with Bryce Adelstein-Lelbach on Benchmarking C++ Code, give a very good overview of what to keep in mind when benchmarking C++ code, and how to do it correctly. Oh, and while talking about performance analysis, I also want to point out the very interesting presentation by Scott Wardle on Memory and C++ debugging at Electronic Arts, where he presents their in-house Delta Viewer application that is not only used for debugging, but also for improving the performance of AAA games at EA. I’d love to see some similar UI tool for Qt and perf in the future…

My personal prize for most entertaining talk(s) goes without thinking to Andrei Alexandrescu. His two sessions, one on Declarative Control Flow, the other on std::allocator is to Allocation what std::vector is to Vexation, more resembled a stand up comedy show from the laughs he triggered in the audience. Nonetheless, the content he delivered was once again superb and thought provoking. I can wholeheartedly recommend watching these two talks.

Conceptually related, but not nearly as entertaining, was Howard Hinnant’s presentation of his C++14 approach to dates and times. I deeply respect both persons for their experience and knowledge when it comes to designing good API for complex problems, resulting in easy and fast solutions.

Wrap Up

To close with this summary of my CppCon 2015, I can only repeat that this is but a fraction of what was shown at CppCon 2015. I invite you to look at the schedule and to watch the recordings of every talk that is of interest to you. Similarly, if you haven’t done so already, look at past year’s recordings, which are just as educational! Finally, if you are interested to see my own talk at this year’s CppCon on Modern User Interfaces for C++, go watch it. In hindsight, I’d have liked to go more in-depth: My talk gave an overview about Qt and what you can do with it, and I still think that it was good to have. But during my conversations with various people attending the conference, it became clear that there is also high demand for in-depth sessions on Qt, i.e. similar to what we do every year at Qt Developer Days or Qt World Summit. For that purpose, I did a short 10 minute talk about CppCon at this year’s Qt World Summit, and explicitly asked for more people to hand in Qt related sessions for next year. As such, I’m looking forward to CppCon 2016 – with hopefully more Qt related content!

About KDAB

KDAB is a consulting company dedicated to C++ and offering a wide variety of services and providing training courses in:

KDAB believes that it is critical for our business to invest into C++, Qt and OpenGL in general, to keep pushing these technologies forward and to ensure they remain competitive.

The post Highlights of CppCon 2015 appeared first on KDAB.

How to integrate OpenGL code with Qt Quick 2 applications (part 1)

The Qt World Summit was a rocking blast! More than 800 delegates, two days packed with sessions (and an additional training day presented by KDAB). Many old faces, lots of new ones, and a packed programme of sessions with terrific technical content.

Yours truly also happened to give a talk, “Integrating OpenGL with Qt Quick 2 applications”. In my session I showed different ways of integrating custom OpenGL code within a Qt Quick 2 application. This is a use case for which there’s more and more demand from the industry. Think for instance, of putting some fancy Qt Quick controls (buttons, sliders, etc.) overlaid on top of a 3D scene, rendered using an existing OpenGL-based solution.

My session was very well received by the audience, and for that reason, instead of simply publishing my slides, I have decided to turn my session into a series of blog posts. Here we go!

The Qt Quick 2 renderer

In order to understand how we can hook our OpenGL code into Qt Quick, let’s take a step back and discuss how Qt Quick 2 renders a scene. The renderer subsystem of Qt Quick 2 is in fact quite a complex piece of machinery.

Qt Quick 2 Rendering

Qt Quick 2 leverages OpenGL and a dedicated render thread to render Qt Quick elements.

First and foremost, it leverages OpenGL to render Qt Quick elements. This was a profound design decision, driven by the fact that virtually every user device these days has an OpenGL-capable GPU. Furthermore, OpenGL-based rendering is necessary if one wants to achieve drawing at a stable 60 frames per second, add special effects (drop shadows, particles, blur, etc.), have smooth animations, and so on. Hence, all of your visible elements in a scene are rendered by means of points, lines, triangles and shaders. This decision makes it also possible to easily integrate your custom, existing OpenGL within the Qt Quick renderer.

Second, it was decided that the renderer may use a dedicated render thread, different from the main thread (that is, the thread that runs main()). There are two ideas behind using a separate thread for rendering:

  1. It allows the rendering to proceed (and keep animations going at 60fps) and your UI not to look stuck even if your CPU is somehow busy doing calculations, or your main thread is in some blocking function call, etc.;
  2. Symmetrically, it allows the main thread not to get stuck by the GPU, in case by accident the GPU is being too slow at rendering a scene.

This dedicated thread is used on basically all the platforms supported by Qt 5.6 (excluding only ANGLE on Windows). Even if your platform isn’t supported today, chances are it will be in a future version of Qt, hence you should always take threading into account when integrating custom code with the Qt Quick renderer.

The scene graph and the synchronization round

But how does the renderer actually render a scene? The renderer uses a specialized data structure called a scene graph. The name “scene graph” is actually very common in the topic of 3D rendering; it refers to any data structure that can be used to analyze and optimize certain tasks (not just rendering, but also handling things such as physics simulations, path finding, etc.). I will not go in depth about how the to use the scene graph to build custom Qt Quick elements, as the purpose of this blog series is how to integrate your existing OpenGL code, so I will just show the bits relevant to this discussion.

In Qt Quick’s world, the scene graph is used for rendering purposes only; and it contains all the visual information that is used to draw a scene. Keep this in mind — all the non-visual information is lost in the process. For instance, in order to draw a rectangular button, the scene graph does not know that it reacts to clicks in some way: all that it knows is that in order to draw that button, one needs first to draw a quadrilateral (actually two triangles) with certain per-vertex colors to simulate a background gradient, and draw on top a smaller quadrilateral with a texture (i.e. an image) that represents button’s text.

The Qt Quick scene graph is implemented as a tree of nodes. Each node type (subclass of QSGNode, where SG stands indeed for scene graph) implements a piece of functionality, such as altering the transformation for the children, or the opacity, or holding a piece of geometry (some vertex buffers), shaders and textures for something that needs to be drawn. You can see some of the Qt Quick scene graph classes in this diagram:


The scene graph is built by iterating over the QML elements. Each Qt Quick visual element type (like Rectangle, Image, Text…) builds a small tree of nodes in its override of the QQuickItem::updatePaintNode function, and returns them to the renderer. The renderer can then take these trees, analyze them and decide what’s the best strategy to paint them.

“Wait a second”, the careful reader should be saying right now. How does the render thread exactly build the scene graph data structure from the QML elements, which live in the main thread? Of course, with multiple threads comes the problem of synchronization. The render thread can’t just walk over the item tree if the main thread is also modifying the elements at the same time.

While one might think of starting to add locks all around but this quickly gets expensive. The solution chosen by Qt Quick is more drastic and removes the problems of handling locking explicitly. The render thread and the main thread will synchronize by pausing the main thread and therefore allowing the render thread to safely call the QQuickItem::updatePaintNode function on all the visual elements in the scene. (So, yes, updatePaintNode gets actually called from another thread). Once the render thread has done this, the main thread gets unlocked and it is free to go again. The render thread has now gathered all the information it needs to draw the scene on screen, and it will proceed to analyze the scene graph and render it.

Sometimes pictures speak louder than words; this is the small dance of the main thread and the render thread synchronizing (picture taken from the Qt documentation): sg-renderloop-threaded This is what happens every time a new frame gets requested, for instance, because a visual item in the scene has been marked as dirty (because some property changed) or because the QQuickWindow::update function gets called.

This picture actually reveals something else: that during the synchronization round, the render thread will emit signals. Our first way of integrating OpenGL with Qt Quick 2 uses those signals. We can connect slots to these signals, and call OpenGL functions from those slots, therefore mixing custom OpenGL code within Qt Quick 2’s rendering, which is exactly what we wanted to do!

What now?

Now that we know how the Qt Quick 2 renderer works, in the subsequent posts we are going to investigate three different ways of integrating OpenGL within a Qt Quick 2 application:

  1. OpenGL underlays and overlays
  2. Custom OpenGL-based elements
  3. Manually controlling the Qt Quick rendering

Stay tuned for the next blog post!

About KDAB

KDAB is a consulting company dedicated to Qt and offering a wide variety of services and providing training courses in:

KDAB believes that it is critical for our business to invest into Qt3D and Qt, in general, to keep pushing the technology forward and to ensure it remains competitive.

The post How to integrate OpenGL code with Qt Quick 2 applications (part 1) appeared first on KDAB.

What’s New in KD Reports 1.7?

The latest release of KD Reports further enhances your ability to get printable and exportable reports from code and XML descriptions.

For those who like using CMake instead of qmake, you’ll be glad to know KD Reports now comes with a fully functioning CMake buildsystem (see INSTALL-cmake.txt).

In addition, we have added Frame element and Report::setDocumentName(), to be able to set a name for your print job, and AutoTableElement::NonBreakableLinesRole to forbid word-wrapping in individual table cells.

In the Preview dialog, you will now find a “Save…” button, which brings up a file dialog for saving as PDF. We have also added setDefaultSaveDirectory() to set the initial directory for that file dialog and setDirectoryBrowsingEnabled() to allow or forbid choosing the save directory.

Also in the Preview dialog we have added setQuickPrinterName(QString), which shows a new button saying
“Print with [printerName]” for quick printing without the print dialog.

In Spreadsheet mode we have added a number of new features, listed below.

  • support for cells spanning multiple rows or columns.
  • honour the settings for border size, border color and header background brush.
  • support for multiline text (with explicit ‘\n’)
  • support for fixed row heights (see example Labels).


The post What’s New in KD Reports 1.7? appeared first on KDAB.

V-Play 2.6.1 Release: Change Native UI At Runtime & V-Play Demos in Qt Creator

The latest V-Play release 2.6.1 adds two new features:

Simulate Native Look & Feel of Different Mobile Platforms at Runtime

In the latest release, you can simulate the native look & feel of mobile platforms at runtime from your PC. This means you don’t need to deploy your apps to mobile devices to test the appearance of UI and UX!

You can do this by changing the Theme.platform string to the platform you want to test. You can simulate iOS, Android or any of the other compatible V-Play mobile and desktop platforms.

The really cool thing is that not only is the UI changed to native settings, but the user navigation gets simulated as well. So on Android for example, you have a navigation drawer and on iOS; a tab bar is most common.

The Navigation element abstracts this from the developer. So all you need is this code to get a native navigation UX in your mobile app:

import QtQuick 2.0
import VPlayApps 1.0

App {

  Navigation {

    NavigationItem {
      title: "Simple List"
      icon: IconType.list

      MyNavigationStackSplitView {}

    }// NavigationItem

    NavigationItem {
      id: otherNavItem
      title: "Other"
      icon: IconType.calculator

      // adds a top NavigationBar
      NavigationStack {

        Page {
          title: otherNavItem.title
          AppText {
            text: "Other Page"

      }// NavigationStack
    }// NavigationItem
  }// Navigation

}// App

You can test changing the native style yourself in the V-Play Showcase App. Open it from the V-Play Sample Launcher in the latest release and see how your mobile app looks and feels across multiple platforms:


V-Play Examples & Demos in Qt Creator

To make it even easier to explore and learn from the 15+ V-Play sample games, you can now start your own project based on one of the samples right from within Qt Creator: Simply click on the Welcome tab on the left and then select Examples.

You’ll then see all the V-Play samples in one place, where you can view, copy and modify their full source code. Plus, the Help window with further explanations and tutorials about the sample is shown.


How does this compare to the V-Play Sample Launcher? We recommend the ideal usage like this:

  • V-Play Sample Launcher: Allows you to quickly run all the available sample games and component examples from one application. Great for getting an overview of the V-Play features and samples.
  • Qt Creator Example Integration: Once you know which sample(s) is most useful for your project, select them in the welcome screen and start coding from here.

Update Instructions

Test out these new features by following these steps:
Step 1

Open the V-Play SDK Maintenance Tool in your V-Play SDK directory. Choose “Update components” and finish the update process to get V-Play 2.6.1 as described in the update guide.

If you haven’t installed V-Play yet, you can do so now with the latest installer from here.

Step 2

The V-Play Sample Launcher allows you to quickly test and run all the open-source examples and demo games that come with the V-Play SDK, from a single desktop application.

After installing the V-Play SDK, you can start the V-Play Sample Launcher from /Examples/V-Play/sampleLauncher.

Now just select one of the new demos, and you can explore & copy the source code right from the Sample Launcher!

The post V-Play 2.6.1 Release: Change Native UI At Runtime & V-Play Demos in Qt Creator appeared first on V-Play Game Engine.

Lighting Up the Internet of Things

By Jeff LeBlanc

At the expense of some minor spoilers for a seven-year-old movie, the post-credit cut scene in Iron Man (2008) showed Tony Stark walking into his dark home and calling for his virtual butler J.A.R.V.I.S. to turn on the lights. Fast-forwarding to 2015, we can now do that, more or less, courtesy of the Internet of Things (IoT).

Qt 5.5.1 Released

Today we have released Qt 5.5.1, the first update to Qt 5.5. In addition to improvements and fixes to Qt functionality, it also packs in new Qt Creator 3.5.1.

Qt 5.5.0 released in July introduced many new features and refinements to existing functionality, and the Qt 5.5.1 patch release provides close to 1.000 improvements and fixes on top of it. One of the key drivers for Qt 5.5 has been quality and maturity and we have continued to address items reported by the Qt users with Qt 5.5.1. I am really happy about all the feedback and especially all the contributions we have received.

Qt WebEngine in Qt 5.5.1 includes a couple of security fixes for known vulnerabilities. The list of important changes in Qt 5.5.1 can be found from the change logs. Note that only the most important items are listed in the change logs, for full list of changes it is best to check the git logs.

The Qt 5.5.1 packages also include new Qt Creator 3.5.1. See Qt Creator 3.5.1 change log for the main improvements.

The Qt for Device Creation embedded Linux stack has been updated to use Qt 5.5.1. Support for a new reference device: Kontron SMARC-sAMX6i has also been added. Furthermore, Qt Virtual Keyboard version 1.3.1 is also released today, as well as a technology preview of Qt Virtual Keyboard 2.0.

If you are using the online installer, Qt 5.5.1 and Creator 3.5.1 can be updated using the maintenance tool. Offline packages are available for commercial users in the Qt Account portal and at qt.io/download for open-source and commercial evaluation users.

The post Qt 5.5.1 Released appeared first on Qt Blog.

Qt Creator 3.5.1 released

We are happy to announce the release of Qt Creator 3.5.1. We fixed many bugs in this release and also updated our binary packages to Qt 5.5.1. Please have a look at our change log for more details.

You find the opensource version on the Qt download page, and commercially licensed packages on the Qt Account Portal. Please post issues in our bug tracker. You can also find us on IRC on #qt-creator on irc.freenode.net, and on the Qt Creator mailing list.

The post Qt Creator 3.5.1 released appeared first on Qt Blog.

Watch the replay of Qt World Summit 2015 Keynotes right now!

If you missed last week’s Qt World Summit 2015 inspirational keynotes, fear not.

This is your chance to get a look into what you may have missed at the global event for all things Qt. Whether you are a technology director, business decision maker, tech strategist, product manager, engineer or developer there is something here for you to watch. You certainly don’t want to miss the thought-provoking talk of Kenneth Cukier from The Economist.


We have also recorded all the other sessions for you and will be publishing them as soon as they are ready!

Let us know if you have any questions; I’ll be in touch soon!

The post Watch the replay of Qt World Summit 2015 Keynotes right now! appeared first on Qt Blog.