Re: include ROOT into another GUI?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Mar 11 1999 - 16:51:09 MET


Hi Ulrich,

  this should be not much of a problem. Look at the code of
TRootEmbeddedCanvas
(http://root.cern.ch/root/html/src/TRootEmbeddedCanvas.cxx.html).

All the magic happens in the ctor:

   Int_t wid = gGXW->InitWindow((ULong_t)GetViewPort()->GetId());
   Window_t win = gGXW->GetWindowID(wid);
   fCanvasContainer = new TRootEmbeddedContainer(this, win,
GetViewPort());
   SetContainer(fCanvasContainer);

   fCanvas = new TCanvas(name, 10, 10, wid);

First initialize a graphics window (gGXW->InitWindow), get is XID (win),
pass win to Qt and tell it to monitor the desired events (this is what
happens in TRootEmbeddedContainer). Next create a ROOT TCanvas with the
wid as the working area. In this TCanvas the histograms will be
displayed.

On how the TRootEmbeddedCanvas is used check $ROOTSYS/test/guitest.cxx.

If you have more detailed questions let me know directly. Also once
you have it working let me know, because it would like to distribute the
informations.


Cheers, Fons.


Ulrich Jost wrote:
> 
> I have an existing GUI application (based on Qt), is it possible to
> produce ROOT objects (ntuple, histograms etc) within it and make a plot
> (canvas) within a widget of the other GUI? Maybe by defining a new
> class which inherits the Qt widget class and the necessary ROOT
> class.
> 
> Thanks, Ulrich

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:30 MET