Index of QT classes

ROOT Qt-layer classes


+
class TQtWidget
-
library: libGQt
#include "TQtWidget.h"
Display options:
Show inherited
Show non-public

class TQtWidget: public QWidget


  TQtWidget is a QWidget with the QPixmap double buffer
  It is designed to back the ROOT TCanvasImp class interface  and it can be used
  as a regular Qt Widget to create Qt-based GUI with the embedded TCanvas objects

This widget can be used as a Qt "custom widget"
         to build a custom GUI interfaces with  Qt Designer

 The class emits the Qt signals and has Qt public slots

  Public slots:  (Qt)

virtual void cd();  // make the associated TCanvas the current one (shortcut to TCanvas::cd())
   virtual void cd(int subpadnumber); // as above - shortcut to Canvas::cd(int subpadnumber)
   void Disconnect(); // disconnect the QWidget from the ROOT TCanvas (used in the class dtor)
   void Refresh();    // force the associated TCanvas::Update to be called
virtual bool QString& fileName) or overloads">Save(const QString &fileName) const;  // QString& fileName) or overloads">Save the widget image with some ppixmap file
   virtual bool QString& fileName) or overloads">Save(const char    *fileName) const;
   virtual bool QString& fileName) or overloads">Save(const QString &fileName,const char *format,int quality=60) const;
   virtual bool QString& fileName) or overloads">Save(const char    *fileName,const char *format,int quality=60) const;

  signals        (Qt)

    CanvasPainted();  // Signal the TCanvas has been painted onto the screen
    Saved(bool ok);   // Signal the TCanvas has been saved into the file
    RootEventProcessed(TObject *selected, unsigned int event, TCanvas *c);
                      // Signal the Qt mouse/keyboard event has been process by ROOT
                      // This "signal" is emitted by the enabled mouse events only.
                      // See: EnableSignalEvents
                      // ---  DisableSignalEvents

  public methods:
    The methods below define whether the TQtWidget object emits "RootEventProcessed" Qt signals
     (By default no  RootEventProcessed Qt signal is emitted )
     void EnableSignalEvents (UInt_t f)
     void DisableSignalEvents(UInt_t f),
         where f is a bitwise OR of the mouse event flags:
                  kMousePressEvent       // TCanvas processed QEvent QMouseEvent* )">mousePressEvent
                  kMouseMoveEvent        // TCanvas processed QEvent QMouseEvent* )">mouseMoveEvent
                  kMouseReleaseEvent     // TCanvas processed QEvent QMouseEvent* )">mouseReleaseEvent
                  kMouseDoubleClickEvent // TCanvas processed QEvent QMouseEvent* )">mouseDoubleClickEvent
                  kKeyPressEvent         // TCanvas processed QEvent QKeyEvent* )">keyPressEvent
                  kEnterEvent            // TCanvas processed QEvent QEvent* )">enterEvent
                  kLeaveEvent            // TCanvas processed QEvent QEvent* )">leaveEvent

  For example to create the custom responce to the mouse crossing TCanvas
  connect the RootEventProsecced signal with your qt slot:

 connect(tQtWidget,SIGNAL(RootEventProcessed(TObject *, unsigned int, TCanvas *))
          ,this,SLOT(CanvasEvent(TObject *, unsigned int, TCanvas *)));
.

void qtrootexample1::CanvasEvent(TObject *obj, unsigned int event, TCanvas *)
{
  TQtWidget *tipped = (TQtWidget *)sender();
const char *objectInfo =
        obj->GetObjectInfo(tipped->GetEventX(),tipped->GetEventY());
  QString tipText ="You have ";
  if  (tipped == tQtWidget1)
     tipText +="clicked";
  else
     tipText +="passed";
  tipText += " the object <";
  tipText += obj->GetName();
tipText += "> of class ";
  tipText += obj->ClassName();
  tipText += " : ";
  tipText += objectInfo;
  
   QWhatsThis::display(tipText)
 }


Function Members (Methods)

