summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-01-27 14:09:36 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-30 16:40:02 +0100
commit870f19f44b1eb2b93c7151dd48b8d9cd471acae8 (patch)
tree111a6ae7cf59b83ca6f872bd537b4c8a635d8800 /src/widgets/kernel/qwidget.cpp
parentb3a978d661b7d85b637e8e8a134bd1df925947f8 (diff)
Add native event filters to Windows, forward to Widgets.
Use prototypically for qwizard_win.cpp. Change-Id: I075e81ae1bc3d62d9f27e51c73c800ffd71cbcd6 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp105
1 files changed, 15 insertions, 90 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index af3941c231..4402b497ad 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -8963,111 +8963,36 @@ void QWidget::hideEvent(QHideEvent *)
{
}
-/*
- \fn QWidget::x11Event(MSG *)
-
- This special event handler can be reimplemented in a subclass to receive
- native X11 events.
-
- In your reimplementation of this function, if you want to stop Qt from
- handling the event, return true. If you return false, this native event
- is passed back to Qt, which translates it into a Qt event and sends it to
- the widget.
-
- \note Events are only delivered to this event handler if the widget is
- native.
-
- \warning This function is not portable.
-
- \sa QApplication::x11EventFilter(), QWidget::winId()
-*/
-
-
-#if defined(Q_WS_MAC)
-
/*!
- \fn bool QWidget::macEvent(EventHandlerCallRef caller, EventRef event)
-
This special event handler can be reimplemented in a subclass to
- receive native Macintosh events.
-
- The parameters are a bit different depending if Qt is build against Carbon
- or Cocoa. In Carbon, \a caller and \a event are the corresponding
- EventHandlerCallRef and EventRef that correspond to the Carbon event
- handlers that are installed. In Cocoa, \a caller is always 0 and the
- EventRef is the EventRef generated from the NSEvent.
+ receive native platform events identified by \a eventType
+ which are passed in the \a message parameter.
In your reimplementation of this function, if you want to stop the
- event being handled by Qt, return true. 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.
+ event being handled by Qt, return true and set \a result.
+ 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.
+ \note Events are only delivered to this event handler if the widget is
+ has a native Window handle.
- \warning This function was not called inside of Qt until Qt 4.4.
- If you need compatibility with earlier versions of Qt, consider QApplication::macEventFilter() instead.
+ \note This function superseedes the event filter functions
+ x11Event(), winEvent() and macEvent() of Qt 4.
- \sa QApplication::macEventFilter()
+ \table
+ \header \i Platform \i Event Type Identifier \i Message Type \i Result Type
+ \row \i Windows \i "windows_generic_MSG" \i MSG * \i LRESULT
+ \endtable
*/
-bool QWidget::macEvent(EventHandlerCallRef, EventRef)
-{
- return false;
-}
-
-#endif
-#if defined(Q_WS_WIN)
-
-/*!
- This special event handler can be reimplemented in a subclass to
- receive native Windows events which are passed in the \a message
- parameter.
-
- In your reimplementation of this function, if you want to stop the
- event being handled by Qt, return true and set \a 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.
-
- \sa QApplication::winEventFilter()
-*/
-bool QWidget::winEvent(MSG *message, long *result)
+bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
+ Q_UNUSED(eventType);
Q_UNUSED(message);
Q_UNUSED(result);
return false;
}
-#endif
-#if defined(Q_WS_X11)
-
-/*!
- \fn bool QWidget::x11Event(XEvent *event)
-
- This special event handler can be reimplemented in a subclass to receive
- native X11 events passed in the \a event parameter.
-
- In your reimplementation of this function, if you want to stop Qt from
- handling the event, return true. If you return false, this native event
- is passed back to Qt, which translates it into a Qt event and sends it to
- the widget.
-
- \note Events are only delivered to this event handler if the widget is
- native.
-
- \warning This function is not portable.
-
- \sa QApplication::x11EventFilter(), QWidget::winId()
-*/
-bool QWidget::x11Event(XEvent *)
-{
- return false;
-}
-
-#endif
-
/*!
Ensures that the widget has been polished by QStyle (i.e., has a
proper font and palette).