diff --git a/graf2d/qt/inc/TGQt.h b/graf2d/qt/inc/TGQt.h
index 256b3263c530aabcedf4e045fa40269dcd362e47..1c1f7b72ab858807fd79eecea50b74084d0f49d2 100644
--- a/graf2d/qt/inc/TGQt.h
+++ b/graf2d/qt/inc/TGQt.h
@@ -60,7 +60,7 @@
 
 class  QPen;
 class  QMarker;
-class  QFont;
+//class  QFont;
 class  QPaintDevice;
 class  QTextCodec;
 
@@ -77,6 +77,7 @@ class TFileHandler;
 class TQtApplication;
 class TQtClientFilter;
 class TQtEventQueue;
+class TQtPadFont;
 
 
 //#define TRACE_TGQt() fprintf(stdout, "TGQt::%s() %d\n", __FUNCTION__, __LINE__)
@@ -128,7 +129,7 @@ protected:
    TQtBrush  *fQBrush;
    QPen      *fQPen;
    TQtMarker *fQtMarker;
-   QFont     *fQFont;
+   TQtPadFont *fQFont;
 #if (QT_VERSION <0x40000)
    Qt::RasterOp fDrawMode;
 #else
@@ -162,7 +163,7 @@ protected:
 
    //Qt::AlignmentFlags fTextAlign;
 
-   void  SetTextFont(const char *fontname, Int_t italic, Int_t bold);
+   // void  SetTextFont(const char *fontname, Int_t italic, Int_t bold);
    Int_t CreatROOTThread();
    void  DeleteSelectedObj();
 
diff --git a/graf2d/qt/inc/TQtBrush.h b/graf2d/qt/inc/TQtBrush.h
index 87a562697f58b09ff9c0d54cd17056d2cb32b0ae..6aba40b6ad0532da38d19042b31404bd7d752f1c 100644
--- a/graf2d/qt/inc/TQtBrush.h
+++ b/graf2d/qt/inc/TQtBrush.h
@@ -33,8 +33,8 @@ protected:
   QColor fBackground;
   int fStyle;
   int fFasi;
-#ifdef R__WIN32
-  QPixmap fCustomPixmap; // shadow transparent pixmap fro WIN32
+#if defined(R__WIN32) &&  (QT_VERSION < 0x40000)
+  QPixmap fCustomPixmap; // shadow transparent pixmap for WIN32
 #endif
 public:
    TQtBrush();
diff --git a/graf2d/qt/inc/TQtPadFont.h b/graf2d/qt/inc/TQtPadFont.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5455d5db1c8ca8c3f4f264af7193811dfbf644f
--- /dev/null
+++ b/graf2d/qt/inc/TQtPadFont.h
@@ -0,0 +1,50 @@
+// @(#)root/qt:$Name:  $:$Id$
+// Author: Valeri Fine   21/01/2002
+/****************************************************************************
+**
+** Copyright (C) 2002 by Valeri Fine.  All rights reserved.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+*****************************************************************************/
+
+#ifndef ROOT_TQtPadFont
+#define ROOT_TQtPadFont
+
+#include "TAttText.h"
+
+#ifndef __CINT__
+#  include <qfont.h>
+#else
+   class  QFont;
+#endif
+   //
+   // TQtPadFont creates the QFort object to map to ROOT  TAttText attributes
+   //
+class TQtPadFont : public QFont, public TAttText
+{
+private:
+   static const char *fgRomanFontName;
+   static const char *fgArialFontName;
+   static const char *fgCourierFontName;
+   static const char *fgSymbolFontFamily;
+
+public:
+   TQtPadFont();
+   TQtPadFont(const TQtPadFont &src):QFont(src),TAttText(src) {}
+   virtual ~TQtPadFont(){;}
+   void  SetTextFont(const char *fontname, int italic, int bold);
+   void  SetTextFont(Font_t fontnumber=62);
+   void  SetTextSize(Float_t textsize=1);
+   void  SetTextSizePixels(Int_t npixels);
+   void  SetTextMaginfy(Float_t mgn);
+   static const char *RomanFontName();
+   static const char *ArialFontName();
+   static const char *CourierFontName();
+   static const char *SymbolFontFamily();
+   static void SetSymbolFontFamily(const char *symbolFnName="Symbol");
+
+};
+
+#endif
diff --git a/graf2d/qt/inc/TQtRConfig.h b/graf2d/qt/inc/TQtRConfig.h
index b0754a737ef900faab9be278c0d3afe8651eae98..b5d3add4913e378834e2b5a995080f61be01d7d1 100644
--- a/graf2d/qt/inc/TQtRConfig.h
+++ b/graf2d/qt/inc/TQtRConfig.h
@@ -8,8 +8,8 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
 
