1. Introduction  Few words about interfacing Qt & ROOT 
  2. Implementation Interface implementation 
  3. Requirements  How to compile & test it  
  4. Qt-Designer integration  How to use the TQRootCanvas within the Qt-Designer   
  5. Screenshot   A Qt-based "Root embedded canvas"    
  6. Email Contact   General discussion 
    

 

New Features and News:

      see Root 511-02 Release Notes

 

Introduction



Using Qt together with ROOT is possible. It only implies to use Qt's eventloop to drive your GUI application and use then ROOT as a class library. We will give here one example of a simple Qt interface to a slighty modified ROOT class library.

 

Why using Qt with ROOT?

 

The ROOT library contains its own GUI classes based on X11 and Xpm so that, a priori, do not need additional external dependencies. A lot of ROOT applications are currently using the native ROOT GUI classes so that the issue of replacement of these classes is not feasible.
On the other hand, some ROOT programmers are also tempted to use KDE/Qt based libraries to write their GUI application simply because of the advantageous development tools that are available.
Qt is a powerful, easy-to-use, cross-platform C++ class library for writing GUI applications. It is used as a based library for development of major actual linux projects such as:
  • KDE  Next Generation of Leading Desktop for Linux
  • the Kylix project: port of Borland Suite (Delphi, Borland C++,etc..) to the Linux World
  • etc ..
The GUI programmer can take advantage of:
  • signal/slot mechanism for connecting user interaction with program functionality, providing an excellent framework for component-based programming.
  • drag and drop mechanism
  • visual design tool Qt Designer (useful for fast GUI learning & writing )
  • etc..

 

Is Qt freely available?

 

Yes it is!
Qt/X11 edition and Qt/Embedded edition are both released for the X Window System under the GPL. For other platforms (Win32, etc..) trolltech provide "non commercial" editions.
The choice of Qt was driven by the fact that in GSI we mainly develop programs using Unix platforms (mainly Linux ). We believe that the way we have included ROOT inside Qt can be easily reused for similar powerful Open Source Free Software GUI Toolkit such as GTK+ .
TOPof Page

Implementation


Qt interface implementation

The Qt interface implementation follows the general design of ROOT GUI ABC. Basically we derive from: the corresponding Qt based interfaces, i.e. These inherited classes will then allow us to use Qt's internal eventloop to drive GUI applications and, consequently, to get Qt native GUI components instead of the ROOT ones.
More detailed "java style" documentation about the Qt interface classes can be found here .

Requirements

 
  • Since ROOT 5.11-02 this Qt interface is included in the ROOT distribution. To use it, you have to set the flag:     --enable-qtgsi  when configuring ROOT

 

  • In the $ROOTSYS/qtgsi/test  there is two examples:

     

    • Example1:   Shows how to use Qt3 and root without the Qt designer. This program has three different "modes" .ie.
                  * mode 0 : type `./qtroot 0' (Qtroot alone)
                  * mode 1 : type `./qtroot 1' (QtROOT + TBrowser)
                  * mode 2 : type `./qtroot 2' (QtROOT + TBrowser + Guitest (ROOT GUI"S examples))

     

    • Example2: example shows how to use the Qt designer create Qt - Root applications.

       

 

TOP of Page

Qt-Designer Integration


Because the  TQRootCanvas is a QWidget  it can be fully integrated into the Qt Designer as a custom widget. On the Other hand using the Qt-Designer one can also make use of the qmake utility in Qt 3.0 and thus generate Qt-Root Makefiles automatically.

A full description for using the QTRootCanvas in the Qt 3.0 designer is available  in the Root  release notes  (see example2 in $ROOTSYS/qtgsi/test in your ROOT installation directory)

Screenshots


You can find here a first screenshot demonstrating a ROOT embedded canvas operational in Qt.
 

EMail Contact

 

 

 

Of course this is one attempt to interface an external library to ROOT. Everybody interested in this work can join the effort. We will be happy also to open general discussion about interface and ROOT.
Please feel free to report all comments bug , inconsistencies etc...to:

Denis Bertini
Mohammad Al-Turany

Mohammad Al-Turany
 
Last modified:   07/28/2006