Qt 4.8
Public Functions | Static Public Functions | List of all members
QETWidget Class Reference
Inheritance diagram for QETWidget:
QWidget QWidget QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject

Public Functions

QWidgetPrivated_func ()
 
QWidgetDatadataPtr ()
 
void doDeferredMap ()
 
QWidgetPrivatedptr ()
 
void forceUpdate ()
 
QRect frameStrut () const
 
void hideChildren (bool spontaneous)
 
void markFrameStrutDirty ()
 
QTLWExtramaybeTopData ()
 
bool raiseOnClick ()
 
void repaintDecoration (QRegion r, bool post)
 
void repolishStyle (QStyle &style)
 
void setWindowTitle_helper (const QString &title)
 
void showChildren (bool spontaneous)
 
void syncBackingStore (const QRegion &rgn)
 
void syncBackingStore ()
 
uint testWindowState (uint teststate)
 
QTLWExtratopData ()
 
bool translateCloseEvent (const MSG &msg)
 
bool translateCloseEvent (const XEvent *)
 
bool translateConfigEvent (const MSG &msg)
 
bool translateConfigEvent (const XEvent *)
 
void translateEmbedEvent (const QWSEmbedEvent *event)
 
bool translateGestureEvent (const MSG &msg, const GESTUREINFO &gi)
 
bool translateKeyEvent (const QWSKeyEvent *, bool grab)
 
bool translateMouseEvent (const QWSMouseEvent *, int oldstate)
 
bool translateMouseEvent (const MSG &msg)
 
bool translateMouseEvent (const XEvent *)
 
bool translatePaintEvent (const MSG &msg)
 
void translatePaintEvent (const XEvent *)
 
bool translatePropertyEvent (const XEvent *)
 
bool translateRegionEvent (const QWSRegionEvent *)
 
bool translateScrollDoneEvent (const XEvent *)
 
bool translateTabletEvent (const MSG &msg, PACKET *localPacketBuf, int numPackets)
 
bool translateWheelEvent (const QWSMouseEvent *me)
 
bool translateWheelEvent (const MSG &msg)
 
bool translateWheelEvent (int global_x, int global_y, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient)
 
bool translateXinputEvent (const XEvent *, QTabletDeviceData *tablet)
 
void updateRegion ()
 
bool winEvent (MSG *m, long *r)
 This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More...
 
QWExtraxtra ()
 
- Public Functions inherited from QWidget
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 Returns the (possibly empty) list of this widget's actions. More...
 
void activateWindow ()
 Sets the top-level widget containing this widget to be the active window. More...
 
void addAction (QAction *action)
 Appends the action action to this widget's list of actions. More...
 
void addActions (QList< QAction *> actions)
 Appends the actions actions to this widget's list of actions. More...
 
void adjustSize ()
 Adjusts the size of the widget to fit its contents. More...
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 Returns the background role of the widget. More...
 
QSize baseSize () const
 
QWidgetchildAt (int x, int y) const
 Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. More...
 
QWidgetchildAt (const QPoint &p) const
 Returns the visible child widget at point p in the widget's own coordinate system. More...
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 Takes keyboard input focus from the widget. More...
 
void clearMask ()
 Removes any mask set by setMask(). More...
 
QMargins contentsMargins () const
 The contentsMargins function returns the widget's contents margins. More...
 
QRect contentsRect () const
 Returns the area inside the widget's margins. More...
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
void createWinId ()
 
QCursor cursor () const
 
int devType () const
 
WId effectiveWinId () const
 Returns the effective window system identifier of the widget, i. More...
 
void ensurePolished () const
 Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette). More...
 
Qt::FocusPolicy focusPolicy () const
 
QWidgetfocusProxy () const
 Returns the focus proxy, or 0 if there is no focus proxy. More...
 
QWidgetfocusWidget () const
 Returns the last child of this widget that setFocus had been called on. More...
 
const QFontfont () const
 
QFontInfo fontInfo () const
 Returns the font info for the widget's current font. More...
 
QFontMetrics fontMetrics () const
 Returns the font metrics for the widget's current font. More...
 
QPalette::ColorRole foregroundRole () const
 Returns the foreground role. More...
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 Returns the widget's contents margins for left, top, right, and bottom. More...
 
HDC getDC () const
 Returns the window system handle of the widget, for low-level access. More...
 
void grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
 Subscribes the widget to a given gesture with specific flags. More...
 
void grabKeyboard ()
 Grabs the keyboard input. More...
 
void grabMouse ()
 Grabs the mouse input. More...
 
void grabMouse (const QCursor &)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. More...
 
QGraphicsEffectgraphicsEffect () const
 The graphicsEffect function returns a pointer to the widget's graphics effect. More...
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns 0. More...
 
bool hasFocus () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int) const
 Returns the preferred height for this widget, given the width w. More...
 
QInputContextinputContext ()
 This function returns the QInputContext for this widget. More...
 
Qt::InputMethodHints inputMethodHints () const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
 This method is only relevant for input widgets. More...
 
void insertAction (QAction *before, QAction *action)
 Inserts the action action to this widget's list of actions, before the action before. More...
 
void insertActions (QAction *before, QList< QAction *> actions)
 Inserts the actions actions to this widget's list of actions, before the action before. More...
 
WId internalWinId () const
 Returns the window system identifier of the widget, or 0 if the widget is not created yet. More...
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false. More...
 
bool isEnabled () const
 
bool isEnabledTo (QWidget *) const
 Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false. More...
 
bool isEnabledToTLW () const
 This function is deprecated. More...
 
bool isFullScreen () const
 
bool isHidden () const
 Returns true if the widget is hidden, otherwise returns false. More...
 
bool isLeftToRight () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isRightToLeft () const
 
bool isTopLevel () const
 Use isWindow() instead. More...
 
bool isVisible () const
 
bool isVisibleTo (QWidget *) const
 Returns true if this widget would become visible if ancestor is shown; otherwise returns false. More...
 
bool isWindow () const
 Returns true if the widget is an independent window, otherwise returns false. More...
 
bool isWindowModified () const
 
QLayoutlayout () const
 Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed. More...
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
Qt::HANDLE macCGHandle () const
 Returns the CoreGraphics handle of the widget. More...
 
Qt::HANDLE macQDHandle () const
 Returns the QuickDraw handle of the widget. More...
 
QPoint mapFrom (QWidget *, const QPoint &) const
 Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. More...
 
QPoint mapFromGlobal (const QPoint &) const
 Translates the global screen coordinate pos to widget coordinates. More...
 
QPoint mapFromParent (const QPoint &) const
 Translates the parent widget coordinate pos to widget coordinates. More...
 
QPoint mapTo (QWidget *, const QPoint &) const
 Translates the widget coordinate pos to the coordinate system of parent. More...
 
QPoint mapToGlobal (const QPoint &) const
 Translates the widget coordinate pos to global screen coordinates. More...
 
QPoint mapToParent (const QPoint &) const
 Translates the widget coordinate pos to a coordinate in the parent widget. More...
 
QRegion mask () const
 Returns the mask currently set on a widget. More...
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
virtual QSize minimumSizeHint () const
 
int minimumWidth () const
 
void move (int x, int y)
 This corresponds to move(QPoint(x, y)). More...
 
void move (const QPoint &)
 
QWidgetnativeParentWidget () const
 Returns the native parent for this widget, i. More...
 
QWidgetnextInFocusChain () const
 Returns the next widget in this widget's focus chain. More...
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags type)
 Sets the window flags for the widget to flags, without telling the window system. More...
 
void overrideWindowState (Qt::WindowStates state)
 
QPaintEnginepaintEngine () const
 Returns the widget's paint engine. More...
 
const QPalettepalette () const
 
QWidgetparentWidget () const
 Returns the parent of this widget, or 0 if it does not have any parent widget. More...
 
QPoint pos () const
 
QWidgetpreviousInFocusChain () const
 The previousInFocusChain function returns the previous widget in this widget's focus chain. More...
 
 QWidget (QWidget *parent=0, Qt::WindowFlags f=0)
 Constructs a widget which is a child of parent, with widget flags set to f. More...
 
QRect rect () const
 
void releaseDC (HDC) const
 Releases the HDC hdc acquired by a previous call to getDC(). More...
 
void releaseKeyboard ()
 Releases the keyboard grab. More...
 
void releaseMouse ()
 Releases the mouse grab. More...
 
void releaseShortcut (int id)
 Removes the shortcut with the given id from Qt's shortcut system. More...
 
void removeAction (QAction *action)
 Removes the action action from this widget's list of actions. More...
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. More...
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the widget into the painter's QPainter::device(). More...
 
void repaint (int x, int y, int w, int h)
 This version repaints a rectangle (x, y, w, h) inside the widget. More...
 
void repaint (const QRect &)
 This version repaints a rectangle rect inside the widget. More...
 
void repaint (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void resize (int w, int h)
 This corresponds to resize(QSize(w, h)). More...
 
void resize (const QSize &)
 
bool restoreGeometry (const QByteArray &geometry)
 Restores the geometry and state top-level widgets stored in the byte array geometry. More...
 
QByteArray saveGeometry () const
 Saves the current geometry and state for top-level widgets. More...
 
void scroll (int dx, int dy)
 Scrolls the widget including its children dx pixels to the right and dy downward. More...
 
void scroll (int dx, int dy, const QRect &)
 This version only scrolls r and does not move the children of the widget. More...
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute, bool on=true)
 Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. More...
 
void setAutoFillBackground (bool enabled)
 
void setBackgroundRole (QPalette::ColorRole)
 Sets the background role of the widget to role. More...
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 This corresponds to setBaseSize(QSize(basew, baseh)). More...
 
void setContentsMargins (int left, int top, int right, int bottom)
 Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. More...
 
void setContentsMargins (const QMargins &margins)
 The setContentsMargins function sets the margins around the widget's contents. More...
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &)
 
void setFixedHeight (int h)
 Sets both the minimum and maximum heights of the widget to h without changing the widths. More...
 
void setFixedSize (const QSize &)
 Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. More...
 
void setFixedSize (int w, int h)
 Sets the width of the widget to w and the height to h. More...
 
void setFixedWidth (int w)
 Sets both the minimum and maximum width of the widget to w without changing the heights. More...
 
void setFocus (Qt::FocusReason reason)
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *)
 Sets the widget's focus proxy to widget w. More...
 
void setFont (const QFont &)
 Use the single-argument overload instead. More...
 
void setForegroundRole (QPalette::ColorRole)
 Sets the foreground role of the widget to role. More...
 
void setGeometry (int x, int y, int w, int h)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). More...
 
void setGeometry (const QRect &)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 The setGraphicsEffect function is for setting the widget's graphics effect. More...
 
void setInputContext (QInputContext *)
 This function sets the input context context on this widget. More...
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *)
 Sets the layout manager for this widget to layout. More...
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &)
 Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. More...
 
void setMask (const QRegion &)
 Causes only the parts of the widget which overlap region to be visible. More...
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 This function corresponds to setMaximumSize(QSize(maxw, maxh)). More...
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 This function corresponds to setMinimumSize(QSize(minw, minh)). More...
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &)
 Use the single-argument overload instead. More...
 
void setParent (QWidget *parent)
 Sets the parent of the widget to parent, and resets the window flags. More...
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 This function also takes widget flags, f as an argument. More...
 
void setShortcutAutoRepeat (int id, bool enable=true)
 If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled. More...
 
void setShortcutEnabled (int id, bool enable=true)
 If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. More...
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 Sets the x (width) size increment to w and the y (height) size increment to h. More...
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. More...
 
void setStatusTip (const QString &)
 
void setStyle (QStyle *)
 Sets the widget's GUI style to style. More...
 
void setToolTip (const QString &)
 
void setUpdatesEnabled (bool enable)
 
void setupUi (QWidget *widget)
 Sets up the user interface for the specified widget. More...
 
void setWhatsThis (const QString &)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags type)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowIconText (const QString &)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &)
 Sets the window's role to role. More...
 
void setWindowState (Qt::WindowStates state)
 Sets the window state to windowState. More...
 
void setWindowSurface (QWindowSurface *surface)
 Sets the window surface to be the surface specified. More...
 
QSize size () const
 
virtual QSize sizeHint () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *)
 Places the widget under w in the parent widget's stack. More...
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute) const
 Returns true if attribute attribute is set on this widget; otherwise returns false. More...
 
QString toolTip () const
 
QWidgettopLevelWidget () const
 
bool underMouse () const
 Returns true if the widget is under the mouse cursor; otherwise returns false. More...
 
void ungrabGesture (Qt::GestureType type)
 Unsubscribes the widget from a given gesture type. More...
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (int x, int y, int w, int h)
 This version updates a rectangle (x, y, w, h) inside the widget. More...
 
void update (const QRect &)
 This version updates a rectangle rect inside the widget. More...
 
void update (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void updateGeometry ()
 Notifies the layout system that this widget has changed and may need to change geometry. More...
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 Returns the unobscured region where paint events can occur. More...
 
QString whatsThis () const
 
int width () const
 
QWidgetwindow () const
 Returns the window for this widget, i.e. More...
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 Window flags are a combination of a type (e. More...
 
QIcon windowIcon () const
 
QString windowIconText () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 Returns the window's role, or an empty string. More...
 
Qt::WindowStates windowState () const
 Returns the current window state. More...
 
QWindowSurfacewindowSurface () const
 Returns the QWindowSurface this widget will be drawn into. More...
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 Returns the window type of this widget. More...
 
WId winId () const
 Returns the window system identifier of the widget. More...
 
int x () const
 
const QX11Infox11Info () const
 Returns information about the configuration of the X display used to display the widget. More...
 
Qt::HANDLE x11PictureHandle () const
 Returns the X11 Picture handle of the widget for XRender support. More...
 
int y () const
 
 ~QWidget ()
 Destroys the widget. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Static Public Functions

static bool sendSpontaneousEvent (QObject *r, QEvent *e)
 
- Static Public Functions inherited from QWidget
static QWidgetfind (WId)
 Returns a pointer to the widget with window identifer/handle id. More...
 
static QWidgetkeyboardGrabber ()
 Returns the widget that is currently grabbing the keyboard input. More...
 
static QWidgetmouseGrabber ()
 Returns the widget that is currently grabbing the mouse input. More...
 
static void setTabOrder (QWidget *, QWidget *)
 Puts the second widget after the first widget in the focus order. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 

Additional Inherited Members

- Public Types inherited from QWidget
enum  RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 }
 This enum describes how to render the widget when calling QWidget::render(). More...
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Public Slots inherited from QWidget
bool close ()
 Closes this widget. More...
 
void hide ()
 Hides the widget. More...
 
void lower ()
 Lowers the widget to the bottom of the parent widget's stack. More...
 
void raise ()
 Raises this widget to the top of the parent widget's stack. More...
 
void repaint ()
 Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. More...
 
void setDisabled (bool)
 Disables widget input events if disable is true; otherwise enables input events. More...
 
void setEnabled (bool)
 
void setFocus ()
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setHidden (bool hidden)
 Convenience function, equivalent to setVisible(!hidden). More...
 
QT_MOC_COMPAT void setShown (bool shown)
 Use setVisible(shown) instead. More...
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool)
 
void setWindowTitle (const QString &)
 
void show ()
 Shows the widget and its child widgets. More...
 
void showFullScreen ()
 Shows the widget in full-screen mode. More...
 
void showMaximized ()
 Shows the widget maximized. More...
 
void showMinimized ()
 Shows the widget minimized, as an icon. More...
 
void showNormal ()
 Restores the widget after it has been maximized or minimized. More...
 
void update ()
 Updates the widget unless updates are disabled or the widget is hidden. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 Updates the widget's micro focus. More...
 
- Protected Functions inherited from QWidget
virtual void actionEvent (QActionEvent *)
 This event handler is called with the given event whenever the widget's actions are changed. More...
 
virtual void changeEvent (QEvent *)
 This event handler can be reimplemented to handle state changes. More...
 
virtual void closeEvent (QCloseEvent *)
 This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. More...
 
