Home

Preparing an application for inspection

For a Qt application to be inspectable using QtObjectInspector on Windows platforms, it must create an instance of the QtObjectInspector class. The source code for this class is in the package's src subdirectory. The simplest way to get a QtObjectInspector instance created in a Qt application is by doing the following:

Firstly add the following line to the application's .pro file:

win32: include(your-install-dir/qtobjectinspector-1.0-enterprise/src/inspector.pri)
This will add appropriate files to the HEADERS and SOURCES variables of your qmake project. It will also add the package's src subdirectory to the include path.

Secondly add

#ifdef QT_INSPECTOR_SUPPORT
#include <qtobjectinspector.h>
#endif
to the top of your main.cpp.

And finally, add

#ifdef QT_INSPECTOR_SUPPORT
QtObjectInspector object_inspector;
#endif
immediately after you create your instance of QApplication. QT_INSPECTOR_SUPPORT is defined from src/qtobjectinspector.pri whenever the debug option is present in the CONFIG qmake variable.

Now compile your application in debug mode.

An example application which can be inspected under windows is provided in the example subdirectory of the package.

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions