Skip to content
Volker Krause edited this page Nov 15, 2021 · 26 revisions

GammaRay - Radiograph your Qt Application

When trying to analyze bugs in your application, the debugger is usually the first tool of choice, and rightfully so. Debuggers allow you to follow the program flow and allow you to inspect the state of objects or variables. When using a debugger with proper Qt integration, such as in QtCreator, it will also handle Qt's own data types correctly. However, when dealing with complex frameworks this level of detail might be too low-level. Keeping an overview in a large QGraphicsView scene or following the complex interactions between models and views can quickly become a cumbersome task in a normal debugger.

GammaRay augments your conventional debugger by providing domain-specific debugging aids on a much higher level. It provides easy ways of navigating through the complex internal structures you find in some Qt frameworks, such as QGraphicsView, model/view, QTextDocument, state machines and more. Unlike the debugger, GammaRay understands those internal structures and can present them in a meaningful way.

GammaRay should not be missing in any Qt developer's toolbox. GammaRay is available both stand-alone and integrated in QtCreator and allows both inspection of Qt applications right from the start as well as attaching to a running Qt application later on.

There are a several other QObject introspection tools available, and of course the usual browsing of object properties, signals, slots and connections is also available in GammaRay, just like in-line displaying of widget boundaries and layouts. However, its real strength comes into play when looking at some of the more complex frameworks provided by Qt.

When working with QGraphicsView (either directly or via Qt Quick), you'll quickly value having a way to browse the scene graph and the various properties of the individual elements in there. GammaRay assists you in debugging transformation and layouting issues by giving you a second view on the scene graph, that allows free navigation and displays item boundaries, coordinate systems and transformation origins. Most properties can not just be inspected but also modified directly, so you can try out your improvements before even changing a single line of code.

The Qt model/view framework is another system that benefits immensely from a domain-specific debugging tool. GammaRay allows you to browse the content of any QAbstractItemModel found in your application, not matter if it's visible in any view or not. It can also display the hierarchy of proxy models as well as any intermediate result in a proxy model chain. Finally, it also allows you to inspect all selection models that are in use on top of any of your models.

GammaRay also allows you to observe your Qt state machines in real time and browse their structures and transitions.

It's a little known fact that Qt comes with a number of powerful debugging tools that are hidden inside the code. There's a full JavaScript debugger hidden in QtScript and a complete debugging and profiling suite for web application can be found in QtWebKit. GammaRay enables you to use those tools on any Qt application without having to integrate them each time again.

While less complex than a QWebPage, a QTextDocument is still complex enough to warrant dedicated tools for analyzing it's internal tree structure of frames, blocks and fragments down to individual characters. For each document element, GammaRay also allows you to inspect the corresponding format settings.

That's not the end though, GammaRay is designed to be extendable for additional domain-specific debugging aids, be it another framework provided by Qt, a component from another vendor or your own classes.

Clone this wiki locally