virtual void contextMenuEvent (QContextMenuEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. More...
 
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 Creates a new widget window if window is 0, otherwise sets the widget's window to window. More...
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 Frees up window system resources. More...
 
virtual void dragEnterEvent (QDragEnterEvent *)
 This event handler is called when a drag is in progress and the mouse enters this widget. More...
 
virtual void dragLeaveEvent (QDragLeaveEvent *)
 This event handler is called when a drag is in progress and the mouse leaves this widget. More...
 
virtual void dragMoveEvent (QDragMoveEvent *)
 This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus. More...
 
virtual void dropEvent (QDropEvent *)
 This event handler is called when the drag is dropped on this widget. More...
 
virtual void enabledChange (bool)
 
virtual void enterEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. More...
 
bool event (QEvent *)
 This is the main event handler; it handles event event. More...
 
virtual void focusInEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. More...
 
bool focusNextChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual bool focusNextPrevChild (bool next)
 Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void focusOutEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. More...
 
bool focusPreviousChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void fontChange (const QFont &)
 
virtual void hideEvent (QHideEvent *)
 This event handler can be reimplemented in a subclass to receive widget hide events. More...
 
virtual void inputMethodEvent (QInputMethodEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. More...
 
virtual void keyPressEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget. More...
 
virtual void keyReleaseEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. More...
 
virtual void languageChange ()
 
virtual void leaveEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. More...
 
virtual bool macEvent (EventHandlerCallRef, EventRef)
 This special event handler can be reimplemented in a subclass to receive native Macintosh events. More...
 
int metric (PaintDeviceMetric) const
 Internal implementation of the virtual QPaintDevice::metric() function. More...
 
virtual void mouseDoubleClickEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget. More...
 
virtual void mouseMoveEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. More...
 
virtual void mousePressEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget. More...
 
virtual void mouseReleaseEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. More...
 
virtual void moveEvent (QMoveEvent *)
 This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. More...
 
virtual void paintEvent (QPaintEvent *)
 This event handler can be reimplemented in a subclass to receive paint events passed in event. More...
 
virtual void paletteChange (const QPalette &)
 
 QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f)
 
virtual bool qwsEvent (QWSEvent *)
 This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux events which are passed in the event parameter. More...
 
void resetInputContext ()
 This function can be called on the widget that currently has focus to reset the input method operating on it. More...
 
virtual void resizeEvent (QResizeEvent *)
 This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. More...
 
virtual void showEvent (QShowEvent *)
 This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. More...
 
virtual void styleChange (QStyle &)
 
virtual void tabletEvent (QTabletEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. More...
 
virtual void wheelEvent (QWheelEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget. More...
 
virtual void windowActivationChange (bool)
 
virtual bool x11Event (XEvent *)
 This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Variables inherited from QPaintDevice
ushort painters
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 431 of file qapplication_qws.cpp.

Functions

◆ d_func()

QWidgetPrivate* QETWidget::d_func ( )
inline

Definition at line 570 of file qapplication_x11.cpp.

Referenced by QApplication::qwsProcessEvent(), and QApplication::x11ProcessEvent().

570 { return QWidget::d_func(); }

◆ dataPtr()

QWidgetData* QETWidget::dataPtr ( )
inline

Definition at line 473 of file qapplication_win.cpp.

Referenced by QtWndProc().

473 { return data; }
QWidgetData * data
Definition: qwidget.h:815

◆ doDeferredMap()

void QETWidget::doDeferredMap ( )
inline

Definition at line 583 of file qapplication_x11.cpp.

Referenced by QApplication::x11ProcessEvent().

584  {
587  adjustSize();
589  }
590 
591  /*
592  workaround for WM's that throw away ConfigureRequests from the following:
593 
594  window->hide();
595  window->move(x, y); // could also be resize(), move()+resize(), or setGeometry()
596  window->show();
597  */
598  QRect r = geometry();
599 
600  XMoveResizeWindow(X11->display,
601  internalWinId(),
602  r.x(),
603  r.y(),
604  r.width(),
605  r.height());
606 
607  // static gravity!
608  XSizeHints sh;
609  memset(&sh, 0, sizeof(sh));
610  long unused;
611  XGetWMNormalHints(X11->display, internalWinId(), &sh, &unused);
612  sh.flags |= USPosition | PPosition | USSize | PSize | PWinGravity;
613  sh.x = r.x();
614  sh.y = r.y();
615  sh.width = r.width();
616  sh.height = r.height();
617  sh.win_gravity = StaticGravity;
618  XSetWMNormalHints(X11->display, internalWinId(), &sh);
619 
622  return;
624  XMapWindow(X11->display, internalWinId());
625  }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
QWidgetPrivate * d_func()
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void adjustSize()
Adjusts the size of the widget to fit its contents.
Definition: qwidget.cpp:8488
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
const QRect & geometry() const
uint waitingForMapNotify
Definition: qwidget_p.h:197

◆ dptr()

QWidgetPrivate* QETWidget::dptr ( )
inline

Definition at line 474 of file qapplication_win.cpp.

Referenced by QtWndProc().

474 { return d_func(); }
QWidgetPrivate * d_func()

◆ forceUpdate()

void QETWidget::forceUpdate ( )
inline

Definition at line 492 of file qapplication_win.cpp.

492  {
493  QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
494  if (tlwExtra && tlwExtra->backingStore)
495  tlwExtra->backingStore->markDirty(rect(), this, true, true);
496  }
void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately=false, bool invalidateBuffer=false)
Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest e...
QRect rect() const
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166

◆ frameStrut()

QRect QETWidget::frameStrut ( ) const
inline

Definition at line 475 of file qapplication_win.cpp.

Referenced by QtWndProc().

475 { return d_func()->frameStrut(); }
QWidgetPrivate * d_func()
QRect frameStrut() const
Definition: qwidget.cpp:12607

◆ hideChildren()

void QETWidget::hideChildren ( bool  spontaneous)
inline

Definition at line 489 of file qapplication_win.cpp.

Referenced by QtWndProc().

489 { d_func()->hideChildren(spontaneous); }
QWidgetPrivate * d_func()
void hideChildren(bool spontaneous)
Definition: qwidget.cpp:8167

◆ markFrameStrutDirty()

void QETWidget::markFrameStrutDirty ( )
inline

Definition at line 477 of file qapplication_win.cpp.

Referenced by QtWndProc().

477 { data->fstrut_dirty = 1; }
QWidgetData * data
Definition: qwidget.h:815
uint fstrut_dirty
Definition: qwidget.h:126

◆ maybeTopData()

QTLWExtra* QETWidget::maybeTopData ( )
inline

Definition at line 470 of file qapplication_win.cpp.

470 { return d_func()->maybeTopData(); }
QTLWExtra * maybeTopData() const
Definition: qwidget_p.h:1010
QWidgetPrivate * d_func()

◆ raiseOnClick()

bool QETWidget::raiseOnClick ( )
inline

Definition at line 444 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

445  {
446  // With limited windowmanagement/taskbar/etc., raising big windows
447  // (eg. spreadsheet) over the top of everything else (eg. calculator)
448  // is just annoying.
449  return !isMaximized() && !isFullScreen();
450  }
bool isMaximized() const
Definition: qwidget.cpp:3074
bool isFullScreen() const
Definition: qwidget.cpp:3153

◆ repaintDecoration()

void QETWidget::repaintDecoration ( QRegion  r,
bool  post 
)

Definition at line 3631 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

3632 {
3633  Q_UNUSED(post);
3634 #ifdef QT_NO_QWS_MANAGER
3635  Q_UNUSED(r);
3636 #else
3637  //please note that qwsManager is a QObject, not a QWidget.
3638  //therefore, normal ways of painting do not work.
3639  // However, it does listen to paint events.
3640 
3641  Q_D(QWidget);
3642  if (isWindow() && d->topData()->qwsManager && isVisible()) {
3643  QWSManager *manager = d->topData()->qwsManager;
3644  r &= manager->region();
3645  if (!r.isEmpty())
3646  manager->repaintRegion(QDecoration::All, QDecoration::Normal);
3647  }
3648 #endif
3649 }
double d
Definition: qnumeric_p.h:62
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_D(Class)
Definition: qglobal.h:2482
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
#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
friend class QWSManager
Definition: qwidget.h:786

◆ repolishStyle()

void QETWidget::repolishStyle ( QStyle style)

Definition at line 3039 of file qapplication_win.cpp.

Referenced by QtWndProc().

3040 {
3042  QApplication::sendEvent(this, &e);
3043 }
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56

◆ sendSpontaneousEvent()

static bool QETWidget::sendSpontaneousEvent ( QObject r,
QEvent e 
)
inlinestatic

Definition at line 587 of file qkeymapper_win.cpp.

Referenced by QKeyMapperPrivate::isADeadKey().

588  { return QApplication::sendSpontaneousEvent(r, e); }
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)

◆ setWindowTitle_helper()

void QETWidget::setWindowTitle_helper ( const QString title)
inline

Definition at line 491 of file qapplication_win.cpp.

Referenced by QtWndProc().

491 { d_func()->setWindowTitle_helper(title); }
QWidgetPrivate * d_func()
void setWindowTitle_helper(const QString &cap)
Definition: qwidget.cpp:6285

◆ showChildren()

void QETWidget::showChildren ( bool  spontaneous)
inline

Definition at line 488 of file qapplication_win.cpp.

Referenced by QtWndProc().

488 { d_func()->showChildren(spontaneous); }
QWidgetPrivate * d_func()
void showChildren(bool spontaneous)
Definition: qwidget.cpp:8144

◆ syncBackingStore() [1/2]

void QETWidget::syncBackingStore ( const QRegion rgn)
inline

Definition at line 471 of file qapplication_win.cpp.

471 { d_func()->syncBackingStore(rgn); }
void syncBackingStore()
Definition: qwidget.cpp:1912
QWidgetPrivate * d_func()

◆ syncBackingStore() [2/2]

void QETWidget::syncBackingStore ( )
inline

Definition at line 472 of file qapplication_win.cpp.

472 { d_func()->syncBackingStore(); }
void syncBackingStore()
Definition: qwidget.cpp:1912
QWidgetPrivate * d_func()

◆ testWindowState()

uint QETWidget::testWindowState ( uint  teststate)
inline

Definition at line 490 of file qapplication_win.cpp.

Referenced by QtWndProc().

490 { return dataPtr()->window_state & teststate; }
uint window_state
Definition: qwidget.h:120
QWidgetData * dataPtr()

◆ topData()

QTLWExtra* QETWidget::topData ( )
inline

Definition at line 469 of file qapplication_win.cpp.

Referenced by QtWndProc().

469 { return d_func()->topData(); }
QWidgetPrivate * d_func()
QTLWExtra * topData() const
Definition: qwidget_p.h:1004

◆ translateCloseEvent() [1/2]

bool QETWidget::translateCloseEvent ( const MSG msg)

Definition at line 3963 of file qapplication_win.cpp.

Referenced by QtWndProc(), and QApplication::x11ClientMessage().

3964 {
3966 }
QWidgetPrivate * d_func()
bool close_helper(CloseMode mode)
Definition: qwidget.cpp:8218

◆ translateCloseEvent() [2/2]

bool QETWidget::translateCloseEvent ( const XEvent )

Definition at line 5446 of file qapplication_x11.cpp.

5447 {
5448  Q_D(QWidget);
5449  return d->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
5450 }
double d
Definition: qnumeric_p.h:62
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_D(Class)
Definition: qglobal.h:2482

◆ translateConfigEvent() [1/2]

bool QETWidget::translateConfigEvent ( const MSG msg)

Definition at line 3832 of file qapplication_win.cpp.

Referenced by QtWndProc(), and QApplication::x11ProcessEvent().

3833 {
3834  if (!testAttribute(Qt::WA_WState_Created)) // in QWidget::create()
3835  return true;
3837  return true;
3839  return true;
3840  if (!isWindow())
3841  return true;
3842  setAttribute(Qt::WA_WState_ConfigPending); // set config flag
3843  QRect cr = geometry();
3844  if (msg.message == WM_SIZE) { // resize event
3845  WORD a = LOWORD(msg.lParam);
3846  WORD b = HIWORD(msg.lParam);
3847  QSize oldSize = size();
3848  QSize newSize(a, b);
3849 #ifdef Q_WS_WINCE_WM
3850  if (isFullScreen() && (oldSize.width() == newSize.height()) && (oldSize.height() == newSize.width()))
3852 #endif
3853  cr.setSize(newSize);
3854  if (msg.wParam != SIZE_MINIMIZED)
3855  data->crect = cr;
3856  if (isWindow()) { // update title/icon text
3857  d_func()->createTLExtra();
3858  // Capture SIZE_MINIMIZED without preceding WM_SYSCOMMAND
3859  // (like Windows+M)
3860  if (msg.wParam == SIZE_MINIMIZED && !isMinimized()) {
3861 #ifndef Q_WS_WINCE
3862  const QString title = windowIconText();
3863  if (!title.isEmpty())
3864  d_func()->setWindowTitle_helper(title);
3865 #endif
3867  if (isVisible()) {
3868  QHideEvent e;
3870  hideChildren(true);
3871  }
3872  } else if (msg.wParam != SIZE_MINIMIZED) {
3873  bool window_state_changed = false;
3874  Qt::WindowStates oldstate = Qt::WindowStates(dataPtr()->window_state);
3875  if (isMinimized()) {
3876 #ifndef Q_WS_WINCE
3877  const QString title = windowTitle();
3878  if (!title.isEmpty())
3879  d_func()->setWindowTitle_helper(title);
3880 #endif
3882  showChildren(true);
3883  QShowEvent e;
3885  // Capture SIZE_MAXIMIZED and SIZE_RESTORED without preceding WM_SYSCOMMAND
3886  // (Aero Snap on Win7)
3887  } else if (msg.wParam == SIZE_MAXIMIZED && !isMaximized()) {
3889  window_state_changed = true;
3890  } else if (msg.wParam == SIZE_RESTORED && isMaximized()) {
3892  window_state_changed = true;
3893  }
3894  if (window_state_changed) {
3895  QWindowStateChangeEvent e(oldstate);
3897  }
3898  }
3899  }
3900  if (msg.wParam != SIZE_MINIMIZED && oldSize != newSize) {
3901  if (isVisible()) {
3902  QTLWExtra *tlwExtra = maybeTopData();
3903  static bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt();
3904  const bool hasStaticContents = tlwExtra && tlwExtra->backingStore
3905  && tlwExtra->backingStore->hasStaticContents();
3906  // If we have a backing store with static contents, we have to disable the top-level
3907  // resize optimization in order to get invalidated regions for resized widgets.
3908  // The optimization discards all invalidateBuffer() calls since we're going to
3909  // repaint everything anyways, but that's not the case with static contents.
3910  if (!slowResize && tlwExtra && !hasStaticContents)
3911  tlwExtra->inTopLevelResize = true;
3912  QResizeEvent e(newSize, oldSize);
3914  if (d_func()->paintOnScreen()) {
3917  updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
3919  } else {
3920  d_func()->syncBackingStore();
3921  }
3922  if (!slowResize && tlwExtra)
3923  tlwExtra->inTopLevelResize = false;
3924  } else {
3925  QResizeEvent *e = new QResizeEvent(newSize, oldSize);
3926  QApplication::postEvent(this, e);
3927  }
3928  }
3929  } else if (msg.message == WM_MOVE) { // move event
3930  int a = (int) (short) LOWORD(msg.lParam);
3931  int b = (int) (short) HIWORD(msg.lParam);
3932  QPoint oldPos = geometry().topLeft();
3933  QPoint newCPos(a, b);
3934  // Ignore silly Windows move event to wild pos after iconify.
3935 #if !defined(Q_WS_WINCE)
3936  if (!IsIconic(internalWinId()) && newCPos != oldPos) {
3937 #endif
3938  cr.moveTopLeft(newCPos);
3939  data->crect = cr;
3940  if (isVisible()) {
3941  QMoveEvent e(newCPos, oldPos); // cpos (client position)
3943  } else {
3944  QMoveEvent * e = new QMoveEvent(newCPos, oldPos);
3945  QApplication::postEvent(this, e);
3946  }
3947 #if !defined(Q_WS_WINCE)
3948  }
3949 #endif
3950  }
3951  setAttribute(Qt::WA_WState_ConfigPending, false); // clear config flag
3952  return true;
3953 }
void hideChildren(bool spontaneous)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QSize size() const
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
bool isVisible() const
Definition: qwidget.h:1005
void qt_wince_hide_taskbar(HWND hwnd)
QString windowIconText() const
uint window_state
Definition: qwidget.h:120
void syncBackingStore()
Definition: qwidget.cpp:1912
uint inTopLevelResize
Definition: qwidget_p.h:188
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
void showChildren(bool spontaneous)
int width() const
Returns the width.
Definition: qsize.h:126
QWidgetPrivate * d_func()
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
void createTLExtra()
Definition: qwidget.cpp:1755
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
QWidgetData * data
Definition: qwidget.h:815
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
QString windowTitle() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
bool hasStaticContents() const
void setWindowTitle_helper(const QString &cap)
Definition: qwidget.cpp:6285
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
QRect rect() const
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
Definition: qrect.h:368
bool isMaximized() const
Definition: qwidget.cpp:3074
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
bool isFullScreen() const
Definition: qwidget.cpp:3153
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
QTLWExtra * maybeTopData()
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
bool isMinimized() const
Definition: qwidget.cpp:3027
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166
QWidgetData * dataPtr()
const QRect & geometry() const
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ translateConfigEvent() [2/2]

