Skip to content

Qt

Tremendous Speed-Up with SQL Transactions

The function CustomerDatabase::importCustomers reads 500 customers from the list c_customers, creates an SQL query cmd for each customer and inserts each customer into the Customers table of the SQL database db.

void CustomerDatabase::importCustomers() {
    auto db = QSqlDatabase::database("CustomerDB");
    for (auto row : c_customers) {
        auto cmd = QString{"INSERT INTO Customers "
                   "(fullName, street, postalCode, city, phone, email) "
                   "VALUES (\'%1\')"}.arg(row.join("\', \'"));
        auto query = QSqlQuery{cmd, db};
    }
}

On an NXP i.MX6 SoC with four Cortex-A9 cores, this function takes 17.5 seconds! Your user would have to wait more than 17.5 seconds for the import of a CSV file with 500 customers to finish. This is unacceptable. How can you speed up the import to 0.2 seconds?
Read More »Tremendous Speed-Up with SQL Transactions

Simplifying Loops with C++11 in Qt Ways

Recently, I looked through the code base of a medium-sized project to see how I could simplify handwritten for-loops by using C++11’s new range-based for and STL algorithms with lambda expressions. The results in short: Range-based for makes loops simpler, easier to understand and often faster. STL algorithms are often a bit harder to read and write than range-based for loops, because lambda expressions are pretty clumsy, algorithm naming is inconsistent, and algorithm interfaces are inconvenient. But, they are still better than handwritten for-loops.
Read More »Simplifying Loops with C++11 in Qt Ways

Using Qt 5.6 and Later under LGPL

Up to Qt 5.3, things were pretty simple. Most modules were under LGPLv2.1 with the exception of some commercial modules. Starting with Qt 5.4, new Qt modules were published under LGPLv3 and old modules additionally under LGPLv3. With Qt 5.6, we now have quite a patchwork of modules under different licenses. Qt 5.7 will drop LGPLv2.1 completely. Some companies stay on Qt 5.3, because they are afraid of LGPLv3. Let me bring some clarity into this patchwork and explain how you can still use Qt under LGPL and sleep well.
Read More »Using Qt 5.6 and Later under LGPL

Remote Support for Harvester Terminal via VNC

The maize harvest is in full swing. The harvester runs nearly 24/7. The driver notices a drop in the area cut per hour. He calls tech support and starts sharing the screen of the terminal in the harvester. The support technician guides guides the driver through changing some machine parameters. All is fine again. My Italian business partner, Ispirata, and I developed a VNC server for the Freescale i.MX53 terminal of Krone’s BiGX forage harvester – to make this scenario possible.
Read More »Remote Support for Harvester Terminal via VNC

Running a QML HMI on an ARM11 without OpenGL

Recently, I brought up Qt 5.5 on a Freescale i.MX35, which has an ARM11 CPU but no OpenGL support. Despite the missing OpenGL, I wanted to write the HMI with QML. The additional challenge was that the cross-compilation toolchain was 32-bit, but I wanted to use my standard 64-bit Ubuntu. I’ll show in this post how to set up the 32-bit toolchain and rootfs on my 64-bit Ubuntu machine, how to configure and build Qt 5.5 from the sources, and how to run a hello-world application written in QML on the i.MX35.Read More »Running a QML HMI on an ARM11 without OpenGL

Responsive QML HMIs with File Selectors

In my previous post, I have shown how to use scaling to adapt QML HMIs to different screen sizes and formats. We reach the limits of scaling if we must change the structure of the HMI or if the HMI must be pixel-perfect. The solution to these problems is to provide a different implementation for each screen size. Switching between these different implementations is done with QML file selectors.
Read More »Responsive QML HMIs with File Selectors

Responsive QML HMIs with Scaling

The HMIs of in-vehicle infotainment systems, TVs, phones and many other systems must adapt to different screen resolutions and formats. This adaptation should happen with as little duplicate effort as possible. The simplest way of doing this for QML HMIs is to scale the values of all x, y, width, height, margin and border properties in proportion to a reference resolution. Based on the HMI of a music player, I’ll show you how to do this by changing only the screen width and height. Read More »Responsive QML HMIs with Scaling