Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries Rene Brun (CERN) Valeri Fine (BNL,

Similar presentations


Presentation on theme: "Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries Rene Brun (CERN) Valeri Fine (BNL,"— Presentation transcript:

1 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)

2 Dec 3, 2003ACAT20003 fine@bnl.gov 2 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.

3 Dec 3, 2003ACAT20003 fine@bnl.gov 3 ROOT low level GUI interface TVirtualX TGX11TGWIN32TGWin32GDK ROOT (TG ROOT (TVirtualPad) 3 different implementations to develop and support

4 Dec 3, 2003ACAT20003 fine@bnl.gov 4 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 TrollTech 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.

5 Dec 3, 2003ACAT20003 fine@bnl.gov 5 ROOT Qt-based GUI interface TVirtualX TGQt ROOT only one (!) implementation

6 Dec 3, 2003ACAT20003 fine@bnl.gov 6 ROOT GUI class library and Qt layer The above Qt layer first was present last year on Acat2002 @ 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.

7 TVirtualX TGQt QObject TQtClientFilter TGQt::CreateWindow(…) TGQt::Init(…) QWidget::installEventFilter QFrame TQtClientWidget QWidget QPtrQueue fRootEventQueue TGQt::NextEvent() TGClient::ProcessOneEvent Event_tQEvent Transformation the QEvent Q-object into the ROOT Event_t structure QWidget TQtWidget TGQt::InitWindow(…)

8 Dec 3, 2003ACAT20003 fine@bnl.gov 8 ROOT vs Qt To run ROOT –Create TApplication –Enter ROOT event loop TApplication::Run To run Qt –Create QApplication –Enter Qt event loop QApplication::exec() This implementation: TApplicationQApplication TApplication::Run() QApplication::exec() Bottom line: No need to deal with QApplication!

9 Dec 3, 2003ACAT20003 fine@bnl.gov 9 Qt Root “Hello Word” 2. QtROOT “Hello Word” source file 1. Qt “Hello Word” source file #include int main( int argc, char **argv ) { QApplication a( argc, argv );// to be replaced QPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30 ); a.setMainWidget( &hello ); // to be removed hello.show(); return a.exec(); // to be replaced } #include int main( int argc, char **argv ) { // Create an interactive ROOT application TRint *theApp = new TRint("Rint", &argc, argv); QPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30 ); hello.show(); theApp->Run(); // and enter the event loop... }

10 Dec 3, 2003ACAT20003 fine@bnl.gov 10 A test application to combine ROOT and Qt Widget

11 Dec 3, 2003ACAT20003 fine@bnl.gov 11 ROOT QtGLWidget A fragment of STAR “Event Display” QtGLViewer class based viewer see: http://www.rhic.bnl.gov/~fine/EventDisplay )http://www.rhic.bnl.gov/~fine/EventDisplay

12 Dec 3, 2003ACAT20003 fine@bnl.gov 12 GL Image formats provided by QGLViewer class

13 Dec 3, 2003ACAT20003 fine@bnl.gov 13 Where to get Qt-ROOT from

14 Dec 3, 2003ACAT20003 fine@bnl.gov 14 Qt-ROOT FAQ

15 Dec 3, 2003ACAT20003 fine@bnl.gov 15 Conclusion There are enough evidences the present approach allows the ROOT developers as well as ROOT users to work with code that has no X11/WIN32 graphics subsystem dependencies and at the same time opens unrestricted access to a rich set of ready-to-use commercial and free GUI Qt- based 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.


Download ppt "Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries Rene Brun (CERN) Valeri Fine (BNL,"

Similar presentations


Ads by Google