bool QETWidget::translateConfigEvent ( const XEvent event)

Definition at line 5268 of file qapplication_x11.cpp.

5269 {
5271 
5272  Q_D(QWidget);
5273  bool wasResize = testAttribute(Qt::WA_WState_ConfigPending); // set in QWidget::setGeometry_sys()
5275 
5277  // discard events for windows that have a geometry X can't handle
5278  XEvent xevent;
5279  while (XCheckTypedWindowEvent(X11->display,internalWinId(), ConfigureNotify,&xevent) &&
5280  !qt_x11EventFilter(&xevent) &&
5281  !x11Event(&xevent)) // send event through filter
5282  ;
5283  return true;
5284  }
5285 
5286  const QSize oldSize = size();
5287 
5288  if (isWindow()) {
5289  QPoint newCPos(geometry().topLeft());
5290  QSize newSize(event->xconfigure.width, event->xconfigure.height);
5291 
5292  bool trust = isVisible()
5293  && (d->topData()->parentWinId == XNone ||
5294  d->topData()->parentWinId == QX11Info::appRootWindow());
5295  bool isCPos = false;
5296 
5297  if (event->xconfigure.send_event || trust) {
5298  // if a ConfigureNotify comes from a real sendevent request, we can
5299  // trust its values.
5300  newCPos.rx() = event->xconfigure.x + event->xconfigure.border_width;
5301  newCPos.ry() = event->xconfigure.y + event->xconfigure.border_width;
5302  isCPos = true;
5303  }
5304  if (isVisible())
5306 
5307  if (d->extra->compress_events) {
5308  // ConfigureNotify compression for faster opaque resizing
5309  XEvent otherEvent;
5310  while (XCheckTypedWindowEvent(X11->display, internalWinId(), ConfigureNotify,
5311  &otherEvent)) {
5312  if (qt_x11EventFilter(&otherEvent))
5313  continue;
5314 
5315  if (x11Event(&otherEvent))
5316  continue;
5317 
5318  if (otherEvent.xconfigure.event != otherEvent.xconfigure.window)
5319  continue;
5320 
5321  newSize.setWidth(otherEvent.xconfigure.width);
5322  newSize.setHeight(otherEvent.xconfigure.height);
5323 
5324  if (otherEvent.xconfigure.send_event || trust) {
5325  newCPos.rx() = otherEvent.xconfigure.x +
5326  otherEvent.xconfigure.border_width;
5327  newCPos.ry() = otherEvent.xconfigure.y +
5328  otherEvent.xconfigure.border_width;
5329  isCPos = true;
5330  }
5331  }
5332 #ifndef QT_NO_XSYNC
5333  qt_sync_request_event_data sync_event;
5334  sync_event.window = internalWinId();
5335  for (XEvent ev;;) {
5336  if (!XCheckIfEvent(X11->display, &ev, &qt_sync_request_scanner, (XPointer)&sync_event))
5337  break;
5338  }
5339 #endif // QT_NO_XSYNC
5340  }
5341 
5342  if (!isCPos) {
5343  // we didn't get an updated position of the toplevel.
5344  // either we haven't moved or there is a bug in the window manager.
5345  // anyway, let's query the position to be certain.
5346  int x, y;
5347  Window child;
5348  XTranslateCoordinates(X11->display, internalWinId(),
5349  QApplication::desktop()->screen(d->xinfo.screen())->internalWinId(),
5350  0, 0, &x, &y, &child);
5351  newCPos.rx() = x;
5352  newCPos.ry() = y;
5353  }
5354 
5355  QRect cr (geometry());
5356  if (newCPos != cr.topLeft()) { // compare with cpos (exluding frame)
5357  QPoint oldPos = geometry().topLeft();
5358  cr.moveTopLeft(newCPos);
5359  data->crect = cr;
5360  if (isVisible()) {
5361  QMoveEvent e(newCPos, oldPos); // pos (including frame), not cpos
5363  } else {
5365  }
5366  }
5367  if (newSize != cr.size()) { // size changed
5368  cr.setSize(newSize);
5369  data->crect = cr;
5370 
5371  uint old_state = data->window_state;
5372  if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))
5373  && !X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)))
5375  if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN)))
5377 
5378  if (old_state != data->window_state) {
5379  QWindowStateChangeEvent e((Qt::WindowStates) old_state);
5380  QApplication::sendEvent(this, &e);
5381  }
5382 
5383  if (!isVisible())
5385  wasResize = true;
5386  }
5387 
5388  } else {
5389  XEvent xevent;
5390  while (XCheckTypedWindowEvent(X11->display,internalWinId(), ConfigureNotify,&xevent) &&
5391  !qt_x11EventFilter(&xevent) &&
5392  !x11Event(&xevent)) // send event through filter
5393  ;
5394  }
5395 
5396  if (wasResize) {
5397  if (isVisible() && data->crect.size() != oldSize) {
5398  Q_ASSERT(d->extra->topextra);
5399  QWidgetBackingStore *bs = d->extra->topextra->backingStore.data();
5400  const bool hasStaticContents = bs && bs->hasStaticContents();
5401  // If we have a backing store with static contents, we have to disable the top-level
5402  // resize optimization in order to get invalidated regions for resized widgets.
5403  // The optimization discards all invalidateBuffer() calls since we're going to
5404  // repaint everything anyways, but that's not the case with static contents.
5405  if (!hasStaticContents)
5406  d->extra->topextra->inTopLevelResize = true;
5407  QResizeEvent e(data->crect.size(), oldSize);
5409  }
5410 
5411  const bool waitingForMapNotify = d->extra->topextra && d->extra->topextra->waitingForMapNotify;
5412  if (!waitingForMapNotify) {
5413  if (d->paintOnScreen()) {
5416  updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
5417  d->syncBackingStore(updateRegion);
5418  } else {
5419  d->syncBackingStore();
5420  }
5421  }
5422 
5423  if (d->extra && d->extra->topextra)
5424  d->extra->topextra->inTopLevelResize = false;
5425  }
5426 #ifndef QT_NO_XSYNC
5427  if (QTLWExtra *tlwExtra = d->maybeTopData()) {
5428  if (tlwExtra->newCounterValueLo != 0 || tlwExtra->newCounterValueHi != 0) {
5429  XSyncValue value;
5430  XSyncIntsToValue(&value,
5431  tlwExtra->newCounterValueLo,
5432  tlwExtra->newCounterValueHi);
5433 
5434  XSyncSetCounter(X11->display, tlwExtra->syncUpdateCounter, value);
5435  tlwExtra->newCounterValueHi = 0;
5436  tlwExtra->newCounterValueLo = 0;
5437  }
5438  }
5439 #endif
5440  return true;
5441 }
double d
Definition: qnumeric_p.h:62
int y() const
QSize size() const
QRect crect
Definition: qwidget.h:131
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
uint window_state
Definition: qwidget.h:120
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
#define Q_D(Class)
Definition: qglobal.h:2482
union _XEvent XEvent
Definition: qwindowdefs.h:116
#define ATOM(x)
Definition: qt_x11_p.h:723
int width() const
Returns the width.
Definition: qsize.h:126
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
virtual bool x11Event(XEvent *)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
Definition: qwidget.cpp:9969
QWidgetData * data
Definition: qwidget.h:815
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
unsigned int uint
Definition: qglobal.h:996
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
bool hasStaticContents() const
QRect rect() const
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
char * XPointer
Definition: qt_x11_p.h:180
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
int x() const
static void syncX()
Synchronizes with the X server in the X11 implementation.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static Bool qt_sync_request_scanner(Display *, XEvent *event, XPointer arg)
int height() const
Returns the height.
Definition: qsize.h:129
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static bool qt_x11EventFilter(XEvent *ev)
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
const QRect & geometry() const
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ translateEmbedEvent()

void QETWidget::translateEmbedEvent ( const QWSEmbedEvent event)

Definition at line 3621 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

3622 {
3623  if (event->simpleData.type | QWSEmbedEvent::Region) {
3624  const QRegion region = event->region;
3625  setGeometry(region.boundingRect());
3626  setVisible(!region.isEmpty());
3627  }
3628 }
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
struct QWSEmbedEvent::SimpleData simpleData
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991

◆ translateGestureEvent()

bool QETWidget::translateGestureEvent ( const MSG msg,
const GESTUREINFO gi 
)

Definition at line 3969 of file qapplication_win.cpp.

3970 {
3971  const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
3972  QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
3973  if (alienWidget && alienWidget->internalWinId())
3974  alienWidget = 0;
3975  QWidget *widget = alienWidget ? alienWidget : this;
3976 
3978  event.sequenceId = gi.dwSequenceID;
3979  event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
3980  event.argument = gi.ullArguments;
3981 
3982  switch (gi.dwID) {
3983  case GID_BEGIN:
3984  event.gestureType = QNativeGestureEvent::GestureBegin;
3985  break;
3986  case GID_END:
3987  event.gestureType = QNativeGestureEvent::GestureEnd;
3988  break;
3989  case GID_ZOOM:
3990  event.gestureType = QNativeGestureEvent::Zoom;
3991  break;
3992  case GID_PAN:
3993  event.gestureType = QNativeGestureEvent::Pan;
3994  break;
3995  case GID_ROTATE:
3996  event.gestureType = QNativeGestureEvent::Rotate;
3997  break;
3998  case GID_TWOFINGERTAP:
3999  case GID_ROLLOVER:
4000  default:
4001  break;
4002  }
4004  qt_sendSpontaneousEvent(widget, &event);
4005  return true;
4006 }
#define GID_BEGIN
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define GID_ROTATE
ULONGLONG ullArguments
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
#define GID_ROLLOVER
#define GID_END
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
#define GID_PAN
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
bool qt_sendSpontaneousEvent(QObject *, QEvent *)
#define GID_ZOOM
#define GID_TWOFINGERTAP

◆ translateKeyEvent()

bool QETWidget::translateKeyEvent ( const QWSKeyEvent event,
bool  grab 
)

Definition at line 3552 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

3553 {
3554  int code = -1;
3555  //### Qt assumes keyboard state is state *before*, while QWS uses state after the event
3556  static Qt::KeyboardModifiers oldstate;
3557  Qt::KeyboardModifiers state = oldstate;
3558  oldstate = event->simpleData.modifiers;
3559 
3560  if (sm_blockUserInput) // block user interaction during session management
3561  return true;
3562 
3563  if (!isEnabled())
3564  return true;
3565 
3566  QEvent::Type type = event->simpleData.is_press ?
3568  bool autor = event->simpleData.is_auto_repeat;
3569  QString text;
3570  if (event->simpleData.unicode && event->simpleData.unicode != 0xffff)
3571  text += QChar(event->simpleData.unicode);
3572  code = event->simpleData.keycode;
3573 
3574 #if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT)
3575  if (type == QEvent::KeyPress && !grab
3576  && static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->use_compat()) {
3577  // send accel events if the keyboard is not grabbed
3578  QKeyEvent a(type, code, state, text, autor, int(text.length()));
3579  if (static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->qt_tryAccelEvent(this, &a))
3580  return true;
3581  }
3582 #else
3583  Q_UNUSED(grab);
3584 #endif
3585  if (!text.isEmpty() && testAttribute(Qt::WA_KeyCompression)) {
3586  // the widget wants key compression so it gets it
3587 
3588  // XXX not implemented
3589  }
3590 
3591  QKeyEvent e(type, code, state, text, autor, int(text.length()));
3592  return QApplication::sendSpontaneousEvent(this, &e);
3593 }
The QKeyEvent class describes a key event.
Definition: qevent.h:224
int type
Definition: qmetatype.cpp:239
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
struct QWSKeyEvent::SimpleData simpleData
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
bool isEnabled() const
Definition: qwidget.h:948
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
static bool sm_blockUserInput
#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
#define text
Definition: qobjectdefs.h:80
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87

◆ translateMouseEvent() [1/3]

bool QETWidget::translateMouseEvent ( const QWSMouseEvent event,
int  oldstate 
)

Definition at line 3330 of file qapplication_qws.cpp.

Referenced by QtWndProc(), QApplication::qwsProcessEvent(), and QApplication::x11ProcessEvent().

