Crossplatform approach to create the interactive application based
Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries http: //root. bnl. gov Rene Brun (CERN) Valeri Fine (BNL, STAR) Jerome Lauret (BNL, STAR) Fons Rademakers (CERN) Dec 3, 2003 ACAT 20003 fine@bnl. gov
Operating system “model” for HEP cross-platform applications It is not unusual when the life cycle of the major HEP applications last for dozens years. In other words it is much more then the life cycle of any known “system components” like operating system, file system, GUI etc. and hardware as well. To survive the sophisticated and expansive HEP applications must be in possession of some (tiny) layer to separate the HEP applications of the concrete system environment evolvement. It is possible by introducing some sort of the “virtual operating system model” the applications rely on; and providing the implementation of that model as soon as operating environment evolves. Dec 3, 2003 ACAT 20003 fine@bnl. gov 2
ROOT low level GUI interface ROOT (TVirtual. Pad) 3 different implementations to develop and support TGWIN 32 Dec 3, 2003 ROOT (TG<family > TVirtual. X TGX 11 ACAT 20003 fine@bnl. gov TGWin 32 GDK 3
Why Qt? The present model has been serving ROOT and ROOT users very well for 8 years soon. On the other hand, most tasks to be performed and implement have no ROOT specific and have been successfully solved by other packages. • Qt package from Troll. Tech AS was especially attractive not only due to its superior quality and high level technical support but because it comes with the source code and tools to build it in place (including a commercial version for Windows). • The rich set of Qt documentation can be found on Web and available from the leading publishers as well. • Qt is a multi-platform C++ application framework that developers can use to write single-source applications that run-natively-on Windows, Linux, Unix, Mac OS X and embedded Linux. • Qt has been used to build thousands of successful commercial applications worldwide, • and is the basis of the open source KDE desktop environment. Dec 3, 2003 ACAT 20003 fine@bnl. gov 4
ROOT Qt-based GUI interface ROOT TVirtual. X only one (!) implementation Dec 3, 2003 TGQt ACAT 20003 fine@bnl. gov 5
ROOT GUI class library and Qt layer • The above Qt layer first was present last year on Acat 2002 @ Moscow and has the significant drawback. • Event though it solves the problem of combining the ROOT Canvas and Qt widgets within one single application it was not compatible with the ROOT GUI class library and the compatibility with the conventional ROOT development. Dec 3, 2003 ACAT 20003 fine@bnl. gov 6
Transformation the QEvent Q-object into the ROOT Event_t structure TGClient: : Process. One. Event_t QEvent TGQt: : Next. Event() QPtr. Queue<Event_t> f. Root. Event. Queue TGQt: : Init(…) TGQt: : Create. Window(…) TVirtual. X TGQt: : Init. Window(…) TQt. Client. Filter QObject TQt. Client. Widget QWidget: : install. Event. Filter Dec 3, 2003 TQt. Widget QFrame QWidget ACAT 20003 fine@bnl. gov
ROOT vs Qt • To run ROOT • To run Qt – Create TApplication – Enter ROOT event loop TApplication: : Run – Create QApplication – Enter Qt event loop QApplication: : exec() This implementation: TApplication QApplication: : exec() TApplication: : Run() Bottom line: No need to deal with QApplication! Dec 3, 2003 ACAT 20003 fine@bnl. gov 8
Qt Root “Hello Word” 1. Qt “Hello Word” source file #include <qapplication. h> #include <qpushbutton. h> int main( int argc, char **argv ) { QApplication a( argc, argv ); // to QPush. Button hello( "Hello world!", hello. resize( 100, 30 ); a. set. Main. Widget( &hello ); // to hello. show(); return a. exec(); // to } be replaced 0 ); be removed be replaced 2. Qt. ROOT “Hello Word” source file #include <TRint. h> #include <qpushbutton. h> int main( int argc, char **argv ) { // Create an interactive ROOT application TRint *the. App = new TRint("Rint", &argc, argv); QPush. Button hello( "Hello world!", 0 ); hello. resize( 100, 30 ); hello. show(); the. App->Run(); // and enter the event loop. . . } Dec 3, 2003 ACAT 20003 fine@bnl. gov 9
A test application to combine ROOT and Qt Widget Dec 3, 2003 ACAT 20003 fine@bnl. gov 10
ROOT Qt. GLWidget A fragment of STAR “Event Display” Qt. GLViewer class based viewer see: http: //www. rhic. bnl. gov/~fine/Event. Display ) Dec 3, 2003 ACAT 20003 fine@bnl. gov 11
GL Image formats provided by QGLViewer class Dec 3, 2003 ACAT 20003 fine@bnl. gov 12
Where to get Qt-ROOT from Dec 3, 2003 ACAT 20003 fine@bnl. gov 13
Qt-ROOT FAQ Dec 3, 2003 ACAT 20003 fine@bnl. gov 14
Conclusion There are enough evidences the present approach allows the ROOT developers as well as ROOT users to work with code that has no X 11/WIN 32 graphics subsystem dependencies and at the same time opens unrestricted access to a rich set of ready-to-use commercial and free GUI Qtbased widgets. Qt layer is provided as the standard ROOT “plug-in” share library. That allows user to turn the layer on/off at run time with no change of recompilation of the user’s code. At the moment we are testing the layer to provide the full ROOT GUI classes implementation. Information about progress can be found on BNL Web site: http: //root. bnl. gov That should be completed and the full compatible version of ROOT Qt layer to be released with the regular ROOT distribution by ROOT 2004 Workshop. Dec 3, 2003 ACAT 20003 fine@bnl. gov 15
- Slides: 15