View Full Version : Conan 0.9.7 - Connection analyzer for Qt

21st June 2010, 15:07
Conan version 0.9.7 has just been released and finally brings Qt 4.6 support.
It is available under GPL at http://sourceforge.net/projects/conanforqt.

When working on a large Qt software project the amount of signal-slot connections can really go through the roof. During run-time I often want to know what is connected to what. I also regularly want to know how often and when a specific signal is emitted. In general I just want some proper signal-slot debugging.
Unfortunately, Qt provides next to nothing for this. Sure you've got QObject::dumpObjectInfo, QObject::dumpObjectTree and the QSignalSpy, but their use is very limited and unpractical. So I decided to make my own signal-slot debugging library called Conan. It is real easy to use and has helped me locate multiple duplicate signal connection in Qt's own libraries. So if you ever need some signal-slot introspection, try Conan. I hope you will find it usefull!

Conan 0.9.7 - Connection analyzer for Qt 4.6.0 - Qt 4.6.3

Conan is a C++ library that provides run-time introspection of object
hierarchies, object inheritance, signal/slot connections, and signal

Conan contains a single widget (conan::ConanWidget) that provides the
following functionality:
-object hierarchies can be added, discovered, browsed and exported to XML
-signals/slots, including active connections, can be examined
-duplicate connections can be found
-signal emissions can be monitored and logged
See /doc/html/index.html for detailed information.

Contact - edekoning@gmail.com
Website - http://sourceforge.net/projects/conanforqt
License - GPL - source code -> see ./GPL.txt
CCL - icons -> see ./icons/CCL.txt

Conan was made using the following tools:
-Silk icons made by Mark James available at FamFamFam
-Qt SDK Open Source Edition, available from Nokia
-Visual C++ 2008 Express Edition, available from Microsoft
-Doxygen by Dimitri van Heesch, for source code documentation
-SourceForge, which hosts this project

Feel free to contact me for suggestions, remarks, bugs, feature requests,
or anything else Conan related.

Conan demo package

The Conan demo package contains an application that demonstrates the use of
Conan. It shows the conan::ConanWidget and a console window that captures
the output of the signal loggers. The conan::ConanWidget contains itself as
root object, so it can be used to examine to internals of Conan.

For more information about the use of the conan::ConanWidget see the
generated documentation /doc/index.html.

The Conan Demo application has been tested on:
-Windows XP SP3
-Windows Vista SP2 32bit
-Windows 7 32bit

Conan source package - installation

Conan provides both a Visual Studio 2008 project file (/win32 folder) and a
pro file (/conan.pro) for use with QT Creator and qmake. Whichever you
choose, make sure the following environment changes have been made:
the root dir of where QT has been installed to
should be set to the platform your compiling for, f.e.:
win32-msvc2008. The qmakespec is used to include the proper
platform specific private qt headers.

The following paths are used to find all Qt headers used by Conan:

All sources are located in /src folder, including generated moc, ui and qrc
files. With Visual Studio these files can be regenerated using the build
rules as specified in the QTRules.rules file, located in the /win32 folder.

Note that Conan uses parts of the private non-documented Qt-API. This is
needed to be able to retrieve all the connection information. As such there
is no guarentee that Conan will continue to build after switching to a
different (non-supported) Qt version. Use of the private Qt-API has been
restricted to a single header: /src/ConanWidget_p.h

In case you are not using the Open Source Edition of Qt, it could be that
you do not have access to the complete Qt source code. Normally these
sources are located in $(QTDIR)/src. The file /src/ConanWidget_p.h includes
the following Qt source files:
If you are missing these files I suggest downloading the appropriate Qt
Open Source Edition and using those sources.

Using Conan

After building Conan (see installation), link your project against the
generated import library Conan(d).lib and make sure your application can
find the Conan(d).dll. Furthermore, the /include folder should be part of
your include search path.

Make sure QT_NO_DEBUG_OUTPUT is not defined as it will disable signal spy

To create and show the Conan widget in your application, all you need to do
is add the following lines of code:

#include <Conan.h> // checks for proper qt version and pulls
// ConanWidget into the global namespace

Q_INIT_RESOURCE (Conan); // necessary on some platforms when Conan
// is build as a static library
ConanWidget widget;
widget.AddRootObject (myMainWindow); // optional
widget.AddRootObject (someOtherObject); // optional
widget.show ();

For more information about the use of the Conan widget see the generated
code documentation /doc/html/index.html.

Conan 0.9.2 release

-There was a problem with conan::priv::BuildSlotData, where a signal->signal
conection would be processed as a signal->slot connection.

Feature additions:
-Added a tool button that searches for duplicate signal connections. Such
connections are marked yellow.

-Added support for Qt 4.5.0
-Changed the README.txt with information on how to use Conan with a
commercial edition of Qt

Conan 0.9.4 release

-There was a problem with conan::priv::BuildSlotData while processing a
manually created connection. QSignalSpy and conan::SignalSpy are examples
of classes that create such connections. They do not have signals or slots
and are not processed by MOC. Instead they call the internal
QMetaObject::connect directly.

Feature additions:
-Added dynamic signal spies. A signal spy monitors the emissions of a
single signal. Information about each emissions is logged using a
customizable format.

-Added support for Qt 4.5.1
-Updated the README.txt and extended the documentation about using Conan in

Conan 0.9.5 release

-Fixed a problem with deleting multiple signal spies from the sinal spy table.

-Added support for Qt 4.5.2
-Added project file for use with the Qt Creator IDE and or qmake

Conan 0.9.7 release


Feature additions:
-Added export to xml option.
-Added class info viewer for showing data set with Q_CLASSINFO.

-Added support for Qt 4.6.0 - Qt 4.6.3
-Dropped support for Qt versions older then 4.6.0

Known issues:
-The list of signals for the current selected object only shows 'out' connections where the
current object is the 'sender'. Suppose the following connection exists:
objectA::signalA() --> objectB::signalB(). This connection will be shown when objectA is
selected, but not when objectB is selected.
-Since Qt 4.6.0, it is required to lock a specific mutex before accessing the connection data
of an object. Unfortunately, this mutex is only accessible from within qobject.cpp. This
means that conan::ConanWidget is not thread safe. To be fair, this is not such a big deal
during normal use. Connections are usually made during or after Object construction, and for
the large part this is done on the gui thread (where Conan lives).

Copyright (C) 2008 - 2010 Elmar de Koning, All Rights Reserved