Qt 6 Additional Libraries via Package Manager

With Qt 6 we want to provide more flexibility via leveraging a package manager in addition to Qt Online Installer. The new package manager functionality, based on conan.io (https://conan.io), allows providing more packages to the users without increasing the complexity of the baseline Qt. In addition to the packages provided by Qt, the package manager can be used for getting content from other sources. 

Graphics in Qt 6.0: QRhi, Qt Quick, Qt Quick 3D

Last year we had a three part blog series about Qt's new approach to working with 3D graphics APIs and shading languages: part 1, part 2, part 3. For Qt Quick, an early, opt-in preview of the new rendering architecture was shipped in Qt 5.14, with some improvements in Qt 5.15. With the release of Qt 6.0 upcoming, let's see what has happened since Qt 5.15. It will not be possible to cover every detail of the graphics stack improvements for Qt Quick here, let alone dive into the vast amount of Qt Quick 3D features, many of which are new or improved in Qt 6.0. Rather, the aim is just to give an overview of what can be expected from the graphics stack perspective when Qt 6.0 ships later this year.

Note that the documentation links refer to the Qt 6 snapshot documentation. This allows seeing the latest C++ and QML API pages, including all changed and new functions, but the content is also not final. These links may also break later on.

Cutelyst 2.13 and ASql 0.19 released

Cutelyst the C++/Qt Web Framework and ASql the ASync SQL library for Qt applications got new versions.

Thanks to the work on ASql Cutelyst got some significant performance improvements on async requests, as well as a new class called ASync, which automatically detaches the current request from the processing chain, and attaches later on when it goes out of scope.

With the ASync class you capture it on your ASql lambda and once the query result arrives and the lambda is freed and the ASync object gets out of scope and continues the processing action chain.

KDAB's fix on a 10 year old bug raised my attention back to a note on QTcpSocket documentation:

Note: TCP sockets cannot be opened in QIODevice::Unbuffered mode.

Which is actually wrong, according to the source code, Cutelyst has been using buffered mode since always due that, so hopefully this new version will be a bit faster and consume less memory, it's important to notice that once the Kernel tells it's going to block QTcpSocket writes get buffered anyway.

Now talking about ASql you might notice the jump on release versions, this is because I've been experimenting some changes and didn't want to write a post at each new feature.

ASql is now at the closest API I'd like it to be, unfortunately one of my goals that would be to be able to handle it's AResult object to Grantlee/Cutelee and be able to iterate over it's records just once, but the call QVariant::canConvert with QVariantList must succeed and the class be able to be casted to QAssociativeIterable or QSequentialIterable, which I didn't managed to get it working in a way I like.

But AResult has hash() and hashes() methods that convert the data to a format that can be used in templating.

On the plus side I added iterators (if you have experience with iterators please review my code as this was the first time I wrote this kind of code) that also work on for ranged loops, and they also have faster type conversion methods, instead converting the data to a QVariant type, and them using QVariant to get the data out of it, one can just call toInt() which will get the int straight from the result set without checking each time if it's an int.

Added AMigrations which is an awesome database maintenance class that is both simple and helpful to maintain database schemas.

  • ACache class to cache special queries
  • Support for data inside QJsonValue
  • Single Row mode (the lambda get's called once per result)
  • Prepared Queries
  • Scoped Transaction class
  • Notifications - this is my favorite PostgreSQL feature, it's hard to image some other big databases lack such an useful feature.

Oh, and Cutelyst results on TechEmpower already got better thanks to ASql, hoping to see even better results when I update the tests to 2.13 that has Unbuffered and faster async handlying.

https://github.com/cutelyst/asql/releases/tag/v0.19.0

https://github.com/cutelyst/cutelyst/releases/tag/v2.13.0

Release 3.7.0: Bluetooth LE (Low Energy) with QML, Apple Sign In, Secure Keychain Storage

Felgo 3.7.0 adds new QML APIs to use Bluetooth LE from QML in your Qt and Felgo apps. This gives you a convenient way to use Bluetooth LE to connect to IoT, wearables and other custom devices, directly from QML, without any C++ code. This update also adds a lot of new components, features, improvements and fixes.

This blog post is the first one of a short series of posts to show you everything that is new with Felgo 3.7.0, so make sure to stay in the loop!

What's New in QMetaType + QVariant

As you might know, Qt has a metatype system which provides run-time dynamic information about types. It enables storing your types in QVariant, queued connections in the signal slot system and is used throughout the QML engine. With the upcoming Qt 6.0 release, we used the chance to revisit its fundamentals and make use of the functionality that C++17 gives us. In the following, we examine those changes, and explain how they might affect your projects.

KD Chart 2.7.2 released!

KDAB has released KD Chart 2.7.2, the final release in the KD Chart 2.7 series. This is a very minor release; however, it’s significant in that it may be the final release of KD Chart that will support Qt 4.

KD Chart is a comprehensive business charting package with many different chart types and a large number of customization options. We are constantly improving the package, and have been doing so for years.

The following changes come with KD Chart 2.7.2:

  • CMake buildsystem – option BUILD_PYTHON_BINDINGS => KDChart_PYTHON_BINDINGS
  • CMake buildsystem – option PYTHON_BINDINGS_INSTALL_PREFIX => KDChart_PYTHON_BINDINGS_INSTALL_PREFIX
  • Fix static linking examples and unittests in the CMake buildsystem
  • small buildsystem improvements

Find out more about KD Chart here.

Login to your KDAB customer account or create a KDAB customer account here, to download a GPL license of KD Chart.

To discuss licensing options, contact us at sales@kdab.com.

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post KD Chart 2.7.2 released! appeared first on KDAB.

ESE Kongress 2020 Online

Der ESE Kongress ist die Leitverantaltung für Embedded Software Engineering in Deutschland.

In diesem Jahr findet er erstmals digital statt, so dass die Teilnahme auch per Video möglich ist. An fünf Tagen gibt es 3 Keynotes und 96 Fachvorträge aus allen Bereichen der Embedded Softwareentwicklung.

Am 1.12.2020 um 9:00 Uhr spricht Anton Kreuzkamp von KDAB über maßgeschneidertes Code-Refactoring mit Clang-Tooling. Titel: Kann das nicht der Compiler machen?

Kurze Zusammenfassung: Jedes Software-Framework und Projekt bringt üblicherweise eigene Best-Practices und Tücken sowie oftmals historisch bedingten Balast. Mit der Zeit bildet sich in jedem Team ein Schatz an Erfahrungen und Konventionen aus, wie die genutzten Bibliotheken effizient, performant und korrekt verwendet werden können. Diese Erfahrungen konsequent in großen Codebasen umzusetzen und Regressionen zu vermeiden, erfordert allerdings sorgfältige Reviews und umfangreiche Schulung neuer Kolleg*innen.

Auch hier kann gutes Tooling uns viel Arbeit abnehmen. Das umfangreiche Clang Compiler Framework bietet die ideale Basis dafür, oftmals auch dann, wenn Clang auf der Zielplatform nicht unterstützt wird.

Anhand konkreter Beispiele aus dem Embedded- und Automotive-Sektorzeigt der Vortrag, wie das Clang Compiler Framework verwendet werden kann, um veraltete Praktiken oder ineffiziente API Nutzung nicht nur zu entdecken, sondern auch automatisiert zu beheben. Es wird das Codemodell betrachtet, das Clang intern aufbaut und wie dieses verwendet werden kann, um Code zu verstehen und zu verändern, ohne Struktur, Formatierung oder Kommentare zu verlieren.

Das gesamte Programm finden Sie hier https://ese-kongress.de

Anton Kreuzkamp

Anton Kreuzkamp entwickelt professionelles Software-Tooling, insbesondere für Qt Entwickler. Er ist langjähriger Entwickler des Introspection-Tools GammaRay, das als freie Software mittlerweile zur Grundausstattung der meisten Qt-Entwickler gehört. Er studierte Physik an der Universität Heidelberg und entwickelt seit 10 Jahren mit C++. Angestellt bei KDAB, greift er als erfahrener Softwareentwickler Kunden bei schwierigen Problemen unter die Arme und schult als Trainer den Umgang mit fortgeschrittenen Features aus modernem C++.

The post ESE Kongress 2020 Online appeared first on KDAB.

Qt 6.0 Beta Released

I am pleased to announce that we released the first beta of Qt 6.0 today. We have provided multiple pre-release snapshots of Qt 6.0 during the past months and Qt 6.0 has now reached the milestone to start the beta phase. Throughout the beta phase we will continue to provide subsequent beta releases via the online installer.

There is a huge number of things to talk about when it comes to the features and functionality of Qt 6.0, so I will leave this to the multiple detailed blog posts about Qt 6.0. We have already published many blog posts about all the cool things Qt 6.0 provides, and will continue to publish more blog posts throughout the year. In the upcoming Qt World Summit Online we have lined up many interesting talks about Qt 6.0, so please join to hear more. 

There and Back Again

A few days ago, a customer using our KD Soap library reported an interesting problem with it. The library worked perfectly to access the SOAP server, but there was some noticeable latency when doing a series of requests in short succession from the client. This latency should not have been there, as both the server and the client were in the same local network.

An investigation began, regarding whether the client code or KD Soap were doing something suboptimal, like reconnecting to the server all the time, or something like that. The actual reason turned out to be something much more profound: a 6-year-old bug in QNetworkAccessManager (at least, that’s when it was reported. I think the bug is at least 10 years old…)

What’s QNetworkAccessManager (or QNAM, for the friends)? It’s the central class in Qt to issue HTTP/FTP requests (incl. HTTPS, HTTP/2, etc.); KD Soap uses it to implement SOAP over HTTP.

Did you know?
In Qt Creator, you can type just upper case letters of a class name (like QNAM, QAIM, QSFPM) — and Creator will offer to autocomplete it for you!

So, “not our bug”, problem solved… maybe for us, but certainly not for our customer!

Therefore, I took a shot at the issue anyhow, as personal curiosity. (Mandatory reminder: KDAB contributes a lot of code to Qt!)

The problem

Using a network sniffer like Wireshark, the problem quickly emerged: each SOAP request, transported through a POST method, was sent by QNAM split over multiple TCP segments.

Let’s analyze the packet dump together. We have 192.168.1.1, which is the client running KD Soap, and 192.168.1.254 running a HTTP server.

In the first few exchanged segments, nothing special happens:

No.     Time           Source                Destination           Protocol Length Info
      2  0.003375      192.168.1.1           192.168.1.254         TCP      66     55212 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM=1
      3  0.003504      192.168.1.254         192.168.1.1           TCP      66     80 → 55212 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 SACK_PERM=1 WS=128
      4  0.003578      192.168.1.1           192.168.1.254         TCP      54     55212 → 80 [ACK] Seq=1 Ack=1 Win=2102272 Len=0
      5  0.003702      192.168.1.1           192.168.1.254         TCP      333    55212 → 80 [PSH, ACK] Seq=1 Ack=1 Win=2102272 Len=279 [TCP segment of a reassembled PDU]
      6  0.003781      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=1 Ack=280 Win=30336 Len=0
      7  0.003815      192.168.1.1           192.168.1.254         HTTP/XML 349    POST / HTTP/1.1 
      8  0.003894      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=1 Ack=575 Win=31360 Len=0
      9  0.005749      192.168.1.254         192.168.1.1           HTTP/XML 655    HTTP/1.1 200 OK 

In order:

  • Segments 2-4 are the typical TCP three-way handshake, connecting to the server.
  • Segment 5 contains the first part of the first SOAP request.
  • Segment 6 quickly acknowledges the data sent by segment 5.
  • Segment 7 completes the first SOAP request (that is, completes the HTTP POST).
  • Segment 8 acknowledges the data sent in segment 7. (Note: Please ignore the length field — it does not refer to the TCP data length, but to the request length; that’s why the acknowledged data does not match.)
  • Segment 9 sends the result back to the client.

The whole exchange (establishing the connection, sending the request, getting an answer) took less than 3 milliseconds. Pretty reasonable, considering everything is happening inside the same local network.

Now this is when things start going wrong. The client did not make just one request; it made several, in quick succession. These requests got queued inside QNAM. QNAM implements HTTP persistent connections, so the TCP connection is not immediately shut down after the request has been served. Instead, once QNAM receives the reply, it’s able to immediately send another request. This happens in the next exchange:

No.     Time           Source                Destination           Protocol Length Info
     10  0.006527      192.168.1.1           192.168.1.254         TCP      333    55212 → 80 [PSH, ACK] Seq=575 Ack=602 Win=2101760 Len=279 [TCP segment of a reassembled PDU]
     11  0.049994      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=602 Ack=854 Win=32512 Len=0
     12  0.050063      192.168.1.1           192.168.1.254         HTTP/XML 349    POST / HTTP/1.1 
     13  0.050269      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=602 Ack=1149 Win=33536 Len=0
     14  0.051334      192.168.1.254         192.168.1.1           HTTP/XML 655    HTTP/1.1 200 OK 

Here we have:

  • Segment 10 acknowledges the data received by the server, and sends part of a new request.
  • Segment 11 acknowledges the data for the new request.
  • Segment 12 completes the request (sending more data).
  • Segment 13 acknowledges the data sent to complete the request.
  • Segment 14 sends the result back to the client.

It looks pretty much like the last exchange, minus establishing the connection, doesn’t it? There’s however a small but important difference: if you carefully look at the timestamps, you may notice that this request took almost 50ms to be served! That’s 10-20 times more than the first one!

If we keep going, we have another request, and this one also takes 50ms:

No.     Time           Source                Destination           Protocol Length Info
     15  0.052316      192.168.1.1           192.168.1.254         TCP      333    55212 → 80 [PSH, ACK] Seq=1149 Ack=1203 Win=2100992 Len=279 [TCP segment of a reassembled PDU]
     16  0.099992      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=1203 Ack=1428 Win=34560 Len=0
     17  0.100047      192.168.1.1           192.168.1.254         HTTP/XML 349    POST / HTTP/1.1 
     18  0.100315      192.168.1.254         192.168.1.1           TCP      60     80 → 55212 [ACK] Seq=1203 Ack=1723 Win=35712 Len=0
     19  0.101336      192.168.1.254         192.168.1.1           HTTP/XML 655    HTTP/1.1 200 OK 

These delays would just keep piling up; in order to send 20 requests we take over one second, rather than less than 0.1s (as it should be). What’s going on here? Where do these delays come from?

Diagnosis

As hinted in the bug report, the problem is a very subtle interaction between QNAM and the underlying TCP stack. The TCP protocol itself, as well as the API that operating systems offer to use it (e.g. the socket(2) APIs on Unix) feature a lot of knobs to fine tune TCP’s behavior. This is intentional, and done in order to make it perform better: reduce latency, increase the used bandwidth, reduce the number of segments exchanged on the network. Some of these knobs are entirely opt-in because whether they make sense or not depends on the application.

A couple of these optimizations are usually enabled by default, and are the cause of the problem here.

The first one is called delayed acknowledgments. In order to reduce the load on the network, one side of a TCP connection may decide to wait a bit before sending out an acknowledgement for the data it has just received. (Of course, it must not wait too much, or the sender may trigger a retransmission thinking that the data it just sent got lost!) It’s a pretty simple idea: give the other side the chance of sending more data; if this happens, the receiving side may send only one segment acknowledging all the data received. (Yes, this is perfectly legal in TCP.)

The second one is called Nagle’s algorithm. This is an algorithm that again tries to reduce the network load by having one side not transmit data too often (until certain conditions are met). The idea is that if a TCP application has to send small chunks of data, it would be better for the TCP stack to buffer all the data and then send it out in one segment. Of course, sooner or later the data has to be sent, and the algorithm controls when.

How does QNAM manage to break all this? When QNAM has to issue an HTTP request with a body (such as POST or PUT), it does two different writes into the TCP socket: first it writes the HTTP headers, then it writes the body of the request. This “double write” causes an interesting chain of events:

  1. Client: QNAM writes the HTTP headers into the socket
  2. Client: the TCP socket sends the headers right away
  3. Server: receives the data, but does not send the ACK yet, because of delayed acknowledgments
  4. Client: QNAM writes the HTTP body into the socket
  5. Client: the TCP socket does not transmit the HTTP body, because Nagle’s algorithm says so (there is 1 pending acknowledgment)
  6. Nothing happens for 50ms
  7. Server: the delayed ack timer times out, so it sends the ACK (just for the HTTP headers)
  8. Client: receives the ACK, Nagle’s algorithm says it can transmit more data, so it sends the rest of the request
  9. Server: receives the rest of the request; the request is complete, the SOAP server handles it, creates a reply, sends the ACK for the rest of the request and the reply

Steps 2-4 can happen in a slightly different order, but the result does not change: we have a 50ms delay, introduced by TCP, which is affecting our requests.

Workarounds

What can we do to fix this? This should really be fixable: the overall data we want to transmit (headers+body) fits in one TCP segment — sending two and having to wait before transmitting the second sounds just wrong.

Note that we do not necessarily control the server, so disabling delayed ACKs is out of the question.

  • The first thing we could think of is to enable buffering on the TCP socket. QTcpSocket, like all QIODevice subclasses, can be opened in buffered or in unbuffered mode. By default, QNAM opens it in unbuffered mode: it does not want an extra copy of the data to be done (from the application, into the TCP socket, then into the kernel; and similarly the other way around). However, opening it in buffered mode does not help at all. What happens is that QTcpSocket copies the data into its own write buffer, and then immediately tries to flush it. Typically the kernel will allow the flush to happen (because there’s not enough outgoing data filling kernel’s outgoing buffers); and this results in the same chain of events, with each write (by QNAM) becoming a write into the kernel, and the second one being delayed by Nagle’s algorithm.
  • On the client, we could think of disabling Nagle’s algorithm. All operating systems offer a way to do so; the rationale is that if we have to frequently send small chunks of data we don’t want to wait for acknowledgements to arrive before sending the next chunk (think, for instance, to a SSH client that has to send individual keystrokes). This option is typically called TCP_NODELAY, and it’s even exposed in Qt by the QAbstractSocket::LowDelayOption socket option. For some reason, QNAM has a commented out call to set the option:
        // improve performance since we get the request sent by the kernel ASAP
        //socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
        // We have this commented out now. It did not have the effect we wanted. If we want to
        // do this properly, Qt has to combine multiple HTTP requests into one buffer
        // and send this to the kernel in one syscall and then the kernel immediately sends
        // it as one TCP packet because of TCP_NODELAY.
        // However, this code is currently not in Qt, so we rely on the kernel combining
        // the requests into one TCP packet.
    

    Not exactly sure why this comment was made. (This code was written before the Qt source code history had been made public in 2011.) I was not willing to revisit this, so I decided to leave it alone, at least for for the moment being.

  • The Linux socket API has the ideal option for this use case. It’s the TCP_CORK socket option. Its effects are to delay the sending of the data written into the socket until a timeout expires, or the option is toggled. This allows a client (or a server) to write in the socket multiple times, and the kernel will take care of coalescing the writes into fewer TCP segments. (The interesting bit is that the writes can happen using different system calls, such as write(2) for the headers followed by sendfile(2) for the body.). While this works, it’s of course OS-specific — there is nothing comparable for any other operating system — so it’s not a good candidate for fixing the problem in Qt (which is, after all, a cross platform toolkit).
  • Finally, the above comment in QNAM contains the actual solution. We can refactor QNAM to avoid writing the headers and then the rest of the request, using separate writes. Instead, it should try to combine them, if possible, into one single write. This should ensure that, once a complete request is sent by the client, the server can act on it and immediately write the reply.

I have implemented and submitted this last solution to Qt.

Enough talk! Give me the code!

Ok, ok… the patch that fixes the problem is here. At this time, it will only be present in Qt 6.0. Qt 5 is in “bugfix only” mode, and since this issue has been present throughout the entire Qt 5 history, it was not deemed safe to apply the change there as well.

Still, it doesn’t mean you cannot just cherry-pick the patch into your local build of Qt 5, if your applications are affected. It should apply without issues. In fact, the customer was able to try it out and confirm that it solves the original issue they were seeing. Whew!

The moral lesson

At first I didn’t want to write a blog post simply to discuss “yet another bugfix that landed into Qt”.

But then, I decided to take this opportunity to also say something else. Many of our customers are (positively!) surprised by the huge skillset found within KDAB. By hiring us, customers don’t get just someone to write some code for them; they get access to a great talent pool. Within KDAB there’s enormous technical knowledge. Each engineer is of course broadly skilled in computer science and programming, but they then have tremendous specialized skills in one or more focus areas:

  • Win32 programming? Check.
  • Low level debugging and profiling? Check.
  • 3D graphics? Check.
  • Usability and design? Check.
  • Hacking into bluetooth stacks? Check.
  • Embedded hardware? Check.
  • Cooking? Check.
  • Acrobatics? Check.
  • Aviation? Check.
  • Modern jazz? Check.
  • Mechanical keyboards? Check.
  • Beer crafting? Check, check, and check.

Valve’s Handbook for New Employees puts it in a very nice way:

We value “T-shaped” people. That is, people who are both generalists (highly skilled at a broad set of valuable things — the top of the T) and also experts (among the best in their field within a narrow discipline — the vertical leg of the T).

Or, to use the words of my ex-colleague Jean-Michaël:

All the above bugfixing story is actually about knowing how things work, all the way from HTTP, into Qt’s code, and down to low level details of TCP/IP programming. Does it mean that I’m just “that good” and happen to know just about everything? We both know that is not true.

This is possible, not only because KDAB hires T-shaped individuals, but also because it nurtures its employees so that their strong “vertical” skills can actually grow over time, while also embracing more “horizontal” skills. We are constantly encouraged in our professional growth, and that’s not something always found out there.

That’s what makes the difference for KDAB.

(If this made you curious about what it means to work with us, feel free to visit our careers page and drop us a line.)

In the meanwhile, thanks for reading!

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post There and Back Again appeared first on KDAB.

KD Soap 1.9.1 Release

We have released KDSoap 1.9.1

As part of our commitment to cross-platform solutions, KDAB offers developers KD SOAP, a web service access package for Qt applications.

KD Soap 1.9.1

This is a final release in this series, with just a few small changes to ensure continued support for those who want to keep using Qt4. Our next release in a few weeks (Version 1.10) will no longer support Qt 4.

Changes in this release

  • unittests onvif_org_event, onvif_ptz, onvif.org WSDL have been removed
  • static linking examples and unittests in the CMake buildsystem have been fixed

There have also been some minor buildsystem improvements and the correct EULA has been restored.

About KD SOAP

KD SOAP is a tool for creating client applications for web services. It makes it possible to interact with applications which have APIs that can be exported as SOAP objects. The web service then provides a machine-accessible interface to its functionality via HTTP. The remote method calls are handled with the SOAP standard, which describes method calls, their parameters and return values as XML documents.

KD SOAP is also a tool for creating web service server implementations. It makes it possible to export application APIs as SOAP objects. Web service client applications can then access these via HTTP. The KD SOAP server module contains all required functionality, allowing web service deployment without the need for an external web server.

Find out more

Download

On Github

Releases

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post KD Soap 1.9.1 Release appeared first on KDAB.

September ’20 – monthly digest

News

Qt Desktop Days 2020

by Charlotte Johansson

From September 7th to 11th, KDAB hosted, online, the very first edition of Qt Desktop Days, beginning with an event introduction from Kalle Dalheimer, KDAB’s CEO followed by a Keynote on Qt 6 for the desktop from Giuseppe D’Angelo.

On the following days we offered a wide range of technical talks from presenters across the globe, spanning open source and commercial. The event finished off with a lively Q&A session with key figures from the Qt community.

Over 500 attendees participated via the open source tool Big Blue Button, thanks to generous technical support from KDE, whose own event KDE Akademy (reviewed below) took place September 4th to 11th, using the same platform. We also live-streamed the talks on Youtube.

Our big thanks to everyone involved. We really couldn’t have done it without you!

We’ll be releasing all the talks as soon as they are processed. But we have one ready for you today. Watch the Opening address and ‘Qt 6 for the desktop. What can we expect?’, the Keynote from Giuseppe D’Angelo.

Read more…


Blogs

Full Stack Tracing Part 1

by Milian Wolff

Full stack tracing is a tool that should be part of every software engineer’s toolkit. It’s the best way to investigate and solve certain classes of hard problems in optimization and debugging. Because of the power and capability it gives the developer, we’ll be writing a series of blogs about it…

Read more…

Introducing KDDockWidgets

by Sérgio Martins

KDDockWidgets was born from my need to preserve sanity after having worked in two projects that needed extensive customization……. Furthermore, our customers were getting more creative with their requests, so it was clear we needed a better docking framework.

Read the blog…

How to Build C++ Projects with the Address Sanitizer on Windows

by Alessandro Ambrosano

Memory bugs are tricky. Leaks have a clear impact on performance, and quickly become hard to spot when heap allocated objects move too much. Memory access bugs, on the other hand, make your program crash right away, if you’re lucky. In less desirable cases, they may end up corrupting random objects on the heap, and only end up in a crash much later.

Read on…

Declarative Widgets!

by Nathan Collins

Here’s a blog on Declarative widgets, a QML plugin that adds Qt Widgets support to QML. This means we can now easily mix the power of QML with the comfort of a Widgets UI on desktop.

Read the blog…


Releases

KDDockWidgets 1.0 has been released

by Sérgio Martins

KDDockWidgets 1.0 released This release represents the culmination of one year of using the library in production for five different huge projects — one year of incorporating real feedback in the form of new features, bug fixes, or simply making the framework more customizable.

KDDockWidgets is Open Source (GPLv2 & GPLv3) and can be downloaded here.

Read more…

GammaRay 2.11.2 released

by Volker Krause and Frances Tait

We have released version 2.11.2 of our Qt application introspection tool GammaRay, bringing support for Qt 5.15 and improved Qt Quick item picking.

Find out more…

Heaptrack Version 1.2.0 Released

by Milian Wolff

We have just released version 1.2.0 of Heaptrack, the fast heap memory profiler for C++/Linux applications.

This is a maintenance release and brings a couple of important bug fixes and improvements…making Heaptrack more stable and error resistant while recording data.

Read more…

Hotspot Version 1.3.0 Released

by Milian Wolff

We are pleased to announce a new release of our Hotspot Linux perf performance analysis GUI: Hotspot version 1.3.0!

With this new release, Hotspot has become …magnitudes faster than it was in the previous releases.

Find out more…


Tutorial videos

Widgets widgets everywhere…

We definitely have a thing about widgets… and we think you should too 🙂

Yes, widgets are still alive and kicking. In the many years we have worked with them, we have gathered quite a number of tips and tricks that we’d love to share with you.

Check them out…


Trainings

Qt Widgets training – online (USA)

Qt Widgets for the desktop, March 2 – 4, 2021 Get up and running with Qt widgets with our 3 day course, running 9am to 4pm, CST, delivered by Jim Albamont. Attendance is limited to 12 to ensure personal attention.

Find out more and book now…


Events

KDE Akademy – Sept 4 – 11

KDAB’s Albert Astals Cid attended this year’s KDE Akademy – the first ever to be held online. Attendance exceeding realtime annual figures, (streaming observers not counted), demonstrating the upsides to not being able to meet in person. The recreational escape games ably substituted for at least some of the missing face-to-face exchanges. The program included several days of BoFs and workshops.

Read Albert’s review…

Qt World Summit online – Oct 22

Qt World Summit’s not just gone online, but virtual too! The one day program has now been published, with four tracks to choose from including a Keynote from Lars Knoll promising the very latest on Qt 6 in the run-up to its release this December.

Meeting C++ – Online Nov 12-14

KDAB is Gold sponsor at Meeting C++ and Marc Mutz will present ‘Partially-Formed Objects for Fun and Profit’.

Qt Day Italy – Online Nov 16 – 21

KDAB is Gold sponsor at Qt Day Italy. The program is to be announced.

 

The post September ’20 – monthly digest appeared first on KDAB.

Qt Widgets training – online (USA)

Qt Widgets for the Desktop – Online, 3 days

March 2nd to 4th 2021, 9am to 4pm CST, with Jim Albamont

What you’ll learn

The course covers Qt fundamentals, objects and widgets, Qt Creator and Designer, then takes you under the hood to learn about core classes, custom dialogs, layout management, painting, event handling, as well as the fundamentals of Qt’s model/view framework.

This class will give you the Qt skills and know-how to boost your productivity at work.  Small group size ensures personal attention and precisely targeted answers to your queries. All KDAB training classes offer world class tuition, best practice, examples and hands-on labs.

Seats are limited to 12 per class. Book now to ensure your seat. This class is confirmed to run.

Find out more and book your place…

About KDAB Training

KDAB has been providing market leading training for over 20 years. We offer courses in Qt, C++, 3D/OpenGL, Debugging and Profiling and much more, both on-site for your team and in our scheduled training classes. Normally, our classes are limited to 12 persons to ensure personal attention and this remains true for our online classes. For live classes during the Covid-19 pandemic, we accept a maximum of 5 students per class at our customised training facility in Berlin to guarantee safe social distancing. Find out more…

“The most professional and thorough software development training I have ever followed” – Siemens 

The post Qt Widgets training – online (USA) appeared first on KDAB.

Qt OPC UA updates

Qt OPC UA updates

The Qt OPC UA module has been ported to CMake and will be part of Qt 6 right from the first release.
In addition to numerous bug fixes and improved test coverage, the open62541 plugin has been updated to open62541 v1.1 and uses OpenSSL for security support, thus removing the dependency on mbedTLS.

Continue reading Qt OPC UA updates at basysKom.

Training & Workshops: For Beginner & Expert Qt Developers

Developing innovative, fully-functioning, and cutting-edge applications while maintaining consistency throughout and beyond the development phases can be a great challenge. To overcome these challenges, you need to provide the users with exceptional features on both backend and frontend. Mastering the skills of UI/UX design, debugging, profiling, or code performance are just a few of the areas that could help you take your app development to the next level.

Cutelyst 2.12 released

Cutelyst a Qt web framework got a new version, this version has one important fix for async apps using FastCGI or HTTP2, also fixes for SO_REUSEPORT, and as a new feature is has support for listen queue backlog on UNIX, sadly QTcpServer doesn't support both of these (I need to find time to write some patches...).

Cutelyst is available for many Linux distributions but doesn't for Debian/Kubuntu, so I'm also adding the CPack deb built will all but uWSGI support for 20.04 amd64.

Have fun https://github.com/cutelyst/cutelyst/releases/tag/v2.12.0

Released GitQlientPlugin 1.3.0 for QtCreator

I’m happy to announce the release of GitQlientPlugin 1.3.0

Three weeks ago I released a new version of GitQlient and now is the time to update the GitQlient plugin for QtCreator.

The new version of the plugin includes all the features already released in GitQlient. That includes the new tab system, the text editor as well as all the modifications in the UX/UI.

The binaries

You can find the binaries for GitQlientPlugin 1.3.0 on the release section on the GitHub repo. This time the plugin has come just after the release of Qt Creator 4.13, for that reason I’m providing versions for QtCreator 4.12 and 4.13.

Further work

Since GitQlientPlugin is a wrap of GitQlient, you can see the release planning and all the features that every release will contain in the Release Plan for GitQlient.

As always, if you’d like some feature or you’re missing something in GitQlient or in GitQlientPlugin, check that it’s not yet in the backlog and open an issue on GitHub!

Released GitQlientPlugin 1.3.0 for QtCreator first appeared on My C++ & Qt blog - Cesc M..

Announcing ASql - async Sql for Qt

When developing Qt applications be it Desktop, Mobile or Web that need to talk directly with a database the use of QtSql is usually the best choice, it has many database drivers, comes ready on their installer, but has a blocking API, which means a query will block you GUI thread.

My Cutelyst Web projects also used QtSql, and for low traffic this isn't a big issue because you are not freezing users GUI, but you are freezing the request queue instead.

One of the Cutelyst apps I developed this year has a very high traffic, and a side effect of blocking came in play, I've about 3k TVs connected via websockets, once a TV connects it does an authentication query, it takes ~17ms, now when there is an event PostgreSQL notifies the application which does some 20 other queries a little more expensive (~30ms) and send them to the TVs, this event also blocks the Cutelyst process.

Every TV does a websocket ping each 15 seconds to check if the connection is stalled, when that event happens plus some latency added 15s timeout and the TV disconnect, this of course happens with lots of TVs, so 1k TVs reconnecting will take around 17 seconds, this means new TVs disconnecting and the snow ball is done, system only recovers if I increase the DB hardware on AWS.

How can async fix this, you might be wondering, well the problem is that the 15s timeout happened to do a DOS on my own system, I can increase the value but when there are 10k TVs this will still be a problem, there are of course other ways to deal with this, but if the SQL query doesn't block the Cutelyst process it will be able to timely reply the Websocket's pongs.

ASql only supports PostgreSQL at time (PR are welcome), and depends on QtCore and libpq (PostgreSQL library), it can be used on Desktop apps and is 100% async from connection to queries, there's even a class to help with DB versioning and migration.

Check it out: https://github.com/cutelyst/asql

Qt & Android: Create a 2D Game using QML

Description

This tutorial describes how to easily create a Qt app for Android using an open source physics simulator engine.

The Github project Box2D is a feature rich 2D rigid body physics engine, written in C++ by Erin Catto. It has been used in many games.  The Github project qml-box2d was created by Thorbjørn Lindeijer.  He states the goal of the qml-box2d plugin is to expose the functionality of Box2D (C++) as a QML plugin in order to make it easier to write physics based software in QML by using simple QML commands to create Box2D bodies, joints, sensors etc.

Source code

This post is going to describe  how to get started with the QML plugin qml-box2d in just a few easy steps.  The complete sample app is found in Github at https://github.com/pgulotta/TestBox2D


Step 1

Clone qml-box2d from Github, https://github.com/qml-box2d/qml-box2d.   The project's README.md provides instructions on how to install the Qt plugin. Take a look  at the README.md to learn how robust BOX2D is. Note, for this example, there is no need to install the Qt plugin because the qml-box2d plugin will be statically linked to this sample project.  

Step 2

Create a new Qt Quick empty project named TestBox2D at the same directory level as the cloned qml-box2d Github project.   To the project file TestBox2D.pro, add a reference to the static library:
INCLUDEPATH += ../qml-box2d/Box2D
include(../qml-box2d/box2d-static.pri)

Build the TestBox2D for both Desktop and Android kits: armeabi-v7a. arm64-v8a. x86. x86_64.  Verify the apps run successfully.


Step 3

Since the qml-box2d Github project provides many QML examples, we will use one of the examples.  Copy the files and the images directory from qml-box2d/examples/mouse into the TestBox2D project directory. The file main.qml is overwritten. Next, copy the qml-box2d/examples/shared directory into TestBox2D project directory.  Update the file qml.qrc to reflect the additional files.  The contents of qml.qrc will look like:
<RCC>
    <qresource prefix="/">

        <file>main.qml</file>
        <file>Wall.qml</file>

        <file>shared/BoxBody.qml</file>
        <file>shared/ChainBody.qml</file> 
        <file>shared/CircleBody.qml</file>
        <file>shared/EdgeBody.qml</file>
        <file>shared/ImageBoxBody.qml</file>
        <file>shared/PhysicsItem.qml</file>
        <file>shared/PolygonBody.qml</file>
        <file>shared/RectangleBoxBody.qml</file>
        <file>shared/ScreenBoundaries.qml</file>

        <file>images/wall.jpg</file>

    </qresource>
</RCC>

Step 4

Since the TestBox2D is statically linked, all QML files must import Box2DStatic 2.0 and not Box2D 2.0.  So every QML file, including those in the shared directory, should have an entry such as:

//import Box2D 2.0
import Box2DStatic 2.0

For this project, the import statements in files main.qml and Wall.qml need to updated:

//import "../shared"
import "shared"  

Finally, in main.qml, change the Rectangle type to Window, visible: true,  and add the import of QtQuick.Window. Resulting in something like:

import QtQuick 2.2
//import Box2D 2.0
import Box2DStatic 2.0
import "shared"
import QtQuick.Window 2.15
Window {
visible:true
width: 800
height: 600
property Body pressedBody: null
... 

Step 5

To make the qml-box2d types available to the TestBox2D app, register the Box2DStatic plugin in main.cpp by adding a couple of lines of code resulting in:

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <box2dplugin.h>

int main( int argc, char* argv[] )
{
  QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
  QGuiApplication app( argc, argv );

  Box2DPlugin plugin;
  plugin.registerTypes( "Box2DStatic" );

  QQmlApplicationEngine engine;
  const QUrl url( QStringLiteral( "qrc:/main.qml" ) );
  QObject::connect( &engine, &QQmlApplicationEngine::objectCreated,
  &app, [url]( QObject * obj, const QUrl & objUrl ) {
    if ( !obj && url == objUrl ) {
      QCoreApplication::exit( -1 );
    }
  }, Qt::QueuedConnection );
  engine.load( url );
  return app.exec();
}


Step 6

Clean, build, and run the TestBox2D app on both for both the desktop and Android platforms (or any other Qt supported platform).  Try out the app by tossing and stacking the different sized boxes (rectangles) around.  Note how the boxes appear to have gravity, friction, and restitution.  

You can try out other examples by following the steps described above or by using the Qt qmlscene tool. Pretty darn awesome, right!