3331 {
3332  static bool manualGrab = false;
3333  QPoint pos;
3334  QPoint globalPos;
3335  int button = 0;
3336 
3337  if (sm_blockUserInput) // block user interaction during session management
3338  return true;
3339  const QWSMouseEvent::SimpleData &mouse = event->simpleData;
3340  pos = mapFromGlobal(QPoint(mouse.x_root, mouse.y_root));
3341 // if (qt_last_x) {
3342 // *qt_last_x=mouse.x_root;
3343 // *qt_last_y=mouse.y_root;
3344 // }
3345  globalPos.rx() = mouse.x_root;
3346  globalPos.ry() = mouse.y_root;
3347 
3349 
3350  Qt::MouseButtons buttonstate = Qt::MouseButtons(mouse.state & Qt::MouseButtonMask);
3351  Qt::KeyboardModifiers keystate = Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask);
3352 
3353  if (mouse.state == prevstate) {
3354  // mouse move
3355  type = QEvent::MouseMove;
3356  } else if ((mouse.state&AnyButton) != (prevstate&AnyButton)) {
3357  Qt::MouseButtons current_buttons = Qt::MouseButtons(prevstate&Qt::MouseButtonMask);
3358  for (button = Qt::LeftButton; !type && button <= Qt::MidButton; button<<=1) {
3359  if ((mouse.state&button) != (current_buttons&button)) {
3360  // button press or release
3361  current_buttons = Qt::MouseButtons(current_buttons ^ button);
3362 
3363 #ifndef QT_NO_QWS_INPUTMETHODS
3364  //############ We used to do a QInputContext::reset(oldFocus);
3365  // when we changed the focus widget. See change 93389 for where the
3366  // focus code went. The IM code was (after testing for ClickToFocus):
3367  //if (mouse.state&button && w != QInputContext::microFocusWidget()) //button press
3368  // QInputContext::reset(oldFocus);
3369 
3370 #endif
3371  if (mouse.state&button) { //button press
3372  qt_button_down = childAt(pos);
3373  if (!qt_button_down)
3374  qt_button_down = this;
3375  if (/*XXX mouseActWindow == this &&*/
3376  mouseButtonPressed == button &&
3377  long(mouse.time) -long(mouseButtonPressTime)
3382  mouseButtonPressTime -= 2000; // no double-click next time
3383  } else {
3384  type = QEvent::MouseButtonPress;
3385  mouseButtonPressTime = mouse.time;
3386  }
3387  mouseButtonPressed = button; // save event params for
3388  mouseXPos = globalPos.x(); // future double click tests
3389  mouseYPos = globalPos.y();
3390  } else { // mouse button released
3391  if (manualGrab) { // release manual grab
3392  manualGrab = false;
3393  // XXX XUngrabPointer(x11Display(), CurrentTime);
3394  }
3395 
3397  }
3398  }
3399  }
3400  button >>= 1;
3401  }
3402  //XXX mouseActWindow = winId(); // save some event params
3403 
3404  if (type == 0) { // event consumed
3405  return false; //EXIT in the normal case
3406  }
3407 
3408  if (qApp->d_func()->inPopupMode()) { // in popup mode
3409  QWidget *popup = qApp->activePopupWidget();
3410  // in X11, this would be the window we are over.
3411  // in QWS this is the top level popup. to allow mouse
3412  // events to other widgets, need to go through qApp->QApplicationPrivate::popupWidgets.
3413  QSize s(qt_screen->width(), qt_screen->height());
3414  for (int i = 0; i < QApplicationPrivate::popupWidgets->size(); ++i) {
3416 
3417  if ((w->windowType() == Qt::Popup) && w->d_func()->localAllocatedRegion().contains(globalPos - w->geometry().topLeft()))
3418  {
3419  popup = w;
3420  break;
3421  }
3422  }
3423  pos = popup->mapFromGlobal(globalPos);
3424  bool releaseAfter = false;
3425  QWidget *popupChild = popup->childAt(pos);
3426  QWidget *popupTarget = popupChild ? popupChild : popup;
3427 
3428  if (popup != popupOfPopupButtonFocus){
3429  popupButtonFocus = 0;
3431  }
3432 
3433  if (!popupTarget->isEnabled()) {
3434  return false; //EXIT special case
3435  }
3436 
3437  switch (type) {
3440  popupButtonFocus = popupChild;
3441  popupOfPopupButtonFocus = popup;
3442  break;
3444  releaseAfter = true;
3445  break;
3446  default:
3447  break; // nothing for mouse move
3448  }
3449 
3450  int oldOpenPopupCount = openPopupCount;
3451 
3452  if (popupButtonFocus) {
3453  QMouseEvent e(type, popupButtonFocus->mapFromGlobal(globalPos),
3454  globalPos, Qt::MouseButton(button), buttonstate, keystate);
3456  if (releaseAfter) {
3457  popupButtonFocus = 0;
3459  }
3460  } else if (popupChild) {
3461  QMouseEvent e(type, popupChild->mapFromGlobal(globalPos),
3462  globalPos, Qt::MouseButton(button), buttonstate, keystate);
3463  QApplication::sendSpontaneousEvent(popupChild, & e);
3464  } else {
3465  QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate);
3466  QApplication::sendSpontaneousEvent(popupChild ? popupChild : popup, & e);
3467  }
3468 #ifndef QT_NO_CONTEXTMENU
3469  if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
3470  QWidget *popupEvent = popup;
3471  if(popupButtonFocus)
3472  popupEvent = popupButtonFocus;
3473  else if(popupChild)
3474  popupEvent = popupChild;
3475  QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate);
3476  QApplication::sendSpontaneousEvent(popupEvent, &e);
3477  }
3478 #endif // QT_NO_CONTEXTMENU
3479 
3480  if (releaseAfter)
3481  qt_button_down = 0;
3482 
3483  } else { //qApp not in popup mode
3484  QWidget *widget = this;
3486  if (!w && qt_button_down)
3487  w = qt_button_down;
3488  if (w && w != this) {
3489  widget = w;
3490  pos = mapToGlobal(pos);
3491  pos = w->mapFromGlobal(pos);
3492  }
3493 
3494  if (popupCloseDownMode) {
3495  popupCloseDownMode = false;
3496  if ((windowType() == Qt::Popup)) // ignore replayed event
3497  return true; //EXIT
3498  }
3499 
3500  QPointer<QWidget> leaveAfterRelease = 0;
3501  if (type == QEvent::MouseButtonRelease &&
3502  (mouse.state & (~button) & (Qt::LeftButton |
3503  Qt::MidButton |
3504  Qt::RightButton)) == 0) {
3505  // Button released outside the widget -> leave the widget after the
3506  // release event has been delivered.
3507  if (widget == qt_button_down && (pos.x() < 0 || pos.y() < 0))
3508  leaveAfterRelease = qt_button_down;
3509  qt_button_down = 0;
3510  }
3511 
3512  int oldOpenPopupCount = openPopupCount;
3513 
3514  QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate);
3515 #ifndef QT_NO_QWS_MANAGER
3516  if (widget->isWindow() && widget->d_func()->topData()->qwsManager
3517  && (widget->d_func()->topData()->qwsManager->region().contains(globalPos)
3518  || QWSManager::grabbedMouse() )) {
3519  if ((*mouseInWidget)) {
3521  (*mouseInWidget) = 0;
3522  }
3523  QApplication::sendSpontaneousEvent(widget->d_func()->topData()->qwsManager, &e);
3524  qApp->d_func()->last_manager = widget->d_func()->topData()->qwsManager;
3525  } else
3526 #endif
3527  {
3528  if (widget != (*mouseInWidget)) {
3530  (*mouseInWidget) = widget;
3532  }
3534  if (leaveAfterRelease && !QWidget::mouseGrabber()) {
3535  *mouseInWidget = QApplication::widgetAt(globalPos);
3538  leaveAfterRelease = 0;
3539  }
3540  }
3541 #ifndef QT_NO_CONTEXTMENU
3542  if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
3543  QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate);
3545  }
3546 #endif // QT_NO_CONTEXTMENU
3547  }
3548  return true;
3549 }
QPoint pos() const
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
static int openPopupCount
int type
Definition: qmetatype.cpp:239
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
QPointer< QWidget > widget
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
static short mouseXPos
static QWidget * popupOfPopupButtonFocus
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
static int mouseButtonPressTime
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
static QWidget * mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
#define qApp
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
static QWidgetList * popupWidgets
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWidget * qt_button_down
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
static QWidget * popupButtonFocus
bool isEnabled() const
Definition: qwidget.h:948
static short mouseYPos
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
static bool sm_blockUserInput
static const int AnyButton
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static int mouse_double_click_distance
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QPointer< QWidget > qt_last_mouse_receiver
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
static bool popupCloseDownMode
static int mouseButtonPressed
static QPointer< QWidget > * mouseInWidget
static int doubleClickInterval()
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
MouseButton
Definition: qnamespace.h:150

◆ translateMouseEvent() [2/3]

bool QETWidget::translateMouseEvent ( const MSG msg)

Definition at line 3045 of file qapplication_win.cpp.

3046 {
3049 
3050  static QPoint pos;
3051  static POINT gpos={-1,-1};
3052  QEvent::Type type; // event parameters
3053  int button;
3054  int state;
3055  int i;
3056 
3057  if (sm_blockUserInput) //block user interaction during session management
3058  return true;
3059 
3060  // Compress mouse move events
3061  if (msg.message == WM_MOUSEMOVE) {
3062  MSG mouseMsg;
3063  while (PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEFIRST,
3064  WM_MOUSELAST, PM_NOREMOVE)) {
3065  if (mouseMsg.message == WM_MOUSEMOVE) {
3066 #define PEEKMESSAGE_IS_BROKEN 1
3067 #ifdef PEEKMESSAGE_IS_BROKEN
3068  // Since the Windows PeekMessage() function doesn't
3069  // correctly return the wParam for WM_MOUSEMOVE events
3070  // if there is a key release event in the queue
3071  // _before_ the mouse event, we have to also consider
3072  // key release events (kls 2003-05-13):
3073  MSG keyMsg;
3074  bool done = false;
3075  while (PeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST,
3076  PM_NOREMOVE)) {
3077  if (keyMsg.time < mouseMsg.time) {
3078  if ((keyMsg.lParam & 0xC0000000) == 0x40000000) {
3079  PeekMessage(&keyMsg, 0, keyMsg.message,
3080  keyMsg.message, PM_REMOVE);
3081  } else {
3082  done = true;
3083  break;
3084  }
3085  } else {
3086  break; // no key event before the WM_MOUSEMOVE event
3087  }
3088  }
3089  if (done)
3090  break;
3091 #else
3092  // Actually the following 'if' should work instead of
3093  // the above key event checking, but apparently
3094  // PeekMessage() is broken :-(
3095  if (mouseMsg.wParam != msg.wParam)
3096  break; // leave the message in the queue because
3097  // the key state has changed
3098 #endif
3099  MSG *msgPtr = (MSG *)(&msg);
3100  // Update the passed in MSG structure with the
3101  // most recent one.
3102  msgPtr->lParam = mouseMsg.lParam;
3103  msgPtr->wParam = mouseMsg.wParam;
3104  // Extract the x,y coordinates from the lParam as we do in the WndProc
3105  msgPtr->pt.x = GET_X_LPARAM(mouseMsg.lParam);
3106  msgPtr->pt.y = GET_Y_LPARAM(mouseMsg.lParam);
3107  ClientToScreen(msg.hwnd, &(msgPtr->pt));
3108  // Remove the mouse move message
3109  PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEMOVE,
3110  WM_MOUSEMOVE, PM_REMOVE);
3111  } else {
3112  break; // there was no more WM_MOUSEMOVE event
3113  }
3114  }
3115  }
3116 
3117  for (i=0; (UINT)mouseTbl[i] != msg.message && mouseTbl[i]; i += 3)
3118  ;
3119  if (!mouseTbl[i])
3120  return false;
3121  type = (QEvent::Type)mouseTbl[++i]; // event type
3122  button = mouseTbl[++i]; // which button
3123  if (button == Qt::XButton1) {
3124  switch(GET_XBUTTON_WPARAM(msg.wParam)) {
3125  case XBUTTON1:
3126  button = Qt::XButton1;
3127  break;
3128  case XBUTTON2:
3129  button = Qt::XButton2;
3130  break;
3131  }
3132  }
3133 #ifndef Q_OS_WINCE
3134  static bool trackMouseEventLookup = false;
3135  typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
3136  static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
3137 #endif
3138  state = translateButtonState(msg.wParam, type, button); // button state
3139  const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y));
3140  QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
3141  if (alienWidget && alienWidget->internalWinId())
3142  alienWidget = 0;
3143 
3144  if (type == QEvent::MouseMove || type == QEvent::NonClientAreaMouseMove
3145  || type == QEvent::TabletMove) {
3146 
3147  if (!(state & Qt::MouseButtonMask))
3148  qt_button_down = 0;
3149 #ifndef QT_NO_CURSOR
3150  QCursor *c = qt_grab_cursor();
3151  if (!c)
3153  if (c) // application cursor defined
3154  SetCursor(c->handle());
3155  else if (type != QEvent::NonClientAreaMouseMove && !qt_button_down) {
3156  // use widget cursor if widget is enabled
3157  QWidget *w = alienWidget ? alienWidget : this;
3158  while (!w->isWindow() && !w->isEnabled())
3159  w = w->parentWidget();
3160  SetCursor(w->cursor().handle());
3161  }
3162 #endif // QT_NO_CURSOR
3163 
3164  HWND id = effectiveWinId();
3166  QWidget *activePopupWidget = QApplication::activePopupWidget();
3167  if (mouseGrabber) {
3168  if (!activePopupWidget || (activePopupWidget == this && !rect().contains(widgetPos)))
3169  id = mouseGrabber->effectiveWinId();
3170  } else if (type == QEvent::NonClientAreaMouseMove) {
3171  id = 0;
3172  }
3173 
3174  if (curWin != id) { // new current window
3175  if (id == 0) {
3177  if (!leave)
3178  leave = QWidget::find(curWin);
3181  curWin = 0;
3182  } else {
3183  QWidget *leave = 0;
3185  leave = qt_last_mouse_receiver;
3186  else
3187  leave = QWidget::find(curWin);
3188  QWidget *enter = alienWidget ? alienWidget : this;
3189  if (mouseGrabber && activePopupWidget) {
3190  if (leave != mouseGrabber)
3191  enter = mouseGrabber;
3192  else
3193  enter = activePopupWidget == this ? this : mouseGrabber;
3194  }
3196  qt_last_mouse_receiver = enter;
3197  curWin = enter ? enter->effectiveWinId() : 0;
3198  }
3199 #ifndef Q_OS_WINCE
3200 
3201  if (curWin != 0) {
3202  if (!trackMouseEventLookup) {
3203  ptrTrackMouseEvent = (PtrTrackMouseEvent)QSystemLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
3204  trackMouseEventLookup = true;
3205  }
3206  if (ptrTrackMouseEvent && !qApp->d_func()->inPopupMode()) {
3207  // We always have to set the tracking, since
3208  // Windows detects more leaves than we do..
3209  TRACKMOUSEEVENT tme;
3210  tme.cbSize = sizeof(TRACKMOUSEEVENT);
3211  tme.dwFlags = 0x00000002; // TME_LEAVE
3212  tme.hwndTrack = curWin; // Track on window receiving msgs
3213  tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
3214  ptrTrackMouseEvent(&tme);
3215  }
3216  }
3217 #endif // Q_OS_WINCE
3218  }
3219 
3220  POINT curPos = msg.pt;
3221  if (curPos.x == gpos.x && curPos.y == gpos.y)
3222  return true; // same global position
3223  gpos = curPos;
3224 
3226  ScreenToClient(internalWinId(), &curPos);
3227 
3228  pos.rx() = curPos.x;
3229  pos.ry() = curPos.y;
3230  pos = d_func()->mapFromWS(pos);
3231  } else {
3232  gpos = msg.pt;
3233  pos = mapFromGlobal(QPoint(gpos.x, gpos.y));
3234 
3235  // mouse button pressed
3237  QWidget *tlw = window();
3238  if (QWidget *child = tlw->childAt(mapTo(tlw, pos)))
3239  qt_button_down = child;
3240  else
3241  qt_button_down = this;
3242  }
3243  }
3244 
3245  bool res = false;
3246 
3247  bool nonClientAreaEvent = type >= QEvent::NonClientAreaMouseMove
3249 
3250  if (qApp->d_func()->inPopupMode()) { // in popup mode
3251 
3252  if (nonClientAreaEvent)
3253  return false;
3254 
3255  replayPopupMouseEvent = false;
3256  QWidget* activePopupWidget = QApplication::activePopupWidget();
3257  QWidget *target = activePopupWidget;
3258  const QPoint globalPos(gpos.x, gpos.y);
3259 
3260  if (target != this) {
3261  if ((windowType() == Qt::Popup) && rect().contains(pos) && 0)
3262  target = this;
3263  else // send to last popup
3264  pos = target->mapFromGlobal(globalPos);
3265  }
3266  QWidget *popupChild = target->childAt(pos);
3267  bool releaseAfter = false;
3268  switch (type) {
3271  popupButtonFocus = popupChild;
3272  break;
3274  case QEvent::TabletRelease:
3275 
3276  releaseAfter = true;
3277  break;
3278  default:
3279  break; // nothing for mouse move
3280  }
3281 
3282  if (target->isEnabled()) {
3283  if (popupButtonFocus) {
3284  target = popupButtonFocus;
3285  } else if (popupChild) {
3286  target = popupChild;
3287  }
3288 
3289  pos = target->mapFromGlobal(globalPos);
3290  QMouseEvent e(type, pos, globalPos,
3291  Qt::MouseButton(button),
3292  Qt::MouseButtons(state & Qt::MouseButtonMask),
3293  Qt::KeyboardModifiers(state & Qt::KeyboardModifierMask));
3294  res = QApplicationPrivate::sendMouseEvent(target, &e, alienWidget, this, &qt_button_down,
3296  res = res && e.isAccepted();
3297  } else {
3298  // close disabled popups when a mouse button is pressed or released
3299  switch (type) {
3303  target->close();
3304  break;
3305  default:
3306  break;
3307  }
3308  }
3309 
3310  if (releaseAfter) {
3311  popupButtonFocus = 0;
3312  qt_button_down = 0;
3313  }
3314 
3315 #ifndef Q_OS_WINCE
3316  if (type == QEvent::MouseButtonPress
3317  && QApplication::activePopupWidget() != activePopupWidget
3318  && ptrTrackMouseEvent
3319  && curWin) {
3320  // Since curWin is already the window we clicked on,
3321  // we have to setup the mouse tracking here.
3322  TRACKMOUSEEVENT tme;
3323  tme.cbSize = sizeof(TRACKMOUSEEVENT);
3324  tme.dwFlags = 0x00000002; // TME_LEAVE
3325  tme.hwndTrack = curWin; // Track on window receiving msgs
3326  tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
3327  ptrTrackMouseEvent(&tme);
3328  }
3329 #endif
3330  if (type == QEvent::MouseButtonPress
3331  && QApplication::activePopupWidget() != activePopupWidget
3332  && replayPopupMouseEvent) {
3333  // the popup disappeared. Replay the event
3334  QWidget* w = QApplication::widgetAt(gpos.x, gpos.y);
3337  HWND hwndTarget = w->effectiveWinId();
3338  if (QWidget::mouseGrabber() == 0)
3339  setAutoCapture(hwndTarget);
3340  if (!w->isActiveWindow())
3341  w->activateWindow();
3342  POINT widgetpt = gpos;
3343  ScreenToClient(hwndTarget, &widgetpt);
3344  LPARAM lParam = MAKELPARAM(widgetpt.x, widgetpt.y);
3345  PostMessage(hwndTarget, msg.message, msg.wParam, lParam);
3346  }
3347  } else if (type == QEvent::MouseButtonRelease && button == Qt::RightButton
3348  && QApplication::activePopupWidget() == activePopupWidget) {
3349  // popup still alive and received right-button-release
3350 #if !defined(QT_NO_CONTEXTMENU)
3351  QContextMenuEvent e2(QContextMenuEvent::Mouse, pos, globalPos,
3353  bool res2 = QApplication::sendSpontaneousEvent( target, &e2 );
3354  if (!res) // RMB not accepted
3355  res = res2 && e2.isAccepted();
3356 #endif
3357  }
3358  } else { // not popup mode
3359  int bs = state & Qt::MouseButtonMask;
3360  if ((type == QEvent::MouseButtonPress ||
3361  type == QEvent::MouseButtonDblClick) && bs == button) {
3363  if (QWidget::mouseGrabber() == 0)
3365  } else if (type == QEvent::MouseButtonRelease && bs == 0) {
3366  if (QWidget::mouseGrabber() == 0)
3368  }
3369 
3370  const QPoint globalPos(gpos.x,gpos.y);
3371  QWidget *widget = QApplicationPrivate::pickMouseReceiver(this, globalPos, pos, type,
3372  Qt::MouseButtons(bs),
3373  qt_button_down, alienWidget);
3374  if (!widget)
3375  return false; // don't send event
3376 
3377  QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button),
3378  Qt::MouseButtons(state & Qt::MouseButtonMask),
3379  Qt::KeyboardModifiers(state & Qt::KeyboardModifierMask));
3380 
3381  res = QApplicationPrivate::sendMouseEvent(widget, &e, alienWidget, this, &qt_button_down,
3383 
3384  // non client area events are only informational, you cannot "handle" them
3385  res = res && e.isAccepted() && !nonClientAreaEvent;
3386 #if !defined(QT_NO_CONTEXTMENU)
3387  if (type == QEvent::MouseButtonRelease && button == Qt::RightButton) {
3388  QContextMenuEvent e2(QContextMenuEvent::Mouse, pos, globalPos,
3390  bool res2 = QApplication::sendSpontaneousEvent(widget, &e2);
3391  if (!res)
3392  res = res2 && e2.isAccepted();
3393  }
3394 #endif
3395 
3396  if (type != QEvent::MouseMove)
3397  pos.rx() = pos.ry() = -9999; // init for move compression
3398  }
3399  return res;
3400 }
QPoint pos() const
HCURSOR_or_HANDLE handle() const
Returns a platform-specific cursor handle.
Definition: qcursor_mac.mm:301
static void setAutoCapture(HWND)
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
int type
Definition: qmetatype.cpp:239
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
unsigned char c[8]
Definition: qnumeric_p.h:62
QPointer< QWidget > widget
static QWidget * pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos, QEvent::Type type, Qt::MouseButtons buttons, QWidget *buttonDown, QWidget *alienWidget)
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
QPoint mapTo(QWidget *, const QPoint &) const
Translates the widget coordinate pos to the coordinate system of parent.
Definition: qwidget.cpp:4409
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
WId effectiveWinId() const
Returns the effective window system identifier of the widget, i.
Definition: qwidget.cpp:2654
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static HWND curWin
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
#define XBUTTON1
static QCursor * overrideCursor()
Strips out vertical alignment flags and transforms an alignment align of Qt::AlignLeft into Qt::Align...
struct tagTRACKMOUSEEVENT * LPTRACKMOUSEEVENT
QWidgetPrivate * d_func()
static QWidget * mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QPointer< QWidget > qt_last_mouse_receiver
#define qApp
static const ushort mouseTbl[]
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
static QWidget * find(WId)
Returns a pointer to the widget with window identifer/handle id.
Definition: qwidget.cpp:2517
Qt::KeyboardModifiers qt_win_getKeyboardModifiers()
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
#define GET_XBUTTON_WPARAM(wParam)
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
#define GET_X_LPARAM(lp)
QCursor * qt_grab_cursor()
QCursor cursor
the cursor shape for this widget
Definition: qwidget.h:183
static void releaseAutoCapture()
QRect rect() const
bool isEnabled() const
Definition: qwidget.h:948
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
struct tagMSG MSG
void * resolve(const char *symbol)
static QWidget * activePopupWidget()
Returns the active popup widget.
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
static bool isBlockedByModal(QWidget *widget)
Returns true if widget is blocked by a modal window.
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define XBUTTON2
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static bool replayPopupMouseEvent
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
#define GET_Y_LPARAM(lp)
static QPointer< QWidget > popupButtonFocus
static bool sm_blockUserInput
static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget, QWidget *native, QWidget **buttonDown, QPointer< QWidget > &lastMouseReceiver, bool spontaneous=true)
static int translateButtonState(int s, int type, int button)
QWidget * qt_button_down
MouseButton
Definition: qnamespace.h:150

