Re: [ROOT] ROOT & Qt, Swing, GUIs, Graphics Abstraction

From: Brett Viren (bv@bnl.gov)
Date: Wed Oct 31 2001 - 14:54:43 MET


Valeri Fine writes:
 >      Qt provides very attractive base class QCanvasItem:
 > 
 >      http://doc.trolltech.com/3.0/qcanvasitemlist.html
 >      http://doc.trolltech.com/3.0/qcanvasitem.html

I get a little nervous when QCanvas is suggested as something to
emulate.  I works okay for some things but the fact that it is integer
pixel based makes it difficult to use for things like event displays.
The user must take care of the world coordinate abstraction.

As an alternative, I think GnomeCanvas is a better role model.  It
treats objects as a heirarchy of items and groups (similar to how TPad
can hold TPads and other TObjects) each with their own affine
transformation and either world or absolute pixel drawing.  You can
also put Gtk Widgets into a GnomeCanvas (although, I am not sure if
that means one can have postscript output of the widget).

Some reading:

GnomeCanvas white paper:
http://developer.gnome.org/doc/whitepapers/canvas/canvas.html
Chapter from GGAD book:
http://developer.gnome.org/doc/GGAD/cha-canvas.html

Another thing I haven't mentioned in my Gnome/Gtk/Gdk cheer-leading is
that since all the underlying libraries are C, but follow an object
oriented design, they lend themselves to easy wrapping in other
languages.  For example, the Gnome--/Gtk--/Gdk-- effort.  I mention
this because one could consider writing ROOT/CINT wrappers for the
underlying C libraries as well.  But, another big long project....

GnomeCanvas does lack some things that QCanvas supplies, such as the
setting an item's "velocity" to provide default movement.  This is not
so useful for event displays but probably good for 2D games, and
arguably better handled by the user.

 >   Qt provides the base QPaintDevice class with some subclasses like
 >   QPrinter, QWidget, QPixmap,  QPicture etc
 > 
 >   http://doc.trolltech.com/3.0/qpaintdevice.html
 >   http://doc.trolltech.com/3.0/qpicture.html#details
 >   http://doc.trolltech.com/3.0/qprinter.html
 > 
 > 
 >    I'd like to call your attention to QPrinter / QPicture classes.
 >    That is what one needs for  the batch job.
 > 
 >   See:  http://doc.trolltech.com/3.0/qprinter.html#setOutputToFile

The QPainter idea is interesting.  To put it in ROOT terms, it
essentially lets you swap out the implimentation of TVirtualX at run
time from paint-to-X11 to paint-to-Postscript.  I used this when I
tried to make Qt widgets draw themselves to postscript, along with the
QCanvas for a proto-MIDAD event display.  It worked fairly well,
although not perfect, I think due to internal Qt bugs (some widgets
drew themselves wrong in Postscript).  I didn't get enough help from
the Qt guys to find it desirable to get it working 100% and in the
end, due to the QCanvas limitations, the QCanvas based display was
abandoned for TCanvas based one.

-Brett.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET