- QIconEnginePluginV{2} classes have been merged
- QIconEngineFactoryInterfaceV{2} classes and interfaces have been merged
- QKeyEventEx and QKeyEvent classes have been merged
+ - QMouseEventEx and QMouseEvent classes have been merged
- QGuiPlatformPlugin class is public
- zlib, OpenSSL, PCRE, Freetype and X11 are required for building
- OpenSSL, D-Bus, CUPS, resolv and NSL cannot be runtime dependencies, they
)
endmacro()
-# a macro to add tests easily by setting them up with the assumptions they make
+# a macro to add tests that require GUI easily by setting them up with the assumptions they make
macro(KATIE_GUI_TEST TESTNAME TESTSOURCES)
katie_resources(${TESTSOURCES} ${ARGN})
#define QFILE_H
#include <QtCore/qiodevice.h>
+
#include <stdio.h>
#ifdef open
if (event->type() == QEvent::DeferredDelete && data == QThreadData::current()) {
// remember the current running eventloop for DeferredDelete
// events posted in the receiver's thread
- event->d = reinterpret_cast<QEventPrivate *>(quintptr(data->loopLevel));
+ event->looplevel = data->loopLevel;
}
// delete the event on exceptions to protect against memory leaks till the event is
// (s.a. QEvent::DeferredDelete), and then only if the event loop that
// posted the event has returned.
const bool allowDeferredDelete =
- (quintptr(pe.event->d) > unsigned(data->loopLevel)
- || (!quintptr(pe.event->d) && data->loopLevel > 0)
- || (event_type == QEvent::DeferredDelete
- && quintptr(pe.event->d) == unsigned(data->loopLevel)));
+ (pe.event->looplevel > data->loopLevel
+ || (!pe.event->looplevel && data->loopLevel > 0)
+ || (event_type == QEvent::DeferredDelete && pe.event->looplevel == data->loopLevel));
if (!allowDeferredDelete) {
// cannot send deferred delete
if (!event_type && !receiver) {
\value PaletteChange Palette of the widget changed.
\value ParentAboutToChange The widget parent is about to change.
\value ParentChange The widget parent has changed.
- \value PlatformPanel A platform specific panel has been requested.
\value Polish The widget is polished.
\value PolishRequest The widget should be polished.
\value QueryWhatsThis The widget should accept the event if it has "What's This?" help.
\value Show Widget was shown on screen (QShowEvent).
\value ShowToParent A child widget has been shown.
\value SockAct Socket activated, used to implement QSocketNotifier.
- \value StateMachineSignal A signal delivered to a state machine (QStateMachine::SignalEvent).
- \value StateMachineWrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent).
\value StatusTip A status tip is requested (QStatusTipEvent).
\value StyleChange Widget's style has been changed.
\value Timer Regular timer events (QTimerEvent).
Contructs an event object of type \a type.
*/
QEvent::QEvent(Type type)
- : d(0), t(type), posted(false), spont(false), m_accept(true)
+ : t(type), looplevel(0), posted(false), spont(false), m_accept(true)
{}
/*!
QT_BEGIN_NAMESPACE
-
-class QEventPrivate;
class Q_CORE_EXPORT QEvent // event base class
{
Q_GADGET
ActionAdded = 76,
ActionRemoved = 77,
- FileOpen = 78, // file open request
-
- Shortcut = 79, // shortcut triggered
- ShortcutOverride = 80, // shortcut override request
-
+ Shortcut = 78, // shortcut triggered
+ ShortcutOverride = 79, // shortcut override request
- WhatsThisClicked = 81,
+ WhatsThisClicked = 80,
- ToolBarChange = 82, // toolbar visibility toggled
+ ToolBarChange = 81, // toolbar visibility toggled
- ApplicationActivate = 83, // application has been changed to active
- ApplicationDeactivate = 84, // application has been changed to inactive
+ ApplicationActivate = 82, // application has been changed to active
+ ApplicationDeactivate = 83, // application has been changed to inactive
- QueryWhatsThis = 85, // query what's this widget help
- EnterWhatsThisMode = 86,
- LeaveWhatsThisMode = 87,
+ QueryWhatsThis = 84, // query what's this widget help
+ EnterWhatsThisMode = 85,
+ LeaveWhatsThisMode = 86,
- ZOrderChange = 88, // child widget has had its z-order changed
+ ZOrderChange = 87, // child widget has had its z-order changed
- HoverEnter = 89, // mouse cursor enters a hover widget
- HoverLeave = 90, // mouse cursor leaves a hover widget
- HoverMove = 91, // mouse cursor move inside a hover widget
+ HoverEnter = 88, // mouse cursor enters a hover widget
+ HoverLeave = 89, // mouse cursor leaves a hover widget
+ HoverMove = 90, // mouse cursor move inside a hover widget
- AccessibilityHelp = 92, // accessibility help text request
- AccessibilityDescription = 93, // accessibility description text request
+ AccessibilityHelp = 91, // accessibility help text request
+ AccessibilityDescription = 92, // accessibility description text request
#ifdef QT_KEYPAD_NAVIGATION
- EnterEditFocus = 94, // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
- LeaveEditFocus = 95, // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
+ EnterEditFocus = 93, // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
+ LeaveEditFocus = 94, // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION)
#endif
- AcceptDropsChange = 96,
-
- GraphicsSceneMouseMove = 97, // GraphicsView
- GraphicsSceneMousePress = 98,
- GraphicsSceneMouseRelease = 99,
- GraphicsSceneMouseDoubleClick = 100,
- GraphicsSceneContextMenu = 101,
- GraphicsSceneHoverEnter = 102,
- GraphicsSceneHoverMove = 103,
- GraphicsSceneHoverLeave = 104,
+ AcceptDropsChange = 95,
+
+ GraphicsSceneMouseMove = 94, // GraphicsView
+ GraphicsSceneMousePress = 97,
+ GraphicsSceneMouseRelease = 98,
+ GraphicsSceneMouseDoubleClick = 99,
+ GraphicsSceneContextMenu = 100,
+ GraphicsSceneHoverEnter = 101,
+ GraphicsSceneHoverMove = 102,
+ GraphicsSceneHoverLeave = 103,
+ GraphicsSceneLeave = 104, // internal
GraphicsSceneHelp = 105,
GraphicsSceneDragEnter = 106,
GraphicsSceneDragMove = 107,
GrabKeyboard = 126,
UngrabKeyboard = 127,
- StateMachineSignal = 128,
- StateMachineWrapped = 129,
-
- TouchBegin = 130,
- TouchUpdate = 131,
- TouchEnd = 132,
+ TouchBegin = 128,
+ TouchUpdate = 129,
+ TouchEnd = 130,
#ifndef QT_NO_GESTURES
- NativeGesture = 133, // Internal for platform gesture support
+ NativeGesture = 131, // Internal for platform gesture support
#endif
- RequestSoftwareInputPanel = 134,
- CloseSoftwareInputPanel = 135,
+ RequestSoftwareInputPanel = 132,
+ CloseSoftwareInputPanel = 133,
- WinIdChange = 136,
+ WinIdChange = 134,
#ifndef QT_NO_GESTURES
- Gesture = 137,
- GestureOverride = 138,
+ Gesture = 135,
+ GestureOverride = 136,
#endif
- PlatformPanel = 139,
-
User = 1000, // first user event id
MaxUser = 65535 // last user event id
};
static int registerEventType(int hint = -1);
protected:
- QEventPrivate *d;
Type t;
+ int looplevel;
private:
- bool posted : 1;
- bool spont : 1;
- bool m_accept : 1;
+ bool posted;
+ bool spont;
+ bool m_accept;
friend class QCoreApplication;
friend class QCoreApplicationPrivate;
case QEvent::Clipboard:
case QEvent::ContentsRectChange:
case QEvent::DeferredDelete:
- case QEvent::FileOpen:
case QEvent::LanguageChange:
case QEvent::MetaCall:
case QEvent::ModifiedChange:
m_formWindows.removeAt(idx);
emit formWindowRemoved(formWindow);
- if (formWindow == m_activeFormWindow)
+ if (formWindow == m_activeFormWindow) {
setActiveFormWindow(0);
if (m_formWindows.size() == 0 && m_core->widgetBox()) {
// Make sure that widget box is enabled by default
m_core->widgetBox()->setEnabled(true);
}
-
+ }
}
void FormWindowManager::setActiveFormWindow(QDesignerFormWindowInterface *w)
pos = mapToReceiver(pos, receiver);
// Send mouse event.
- QMouseEvent *mouseEvent = QMouseEvent::createExtendedMouseEvent(type, pos,
- receiver->mapToGlobal(pos.toPoint()), event->button(),
- event->buttons(), event->modifiers());
+ QMouseEvent mouseEvent = QMouseEvent(type, pos,
+ receiver->mapToGlobal(pos.toPoint()), event->button(),
+ event->buttons(), event->modifiers());
QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber;
- QApplicationPrivate::sendMouseEvent(receiver, mouseEvent, alienWidget, widget,
+ QApplicationPrivate::sendMouseEvent(receiver, &mouseEvent, alienWidget, widget,
&embeddedMouseGrabberPtr, lastWidgetUnderMouse, event->spontaneous());
embeddedMouseGrabber = embeddedMouseGrabberPtr;
#endif
}
- event->setAccepted(mouseEvent->isAccepted());
- delete mouseEvent;
+ event->setAccepted(mouseEvent.isAccepted());
}
void QGraphicsProxyWidgetPrivate::sendWidgetKeyEvent(QKeyEvent *event)
d->dispatchHoverEvent(hoverEvent);
break;
}
- case QEvent::Leave:
+ case QEvent::GraphicsSceneLeave:
// hackieshly unpacking the viewport pointer from the leave event.
- d->leaveScene(reinterpret_cast<QWidget *>(event->d));
+ d->leaveScene(static_cast<QGraphicsSceneEvent *>(event));
break;
case QEvent::GraphicsSceneHelp:
helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event));
Handles all actions necessary to clean up the scene when the mouse leaves
the view.
*/
-void QGraphicsScenePrivate::leaveScene(QWidget *viewport)
+void QGraphicsScenePrivate::leaveScene(QGraphicsSceneEvent *event)
{
#ifndef QT_NO_TOOLTIP
QToolTip::hideText();
#endif
+ QWidget *viewport = event->widget();
QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent());
// Send HoverLeave events to all existing hover items, topmost first.
QGraphicsSceneHoverEvent hoverEvent;
bool dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent);
bool itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const;
- void leaveScene(QWidget *viewport);
+ void leaveScene(QGraphicsSceneEvent *leaveEvent);
void cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest,
QGraphicsSceneDragDropEvent *source);
return QAbstractScrollArea::viewportEvent(event);
switch (event->type()) {
- case QEvent::Enter:
+ case QEvent::Enter: {
QApplication::sendEvent(d->scene, event);
break;
- case QEvent::WindowActivate:
+ }
+ case QEvent::WindowActivate: {
QApplication::sendEvent(d->scene, event);
break;
- case QEvent::WindowDeactivate:
+ }
+ case QEvent::WindowDeactivate: {
// ### This is a temporary fix for until we get proper mouse
// grab events. mouseGrabberItem should be set to 0 if we lose
// the mouse grab.
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first());
QApplication::sendEvent(d->scene, event);
break;
- case QEvent::Show:
+ }
+ case QEvent::Show: {
if (d->scene && isActiveWindow()) {
QEvent windowActivate(QEvent::WindowActivate);
QApplication::sendEvent(d->scene, &windowActivate);
}
break;
- case QEvent::Hide:
+ }
+ case QEvent::Hide: {
// spontaneous event will generate a WindowDeactivate.
if (!event->spontaneous() && d->scene && isActiveWindow()) {
QEvent windowDeactivate(QEvent::WindowDeactivate);
QApplication::sendEvent(d->scene, &windowDeactivate);
}
break;
- case QEvent::Leave:
+ }
+ case QEvent::Leave: {
// ### This is a temporary fix for until we get proper mouse grab
// events. activeMouseGrabberItem should be set to 0 if we lose the
// mouse grab.
}
d->useLastMouseEvent = false;
// a hack to pass a viewport pointer to the scene inside the leave event
- Q_ASSERT(event->d == 0);
- event->d = reinterpret_cast<QEventPrivate *>(viewport());
- QApplication::sendEvent(d->scene, event);
+ QGraphicsSceneEvent leaveEvent(QEvent::GraphicsSceneLeave);
+ leaveEvent.setWidget(viewport());
+ QApplication::sendEvent(d->scene, &leaveEvent);
break;
+ }
#ifndef QT_NO_TOOLTIP
case QEvent::ToolTip: {
QHelpEvent *toolTip = static_cast<QHelpEvent *>(event);
return true;
}
#endif
- case QEvent::Paint:
+ case QEvent::Paint: {
// Reset full update
d->fullUpdatePending = false;
d->dirtyScrollOffset = QPoint();
}
}
break;
+ }
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
ge.t = gestureEvent->t;
ge.spont = gestureEvent->spont;
ge.m_accept = wasAccepted;
- ge.d_func()->accepted = gestureEvent->d_func()->accepted;
+ ge.m_accepted = gestureEvent->m_accepted;
res = d->notify_helper(w, &ge);
gestureEvent->spont = false;
eventAccepted = ge.isAccepted();
// packed into a single QEvent depends on not consuming the event
if (eventAccepted || ge.isAccepted(g)) {
// if the gesture was accepted, mark the target widget for it
- gestureEvent->d_func()->targetWidgets[g->gestureType()] = w;
+ gestureEvent->m_targetWidgets[g->gestureType()] = w;
gestureEvent->setAccepted(g, true);
} else {
// if the gesture was explicitly ignored by the application,
qt_x11Data->xdndHandleSelectionRequest(req);
} else if (qt_clipboard) {
- QClipboardEvent e(reinterpret_cast<QEventPrivate*>(event));
+ QClipboardEvent e(event);
QApplication::sendSpontaneousEvent(qt_clipboard, &e);
}
break;
break;
if (qt_clipboard && !qt_x11Data->use_xfixes) {
- QClipboardEvent e(reinterpret_cast<QEventPrivate*>(event));
+ QClipboardEvent e(event);
QApplication::sendSpontaneousEvent(qt_clipboard, &e);
}
break;
break;
if (qt_clipboard) {
- QClipboardEvent e(reinterpret_cast<QEventPrivate*>(event));
+ QClipboardEvent e(event);
QApplication::sendSpontaneousEvent(qt_clipboard, &e);
}
break;
#include "qelapsedtimer.h"
#include "qvariant.h"
#include "qdnd_p.h"
-#include <qwidget_p.h>
+#include "qwidget_p.h"
+#include "qevent_p.h"
QT_BEGIN_NAMESPACE
return QObject::event(e);
}
- XEvent *xevent = (XEvent *)(((QClipboardEvent *)e)->data());
+ XEvent *xevent = static_cast<QClipboardEvent*>(e)->m_event;
Display *dpy = qt_x11Data->display;
if (!xevent) {
g = QCursor::pos();
}
+QMouseEvent::QMouseEvent(Type type, const QPointF &position, Qt::MouseButton button,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+ : QInputEvent(type, modifiers), p(position), b(button), mouseState(buttons)
+{
+ g = QCursor::pos();
+}
+
/*!
\internal
*/
: QInputEvent(type, modifiers), p(pos), g(globalPos), b(button), mouseState(buttons)
{}
-/*!
- \internal
-*/
-QMouseEvent *QMouseEvent::createExtendedMouseEvent(Type type, const QPointF &pos,
- const QPoint &globalPos, Qt::MouseButton button,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
-{
- return new QMouseEventEx(type, pos, globalPos, button, buttons, modifiers);
-}
+QMouseEvent::QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers)
+ : QInputEvent(type, modifiers), p(pos), g(globalPos), b(button), mouseState(buttons)
+{}
/*!
- \fn bool QMouseEvent::hasExtendedInfo() const
- \internal
+ \fn const QPoint &QMouseEvent::pos() const
+
+ Returns the position of the mouse cursor, relative to the widget
+ that received the event.
+
+ If you move the widget as a result of the mouse event, use the
+ global position returned by globalPos() to avoid a shaking
+ motion.
+
+ \sa x() y() globalPos()
*/
/*!
+ \fn const QPointF &QMouseEvent::posF() const
\since 4.4
Returns the position of the mouse cursor as a QPointF, relative to the
\sa x() y() pos() globalPos()
*/
-QPointF QMouseEvent::posF() const
-{
- return hasExtendedInfo() ? reinterpret_cast<const QMouseEventEx *>(this)->posF : QPointF(pos());
-}
-
-/*!
- \internal
-*/
-QMouseEventEx::QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos,
- Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers)
- : QMouseEvent(type, pos.toPoint(), globalPos, button, buttons, modifiers), posF(pos)
-{
- d = reinterpret_cast<QEventPrivate *>(this);
-}
/*!
- \internal
-*/
-QMouseEventEx::~QMouseEventEx()
-{
-}
-
-/*!
- \fn const QPoint &QMouseEvent::pos() const
-
- Returns the position of the mouse cursor, relative to the widget
- that received the event.
+ \fn const QPoint &QMouseEvent::globalPos() const
- If you move the widget as a result of the mouse event, use the
- global position returned by globalPos() to avoid a shaking
- motion.
+ Returns the global position of the mouse cursor \e{at the time
+ of the event}. This is important on asynchronous window systems
+ like X11. Whenever you move your widgets around in response to
+ mouse events, globalPos() may differ a lot from the current
+ pointer position QCursor::pos(), and from
+ QWidget::mapToGlobal(pos()).
- \sa x() y() globalPos()
+ \sa globalX() globalY()
*/
/*!
- \fn const QPoint &QMouseEvent::globalPos() const
+ \fn const QPointF &QMouseEvent::globalPosF() const
Returns the global position of the mouse cursor \e{at the time
of the event}. This is important on asynchronous window systems
{
}
+QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos)
+ : QEvent(type), p(pos), op(oldPos)
+{
+}
+
+
/*!
\internal
*/
g = QCursor::pos();
}
+QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
+ Qt::Orientation orient)
+ : QInputEvent(Wheel, modifiers), p(pos), d(delta), mouseState(buttons), o(orient)
+{
+ g = QCursor::pos();
+}
+
/*!
\internal
*/
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient)
{}
+QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
+ Qt::Orientation orient)
+ : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient)
+{}
+
#endif // QT_NO_WHEELEVENT
/*!
Use QDropEvent::encodedData().
*/
-/*!
- \class QFileOpenEvent
- \brief The QFileOpenEvent class provides an event that will be
- sent when there is a request to open a file or a URL.
-
- \ingroup events
-
- File open events will be sent to the QApplication::instance()
- when the operating system requests that a file or URL should be opened.
- This is a high-level event that can be caused by different user actions
- depending on the user's desktop environment; for example, double
- clicking on an file icon in the Finder on Mac OS X.
-
- This event is only used to notify the application of a request.
- It may be safely ignored.
-
- \note This class is currently supported for Mac OS X only.
-*/
-
-QFileOpenEventPrivate::~QFileOpenEventPrivate()
-{
-}
-
-/*!
- \internal
-
- Constructs a file open event for the given \a file.
-*/
-QFileOpenEvent::QFileOpenEvent(const QString &file)
- : QEvent(FileOpen), f(file)
-{
- d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(QUrl::fromLocalFile(file)));
-}
-
-/*!
- \internal
-
- Constructs a file open event for the given \a url.
-*/
-QFileOpenEvent::QFileOpenEvent(const QUrl &url)
- : QEvent(FileOpen)
-{
- d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(url));
- f = url.toLocalFile();
-}
-
-
-/*! \internal
-*/
-QFileOpenEvent::~QFileOpenEvent()
-{
- delete reinterpret_cast<QFileOpenEventPrivate *>(d);
-}
-
-/*!
- \fn QString QFileOpenEvent::file() const
-
- Returns the file that is being opened.
-*/
-
-/*!
- \fn QUrl QFileOpenEvent::url() const
-
- Returns the url that is being opened.
-
- \since 4.6
-*/
-QUrl QFileOpenEvent::url() const
-{
- return reinterpret_cast<const QFileOpenEventPrivate *>(d)->url;
-}
-
-/*!
- \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
-
- Opens a QFile on the \a file referenced by this event in the mode specified
- by \a flags. Returns true if successful; otherwise returns false.
-
- This is necessary as some files cannot be opened by name, but require specific
- information stored in this event.
- For example, if this QFileOpenEvent contains a request to open a Symbian data caged file,
- the QFile could only be opened from the Symbian RFile used in the construction of this event.
-
- \since 4.8
-*/
-bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
-{
- file.setFileName(f);
- return file.open(flags);
-}
-
#ifndef QT_NO_TOOLBAR
/*!
\internal
return "QEnterEvent";
case QEvent::Close:
return "QCloseEvent";
- case QEvent::FileOpen:
- return "QFileOpenEvent";
#ifndef QT_NO_GESTURES
case QEvent::NativeGesture:
return "QNativeGestureEvent";
case QEvent::GraphicsSceneHoverEnter:
case QEvent::GraphicsSceneHoverMove:
case QEvent::GraphicsSceneHoverLeave:
+ case QEvent::GraphicsSceneLeave:
case QEvent::GraphicsSceneHelp:
case QEvent::GraphicsSceneDragEnter:
case QEvent::GraphicsSceneDragMove:
\sa QClipboard
*/
-QClipboardEvent::QClipboardEvent(QEventPrivate *data)
- : QEvent(QEvent::Clipboard)
+QClipboardEvent::QClipboardEvent(XEvent *event)
+ : QEvent(QEvent::Clipboard), m_event(event)
{
- d = data;
}
QClipboardEvent::~QClipboardEvent()
QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s, bool isOverride)
: QEvent(WindowStateChange), ostate(s)
{
- if (isOverride)
- d = (QEventPrivate*)(this);
+ m_override = isOverride;
}
/*! \internal
*/
bool QWindowStateChangeEvent::isOverride() const
{
- return (d != 0);
+ return m_override;
}
/*! \internal
Creates new QGestureEvent containing a list of \a gestures.
*/
QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
- : QEvent(QEvent::Gesture)
+ : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(Q_NULLPTR)
{
- d = reinterpret_cast<QEventPrivate *>(new QGestureEventPrivate(gestures));
}
/*!
*/
QGestureEvent::~QGestureEvent()
{
- delete reinterpret_cast<QGestureEventPrivate *>(d);
}
/*!
*/
QList<QGesture *> QGestureEvent::gestures() const
{
- return d_func()->gestures;
+ return m_gestures;
}
/*!
*/
QGesture *QGestureEvent::gesture(Qt::GestureType type) const
{
- const QGestureEventPrivate *d = d_func();
- for(int i = 0; i < d->gestures.size(); ++i)
- if (d->gestures.at(i)->gestureType() == type)
- return d->gestures.at(i);
+ for(int i = 0; i < m_gestures.size(); ++i)
+ if (m_gestures.at(i)->gestureType() == type)
+ return m_gestures.at(i);
return 0;
}
QList<QGesture *> QGestureEvent::activeGestures() const
{
QList<QGesture *> gestures;
- foreach (QGesture *gesture, d_func()->gestures) {
+ foreach (QGesture *gesture, m_gestures) {
if (gesture->state() != Qt::GestureCanceled)
gestures.append(gesture);
}
QList<QGesture *> QGestureEvent::canceledGestures() const
{
QList<QGesture *> gestures;
- foreach (QGesture *gesture, d_func()->gestures) {
+ foreach (QGesture *gesture, m_gestures) {
if (gesture->state() == Qt::GestureCanceled)
gestures.append(gesture);
}
void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
{
setAccepted(false);
- d_func()->accepted[gestureType] = value;
+ m_accepted[gestureType] = value;
}
/*!
*/
bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
{
- return d_func()->accepted.value(gestureType, true);
+ return m_accepted.value(gestureType, true);
}
/*!
*/
void QGestureEvent::setWidget(QWidget *widget)
{
- d_func()->widget = widget;
+ m_widget = widget;
}
/*!
*/
QWidget *QGestureEvent::widget() const
{
- return d_func()->widget;
+ return m_widget;
}
#ifndef QT_NO_GRAPHICSVIEW
}
#endif //QT_NO_GRAPHICSVIEW
-/*!
- \internal
-*/
-QGestureEventPrivate *QGestureEvent::d_func()
-{
- return reinterpret_cast<QGestureEventPrivate *>(d);
-}
-
-/*!
- \internal
-*/
-const QGestureEventPrivate *QGestureEvent::d_func() const
-{
- return reinterpret_cast<const QGestureEventPrivate *>(d);
-}
-
#ifdef Q_NO_USING_KEYWORD
/*!
\fn void QGestureEvent::setAccepted(bool accepted)
#include <QtCore/qvariant.h>
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
-#include <QtCore/qfile.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qmimedata.h>
#include <QtGui/qkeysequence.h>
QT_BEGIN_NAMESPACE
-
-class QAction;
-#ifndef QT_NO_GESTURES
-class QGesture;
-#endif
-
class Q_GUI_EXPORT QInputEvent : public QEvent
{
public:
public:
QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
+ QMouseEvent(Type type, const QPointF &pos, Qt::MouseButton button,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers);
+ QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers);
~QMouseEvent();
- inline const QPoint &pos() const { return p; }
- inline const QPoint &globalPos() const { return g; }
- inline int x() const { return p.x(); }
- inline int y() const { return p.y(); }
- inline int globalX() const { return g.x(); }
- inline int globalY() const { return g.y(); }
+ inline const QPoint pos() const { return p.toPoint(); }
+ inline const QPointF &posF() const { return p; }
+ inline const QPoint globalPos() const { return g.toPoint(); }
+ inline const QPointF &globalPoFs() const { return g; }
+ inline int x() const { return qRound(p.x()); }
+ inline int y() const { return qRound(p.y()); }
+ inline int globalX() const { return qRound(g.x()); }
+ inline int globalY() const { return qRound(g.y()); }
inline Qt::MouseButton button() const { return b; }
inline Qt::MouseButtons buttons() const { return mouseState; }
- static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos,
- const QPoint &globalPos, Qt::MouseButton button,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
- inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; }
- QPointF posF() const;
-
protected:
- QPoint p, g;
+ QPointF p, g;
Qt::MouseButton b;
Qt::MouseButtons mouseState;
};
{
public:
QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
+ QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos);
~QHoverEvent();
- inline const QPoint &pos() const { return p; }
- inline const QPoint &oldPos() const { return op; }
+ inline const QPoint pos() const { return p.toPoint(); }
+ inline const QPointF &posF() const { return p; }
+ inline const QPoint oldPos() const { return op.toPoint(); }
+ inline const QPointF &oldPosF() const { return op; }
protected:
- QPoint p, op;
+ QPointF p, op;
};
#ifndef QT_NO_WHEELEVENT
QWheelEvent(const QPoint &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient = Qt::Vertical);
+ QWheelEvent(const QPointF &pos, int delta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
+ Qt::Orientation orient = Qt::Vertical);
QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient = Qt::Vertical);
+ QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
+ Qt::Orientation orient = Qt::Vertical);
~QWheelEvent();
inline int delta() const { return d; }
- inline const QPoint &pos() const { return p; }
- inline const QPoint &globalPos() const { return g; }
- inline int x() const { return p.x(); }
- inline int y() const { return p.y(); }
- inline int globalX() const { return g.x(); }
- inline int globalY() const { return g.y(); }
+ inline const QPoint pos() const { return p.toPoint(); }
+ inline const QPointF &posF() const { return p; }
+ inline const QPoint globalPos() const { return g.toPoint(); }
+ inline const QPointF &globalPosF() const { return g; }
+ inline int x() const { return qRound(p.x()); }
+ inline int y() const { return qRound(p.y()); }
+ inline int globalX() const { return qRound(g.x()); }
+ inline int globalY() const { return qRound(g.y()); }
inline Qt::MouseButtons buttons() const { return mouseState; }
Qt::Orientation orientation() const { return o; }
protected:
- QPoint p;
- QPoint g;
+ QPointF p, g;
int d;
Qt::MouseButtons mouseState;
Qt::Orientation o;
#endif
#ifndef QT_NO_ACTION
+
+class QAction;
+
class Q_GUI_EXPORT QActionEvent : public QEvent
{
QAction *act, *bef;
};
#endif
-class Q_GUI_EXPORT QFileOpenEvent : public QEvent
-{
-public:
- QFileOpenEvent(const QString &file);
- QFileOpenEvent(const QUrl &url);
- ~QFileOpenEvent();
-
- inline QString file() const { return f; }
- QUrl url() const;
- bool openFile(QFile &file, QIODevice::OpenMode flags) const;
-private:
- QString f;
-};
-
#ifndef QT_NO_TOOLBAR
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
{
};
#endif
-#ifndef QT_NO_CLIPBOARD
-class Q_GUI_EXPORT QClipboardEvent : public QEvent
-{
-public:
- QClipboardEvent(QEventPrivate *data);
- ~QClipboardEvent();
-
- QEventPrivate *data() { return d; }
-};
-#endif
-
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
public:
bool isOverride() const;
private:
+ bool m_override;
Qt::WindowStates ostate;
};
};
#ifndef QT_NO_GESTURES
+
class QGesture;
class QGestureEventPrivate;
+
class Q_GUI_EXPORT QGestureEvent : public QEvent
{
public:
#endif
private:
- QGestureEventPrivate *d_func();
- const QGestureEventPrivate *d_func() const;
+ QList<QGesture *> m_gestures;
+ QWidget *m_widget;
+ QMap<Qt::GestureType, bool> m_accepted;
+ QMap<Qt::GestureType, QWidget *> m_targetWidgets;
friend class QApplication;
friend class QGestureManager;
#include <QtCore/qurl.h>
#include <QtGui/qevent.h>
+#include <QtGui/qt_x11_p.h>
QT_BEGIN_NAMESPACE
// We mean it.
//
-// ### Qt 5: remove
-class QMouseEventEx : public QMouseEvent
-{
-public:
- QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos,
- Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers);
- ~QMouseEventEx();
-
-protected:
- QPointF posF;
- friend class QMouseEvent;
-};
-
class QTouchEventTouchPointPrivate
{
public:
QPoint position;
float angle;
};
-
-class QGestureEventPrivate
-{
-public:
- inline QGestureEventPrivate(const QList<QGesture *> &list)
- : gestures(list), widget(0)
- {
- }
-
- QList<QGesture *> gestures;
- QWidget *widget;
- QMap<Qt::GestureType, bool> accepted;
- QMap<Qt::GestureType, QWidget *> targetWidgets;
-};
#endif // QT_NO_GESTURES
-class QFileOpenEventPrivate
+
+#ifndef QT_NO_CLIPBOARD
+class Q_GUI_EXPORT QClipboardEvent : public QEvent
{
public:
- inline QFileOpenEventPrivate(const QUrl &url)
- : url(url)
- {
- }
- ~QFileOpenEventPrivate();
+ QClipboardEvent(XEvent *event);
+ ~QClipboardEvent();
- QUrl url;
+ XEvent* m_event;
};
+#endif
QT_END_NAMESPACE
bool eventAccepted = event.isAccepted();
foreach(QGesture *gesture, event.gestures()) {
if (eventAccepted || event.isAccepted(gesture)) {
- QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
DEBUG() << "override event: gesture was accepted:" << gesture << w;
QList<QGesture *> &gestures = normalStartedGestures[w];
foreach (QGesture *gesture, event.gestures()) {
if (gesture->state() == Qt::GestureStarted &&
(eventAccepted || event.isAccepted(gesture))) {
- QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
DEBUG() << "started gesture was delivered and accepted by" << w;
m_gestureTargets[gesture] = w;
{ "QStatusTipEvent", "QtGui/qevent.h"},
{ "QWhatsThisClickedEvent", "QtGui/qevent.h"},
{ "QActionEvent", "QtGui/qevent.h"},
- { "QFileOpenEvent", "QtGui/qevent.h"},
{ "QToolBarChangeEvent", "QtGui/qevent.h"},
{ "QShortcutEvent", "QtGui/qevent.h"},
- { "QClipboardEvent", "QtGui/qevent.h"},
{ "QWindowStateChangeEvent", "QtGui/qevent.h"},
{ "QTouchEvent", "QtGui/qevent.h"},
{ "TouchPoint", "QtGui/qevent.h"},
{ "QFormBuilder", "QtUiTools/formbuilder.h"},
{ "QUiLoader", "QtUiTools/quiloader.h"},
};
-static const int qclass_lib_count = 690;
+static const int qclass_lib_count = 688;
#endif
bool QDesigner::event(QEvent *ev)
{
switch (ev->type()) {
- case QEvent::FileOpen:
- // Set it true first since, if it's a Qt 3 form, the messagebox from convert will fire the timer.
- m_suppressNewFormShow = true;
- if (!m_workbench->readInForm(static_cast<QFileOpenEvent *>(ev)->file()))
- m_suppressNewFormShow = false;
- return true;
case QEvent::Close: {
bool eaten = true;
QCloseEvent *closeEvent = static_cast<QCloseEvent *>(ev);