-#ifndef ROOT_TQtRConfig
-#define ROOT_TQtRConfig
+#ifndef ROOT_TQTRCONFIG
+#define ROOT_TQTRCONFIG
 #include "RConfig.h"
 #ifndef __CINT__
 #  include "qglobal.h"
@@ -32,11 +32,15 @@
 #undef  R__QTGUITHREAD
 #endif /*R__QTGUITHREAD*/
 
-#if defined(R__UNIX) && !defined(R__MACOSX)
+#ifdef Q_WS_X11
 # define R__QTX11
 #endif
 
-#if defined(R__WIN32)
+#if !defined(R__QTX11) && defined(R__UNIX) && !defined(R__MACOSX)
+# define R__QTX11
+#endif
+
+#if !defined(R__QTX11) &&  defined(R__WIN32)
 # define R__QTWIN32
 #endif
 
diff --git a/graf2d/qt/inc/TQtWidget.h b/graf2d/qt/inc/TQtWidget.h
index 7693e302537c71ed16233ee8ab1ad336db85ed83..45fcb7a866116894856861d7c7c24417a4895e5a 100644
--- a/graf2d/qt/inc/TQtWidget.h
+++ b/graf2d/qt/inc/TQtWidget.h
@@ -109,7 +109,7 @@ public:
   TQtWidget( QWidget* parent=0);
 #endif  
   virtual ~TQtWidget();
-  void SetCanvas(TCanvas *c)                 { fCanvas = c;}
+  void SetCanvas(TCanvas *c);
 //  inline TCanvas  *GetCanvas() const         { return fCanvas;}
   inline TCanvas  *GetCanvas() const         { return (!fIsShadow) ? fCanvas : ((TQtWidget *)parentWidget())->GetCanvas(); }
   inline QPixmap  &GetBuffer()               { return fPixmapID;}
diff --git a/graf2d/qt/src/TGQt.cxx b/graf2d/qt/src/TGQt.cxx
index f7291f6dd851de8570aa386abeeb08aea17fc0b2..b3527844069cd96dc24066d6306a97e28076c9ad 100644
--- a/graf2d/qt/src/TGQt.cxx
+++ b/graf2d/qt/src/TGQt.cxx
@@ -76,6 +76,7 @@
 #include "TQtEventQueue.h"
 #include "TQtSymbolCodec.h"
 #include "TQtLock.h"
+#include "TQtPadFont.h"
 #include "TStyle.h"
 #include "TObjString.h"
 #include "TObjArray.h"
@@ -421,73 +422,6 @@ void TGQt::PrintEvent(Event_t &ev)
    fprintf(stderr,"fX, fY, fXRoot, fYRoot = %d %d  :: %d %d\n", ev.fX, ev.fY,ev.fXRoot, ev.fYRoot);
 }
 
