RE: [ROOT] TRootBrowser

From: Valeri Fine (fine@bnl.gov)
Date: Sun Feb 08 2004 - 20:12:26 MET


With Qt-layer your goal is simple to achieve because any Qt widget emits
the "destroyed" SIGNAL   (see
http://doc.trolltech.com/2.3/qobject.html#a9d5ae ) It doesn't matter
what was the reason for that QWidget collapse. It can be due the code
calling "delete" or because of the user acted to "destroy" the window on
the screen.
This means in your main() you can connect the "destroyed" signal with
some custom slot that in turn does gApplication->Terminate();

For example the "qtgui" package from http://root.bnl.gov does provide
several implementations for TBrowserImp class for different occasions.

Calling "gApplication->Terminate();"  from object dtor may have caused
the unforeseen troubles  and surprise the end-user.

On other hand the Qt-like solution can be done with TRootBrowser also. 
One should re-call that TGFrame base class object emits:

       Emit("CloseWindow()");

ROOT signal just the user had closed the appropriated X window.

(see:
http://root.cern.ch/root/htmldoc/src/TGFrame.cxx.html#TGFrame:HandleClie
ntMessage )

You should connect this signal with your code to terminate the
application. In this case no custom TBrowser class is required.

  Hope this helps.


> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]
> On Behalf Of Alexander Bürger
> Sent: Sunday, February 08, 2004 9:23 AM
> To: roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] TRootBrowser
> 
> Hi Rene,
> 
> > To exit from the application, select the "Quit Root" item in the
> > browser "File" menu.
> 
> This is the point. I find it much more convenient if the application
> exits also when I close the window via the windowmanager because I
know
> I would often forget to "Quit ROOT". The aim is to put it into
.mailcap,
> so I cannot just stop the application with Ctrl-C when it's run e.g.
> from mozilla.
> 
> Best wishes,
> 
> Alexander



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET