Indie Mobile Available Until Aug 31st

There are many of you who have expressed disappointment with our decision to discontinue the Indie Mobile commercial license subscription product – we are disappointed with this decision as well. Our disappointment comes from the fact that we expected and believed from previous feedback that there in fact would be potential for this kind of product, as there has been tens if not hundreds of people who have expressed interest in that in different forums. Unfortunately, that potential has not materialized in real life, the adoption rate has been extremely low, and we were forced to discontinue that product as it requires resources that we are not able to justify by commercial terms. We did not expect this to be a gold mine for us, rather a product that would fill a demand gap in our offering, with a very affordable pricing. In the end, we must say that we did not see any real demand for this – having just some tens of subscribers is a testament to this. Our mistake was not to announce the retirement of that offering earlier, and we do apologize for that.

We do honor our current subscribers, and we would like to now offer, for a limited time, those who have been considering the Indie Mobile package the opportunity to still subscribe to it with the same price of $25/month. We will offer this until August 31. Please use the following link to take advantage of the offer: We will continue to honor all subscribers of Indie Mobile after August 31st, however, after that date we will no longer make new sales of the package and we will proceed with discontinuing it.

We are constantly looking for new business models and opportunities to serve our customers and community better. The discontinuation of Indie Mobile will enable us to invest in new things, and we still believe that there should be opportunities for other products like Indie Mobile. Our new Qt for Application Development offering provides all desktop and mobile platforms and the subscription price is actually a lot cheaper than it was previously ($350 vs. $399). The latest Vision Mobile CPT report names Qt #4 with 18% mindshare as a cross-platform mobile development tool. Vision Mobile, at least, believes Qt will catch up to the Top 3 in no time. So, if you would still like to develop with Qt for mobile app development, you can, of course, use our Open Source offering.

Thanks again for your feedback and we do apologize for not being transparent earlier with our plans for the Indie Mobile package. We hope that those that were planning to develop a commercial mobile  app with Qt, take advantage of Indie Mobile before August 31st.

The post Indie Mobile Available Until Aug 31st appeared first on Qt Blog.

New in Qt 5.5: Q_ENUM and the C++ tricks behind it

Qt 5.5 was just released and with it comes a new Q_ENUM macro, a better alternative to the now deprecated Q_ENUMS (with S).

In this blog post, I will discuss this new Qt 5.5 feature; What it does, and how I implemented it. If you are not interested by the implementation details, skip to the conclusion to see what you can do in Qt 5.5 with Q_ENUM.

The problem

In order to better understand the problem it solves, let us look at this typical sample code using Q_ENUMS as it already could have been written with Qt 4.0.

class FooBar : public QObject {
  enum Action { Open, Save, New, Copy, Cut, Paste, Undo, Redo, Delete };