public:
TQtWidget(QWidget* parent = 0)
virtual~TQtWidget()
virtual voidadjustSize()
static TCanvas*Canvas(TQtWidget* widget)
static TQtWidget*Canvas(const TCanvas* canvas)
static TQtWidget*Canvas(Int_t id)
virtual voidcd()
virtual voidcd(int subpadnumber)
static TClass*Class()
voidDisableSignalEvents(UInt_t f)
voidDisconnect()
voidEmitSignal(UInt_t f)
voidEmitTestedSignal()
voidEnableSignalEvents(UInt_t f)
virtual voiderase()
UInt_tGetAllBits() const
QPixmap&GetBuffer()
const QPixmap&GetBuffer() const
TCanvas*GetCanvas() const
Int_tGetEvent() const
Int_tGetEventX() const
Int_tGetEventY() const
TObject*GetSelected() const
TVirtualPad*GetSelectedPad() const
Int_tGetSelectedX() const
Int_tGetSelectedY() const
static TApplication*InitRint(Bool_t prompt = FALS, const char* appClassName = "tRin", int* argc = 0, char** argv = "0", void* options = 0, int numOptions = 0, Bool_t noLogo = FALS)
voidInvertBit(UInt_t f)
virtual TClass*IsA() const
boolIsDoubleBuffered()
Bool_tIsSignalEventEnabled(UInt_t f) const
virtual QSizeminimumSizeHint() const
voidRefresh()
voidResetBit(UInt_t f)
virtual voidresize(int w, int h)
virtual boolSave(const QString& fileName) const
virtual boolSave(const char* fileName) const
virtual boolSave(const QString& fileName, const char* format, int quality = ) const
virtual boolSave(const char* fileName, const char* format, int quality = ) const
voidSetAllBits(UInt_t f)
voidSetBit(UInt_t f)
voidSetBit(UInt_t f, Bool_t set)
voidSetCanvas(TCanvas* c)
voidSetDoubleBuffer(bool on = RU)
virtual voidSetSaveFormat(const char* format)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual QSizesizeHint() const
virtual QSizePolicysizePolicy() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
Bool_tTestBit(UInt_t f) const
Int_tTestBits(UInt_t f) const
protected:
voidAdjustBufferSize()
TCanvas*Canvas()
virtual voidcustomEvent(QCustomEvent*)
virtual voidEmitCanvasPainted()
virtual voidenterEvent(QEvent*)
virtual voidexitSizeEvent()
virtual voidfocusInEvent(QFocusEvent*)
virtual voidfocusOutEvent(QFocusEvent*)
QWidget*GetRootID() const
virtual voidkeyPressEvent(QKeyEvent*)
virtual voidkeyReleaseEvent(QKeyEvent*)
virtual voidleaveEvent(QEvent*)
virtual voidmouseDoubleClickEvent(QMouseEvent*)
virtual voidmouseMoveEvent(QMouseEvent*)
virtual voidmousePressEvent(QMouseEvent*)
virtual voidmouseReleaseEvent(QMouseEvent*)
virtual voidpaintEvent(QPaintEvent*)
boolpaintFlag(bool mode = RU)
boolpaintingActive() const
virtual voidresizeEvent(QResizeEvent*)
voidSetRootID(QWidget* wrapper)
virtual voidSetSizeHint(const QSize& size)
virtual voidshowEvent(QShowEvent*)
virtual voidstretchWidget(QResizeEvent* e)
private:
TQtWidget(const TQtWidget&)
voidoperator=(const TQtWidget&)

Data Members

public:
enum { kBitMask
kEXITSIZEMOVE
kENTERSIZEMOVE
kFORCESIZE
};
protected:
TCanvas*fCanvas
boolfDoubleBufferOn
boolfEmbedded
boolfPaint
TQtWidgetBufferfPixmapIDDouble buffer of this widget
QStringfSaveFormat
boolfSizeChanged
QSizefSizeHint
QWidget*fWrapper
private:
UInt_tfBitsbit field status word

Class Charts

Inheritance Chart:
QWidget
TQtWidget
TQRootCanvas

Function documentation

TQtWidget(QWidget* parent, const char* name, Qt::WFlags f,bool embedded)
~TQtWidget()
TCanvas * Canvas()
TCanvas * Canvas(TQtWidget *widget)
 static: return TCanvas by TQtWidget pointer
TQtWidget * Canvas(const TCanvas *canvas)
 static: return the TQtWidget backend for TCanvas *canvas object
TQtWidget * Canvas(Int_t id)
 static: return TQtWidget by TCanvas id
TApplication * InitRint( Bool_t /*prompt*/, const char *appClassName, int *argc, char **argv, void *options, int numOptions, Bool_t /*noLogo*/)
 Instantiate ROOT from within Qt application if needed
 Return the TRint pointer
 Most parametrs are passed to TRint class ctor

 Bool_t prompt = kTRUE;  Instantiate ROOT with ROOT command prompt
                 kFALSE; No ROOT prompt. The default for Qt GUI applications

  The prompt option can be defined via ROOT parameter file ".rootrc"
 .rootrc:
    . . .
  Gui.Prompt   yes

void adjustSize()
 Adjusts the size of the widget to fit the contents.
 Adjust the size of the double buffer to the
 current Widget size
void cd()
 [slot] to make this embedded canvas the current one
void cd(int subpadnumber)
 [slot] to make this embedded canvas / pad the current one
void Disconnect()
 [slot] Disconnect the Qt widget from TCanvas object before deleting
 to avoid the dead lock
 one has to set CanvasID = 0 to disconnect things properly.
void Refresh()
 [slot]  to allow Qt signal refreshing the ROOT TCanvas if needed
void customEvent(QCustomEvent *e)
 The custom responce to the special WIN32 events
 These events are not present with X11 systems