◆ translateMouseEvent() [3/3]

bool QETWidget::translateMouseEvent ( const XEvent event)

Definition at line 4214 of file qapplication_x11.cpp.

4215 {
4218 
4219  Q_D(QWidget);
4220  QEvent::Type type; // event parameters
4221  QPoint pos;
4222  QPoint globalPos;
4223  Qt::MouseButton button = Qt::NoButton;
4224  Qt::MouseButtons buttons;
4225  Qt::KeyboardModifiers modifiers;
4226  XEvent nextEvent;
4227 
4228  if (qt_sm_blockUserInput) // block user interaction during session management
4229  return true;
4230 
4231  if (event->type == MotionNotify) { // mouse move
4232  if (event->xmotion.root != RootWindow(X11->display, x11Info().screen()) &&
4233  ! qt_xdnd_dragging)
4234  return false;
4235 
4236  XMotionEvent lastMotion = event->xmotion;
4237  while(XPending(X11->display)) { // compress mouse moves
4238  XNextEvent(X11->display, &nextEvent);
4239  if (nextEvent.type == ConfigureNotify
4240  || nextEvent.type == PropertyNotify
4241  || nextEvent.type == Expose
4242  || nextEvent.type == GraphicsExpose
4243  || nextEvent.type == NoExpose
4244  || nextEvent.type == KeymapNotify
4245  || ((nextEvent.type == EnterNotify || nextEvent.type == LeaveNotify)
4246  && qt_button_down == this)
4247  || (nextEvent.type == ClientMessage
4248  && (nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE) ||
4249  (nextEvent.xclient.message_type == ATOM(WM_PROTOCOLS) &&
4250  (Atom)nextEvent.xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST))))) {
4251  // Pass the event through the event dispatcher filter so that applications
4252  // which install an event filter on the dispatcher get to handle it first.
4253  if (!QAbstractEventDispatcher::instance()->filterEvent(&nextEvent))
4254  qApp->x11ProcessEvent(&nextEvent);
4255  continue;
4256  } else if (nextEvent.type != MotionNotify ||
4257  nextEvent.xmotion.window != event->xmotion.window ||
4258  nextEvent.xmotion.state != event->xmotion.state) {
4259  XPutBackEvent(X11->display, &nextEvent);
4260  break;
4261  }
4262  if (!qt_x11EventFilter(&nextEvent)
4263  && !x11Event(&nextEvent)) // send event through filter
4264  lastMotion = nextEvent.xmotion;
4265  else
4266  break;
4267  }
4268  type = QEvent::MouseMove;
4269  pos.rx() = lastMotion.x;
4270  pos.ry() = lastMotion.y;
4271  pos = d->mapFromWS(pos);
4272  globalPos.rx() = lastMotion.x_root;
4273  globalPos.ry() = lastMotion.y_root;
4274  buttons = translateMouseButtons(lastMotion.state);
4275  modifiers = X11->translateModifiers(lastMotion.state);
4276  if (qt_button_down && !buttons)
4277  qt_button_down = 0;
4278  } else if (event->type == EnterNotify || event->type == LeaveNotify) {
4279  XEvent *xevent = (XEvent *)event;
4280  //unsigned int xstate = event->xcrossing.state;
4281  type = QEvent::MouseMove;
4282  pos.rx() = xevent->xcrossing.x;
4283  pos.ry() = xevent->xcrossing.y;
4284  pos = d->mapFromWS(pos);
4285  globalPos.rx() = xevent->xcrossing.x_root;
4286  globalPos.ry() = xevent->xcrossing.y_root;
4287  buttons = translateMouseButtons(xevent->xcrossing.state);
4288  modifiers = X11->translateModifiers(xevent->xcrossing.state);
4289  if (qt_button_down && !buttons)
4290  qt_button_down = 0;
4291  if (qt_button_down)
4292  return true;
4293  } else { // button press or release
4294  pos.rx() = event->xbutton.x;
4295  pos.ry() = event->xbutton.y;
4296  pos = d->mapFromWS(pos);
4297  globalPos.rx() = event->xbutton.x_root;
4298  globalPos.ry() = event->xbutton.y_root;
4299  buttons = translateMouseButtons(event->xbutton.state);
4300  modifiers = X11->translateModifiers(event->xbutton.state);
4301  switch (event->xbutton.button) {
4302  case Button1: button = Qt::LeftButton; break;
4303  case Button2: button = Qt::MidButton; break;
4304  case Button3: button = Qt::RightButton; break;
4305  case Button4:
4306  case Button5:
4307  case 6:
4308  case 7:
4309  // the fancy mouse wheel.
4310 
4311  // We are only interested in ButtonPress.
4312  if (event->type == ButtonPress){
4313  // compress wheel events (the X Server will simply
4314  // send a button press for each single notch,
4315  // regardless whether the application can catch up
4316  // or not)
4317  int delta = 1;
4318  XEvent xevent;
4319  while (XCheckTypedWindowEvent(X11->display, effectiveWinId(), ButtonPress, &xevent)){
4320  if (xevent.xbutton.button != event->xbutton.button){
4321  XPutBackEvent(X11->display, &xevent);
4322  break;
4323  }
4324  delta++;
4325  }
4326 
4327  // the delta is defined as multiples of
4328  // WHEEL_DELTA, which is set to 120. Future wheels
4329  // may offer a finer-resolution. A positive delta
4330  // indicates forward rotation, a negative one
4331  // backward rotation respectively.
4332  int btn = event->xbutton.button;
4333  delta *= 120 * ((btn == Button4 || btn == 6) ? 1 : -1);
4334  bool hor = (((btn == Button4 || btn == Button5) && (modifiers & Qt::AltModifier)) ||
4335  (btn == 6 || btn == 7));
4336  translateWheelEvent(globalPos.x(), globalPos.y(), delta, buttons,
4337  modifiers, (hor) ? Qt::Horizontal: Qt::Vertical);
4338  }
4339  return true;
4340  case 8: button = Qt::XButton1; break;
4341  case 9: button = Qt::XButton2; break;
4342  }
4343  if (event->type == ButtonPress) { // mouse button pressed
4344  buttons |= button;
4345 #if defined(Q_OS_IRIX) && !defined(QT_NO_TABLET)
4347  for (int i = 0; i < tablets->size(); ++i) {
4348  QTabletDeviceData &tab = tablets->operator[](i);
4349  XEvent myEv;
4350  if (XCheckTypedEvent(X11->display, tab.xinput_button_press, &myEv)) {
4351  if (translateXinputEvent(&myEv, &tab)) {
4352  //Spontaneous event sent. Check if we need to continue.
4353  if (qt_tabletChokeMouse) {
4354  qt_tabletChokeMouse = false;
4355  return false;
4356  }
4357  }
4358  }
4359  }
4360 #endif
4361  if (!qt_button_down) {
4362  qt_button_down = childAt(pos); //magic for masked widgets
4363  if (!qt_button_down)
4364  qt_button_down = this;
4365  }
4366  if (mouseActWindow == event->xbutton.window &&
4367  mouseButtonPressed == button &&
4368  (long)event->xbutton.time -(long)mouseButtonPressTime
4370  qAbs(event->xbutton.x - mouseXPos) < QT_GUI_DOUBLE_CLICK_RADIUS &&
4371  qAbs(event->xbutton.y - mouseYPos) < QT_GUI_DOUBLE_CLICK_RADIUS) {
4373  mouseButtonPressTime -= 2000; // no double-click next time
4374  } else {
4375  type = QEvent::MouseButtonPress;
4376  mouseButtonPressTime = event->xbutton.time;
4377  }
4378  mouseButtonPressed = button; // save event params for
4379  mouseXPos = event->xbutton.x; // future double click tests
4380  mouseYPos = event->xbutton.y;
4381  mouseGlobalXPos = globalPos.x();
4382  mouseGlobalYPos = globalPos.y();
4383  } else { // mouse button released
4384  buttons &= ~button;
4385 #if defined(Q_OS_IRIX) && !defined(QT_NO_TABLET)
4387  for (int i = 0; i < tablets->size(); ++i) {
4388  QTabletDeviceData &tab = tablets->operator[](i);
4389  XEvent myEv;
4390  if (XCheckTypedEvent(X11->display, tab.xinput_button_press, &myEv)) {
4391  if (translateXinputEvent(&myEv, &tab)) {
4392  //Spontaneous event sent. Check if we need to continue.
4393  if (qt_tabletChokeMouse) {
4394  qt_tabletChokeMouse = false;
4395  return false;
4396  }
4397  }
4398  }
4399  }
4400 #endif
4402  }
4403  }
4404  mouseActWindow = effectiveWinId(); // save some event params
4406  if (type == 0) // don't send event
4407  return false;
4408 
4409  if (qApp->d_func()->inPopupMode()) { // in popup mode
4410  QWidget *activePopupWidget = qApp->activePopupWidget();
4411  QWidget *popup = qApp->activePopupWidget();
4412  if (popup != this) {
4413  if (event->type == LeaveNotify)
4414  return false;
4415  if ((windowType() == Qt::Popup) && rect().contains(pos) && 0)
4416  popup = this;
4417  else // send to last popup
4418  pos = popup->mapFromGlobal(globalPos);
4419  }
4420  bool releaseAfter = false;
4421  QWidget *popupChild = popup->childAt(pos);
4422 
4423  if (popup != qt_popup_down){
4424  qt_button_down = 0;
4425  qt_popup_down = 0;
4426  }
4427 
4428  switch (type) {
4431  qt_button_down = popupChild;
4432  qt_popup_down = popup;
4433  break;
4435  releaseAfter = true;
4436  break;
4437  default:
4438  break; // nothing for mouse move
4439  }
4440 
4441  int oldOpenPopupCount = openPopupCount;
4442 
4443  if (popup->isEnabled()) {
4444  // deliver event
4445  replayPopupMouseEvent = false;
4446  QWidget *receiver = popup;
4447  QPoint widgetPos = pos;
4448  if (qt_button_down)
4449  receiver = qt_button_down;
4450  else if (popupChild)
4451  receiver = popupChild;
4452  if (receiver != popup)
4453  widgetPos = receiver->mapFromGlobal(globalPos);
4454  QWidget *alien = childAt(mapFromGlobal(globalPos));
4455  QMouseEvent e(type, widgetPos, globalPos, button, buttons, modifiers);
4457  } else {
4458  // close disabled popups when a mouse button is pressed or released
4459  switch (type) {
4463  popup->close();
4464  break;
4465  default:
4466  break;
4467  }
4468  }
4469 
4470  if (qApp->activePopupWidget() != activePopupWidget
4471  && replayPopupMouseEvent) {
4472  // the active popup was closed, replay the mouse event
4473  if (!(windowType() == Qt::Popup)) {
4474 #if 1
4475  qt_button_down = 0;
4476 #else
4477  if (buttons == button)
4478  qt_button_down = this;
4479  QMouseEvent e(type, mapFromGlobal(globalPos), globalPos, button,
4480  buttons, modifiers);
4482 
4483  if (type == QEvent::MouseButtonPress
4484  && button == Qt::RightButton
4485  && (openPopupCount == oldOpenPopupCount)) {
4487  globalPos, modifiers);
4489  }
4490 #endif
4491  }
4492  replayPopupMouseEvent = false;
4493  } else if (type == QEvent::MouseButtonPress
4494  && button == Qt::RightButton
4495  && (openPopupCount == oldOpenPopupCount)) {
4496  QWidget *popupEvent = popup;
4497  if (qt_button_down)
4498  popupEvent = qt_button_down;
4499  else if(popupChild)
4500  popupEvent = popupChild;
4501  QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, modifiers);
4502  QApplication::sendSpontaneousEvent(popupEvent, &e);
4503  }
4504 
4505  if (releaseAfter) {
4506  qt_button_down = 0;
4507  qt_popup_down = 0;
4508  }
4509  } else {
4510  QWidget *alienWidget = childAt(pos);
4511  QWidget *widget = QApplicationPrivate::pickMouseReceiver(this, globalPos, pos, type, buttons,
4512  qt_button_down, alienWidget);
4513  if (!widget) {
4514  if (type == QEvent::MouseButtonRelease)
4516  return false; // don't send event
4517  }
4518 
4519  int oldOpenPopupCount = openPopupCount;
4520  QMouseEvent e(type, pos, globalPos, button, buttons, modifiers);
4521  QApplicationPrivate::sendMouseEvent(widget, &e, alienWidget, this, &qt_button_down,
4523  if (type == QEvent::MouseButtonPress
4524  && button == Qt::RightButton
4525  && (openPopupCount == oldOpenPopupCount)) {
4526  QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, modifiers);
4528  }
4529  }
4530  return true;
4531 }
QPoint pos() const
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
QPointer< QWidget > widget
static QWidget * pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos, QEvent::Type type, Qt::MouseButtons buttons, QWidget *buttonDown, QWidget *alienWidget)
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
WId effectiveWinId() const
Returns the effective window system identifier of the widget, i.
Definition: qwidget.cpp:2654
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
static Qt::MouseButtons buttons
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
const QX11Info & x11Info() const
Returns information about the configuration of the X display used to display the widget.
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
static Window mouseActWindow
static int openPopupCount
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
bool qt_xdnd_dragging
Definition: qdnd_x11.cpp:237
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
#define Q_D(Class)
Definition: qglobal.h:2482
static Qt::MouseButtons translateMouseButtons(int s)
bool qt_sm_blockUserInput
QTabletDeviceDataList * qt_tablet_devices()
union _XEvent XEvent
Definition: qwindowdefs.h:116
#define ATOM(x)
Definition: qt_x11_p.h:723
#define QT_GUI_DOUBLE_CLICK_RADIUS
QWidget * qt_button_down
bool translateXinputEvent(const XEvent *, QTabletDeviceData *tablet)
static short mouseYPos
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static short mouseGlobalYPos
#define qApp
bool translateWheelEvent(const QWSMouseEvent *me)
bool qt_tabletChokeMouse
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
virtual bool x11Event(XEvent *)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
Definition: qwidget.cpp:9969
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
static Time mouseButtonPressTime
QRect rect() const
bool isEnabled() const
Definition: qwidget.h:948
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
static Qt::MouseButtons mouseButtonState
QPointer< QWidget > qt_last_mouse_receiver
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
static bool replayPopupMouseEvent
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static short mouseGlobalXPos
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
static Qt::MouseButton mouseButtonPressed
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
static bool qt_x11EventFilter(XEvent *ev)
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
static QWidget * qt_popup_down
static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget, QWidget *native, QWidget **buttonDown, QPointer< QWidget > &lastMouseReceiver, bool spontaneous=true)
static int doubleClickInterval()
static short mouseXPos
static Qt::MouseButtons mouse_buttons
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
MouseButton
Definition: qnamespace.h:150

