Re: [ROOT] TGQt

From: Valeri Fine (fine@bnl.gov)
Date: Thu Nov 08 2001 - 20:02:20 MET


Hello Yuri,

This is OK from the first glance.

  However there are 4  main questions to be solved first:

   1. How this fits multithreaded applications (otherwise one meets dead-end) (see last week discussion)
   2. How Qt event loop will "collaborate" with ROOT event loop.
   3. To eliminate the peformace penalty it would be good to introduce some sort of method
       like:
             TVirtualX->PaintBegin(int wid)
             TVirtualX->PaintEnd(int wid)

   4. One should change the double-buffered  ROOT schema
      The small correction may simplify the TVirtualX implementation 
      (I've sent my proposal to Fons). to emanate and the logice it entails.
  
  struct SVirtualWnd
  {
    QPaintDevice *main;
    QPaintDevice *buffer;
    bool          isWidget;
  };

  TVirtrualX class should do nothing with the "double buffer".
   It is a job of TCanvasImp class. TVirtualX should work with 
   ONE QPaintDevice.


By the way AddWindow should return (int)(QPaintDevice *)
This eliminate your TGQtWndMan. 

For example one will be able (it is how the current Win32 impl works)

void  TGQt::CopyPixmap(int wid, int xpos, int ypos)
{
  assert(((QPaintDevice *)wid)->devType() == QInternal::Pixmap);
  if (fSelectedWindow && (int(fSelectedWindow) != wid) ) 
  {
    QRect r = GetQRect(*fSelectedWindow);
    r.setX(xpos);
    r.setY(ypos);
    fQPainter.drawPixmap(r,*(QPixmap *)wid);
  }
}



 There are some othe issues. For example one needs to be able to use RGB with
  no color index involved. This this ancient schema ROOT inherited from that age 
  when we had  8 colors terminals. Eliminating color index will simplify things
  tremendously  ROOT wide. 
 Just have a look at http://root.cern.ch/root/htmldoc/src/TColor.cxx.html#TColor:SetRGB
 to understand how slow and complex the current schema is. 

 For example if TColor::GetNumber will return the packed color index (8 bit) 
+ r ( 8bit) + g (8bit) + b(8bit) = 32 bits, then will be no need for your class TGQtColorMan
 with    typedef QMap<int, QColor> ColorMap; If r = g= b=0, then thing works as before
for the sake of the backward compatibility. (for this case Qcolor RootColor[256] or
even better vector<QColor> will be just fine (and faster)

  As it was proved many times it is not difficult to learn how to draw 
  the filled rectangular on the screen. The question how to do this drawing
  reasonable fast and useful.

  This means one has to wait ROOT team word.

  If you find my thoughts useful and you do have time to work on, 
  send me mail.

  Cheers,
                             Valeri
-----
Dr.Valeri Fine
STAR/US Atlas                                    E-mail: fine@bnl.gov
Brookhaven National Lab                   Phone: +1 631 344 7806
Upton, NY 11973-5000                       FAX:     +1 631 344 4206
USA



----- Original Message ----- 
From: "Yuriy" <yuriypro@mail.ru>
To: <roottalk@pcroot.cern.ch>
Sent: Thursday, November 08, 2001 12:38 PM
Subject: [ROOT] TGQt


> Dear ROOTer, here is the first draft of the TGQt class (Qt ROOT
> interface). My approach differs to the Go4 way. I have substituted
> gVirtualX to Qt implemented drawing class. So it seems to work on
> different platforms. I tested Linux+Qt3.0 and Windows+Qt2.3, and it
> works! There are Makefile for Linux and .dsw for VStudio, so you can
> compile it on both platforms.
> 
> If somebody will interested on my future Qt ROOT studies just write
> me a letter.
> 
> Best regards,
> Yuriy.
> 
> 



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