TQtWidget
class description - source file - inheritance tree (.pdf)
class TQtWidget : public QWidget
private:
TQtWidget(const TQtWidget&)
void operator=(const TQtWidget&) const
void operator=(const TQtWidget&)
protected:
void AdjustBufferSize()
TCanvas* Canvas()
virtual void customEvent(QCustomEvent*)
virtual void EmitCanvasPainted()
void EmitSignal(UInt_t f)
void EmitTestedSignal()
virtual void enterEvent(QEvent*)
virtual void exitSizeEvent()
virtual void focusInEvent(QFocusEvent*)
virtual void focusOutEvent(QFocusEvent*)
QWidget* GetRootID() const
void InvertBit(UInt_t f)
virtual void keyPressEvent(QKeyEvent*)
virtual void keyReleaseEvent(QKeyEvent*)
virtual void leaveEvent(QEvent*)
virtual void mouseDoubleClickEvent(QMouseEvent*)
virtual void mouseMoveEvent(QMouseEvent*)
virtual void mousePressEvent(QMouseEvent*)
virtual void mouseReleaseEvent(QMouseEvent*)
virtual void paintEvent(QPaintEvent*)
bool paintFlag(bool mode = TRUE)
bool paintingActive() const
void ResetBit(UInt_t f)
virtual void resizeEvent(QResizeEvent*)
void SetBit(UInt_t f, Bool_t set)
void SetBit(UInt_t f)
void SetRootID(QWidget* wrapper)
virtual void SetSizeHint(const QSize& size)
virtual void showEvent(QShowEvent*)
virtual void stretchWidget(QResizeEvent* e)
Bool_t TestBit(UInt_t f) const
Int_t TestBits(UInt_t f) const
public:
TQtWidget(QWidget* parent = 0, const char* name = "0", int f, bool embedded)
virtual ~TQtWidget()
virtual void adjustSize()
void CanvasPainted()
virtual void cd()
virtual void cd(int subpadnumber)
static TClass* Class()
void DisableSignalEvents(UInt_t f)
void Disconnect()
void EnableSignalEvents(UInt_t f)
virtual void erase()
QPixmap& GetBuffer()
const QPixmap& GetBuffer() const
TCanvas* GetCanvas() const
Int_t GetEvent() const
Int_t GetEventX() const
Int_t GetEventY() const
TObject* GetSelected() const
TVirtualPad* GetSelectedPad() const
Int_t GetSelectedX() const
Int_t GetSelectedY() const
static TApplication* InitRint(Bool_t prompt = kFALSE, const char* appClassName = "QtRint", int* argc = 0, char** argv = "0", void* options = 0, int numOptions = 0, Bool_t noLogo = kFALSE)
virtual TClass* IsA() const
bool IsDoubleBuffered()
Bool_t IsSignalEventEnabled(UInt_t f) const
virtual QSize minimumSizeHint() const
virtual void polish()
void Refresh()
virtual void resize(int w, int h)
void RootEventProcessed(TObject* selected, unsigned int event, TCanvas* c)
virtual bool Save(const QString& fileName) const
virtual bool Save(const char* fileName) const
virtual bool Save(const QString& fileName, const char* format, int quality = 60) const
virtual bool Save(const char* fileName, const char* format, int quality = 60) const
void Saved(bool ok)
void SetCanvas(TCanvas* c)
void SetDoubleBuffer(bool on = TRUE)
virtual void SetSaveFormat(const char* format)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual QSize sizeHint() const
virtual QSizePolicy sizePolicy() const
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
private:
UInt_t fBits bit field status word
protected:
TCanvas* fCanvas
TQtWidgetBuffer fPixmapID Double buffer of this widget
bool fPaint
bool fSizeChanged
bool fDoubleBufferOn
bool fEmbedded
QSize fSizeHint
QWidget* fWrapper
QString fSaveFormat
public:
static const enum TQtWidget:: kBitMask
static const enum TQtWidget:: kEXITSIZEMOVE
static const enum TQtWidget:: kENTERSIZEMOVE
static const enum TQtWidget:: kFORCESIZE
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
class emits Qt signals and has a 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 Qidget from the ROOT TCanvas (used in the class dtor)
void Refresh(); // forece the aasociated TCanvas::Update to be called
virtual bool Save(const QString &fileName) const; // Save the widget image with some ppixmap file
virtual bool Save(const char *fileName) const;
virtual bool Save(const QString &fileName,const char *format,int quality=60) const;
virtual bool 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
For example to create the custom responce to the mouse crossing TCanvas
connect the RootEventProsecced signal witrh 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;
QToolTip::remove(tipped);
QToolTip::add(tipped,tipText);
}
TCanvas* Canvas()
TQtWidget(QWidget* parent, const char* name, WFlags f,bool embedded):QWidget(parent,name,f)
,fBits(0),fCanvas(0),fPixmapID(this),fPaint(TRUE),fSizeChanged(FALSE)
,fDoubleBufferOn(FALSE),fEmbedded(embedded),fWrapper(0),fSaveFormat("PNG")
~TQtWidget()
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 erase ()
Erases the specified area (x, y, w, h) in the widget
without generating a paint event.
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 TOOT TCanvas if needed
void resize (int w, int h)
resize the widget and its double buffer
fprintf(stderr,"TQtWidget::resize (int w=%d, int h=%d)\n",w,h);
void customEvent(QCustomEvent *e)
The custom responce to the special WIN32 events
These events are not present with X11 systems
void focusInEvent ( QFocusEvent *e )
The custom responce to the Qt QFocusEvent "in"
this imposes an extra protection to avoid TObject interaction with
mouse event accidently
void focusOutEvent ( QFocusEvent *e )
The custom responce to the Qt QFocusEvent "out"
this imposes an extra protection to avoid TObject interaction with
mouse event accidently
void mousePressEvent (QMouseEvent *e)
Map the Qt mouse press button event to the ROOT TCanvas events
Mouse events occur when a mouse button is pressed or released inside
a widget or when the mouse cursor is moved.
void mouseMoveEvent (QMouseEvent * e)
Map the Qt mouse move pointer event to the ROOT TCanvas events
kMouseMotion = 51,
kButton1Motion = 21, kButton2Motion = 22, kButton3Motion = 23, kKeyPress = 24
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 leaveEvent (QEvent *e)
Map the Qt mouse leaves widget event to the ROOT TCanvas events
kMouseLeave = 53
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) const
TQtWidget::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) const
TQtWidget::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)const
bool Save(const QString &fileName,const char *format,int quality)const
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
void exitSizeEvent ()
Responce to the "exit size event"
bool paintFlag(bool mode)
Set new fPaint flag
Returns: the previous version of the flag
void showEvent ( QShowEvent *)
Custom handler of the Qt show event
Non-spontaneous show events are sent to widgets immediately before
they are shown.
The spontaneous show events of top-level widgets are delivered afterwards.
void paintEvent (QPaintEvent *e)
Custom handler of the Qt paint event
A paint event is a request to repaint all or part of the widget.
It can happen as a result of repaint() or update(), or because the widget
was obscured and has now been uncovered, or for many other reasons.
void SetSizeHint (const QSize &size)
sets the preferred size of the widget.
QSize sizeHint () const
returns the preferred size of the widget.
QSize minimumSizeHint () const
returns the smallest size the widget can have.
QSizePolicy sizePolicy () const
returns a QSizePolicy; a value describing the space requirements
void EmitTestedSignal()
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Inline Functions
void operator=(const TQtWidget&) const
void operator=(const TQtWidget&)
TQtWidget TQtWidget(QWidget* parent = 0, const char* name = "0", int f, bool embedded)
void SetCanvas(TCanvas* c)
TCanvas* GetCanvas() const
QPixmap& GetBuffer()
const QPixmap& GetBuffer() const
bool IsDoubleBuffered()
void SetDoubleBuffer(bool on = TRUE)
void SetRootID(QWidget* wrapper)
QWidget* GetRootID() const
void EmitCanvasPainted()
void AdjustBufferSize()
bool paintingActive() const
void SetBit(UInt_t f)
void ResetBit(UInt_t f)
Bool_t TestBit(UInt_t f) const
Int_t TestBits(UInt_t f) const
void InvertBit(UInt_t f)
void EmitSignal(UInt_t f)
Int_t GetEvent() const
Int_t GetEventX() const
Int_t GetEventY() const
TObject* GetSelected() const
Int_t GetSelectedX() const
Int_t GetSelectedY() const
TVirtualPad* GetSelectedPad() const
void EnableSignalEvents(UInt_t f)
void DisableSignalEvents(UInt_t f)
Bool_t IsSignalEventEnabled(UInt_t f) const
void CanvasPainted()
void Saved(bool ok)
void polish()
void RootEventProcessed(TObject* selected, unsigned int event, TCanvas* c)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Author: Valeri Fine 23/01/2003
Last update: root/qt:$Name: $:$Id: TQtWidget.cxx,v 1.18 2005/09/20 06:38:10 brun Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.