-//______________________________________________________________________________
-static float CalibrateFont()
-{
-    // Use the ROOT font with ID=1 to calibrate the current font on fly;
-    // Environment variable ROOTFONTFACTOR allows to set the factor manually
-    static float fontCalibFactor = -1;
-    if (fontCalibFactor  < 0 ) {
-
-       const char * envFactor = gSystem->Getenv("ROOTFONTFACTOR");
-       bool ok=false;
-       if (envFactor && envFactor[0])
-          fontCalibFactor= QString(envFactor).toFloat(&ok);
-       if (!ok) {
-
-          bool  italic = TRUE;
-          long  bold   = 5;
-          QString fontName =
-#if QT_VERSION < 0x40000
-            romanFontName;
-#else
-            "Nimbus Roman No9 L";
-#endif
-
-          QFont pattern;
-
-          pattern.setWeight(bold*10);
-          pattern.setItalic(italic);
-          pattern.setFamily(fontName);
-          pattern.setPixelSize(12);
-
-          int w,h;
-          QFontMetrics metrics(pattern);
-          w = metrics.width("This is a PX distribution");
-          h = metrics.height();
-
-// I found 0.94 matches well what Rene thinks it should be
-// for TTF and XFT and it should be 1.1 for X Fonts
-//
-//  X11 returns         h = 12
-//  XFT returns         h = 14
-// WIN32 TTF returns    h = 16
-// Nimbus Roman returns h = 18
-
-         // printf(" Font metric w = %d , h = %d\n", w,h);
-          float f;
-          switch (h) {
-             case 12: f = 1.10;  break;// it was  f = 1.13 :-(;
-             case 14: f = 0.915; break;// it was f = 0.94  :-(;
-             case 16: f = 0.94;  break;// to be tested yet
-             case 18: f = 0.92;  break;// to be tested yet
-             default: f = 1.10;  break;
-          }
-          fontCalibFactor = f;
-       }
-    }
-    return fontCalibFactor;
-}
-
-//______________________________________________________________________________
-static inline float FontMagicFactor(float size)
-{
-   // Adjust the font size to match that for Postscipt format
-   static float calibration =0;
-   if (calibration == 0) calibration = CalibrateFont();
-   return TMath::Max(calibration*size,Float_t(1.0));
-}
-
 int TGQt::fgCoinFlag = 0; // no current coin viewer;
 int TGQt::fgCoinLoaded = 0; // coint viewer DLL has not been loaded
 
@@ -878,7 +812,7 @@ Bool_t TGQt::Init(void* /*display*/)
    fQPen     = new QPen;
    fQBrush   = new TQtBrush;
    fQtMarker = new TQtMarker;
-   fQFont    = new QFont();
+   fQFont    = new TQtPadFont();
    // ((TGQt *)TGQt::GetVirtualX())->SetQClientFilter(
    fQClientFilter = new TQtClientFilter();
 
@@ -890,7 +824,8 @@ Bool_t TGQt::Init(void* /*display*/)
    //  define the font code page
    QString fontName(default_font);
    fFontTextCode = fontName.section('-',13).upper();
-   if  ( fFontTextCode.isEmpty() ) fFontTextCode = "ISO8859-1";
+   if  ( fFontTextCode.isEmpty() ) fFontTextCode = "ISO8859-5";
+#ifndef R__QTWIN32
    // Check whether "Symbol" font is available
     QFontDatabase fdb;
     QStringList families = fdb.families();
@@ -908,10 +843,11 @@ Bool_t TGQt::Init(void* /*display*/)
         {
            symbolFontFound = kTRUE;
            fSymbolFontFamily = *f;
+           TQtPadFont::SetSymbolFontFamily(*f);
 #if QT_VERSION < 0x40000
 //              fprintf(stderr, "Symbol font family found %s\n", fSymbolFontFamily);
 #else
-//              qDebug() << "Symbol font family found:" << fSymbolFontFamily;
+              qDebug() << "Symbol font family found:" << fSymbolFontFamily;
 #endif
            break;
         }
@@ -945,6 +881,7 @@ Bool_t TGQt::Init(void* /*display*/)
         // create a custom codec
         new QSymbolCodec();
     }
+#endif
    //  printf(" TGQt::Init finsihed\n");
    // Install filter for the desktop
    // QApplication::desktop()->installEventFilter(QClientFilter());