◆ translatePaintEvent() [1/2]

bool QETWidget::translatePaintEvent ( const MSG msg)

Definition at line 3784 of file qapplication_win.cpp.

Referenced by QtWndProc(), and QApplication::x11ProcessEvent().

3785 {
3788 
3790  if (!GetUpdateRect(internalWinId(), 0, FALSE)) { // The update bounding rect is invalid
3791  d_func()->hd = 0;
3793  return false;
3794  }
3795 
3796  if (msg.message == WM_ERASEBKGND)
3797  return true;
3798 
3800 
3801  if (d_func()->isGLWidget) {
3802  if (d_func()->usesDoubleBufferedGLContext)
3803  InvalidateRect(internalWinId(), 0, false);
3804  } else {
3805  const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
3806  // Make sure the invalidated region contains the region we're about to repaint.
3807  // BeginPaint will set the clip to the invalidated region and it is impossible
3808  // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
3809  // as it may return an invalid context (especially on Windows Vista).
3810  if (!dirtyInBackingStore.isEmpty())
3811  InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
3812  }
3813  PAINTSTRUCT ps;
3814  d_func()->hd = BeginPaint(internalWinId(), &ps);
3815 
3816  const QRect updateRect(QPoint(ps.rcPaint.left, ps.rcPaint.top),
3817  QPoint(ps.rcPaint.right, ps.rcPaint.bottom));
3818 
3819  // Mapping region from system to qt (32 bit) coordinate system.
3820  d_func()->syncBackingStore(updateRect.translated(data->wrect.topLeft()));
3821 
3822  d_func()->hd = 0;
3823  EndPaint(internalWinId(), &ps);
3824 
3825  return true;
3826 }
Qt::HANDLE hd
Definition: qwidget_p.h:754
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
QRegion qt_dirtyRegion(QWidget *)
Definition: qwidget.cpp:1111
void syncBackingStore()
Definition: qwidget.cpp:1912
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QWidgetPrivate * d_func()
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QWidgetData * data
Definition: qwidget.h:815
#define FALSE
Synonym for false.
Definition: qglobal.h:1019
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QRect wrect
Definition: qwidget.h:145
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ translatePaintEvent() [2/2]

void QETWidget::translatePaintEvent ( const XEvent event)

Definition at line 5206 of file qapplication_x11.cpp.

5207 {
5210 
5211  Q_D(QWidget);
5212  QRect paintRect(event->xexpose.x, event->xexpose.y,
5213  event->xexpose.width, event->xexpose.height);
5214  XEvent xevent;
5216  info.window = internalWinId();
5217  translateBySips(this, paintRect);
5218  paintRect = d->mapFromWS(paintRect);
5219 
5220  QRegion paintRegion = paintRect;
5221 
5222  // WARNING: this is O(number_of_events * number_of_matching_events)
5223  while (XCheckIfEvent(X11->display,&xevent,isPaintOrScrollDoneEvent,
5224  (XPointer)&info) &&
5225  !qt_x11EventFilter(&xevent) &&
5226  !x11Event(&xevent)) // send event through filter
5227  {
5228  if (xevent.type == Expose || xevent.type == GraphicsExpose) {
5229  QRect exposure(xevent.xexpose.x,
5230  xevent.xexpose.y,
5231  xevent.xexpose.width,
5232  xevent.xexpose.height);
5233  translateBySips(this, exposure);
5234  exposure = d->mapFromWS(exposure);
5235  paintRegion |= exposure;
5236  } else {
5237  translateScrollDoneEvent(&xevent);
5238  }
5239  }
5240 
5241  if (!paintRegion.isEmpty() && !testAttribute(Qt::WA_WState_ConfigPending))
5242  d->syncBackingStore(paintRegion);
5243 }
double d
Definition: qnumeric_p.h:62
static mach_timebase_info_data_t info
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
#define Q_D(Class)
Definition: qglobal.h:2482
union _XEvent XEvent
Definition: qwindowdefs.h:116
static Bool isPaintOrScrollDoneEvent(Display *, XEvent *ev, XPointer a)
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
bool translateScrollDoneEvent(const XEvent *)
virtual bool x11Event(XEvent *)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
Definition: qwidget.cpp:9969
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
char * XPointer
Definition: qt_x11_p.h:180
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool translateBySips(QWidget *that, QRect &paintRect)
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static bool qt_x11EventFilter(XEvent *ev)
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636

◆ translatePropertyEvent()

bool QETWidget::translatePropertyEvent ( const XEvent event)

Definition at line 4959 of file qapplication_x11.cpp.

Referenced by QApplication::x11ProcessEvent().

4960 {
4961  Q_D(QWidget);
4962  if (!isWindow()) return true;
4963 
4964  Atom ret;
4965  int format, e;
4966  unsigned char *data = 0;
4967  unsigned long nitems, after;
4968 
4969  if (event->xproperty.atom == ATOM(_KDE_NET_WM_FRAME_STRUT)) {
4970  this->data->fstrut_dirty = 1;
4971 
4972  if (event->xproperty.state == PropertyNewValue) {
4973  e = XGetWindowProperty(X11->display, event->xproperty.window, ATOM(_KDE_NET_WM_FRAME_STRUT),
4974  0, 4, // struts are 4 longs
4975  False, XA_CARDINAL, &ret, &format, &nitems, &after, &data);
4976 
4977  if (e == Success && ret == XA_CARDINAL &&
4978  format == 32 && nitems == 4) {
4979  long *strut = (long *) data;
4980  d->topData()->frameStrut.setCoords(strut[0], strut[2], strut[1], strut[3]);
4981  this->data->fstrut_dirty = 0;
4982  }
4983  }
4984  } else if (event->xproperty.atom == ATOM(_NET_WM_STATE)) {
4985  bool max = false;
4986  bool full = false;
4987  Qt::WindowStates oldState = Qt::WindowStates(this->data->window_state);
4988 
4989  if (event->xproperty.state == PropertyNewValue) {
4990  // using length of 1024 should be safe for all current and
4991  // possible NET states...
4992  e = XGetWindowProperty(X11->display, event->xproperty.window, ATOM(_NET_WM_STATE), 0, 1024,
4993  False, XA_ATOM, &ret, &format, &nitems, &after, &data);
4994 
4995  if (e == Success && ret == XA_ATOM && format == 32 && nitems > 0) {
4996  Atom *states = (Atom *) data;
4997 
4998  unsigned long i;
4999  uint maximized = 0;
5000  for (i = 0; i < nitems; i++) {
5001  if (states[i] == ATOM(_NET_WM_STATE_MAXIMIZED_VERT))
5002  maximized |= 1;
5003  else if (states[i] == ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))
5004  maximized |= 2;
5005  else if (states[i] == ATOM(_NET_WM_STATE_FULLSCREEN))
5006  full = true;
5007  }
5008  if (maximized == 3) {
5009  // only set maximized if both horizontal and vertical properties are set
5010  max = true;
5011  }
5012  }
5013  }
5014 
5015  bool send_event = false;
5016 
5017  if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))
5018  && X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) {
5019  if (max && !isMaximized()) {
5020  this->data->window_state = this->data->window_state | Qt::WindowMaximized;
5021  send_event = true;
5022  } else if (!max && isMaximized()) {
5023  this->data->window_state &= ~Qt::WindowMaximized;
5024  send_event = true;
5025  }
5026  }
5027 
5028  if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) {
5029  if (full && !isFullScreen()) {
5030  this->data->window_state = this->data->window_state | Qt::WindowFullScreen;
5031  send_event = true;
5032  } else if (!full && isFullScreen()) {
5033  this->data->window_state &= ~Qt::WindowFullScreen;
5034  send_event = true;
5035  }
5036  }
5037 
5038  if (send_event) {
5039  QWindowStateChangeEvent e(oldState);
5041  }
5042  } else if (event->xproperty.atom == ATOM(WM_STATE)) {
5043  // the widget frame strut should also be invalidated
5044  this->data->fstrut_dirty = 1;
5045 
5046  if (event->xproperty.state == PropertyDelete) {
5047  // the window manager has removed the WM State property,
5048  // so it is now in the withdrawn state (ICCCM 4.1.3.1) and
5049  // we are free to reuse this window
5050  d->topData()->parentWinId = 0;
5051  d->topData()->validWMState = 0;
5052  // map the window if we were waiting for a transition to
5053  // withdrawn
5054  if (X11->deferred_map.removeAll(this)) {
5055  doDeferredMap();
5056  } else if (isVisible()
5059  // so that show() will work again. As stated in the
5060  // ICCCM section 4.1.4: "Only the client can effect a
5061  // transition into or out of the Withdrawn state.",
5062  // but apparently this particular window manager
5063  // doesn't seem to care
5066  }
5067  } else {
5068  // the window manager has changed the WM State property...
5069  // we are wanting to see if we are withdrawn so that we
5070  // can reuse this window...
5071  e = XGetWindowProperty(X11->display, internalWinId(), ATOM(WM_STATE), 0, 2, False,
5072  ATOM(WM_STATE), &ret, &format, &nitems, &after, &data);
5073 
5074  if (e == Success && ret == ATOM(WM_STATE) && format == 32 && nitems > 0) {
5075  long *state = (long *) data;
5076  switch (state[0]) {
5077  case WithdrawnState:
5078  // if we are in the withdrawn state, we are free
5079  // to reuse this window provided we remove the
5080  // WM_STATE property (ICCCM 4.1.3.1)
5081  XDeleteProperty(X11->display, internalWinId(), ATOM(WM_STATE));
5082 
5083  // set the parent id to zero, so that show() will
5084  // work again
5085  d->topData()->parentWinId = 0;
5086  d->topData()->validWMState = 0;
5087  // map the window if we were waiting for a
5088  // transition to withdrawn
5089  if (X11->deferred_map.removeAll(this)) {
5090  doDeferredMap();
5091  } else if (isVisible()
5094  // so that show() will work again. As stated
5095  // in the ICCCM section 4.1.4: "Only the
5096  // client can effect a transition into or out
5097  // of the Withdrawn state.", but apparently
5098  // this particular window manager doesn't seem
5099  // to care
5102  }
5103  break;
5104 
5105  case IconicState:
5106  d->topData()->validWMState = 1;
5107  if (!isMinimized()) {
5108  // window was minimized
5109  this->data->window_state = this->data->window_state | Qt::WindowMinimized;
5110  QWindowStateChangeEvent e(Qt::WindowStates(this->data->window_state & ~Qt::WindowMinimized));
5112  }
5113  break;
5114 
5115  default:
5116  d->topData()->validWMState = 1;
5117  if (isMinimized()) {
5118  // window was un-minimized
5119  this->data->window_state &= ~Qt::WindowMinimized;
5120  QWindowStateChangeEvent e(Qt::WindowStates(this->data->window_state | Qt::WindowMinimized));
5122  }
5123  break;
5124  }
5125  }
5126  }
5127  } else if (event->xproperty.atom == ATOM(_NET_WM_WINDOW_OPACITY)) {
5128  // the window opacity was changed
5129  if (event->xproperty.state == PropertyNewValue) {
5130  e = XGetWindowProperty(event->xclient.display,
5131  event->xclient.window,
5133  0, 1, False, XA_CARDINAL,
5134  &ret, &format, &nitems, &after, &data);
5135 
5136  if (e == Success && ret == XA_CARDINAL && format == 32 && nitems == 1
5137  && after == 0 && data) {
5138  ulong value = *(ulong*)(data);
5139  d->topData()->opacity = uint(value >> 24);
5140  }
5141  } else
5142  d->topData()->opacity = 255;
5143  }
5144 
5145  if (data)
5146  XFree(data);
5147 
5148  return true;
5149 }
double d
Definition: qnumeric_p.h:62
void doDeferredMap()
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define X11
Definition: qt_x11_p.h:724
bool maximized
whether this widget is maximized
Definition: qwidget.h:193
#define Q_D(Class)
Definition: qglobal.h:2482
#define ATOM(x)
Definition: qt_x11_p.h:723
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QWidgetData * data
Definition: qwidget.h:815
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
unsigned int uint
Definition: qglobal.h:996
unsigned long ulong
Definition: qglobal.h:997
bool isMaximized() const
Definition: qwidget.cpp:3074
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
bool isFullScreen() const
Definition: qwidget.cpp:3153
Definition: qnamespace.h:54
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
bool isMinimized() const
Definition: qwidget.cpp:3027
uint fstrut_dirty
Definition: qwidget.h:126
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636

