Qt 4.8
Functions
qevent.cpp File Reference
#include "qevent.h"
#include "qcursor.h"
#include "qapplication.h"
#include "private/qapplication_p.h"
#include "private/qevent_p.h"
#include "private/qkeysequence_p.h"
#include "qwidget.h"
#include "qgraphicsview.h"
#include "qdebug.h"
#include "qmime.h"
#include "qdnd_p.h"
#include "qevent_p.h"
#include "qgesture.h"
#include "qgesture_p.h"

Go to the source code of this file.

Functions

QDebug operator<< (QDebug dbg, const QEvent *e)
 

Function Documentation

◆ operator<<()

QDebug operator<< ( QDebug  dbg,
const QEvent e 
)

Definition at line 3639 of file qevent.cpp.

3639  {
3640 #ifndef Q_BROKEN_DEBUG_STREAM
3641  // More useful event output could be added here
3642  if (!e)
3643  return dbg << "QEvent(this = 0x0)";
3644  const char *n = 0;
3645  switch (e->type()) {
3646  case QEvent::Timer:
3647  n = "Timer";
3648  break;
3650  case QEvent::MouseMove:
3653  {
3654  const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
3655  switch(me->type()) {
3657  n = "MouseButtonPress";
3658  break;
3659  case QEvent::MouseMove:
3660  n = "MouseMove";
3661  break;
3663  n = "MouseButtonRelease";
3664  break;
3666  default:
3667  n = "MouseButtonDblClick";
3668  break;
3669  }
3670  dbg.nospace() << "QMouseEvent(" << n
3671  << ", " << me->button()
3672  << ", " << hex << (int)me->buttons()
3673  << ", " << hex << (int)me->modifiers()
3674  << ')';
3675  }
3676  return dbg.space();
3677 
3678 #ifndef QT_NO_TOOLTIP
3679  case QEvent::ToolTip:
3680  n = "ToolTip";
3681  break;
3682 #endif
3684  n = "WindowActivate";
3685  break;
3687  n = "WindowDeactivate";
3688  break;
3690  n = "ActivationChange";
3691  break;
3692 #ifndef QT_NO_WHEELEVENT
3693  case QEvent::Wheel:
3694  dbg.nospace() << "QWheelEvent(" << static_cast<const QWheelEvent *>(e)->delta()
3695  << ')';
3696  return dbg.space();
3697 #endif
3698  case QEvent::KeyPress:
3699  case QEvent::KeyRelease:
3701  {
3702  const QKeyEvent *ke = static_cast<const QKeyEvent*>(e);
3703  switch(ke->type()) {
3705  n = "ShortcutOverride";
3706  break;
3707  case QEvent::KeyRelease:
3708  n = "KeyRelease";
3709  break;
3710  case QEvent::KeyPress:
3711  default:
3712  n = "KeyPress";
3713  break;
3714  }
3715  dbg.nospace() << "QKeyEvent(" << n
3716  << ", " << hex << ke->key()
3717  << ", " << hex << (int)ke->modifiers()
3718  << ", \"" << ke->text()
3719  << "\", " << ke->isAutoRepeat()
3720  << ", " << ke->count()
3721  << ')';
3722  }
3723  return dbg.space();
3724  case QEvent::FocusIn:
3725  n = "FocusIn";
3726  break;
3727  case QEvent::FocusOut:
3728  n = "FocusOut";
3729  break;
3730  case QEvent::Enter:
3731  n = "Enter";
3732  break;
3733  case QEvent::Leave:
3734  n = "Leave";
3735  break;
3736  case QEvent::PaletteChange:
3737  n = "PaletteChange";
3738  break;
3739  case QEvent::PolishRequest:
3740  n = "PolishRequest";
3741  break;
3742  case QEvent::Polish:
3743  n = "Polish";
3744  break;
3745  case QEvent::UpdateRequest:
3746  n = "UpdateRequest";
3747  break;
3748  case QEvent::Paint:
3749  n = "Paint";
3750  break;
3751  case QEvent::Move:
3752  n = "Move";
3753  break;
3754  case QEvent::Resize:
3755  n = "Resize";
3756  break;
3757  case QEvent::Create:
3758  n = "Create";
3759  break;
3760  case QEvent::Destroy:
3761  n = "Destroy";
3762  break;
3763  case QEvent::Close:
3764  n = "Close";
3765  break;
3766  case QEvent::Quit:
3767  n = "Quit";
3768  break;
3769  case QEvent::FileOpen:
3770  n = "FileOpen";
3771  break;
3772  case QEvent::Show:
3773  n = "Show";
3774  break;
3775  case QEvent::ShowToParent:
3776  n = "ShowToParent";
3777  break;
3778  case QEvent::Hide:
3779  n = "Hide";
3780  break;
3781  case QEvent::HideToParent:
3782  n = "HideToParent";
3783  break;
3784  case QEvent::None:
3785  n = "None";
3786  break;
3787  case QEvent::ParentChange:
3788  n = "ParentChange";
3789  break;
3791  n = "ParentAboutToChange";
3792  break;
3793  case QEvent::HoverEnter:
3794  n = "HoverEnter";
3795  break;
3796  case QEvent::HoverMove:
3797  n = "HoverMove";
3798  break;
3799  case QEvent::HoverLeave:
3800  n = "HoverLeave";
3801  break;
3802  case QEvent::ZOrderChange:
3803  n = "ZOrderChange";
3804  break;
3805  case QEvent::StyleChange:
3806  n = "StyleChange";
3807  break;
3808  case QEvent::DragEnter:
3809  n = "DragEnter";
3810  break;
3811  case QEvent::DragMove:
3812  n = "DragMove";
3813  break;
3814  case QEvent::DragLeave:
3815  n = "DragLeave";
3816  break;
3817  case QEvent::Drop:
3818  n = "Drop";
3819  break;
3821  n = "GraphicsSceneMouseMove";
3822  break;
3824  n = "GraphicsSceneMousePress";
3825  break;
3827  n = "GraphicsSceneMouseRelease";
3828  break;
3830  n = "GraphicsSceneMouseDoubleClick";
3831  break;
3833  n = "GraphicsSceneContextMenu";
3834  break;
3836  n = "GraphicsSceneHoverEnter";
3837  break;
3839  n = "GraphicsSceneHoverMove";
3840  break;
3842  n = "GraphicsSceneHoverLeave";
3843  break;
3845  n = "GraphicsSceneHelp";
3846  break;
3848  n = "GraphicsSceneDragEnter";
3849  break;
3851  n = "GraphicsSceneDragMove";
3852  break;
3854  n = "GraphicsSceneDragLeave";
3855  break;
3857  n = "GraphicsSceneDrop";
3858  break;
3860  n = "GraphicsSceneWheel";
3861  break;
3863  n = "GraphicsSceneResize";
3864  break;
3866  n = "GraphicsSceneMove";
3867  break;
3868  case QEvent::CursorChange:
3869  n = "CursorChange";
3870  break;
3871  case QEvent::ToolTipChange:
3872  n = "ToolTipChange";
3873  break;
3874  case QEvent::StatusTip:
3875  n = "StatusTip";
3876  break;
3877  case QEvent::WhatsThis:
3878  n = "WhatsThis";
3879  break;
3880  case QEvent::FontChange:
3881  n = "FontChange";
3882  break;
3883  case QEvent::Style:
3884  n = "Style";
3885  break;
3887  n = "KeyboardLayoutChange";
3888  break;
3890  n = "DynamicPropertyChange";
3891  break;
3892  case QEvent::GrabMouse:
3893  n = "GrabMouse";
3894  break;
3895  case QEvent::UngrabMouse:
3896  n = "UngrabMouse";
3897  break;
3898  case QEvent::GrabKeyboard:
3899  n = "GrabKeyboard";
3900  break;
3902  n = "UngrabKeyboard";
3903  break;
3904 #ifdef QT3_SUPPORT
3905  case QEvent::ChildInsertedRequest:
3906  n = "ChildInsertedRequest";
3907  break;
3908  case QEvent::ChildInserted: n = "ChildInserted";
3909 #endif
3910  case QEvent::ChildAdded: n = n ? n : "ChildAdded";
3911  case QEvent::ChildPolished: n = n ? n : "ChildPolished";
3912  case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
3913  dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
3914  return dbg.space();
3915 #ifndef QT_NO_GESTURES
3916  case QEvent::Gesture:
3917  n = "Gesture";
3918  break;
3919 #endif
3920  default:
3921  dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
3922  return dbg.space();
3923  }
3924 
3925  dbg.nospace() << 'Q' << n << "Event(" << (const void *)e << ')';
3926  return dbg.space();
3927 #else
3928  qWarning("This compiler doesn't support streaming QEvent to QDebug");
3929  return dbg;
3930  Q_UNUSED(e);
3931 #endif
3932 }
The QKeyEvent class describes a key event.
Definition: qevent.h:224
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition: qevent.cpp:999
int key() const
Returns the code of the key that was pressed or released.
Definition: qevent.h:231
Q_CORE_EXPORT void qWarning(const char *,...)
int count() const
Returns the number of keys involved in this event.
Definition: qevent.h:238
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
The QChildEvent class contains event parameters for child object events.
Definition: qcoreevent.h:353
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition: qevent.h:102
QString text() const
Returns the Unicode text that this key generated.
Definition: qevent.h:236
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
Definition: qevent.h:237
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately before the event occurred.
Definition: qevent.h:79
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729