Latest posts — page 13

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(

Emitting Signals during Construction or Destruction

In the beginning, the application shows the Main Screen. When the user clicks on the Open button, the application will show a second screen. The second screen creates a C++ model when opened and destroys this model when closed. As

Monitoring Sys Files with QFileSystemWatcher

When the driver turns off the ignition in a vehicle, display computers like terminals in harvesters or infotainment systems in cars should be notified. The display computers should save important data and shut down orderly. When the display computer runs

QML Engine Deletes C++ Objects Still In Use

Correction: In the original post, I stated that ownership is transferred from C++ to QML by READ functions of Q_PROPERTYs. This is wrong. Ownership is only transferred by Q_INVOKABLE functions and slots, which return a QObject pointer. I

Converting a QByteArray into an Unsigned Integer

My program received messages from a network as an array of bytes. The sender of the messages encoded integers in Big Endian format. So, the hex number 0x1540 arrived in the sequence [0x15, 0x40]. I wrote the following function, which

Agritechnica 2017: What's New for Terminals?

Agritechnica 2017 was my third visit after 2013 and 2015. My focus was on terminals (display computers) as usual. The standard terminal of 2017 is powered by a quad-core NXP i.MX6 processor (32-bit ARM Cortex-A9 with ARMv7a architecture) and

New in Qt 5.10: Dynamic Language Change in QML

My favourite new feature in Qt 5.10 is the inconspicuous function QmlEngine::retranslate(). Finally, seven years after QML's birth, there is a Qt way to change the language of your application at runtime. There is no need

Pretty-Printing Output for QCOMPARE

We have created a custom class, say Person, and use it in a unit test. void TestPerson::testEquality() { Person p1("Alice", 42); Person p2("Bob", 37); QCOMPARE(p1, p2); } The unit test fails with this message.