  void myFunction(Action a) {
    qDebug() << "Action is: " << a;

But here, the qDebug will look like this:
Action is: 8
It would be much better if I could see the text instead such as:
Action is: Delete

Q_ENUMS tells moc to register the names of the enum value inside its QMetaObject so that it can be used from Qt Designer, from QtScript or from QML. However it is not working yet with qDebug.

One could use the information in the QMetaObject while overloading the operator<< for QDebug and use QMetaObject's API:

QDebug operator<<(QDebug dbg, FooBar::Action action)
  static int enumIdx = FooBar::staticMetaObject.indexOfEnumerator("Action");
  return dbg << FooBar::staticMetaObject.enumerator(enumIdx).valueToKey(action);

That has been working fine since Qt 4.0, but you have to manually write this operator and it is a lot of code that is somehow error prone. Most of Qt's own enumerations did not even have such operator.

The Solution

I wanted this to be automatic. The problem is that we had no way to get the QMetaObject of the enclosed QObject (or Q_GADGET) associated with a given enumeration. We also need the name of the enumeration to be passed as an argument to QMetaObject::indexOfEnumerator.
Let us suppose we have some magic functions that would do exactly that. (We will see later how to make them):

QMetaObject *qt_getEnumMetaObject(ENUM);
const char *qt_getEnumName(ENUM);

We could then do:

template <typename T>
QDebug operator<<(QDebug dbg, T enumValue)
    const QMetaObject *mo = qt_getEnumMetaObject(enumValue);
    int enumIdx = mo->indexOfEnumerator(qt_getEnumName(enumValue));
    return dbg << mo->enumerator(enumIdx).valueToKey(enumValue);

Argument dependent lookup (ADL) will find the right overload for qt_getEnumMetaObject and qt_getEnumName, and this function will work. The problem is that this template will match any type, even the ones that are not enumerations or that are not registered with Q_ENUM for which qt_getEnumMetaObject(enum) would not compile. We have to use SFINAE (substitution failure is not an error) to enable this operator only if qt_getEnumMetaObject(enum) compiles:

template <typename T>
typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value , QDebug>::Type
operator<<(QDebug dbg, T enumValue)
    const QMetaObject *mo = qt_getEnumMetaObject(enumValue);
    int enumIdx = mo->indexOfEnumerator(qt_getEnumName(enumValue));
    return dbg << mo->enumerator(enumIdx).valueToKey(enumValue);

QEnableIf is the same as std::enable_if and IsQEnumHelper is implemented this way:

namespace QtPrivate {
template<typename T> char qt_getEnumMetaObject(const T&);

template<typename T>
struct IsQEnumHelper {
  static const T &declval();
  // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject()
  // declared in the Q_ENUM macro will be chosen by ADL, and the return type
  // will be QMetaObject*.
  // Otherwise the chosen overload will be the catch all template function
  // qt_getEnumMetaObject(T) which returns 'char'
  enum {
    Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*)

So now it all boils down to how to implement the Q_ENUM macro to declare this qt_getEnumMetaObject.
We need to implement the function qt_getEnumMetaObject in the same namespace as the class. Yet, the macro is used within the class. How can we implement the function in the class? Perhaps using some static function or some template magic? No! We are going to use a friend function. Indeed, it is possible to define a function in a friend declaration. As an illustration:

namespace ABC {
  class FooBar {
    friend int foo() { return 456; }

foo is in the namespace ABC (or the global namespace if FooBar was not in a namespace). But the interesting fact is that in the body of that function, the lookup is done within the class's scope:

class FooBar {
  friend const QMetaObject *getFooBarMetaObject() { return &staticMetaObject; }

  static const QMetaObject staticMetaObject;

This uses the staticMetaObject of the class (as declared in the Q_OBJECT macro). The function can just be called by getFooBarMetaObject(); (without the FooBar:: that would be required if it was a static function instead of a friend).
With that we can now construct the Q_ENUM macro:

#define Q_ENUM(ENUM) \
    friend constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
    friend constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }

Each instance of this macro will create a new overload of the functions for the given enum type. However, this needs the ENUM type to be declared when we declare the function. Therefore we need to put the Q_ENUM macro after the enum declaration. This also permits only one enum per macro while Q_ENUMS could have several.

(moc will still interpret the Q_ENUM macro like the old Q_ENUMS macro and generate the same data.)

Using this, I also introduced a new static function QMetaEnum::fromType<T>() which let you easily get a QMetaEnum for a given type. This is how it is implemented:

template<typename T>
QMetaEnum QMetaEnum::fromType()
  const QMetaObject *metaObject = qt_getEnumMetaObject(T());
  const char *name = qt_getEnumName(T());
  return metaObject->enumerator(metaObject->indexOfEnumerator(name));

We can also integrate it with QMetaType to register this type automatically and register the correspding meta object to the metatype system. From that, we can use this information in QVariant to convert from a string or to a string.

(Note: The code snippets shown were slightly simplified for the purpose of the blog. Check the real implementation of the debug operator<<, or QMetaEnum::fromType, or QTest::toString.


Q_ENUM is like the old Q_ENUMS but with those differences:

  • It needs to be placed after the enum in the source code.
  • Only one enum can be put in the macro.
  • It enables QMetaEnum::fromType<T>().
  • These enums are automatically declared as a QMetaTypes (no need to add them in Q_DECLARE_METATYPE anymore).
  • enums passed to qDebug will print the name of the value rather than the number.
  • When put in a QVariant, toString gives the value name.
  • The value name is printed by QCOMPARE (from Qt 5.6).

You can read more articles about Qt internals on our blog.

Qt3D Technology Preview Released with Qt 5.5.0

KDAB is pleased to announce that the Qt 5.5.0 release includes a Technology Preview of the Qt3D module. Qt3D provides a high-level framework to allow developers to easily add 3D content to Qt applications using either QML or C++ APIs. The Qt3D module is released with the Technology Preview status. This means that Qt3D will continue to see improvements across the API design, supported features and performance before release. It is provided to start collecting feedback from users and to give a taste of what is coming with Qt3D in the future. Please grab a copy of the Qt 5.5.0 release and give Qt3D a test drive and report bugs and feature requests.

Qt3D provides a lot of functionality needed for modern 3D rendering backed by the performance of OpenGL across the platforms supported by Qt with the exception of iOS. There is work under way to support Qt3D on iOS and we expect this to be available very shortly. Qt3D allows developers to not only show 3D content easily but also to totally customise the appearance of objects by using the built-in materials or by providing custom GLSL shaders. Moreover, Qt3D allows control over how the scene is rendered in a data-driven manner. This allows rapid prototyping of new or custom rendering algorithms. Integration of Qt3D and Qt Quick 2 content is enabled by the Scene3D Qt Quick item. Features currently supported by the Qt3D Technology Preview are:

  • A flexible and extensible Entity Component System with a highly threaded and scalable architecture
  • Loading of custom geometry (using built in OBJ parser or assimp if available)
  • Comprehensive material, effect, render pass system to customise appearance
  • Data-driven renderer configuration – change how your scene is rendered without touching C++
  • Support for many rendering techniques – forward, deferred, early z-fill, shadow mapping etc.
  • Support for all GLSL shader stages (excluding compute at present)
  • Good support for textures and render targets including high-dynamic range
  • Support for uniform buffer objects where available
  • Out of the box support for simple geometric primitives and materials
  • Keyboard input and simple camera mouse control
  • Integration with Qt Quick 2 user interfaces

Beyond rendering, Qt3D also provides a framework for adding additional functionality in the future for areas such as:

  • Physics simulation
  • Skeletal and morph target animation
  • 3D positional audio
  • Stereoscopic rendering
  • Artificial intelligence
  • Advanced input mechanisms

To learn more about the architecture and features of Qt3D, please read KDAB’s series of blogs and the Qt3D documentation.

KDAB and The Qt Company will continue to improve Qt3D over the coming months to improve support for more platforms, input handling and picking, import of additional 3D formats, instanced rendering, more materials and better integration points to the rest of Qt. If you wish to contribute either with code, examples, documentation or time then please contact us on the #qt-3d channel on freenode IRC or via the mailing lists.

The post Qt3D Technology Preview Released with Qt 5.5.0 appeared first on KDAB.

Make Qt 3D Games with Qt 5.5 and New V-Play Release 2.5.0

The new Qt release 5.5.0 adds a long desired feature: 3D support for Qt. The new Qt3D module allows 3D content within Qt applications. This is great news for all game developers, because 3D games are now possible with Qt and V-Play!


Qt3D Use Cases

Why is 3D support such a big deal?

V-Play and Qt have always been 2D specialized and optimized frameworks. Although popular 3D applications were created with Qt like Autodesk Maya and Daze3D (using QGLWidget), this required to work with C++ and OpenGL. In comparison, you can develop much faster with QML (aka Qt Quick) while keeping native performance. The new Qt3D additions enable you to use QML and dedicated 3D QML components to avoid low-level OpenGL development, with the same performance benefits.

This allows you to mix both 2D and 3D elements in your game or app, which is especially useful when you want to:

  • Define the User Interface in QML and 2D, and load the game objects in 3D.
  • Load 3D models and freely move and rotate them in your Qt app, which saves space compared to using sprite sheets.

To showcase some of these concepts, we made a tech demo of what’s possible with Qt3D. Our experience from creating the demo is:

Mixing 3D content with 2D elements has never been easier & faster in any programming language!

How V-Play Adds 3D Game Support to Qt

When creating the tech demo, we had the following goals:

  • Mix 3D Content of the Qt3D Tech Preview with 2D UI
  • Re-use the same entity-based game logic of a 2D V-Play game with 3D models
  • As Proof of Concept: A Minimap that is rendered with 2D images on top of 3D world
  • Use these Qt3D features: 3D Models, Transforms, Skybox, Follow Camera
  • Box2D physics-based movement

It’s really amazing how little code we needed to change an existing 2D-based game and transform it into a 3D world. All you need to do is replace the 2D images and sprite animations with 3D models and add a camera. In the tech demo, we even left the 2D visuals in the game to show that mixing 2D and 3D is possible as well – you can see the 2D rendering on the minimap. You could of course also create a top-down minimap in 3D by adding another viewport, but for the tech demo the 2D mixing approach was a perfect proof of concept.


We have added 3D components to the new V-Play release 2.5.0 which makes working with Qt3D easier and simplify game creation.

For example the Car entity looks like this:

import VPlay 2.0
import QtQuick 2.0

EntityBase {

  // this Box2D physics component modifies the entity position by applying forces
  // when the entity position changes, the Render and Image components change too
  BoxCollider {

  // new V-Play component that allows loading a Mesh and a texture
  Render3D {
    source: "assets/3d/car_model.obj"
    texture: "assets/3d/car_texture.png"

  // like this it was in the 2D version, a top-down image of the car
  // mixing of 2D components with 3D components is easily possible
  Image {
    source: "assets/2d/car.png"

You can also have a look at the full source code of the Car Challenge 3D game here.

Play the Qt 3D Game Car Challenge 3D

The following options are available to you to test the game and experiment with the tech demo:

Download Car Challenge 3D from Google Play Store


Download Car Challenge 3D for Desktop

Car Challenge 3D is available for Windows & Mac as part of the V-Play Sample Launcher. You can either download the standalone desktop application here, or download the V-Play SDK which allows you to develop with Qt 3D and V-Play for free.

On Linux, you can run Car Challenge 3D from <V-PlaySDK/Examples/V-Play/demos/CarChallenge3D after downloading the V-Play SDK.

Note: In order to improve the Qt3D state, it helps if you share your experiences (or possible crashes on your device and operating system). You can share your feedback here.

Get the Full Car Challenge 3D Source Code for Free

To develop with the brand-new V-Play 3D components and Qt3D, download the V-Play SDK.

Download V-Play SDK & Car Challenge 3D

If you have an existing Qt 5 installation, you can also add V-Play on top of the new Qt 5.5 release as described here.

If you already have V-Play installed, add update to the latest release 2.5.0 as described in the Update Guide and make sure to use a Qt 5.5 compiler. Alternatively, you can downlad and install the new V-Play 2.5.0 Offline Installer and remove your current installation afterwards.

Start 3D Development

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. This also includes the new Car Challenge 3D Tech Demo!

After installing the V-Play SDK, you can start it from <V-PlaySDK/Examples/V-Play/sampleLauncher.

Now just choose Car Challenge 3D and you can explore & copy the source code right from within the Sample Launcher, and then continue development with Qt Creator.

What’s the Roadmap of Qt 3D and V-Play 3D?

Qt3D is in a Tech Preview state now supported on Android, Windows, Mac and Linux, with the goal to gather feedback about its API, stability and performance. iOS support and API finalisation will follow with the next Qt releases in the coming months, based on your feedback. However, Qt3D and V-Play 3D is already now in a good shape and you can use it in your published games and apps already.

We will continue to provide more 3D components and examples to show you how to use shadow mapping, multiple viewports and anaglyph rendering in games and apps.


PS: Kudos to KDAB who have contributed massive parts of the Qt3D module and have done a great job in designing the 3D Qt APIs. You can find a great article series about Qt3D concepts on the KDAB Blog here.

PPS: For more details on the Qt 5.5.0 Release and our Qt3D launch partnership with The Qt Company visit the awesome Qt Developer Blog.


Join us on this exciting new journey and share the good news below. :)

The post Make Qt 3D Games with Qt 5.5 and New V-Play Release 2.5.0 appeared first on V-Play Game Engine.

Qt 5.5 Released

It is my pleasure to announce that Qt 5.5 has been released today. Over the last 6 months, we’ve been working hard to create a great release for you.

As a result, close to 1500 reported bugs have been fixed during this period, and we’ve implemented numerous performance improvements throughout the whole stack. We’ve filled a couple of holes in our cross platform offering, bringing better feature parity between the platforms in areas such as Multimedia and Bluetooth.

We have invested lots of efforts to make sure Qt 5.5 is ready for Windows 10 once it gets officially released by Microsoft. That Qt is running on top of the new WinRT APIs on Windows 8 already since Qt 5.3 gave us a great basis for those efforts. With this we are confident that we can fully support Windows 10 as soon as it is being made available with a Qt 5.5.x patch release.

Linux packages are now being built on RedHat Enterprise Linux, allowing to cover a wider range of Linux distributions (from RHEL 6.6 up to Ubuntu 15.04) with one set of binaries.

A lot of work has been put into the version for Mac OS X, where we now use Apple’s Secure Transport layer to enable SSL functionality, support Bluetooth and Bluetooth LE, support Qt WebView and fixed many issues with Qt Multimedia.

Simplified Product Offering

Another change coming with Qt 5.5, is a greatly simplified product structure. There are now three versions of Qt available.

Qt for Application Development is our commercial offering that allows you to create applications for all desktop and mobile platforms that Qt supports. It comes with full support and our flexible commercial licensing.

Qt for Device Creation is the second commercial product. It targets the creation of embedded devices, and comes with a lot of tooling and support to make this as easy as possible. Of course with full support and our flexible commercial licensing as well.

And finally, we have Qt Open Source, our open source version that you can use under the terms of the LGPL (version 2.1 and/or version 3) or GPL.

For more details about this new product offering have a look at our new product pages on .

New Functionality

As always, Qt 5.5 comes bundled together with the latest version of Qt Creator and a large amount of new functionality. Let me highlight some of them in this blog.


The Bluetooth LE API that got introduced as a Technology Preview with Qt 5.4, is now final and supported on Android, Mac OS X and iOS in addition to the existing backends on Linux.


With Qt’s root being a graphical toolkit, we have always had a strong focus on graphics. A good integration with OpenGL has been available since Qt 2 times. This integration has mainly focused on low level enablers and classes.

With Qt 5.5, we now take a large step forward, adding two new modules that greatly extend our set of 3D APIs:

Qt Canvas 3D is a new module that makes it very easy to directly use WebGL code from within Qt Quick. The module existed as a Technology Preview in Qt 5.4. We’ve taken the time since then to mature it, and I’m happy to now have it as a fully supported module inside the Qt frameworks. Qt Canvas 3D implements a WebGL-like API for Qt Quick, and can be used both with low level WebGL code or in conjunction with JavaScript frameworks such as three.js, making the handling of 3D content inside Qt Quick trivial.

The other new module is Qt 3D, available as a Technology Preview for Qt 5.5. Qt 3D existed as a library during Qt 4 times, but has now undergone some major rework to make it fit to the world of modern OpenGL.

Qt 3D takes our OpenGL support a large step forward making it much easier to integrate 3D content into Qt applications. The module comes with both C++ and QML APIs. For more details what Qt 3D 2.0 brings, you can check the Qt 3D documentation and the KDAB guest blog post. Being a Technology Preview, the module still has some rough edges. However, check out the Qt 3D game demo that V-Play managed to create already with the tech preview. Please let us know what you think, so that we can turn Qt 3D into a fully supported part of Qt with Qt 5.6.

Using OpenGL on Windows has always been somewhat problematic as good drivers are not available in all installations by default. Qt 5.5 helps solve this problem by switching dynamically between using the OpenGL driver or the ANGLE emulation layer implementing OpenGL on top of DirectX.

Qt Location

Another new module that now found it’s way to Qt 5.5 as a Technology Preview is Qt Location. Qt Location adds mapping, geocoding, routes and places support to Qt. In conjunction with the existing Qt Positioning API, it should give you all you need to create location aware applications. Qt Location can make use of different mapping providers. We currently support Nokia Here, Mapbox and Openstreetmap. Check out the examples in documentation.

Qt Quick

A lot of work has gone into improving Qt Quick. The QML and JavaScript engine now supports JavaScript typed arrays. In Qt Core, we added support for properties and invokable methods to Q_GADGETs, making it much easier to expose your own value based classes in QML. Qt Quick has gotten improvements to make Flickable and PinchArea work better on Mac OS X and iOS.

The Enterprise Controls have been folded into Qt Quick Controls and are now also available in the open source version. A TreeView control has been added to complete the set of controls required for creating desktop applications.

Qt Multimedia

A lot of work has also gone into Qt Multimedia. On Linux, we have now added gstreamer 1.0 support and lots of bugs have been fixed for the other platforms. Camera support has been greatly improved. The new Video filtering framework is a great new feature that allows the integration of frameworks, such as OpenCL or CUDA with VideoOutput elements.

Watch how Qt Multimedia with real-time video/camera integrates with the computer vision library (OpenCV) to create a real-time pattern recognition application that identifies speed signs on this short road trip. Further functionality could be added to this demo by, for example, displaying a warning if the vehicle’s speed exceeds the last recognized sign.

Qt WebEngine

Qt WebEngine has been updated to Chromium version 40 and has received new APIs for managing downloading of files, controlling cache and cookies, as well as settings. Support for Qt WebChannel is now built-in and many experimental APIs are now public and fully supported.

Other Improvements

Of course, there are a lot of other improvements and new features in Qt 5.5. Please have a look at the wiki for all the details.

Deprecated Modules

With all these new features coming, some older ones are being deprecated, namely Qt WebKit, Qt Quick 1 and Qt Script. All of these modules are still available with Qt 5.5, but we strongly recommend using their replacements for any new functionality: Qt WebEngine, Qt Quick, and Qt QML, which also provides a fully compliant JavaScript engine. For most uses cases, the new replacement modules should be more suitable and provide better functionality than the replaced ones.

Learn More about Qt 5.5

To ease you into Qt 5.5, we have scheduled 2 LIVE webinars (July 2nd & July 3rd) so you can hear first hand what is new in Qt 5.5. Please make sure to register here:

Learn Even More at Qt World Summit 2015

Registration for the Qt World Summit 2015 (Oct 5-7, Berlin) is open. This is the main global Qt event where Qt experts from The Qt Company and the community will deliver 50+ technical and strategic sessions. Qt World Summit will give you the knowledge you need to kick start your Qt development project as well as provide you with the insight and tips and tricks necessary to make sure your Qt product is successful. Make sure to register today and take advantage of the Early Bird pricing (SAVE EUR 70) ending July 13th and/or learn about group discounts:


I’d like to take the opportunity to thank everybody who helped develop and create Qt 5.5. The release wouldn’t have been possible without the hard work of many people in the community and from The Qt Company. A special thanks goes to KDAB, who invested lots of time and efforts to make the Qt 3D Technology Preview ready for Qt 5.5.

Now go and get Qt 5.5 from your Qt Account portal or from Enjoy!

The post Qt 5.5 Released appeared first on Qt Blog.

Qt Creator 3.4.2 released

We are happy to announce the release of Qt Creator 3.4.2.

The main change in 3.4.2 is that our binaries are now based on the new Qt 5.5 release, benefitting from its support of a wider range of Linux distributions, and its other improvements. We also fixed recognition of the MSVC 2015 tool chain and a crash in the Valgrind analyzer.

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

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

Qt3D 2.0 Technology Preview

This blog post is written by a guest blogger, the maintainer of Qt3D module and the Managing Director KDAB UK Ltd, Dr Sean Harmer.

KDAB is pleased to announce that the Qt 5.5.0 release includes a Technology Preview of the Qt3D module. Qt3D provides a high-level framework to allow developers to easily add 3D content to Qt applications using either QML or C++ APIs. The Qt3D module is released with the Technology Preview status. This means that Qt3D will continue to see improvements across the API design, supported features and performance before release. It is provided to start collecting feedback from users and to give a taste of what is coming with Qt3D in the future. Please grab a copy of the Qt 5.5.0 release and give Qt3D a test drive and report bugs and feature requests.

Qt3D provides a lot of functionality needed for modern 3D rendering backed by the performance of OpenGL across the platforms supported by Qt with the exception of iOS. There is work under way to support Qt3D on iOS and we expect this to be available very shortly. Qt3D allows developers to not only show 3D content easily but also to totally customise the appearance of objects by using the built in materials or by providing custom GLSL shaders. Moreover, Qt3D allows control over how the scene is rendered in a data-driven manner. This allows rapid prototyping of new or custom rendering algorithms. Integration of Qt3D and Qt Quick 2 content is enabled by the Scene3D Qt Quick item. Features currently supported by the Qt3D Technology Preview are:

  • A flexible and extensible Entity Component System with a highly threaded and scalable architecture
  • Loading of custom geometry (using built in OBJ parser or assimp if available)
  • Comprehensive material, effect, render pass system to customise appearance
  • Data-driven renderer configuration – change how your scene is rendered without touching C++
  • Support for many rendering techniques – forward, deferred, early z-fill, shadow mapping etc.
  • Support for all GLSL shader stages (excluding compute at present)
  • Good support for textures and render targets including high-dynamic range
  • Support for uniform buffer objects where available
  • Out of the box support for simple geometric primitives and materials
  • Keyboard input and simple camera mouse control
  • Integration with Qt Quick 2 user interfaces

Beyond rendering, Qt3D also provides a framework for adding additional functionality in the future for areas such as:

  • Physics simulation
  • Skeletal and morph target animation
  • 3D positional audio
  • Stereoscopic rendering
  • Artificial intelligence
  • Advanced input mechanisms

To learn more about the architecture and features of Qt3D, please read KDAB’s series of blogs and the Qt3D documentation.

KDAB and The Qt Company will continue to improve Qt3D over the coming months to improve support for more platforms, input handling and picking, import of additional 3D formats, instanced rendering, more materials and better integration points to the rest of Qt. If you wish to contribute either with code, examples, documentation or time then please contact us on the #qt-3d channel on freenode IRC or via the mailing lists.

The post Qt3D 2.0 Technology Preview appeared first on Qt Blog.

Qt Japan Summit 2015 | Build Your World

Last month’s Qt Japan Summit 2015 offered insightful keynotes & several technical sessions focusing on the latest Qt features as well as amazing demos and customer stories from industries such as automotive, consumer electronics and automation.

We are happy that this year’s event was even larger than last year’s and we have our sponsors SRA, ISB, Adeneo Embedded, Wind River, PTP and the Japan Qt Users’ group to thank for that.

Whether you were able to attend the event or missed it, the presentation materials are available for your convenience.

View presentations:

Japan had a ‘Build your world with Qt’ theme, from talks to exhibitions, demos to anniversary celebrations, and you can relive the experience via the photos. If you came to the Qt Japan Summit, thank you again for visiting us!

QtJS Keynotes Collage

Qt JAPAN SUMMIT Breakout collage

Please contact for any questions & comments regarding the Qt Japan Summit.

The post Qt Japan Summit 2015 | Build Your World appeared first on Qt Blog.

Qt Bluetooth and its state of the union

Even though a lot of Qt use cases are about creating user interfaces, Qt provides a diverse set of middle-layer APIs for non-GUI functionality. One of the younger middle-layer APIs in Qt is Qt Bluetooth. From its first release in Qt 5.2 onwards, it has grown and improved in every Qt release.

In light of the forthcoming Qt 5.5 release, I’d like to tell you a bit more about the current status of Qt Bluetooth. It started out as a solution to interact with Bluetooth devices on Linux using Bluez 4.x. At the time, the supported feature set focused on classic Bluetooth development. It targeted the type of profiles and capabilities most commonly encountered by applications:

  • Local Device Control
  • Device & Service Discovery
  • OBEX Push
  • Serial Port Profile for Server & Client

Over time, the number of supported platforms was significantly expanded to cover Android (Qt 5.3), Bluez 5 (Qt 5.4) & OS X (Qt 5.5). Unfortunately, there are no API’s which would permit the implementation of the above features on iOS too.

One of the more recent feature additions is related to Bluetooth Low Energy and Internet of Things. What started as a Technology Preview in Qt 5.4 for Linux quickly became a very important subset of the Qt Bluetooth APIs. The recent explosion of available wearables, health and environment sensors requires Qt to be able to interact with such Bluetooth Smart enabled devices. Qt 5.5 takes this development into account and provides Bluetooth Low Energy support on all existing Qt Bluetooth platforms. In addition, Bluetooth Low Energy on iOS was added too.

Well, what’s missing? I guess my personal list is rather long and some of those items are less visible. Hopefully, we can close the gap towards the last major platform which is not yet supported. A WinRT port is being planned for Qt 5.6. On the Low Energy side of things, Qt Bluetooth should be able to run on Bluetooth Low Energy devices which offer their services to other devices (server role). Better scanning and advertising features, to interact for example with devices adhering to the iBeacon standard, are desirable too.

For the interested mind, the semi-official roadmap for the missing features is QTBUG-31674. I am interested in your feedback. Either drop a comment here or directly in Jira.

The post Qt Bluetooth and its state of the union appeared first on Qt Blog.

Squish tip of the week: Bring window to foreground

When working with multiple applications, or multiple windows in a single application, you can tell Squish to bring the desired window to the foreground before working with the window.

This applies to many different technologies or toolkits.

For example, when working with NSWindow on Mac OS X (Cocoa), given the name or title of the window, you can do the following:

def main():

    objName = "{title='MyApp Window #1' type='NSWindow'}"
    waitFor("object.exists(\"%s\")" % objName, 20000)
    nsw = findObject(objName)

Read more about this Mac OS X Cocoa example, or other examples in the following Knowledgebase articles:

Remember; we’re always adding to our knowledgebase and other online resources to provide you with the most current and helpful information!


16 Great Websites Featuring Free Game Sounds for Developers

Every game needs great music sounds. Here at V-Play, we’ve put together a list ranking 16 of our favourite websites offering free game sounds to help you develop your next game. If you’re looking for effects, UI sounds, background music or more, you’ll find it here. Best of all, they’re all for royalty-free so you can use them again and again. Hope you like the free game sounds!



Freesound - for free game sounds

The first site on our list is This site is a treasure trove of royalty-free sound samples and is utilised by many professional musicians and filmmakers. Samples from have been used by The Prodigy and featured in the movie Children of Men. You can search by keyword, licence type, file type and many more parameters so you’ll only see the search results you want. If you don’t find what you need, reach out to the community and someone might be able to help you.

99sound - for free game sounds is a website offering free downloads of royalty-free content generated by its own users. It has a great selection of high quality sound effects and is updated every month with a new sample pack. The variety of sample packs range from punching sound effects to ambient soundscapes. My favourite thing about 99sounds is that you don’t even have to register to access these amazing free game sounds, although registration does mean that you receive updates every time a new pack is launched.

noiseforfun - for free game sounds is a freeware project created in 2011 by sound designer and composer Filippo Vicarelli. All of the sound effects are available to use royalty-free and you don’t even need to register. Sounds are arranged according to game genre making it extremely easy for game developers to navigate. If you need to find a sound quickly, then this is the place to go.

Incompetech - for free game sounds

For an even broader and more eclectic mix of game music, you should definitely check out’s royalty-free music section. The unique thing about is that all of the tracks that make up the songs are also available to download individually. So if you hear even one part of song that you like, you can download it and use it in your game.

OpenGameArt - for free game sounds is the starting point for many indie developers on the hunt for graphics, but it’s also a source for free game sounds. Users upload their own sounds and choose what licence they share their music under. There are already hundreds of sounds to choose from and more are always being added. Besides the free game sounds, also has an extremely active forum where you can interact with the very people that create the sounds.

Raisedbeaches - for free game sounds offers something every game designer needs. The Octave collection that they’ve made available is a comprehensive selection of free UI sound effects in .aif form. The collection is made up of 48 beeps, slides and clicks that will bring your UI to the next level. The Octave collection can be downloaded at the click of a button and used in your project today. Its author doesn’t require attribution but it’s always welcome.

Musopen - for free game sounds

If you want to add a touch of class to your game, then you’ll want to check out right now. This non-profit website is dedicated to sharing music, but most noticeably, it has a great collection of classical music that is free to download and use in your games. You can browse by composer, artist, time period or instrument. You can preview all recording, which may be a good idea as the sound quality varies from track to track.

PlayonLoop - for free game sounds is the sister site of and offers background loops for games. This site definitely lives up to the standards of its sibling and is a fantastic source for game music. While all of the loops on the site have a price listed, the same loops are also available as a free download in shortened form. Free downloads are available with a CC-BY 3.0 License, meaning you need to attribute

Bensound - for free game sounds is a source of royalty-free game music that is available to use under Creative Commons License Attribution-NoDerivs 3.0. This website is really easy to use and the songs themselves really stand up at a professional level. There is a song for every game on this website and if you want to find a song as quickly as possible, then this would definitely be my pick. The songs are arranged by genre and made available for free as mp3 files.

SoundJay - for free game sounds have a huge collection of royalty-free content available on their site that you can use without any attribution, although they would like to be properly credited for their work. Their content is very well organised and you can download both mp3 and wav files at the click of a mouse. The stand-out category for me is the miscellaneous section which contains some really obscure sounds.

digccmixter - for free game sounds is next on our list and for a very good reason. This website gives you access to royalty-free songs submitted by its users and searchable according to different tags. A cool feature on this site is that you can listen to tracks from one artist while you continue to browse other titles. There’s a broad range of genres to choose from so it’s a great site for game devs to delve into.

Soundgator - for free game sounds is a site dedicated solely to providing royalty-free sound effects. It does require registration but the effects are completely free to use. The site is really easy to navigate and it has great search functionality. The sounds are ordered according to category and I particularly like its collection of ambient sounds. If you want to add some real life sounds to your game, this would definitely be the place to look.

Pacdv - for free game sounds

This website has been operational since 2001 and has amassed a great deal of sound effects since then. All of the sounds on are royalty-free and have also been used by a number of filmmakers and music producers. The sounds are once again ordered by category and can be previewed on site. In order to download a sound, you just need to click on it and then right-click and select ‘Save as’ to anywhere on your computer.

freesfx - for free game sounds is a great site to find sound effects for your game. This site has hundreds of effects in a large variety of categories that can be used in any commercial game, as long as you credit On top of the selection of sound effects, they also have a great library of royalty-free songs. It could have the effect that you’re missing right now.

Imphenzia - For Free game sounds is the work of Stefan Persson and it offers a great number of sound effects for free. Although this site mainly offers sound effects for sale, it has a great number of completely free game sounds which are available to download in a variety of file types. Stefan’s area of expertise is alarm, laser and explosion sounds, so if that’s what you’re after, don’t waste any time visiting his site.

bxfr - for free game sounds isn’t necessarily a resource, it’s actually an online tool that allows you to create your own sound effect and then export it to disk as a .wav file. It’s a really cool way to create your own free game sounds and will keep any musically inclined V-players entertained for hours. If you’ve got a bum ear, don’t worry too much. Bxfr is loaded with presets that can be easily tweaked to give you high quality sound effects in seconds. It’s also available to download as a stand-alone program.


How to Play Free Game Sounds in V-Play

Now that you’ve found all these amazing free game sounds for your new game, you may be wondering how to use them. With V-Play, you can add background music or sound effects to your game in seconds.

For background music that will always play during your game, you can use our BackgroundMusic element. It supports ogg and mp3 format and it streams the music to the game, saving on resources. On top of that, the music will pause if you ever get a phone call or some other game interruption.

For shorter sounds such as sound effects or UI sounds you can use the SoundEffectVPlay element. This element works best with low latency sounds and sounds that need to begin immediately after their play function has been called.

Here is a quick example of how both of these sound elements can be used:


import VPlay 2.0
import QtQuick 2.0

GameWindow {    
    Scene {
        Column {
            SimpleButton {
                text:"Sound Effect"
            SimpleButton {
                text: "Background Music"
                onClicked: music.pause()
        SoundEffectVPlay {
            id: clickSound
            source: "clickSound.wav"
        BackgroundMusic {
            id: music
            source: "awesomeBackgroundMusic.mp3"


So that’s our list. If you know of any other great free game sounds for game developers, let us know in the comments section. And if you really liked the article or think someone you know would like to read it, please share it using the options below!


The post 16 Great Websites Featuring Free Game Sounds for Developers appeared first on V-Play Game Engine.

Qt is coming to Red Hat Enterprise Linux!

For some time now it has been possible to compile and use Qt manually on the Red Hat Enterprise Linux platform, but with the later Qt 5 releases it hasn’t been as  straightforward due to the libraries and tools that come provided with Red Hat Enterprise Linux. Now with the release of Qt 5.5.0, there will be full and official support for Red Hat Enterprise Linux 6.6!

What this actually means is that Qt is tested on Red Hat Enterprise Linux 6.6 along with the other platforms that are CI tested (i.e Qt is regularly built and platform tests are run on a regular basis to try and prevent bugs from being introduced when a change is made), as indicated here

In addition to the fact that Red Hat Enterprise Linux 6.6 is now tested much more thoroughly on a regular basis, there will also be a pre-built version of Qt for this platform. This will enable you to download Qt and install it without having to wait for the compilation to succeed. This also means less hassle with setting up all the dependencies and the like to get Qt built.

Since the same rules apply for earlier versions of Red Hat Enterprise Linux, as for any other Linux distribution, Qt will be usable on these platforms, too. As long as you can use a supported compiler version and the dependencies required for building Qt are also available then there is no problem with compiling and developing with Qt on the earlier versions. However, for simplicity and ease of use reasons, we recommend that you consider moving to Red Hat Enterprise Linux 6.6 when switching to Qt 5.5.0.

The post Qt is coming to Red Hat Enterprise Linux! appeared first on Qt Blog.

Qt 5.5 Release Candidate Available

I am happy to announce that Qt 5.5 Release Candidate is now available.

Please download and try it out – it is quite close to final release, and we very much value your feedback:

For those who have not yet checked what Qt 5.5 brings, please refer to the Qt 5.5 Beta blog post, the wiki article listing new Qt 5.5 features, or the documentation snapshot for more details.

Qt 5.5 Release Candidate is available via offline installers. Offline Installers are available from the Qt Account for commercial users of Qt. Open source users can download installers from

The post Qt 5.5 Release Candidate Available appeared first on Qt Blog.

GCI 2014 and Grand Prize Trip

KDE Project:

Many pre-university students have participated in Google Code-In (2014) again and for many of them it has been the first opportunity to make contributions to Free Software and Open Source projects. In opposite to Google Summer of Code the GCI program is organized as a worldwide contest where students at the age of 13-17 years take the challenge to complete as many software development tasks from their mentor organizations as possible. These software development tasks are provided by Open Source Projects that are approved as mentor organizations. And at the end of 2014 KDE has participated as a mentor organization for the fifth year.

The most recent edition of Google Code-In, GCI 2014 has again been very successful: As Heena Mahour described in her Google Code-in 2014 wrap up with KDE there have been more than 277 tasks created by KDE mentors for the students which covered all aspects of the software development cycle and which ranged from creating source code to documentation, research, quality assurance and user interface tasks. It was amazing to see how the students solved nearly all of them and helped to improve KDE applications significantly.

As in previous years the top 24 performers became Grand Prize Winners and won a trip to Google Headquarters in Mountain View, California! In the KDE community the Marble Virtual Globe developers are usually actively involved with GSOC and GCI mentorship. Two of our students - Mikhail Ivchenko and Ilya Kowalewski - have made extraordinary contributions to Marble: They had worked very hard and contributed several important features to Marble - see e.g. Mikhail's blog post about the Tour (don't miss to watch the video!) and Ilya's blog about the Measure Tool improvements. And since they also earned most points they became Grand Prize Winners.
This year I was the happy one who went to Mountain View as a KDE mentor between June 7-10. And the trip was a great opportunity to learn more about the other mentors and the winning students (they were accompanied by a parent each) and to share more about our Free Software work in the KDE project. The Grand Prize Winner trip was lovingly organized by Stephanie Taylor and other members of the Google Open Source Programs Office: It began with a meet-and-greet event on Sunday evening in San Francisco to get to know everyone. On Monday we visited Googleplex in Mountain View. And on Tuesday we had a fun day in San Francisco where we had the choice to visit the Exploratorium, Alcatraz or went on a Segway tour through San Francisco. Being a science guy I picked the Exploratorium. On Wednesday it was time to say goodbye already after enjoying another round of Googler talks, delicious food and swags at the Google San Francisco Office. The whole experience was just awesome and I'd like to thank Stephanie, Carol, Cat and all the other Googlers for organizing this event and for giving us the opportunity to join it.

How to Profile QtQuick applications on Freescale i.MX 6 with vAnalyzer

Quick overview of profiling tools

QtQuick is often used to create UIs for embedded devices. One SoC that is quite popular at the moment is the i.MX 6 board from Freescale, with its Vivante GC2000 or GC880 3D GPU. Performance on such a device matters, users expect a fluid interaction. With the QML Profiler, Qt provides an excellent tool to dig into the performance of QtQuick applications. In cases where that is not enough and more details about graphics performance is needed, the apitrace tool provides profiling on the level of OpenGL calls. Sometimes, even more details can be useful. In this blog post, we will look at one of the tools provided by Vivante that provide GPU statistics for profiling.


Vivante provides a set of tools in their Vivante Tool Kit (VTK). It contains a shader compiler (vCompiler), an OpenGL emulator library (vEmulator), a shader development tool (vShader), a texture compression/decompression tool (vTexture), a tool to record and replay OpenGL traces, like apitrace (vTracer and vPlayer) and finally a tool to display GPU statistics, vAnalyzer. We will look at the last one, vAnalyzer, here. The download of VTK is a bit hidden and behind a registration wall, and can be found on, in the download section of the i.MX 6 product page, for example i.MX 6D/Q/DL/S/SX GPU Tools-5.0.11P4.1 for the BSP with the 3.10.53 kernel.


Recording GPU statistics can be done with vProfile, which is built into the user-space and kernel drivers. An option in the kernel controls whether profiling is compiled into the Vivante GPU kernel module. This is enabled by default in Yocto “Fido” (and probably also in earlier versions), which uses the linux-imx kernel tree. If you use another kernel, enable the VIVANTE_PROFILER option in either drivers/mxc/gpu-viv/Kbuild or in drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h. In addition, profiling needs to be enabled in the kernel command line, which also provides an option to check if profiling was compiled in. These options are galcore.gpuProfiler=1 and galcore.showArgs=1. If everything worked, something like the following should be shown during the boot process:

Galcore version
Galcore options:
  irqLine = 41
  registerMemBase = 0x00130000
  registerMemSize = 0x00004000
  irqLine2D = 42
  registerMemBase2D = 0x00134000
  registerMemSize2D = 0x00004000
  irqLineVG = 43
  registerMemBaseVG = 0x02204000
  registerMemSizeVG = 0x00004000
  contiguousSize = 134217728
  contiguousBase = 0x3CB00000
  bankSize = 0x00000000
  fastClear = -1
  compression = -1
  signal = 48
  powerManagement = 0
  baseAddress = 0x00000000
  physSize = 0x00000000
  logFileSize = 0 KB
  recovery = 1
  stuckDump = 1
  gpuProfiler = 1

If the line about gpuProfiler is missing, then profiling support was disabled during compilation.


vAnalyzer is, like all other tools in the VTK, a Windows application, which is a bit unfortunate since most i.MX boards probably run Linux, and hence the developers probably run Linux on their desktop machine as well. Fortunately, it runs fine under Wine, simply running wine setup.exe will install vAnalyzer.


Obtaining a trace is easy: Before running an OpenGL program, run export VIV_PROFILE=1. Once the program has finished, the driver will write the trace into a file, for example _378_2.vpd. This file can then be opened with vAnalyzer. There are additional environment variables you can set to control the file name or restrict the recording to a certain frame number range. Moreover, an application can start/stop the recording by calling glEnable(GL_PROFILE_VIV) or glDisable(GL_PROFILE_VIV). Consult the VTK User Guide for more details.

To demonstrate, we ran the following QML file with qmlscene -platform eglfs:

import QtQuick 2.0

Item {
    id: root
    width: 1024
    height: 768

    Component {
        id: rectComponent

        Rectangle {
            id: rect
            x: Math.random() * root.width
            y: Math.random() * root.height
            width: Math.random() * root.width
            height: Math.random() * root.height
            color: Qt.rgba(Math.random(), Math.random(), Math.random(), Math.random())

            NumberAnimation on rotation {
                duration: Math.random() * 1000;
                from: 0
                to: 360
                running: true
                loops: Animation.Infinite

    function createSomeRects() {
        for (var i = 0; i < 10; i++) {

    Timer {
        interval: 2000
        repeat: true
        running: true
        onTriggered: createSomeRects()

    Component.onCompleted: createSomeRects();
QtQuick Rectangles Example

QtQuick Rectangles Example

That program creates 10 rotating rectangles every 2 seconds. vAnalyzer, as pictured in the screenshot below, nicely shows that the framerate starts to drop from 60 FPS due to fill rate limitations when we approach about 110 rectangles. This is something to keep in mind when developing UIs for i.MX 6 devices – avoid overdraw as much as possible, make sure your QML files don’t contain useless Rectangles that are covered by other UI elements anyway. If in doubt, check with QSG_VISUALIZE=overdraw how much overdraw your application has.

As one can see in the right-hand listview of the screenshot, there are many more statistics from different pipeline stages that help for digging into more details. The GPU utilization is always displayed as 100% though, which is probably a bug. Nevertheless there are a wealth of other useful data points available.

VAnalyzer Main Window

vAnalyzer Main Window (click to enlarge)


vProfiler and vAnalyzer are useful tools to augment profiling data from other tools. Until now, they are not well-known, as the lack of Google search results reveals. We hope that this blog post has made developers aware of vAnalyzer’s existence and will maybe help them to analyze performance of their QtQuick application on an i.MX board.

The post How to Profile QtQuick applications on Freescale i.MX 6 with vAnalyzer appeared first on KDAB.

Cutelyst 0.9.0 is out!

Cutelyst the Qt Web framework just got a new release!

I was planning to do this one after Qt 5.5 was out due to the new qCInfo() logger and Q_GADGET introspection, but I'll save that for 0.10.0.

This release brings some important API breaks so if everything goes well I can do another CMlyst release.

  • Some small performance improvements with QStringRef usage and pre-cached _DISPATCH actions
  • Fixes when using uWSGI in threaded mode
  • Speedup uWSGI threaded mode, still slower than pre-forked but quite close
  • Fixes for the session handling as well as having static methods to make the code cleaner
  • Fix uWSGI --lazy-apps mode
  • Use PBKDF2 on Authentication plugin
  • Requite CMake 3.0 and it's policy
  • Add Request::mangleParams() and Request::uriWith() so that Request API now covers all of Catalyst's
  • Documented some functions

Cutelyst repository was moved to gitlab and then moved to github. The main website is now powered by CMlyst and itself :)

Download here.

I also started another project, html-qt is a library to create a DOM representation of HTML following the WHATWG specifications, it's needed for CMlyst to be able to remove XSS of published posts, at the moment it has 90% of the tokenizer ready, and 5% of the parser/tree construction code, so if you have interest in the subject (could be potentially useful for mail clients such as KMail) give me a hand!

Qt Input Method – In Depth

What is an Input Method and what do we need it for?

To answer that question, let’s see what Wikipedia says:

“An input method (or input method editor, commonly abbreviated IME) is an operating system component or program that allows any data, such as keyboard strokes or mouse movements, to be received as input. In this way users can enter characters and symbols not found on their input devices.”

So an input method allows you for example to input Chinese, Japanese, Korean or Indian characters into a text input field of an application, even though there is only a Latin keyboard attached to the computer. That is done by analyzing the text, which is typed in as Latin, and e.g. opening a popup menu with a pre-selection of Chinese characters, which are associated with that Latin input. The user can now select one of these Chinese characters, which will then replace the Latin input in the text field.

input method example

Since input method support is nowadays an important requirement for UI toolkits, it doesn’t come as a surprise that our favorite one (aka Qt) provides it as well. But since Qt is cross-platform, it doesn’t support only a single input method, but various ones, depending on the target platform.

In this blog post, we’ll have a closer look at how that is implemented, what classes are involved and where it can be extended or adapted.

Input methods in Qt

To get an overview of the input method handling in Qt, let’s have a closer look at the involved components first:

components overview

QPA plugin: Since version 4.8, Qt contains an abstraction layer (Qt Platform Abstraction), to simplify the porting of the UI parts of Qt to new windowing systems. This layer consists of a set of abstract interface classes (QPlatform*), which are reimplemented for the target windowing system and are bundled as a plugin that can be loaded at runtime. The central interface is QPlatformIntegration, which is instantiated from the plugin by QGuiApplication on startup, and provides access to all the other QPA interfaces.

QPlatformInputContext: The QPlatformInputContext is an abstract interface for the various input method systems that are available on the different windowing systems. For every supported system, there is a sub class of QPlatformInputContext, which implements the communication with the actual input method backend (e.g. QIBusPlatformInputContext for IBus). These subclasses are either available as standalone plugins, which can be loaded at runtime (Qt 5.4 ships two of them, ‘ibus’ and ‘compose’), or are compiled into the QPA plugin (e.g. QQnxInputContext for QNX and QWindowsInputContext for Windows). QPlatformInputContext is part of Qt’s private API, so as an application developer, you won’t access it directly, instead the global instance of the public class QInputMethod is used. This global instance is returned by QGuiApplication::inputMethod() and it simply forwards the calls to its methods to the global QPlatformInputContext instance. The latter is provided by the loaded QPA plugin (see QPlatformIntegration::inputContext()), which returns one of the above mentioned subclasses.

QGuiApplication: The QGuiApplication inherits QCoreApplication and therefore contains the main event loop of the application, which is responsible for forwarding incoming events from the native windowing system to the appropriated objects in the application. While QCoreApplication only knows about the UI-independent events, the QGuiApplication has knowledge about UI-related states, like which widget has the active keyboard focus, what the current input method is etc.

Text input widgets: The purpose of the text input widgets (e.g. QLineEdit or QTextEdit) is to visualize the keyboard input of the user in a textual representation. Since the key events, which come in from the native windowing system, cannot always be mapped to output characters one-to-one, the text input widgets need support from the input method system to do the conversion.

Follow the stream

While we now know the major players in the game and their roles, in the next step we’ll see how they interact with each other. For that, we follow a key stroke on the keyboard throughout the complete system until it shows up as character in a QLineEdit.


The first thing we need in our application is an input widget, which is sensitive to keyboard input. That is easily done by instantiating a QLineEdit. If the user now wants to type in a Chinese character, the first of his actions would be to give this QLineEdit the input focus by either clicking on it with the mouse pointer or navigating to it via the tab chain. As soon as the QLineEdit receives the focus, a private slot in QGuiApplication is called (_q_updateFocusObject), which executes the following steps:

  1. check if the QPlatformIntegration provides a QPlatformInputContext object
  2. if so, check if the object with the input focus wants to use the input method system or handle key events itself
  3. informs the QPlatformInputContext about the new focus object

The first check is easily done, since the QGuiApplication has loaded the QPA plugin itself, so it has access to the QPlatformIntegration instance and can simply call the QPlatformIntegration::inputContext() method to check if a valid QPlatformInputContext object is returned.

The second check is a bit more advanced. To decouple the QGuiApplication from the QWidget interface (and e.g. support also focus handling for QQuickItem), it cannot just call a method on the focus object to query its properties, since that would require QGuiApplication to know their API. Instead QGuiApplication sends a synchronous event (a blocking invocation via QGuiApplication::sendEvent(QEvent*)) to the focus object. Then the focus object fills the event object with the requested information, and when the blocking call returns, the QGuiApplication extracts the information from the event. In short: synchronous event sending is used to decouple QGuiApplication from the public interface of the focus objects.

So what does the event look like and what information can be queried? QInputMethodQueryEvent is the actual event that is used to query the information, and it allows QGuiApplication to query information from the focus object like:

  • does it accept input method input (Qt::ImEnabled)
  • the text around the current input area (Qt::ImSurroundingText)
  • preferred input language (Qt::ImPreferredLanguage) and many, many more (see Qt::InputMethodQuery).

In our case QGuiApplication sends a QInputMethodQueryEvent to QLineEdit and asks for the Qt::ImEnabled flag. QLineEdit responds to that event in the reimplemented QWidget::inputMethodQuery() method, by checking if the Qt::WA_InputMethodEnabled widget attribute is set. This attribute needs to be set by any widget that wants to use the input method system and is set by default on the text input classes (QLineEdit, QTextEdit etc.) in Qt.

The last of the steps executed by _q_updateFocusObject() is to inform the QPlatformInputContext object about the new focus object, so that it can query further information from the focus object if needed later on during the input process. That is simply done by invoking QPlatformInputContext::setFocusObject(QObject *object).


Now that the QLineEdit has the keyboard focus, the user might press a key on the keyboard, which will trigger an input event in the operating system, which will be forwarded to the windowing system and from there call some function in the currently loaded QPA plugin. At that point the QPA plugin would transform the native key event into a QKeyEvent and inject it into the applications event queue by calling QWindowSystemInterface::handleKeyEvent() or QWindowSystemInterface::handleExtendedKeyEvent(). If however an input method system is active, (in that case (QPlatformIntegration::inputContext() returns a valid QPlatformInputContext object), it will send the raw input data to the QPlatformInputContext object instead. How the raw input data are sent to the QPlatformInputContext in that case is not defined by any API, so every QPA implementation is free to choose how to do it. The XCB QPA plugin for example expects the QPlatformInputContext to provide a public slot ‘x11FilterEvent’, which it invokes with QMetaObject::invokeMethod() and passes the xcb_keysym* data as parameters. That dynamic invocation allows us to use different QPlatformInputContext implementations on XCB systems, without having the XCB QPA plugin know the exact class interface. The QNX QPA plugin on the other hand has the QQnxInputContext compiled in, so it has a pointer to that instance and simply calls a method to forward the raw input data to it.


The QPlatformInputContext subclass has got the raw input data now and can forward them to the actual platform specific input method backend (e.g. send to IBus server via DBus). At that point the input method backend might require additional information to process the current raw input data. Example information could be:

  • the text around the current input area, to interpret the new input data in a context
  • the location of the cursor, to open character selection popup menu next to it

To query this information, the QPlatformInputContext sends a synchronous QInputMethodQueryEvent to the current focus object again, exactly as QGuiApplication has done it before. Once it has retrieved this information from the focus object, and forwarded it to the input method backend, the backend will compose a final character (or sequence of characters) that should be set as the new text on the QLineEdit. The composing is either done programatically (by following some writing system specific rules), or the input method system opens a popup menu with a pre-selection of possible characters from which the user selects an appropriated character.

So how does the composed text get back to the QLineEdit? For that, another synchronous event invocation is done. The QPlatformInputContext creates an instance of QInputMethodEvent and calls setCommitString() on it, with the newly composed text as parameter. Afterwards it sends the event to the focus object.

On the focus object, the QLineEdit in our case, the reimplemented method QWidget::inputMethodEvent(QInputMethodEvent*) is invoked. That method will update the current text of the QLineEdit with the composed text, reposition the text cursor and possibly update the current selection.

At that point, the key press event has reached its destination and the user is going to press the next key on the keyboard.

In addition to the commit string, the QPlatformInputContext could also create a QInputMethodEvent with a preedit string and send it to the focus object before composing has started or while composing is in progress. That preedit string is then shown inside the QLineEdit as intermediate result. The visual appearance of that text can be influenced by setting certain attributes on the QInputMethodEvent.

In the next blog post we will learn how to implement an out-of-process virtual keyboard, that uses Qt’s input method framework to communicate with Qt-based applications. Stay tuned!

The post Qt Input Method – In Depth appeared first on KDAB.

Fast and Slow Sticky Notes in Haskell and Qt

Last year I gave a talk for the London Haskell User Group on building a Sticky Notes application using Haskell, Qt, and the HsQML binding between them. The video has been out for a while now and made the rounds elsewhere, but I've thus far neglected to post it on my own blog! Slides are here. See below for an update on the example program and an answer to the most commonly asked question after the fact.

Fast and Slow? An update!

For the sakes of simplicity, the original version of the sticky notes program shown in the talk uses an SQLite database to serve the view directly with no in-memory model or caching. This is at least the cause of some sluggishness and at worst pathological performance depending on your machine.

As alluded to in the talk, there is a better albeit more complicated way. This involves moving the slow database accesses onto a separate thread and keeping a fast in-memory model to support the user interface. Changes made by user are now queued up and then flushed to disk asynchronously.

I've now released an updated version ( of the hsqml-demo-notes package which includes a new faster version of the program illustrating exactly this technique. This hsqml-notes executable is now built using the new code and, for reference, the original code is built into the hsqml-notes-slow executable.

The fast variant uses three MVars to communicate between the UI and database threads. An MVar is kind of synchronisation primitive offered by Haskell akin to a box which may either contain a data value or be empty. Operations on MVars take out or put in values to the box and will block if the MVar is not in the appropriate state to accept or produce a value. Hence, a variety of different constructs such as locks and semaphores can built out of MVars.

The first MVar in the new notes code, modelVar, contains a Map from note IDs to the data associated with each note. This is the in-memory model. It includes all the fields held in the database table plus an additional field which indicates whether there are any pending changes which need flushing to the database (whether the record is "dirty"). The MVar semantics here act as a lock to prevent more than one thread trying to manipulate the model at the same time.

A second MVar, cmdVar, is used as a shallow channel for the UI thread to signal the database thread when there is work to do. The database thread normally waits blocked on this MVar until a new command value is placed in it, at which point it takes out and acts upon it. The first command given to the database thread when the program starts is to populate the model with the data stored on disk. Thereafter, whenever a user makes a change to the model, the dirty bit is set on the altered record and a command issued to the database thread to write those dirty records to the database.

Finally, the third possible type of command causes the database thread to close the SQLite file and cleanly exit. In that case, the third MVar, finVar, is used as a semaphore to signal back to the UI thread once it has shut down cleanly. This is necessary because the Haskell runtime will normally exit once the main thread has finished, and the MVar provides something for it block on so that the database thread has time to finish cleaning up first.

What is the FactoryPool actually for?

QML objects require a relatively explicit degree of handling by Haskell standards because the idea that data values can have distinct identities to one another even if they are otherwise equal is somewhat at odds with Haskell's embrace of referential transparency. This sense of identity is important to the semantics of QML and can't be swept under the rug too easily. Crucially, using signals to pass events from Haskell to QML requires that both the Haskell and QML code are holding on to exactly the same object.

One way to accomplish this is to carefully keep track of the QML objects you create in your own code. The factory-pool is an attempt to provide a convenience layer atop object creation which saves the programmer from having to do this. It is essentially an interning table which enforces the invariant that there is no more than one QML object for each distinct value (according to the Ord type-class) of the Haskell type used to back it. If you query the pool twice with two equal values then it will give you the same object back both times. Importantly, it uses weak references so that objects which are no longer in use are cleared from the intern table and it doesn't grow in size indefinitely.

One of the difficulties people have had with understanding the factory-pool from the notes example is that it's not generally necessary to make it work. Aside from the initial loading of the database, all the activity is driven from the front-end and so displaying a single view isn't strictly reliant on the signals firing correctly. If you replace the code to retrieve an object from the pool with a plain object instantiation, the default QML front-end for the demo would still work the same, albeit more wastefully.

To see the pool doing something useful, try the "notes-dual" front-end (by specifying it on the command line), which I've come to think of as the most interesting of the demos. It displays two front-ends simultaneously backed by the same data model. Changes in one are immediately reflected in the other. This works because when each front-end retrieves the list of notes they both obtains the same ObjRef from the pool for each Note as each other. Hence, when a change is made in one front-end, and a change signal is fired, both the front-ends receive it and remain in sync.

Without the pool, the onus would be on the application code to keep track of the objects in some other fashion. For example, if each read of the notes property created a new set of objects every time it was accessed then many more objects would need to have signals fired on them in order to ensure that every piece of active QML had received notice of the event. Each front-end would still be backed by the same data, methods and properties would still have access to the same set of Note values, but their objects would be distinct from the perspective of signalling and, unless special care was taken, the front-ends wouldn't update correctly.

Back home after Qt Contributors’ Summit 2015

It was a great weekend in Oslo, 5-7th June!

Over a hundred Qt contributors gathered right next door to The Qt Company offices to talk about the current state and future of Qt.

The Friday pre-event drew a good crowd, who met up at The Qt Company offices. As the weather was nice, we went out for a picnic in the nearby park. This set the feeling of Qt Contributors’ Summit well, as it is a gathering of a community

The program for the weekend contains the session notes. The topics ranged from the upcoming QtCreator UI style changes to long term support in Qt. Every session drew an active crowd and there were many discussions. Between every session there was time to talk in the hallways, a very important part of a good Qt Contributors’ Summit.

For those of you who were taking notes in sessions, if you haven’t yet, please go and update the notes for the session on the wiki. Also for at least the more technical sessions, please post the notes to the Development mailing list, so as to make sure people who need to see the notes really do see them.

3ChampionsMemorable things from this years summit include the strong attendance from Japan, three community members present. We also had  three of the current four Qt Champions present at the same time!

The Saturday evening event was held together with The Qt Company and local old trolls. The venue had a nice sunny balcony, and people enjoyed themselves after a long day of sessions.

I want to thank everyone who made this Qt Contributors’ Summit a great event. Our sponsors; The Qt Company, Intel, Boundary Devices, ICS, Froglogic,KDAB, e-Gits and Pelagicore. And Aliz and Anca from The Qt Company offices were an invaluable help in the event practicalities.

But most of all, thank you to everyone who attended.

Hope to see you all in Berlin at the Qt World Summit!

QtCS roll up small

The post Back home after Qt Contributors’ Summit 2015 appeared first on Qt Blog.

Minimal Continuous Integration for Git projects with Jenkins (and a Qt example)

... a.k.a. "all auto tests in the master branch are always passing".   Imagine this typical scenario: You are working on a project with Git, and the classes are tested via auto tests. Unfortunately, many of the tests are often broken (typically by your co-workers, not by yourself, right?) and will be fixed "tomorrow" (which can mean anything from tomorrow until never). A better way is this: You do not push to the master branch (or stable etc.) directly, but to a special branch; then that branch

Update 2.4.2: New Action & Falldown Game Samples, License Update

The new V-Play update 2.4.2 adds two more sample games: the falldown game Chicken Outbreak 2 and the action game Crazy Carousel. Both games are included with full source code in the free V-Play SDK, and help you to learn V-Play faster. You can also use the games as a foundation for your own game. See below how to run the new demo games.

Simpler License Generation for V-Play Qt Plugins

To make a game that is in top of the charts, you need to measure & constantly improve it. For this challenge, you can use Flurry or Google Analytics and integrate them with just 10 lines of code into your game. With a V-Play License, you get access to these and many more plugins that help you to analyze, monetize & improve your game.

Before V-Play 2.4.2, you needed to generate a separate license key for each plugin. Since this new update, you can simply select the plugins you like and are all set for integrating the plugin to your game:

You can now select all the Qt plugins you want to include in your V-Play license key.

As a V-Play Customer, you can now use this simplified license key generation for all plugins here.

New Open-Source Falldown Game: Chicken Outbreak 2

Chicken Outbreak 2 is the second part of the original V-Play falldown game with your goal to escape from a Western-style henhouse. It uses many features you can also use in your game like:

Chicken Outbreak 2 - Falldown game by V-Play

To play & test this game, see Play the Games below.

New Action Game & Game Tutorial: Crazy Carousel

Crazy Carousel is a mini-game with the goal to collect as many coins as possible while avoiding to get hit by paper planes. You can collect the coins or avoid the paper planes by jumping from one carousel ride to another. To jump, just swipe to the left or the right.

Crazy Carousel - V-Play Action Game

We also created a complete step-by-step tutorial for you on How to Create the Crazy Carousel Game with V-Play!

This new demo game is a showcase project that combines several important aspects of the V-Play engine. It uses these features:

In addition, the game shows how you can get a 3-dimensional feeling into your 2D-game! We accomplished that by using images that simulate a 3D room and a special animation of the paper planes and coins, that also scales them up when coming closer.

Play the Games

To play & test the games (you might need some of the source code implementation for your own game!), follow these steps:

1.) Update V-Play

After you installed V-Play, open the V-Play SDK Maintenance Tool in your V-Play SDK directory. Choose “Updates components” and finish the update process to get the latest version 2.4.2 as described in the update guide.

If you did not install V-Play yet, you can do so now with the latest installer from here.

2.) Start the Sample Launcher

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 it from <V-PlaySDK>/Examples/V-Play/sampleLauncher.

V-Play Sample Launcher - Play & Test all V-Play Sample Games from one application

Now just choose one of the two new demos, and you can explore & copy the source code right from within the Sample Launcher.


P.S.: For a detailed changelog of the update, see here.


The post Update 2.4.2: New Action & Falldown Game Samples, License Update appeared first on V-Play Game Engine.

Play ball! Qt World Summit 2015 Registration Now Open!

We want you, our faithful blog reader, to be the first to get the goods on what’s happening at Qt World Summit. We are very excited to announce Qt’s most anticipated business and technology event will be returning to Berlin October 5-7. Registration is officially open!

The global event for all things Qt

This will be the 12th annual Qt event, so you can expect the same greatness you’ve experienced in the past, but now with a more unified and integrated approach covering business strategy and the code behind it.

Your ticket will get you 3 days of everything Qt, 75+ sessions, and 8 training options. We’re still working on all the conference details and the full content schedule, but whether you are a technology director, business decision maker, tech strategist, product manager, engineer or developer there is something here for you. You’ll experience all this with hundreds of your closest and smartest friends in the Qt community.

In addition to the exceptional learning opportunities, we’re planning some networking experiences that will knock your socks off.

World-Class Training from Diamond Sponsor, KDAB

Two days is just not enough to pack in all the great content we have in store for you! Why not join us a day early for one of 8 pre-conference training options from KDAB, spanning all topics from Qt fundamentals to advanced areas?

QtWS15 Welcomes Top Sponsors

We are very happy to have ICS as our Platinum sponsor. A huge thanks also to e-GITS and Froglogic as Gold sponsors, basysKom as Silver sponsor, and KDE Community as Partner. Together we will make Qt World Summit 2015 an event you won’t forget. Thinking about becoming a Qt World Summit sponsor? Please contact us.

Registration Now Open: Early Bird, Student Discount, Bring the Team Offer

Sign up now to get early bird pricing. It’s only available until July 13 and it’s the lowest possible price this year!

Are you currently enrolled in a college or university? Get your unique student discount code here.

There really is too much good stuff for one person to see. Take advantage of the Bring the Team Offer!

Tip: You probably already know that your investment of time and money in QtWS will pay for itself and then some. Need help convincing your manager? Download the justification e-mail, tailor it to fit your situation, then send it on for approval.

As you register for Qt World Summit 2015, don’t forget to share that you’re attending. The official event hashtag is #QtWS15, and you can follow the buzz on Facebook, Twitter, and LinkedIn. If conference registration opens and no one tweets about it, is it even a conference at all…? :-)

Look forward to connecting, and happy registering!


The post Play ball! Qt World Summit 2015 Registration Now Open! appeared first on Qt Blog.

Some Lesser Known Qt Tools and Commands - Part 3

In this next installment of our blog series on lesser-known Qt commands, we'll look at four tools related to documentation: qdoc, qhelpgenerator, qcollectiongenerator and qhelpconverter.


Qdoc1 is the tool used to generate the developer documentation for the Qt Project. It is not specific to Qt, and can be used to create documentation for other projects or applications.

Qt World Summit 2015 | Come early and soak up even more!

We’re really getting into the exciting part of the Qt World Summit year as we push ahead on building out the agenda and selecting speakers so that you know well in advance everything you’re going to be able to experience next October. On we’ve published the day-by-day agenda at a glance. We want you to have plenty of time to plan your trip to and from Berlin, so we’ve given you the start and end times of all the principal activities for each day.

Two days is just not enough to pack in all the great content we have in store for you! Why not join us a day early, on October 5, for one of the focused pre-conference training options?

We are thrilled to have Diamond sponsor, KDAB, host the Training Day, showing their strong and continued commitment to the Qt ecosystem especially after their great effort of organizing the previous Qt Developer Days in Europe. With more than 50 to 100 classes a year, KDAB instructors are experienced trainers as well as active developers, with real life experience from projects for KDAB customers.

KDAB-300x204Whether you are new to Qt and already a developer, new to Qt and a manager / decision maker or already a Qt developer there is something here for you.

Learn more about course options and which training is right for you here. Tickets will go on sale next week.

The post Qt World Summit 2015 | Come early and soak up even more! appeared first on Qt Blog.

Porting Three.js Code to Canvas3D

You might have heard of our new Qt Canvas3D module that comes with Qt 5.5: Introducing Qt Canvas3D. In this post we will go through the steps needed to port your three.js content to Canvas3D. We will cover how you can create your own Canvas3D project with Qt Creator and what are the main things to take into account when porting your code. To make it more exciting, all this will be shown via a well-known three.js example.

Creating a Canvas3D project

The easiest way to start is to use the QtCanvas3D Application with Three.js wizard with Qt Creator. The wizard template will be included in Qt Creator 3.5 and onwards. If you are using an older version of Qt Creator, you can find the wizard template in the Qt folder under 5.5/Src/qtcanvas3d/creatortemplates folder. The template needs to be copied to the correct location for Qt Creator to detect it. More details about the correct location can be found from Qt Creator documentation: Locating Wizards

After you have the wizard template in place you can start the New File or Project wizard. The QtCanvas3D Application with Three.js template can be found under Applications. Just give your project a descriptive name, select the kits used for the project, add it to version control if needed, and finish the wizard. Now you have a basic Canvas3D project created. The project includes a pre-defined set of files to run a Canvas3D application including the three.js. The default implementation draws a cube so that you can verify that everything is working correctly.

Porting HTML Content to JS

Next we are going to go through the steps needed to port the original HTML content into the created project. As an example we will use the Simple Cloth Simulation from three.js. We will use here a port of three.js on top of Canvas3D.


The three.js library and the other JavaScript file needed by the example are added to the resource file automatically if the project was created with the wizard. Otherwise you will need to add the files to the project’s resource (.qrc) file.

The QML file created by the wizard has a Canvas3D element that already has the basic methods you will need to initialize, paint, and resize the canvas. The Canvas3D object is passed to these methods as a parameter. We will later show how the buttons to toggle different properties are created and positioned on the QML side. However, first we will go to the JavaScript side to port the actual code from the HTML file in the Simple Cloth Simulation has.

Let’s start with the initializeGL() function in our Canvas3D project. Basically this method is the place where you put the code you had in your init() function in HTML. With Canvas3D we don’t use the document object so code related to that can be skipped. Also the code related to stats is something we don’t need here. In the HTML you have used window to get the size. Code related to that should be changed so that the canvas object passed to the function is used. For example, the camera creation in the original example was done like this:

camera = new THREE.PerspectiveCamera( 30,
            window.innerWidth / window.innerHeight,
            10000 );

With Canvas3D the camera should be created in the following way:

camera = new THREE.PerspectiveCamera( 30,
            canvas.width / canvas.height,
            10000 );

There are some textures used in the example. The texture files need to be added to the project’s resource file. After this they can be loaded using the reference to the resource:

var clothTexture = THREE.ImageUtils.loadTexture(
            'qrc:/textures/patterns/circuit_pattern.png' );

The original HTML example has some shaders defined with the help of the document. We have created a WebGL Shader Library that basically has the exact same code as the original shaders did.

var clothShader = THREE.ShaderLib[ "cloth" ];
var vertexShader = clothShader.vertexShader;
var fragmentShader = clothShader.fragmentShader;

Last but not least, we replace WebGLRenderer with Canvas3DRenderer in the initializeGL() function.

renderer = new THREE.Canvas3DRenderer(
            { canvas: canvas,
              antialias: true,
              devicePixelRatio: canvas.devicePixelRatio });

The JavaScript file has an implementation for the onResizeGL() function. The default implementation there will work fine for Canvas3D projects, but you may want to do some changes based on the HTML files. In the example we ported, the implementation of the template was sufficient.

function resizeGL(canvas) {
    camera.aspect = canvas.width / canvas.height;
    renderer.setSize( canvas.width, canvas.height );

The content of the animate() function you have in HTML can be ported to the paintGL() function with Canvas3D. You no longer need to request animation frame because Canvas3D takes care of that.

The full port of the HTML to JavaScript for Simple Cloth Simulation example can be found here: animation-cloth.js.

Adding controls to the QML side

For the Simple Cloth Simulation example we have added some buttons to the QML to do the toggling. All the buttons are positioned on the top of the window. For example, for toggling the wind we have created a button in the following way:

Button {
    id: windButton
    anchors.left: cameraButton.right
    width: parent.width / 4
    text: "Toggle Wind"
    onClicked: GLCode.toggleWind()

The JavaScript code was imported as GLCode for our ported application. The toggleWind() function from JavaScript code is called when the button is pressed. This function has the implementation that was defined in the hyperlink on the original HTML.

Another way to do this would be to define custom properties in your QML types, for example on the Canvas3D element. That object is already passed to the JavaScript, so you can just modify the value of the property on button press. In the way we have done the amount of needed porting effort has been reduced by reusing the existing methods from the HTML implementation.

The fully ported Simple Cloth Simulation example you can find here: ported animation-cloth example.

Mouse and Key Event Handling

The example we have covered here doesn’t have any mouse or key event handling. If you need these event handlers you can do it, for example, by adding a ControlEventSource to your Canvas3D type. ControlEventSource offers an API that is compatible to key and mouse event registration in HTML.

ControlEventSource {
    anchors.fill: parent
    focus: true
    id: eventSource

This needs to be passed to the JavaScript on initialization:

onInitializeGL: {
    GLCode.initializeGL(canvas3d, eventSource);

Then in the JavaScript initializeGL() function you should connect the desired signals to the corresponding functions. For example, for mouse and key down events the code would look like this:


For the mouse event you will get the position of the pointer. For the key event you get the event and from it you can check which key was pressed using the key names used by Qt (Qt::Key).

Try it out

There’s a set of three.js examples that we’ve already ported on top of Canvas3D. You can find these examples here: qt-examples. Why not take a look at those and then give a try to port your own code?

The post Porting Three.js Code to Canvas3D appeared first on Qt Blog.

How Can Automakers Compete with the Rise of the Smartphone?

Automakers have long strived to make their in-car experiences unique and distinctive: not just in an effort to distinguish themselves from their competitors, but also to distinguish their low-end car models from their luxury models. The low-end to high-end distinction has been important to them for two reasons:

Qt 5.5, computer vision, and the Nitrogen6X

In a previous post we have introduced one of the many new features of the upcoming Qt 5.5: the ability to easily integrate image processing and vision algorithms with camera and video streams via Qt Multimedia. It is now time to see the briefly mentioned OpenCV-based example in more detail.

Qt Quick, Multimedia, and OpenCV on the Nitrogen6X board

Qt Quick, Multimedia, and OpenCV on the Nitrogen6X board

Nitrogen6X is a single board computer from Boundary Devices based on the well-known Freescale i.MX6 platform. Combined with the 5 megapixel MIPI camera and the 7″ multi-touch display, all of which Qt supports out of the box, it provides an excellent platform for modern user interfaces and multimedia applications.

To see it all in its full glory, check out the following video:

As always, the application is cross-platform. Below it is seen running on an ordinary Linux PC, with QT_QUICK_CONTROLS_STYLE set to Flat. This allows having the exact same style for the controls as on the actual devices. This previously commercial-only style is now available under LGPLv3 for anyone, on any platform, starting from Qt 5.5. This is excellent news when targeting embedded devices, as those do not have a native look and feel to begin with, and for anyone who is after a consistent, unified experience across desktop, mobile, and embedded platforms.

Qt OpenCV demo on the desktop

Qt OpenCV demo on the desktop

The post Qt 5.5, computer vision, and the Nitrogen6X appeared first on Qt Blog.