◆ translateRegionEvent()

bool QETWidget::translateRegionEvent ( const QWSRegionEvent event)

Definition at line 3595 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

3596 {
3597  QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(windowSurface());
3598  Q_ASSERT(surface);
3599 
3600  QRegion region;
3601  region.setRects(event->rectangles, event->simpleData.nrectangles);
3602 
3603  switch (event->simpleData.type) {
3605  region.translate(-mapToGlobal(QPoint()));
3606  surface->setClipRegion(region);
3607  break;
3608 #ifdef QT_QWS_CLIENTBLIT
3609  case QWSRegionEvent::DirectPaint:
3610  surface->setDirectRegion(region, event->simpleData.id);
3611  break;
3612 #endif
3613  default:
3614  break;
3615  }
3616 
3617  return true;
3618 }
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QWindowSurface * windowSurface() const
Returns the QWindowSurface this widget will be drawn into.
Definition: qwidget.cpp:12819
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QRect * rectangles
Definition: qwsevent_qws.h:265
void setRects(const QRect *rect, int num)
Sets the region using the array of rectangles specified by rects and number.
Definition: qregion.cpp:4424
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
struct QWSRegionEvent::SimpleData simpleData
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.

◆ translateScrollDoneEvent()

bool QETWidget::translateScrollDoneEvent ( const XEvent event)

Definition at line 5249 of file qapplication_x11.cpp.

Referenced by QApplication::x11ClientMessage().

5250 {
5251  long id = event->xclient.data.l[0];
5252 
5253  // Remove any scroll-in-progress record for the given id.
5254  for (int i = 0; i < X11->sip_list.size(); ++i) {
5255  const QX11Data::ScrollInProgress &sip = X11->sip_list.at(i);
5256  if (sip.id == id) {
5257  X11->sip_list.removeAt(i);
5258  return true;
5259  }
5260  }
5261 
5262  return false;
5263 }
#define X11
Definition: qt_x11_p.h:724

◆ translateTabletEvent()

bool QETWidget::translateTabletEvent ( const MSG msg,
PACKET *  localPacketBuf,
int  numPackets 
)

Definition at line 3593 of file qapplication_win.cpp.

Referenced by QtWndProc().

3595 {
3596  Q_UNUSED(msg);
3597  POINT ptNew;
3598  static DWORD btnNew, btnOld, btnChange;
3599  qreal prsNew;
3600  ORIENTATION ort;
3601  static bool button_pressed = false;
3602  int i,
3603  tiltX,
3604  tiltY;
3605  bool sendEvent = false;
3606  QEvent::Type t;
3607  int z = 0;
3608  qreal rotation = 0.0;
3609  qreal tangentialPressure;
3610  // The tablet can be used in 2 different modes, depending on it settings:
3611  // 1) Absolute (pen) mode:
3612  // The coordinates are scaled to the virtual desktop (by default). The user
3613  // can also choose to scale to the monitor or a region of the screen.
3614  // When entering proximity, the tablet driver snaps the mouse pointer to the
3615  // tablet position scaled to that area and keeps it in sync.
3616  // 2) Relative (mouse) mode:
3617  // The pen follows the mouse. The constant 'absoluteRange' specifies the
3618  // manhattanLength difference for detecting if a tablet input device is in this mode,
3619  // in which case we snap the position to the mouse position.
3620  // It seems there is no way to find out the mode programmatically, the LOGCONTEXT orgX/Y/Ext
3621  // area is always the virtual desktop.
3622  enum { absoluteRange = 20 };
3623 
3624  // the most common event that we get...
3625  t = QEvent::TabletMove;
3626  for (i = 0; i < numPackets; i++) {
3627  // get the unique ID of the device...
3628  btnOld = btnNew;
3629  btnNew = localPacketBuf[i].pkButtons;
3630  btnChange = btnOld ^ btnNew;
3631 
3632  if (btnNew & btnChange) {
3633  button_pressed = true;
3634  t = QEvent::TabletPress;
3635  }
3636  ptNew.x = UINT(localPacketBuf[i].pkX);
3637  ptNew.y = UINT(localPacketBuf[i].pkY);
3638 #ifndef QT_NO_TABLETEVENT
3639  z = (currentTabletPointer.currentDevice == QTabletEvent::FourDMouse) ? UINT(localPacketBuf[i].pkZ) : 0;
3640 #else
3641  Q_UNUSED(z);
3642 #endif // QT_NO_TABLETEVENT
3643  prsNew = 0.0;
3644  QRect desktopArea = QApplication::desktop()->geometry();
3645 
3646  // This code is to delay the tablet data one cycle to sync with the mouse location.
3647  QPointF hiResTabletGlobalPosF = oldHiResTabletGlobalPosF;
3649  currentTabletPointer.scaleCoord(ptNew.x, ptNew.y, desktopArea.left(),
3650  desktopArea.width(), desktopArea.top(),
3651  desktopArea.height());
3652 
3653  if (btnNew) {
3654 #ifndef QT_NO_TABLETEVENT
3655  if (currentTabletPointer.currentPointerType == QTabletEvent::Pen || currentTabletPointer.currentPointerType == QTabletEvent::Eraser)
3656  prsNew = localPacketBuf[i].pkNormalPressure
3657  / qreal(currentTabletPointer.maxPressure
3658  - currentTabletPointer.minPressure);
3659  else
3660 #endif // QT_NO_TABLETEVENT
3661  prsNew = 0;
3662  } else if (button_pressed) {
3663  // One button press, should only give one button release
3665  button_pressed = false;
3666  }
3667  QPoint globalPos = hiResTabletGlobalPosF.toPoint();
3668 
3669  // Get Mouse Position and compare to tablet info
3670  // Positions should be almost the same if we are in absolute
3671  // mode. If they are not, use the mouse location.
3672 #ifndef Q_WS_WINCE
3673  POINT mouseLocationP;
3674  if (GetCursorPos(&mouseLocationP)) {
3675  const QPoint mouseLocation(mouseLocationP.x, mouseLocationP.y);
3676  if ((mouseLocation - globalPos).manhattanLength() > absoluteRange) {
3677  globalPos = mouseLocation;
3678  hiResTabletGlobalPosF = globalPos;
3679  }
3680  }
3681 #endif // !Q_WS_WINCE
3682 
3683  if (t == QEvent::TabletPress)
3684  {
3686  }
3687 
3688  // make sure the tablet event get's sent to the proper widget...
3689  QWidget *w = 0;
3690 
3691  if (qt_button_down)
3692  w = qt_button_down; // Pass it to the thing that's grabbed it.
3693  else
3694  w = QApplication::widgetAt(globalPos);
3695 
3696  if (!w)
3697  w = this;
3698 
3699  if (t == QEvent::TabletRelease)
3700  {
3705  qt_button_down = 0;
3706  }
3707  }
3708 
3709  }
3710 
3711  QPoint localPos = w->mapFromGlobal(globalPos);
3712 #ifndef QT_NO_TABLETEVENT
3713  if (currentTabletPointer.currentDevice == QTabletEvent::Airbrush) {
3714  tangentialPressure = localPacketBuf[i].pkTangentPressure
3715  / qreal(currentTabletPointer.maxTanPressure
3716  - currentTabletPointer.minTanPressure);
3717  } else {
3718  tangentialPressure = 0.0;
3719  }
3720 #else
3721  tangentialPressure = 0.0;
3722 #endif // QT_NO_TABLETEVENT
3723 
3724  if (!qt_tablet_tilt_support) {
3725  tiltX = tiltY = 0;
3726  rotation = 0.0;
3727  } else {
3728  ort = localPacketBuf[i].pkOrientation;
3729  // convert from azimuth and altitude to x tilt and y tilt
3730  // what follows is the optimized version. Here are the equations
3731  // I used to get to this point (in case things change :)
3732  // X = sin(azimuth) * cos(altitude)
3733  // Y = cos(azimuth) * cos(altitude)
3734  // Z = sin(altitude)
3735  // X Tilt = arctan(X / Z)
3736  // Y Tilt = arctan(Y / Z)
3737  double radAzim = (ort.orAzimuth / 10) * (Q_PI / 180);
3738  //double radAlt = abs(ort.orAltitude / 10) * (Q_PI / 180);
3739  double tanAlt = tan((abs(ort.orAltitude / 10)) * (Q_PI / 180));
3740 
3741  double degX = atan(sin(radAzim) / tanAlt);
3742  double degY = atan(cos(radAzim) / tanAlt);
3743  tiltX = int(degX * (180 / Q_PI));
3744  tiltY = int(-degY * (180 / Q_PI));
3745  rotation = ort.orTwist;
3746  }
3747 #ifndef QT_NO_TABLETEVENT
3748  QTabletEvent e(t, localPos, globalPos, hiResTabletGlobalPosF, currentTabletPointer.currentDevice,
3749  currentTabletPointer.currentPointerType, prsNew, tiltX, tiltY,
3750  tangentialPressure, rotation, z, QApplication::keyboardModifiers(), currentTabletPointer.llId);
3751  sendEvent = QApplication::sendSpontaneousEvent(w, &e);
3752 #endif // QT_NO_TABLETEVENT
3753  }
3754  return sendEvent;
3755 }
QPointF oldHiResTabletGlobalPosF
static HWND autoCaptureWnd
double qreal
Definition: qglobal.h:1193
QTabletDeviceData currentTabletPointer
Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static void releaseAutoCapture()
The QTabletEvent class contains parameters that describe a Tablet event.
Definition: qevent.h:179
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
Definition: qpoint.h:376
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
bool qt_tablet_tilt_support
const QRect & geometry() const
#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
QWidget * qt_button_down
static const qreal Q_PI
Definition: qmath_p.h:61

◆ translateWheelEvent() [1/3]

bool QETWidget::translateWheelEvent ( const QWSMouseEvent me)

Definition at line 3288 of file qapplication_qws.cpp.

Referenced by QtWndProc(), and QApplication::qwsProcessEvent().

3289 {
3290 #ifdef QT_NO_WHEELEVENT
3291  Q_UNUSED(me);
3292  return false;
3293 #else
3294  const QWSMouseEvent::SimpleData &mouse = me->simpleData;
3295 
3296  // Figure out wheeling direction:
3297  // Horizontal wheel w/o Alt
3298  // OR Vertical wheel w/ Alt ==> Horizontal wheeling
3299  // ..all other permutations ==> Vertical wheeling
3300  int axis = mouse.delta / 120; // WHEEL_DELTA?
3301  Qt::Orientation orient = ((axis == 2 || axis == -2) && ((mouse.state & Qt::AltModifier) == 0))
3302  ||((axis == 1 || axis == -1) && mouse.state & Qt::AltModifier)
3304 
3305  QPoint mousePoint = QPoint(mouse.x_root, mouse.y_root);
3306 
3307  // send the event to the widget or its ancestors
3308  QWidget* popup = qApp->activePopupWidget();
3309  if (popup && window() != popup)
3310  popup->close();
3311  QWheelEvent we(mapFromGlobal(mousePoint), mousePoint, mouse.delta,
3312  Qt::MouseButtons(mouse.state & Qt::MouseButtonMask),
3313  Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask), orient);
3314  if (QApplication::sendSpontaneousEvent(this, &we))
3315  return true;
3316 
3317  // send the event to the widget that has the focus or its ancestors, if different
3318  QWidget *w = this;
3319  if (w != qApp->focusWidget() && (w = qApp->focusWidget())) {
3320  QWidget* popup = qApp->activePopupWidget();
3321  if (popup && w != popup)
3322  popup->hide();
3324  return true;
3325  }
3326  return false;
3327 #endif
3328 }
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
struct QWSMouseEvent::SimpleData simpleData
#define qApp
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
void hide()
Hides the widget.
Definition: qwidget.h:501
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
Orientation
Definition: qnamespace.h:174
#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

◆ translateWheelEvent() [2/3]

bool QETWidget::translateWheelEvent ( const MSG msg)

Definition at line 3402 of file qapplication_win.cpp.