@@ -1367,7 +1304,7 @@ void  TGQt::DrawBox(int x1, int y1, int x2, int y2, EBoxMode mode)
       } else {
          if (fQBrush->style() != Qt::SolidPattern)
             fQPainter->setPen(fQBrush->GetColor());
-#ifdef R__WIN32
+#if defined(R__WIN32) &&  (QT_VERSION < 0x40000)
          if ( 3000 <= fQBrush->GetStyle() && fQBrush->GetStyle() < 4000) {
             QPixmap &px = *fQBrush->pixmap();
             px.fill(fQBrush->GetColor());
@@ -1464,7 +1401,7 @@ void  TGQt::DrawFillArea(int n, TPoint *xy)
       TPoint *rootPoint = xy;
       for (int i =0;i<n;i++,rootPoint++)
          qtPoints.setPoint(i,rootPoint->fX,rootPoint->fY);
-#ifdef R__WIN32
+#if defined(R__WIN32) &&  (QT_VERSION < 0x40000)
       if ( 3000 <= fQBrush->GetStyle() && fQBrush->GetStyle() < 4000) {
             QPixmap &px = *fQBrush->pixmap();
             px.fill(fQBrush->GetColor());
@@ -1637,8 +1574,7 @@ void  TGQt::DrawText(int x, int y, float angle, float mgn, const char *text, TVi
    // fprintf(stderr,"TGQt::DrawText: %s\n", text);
    if (text && text[0]) {
       TQtLock lock;
-      Int_t tsize = (Int_t)(fTextSize+0.5);
-      if (TMath::Abs(mgn-1) >0.05)  fQFont->setPixelSizeFloat(mgn*FontMagicFactor(tsize));
+      fQFont->SetTextMaginfy(mgn);
       UpdateFont();
       fQPainter->save();
       fQPainter->setPen(ColorIndex(fTextColor));
@@ -2743,7 +2679,7 @@ Int_t  TGQt::SetTextFont(char* /*fontname*/, TVirtualX::ETextSetMode /*mode*/)
    // Qt takes care to make sure the proper font is loaded and scaled.
    return 0;
 }
-
+#if 0
 //______________________________________________________________________________
 void  TGQt::SetTextFont(const char *fontname, int italic, int bold)
 {
@@ -2755,30 +2691,11 @@ void  TGQt::SetTextFont(const char *fontname, int italic, int bold)
    //*-*
    //*-*    Set text font to specified name. This function returns 0 if
    //*-*    the specified font is found, 1 if not.
-
-   fQFont->setWeight((long) bold*10);
-   fQFont->setItalic((Bool_t)italic);
-   fQFont->setFamily(fontname);
-#if QT_VERSION >= 0x40000
-   if (!strcmp(fontname,romanFontName)) {
-      fQFont->setStyleHint(QFont::Serif);
-   } else if (!strcmp(fontname,arialFontName)) {
-      fQFont->setStyleHint(QFont::SansSerif);
-   } else if (!strcmp(fontname,courierFontName)){
-      fQFont->setStyleHint(QFont::TypeWriter);
-   }
-   fQFont->setStyleStrategy(QFont::PreferDevice);
-#if 0
-   qDebug() << "TGQt::SetTextFont:" << fontname
-         << fQFont->lastResortFamily ()
-         << fQFont->lastResortFont ()
-         << fQFont->substitute (fontname);
-#endif
-#endif
-   fTextFontModified = 1;
+    fQFont->SetTextFont(fontname, italic, bold);
+    fTextFontModified = 1;
    // fprintf(stderr, "TGQt::SetTextFont font: <%s> bold=%d italic=%d\n",fontname,bold,italic);
 }
-
+#endif
 //______________________________________________________________________________
 void  TGQt::SetTextFont(Font_t fontnumber)
 {
@@ -2808,89 +2725,8 @@ void  TGQt::SetTextFont(Font_t fontnumber)
       fTextFontModified = 1;
       return;
    }
-   int italic, bold;
-   const char *fontName = romanFontName;
-
-   switch(fontnumber/10) {
-
-   case  1:
-      italic = 1;
-      bold   = 5;
-      fontName = romanFontName;
-      break;
-   case  2:
-      italic = 0;
-      bold   = 8;
-      fontName = romanFontName;
-      break;
-   case  3:
-      italic = 1;
-      bold   = 8;
-      fontName = romanFontName;
-      break;
-   case  4:
-      italic = 0;
-      bold   = 5;
-      fontName = arialFontName;
-      break;
-   case  5:
-      italic = 1;
-      bold   = 5;
-      fontName = arialFontName;
-      break;
-   case  6:
-      italic = 0;
-      bold   = 8;
-      fontName = arialFontName;
-      break;
-   case  7:
-      italic = 1;
-      bold   = 8;
-      fontName = arialFontName;
-      break;
-   case  8:
-      italic = 0;
-      bold   = 5;
-      fontName = courierFontName;
-      break;
-   case  9:
-      italic = 1;
-      bold   = 5;
-      fontName = courierFontName;
-      break;
-   case 10:
-      italic = 0;
-      bold   = 8;
-      fontName = courierFontName;
-      break;
-   case 11:
-      italic = 1;
-      bold   = 8;
-      fontName = courierFontName;
-      break;
-   case 12:
-      italic = 0;
-      bold   = 5;
-      fontName = fSymbolFontFamily;
-      break;
-   case 13:
-      italic = 0;
-      bold   = 5;
-      fontName = romanFontName;
-      break;
-   case 14:
-      italic = 0;
-      bold   = 5;
-      fontName = "Wingdings";
-      break;
-   default:
-      italic = 0;
-      bold   = 5;
-      fontName = romanFontName;
-      break;
-
-   }
-   SetTextFont(fontName, italic, bold);
+   fQFont->SetTextFont(fontnumber);
+   fTextFontModified = 1;
 }
 
 //______________________________________________________________________________
@@ -2901,8 +2737,7 @@ void  TGQt::SetTextSize(Float_t textsize)
    if ( fTextSize != textsize ) {
       fTextSize = textsize;
       if (fTextSize > 0) {
-         Int_t   tsize =(Int_t)( textsize+0.5);
-         fQFont->setPixelSize(int(FontMagicFactor(tsize)));
+         fQFont->SetTextSize(textsize);
          fTextFontModified = 1;
       }
    }
diff --git a/graf2d/qt/src/TQtBrush.cxx b/graf2d/qt/src/TQtBrush.cxx
index 0e4460e54839f45d16de0483827463c8ac1ca9b8..31ff4ea841f1802144041b16ad3d6cb52b57776a 100644
--- a/graf2d/qt/src/TQtBrush.cxx
+++ b/graf2d/qt/src/TQtBrush.cxx
@@ -138,7 +138,7 @@ static uchar *patter_bits[]= { p1_bits, p2_bits,   p3_bits,  p4_bits,  p5_bits,
 ClassImp(TQtBrush)
 //______________________________________________________________________________
 TQtBrush::TQtBrush(): QBrush(),fStyle(0),fFasi(0)
-#ifdef R__WIN32
+#if defined(R__WIN32) &&  (QT_VERSION < 0x40000)
    , fCustomPixmap(16,16)
 #endif
 {}
@@ -172,7 +172,7 @@ void TQtBrush::SetStyle(int style, int fasi)
         int pattern = 1;
         if (fasi > 0 && fasi < 26 ) pattern = fasi-1;
         QBitmap bm(16,16,patter_bits[pattern],TRUE);
-#ifndef R__WIN32
+#if !defined(R__WIN32) ||  (QT_VERSION >= 0x40000)
         setPixmap(bm);
 #else
         fCustomPixmap.fill(Qt::color0);
diff --git a/graf2d/qt/src/TQtPadFont.cxx b/graf2d/qt/src/TQtPadFont.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b0e981c9032b4a47d6a3a8d1939ad77d8f5d2119
--- /dev/null
+++ b/graf2d/qt/src/TQtPadFont.cxx
@@ -0,0 +1,316 @@
+// Author: Valeri Fine   21/01/2002
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 2002 by Valeri Fine. Brookhaven National Laboratory.
+**                                    All rights reserved.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+*****************************************************************************/
+
+
+/////////////////////////////////////////////////////////////////////////////////
+//
+// TQtPadFont creates the QFort object to map to ROOT  TAttText attributes
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "TQtPadFont.h"
+#include "TSystem.h"
+#include "TMath.h"
+#include <qfontmetrics.h>
+#if QT_VERSION >= 0x40000
+#  include <QDebug>
+#endif
+
+const char *TQtPadFont::fgRomanFontName   = "Times New Roman";
+const char *TQtPadFont::fgArialFontName   = "Arial";
+const char *TQtPadFont::fgCourierFontName = "Courier New";
+const char *TQtPadFont::fgSymbolFontFamily= "Symbol";
+
+
+//______________________________________________________________________________
+static float CalibrateFont()
+{
+    // Use the ROOT font with ID=1 to calibrate the current font on fly;
+    // Environment variable ROOTFONTFACTOR allows to set the factor manually
+    static float fontCalibFactor = -1;
+    if (fontCalibFactor  < 0 ) {
+
+       const char * envFactor = gSystem->Getenv("ROOTFONTFACTOR");
+       bool ok=false;
+       if (envFactor && envFactor[0])
+          fontCalibFactor= QString(envFactor).toFloat(&ok);
+       if (!ok) {
+
+          bool  italic = TRUE;
+          long  bold   = 5;
+          QString fontName =
+#if QT_VERSION < 0x40000
+            RomanFontName();
+#else
+            "Nimbus Roman No9 L";
+#endif
+
+          QFont pattern;
+
+          pattern.setWeight(bold*10);
+          pattern.setItalic(italic);
+          pattern.setFamily(fontName);
+          pattern.setPixelSize(12);
+
+          int w,h;
+          QFontMetrics metrics(pattern);
+          w = metrics.width("This is a PX distribution");
+          h = metrics.height();
+
+// I found 0.94 matches well what Rene thinks it should be
+// for TTF and XFT and it should be 1.1 for X Fonts
+//
+//  X11 returns         h = 12
+//  XFT returns         h = 14
+// WIN32 TTF returns    h = 16
+// Nimbus Roman returns h = 18
+
+         // printf(" Font metric w = %d , h = %d\n", w,h);
+          float f;
+          switch (h) {
+             case 12: f = 1.10;  break;// it was  f = 1.13 :-(;
+             case 14: f = 0.915; break;// it was f = 0.94  :-(;
+             case 16: f = 0.94;  break;// to be tested yet
+             case 18: f = 0.92;  break;// to be tested yet
+             default: f = 1.10;  break;
+          }
+          fontCalibFactor = f;
+       }
+    }
+    return fontCalibFactor;
+}
+
+//______________________________________________________________________________
+static inline float FontMagicFactor(float size)
+{
+   // Adjust the font size to match that for Postscipt format
+   static float calibration =0;
+   if (calibration == 0) calibration = CalibrateFont();
+   return TMath::Max(calibration*size,Float_t(1.0));
+}
+
+//______________________________________________________________________________
+TQtPadFont::TQtPadFont(): TAttText()
+{}
+
+//______________________________________________________________________________
+void  TQtPadFont::SetTextFont(const char *fontname, int italic, int bold)
+{
+
+   //*-*    mode              : Option message
+   //*-*    italic   : Italic attribut of the TTF font
+   //*-*    bold     : Weight attribute of the TTF font
+   //*-*    fontname : the name of True Type Font (TTF) to draw text.
+   //*-*
+   //*-*    Set text font to specified name. This function returns 0 if
+   //*-*    the specified font is found, 1 if not.
+
+   this->setWeight((long) bold*10);
+   this->setItalic((Bool_t)italic);
+   this->setFamily(fontname);
+#if QT_VERSION >= 0x40000
+   if (!strcmp(fontname,RomanFontName())) {
+      this->setStyleHint(QFont::Serif);
+   } else if (!strcmp(fontname,ArialFontName())) {
+      this->setStyleHint(QFont::SansSerif);
+   } else if (!strcmp(fontname,CourierFontName())){
+      this->setStyleHint(QFont::TypeWriter);
+   }
+   this->setStyleStrategy(QFont::PreferDevice);
+#if 0
+   qDebug() << "TQtPadFont::SetTextFont:" << fontname
+         << this->lastResortFamily ()
+         << this->lastResortFont ()
+         << this->substitute (fontname)
+         << "ROOT  font number=" << fTextFont;
+#endif
+#endif
+   // fprintf(stderr, "TGQt::SetTextFont font: <%s> bold=%d italic=%d\n",fontname,bold,italic);
+}
+
+//______________________________________________________________________________
+void  TQtPadFont::SetTextFont(Font_t fontnumber)
+{
+   //*-*-*-*-*-*-*-*-*-*-*-*-*Set current text font number*-*-*-*-*-*-*-*-*-*-*-*
+   //*-*                      ===========================
+   //*-*  List of the currently supported fonts (screen and PostScript)
+   //*-*  =============================================================
+   //*-*   Font ID       X11                       Win32 TTF       lfItalic  lfWeight x 10
+   //*-*        1 : times-medium-i-normal      "Times New Roman"      1           5
+   //*-*        2 : times-bold-r-normal        "Times New Roman"      0           8
+   //*-*        3 : times-bold-i-normal        "Times New Roman"      1           8
+   //*-*        4 : helvetica-medium-r-normal  "Arial"                0           5
+   //*-*        5 : helvetica-medium-o-normal  "Arial"                1           5
+   //*-*        6 : helvetica-bold-r-normal    "Arial"                0           8
+   //*-*        7 : helvetica-bold-o-normal    "Arial"                1           8
+   //*-*        8 : courier-medium-r-normal    "Courier New"          0           5
+   //*-*        9 : courier-medium-o-normal    "Courier New"          1           5
+   //*-*       10 : courier-bold-r-normal      "Courier New"          0           8
+   //*-*       11 : courier-bold-o-normal      "Courier New"          1           8
+   //*-*       12 : symbol-medium-r-normal     "Symbol"               0           6
+   //*-*       13 : times-medium-r-normal      "Times New Roman"      0           5
+   //*-*       14 :                            "Wingdings"            0           5
+
+   if ( (fTextFont == fontnumber)  || (fontnumber <0) ) return;
+   TAttText::SetTextFont(fontnumber);
+
+   int italic, bold;
+   const char *fontName = RomanFontName();
+
+   switch(fTextFont/10) {
+
+   case  1:
+      italic = 1;
+      bold   = 5;
+      fontName = RomanFontName();
+      break;
+   case  2:
+      italic = 0;
+      bold   = 8;
+      fontName = RomanFontName();
+      break;
+   case  3:
+      italic = 1;
+      bold   = 8;
+      fontName = RomanFontName();
+      break;
+   case  4:
+      italic = 0;
+      bold   = 5;
+      fontName = ArialFontName();
+      break;
+   case  5:
+      italic = 1;
+      bold   = 5;
+      fontName = ArialFontName();
+      break;
+   case  6:
+      italic = 0;
+      bold   = 8;
+      fontName = ArialFontName();
+      break;
+   case  7:
+      italic = 1;
+      bold   = 8;
+      fontName = ArialFontName();
+      break;
+   case  8:
+      italic = 0;
+      bold   = 5;
+      fontName = CourierFontName();
+      break;
+   case  9:
+      italic = 1;
+      bold   = 5;
+      fontName = CourierFontName();
+      break;
+   case 10:
+      italic = 0;
+      bold   = 8;
+      fontName = CourierFontName();
+      break;
+   case 11:
+      italic = 1;
+      bold   = 8;
+      fontName = CourierFontName();
+      break;
+   case 12:
+      italic = 0;
+      bold   = 5;
+      fontName = SymbolFontFamily();
+      break;
+   case 13:
+      italic = 0;
+      bold   = 5;
+      fontName = RomanFontName();
+      break;
+   case 14:
+      italic = 0;
+      bold   = 5;
+      fontName = "Wingdings";
+      break;
+   default:
+      italic = 0;
+      bold   = 5;
+      fontName = RomanFontName();
+      break;
+
+   }
+   SetTextFont(fontName, italic, bold);
+}
+
+//______________________________________________________________________________
+void  TQtPadFont::SetTextSize(Float_t textsize)
+{
+   //*-*-*-*-*-*-*-*-*-*-*-*-*Set current text size*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+   //*-*                      =====================
+   if ( fTextSize != textsize ) {
+      TAttText::SetTextSize(textsize);
+      if (fTextSize > 0) {
+         Int_t   tsize =(Int_t)( textsize+0.5);
+         SetTextSizePixels(int(FontMagicFactor(tsize)));
+      }
+   }
+}
+//______________________________________________________________________________
+ void  TQtPadFont::SetTextSizePixels(Int_t npixels)
+ {
+    // Set the text pixel size
+    TAttText::SetTextSizePixels(npixels);
+    this->setPixelSize(int(FontMagicFactor(npixels)));
+ }
+//______________________________________________________________________________
+const char *TQtPadFont::RomanFontName() 
+{ 
+   // Get the system name for the "Roman" font
+   return fgRomanFontName;
+}
+
+//______________________________________________________________________________
+const char *TQtPadFont::ArialFontName() 
+{
+   // Get the system name for the "Arial" font
+   return fgArialFontName;
+}
+
+//______________________________________________________________________________
+const char *TQtPadFont::CourierFontName()
+{ 
+   // Get the system name for the "Courier" font
+   return fgCourierFontName;
+}
+//______________________________________________________________________________
+const char *TQtPadFont::SymbolFontFamily() 
+{ 
+   // Get the system name for the "Symbol" font
+   return fgSymbolFontFamily;
+}
+//______________________________________________________________________________
+void TQtPadFont::SetSymbolFontFamily(const char *symbolFnName)
+{ 
+   // Set the system name for the "Symbol" font
+   fgSymbolFontFamily = symbolFnName;  // we need the TString here !!!
+}
+
+//______________________________________________________________________________
+void   TQtPadFont::SetTextMaginfy(Float_t  mgn)
+{
+   //
+   // Scale the font accroding the inout mgn magnification factor
+   // mgn        : magnification factor
+   // -------
+   // see: TVirtualX::DrawText(int x, int y, float angle, float mgn, const char *text, TVirtualX::ETextMode /*mode*/)
+   //
+    Int_t tsize = (Int_t)(fTextSize+0.5);
+    if (TMath::Abs(mgn-1) >0.05)  this->setPixelSizeFloat(mgn*FontMagicFactor(tsize));
+}
\ No newline at end of file
diff --git a/graf2d/qt/src/TQtWidget.cxx b/graf2d/qt/src/TQtWidget.cxx
index ccb2d1f655af458ce56d701bff9e964fdcd35df3..a249c5102650a348461548816ed8536c5c9f80ef 100644
--- a/graf2d/qt/src/TQtWidget.cxx
+++ b/graf2d/qt/src/TQtWidget.cxx
@@ -289,7 +289,10 @@ TApplication *TQtWidget::InitRint( Bool_t /*prompt*/, const char *appClassName,
 #endif
        if (!guiFactory.BeginsWith("qt",TString::kIgnoreCase )){
          // Check for the extention
-         char *extLib = gSystem->DynamicPathName("libQtGui",kTRUE);
+         char *extLib = 0;
+#if QT_VERSION < 0x40000
+         extLib = gSystem->DynamicPathName("libQtGui",kTRUE);
+#endif         
          if (!extLib) extLib = gSystem->DynamicPathName("libQtRootGui",kTRUE);
          if (extLib) {
             gEnv->SetValue("Gui.Factory", "qtgui");
@@ -379,6 +382,14 @@ void TQtWidget::Refresh()
    }
    update();
 }
+//_____________________________________________________________________________
+void TQtWidget::SetCanvas(TCanvas *c) 
+{ 
+   //  remember my host TCanvas and adopt its name
+   fCanvas = c;
+   setName(fCanvas->GetName());
+}
+
 //_____________________________________________________________________________
 void TQtWidget::resize (int w, int h)
 {
@@ -488,7 +499,7 @@ void TQtWidget::mousePressEvent (QMouseEvent *e)
 
    EEventType rootButton = kNoEvent;
    TCanvas *c = Canvas();
-   if (c || !fWrapper ){
+   if (c && !fWrapper ){
       switch (e->button ())
       {
       case Qt::LeftButton:  rootButton = kButton1Down; break;
@@ -521,7 +532,7 @@ void TQtWidget::mouseMoveEvent (QMouseEvent * e)
    //  kButton1Motion = 21, kButton2Motion = 22, kButton3Motion = 23, kKeyPress = 24
    EEventType rootButton = kMouseMotion;
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       if (e->state() & Qt::LeftButton) { rootButton = kButton1Motion; }
       c->HandleInput(rootButton, e->x(), e->y());
       e->accept();
@@ -551,7 +562,7 @@ void TQtWidget::mouseReleaseEvent(QMouseEvent * e)
    }   
    EEventType rootButton = kNoEvent;
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       switch (e->button())
       {
       case Qt::LeftButton:  rootButton = kButton1Up; break;
@@ -578,7 +589,7 @@ void TQtWidget::mouseDoubleClickEvent(QMouseEvent * e)
    //  kButton1Double = 61, kButton2Double = 62, kButton3Double = 63
    EEventType rootButton = kNoEvent;
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       switch (e->button())
       {
       case Qt::LeftButton:  rootButton = kButton1Double; break;
@@ -601,7 +612,7 @@ void TQtWidget::keyPressEvent(QKeyEvent * e)
    //  Map the Qt key press event to the ROOT TCanvas events
    // kKeyDown  =  4
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       c->HandleInput(kKeyPress, e->ascii(), e->key());
       EmitSignal(kKeyPressEvent);
    } else {
@@ -622,7 +633,7 @@ void TQtWidget::enterEvent(QEvent *e)
    // Map the Qt mouse enters widget event to the ROOT TCanvas events
    // kMouseEnter    = 52
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       c->HandleInput(kMouseEnter, 0, 0);
       EmitSignal(kEnterEvent);
    }
@@ -634,7 +645,7 @@ void TQtWidget::leaveEvent (QEvent *e)
    //  Map the Qt mouse leaves widget event to the ROOT TCanvas events
    // kMouseLeave    = 53
    TCanvas *c = Canvas();
-   if (c || !fWrapper){
+   if (c && !fWrapper){
       c->HandleInput(kMouseLeave, 0, 0);
       EmitSignal(kLeaveEvent);
    }