void mouseReleaseEvent(QMouseEvent * e)
  Map the Qt mouse button release event to the ROOT TCanvas events
   kButton1Up     = 11, kButton2Up     = 12, kButton3Up     = 13
void mouseDoubleClickEvent(QMouseEvent * e)
  Map the Qt mouse double click button event to the ROOT TCanvas events
  kButton1Double = 61, kButton2Double = 62, kButton3Double = 63
void keyPressEvent(QKeyEvent * e)
  Map the Qt key press event to the ROOT TCanvas events
 kKeyDown  =  4
void keyReleaseEvent(QKeyEvent * e)
 Map the Qt key release event to the ROOT TCanvas events
 kKeyUp    = 14
void enterEvent(QEvent *e)
 Map the Qt mouse enters widget event to the ROOT TCanvas events
 kMouseEnter    = 52
void resizeEvent(QResizeEvent *e)
 The widget will be erased and receive a paint event immediately after
 processing the resize event.
 No drawing need be (or should be) done inside this handler.
void SetSaveFormat(const char *format)
 Set the default save format for the widget
bool Save(const char *fileName)
  TQtWidget::QString& fileName) or overloads">Save(const QString &fileName) is a public Qt slot.
  it saves the double buffer of this object using the default save
  format  defined the file extension
  If the "fileName" has no extension the "default" format is to be used instead
  The deafult format is "PNG".
  It can be changed with the TQtWidget::SetSaveFormat method

bool Save(const QString &fileName)
  TQtWidget::QString& fileName) or overloads">Save(const QString &fileName) is a public Qt slot.
  it saves the double buffer of this object using the default save
  format  defined the file extension
  If the "fileName" has no extension the "default" format is to be used instead
  The deafult format is "PNG".
  It can be changed with the TQtWidget::SetSaveFormat method

bool Save(const char *fileName,const char *format,int quality)
bool Save(const QString &fileName,const char *format,int quality)
  TQtWidget::save is a public Qt slot.
  it saves the double buffer of this object using QPixmap facility
void stretchWidget(QResizeEvent * /*s*/)
 Stretch the widget during sizing
bool paintFlag(bool mode)
  Set new fPaint flag
  Returns: the previous version of the flag
void EmitTestedSignal()
void SetBit(UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f.
void AdjustBufferSize()


{ if (fPixmapID.size() != size() ) fPixmapID.resize(size()); }
void SetRootID(QWidget *wrapper)

{ QWidget* TQtWidget::fWrapper">fWrapper = wrapper;}
QWidget * GetRootID()
{ return QWidget* TQtWidget::fWrapper">fWrapper;}
Int_t GetEvent()

  Proxy methods to access the TCanvas selected TObject
  and last processed event


{ return GetCanvas()->GetEvent(); }
Int_t GetEventX()


{ return GetCanvas()->GetEventX(); }
Int_t GetEventY()


{ return GetCanvas()->GetEventY(); }
TObject * GetSelected()


{ return GetCanvas()->GetSelected(); }
Int_t GetSelectedX()


{ return GetCanvas()->GetSelectedX(); }
Int_t GetSelectedY()


{ return GetCanvas()->GetSelectedY(); }
TVirtualPad * GetSelectedPad()
{ return GetCanvas()->GetSelectedPad(); }
UInt_t GetAllBits()
----- bit manipulation
{ return fBits; }
void SetAllBits(UInt_t f)
{ fBits = f; }
void SetBit(UInt_t f)
{ fBits |= f & kBitMask; }
void ResetBit(UInt_t f)
{ fBits &= ~(f & kBitMask); }
Bool_t TestBit(UInt_t f)
{ return (Bool_t) ((fBits & f) != 0); }
Int_t TestBits(UInt_t f)
{ return (Int_t) (fBits & f); }
void InvertBit(UInt_t f)
{ fBits ^= f & kBitMask; }
Bool_t IsSignalEventEnabled(UInt_t f)
{ return TestBit (f); }
void EmitSignal(UInt_t f)
{if (IsSignalEventEnabled(f)) EmitTestedSignal();}
void operator=(const TQtWidget&)
TQtWidget(const TQtWidget&)
----- Private bits, clients can only test but not change them
void SetCanvas(TCanvas *c)
{ fCanvas = c;}
TCanvas * GetCanvas()
{ return fCanvas;}
QPixmap & GetBuffer()
{ return fPixmapID;}
const QPixmap & GetBuffer()
{ return fPixmapID;}
bool IsDoubleBuffered()
{ return fDoubleBufferOn; }
void SetDoubleBuffer(bool on=TRUE)
{ fDoubleBufferOn = on;}
void EmitCanvasPainted()
{ emit CanvasPainted(); }
return paintingActive()

Qt/ROOT page - ROOT page - Class index - Class Hierarchy - Top of the page - Qt docs

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to QtROOT support, or contact the developers with any questions or problems regarding ROOT.