Skip to content

QtDevelopment Get the RSS Feed

for feeds to planetqt and planetkde

Un-deprecate your Qt project

The last post from my colleague Marc Mutz about deprecating Q_FOREACH caused quite an uproar amongst the Qt developers who follow this blog.

I personally feel that this was caused fundamentally by a perceived threat: there is a cost associated to porting away a codebase from a well-known construct (Q_FOREACH) to a new and yet-undiscovered construct (C++11’s range based for), especially when the advantages are not that clear. (With stronger advantages, maybe people would be more keen …

Writing Code That Won’t Kill A Functional Safety Source Book

Functional Safety is the term used for systems designed to minimize risk to human health. But there’s a dilemma in today’s tech-driven world.

We are more reliant than ever on software to control our planes, trains, cars, and boats, to operate our medical equipment, to process our food, to clean our water, and to power our homes. If these systems don’t function properly, they have the ability to injure, or even kill us. Meanwhile software complexity continues to increase exponentially …

Fixing bugs via lateral thinking

For today’s blog I would like to share with you the little adventure I had when fixing a very strange bug in Qt.

Pop quiz

Don’t think about this too much, just guess: what does this QML snippet print?

import QtQuick 2.0

QtObject {
    Component.onCompleted: {
        console.log("240000000000" == "3776798720");
    }
}

There are no JavaScript semantic tricks involved; and using either == or === does not change the result in any way.

Did you get it?

Pop quiz (2)

Here’s …

Fuzzing Qt for fun and profit A brief introduction to fuzzing and how we successfully use it in Qt

Many KDAB engineers are part of the Qt Security Team. The purpose of this team is to get notified of security-related issues, and then decide the best course of action for the Qt project.

Most of the time, this implies identifying the problem, creating and submitting a patch through the usual Qt contribution process, waiting for it to be merged in all the relevant branches, and then releasing a notice to the users about the extent of the …

KDAB talks at QtCon 2016

Hello!

This is a small wrap-up fromQtCon, the biggest Qt event in Europe in 2016, that happened at the beginning of September. At QtCon the Qt community joined forces with the KDE, FSFE and VideoLAN communities, to create an exciting event in the spirit of open collaboration and participation amongst projects.

During QtCon many KDAB engineers gave in-depth technical talks about Qt, QML, Qt3D, OpenGL and the other technologies around Qt development. All the sessions …

Goodbye, Q_FOREACH A Porting Guide to C++11 Ranged For-Loops

Q_FOREACH (or the alternative form, foreach) will be deprecated soon, probably in Qt 5.9. Starting with Qt 5.7, you can use the QT_NO_FOREACH define to make sure that your code does not depend on Q_FOREACH.

You may have wondered what all the fuss is about. Why is there a continuous stream of commits going to into Qt replacing Q_FOREACH with C++11 ranged for-loops? And why does it take so many commits and several Qt versions to port away …

Qt on Android: How to restart your application

Some time ago, I wrote a code to restart the running application on Android.

You might well ask why such a thing was needed. It was needed because there are cases where, whenever a user changes the theme, the application has to restart to apply the change (it can’t be applied on the fly). In my example I used it to restart Qt Quick Controls 2 gallery.

Sadly my fix was not accepted, because other platforms (iOS, IIRC) have this …

KDAB, Qt 3D and the Release of Qt 5.7

Some of you may know that Qt 3D is going strong almost entirely due to the work of the KDAB team, led by Dr. Sean Harmer and Paul Lemire. You can read all about its near demise and ultimate rescue here – it’s quite a story, and started with the release of Qt 4.

Now we are approaching another major chapter in the Qt 3D story, as Qt 5.7.0 is released along with a fully supported stable Qt 3D module. …

Very explicit operator bool Is the Safe Bool Idiom still useful in C++11 / C++14?

From time to time I scroll through Qt-related forums and mailing lists, and whenever possible I try to help fellow developers out. The other day a StackOverflow thread caught my attention: a developer was asking “What is the purpose of operator RestrictedBool in QScopedPointer?”

Indeed, looking at QScopedPointer‘s implementation, one notices the strange RestrictedBool usage. Removing the other code, the bulk is:

template <typename T, typename Cleanup = QScopedPointerDeleter<T> >
class QScopedPointer
{
    typedef T *QScopedPointer:: *RestrictedBool;
public:
    inline 

Faster than Fast String Search in Qt

Is your code burning a lot of cycles hunting for strings? Maybe you need to find the proper charset nestled in a chunk of HTML, or look for the dimensions in an XPM image file, or locate the email attachment boundaries in a block of MIME. If you string search a lot and performance is important to you, you’ll want to keep reading!

You may have encountered Boyer-Moore string searches if you have a formal education in Computer Science or …