qtroot a qt interface to root€¦ · yfull kde/qt cross-platform c++ class library yfull root...

10
QtROOT a Qt interface to ROOT Denis Bertini GO4 GSI-Darmstadt 13/06/2001

Upload: others

Post on 14-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

QtROOT a Qt interface to ROOT

Denis BertiniGO4 GSI-Darmstadt13/06/2001

Page 2: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

Outline

zMotivationszQtROOT interface implementationyuse of general ROOT GUI Factory classesyIntegrating ROOT system events

zOngoing workzConclusions

Page 3: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

Motivations

zTo Give the ROOT user the opportunity to develop GUI application using together: yfull embedded ROOT canvas functionalityyfull KDE/Qt cross-platform C++ class libraryyfull ROOT functionality i.e ROOT system events

available (TTimer, TSockets , TThread, ...)yCINT and Qt?

zVisual design tool available : QtDesignerycompatible with QtROOT embedded canvas.

Page 4: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

QtROOT components

z Follows the general ROOT GUI ABCy no changes in ROOT source necessary

z Inheritance from ROOT base classesy TQRootGuiFactory (TRootGuiFactory)

• Qt Factory GUI componentsy TQCanvasImp (TCanvasImp)

• creates a Qt independent main window (QMainWindow)• sets TQRootCanvas as a central widget

y TQApplication (TApplication)• ROOT environment set with a Qt GUI factory

z Inheritance from Qt base classy QRootApplication (QApplication)

• enable Qt evt-loop to drive Qt based GUI applications

• call ROOT inner loop repeatedly to enable ROOT system events

Page 5: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

QtROOT UML Diagram

fDialog

0..1

TQRootDialog

Q_OBJECT

TQRootDialog( )~TQRootDialog( )add( )popup( )setTCanvas( )receive( )executeMethod( )

1

TQCanvasImp

TQRootCanvas* fQCanvasQMainWindow *fDialogbox

build( )TQCanvasImp( )TQCanvasImp( )TQCanvasImp( )~TQCanvasImp( )InitWindow( )ForceUpdate( )GetWindowGeometry( )Iconify( )SetStatusText( )SetWindowPosition( )SetWindowSize( )SetWindowTitle( )SetCanvasSize( )ShowMenuBar( )ShowStatusBar( )Show( )Close( )

1

TQCanvasMenu

Q_OBJECTTCanvas* c

TQCanvasMenu( )~TQCanvasMenu( )popup( )dialog( )createDialogTitle( )createArgumentTitle( )execute( )

0..11

0..1

fContextMenu

ApplicationWindow

Q_OBJECT

ApplicationWindow( )~ApplicationWindow( )closeEvent( )newDoc( )load( )load( )save( )saveAs( )print( )about( )aboutQt( )execute( )clear_histo( )listen( )

1

fQCanvas

0..1

1

TQRootCanvas

Q_OBJECTTCanvas *fCanvasTQCanvasMenu* fContextmenubool isCanvasOwned

TQRootCanvas( )~TQRootCanvas( )getCanvas( )getRootWid( )eventFilter( )mousePressEvent( )mouseReleaseEvent( )resizeEvent( )paintEvent( )mouseDoubleClickEvent( )mouseMoveEvent( )leaveEvent( )sizePolicy( )closeEvent( )

0..1

1

0..1

1

aCanvas

0..10..1

1

TCanvasImp

TCanvas *fCanvas

TCanvasImp( )~TCanvasImp( )InitWindow( )ForceUpdate( )GetWindowGeometry( )Iconify( )SetStatusText( )build( )

(from <unspecified>)

QObject

connect()disconnect()

QObject( )~QObject( )

QWidget

QWidget( )~Qwidget( )event( )

(from <unspecified>)

QVbox

QVbox( )~QVbox( )

QMainWindow

QMainWindow( )~QMainWindow( )

(from <unspecified>)

Page 6: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

QtROOT GUI Factory

z TQApplication⌧ LoadGraphLibs() sets global

gGuiFactory -> TQRootGuiFactory

z TRootGuiFactory⌧ uses services from ABC

TGuiFactory⌧ enables usage of native Qt

components + ROOT widgets⌧ overriding:

TQApplication

TQApplication( )TQApplication( )LoadGraphicsLibs( )~TQApplication( )

TQRootGuiFactory

TQRootGuiFactory( )~TQRootGuiFactory( )CreateCanvasImp( )CreateCanvasImp( )

TApplication

LoadGraphicsLibs( )Run( )

Set globals: gVirtualX -> TGX11gGuiFactory -> TRootGuiFactory

Set globals: gVirtualX -> TGX11gGuiFactory -> TQRooGuiFactory

1*gGuiFactory

TGX11

TGX11 ()~TGX11 ()AddWindow (int QtId)RemoveWIndow (int QtId)

1

*gVirtualX

TGX11::AddWindow(int QtId) - Only register a Qt based wind to ROOT - Fill XWindows_t using Qt Infos - Add window to array (fWindows list)

• TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height);

• TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)

Services:• Creates a specific Canvas Implementation TQCanvasImp

Page 7: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

Integrating ROOT events

QApplicationQ_OBJECT

QApplication( )~QApplication( )enter_loop( )exit_loop( )exec( )

QRootApplicationQ_OBJECTQTimer* timer

QRootApplication( )~QRootApplication( )execute( )

QObject

connect()disconnect()

QObject( )~QObject( )

TUnixSystem

TUnixSystem( )~TUnixSystem( )InnerLoop( )DispatchOneEvent( )

*gSystem

z QRootApplicationy Qt event loop

⌧ uses QApplication::exec()

y ROOT inner loop⌧ connect itself to

TUnixSystem::DispatchOneEvent()via a Qtimer class.

⌧ ROOT inner loop is the called repeatedly and return quickly

⌧ ROOT system event ( TThreads, TTimers, Network classes) are enabled while Qt event loop is activated

⌧ ROOT Gui TGxx classes can also be used together with Qt Widget !

Page 8: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

QtROOT Main program

Int main(int argc, char** argv){QRootApplication a (argc, argv );TROOT root( “QtRoot”,”test”);TQApplication app(“QtRoot”,&argc,argv);

// Native ROOT GUI classesTBrowser b;

// Qt windowsApplicationWindow mw;mw.setCaption(“QtRoot”);mw.show();int res = a.exec();return res;

}

Page 9: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

Ongoing work

zFurther tests of QtROOT on Unix PlatformzGO4 Qt GUI front end in developmentzHADES Qt based online monitoringzPort to Qt3.0 ( when release available)zInvestigate integration of OpenGL

Page 10: QtROOT a Qt interface to ROOT€¦ · yfull KDE/Qt cross-platform C++ class library yfull ROOT functionality i.e ROOT system events available (TTimer, ... • enable Qt evt-loop to

13/06/2001 Denis Bertini

Conclusions

z Full embbeded ROOT Canvas functionnality is available and tested

z ROOT system events integration has been tested within the multithreaded GO4 framework which uses TTimers, TThreads and ROOT network classes all together

z Running Qt widgets in parallel with ROOT widgets (e.g TBrowser) is possible (see Mohammad Al-Turany talk)