Skip to content

Nailing 13 signal and slot mistakes with clazy 1.3

Today I want to share 13 mistakes regarding signals, slots and connect statements and how to find them at compile time with clazy, our open-source static-analyzer for Qt.

Clazy is a compiler plugin which generates warnings related to Qt. You can read more about it in our previous blog posts:

Today’s instalment is exclusively about signal/slots, since …

Clazy Results Visualizer for Qt Web UI to view clazy and gcc warnings

Clazy is a clang plugin which extends the compiler with over 50 warnings related to Qt best practices ranging from unneeded memory allocations to API misuse. It’s an opensource project spawned by KDAB’s R&D efforts for better C++ tooling.

Today, we’re proud to announce a Clazy Web UI to view all warnings emitted by Clazy, as well as normal gcc/clang issues.

Furthermore, we’ll be hosting it publicly for the Qt code base. This means that you can now head …

clazy 1.2 released presenting 5 new Qt compile-time checks

In the previous episode we presented how to uncover 32 Qt best practices at compile time with clazy. Today it’s time to show 5 more and other new goodies present in the freshly released clazy v1.2.

New checks

1. connect-not-normalized

Warns when the content of SIGNAL(), SLOT(), Q_ARG() and Q_RETURN_ARG() is not normalized. Using normalized signatures allows to avoid unneeded memory allocations.


    // warning: Signature is not normalized. Use void mySlot(int) instead of void mySlot(const int) 

Uncovering 32 Qt best practices at compile time with clazy

In a previous blog post we introduced clazy, a clang plugin which makes the compiler understand Qt semantics, allowing you to get compile-time warnings about Qt best practices ranging from unneeded memory allocations to misuse of API, including fix-its for automatic refactoring.

Today we’ll do a round-up and present the checks related to connect statements, Qt containers (including QString) and misc Qt facilities.


1. old-style-connect

Finds connect() statements still using the old SIGNAL()/SLOT() syntax. The Qt …

How to use static analysis to improve performance

It’s usually said “only improve performance where a profiler tells you to“. I don’t completely agree.

  • Take a big C++ library like Qt: can you profile all classes and all code paths ? It would take a couple of years to accomplish and analyse the results.
  • It’s expensive: It usually only happens if the speed-up is big enough to justify the needed skilled developer time. Customers don’t pay for a 10% speed gain for a desktop application. Even

KDAB contributions to Qt 5.4: qmllint

One type of bug I see very often comes down to syntax errors in QML and JavaScript files. Most of the time these errors are simple typos; however, they creep in, go unnoticed by continuous integration and sometimes reach production — especially on delayed loaded components.

I like fixing bugs, but what I love even more is not fixing them, so I wrote a command line tool that can easily be integrated into our CI system so we can …

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.