3403 {
3404  int state = 0;
3405 
3406  if (sm_blockUserInput) // block user interaction during session management
3407  return true;
3408 
3409  state = translateButtonState(GET_KEYSTATE_WPARAM(msg.wParam), 0, 0);
3410 
3411  int delta;
3412  if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
3413  delta = (short) HIWORD (msg.wParam);
3414  else
3415  delta = (int) msg.wParam;
3416 
3417  Qt::Orientation orient = (msg.message == WM_MOUSEHWHEEL || state&Qt::AltModifier
3418 #if 0
3419  // disabled for now - Trenton's one-wheel mouse makes trouble...
3420  // "delta" for usual wheels is +-120. +-240 seems to indicate
3421  // the second wheel see more recent MSDN for WM_MOUSEWHEEL
3422 
3423  ( // <- parantheses added to make update happy, remove if the
3424  // #if 0 is removed
3425  || delta == 240 || delta == -240)?Qt::Horizontal:Vertical;
3426  if (delta == 240 || delta == -240)
3427  delta /= 2;
3428 #endif
3430 
3431  // according to the MSDN documentation on WM_MOUSEHWHEEL:
3432  // a positive value indicates that the wheel was rotated to the right;
3433  // a negative value indicates that the wheel was rotated to the left.
3434  // Qt defines this value as the exact opposite, so we have to flip the value!
3435  if (msg.message == WM_MOUSEHWHEEL)
3436  delta = -delta;
3437 
3438  QPoint globalPos;
3439 
3440  globalPos.rx() = (short)LOWORD (msg.lParam);
3441  globalPos.ry() = (short)HIWORD (msg.lParam);
3442 
3443 
3444  // if there is a widget under the mouse and it is not shadowed
3445  // by modality, we send the event to it first
3446  int ret = 0;
3447  QWidget* w = QApplication::widgetAt(globalPos);
3448  if (!w || !qt_try_modal(w, (MSG*)&msg, ret)) {
3449  //synaptics touchpad shows its own widget at this position
3450  //so widgetAt() will fail with that HWND, try child of this widget
3451  w = this->childAt(this->mapFromGlobal(globalPos));
3452  if (!w)
3453  w = this;
3454  }
3455 
3456  // send the event to the widget or its ancestors
3457  {
3459  if (popup && w->window() != popup)
3460  popup->close();
3461 #ifndef QT_NO_WHEELEVENT
3462  QWheelEvent e(w->mapFromGlobal(globalPos), globalPos, delta,
3463  Qt::MouseButtons(state & Qt::MouseButtonMask),
3465 
3467 #else
3468  Q_UNUSED(orient);
3469 #endif //QT_NO_WHEELEVENT
3470  return true;
3471  }
3472 
3473  // send the event to the widget that has the focus or its ancestors, if different
3474  if (w != QApplication::focusWidget() && (w = QApplication::focusWidget())) {
3476  if (popup && w->window() != popup)
3477  popup->close();
3478 #ifndef QT_NO_WHEELEVENT
3479  QWheelEvent e(w->mapFromGlobal(globalPos), globalPos, delta,
3480  Qt::MouseButtons(state & Qt::MouseButtonMask),
3483 #endif //QT_NO_WHEELEVENT
3484  return true;
3485  }
3486  return false;
3487 }
#define WM_MOUSEWHEEL
Definition: qt_windows.h:116
#define WM_MOUSEHWHEEL
Definition: qt_windows.h:119
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
KeyboardModifier
Definition: qnamespace.h:127
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
static bool qt_try_modal(QWidget *, MSG *, int &ret)
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
#define GET_KEYSTATE_WPARAM(wParam)
struct tagMSG MSG
static QWidget * activePopupWidget()
Returns the active popup widget.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
static bool sm_blockUserInput
Orientation
Definition: qnamespace.h:174
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#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
static int translateButtonState(int s, int type, int button)

◆ translateWheelEvent() [3/3]

bool QETWidget::translateWheelEvent ( int  global_x,
int  global_y,
int  delta,
Qt::MouseButtons  buttons,
Qt::KeyboardModifiers  modifiers,
Qt::Orientation  orient 
)

Definition at line 4537 of file qapplication_x11.cpp.

4540 {
4541  const QPoint globalPos = QPoint(global_x, global_y);
4542  QPoint pos = mapFromGlobal(globalPos);
4543  QWidget *widget = childAt(pos);
4544  if (!widget)
4545  widget = this;
4546  else if (!widget->internalWinId())
4547  pos = widget->mapFromGlobal(globalPos);
4548 
4549 #ifdef ALIEN_DEBUG
4550  qDebug() << "QETWidget::translateWheelEvent: receiver:" << widget << "pos:" << pos;
4551 #endif
4552 
4553  // send the event to the widget or its ancestors
4554  {
4555  QWidget* popup = qApp->activePopupWidget();
4556  if (popup && window() != popup)
4557  popup->close();
4558 #ifndef QT_NO_WHEELEVENT
4559  QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
4560  if (QApplication::sendSpontaneousEvent(widget, &e))
4561 #endif
4562  return true;
4563  }
4564 
4565  // send the event to the widget that has the focus or its ancestors, if different
4566  if (widget != qApp->focusWidget() && (widget = qApp->focusWidget())) {
4567  if (widget && !widget->internalWinId())
4568  pos = widget->mapFromGlobal(globalPos);
4569  QWidget* popup = qApp->activePopupWidget();
4570  if (popup && widget != popup)
4571  popup->hide();
4572 #ifndef QT_NO_WHEELEVENT
4573  QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
4574  if (QApplication::sendSpontaneousEvent(widget, &e))
4575 #endif
4576  return true;
4577  }
4578  return false;
4579 }
QPoint pos() const
QPointer< QWidget > widget
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
static Qt::MouseButtons buttons
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
Q_CORE_EXPORT void qDebug(const char *,...)
#define qApp
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
void hide()
Hides the widget.
Definition: qwidget.h:501
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
bool close()
Closes this widget.
Definition: qwidget.cpp:8305

◆ translateXinputEvent()

bool QETWidget::translateXinputEvent ( const XEvent ev,
QTabletDeviceData tablet 
)

Definition at line 4700 of file qapplication_x11.cpp.

Referenced by QApplication::x11ProcessEvent().

4701 {
4702 #if defined (Q_OS_IRIX)
4703  // Wacom has put defines in their wacom.h file so it would be quite wise
4704  // to use them, need to think of a decent way of not using
4705  // it when it doesn't exist...
4706  XDeviceState *s;
4707  XInputClass *iClass;
4708  XValuatorState *vs;
4709  int j;
4710 #endif
4711 
4712  Q_ASSERT(tablet != 0);
4713 
4714  QWidget *w = this;
4715  QPoint global,
4716  curr;
4717  QPointF hiRes;
4718  qreal pressure = 0;
4719  int xTilt = 0,
4720  yTilt = 0,
4721  z = 0;
4722  qreal tangentialPressure = 0;
4723  qreal rotation = 0;
4724  int deviceType = QTabletEvent::NoDevice;
4725  int pointerType = QTabletEvent::UnknownPointer;
4726  const XDeviceMotionEvent *motion = 0;
4727  XDeviceButtonEvent *button = 0;
4728  const XProximityNotifyEvent *proximity = 0;
4729  QEvent::Type t;
4730  Qt::KeyboardModifiers modifiers = 0;
4731 #if !defined (Q_OS_IRIX)
4732  XID device_id;
4733 #endif
4734 
4735  if (ev->type == tablet->xinput_motion) {
4736  motion = reinterpret_cast<const XDeviceMotionEvent*>(ev);
4737  t = QEvent::TabletMove;
4738  global = QPoint(motion->x_root, motion->y_root);
4739  curr = QPoint(motion->x, motion->y);
4740 #if !defined (Q_OS_IRIX)
4741  device_id = motion->deviceid;
4742 #endif
4743  } else if (ev->type == tablet->xinput_button_press || ev->type == tablet->xinput_button_release) {
4744  if (ev->type == tablet->xinput_button_press) {
4745  t = QEvent::TabletPress;
4746  } else {
4748  }
4749  button = (XDeviceButtonEvent*)ev;
4750 
4751  global = QPoint(button->x_root, button->y_root);
4752  curr = QPoint(button->x, button->y);
4753 #if !defined (Q_OS_IRIX)
4754  device_id = button->deviceid;
4755 #endif
4756  } else { // Proximity
4757  if (ev->type == tablet->xinput_proximity_in)
4759  else
4761  proximity = (const XProximityNotifyEvent*)ev;
4762 #if !defined (Q_OS_IRIX)
4763  device_id = proximity->deviceid;
4764 #endif
4765  }
4766 
4767  qint64 uid = 0;
4768 #if defined (Q_OS_IRIX)
4769  QRect screenArea = qApp->desktop()->screenGeometry(this);
4770  s = XQueryDeviceState(X11->display, static_cast<XDevice *>(tablet->device));
4771  if (!s)
4772  return false;
4773  iClass = s->data;
4774  for (j = 0; j < s->num_classes; j++) {
4775  if (iClass->c_class == ValuatorClass) {
4776  vs = reinterpret_cast<XValuatorState *>(iClass);
4777  // figure out what device we have, based on bitmasking...
4778  if (vs->valuators[WAC_TRANSDUCER_I]
4779  & WAC_TRANSDUCER_PROX_MSK) {
4780  switch (vs->valuators[WAC_TRANSDUCER_I]
4781  & WAC_TRANSDUCER_MSK) {
4782  case WAC_PUCK_ID:
4783  pointerType = QTabletEvent::Puck;
4784  break;
4785  case WAC_STYLUS_ID:
4786  pointerType = QTabletEvent::Pen;
4787  break;
4788  case WAC_ERASER_ID:
4789  pointerType = QTabletEvent::Eraser;
4790  break;
4791  }
4792  // Get a Unique Id for the device, Wacom gives us this ability
4793  uid = vs->valuators[WAC_TRANSDUCER_I] & WAC_TRANSDUCER_ID_MSK;
4794  uid = (uid << 24) | vs->valuators[WAC_SERIAL_NUM_I];
4795  switch (WAC_TRANSDUCER_I & 0x0F0600) {
4796  case 0x080200:
4797  deviceType = QTabletEvent::Stylus;
4798  break;
4799  case 0x090200:
4800  deviceType = QTabletEvent::Airbrush;
4801  break;
4802  case 0x000400:
4803  deviceType = QTabletEvent::FourDMouse;
4804  break;
4805  case 0x000600:
4806  deviceType = QTabletEvent::Puck;
4807  break;
4808  case 0x080400:
4809  deviceType = QTabletEvent::RotationStylus;
4810  break;
4811  }
4812  } else {
4813  pointerType = QTabletEvent::UnknownPointer;
4814  deviceType = QTabletEvent::NoDevice;
4815  uid = 0;
4816  }
4817 
4818  if (!proximity) {
4819  // apparently Wacom needs a cast for the +/- values to make sense
4820  xTilt = short(vs->valuators[WAC_XTILT_I]);
4821  yTilt = short(vs->valuators[WAC_YTILT_I]);
4822  pressure = vs->valuators[WAC_PRESSURE_I];
4823  if (deviceType == QTabletEvent::FourDMouse
4824  || deviceType == QTabletEvent::RotationStylus) {
4825  rotation = vs->valuators[WAC_ROTATION_I] / 64.0;
4826  if (deviceType == QTabletEvent::FourDMouse)
4827  z = vs->valuators[WAC_ZCOORD_I];
4828  } else if (deviceType == QTabletEvent::Airbrush) {
4829  tangentialPressure = vs->valuators[WAC_TAN_PRESSURE_I]
4830  / qreal(tablet->maxTanPressure - tablet->minTanPressure);
4831  }
4832 
4833  hiRes = tablet->scaleCoord(vs->valuators[WAC_XCOORD_I], vs->valuators[WAC_YCOORD_I],
4834  screenArea.x(), screenArea.width(),
4835  screenArea.y(), screenArea.height());
4836  }
4837  break;
4838  }
4839  iClass = reinterpret_cast<XInputClass*>(reinterpret_cast<char*>(iClass) + iClass->length);
4840  }
4841  XFreeDeviceState(s);
4842 #else
4843  // We've been passed in data for a tablet device that handles this type
4844  // of event, but it isn't necessarily the tablet device that originated
4845  // the event. Use the device id to find the originating device if we
4846  // have it.
4847  QTabletDeviceDataList *tablet_list = qt_tablet_devices();
4848  for (int i = 0; i < tablet_list->size(); ++i) {
4849  QTabletDeviceData &tab = tablet_list->operator[](i);
4850  if (device_id == static_cast<XDevice *>(tab.device)->device_id) {
4851  // Replace the tablet passed in with this one.
4852  tablet = &tab;
4853  deviceType = tab.deviceType;
4855  deviceType = QTabletEvent::Stylus;
4856  pointerType = QTabletEvent::Eraser;
4857  } else if (tab.deviceType == QTabletEvent::Stylus) {
4858  pointerType = QTabletEvent::Pen;
4859  }
4860  break;
4861  }
4862  }
4863 
4864  fetchWacomToolId(deviceType, uid);
4865 
4866  QRect screenArea = qApp->desktop()->rect();
4867  if (motion) {
4868  xTilt = (short) motion->axis_data[3];
4869  yTilt = (short) motion->axis_data[4];
4870  rotation = ((short) motion->axis_data[5]) / 64.0;
4871  pressure = (short) motion->axis_data[2];
4872  modifiers = X11->translateModifiers(motion->state);
4873  hiRes = tablet->scaleCoord(motion->axis_data[0], motion->axis_data[1],
4874  screenArea.x(), screenArea.width(),
4875  screenArea.y(), screenArea.height());
4876  } else if (button) {
4877  xTilt = (short) button->axis_data[3];
4878  yTilt = (short) button->axis_data[4];
4879  rotation = ((short) button->axis_data[5]) / 64.0;
4880  pressure = (short) button->axis_data[2];
4881  modifiers = X11->translateModifiers(button->state);
4882  hiRes = tablet->scaleCoord(button->axis_data[0], button->axis_data[1],
4883  screenArea.x(), screenArea.width(),
4884  screenArea.y(), screenArea.height());
4885  } else if (proximity) {
4886  pressure = 0;
4887  modifiers = 0;
4888  }
4889  if (deviceType == QTabletEvent::Airbrush) {
4890  tangentialPressure = rotation;
4891  rotation = 0.;
4892  }
4893 #endif
4894 
4895  if (tablet->widgetToGetPress) {
4896  w = tablet->widgetToGetPress;
4897  } else {
4898  QWidget *child = w->childAt(curr);
4899  if (child)
4900  w = child;
4901  }
4902  curr = w->mapFromGlobal(global);
4903 
4904  if (t == QEvent::TabletPress) {
4905  tablet->widgetToGetPress = w;
4906  } else if (t == QEvent::TabletRelease && tablet->widgetToGetPress) {
4907  w = tablet->widgetToGetPress;
4908  curr = w->mapFromGlobal(global);
4909  tablet->widgetToGetPress = 0;
4910  }
4911 
4912  QTabletEvent e(t, curr, global, hiRes,
4913  deviceType, pointerType,
4914  qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)),
4915  xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid);
4916  if (proximity) {
4918  } else {
4920  const bool accepted = e.isAccepted();
4921  if (!accepted && ev->type == tablet->xinput_motion) {
4922  // If the widget does not accept tablet events, we drop the next ones from the event queue
4923  // for this widget so it is not overloaded with the numerous tablet events.
4924  qt_tablet_motion_data tabletMotionData;
4925  tabletMotionData.tabletMotionType = tablet->xinput_motion;
4926  tabletMotionData.widget = w;
4927  tabletMotionData.etWidget = this;
4928  // if nothing is pressed, the events are filtered by position
4929  tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0);
4930 
4931  bool reinsertMouseEvent = false;
4932  XEvent mouseMotionEvent;
4933  while (true) {
4934  // Find first mouse event since we expect them in pairs inside Qt
4935  tabletMotionData.error =false;
4936  if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
4937  reinsertMouseEvent = true;
4938  } else {
4939  break;
4940  }
4941 
4942  // Now discard any duplicate tablet events.
4943  tabletMotionData.error = false;
4944  XEvent dummy;
4945  while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
4946  // just discard the event
4947  }
4948  }
4949 
4950  if (reinsertMouseEvent) {
4951  XPutBackEvent(X11->display, &mouseMotionEvent);
4952  }
4953  }
4954  }
4955  return true;
4956 }
double qreal
Definition: qglobal.h:1193
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
QPointer< QWidget > widgetToGetPress
QTabletDeviceDataList * qt_tablet_devices()
union _XEvent XEvent
Definition: qwindowdefs.h:116
#define qApp
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static Bool qt_mouseMotion_scanner(Display *, XEvent *event, XPointer arg)
__int64 qint64
Definition: qglobal.h:942
The QTabletEvent class contains parameters that describe a Tablet event.
Definition: qevent.h:179
char * XPointer
Definition: qt_x11_p.h:180
void fetchWacomToolId(int &deviceType, qint64 &serialId)
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg)
unsigned long XID
Definition: qgtkstyle_p.h:71
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ updateRegion()

void QETWidget::updateRegion ( )

Definition at line 3651 of file qapplication_qws.cpp.

3652 {
3653  Q_D(QWidget);
3654 
3655  QTLWExtra *topextra = d->maybeTopData();
3656  if (!topextra)
3657  return;
3658 
3659  QRegion myregion = d->localRequestedRegion();
3660  myregion.translate(geometry().topLeft());
3661 
3662 #ifndef QT_NO_QWS_MANAGER
3663  QWSManager *manager = topextra->qwsManager;
3664  if (manager)
3665  myregion += manager->region();
3666 #endif
3667 
3668  QRect br(myregion.boundingRect());
3669  topextra->frameStrut.setCoords(d->data.crect.x() - br.x(),
3670  d->data.crect.y() - br.y(),
3671  br.right() - d->data.crect.right(),
3672  br.bottom() - d->data.crect.bottom());
3673 }
double d
Definition: qnumeric_p.h:62
QRect frameStrut
Definition: qwidget_p.h:180
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
#define Q_D(Class)
Definition: qglobal.h:2482
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
const QRect & geometry() const
friend class QWSManager
Definition: qwidget.h:786

◆ winEvent()

bool QETWidget::winEvent ( MSG message,
long *  result 
)
inlinevirtual

This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter.

In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result to the value that the window procedure should return. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.

Warning
This function is not portable.
See also
QApplication::winEventFilter()

Reimplemented from QWidget.

Definition at line 476 of file qapplication_win.cpp.

Referenced by QtWndProc().

476 { return QWidget::winEvent(m, r); }
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941

◆ xtra()

QWExtra* QETWidget::xtra ( )
inline

Definition at line 468 of file qapplication_win.cpp.

Referenced by QtWndProc().

468 { return d_func()->extraData(); }
QWidgetPrivate * d_func()
QWExtra * extraData() const
Definition: qwidget_p.h:999

The documentation for this class was generated from the following files: