For starters, it's a powerful electromagnetic wave, as well as a way to treat cancer. It’s also an under-appreciated German speed metal band. And it’s what gives Dr. Bruce Banner his big green alter ego. But Qt aficionados will know the GammaRay that we're talking about is an uber-powerful Qt debugger and introspection tool. If you're not using it already, read on to find out why it should be part of your go-to toolkit.
Fig 0. Doc Bruce Banner, bathed in gamma rays
The GammaRay Qt debugger is metaphorically named after the medical treatment, for obvious reasons, once you know what it does. When you need to cure (debug) really invasive (complex) cancers (defects) in your patient (code), you sometimes need a powerful gamma ray (aka “GammaRay”).
Okay, so that’s the “what”, but why is it so great? Here are three big reasons why you need to stop procrastinating and start getting familiar with this world class tool.
1) GammaRay understands Qt. Your C++ debugger is only so smart. Sure, it can tell you the values of QObject properties, but it doesn’t grok them. GammaRay is built with an understanding of Qt—it understands things like object properties, object hierarchies, signals/slots, MVC architecture, and scene graphs, and shows these to you in an intuitive way. Unlike a plain old C++ debugger, GammaRay knows what all that moc stuff is actually doing to your code. “Just say no” to manually inspecting any more pointers in a Qt-unaware debugger.
Fig 1. Tracing through a Qt State Machine in GammaRay
2) GammaRay is visual. Do you use state machines but you can’t figure out why they’re misbehaving? Is your program generating tons of signals that cloud your visibility to the real problem? Is your MVC WTF? Sometimes getting a visual representation makes all the difference in the world for debugging big, complex problems, and GammaRay makes that easy with its domain-specific viewers. Using GammaRay means you’ll never again have to click through 10,000 properties to build a mental model of your running system’s data structures in your head, or scan through pages of log files looking for events evidence.
Fig 2. Looking at interactions of signals between three objects
3) GammaRay is read/write. With GammaRay, not only can you inspect object properties, you can change them in running code on the fly. We may have powerful CPUs and compilers, but C++ still has a compile step and the bigger the code, the more inconvenient that is. Tell the truth—aren’t you just a tiny bit jealous when you see Web developers in the Chrome debugger hacking their code live and seeing the results immediately in the browser? Yeah, thought so. GammaRay gives you that same power, whether you’re using Qt Quick, QtWidgets, QGraphicsView, or a custom mix thereof.
Fig 3. Finding the perfect color using GammaRay
Hopefully you’re convinced. Great! Although we've barely scratched the surface, it’s free and it’s here so you can start experimenting. We hope to bring you a number of deeper dives into what this tool can really do and how to maximize your use of it in the upcoming weeks…
The KDAB Group is a globally recognized provider for software consulting, development and training, specializing in embedded devices and complex cross-platform desktop applications. In addition to being leading experts in Qt, C++ and 3D technologies for over two decades, KDAB provides deep expertise across the stack, including Linux, Rust and modern UI frameworks. With 100+ employees from 20 countries and offices in Sweden, Germany, USA, France and UK, we serve clients around the world.
Andy Gryc
Co-Founder at Third Law autotech marketing
Andy Gryc is a Co-Founder at Third Law autotech marketing
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.