summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri7
-rw-r--r--src/gui/kernel/qclipboard.cpp12
-rw-r--r--src/gui/kernel/qcursor.cpp144
-rw-r--r--src/gui/kernel/qcursor.h4
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp40
-rw-r--r--src/gui/kernel/qdnd.cpp402
-rw-r--r--src/gui/kernel/qdnd_p.h87
-rw-r--r--src/gui/kernel/qdrag.cpp99
-rw-r--r--src/gui/kernel/qdrag.h5
-rw-r--r--src/gui/kernel/qevent.cpp79
-rw-r--r--src/gui/kernel/qevent.h58
-rw-r--r--src/gui/kernel/qguiapplication.cpp168
-rw-r--r--src/gui/kernel/qguiapplication_p.h6
-rw-r--r--src/gui/kernel/qkeysequence.cpp150
-rw-r--r--src/gui/kernel/qkeysequence.h3
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qpalette.cpp13
-rw-r--r--src/gui/kernel/qpalette.h4
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp15
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h10
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.cpp187
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h49
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h13
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.cpp83
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.h87
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h43
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp9
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h6
31 files changed, 990 insertions, 819 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 9c5f3b10da..06773f58b5 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -56,7 +56,8 @@ HEADERS += \
kernel/qtouchdevice_p.h \
kernel/qplatformsharedgraphicscache_qpa.h \
kernel/qplatformdialoghelper_qpa.h \
- kernel/qplatformservices_qpa.h
+ kernel/qplatformservices_qpa.h \
+ kernel/qplatformscreenpageflipper_qpa.h
SOURCES += \
kernel/qclipboard_qpa.cpp \
@@ -66,6 +67,7 @@ SOURCES += \
kernel/qwindowsysteminterface_qpa.cpp \
kernel/qplatforminputcontext_qpa.cpp \
kernel/qplatformintegration_qpa.cpp \
+ kernel/qplatformdrag_qpa.cpp \
kernel/qplatformscreen_qpa.cpp \
kernel/qplatformintegrationfactory_qpa.cpp \
kernel/qplatformintegrationplugin_qpa.cpp \
@@ -99,7 +101,8 @@ SOURCES += \
kernel/qtouchdevice.cpp \
kernel/qplatformsharedgraphicscache_qpa.cpp \
kernel/qplatformdialoghelper_qpa.cpp \
- kernel/qplatformservices_qpa.cpp
+ kernel/qplatformservices_qpa.cpp \
+ kernel/qplatformscreenpageflipper_qpa.cpp
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, egl) {
HEADERS += \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 8e881aabc7..27179cf141 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -86,18 +86,18 @@ QT_BEGIN_NAMESPACE
\list
- \i The X11 Window System has the concept of a separate selection
+ \li The X11 Window System has the concept of a separate selection
and clipboard. When text is selected, it is immediately available
as the global mouse selection. The global mouse selection may
later be copied to the clipboard. By convention, the middle mouse
button is used to paste the global mouse selection.
- \i X11 also has the concept of ownership; if you change the
+ \li X11 also has the concept of ownership; if you change the
selection within a window, X11 will only notify the owner and the
previous owner of the change, i.e. it will not notify all
applications that the selection or clipboard data changed.
- \i Lastly, the X11 clipboard is event driven, i.e. the clipboard
+ \li Lastly, the X11 clipboard is event driven, i.e. the clipboard
will not function properly if the event loop is not running.
Similarly, it is recommended that the contents of the clipboard
are stored or retrieved in direct response to user-input events,
@@ -105,7 +105,7 @@ QT_BEGIN_NAMESPACE
store or retrieve the clipboard contents in response to timer or
non-user-input events.
- \i Since there is no standard way to copy and paste files between
+ \li Since there is no standard way to copy and paste files between
applications on X11, various MIME types and conventions are currently
in use. For instance, Nautilus expects files to be supplied with a
\c{x-special/gnome-copied-files} MIME type with data beginning with
@@ -123,12 +123,12 @@ QT_BEGIN_NAMESPACE
\list
- \i Windows and Mac OS X do not support the global mouse
+ \li Windows and Mac OS X do not support the global mouse
selection; they only supports the global clipboard, i.e. they
only add text to the clipboard when an explicit copy or cut is
made.
- \i Windows and Mac OS X does not have the concept of ownership;
+ \li Windows and Mac OS X does not have the concept of ownership;
the clipboard is a fully global resource so all applications are
notified of changes.
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 77eb1e1e9c..95b2b4a28e 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
To set or get the position of the mouse cursor use the static
methods QCursor::pos() and QCursor::setPos().
- \bold{Note:} It is possible to create a QCursor before
+ \b{Note:} It is possible to create a QCursor before
QGuiApplication, but it is not useful except as a place-holder for a
real QCursor created after QGuiApplication. Attempting to use a
QCursor that was created before QGuiApplication will result in a
@@ -104,50 +104,50 @@ QT_BEGIN_NAMESPACE
theme, while others will use an internal bitmap cursor.
\table
- \header \o Shape \o Qt::CursorShape Value \o Cursor Name
- \o Shape \o Qt::CursorShape Value \o Cursor Name
- \row \o \inlineimage cursor-arrow.png
- \o Qt::ArrowCursor \o \c left_ptr
- \o \inlineimage cursor-sizev.png
- \o Qt::SizeVerCursor \o \c size_ver
- \row \o \inlineimage cursor-uparrow.png
- \o Qt::UpArrowCursor \o \c up_arrow
- \o \inlineimage cursor-sizeh.png
- \o Qt::SizeHorCursor \o \c size_hor
- \row \o \inlineimage cursor-cross.png
- \o Qt::CrossCursor \o \c cross
- \o \inlineimage cursor-sizeb.png
- \o Qt::SizeBDiagCursor \o \c size_bdiag
- \row \o \inlineimage cursor-ibeam.png
- \o Qt::IBeamCursor \o \c ibeam
- \o \inlineimage cursor-sizef.png
- \o Qt::SizeFDiagCursor \o \c size_fdiag
- \row \o \inlineimage cursor-wait.png
- \o Qt::WaitCursor \o \c wait
- \o \inlineimage cursor-sizeall.png
- \o Qt::SizeAllCursor \o \c size_all
- \row \o \inlineimage cursor-busy.png
- \o Qt::BusyCursor \o \c left_ptr_watch
- \o \inlineimage cursor-vsplit.png
- \o Qt::SplitVCursor \o \c split_v
- \row \o \inlineimage cursor-forbidden.png
- \o Qt::ForbiddenCursor \o \c forbidden
- \o \inlineimage cursor-hsplit.png
- \o Qt::SplitHCursor \o \c split_h
- \row \o \inlineimage cursor-hand.png
- \o Qt::PointingHandCursor \o \c pointing_hand
- \o \inlineimage cursor-openhand.png
- \o Qt::OpenHandCursor \o \c openhand
- \row \o \inlineimage cursor-whatsthis.png
- \o Qt::WhatsThisCursor \o \c whats_this
- \o \inlineimage cursor-closedhand.png
- \o Qt::ClosedHandCursor \o \c closedhand
- \row \o
- \o Qt::DragMoveCursor \o \c dnd-move or \c move
- \o
- \o Qt::DragCopyCursor \o \c dnd-copy or \c copy
- \row \o
- \o Qt::DragLinkCursor \o \c dnd-link or \c link
+ \header \li Shape \li Qt::CursorShape Value \li Cursor Name
+ \li Shape \li Qt::CursorShape Value \li Cursor Name
+ \row \li \inlineimage cursor-arrow.png
+ \li Qt::ArrowCursor \li \c left_ptr
+ \li \inlineimage cursor-sizev.png
+ \li Qt::SizeVerCursor \li \c size_ver
+ \row \li \inlineimage cursor-uparrow.png
+ \li Qt::UpArrowCursor \li \c up_arrow
+ \li \inlineimage cursor-sizeh.png
+ \li Qt::SizeHorCursor \li \c size_hor
+ \row \li \inlineimage cursor-cross.png
+ \li Qt::CrossCursor \li \c cross
+ \li \inlineimage cursor-sizeb.png
+ \li Qt::SizeBDiagCursor \li \c size_bdiag
+ \row \li \inlineimage cursor-ibeam.png
+ \li Qt::IBeamCursor \li \c ibeam
+ \li \inlineimage cursor-sizef.png
+ \li Qt::SizeFDiagCursor \li \c size_fdiag
+ \row \li \inlineimage cursor-wait.png
+ \li Qt::WaitCursor \li \c wait
+ \li \inlineimage cursor-sizeall.png
+ \li Qt::SizeAllCursor \li \c size_all
+ \row \li \inlineimage cursor-busy.png
+ \li Qt::BusyCursor \li \c left_ptr_watch
+ \li \inlineimage cursor-vsplit.png
+ \li Qt::SplitVCursor \li \c split_v
+ \row \li \inlineimage cursor-forbidden.png
+ \li Qt::ForbiddenCursor \li \c forbidden
+ \li \inlineimage cursor-hsplit.png
+ \li Qt::SplitHCursor \li \c split_h
+ \row \li \inlineimage cursor-hand.png
+ \li Qt::PointingHandCursor \li \c pointing_hand
+ \li \inlineimage cursor-openhand.png
+ \li Qt::OpenHandCursor \li \c openhand
+ \row \li \inlineimage cursor-whatsthis.png
+ \li Qt::WhatsThisCursor \li \c whats_this
+ \li \inlineimage cursor-closedhand.png
+ \li Qt::ClosedHandCursor \li \c closedhand
+ \row \li
+ \li Qt::DragMoveCursor \li \c dnd-move or \c move
+ \li
+ \li Qt::DragCopyCursor \li \c dnd-copy or \c copy
+ \row \li
+ \li Qt::DragLinkCursor \li \c dnd-link or \c link
\endtable
\sa QWidget, {fowler}{GUI Design Handbook: Cursors}
@@ -185,10 +185,10 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QPoint QCursor::pos()
+ \fn QPoint QCursor::pos(const QScreen *screen)
- Returns the position of the cursor (hot spot) in global screen
- coordinates.
+ Returns the position of the cursor (hot spot) of the \a screen
+ in global screen coordinates.
You can call QWidget::mapFromGlobal() to translate it to widget
coordinates.
@@ -197,10 +197,23 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QCursor::setPos(int x, int y)
+ \fn QPoint QCursor::pos()
+
+ Returns the position of the cursor (hot spot) of
+ the primary screen in global screen coordinates.
+
+ You can call QWidget::mapFromGlobal() to translate it to widget
+ coordinates.
+
+ \sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
+*/
- Moves the cursor (hot spot) to the global screen position (\a x,
- \a y).
+
+/*!
+ \fn void QCursor::setPos(QScreen *screen, int x, int y)
+
+ Moves the cursor (hot spot) of the \a screen to the global
+ screen position (\a x, \a y).
You can call QWidget::mapToGlobal() to translate widget
coordinates to global screen coordinates.
@@ -209,6 +222,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn void QCursor::setPos(int x, int y)
+
+ Moves the cursor (hot spot) of the primary screen
+ to the global screen position (\a x, \a y).
+
+ You can call QWidget::mapToGlobal() to translate widget
+ coordinates to global screen coordinates.
+
+ \sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
+*/
+
+/*!
\fn void QCursor::setPos (const QPoint &p)
\overload
@@ -217,6 +242,15 @@ QT_BEGIN_NAMESPACE
\a p.
*/
+/*!
+ \fn void QCursor::setPos (QScreen *screen,const QPoint &p)
+
+ \overload
+
+ Moves the cursor (hot spot) to the global screen position of the
+ \a screen at point \a p.
+*/
+
/*****************************************************************************
QCursor stream functions
*****************************************************************************/
@@ -346,10 +380,10 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
The cursor \a bitmap (B) and \a mask (M) bits are combined like this:
\list
- \o B=1 and M=1 gives black.
- \o B=0 and M=1 gives white.
- \o B=0 and M=0 gives transparent.
- \o B=1 and M=0 gives an XOR'd result under Windows, undefined
+ \li B=1 and M=1 gives black.
+ \li B=0 and M=1 gives white.
+ \li B=0 and M=0 gives transparent.
+ \li B=1 and M=0 gives an XOR'd result under Windows, undefined
results on all other platforms.
\endlist
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 00b709b308..4820bcee9b 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
class QVariant;
+class QScreen;
/*
### The fake cursor has to go first with old qdoc.
@@ -101,8 +102,11 @@ public:
QPoint hotSpot() const;
static QPoint pos();
+ static QPoint pos(const QScreen *screen);
static void setPos(int x, int y);
+ static void setPos(QScreen *screen, int x, int y);
inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
+ inline static void setPos(QScreen *screen, const QPoint &p) { setPos(screen, p.x(), p.y()); }
#ifdef qdoc
HCURSOR_or_HANDLE handle() const;
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 7ba2e1c580..1c719c839e 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qcursor.h>
+#include <qscreen.h>
#include <private/qcursor_p.h>
#include <qplatformcursor_qpa.h>
#include <private/qguiapplication_p.h>
@@ -110,27 +111,34 @@ void QCursorData::update()
QPoint QCursor::pos()
{
+ return QCursor::pos(QGuiApplication::primaryScreen());
+}
+
+QPoint QCursor::pos(const QScreen *screen)
+{
+ if (screen)
+ if (const QPlatformCursor *cursor = screen->handle()->cursor())
+ return cursor->pos();
return QGuiApplicationPrivate::lastCursorPosition.toPoint();
}
-void QCursor::setPos(int x, int y)
+void QCursor::setPos(QScreen *screen, int x, int y)
{
- QPoint target(x, y);
-
- // Need to check, since some X servers generate null mouse move
- // events, causing looping in applications which call setPos() on
- // every mouse move event.
- //
- if (pos() == target)
- return;
-
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- int cursorCount = cursors.count();
- for (int i = 0; i < cursorCount; ++i) {
- const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
- if (cursor)
- cursor.data()->setPos(target);
+ if (screen) {
+ if (QPlatformCursor *cursor = screen->handle()->cursor()) {
+ const QPoint pos = QPoint(x, y);
+ // Need to check, since some X servers generate null mouse move
+ // events, causing looping in applications which call setPos() on
+ // every mouse move event.
+ if (pos != cursor->pos())
+ cursor->setPos(pos);
+ }
}
}
+void QCursor::setPos(int x, int y)
+{
+ QCursor::setPos(QGuiApplication::primaryScreen(), x, y);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 2fb250cf18..1ed4a96192 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -125,417 +125,79 @@ QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies)
#endif
// the universe's only drag manager
-QDragManager *QDragManager::instance = 0;
+QDragManager *QDragManager::m_instance = 0;
QDragManager::QDragManager()
- : QObject(qApp)
+ : QObject(qApp), m_platformDropData(0), m_currentDropTarget(0),
+ m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()),
+ m_object(0)
{
- Q_ASSERT(!instance);
+ Q_ASSERT(!m_instance);
- object = 0;
- beingCancelled = false;
- restoreCursor = false;
- willDrop = false;
- eventLoop = 0;
- currentDropTarget = 0;
- shapedPixmapWindow = 0;
-
- possible_actions = Qt::IgnoreAction;
-
- QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
- platformDrag = pi->drag();
-
- platformDropData = 0;
- if (platformDrag)
- platformDropData = platformDrag->platformDropData();
+ if (m_platformDrag)
+ m_platformDropData = m_platformDrag->platformDropData();
}
QDragManager::~QDragManager()
{
-#ifndef QT_NO_CURSOR
- if (restoreCursor)
- QGuiApplication::restoreOverrideCursor();
-#endif
- instance = 0;
+ m_instance = 0;
}
QDragManager *QDragManager::self()
{
- if (!instance && !QGuiApplication::closingDown())
- instance = new QDragManager;
- return instance;
+ if (!m_instance && !QGuiApplication::closingDown())
+ m_instance = new QDragManager;
+ return m_instance;
}
-QPixmap QDragManager::dragCursor(Qt::DropAction action) const
+QObject *QDragManager::source() const
{
- typedef QMap<Qt::DropAction, QPixmap>::const_iterator Iterator;
-
- if (const QDragPrivate *d = dragPrivate()) {
- const Iterator it = d->customCursors.constFind(action);
- if (it != d->customCursors.constEnd())
- return it.value();
- }
-
- Qt::CursorShape shape = Qt::ForbiddenCursor;
- switch (action) {
- case Qt::MoveAction:
- shape = Qt::DragMoveCursor;
- break;
- case Qt::CopyAction:
- shape = Qt::DragCopyCursor;
- break;
- case Qt::LinkAction:
- shape = Qt::DragLinkCursor;
- break;
- default:
- shape = Qt::ForbiddenCursor;
- }
- return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
-}
-
-Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
- Qt::KeyboardModifiers modifiers) const
-{
-#ifdef QDND_DEBUG
- qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
- qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
-#endif
-
- QDragPrivate *d = dragPrivate();
- Qt::DropAction defaultAction = d ? d->defaultDropAction : Qt::IgnoreAction;
-
- if (defaultAction == Qt::IgnoreAction) {
- //This means that the drag was initiated by QDrag::start and we need to
- //preserve the old behavior
- defaultAction = Qt::CopyAction;
- }
-
- if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
- defaultAction = Qt::LinkAction;
- else if (modifiers & Qt::ControlModifier)
- defaultAction = Qt::CopyAction;
- else if (modifiers & Qt::ShiftModifier)
- defaultAction = Qt::MoveAction;
- else if (modifiers & Qt::AltModifier)
- defaultAction = Qt::LinkAction;
-
-#ifdef QDND_DEBUG
- qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
-#endif
-
- // Check if the action determined is allowed
- if (!(possibleActions & defaultAction)) {
- if (possibleActions & Qt::CopyAction)
- defaultAction = Qt::CopyAction;
- else if (possibleActions & Qt::MoveAction)
- defaultAction = Qt::MoveAction;
- else if (possibleActions & Qt::LinkAction)
- defaultAction = Qt::LinkAction;
- else
- defaultAction = Qt::IgnoreAction;
- }
-
-#ifdef QDND_DEBUG
- qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
-#endif
-
- return defaultAction;
+ if (m_object)
+ return m_object->source();
+ return 0;
}
void QDragManager::setCurrentTarget(QObject *target, bool dropped)
{
- if (currentDropTarget == target)
+ if (m_currentDropTarget == target)
return;
- currentDropTarget = target;
- if (!dropped && object) {
- object->d_func()->target = target;
- emit object->targetChanged(target);
+ m_currentDropTarget = target;
+ if (!dropped && m_object) {
+ m_object->d_func()->target = target;
+ emit m_object->targetChanged(target);
}
-
}
-QObject *QDragManager::currentTarget()
+QObject *QDragManager::currentTarget() const
{
- return currentDropTarget;
-}
-
-
-static const int default_pm_hotx = -2;
-static const int default_pm_hoty = -16;
-static const char *const default_pm[] = {
-"13 9 3 1",
-". c None",
-" c #000000",
-"X c #FFFFFF",
-"X X X X X X X",
-" X X X X X X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X X X X X X ",
-"X X X X X X X",
-};
-
-
-QShapedPixmapWindow::QShapedPixmapWindow()
- : QWindow()
-{
- setSurfaceType(RasterSurface);
- setWindowFlags(Qt::Tool | Qt::FramelessWindowHint |
- Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
- create();
- backingStore = new QBackingStore(this);
-}
-
-void QShapedPixmapWindow::render()
-{
- QRect rect(QPoint(), geometry().size());
- backingStore->resize(rect.size());
-
- backingStore->beginPaint(rect);
-
- QPaintDevice *device = backingStore->paintDevice();
-
- {
- QPainter p(device);
- p.drawPixmap(0, 0, pixmap);
- }
-
- backingStore->endPaint();
- backingStore->flush(rect);
-}
-
-
-
-
-static Qt::KeyboardModifiers oldstate;
-
-void QDragManager::updatePixmap()
-{
- if (shapedPixmapWindow) {
- shapedPixmapWindow->pixmap = QPixmap();
- shapedPixmapWindow->hotSpot = QPoint(default_pm_hotx,default_pm_hoty);
- if (object) {
- shapedPixmapWindow->pixmap = object->pixmap();
- if (!shapedPixmapWindow->pixmap.isNull())
- shapedPixmapWindow->hotSpot = object->hotSpot();
- }
- if (shapedPixmapWindow->pixmap.isNull())
- shapedPixmapWindow->pixmap = QPixmap(default_pm);
- shapedPixmapWindow->setGeometry(QRect(QCursor::pos() - shapedPixmapWindow->hotSpot, shapedPixmapWindow->pixmap.size()));
- shapedPixmapWindow->show();
- shapedPixmapWindow->render();
- }
-}
-
-void QDragManager::updateCursor()
-{
- if (shapedPixmapWindow) {
- shapedPixmapWindow->render(); // ### Hack
- shapedPixmapWindow->move(QCursor::pos() - shapedPixmapWindow->hotSpot);
- }
-
- Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
- if (willDrop) {
- if (global_accepted_action == Qt::CopyAction) {
- cursorShape = Qt::DragCopyCursor;
- } else if (global_accepted_action == Qt::LinkAction) {
- cursorShape = Qt::DragLinkCursor;
- } else {
- cursorShape = Qt::DragMoveCursor;
- }
- }
- QCursor *cursor = qApp->overrideCursor();
- if (cursor && cursorShape != cursor->shape())
- qApp->changeOverrideCursor(QCursor(cursorShape));
-}
-
-
-bool QDragManager::eventFilter(QObject *o, QEvent *e)
-{
- if (beingCancelled) {
- if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
- qApp->removeEventFilter(this);
- Q_ASSERT(object == 0);
- beingCancelled = false;
- eventLoop->exit();
- return true; // block the key release
- }
- return false;
- }
-
- Q_ASSERT(object != 0);
-
- if (!qobject_cast<QWindow *>(o))
- return false;
-
- switch(e->type()) {
- case QEvent::ShortcutOverride:
- // prevent accelerators from firing while dragging
- e->accept();
- return true;
-
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- {
- QKeyEvent *ke = static_cast<QKeyEvent *>(e);
- if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
- cancel();
- qApp->removeEventFilter(this);
- beingCancelled = false;
- eventLoop->exit();
- } else {
- // ### x11 forces move!
- updateCursor();
- }
- return true; // Eat all key events
- }
-
- case QEvent::MouseMove:
- move(static_cast<QMouseEvent *>(e));
- return true; // Eat all mouse events
-
- case QEvent::MouseButtonRelease:
- qApp->removeEventFilter(this);
- if (willDrop)
- drop(static_cast<QMouseEvent *>(e));
- else
- cancel();
- beingCancelled = false;
- eventLoop->exit();
- return true; // Eat all mouse events
-
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonDblClick:
- case QEvent::Wheel:
- return true;
- default:
- break;
- }
- return false;
+ return m_currentDropTarget;
}
Qt::DropAction QDragManager::drag(QDrag *o)
{
- if (!o || object == o)
+ if (!o || m_object == o)
return Qt::IgnoreAction;
- if (!platformDrag || !o->source()) {
+ if (!m_platformDrag || !o->source()) {
o->deleteLater();
return Qt::IgnoreAction;
}
- if (object) {
- cancel();
- qApp->removeEventFilter(this);
- beingCancelled = false;
- }
-
- object = o;
- if (!shapedPixmapWindow)
- shapedPixmapWindow = new QShapedPixmapWindow();
- oldstate = Qt::NoModifier; // #### Should use state that caused the drag
-// drag_mode = mode;
-
- possible_actions = dragPrivate()->possible_actions;
-
- willDrop = false;
- object->d_func()->target = 0;
- qApp->installEventFilter(this);
-
- global_accepted_action = Qt::CopyAction;
-#ifndef QT_NO_CURSOR
- qApp->setOverrideCursor(Qt::DragCopyCursor);
- restoreCursor = true;
- updateCursor();
-#endif
- updatePixmap();
-
- platformDrag->startDrag();
-
- eventLoop = new QEventLoop;
- (void) eventLoop->exec();
- delete eventLoop;
- eventLoop = 0;
-
- delete shapedPixmapWindow;
- shapedPixmapWindow = 0;
-
- return global_accepted_action;
-}
-
-void QDragManager::move(const QMouseEvent *me)
-{
- if (!platformDrag)
- return;
-
- platformDrag->move(me);
-}
-
-void QDragManager::drop(const QMouseEvent *me)
-{
- if (!platformDrag)
- return;
-
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QGuiApplication::restoreOverrideCursor();
- restoreCursor = false;
- }
-#endif
- willDrop = false;
-
- platformDrag->drop(me);
-
- if (object)
- object->deleteLater();
- object = 0;
-}
-
-void QDragManager::cancel(bool deleteSource)
-{
- if (!platformDrag)
- return;
-
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QGuiApplication::restoreOverrideCursor();
- restoreCursor = false;
+ if (m_object) {
+ qWarning("QDragManager::drag in possibly invalid state");
+ return Qt::IgnoreAction;
}
-#endif
-
- beingCancelled = true;
- platformDrag->cancel();
+ m_object = o;
- if (object && deleteSource)
- object->deleteLater();
- object = 0;
+ m_object->d_func()->target = 0;
- global_accepted_action = Qt::IgnoreAction;
-}
-
-/*!
- Called from startDrag() in QPlatformDrag implementations that do not need
- the desktop-oriented stuff provided by the event filter (e.g. because their
- drag is not based on mouse events). Instead, they will manage everything on
- their own, will not rely on move/drop/cancel, and will call stopDrag() to stop
- the event loop when the drag is over.
- */
-void QDragManager::unmanageEvents()
-{
- qApp->removeEventFilter(this);
-}
-
-void QDragManager::stopDrag()
-{
- if (eventLoop)
- eventLoop->exit();
+ const Qt::DropAction result = m_platformDrag->drag(m_object);
+ m_object = 0;
+ return result;
}
#endif // QT_NO_DRAGANDDROP
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 857be34d10..764b73c06f 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -98,100 +98,45 @@ protected:
class QDragPrivate : public QObjectPrivate
{
public:
+ QDragPrivate()
+ : source(0)
+ , target(0)
+ , data(0)
+ { }
QObject *source;
QObject *target;
QMimeData *data;
QPixmap pixmap;
QPoint hotspot;
- Qt::DropActions possible_actions;
Qt::DropAction executed_action;
+ Qt::DropActions supported_actions;
+ Qt::DropAction default_action;
QMap<Qt::DropAction, QPixmap> customCursors;
- Qt::DropAction defaultDropAction;
};
-class QShapedPixmapWindow : public QWindow
-{
-public:
- QShapedPixmapWindow();
-
- void exposeEvent(QExposeEvent *)
- {
- render();
- }
-
- void render();
-
- QBackingStore *backingStore;
- QPixmap pixmap;
- QPoint hotSpot;
-};
-
-
class Q_GUI_EXPORT QDragManager : public QObject {
Q_OBJECT
- // only friend classes can use QDragManager.
- friend class QDrag;
- friend class QDragMoveEvent;
- friend class QDropEvent;
- friend class QApplication;
-
- bool eventFilter(QObject *, QEvent *);
-
public:
QDragManager();
~QDragManager();
static QDragManager *self();
- virtual Qt::DropAction drag(QDrag *);
-
- virtual void cancel(bool deleteSource = true);
- virtual void move(const QMouseEvent *me);
- virtual void drop(const QMouseEvent *me);
-
- void updatePixmap();
- void updateCursor();
-
- Qt::DropAction defaultAction(Qt::DropActions possibleActions,
- Qt::KeyboardModifiers modifiers) const;
-
- QPixmap dragCursor(Qt::DropAction action) const;
-
- QDragPrivate *dragPrivate() const { return object ? object->d_func() : 0; }
-
- inline QMimeData *dropData()
- { return object ? dragPrivate()->data : platformDropData; }
-
- void emitActionChanged(Qt::DropAction newAction) { if (object) emit object->actionChanged(newAction); }
+ Qt::DropAction drag(QDrag *);
void setCurrentTarget(QObject *target, bool dropped = false);
- QObject *currentTarget();
+ QObject *currentTarget() const;
- QDrag *object;
-
- bool beingCancelled;
- bool restoreCursor;
- bool willDrop;
- QEventLoop *eventLoop;
-
- Qt::DropActions possible_actions;
- // Shift/Ctrl handling, and final drop status
- Qt::DropAction global_accepted_action;
-
- QShapedPixmapWindow *shapedPixmapWindow;
-
- void unmanageEvents();
- void stopDrag();
+ QDrag *object() const { return m_object; }
+ QObject *source() const;
private:
- QMimeData *platformDropData;
-
- Qt::DropAction currentActionForOverrideCursor;
- QObject *currentDropTarget;
-
- QPlatformDrag *platformDrag;
+ QMimeData *m_platformDropData;
+ QObject *m_currentDropTarget;
+ QPlatformDrag *m_platformDrag;
+ QDrag *m_object;
- static QDragManager *instance;
+ static QDragManager *m_instance;
Q_DISABLE_COPY(QDragManager)
};
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 694b12a180..40015c8706 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qdrag.h>
+#include "private/qguiapplication_p.h"
#include <qpixmap.h>
#include <qpoint.h>
#include "qdnd_p.h"
@@ -114,9 +115,9 @@ QDrag::QDrag(QObject *dragSource)
d->target = 0;
d->data = 0;
d->hotspot = QPoint(-10, -10);
- d->possible_actions = Qt::CopyAction;
d->executed_action = Qt::IgnoreAction;
- d->defaultDropAction = Qt::IgnoreAction;
+ d->supported_actions = Qt::IgnoreAction;
+ d->default_action = Qt::IgnoreAction;
}
/*!
@@ -126,9 +127,6 @@ QDrag::~QDrag()
{
Q_D(QDrag);
delete d->data;
- QDragManager *manager = QDragManager::self();
- if (manager && manager->object == this)
- manager->cancel(false);
}
/*!
@@ -178,7 +176,7 @@ QPixmap QDrag::pixmap() const
Sets the position of the hot spot relative to the top-left corner of the
pixmap used to the point specified by \a hotspot.
- \bold{Note:} on X11, the pixmap may not be able to keep up with the mouse
+ \b{Note:} on X11, the pixmap may not be able to keep up with the mouse
movements if the hot spot causes the pixmap to be displayed
directly under the cursor.
*/
@@ -226,7 +224,7 @@ QObject *QDrag::target() const
from are specified in \a supportedActions. The default proposed action will be selected
among the allowed actions in the following order: Move, Copy and Link.
- \bold{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and Mac OS X, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
@@ -248,7 +246,7 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)
The \a defaultDropAction determines which action will be proposed when the user performs a
drag without using modifier keys.
- \bold{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and Mac OS X, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
@@ -264,24 +262,22 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
qWarning("QDrag: No mimedata set before starting the drag");
return d->executed_action;
}
- QDragManager *manager = QDragManager::self();
- d->defaultDropAction = Qt::IgnoreAction;
- d->possible_actions = supportedActions;
-
- if (manager) {
- if (defaultDropAction == Qt::IgnoreAction) {
- if (supportedActions & Qt::MoveAction) {
- d->defaultDropAction = Qt::MoveAction;
- } else if (supportedActions & Qt::CopyAction) {
- d->defaultDropAction = Qt::CopyAction;
- } else if (supportedActions & Qt::LinkAction) {
- d->defaultDropAction = Qt::LinkAction;
- }
- } else {
- d->defaultDropAction = defaultDropAction;
+ Qt::DropAction transformedDefaultDropAction = Qt::IgnoreAction;
+
+ if (defaultDropAction == Qt::IgnoreAction) {
+ if (supportedActions & Qt::MoveAction) {
+ transformedDefaultDropAction = Qt::MoveAction;
+ } else if (supportedActions & Qt::CopyAction) {
+ transformedDefaultDropAction = Qt::CopyAction;
+ } else if (supportedActions & Qt::LinkAction) {
+ transformedDefaultDropAction = Qt::LinkAction;
}
- d->executed_action = manager->drag(this);
+ } else {
+ transformedDefaultDropAction = defaultDropAction;
}
+ d->supported_actions = supportedActions;
+ d->default_action = transformedDefaultDropAction;
+ d->executed_action = QDragManager::self()->drag(this);
return d->executed_action;
}
@@ -289,13 +285,13 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
/*!
\obsolete
- \bold{Note:} It is recommended to use exec() instead of this function.
+ \b{Note:} It is recommended to use exec() instead of this function.
Starts the drag and drop operation and returns a value indicating the requested
drop action when it is completed. The drop actions that the user can choose
from are specified in \a request. Qt::CopyAction is always allowed.
- \bold{Note:} Although the drag and drop operation can take some time, this function
+ \b{Note:} Although the drag and drop operation can take some time, this function
does not block the event loop. Other events are still delivered to the application
while the operation is performed.
@@ -308,11 +304,9 @@ Qt::DropAction QDrag::start(Qt::DropActions request)
qWarning("QDrag: No mimedata set before starting the drag");
return d->executed_action;
}
- QDragManager *manager = QDragManager::self();
- d->defaultDropAction = Qt::IgnoreAction;
- d->possible_actions = request | Qt::CopyAction;
- if (manager)
- d->executed_action = manager->drag(this);
+ d->supported_actions = request | Qt::CopyAction;
+ d->default_action = Qt::IgnoreAction;
+ d->executed_action = QDragManager::self()->drag(this);
return d->executed_action;
}
@@ -336,6 +330,49 @@ void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)
}
/*!
+ Returns the drag cursor for the \a action.
+
+ \since 5.0
+*/
+
+QPixmap QDrag::dragCursor(Qt::DropAction action) const
+{
+ typedef QMap<Qt::DropAction, QPixmap>::const_iterator Iterator;
+
+ Q_D(const QDrag);
+ const Iterator it = d->customCursors.constFind(action);
+ if (it != d->customCursors.constEnd())
+ return it.value();
+
+ Qt::CursorShape shape = Qt::ForbiddenCursor;
+ switch (action) {
+ case Qt::MoveAction:
+ shape = Qt::DragMoveCursor;
+ break;
+ case Qt::CopyAction:
+ shape = Qt::DragCopyCursor;
+ break;
+ case Qt::LinkAction:
+ shape = Qt::DragLinkCursor;
+ break;
+ default:
+ shape = Qt::ForbiddenCursor;
+ }
+ return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
+}
+
+Qt::DropActions QDrag::supportedActions() const
+{
+ Q_D(const QDrag);
+ return d->supported_actions;
+}
+
+Qt::DropAction QDrag::defaultAction() const
+{
+ Q_D(const QDrag);
+ return d->default_action;
+}
+/*!
\fn void QDrag::actionChanged(Qt::DropAction action)
This signal is emitted when the \a action associated with the
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 0a1ddff2d9..de84b6588b 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -56,6 +56,7 @@ class QPixmap;
class QPoint;
class QDragManager;
+
class Q_GUI_EXPORT QDrag : public QObject
{
Q_OBJECT
@@ -81,6 +82,10 @@ public:
Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
void setDragCursor(const QPixmap &cursor, Qt::DropAction action);
+ QPixmap dragCursor(Qt::DropAction action) const;
+
+ Qt::DropActions supportedActions() const;
+ Qt::DropAction defaultAction() const;
Q_SIGNALS:
void actionChanged(Qt::DropAction action);
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 281d4f61bc..7b84f4a982 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -377,9 +377,9 @@ QMouseEvent::~QMouseEvent()
you will get the following QEvent::MouseMove events:
\list 1
- \o A::MouseMove
- \o B::MouseMove
- \o C::MouseMove
+ \li A::MouseMove
+ \li B::MouseMove
+ \li C::MouseMove
\endlist
You will get the same events for QEvent::HoverMove, except that the event
@@ -390,9 +390,9 @@ QMouseEvent::~QMouseEvent()
In this case the events will occur in the following way:
\list 1
- \o A::HoverMove
- \o A::HoverMove, B::HoverMove
- \o A::HoverMove, B::HoverMove, C::HoverMove
+ \li A::HoverMove
+ \li A::HoverMove, B::HoverMove
+ \li A::HoverMove, B::HoverMove, C::HoverMove
\endlist
*/
@@ -1483,20 +1483,20 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
step process:
\list 1
- \o \bold{Starting to Compose}
+ \li \b{Starting to Compose}
When the user presses the first key on a keyboard, an input
context is created. This input context will contain a string
of the typed characters.
- \o \bold{Composing}
+ \li \b{Composing}
With every new key pressed, the input method will try to create a
matching string for the text typed so far called preedit
string. While the input context is active, the user can only move
the cursor inside the string belonging to this input context.
- \o \bold{Completing}
+ \li \b{Completing}
At some point, the user will activate a user interface component
(perhaps using a particular key) where they can choose from a
@@ -1539,10 +1539,10 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
following steps:
\list 1
- \o If the widget has selected text, the selected text should get
+ \li If the widget has selected text, the selected text should get
removed.
- \o Remove the text starting at replacementStart() with length
+ \li Remove the text starting at replacementStart() with length
replacementLength() and replace it by the commitString(). If
replacementLength() is 0, replacementStart() gives the insertion
position for the commitString().
@@ -1556,7 +1556,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
If the widget implements undo/redo, this operation gets added to
the undo stack.
- \o If there is no current preedit string, insert the
+ \li If there is no current preedit string, insert the
preeditString() at the current cursor position; otherwise replace
the previous preeditString with the one received from this event.
@@ -2060,7 +2060,7 @@ QTabletEvent::~QTabletEvent()
Returns the z position of the device. Typically this is represented by a
wheel on a 4D Mouse. If the device does not support a Z-axis, this value is
- always zero. This is \bold not the same as pressure.
+ always zero. This is \b not the same as pressure.
\sa pressure()
*/
@@ -2295,8 +2295,9 @@ QDropEvent::~QDropEvent()
*/
QObject* QDropEvent::source() const
{
- QDragManager *manager = QDragManager::self();
- return (manager && manager->object) ? manager->object->source() : 0;
+ if (const QDragManager *manager = QDragManager::self())
+ return manager->source();
+ return 0;
}
@@ -2575,11 +2576,11 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/qstatustipevent/main.cpp 1
\dots
\snippet doc/src/snippets/qstatustipevent/main.cpp 3
- \o
+ \li
\image qstatustipevent-widget.png Widget with status tip.
\endtable
@@ -2588,12 +2589,12 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/qstatustipevent/main.cpp 0
\snippet doc/src/snippets/qstatustipevent/main.cpp 2
\dots
\snippet doc/src/snippets/qstatustipevent/main.cpp 3
- \o
+ \li
\image qstatustipevent-action.png Action with status tip.
\endtable
@@ -2998,7 +2999,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- dbg.nospace() << "QWheelEvent(" << static_cast<const QWheelEvent *>(e)->delta()
+ dbg.nospace() << "QWheelEvent("
+ << static_cast<const QWheelEvent *>(e)->pixelDelta()
+ << static_cast<const QWheelEvent *>(e)->angleDelta()
<< ')';
return dbg.space();
#endif
@@ -3402,10 +3405,10 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\list
- \i When the first touch point is detected, the destination widget is determined firstly by the
+ \li When the first touch point is detected, the destination widget is determined firstly by the
location on screen and secondly by the propagation rules.
- \i When additional touch points are detected, Qt first looks to see if there are any active
+ \li When additional touch points are detected, Qt first looks to see if there are any active
touch points on any ancestor or descendent of the widget under the new touch point. If there
are, the new touch point is grouped with the first, and the new touch point will be sent in a
single QTouchEvent to the widget that handled the first touch point. (The widget under the new
@@ -3427,19 +3430,19 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\list
- \i As mentioned above, enabling touch events means multiple widgets can be receiving touch
+ \li As mentioned above, enabling touch events means multiple widgets can be receiving touch
events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents,
this gives you great flexibility in designing touch user interfaces. Be aware of the
implications. For example, it is possible that the user is moving a QSlider with one finger and
pressing a QPushButton with another. The signals emitted by these widgets will be
interleaved.
- \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or
+ \li Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or
QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event
recipients, recursion may cause problems, including but not limited to lost events
and unexpected infinite recursion.
- \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
+ \li QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
\l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is
undefined when opening a pop-up or grabbing the mouse while there are more than one active touch
points.
@@ -3618,7 +3621,7 @@ QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
*/
QTouchEvent::TouchPoint::~TouchPoint()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -3860,11 +3863,16 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
}
/*!
- Returns the raw, unfiltered positions for the touch point. The positions are in screen coordinates.
+ Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
\note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
+ \note Native screen coordinates refer to the native orientation of the screen which, in case of
+ mobile devices, is typically portrait. This means that on systems capable of screen orientation
+ changes the positions in this list will not reflect the current orientation (unlike pos(),
+ screenPos(), etc.) and will always be reported in the native orientation.
+
\sa QTouchDevice::capabilities(), device(), window()
*/
QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
@@ -4040,16 +4048,15 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
d->flags = flags;
}
-/*! \internal */
-QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
-{
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- return *this;
-}
+/*!
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
+ \internal
+ */
+/*!
+ \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
+ \internal
+*/
/*!
\class QScrollPrepareEvent
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index ca93095a94..7c871b0dda 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -71,7 +71,7 @@ class QScreen;
class Q_GUI_EXPORT QInputEvent : public QEvent
{
public:
- QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
~QInputEvent();
inline Qt::KeyboardModifiers modifiers() const { return modState; }
inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
@@ -276,7 +276,7 @@ protected:
class Q_GUI_EXPORT QFocusEvent : public QEvent
{
public:
- QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
+ explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
~QFocusEvent();
inline bool gotFocus() const { return type() == FocusIn; }
@@ -292,8 +292,8 @@ private:
class Q_GUI_EXPORT QPaintEvent : public QEvent
{
public:
- QPaintEvent(const QRegion& paintRegion);
- QPaintEvent(const QRect &paintRect);
+ explicit QPaintEvent(const QRegion& paintRegion);
+ explicit QPaintEvent(const QRect &paintRect);
~QPaintEvent();
inline const QRect &rect() const { return m_rect; }
@@ -311,7 +311,7 @@ protected:
class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent
{
public:
- QUpdateLaterEvent(const QRegion& paintRegion);
+ explicit QUpdateLaterEvent(const QRegion& paintRegion);
~QUpdateLaterEvent();
inline const QRegion &region() const { return m_region; }
@@ -337,7 +337,7 @@ protected:
class Q_GUI_EXPORT QExposeEvent : public QEvent
{
public:
- QExposeEvent(const QRegion &rgn);
+ explicit QExposeEvent(const QRegion &rgn);
~QExposeEvent();
inline const QRegion &region() const { return rgn; }
@@ -464,11 +464,12 @@ private:
int replace_length;
QString tentativeCommit;
};
+Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE);
class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
{
public:
- QInputMethodQueryEvent(Qt::InputMethodQueries queries);
+ explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
~QInputMethodQueryEvent();
Qt::InputMethodQueries queries() const { return m_queries; }
@@ -586,7 +587,7 @@ private:
class Q_GUI_EXPORT QStatusTipEvent : public QEvent
{
public:
- QStatusTipEvent(const QString &tip);
+ explicit QStatusTipEvent(const QString &tip);
~QStatusTipEvent();
inline QString tip() const { return s; }
@@ -599,7 +600,7 @@ private:
class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
{
public:
- QWhatsThisClickedEvent(const QString &href);
+ explicit QWhatsThisClickedEvent(const QString &href);
~QWhatsThisClickedEvent();
inline QString href() const { return s; }
@@ -624,8 +625,8 @@ public:
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
{
public:
- QFileOpenEvent(const QString &file);
- QFileOpenEvent(const QUrl &url);
+ explicit QFileOpenEvent(const QString &file);
+ explicit QFileOpenEvent(const QUrl &url);
~QFileOpenEvent();
inline QString file() const { return f; }
@@ -639,7 +640,7 @@ private:
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
{
public:
- QToolBarChangeEvent(bool t);
+ explicit QToolBarChangeEvent(bool t);
~QToolBarChangeEvent();
inline bool toggle() const { return tog; }
@@ -669,7 +670,7 @@ protected:
class Q_GUI_EXPORT QClipboardEvent : public QEvent
{
public:
- QClipboardEvent(QEventPrivate *data);
+ explicit QClipboardEvent(QEventPrivate *data);
~QClipboardEvent();
QEventPrivate *data() { return d; }
@@ -679,7 +680,7 @@ public:
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
public:
- QWindowStateChangeEvent(Qt::WindowStates aOldState);
+ explicit QWindowStateChangeEvent(Qt::WindowStates aOldState);
QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
~QWindowStateChangeEvent();
@@ -711,10 +712,20 @@ public:
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
- TouchPoint(int id = -1);
- TouchPoint(const QTouchEvent::TouchPoint &other);
+ explicit TouchPoint(int id = -1);
+ TouchPoint(const TouchPoint &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
+ TouchPoint &operator=(TouchPoint &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
~TouchPoint();
+ TouchPoint &operator=(const TouchPoint &other)
+ { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
+
+ void swap(TouchPoint &other) { qSwap(d, other.d); }
+
int id() const;
Qt::TouchPointState state() const;
@@ -766,7 +777,6 @@ public:
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
void setRawScreenPositions(const QList<QPointF> &positions);
- QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
private:
QTouchEventTouchPointPrivate *d;
@@ -783,11 +793,11 @@ public:
};
#endif
- QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device = 0,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier,
- Qt::TouchPointStates touchPointStates = 0,
- const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
+ explicit QTouchEvent(QEvent::Type eventType,
+ QTouchDevice *device = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ Qt::TouchPointStates touchPointStates = 0,
+ const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
inline QWindow *window() const { return _window; }
@@ -818,14 +828,14 @@ protected:
friend class QApplication;
friend class QApplicationPrivate;
};
-
+Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
class QScrollPrepareEventPrivate;
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
{
public:
- QScrollPrepareEvent(const QPointF &startPos);
+ explicit QScrollPrepareEvent(const QPointF &startPos);
~QScrollPrepareEvent();
QPointF startPos() const;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1cd448a6bb..42ce3745de 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -73,8 +73,11 @@
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qwindow_p.h"
#include "private/qcursor_p.h"
+
#include "private/qdnd_p.h"
#include <private/qplatformthemefactory_qpa_p.h>
+#include "qplatformdrag_qpa.h"
+
#ifndef QT_NO_CURSOR
#include "qplatformcursor_qpa.h"
#endif
@@ -169,6 +172,11 @@ static inline void clearPalette()
static void initFontUnlocked()
{
+ if (!QGuiApplicationPrivate::app_font) {
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ if (const QFont *font = theme->font(QPlatformTheme::SystemFont))
+ QGuiApplicationPrivate::app_font = new QFont(*font);
+ }
if (!QGuiApplicationPrivate::app_font)
QGuiApplicationPrivate::app_font =
new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
@@ -192,7 +200,7 @@ static inline void clearFontUnlocked()
application's initialization and finalization. In addition, QGuiApplication handles
most of the system-wide and application-wide settings.
- For any GUI application using Qt, there is precisely \bold one QGuiApplication
+ For any GUI application using Qt, there is precisely \b one QGuiApplication
object no matter whether the application has 0, 1, 2 or more windows at
any given time. For non-GUI Qt applications, use QCoreApplication instead,
as it does not depend on the \l QtGui library.
@@ -202,30 +210,30 @@ static inline void clearFontUnlocked()
QGuiApplication's main areas of responsibility are:
\list
- \o It initializes the application with the user's desktop settings,
+ \li It initializes the application with the user's desktop settings,
such as palette(), font() and styleHints(). It keeps
track of these properties in case the user changes the desktop
globally, for example, through some kind of control panel.
- \o It performs event handling, meaning that it receives events
+ \li It performs event handling, meaning that it receives events
from the underlying window system and dispatches them to the
relevant widgets. You can send your own events to windows by
using sendEvent() and postEvent().
- \o It parses common command line arguments and sets its internal
+ \li It parses common command line arguments and sets its internal
state accordingly. See the \l{QGuiApplication::QGuiApplication()}
{constructor documentation} below for more details.
- \o It provides localization of strings that are visible to the
+ \li It provides localization of strings that are visible to the
user via translate().
- \o It provides some magical objects like the clipboard().
+ \li It provides some magical objects like the clipboard().
- \o It knows about the application's windows. You can ask which
+ \li It knows about the application's windows. You can ask which
window is at a certain position using topLevelAt(), get a list of
topLevelWindows(), etc.
- \o It manages the application's mouse cursor handling, see
+ \li It manages the application's mouse cursor handling, see
setOverrideCursor()
\endlist
@@ -237,11 +245,11 @@ static inline void clearFontUnlocked()
\table
\header
- \o{2,1} Groups of functions
+ \li{2,1} Groups of functions
\row
- \o System settings
- \o desktopSettingsAware(),
+ \li System settings
+ \li desktopSettingsAware(),
setDesktopSettingsAware(),
styleHints(),
palette(),
@@ -250,8 +258,8 @@ static inline void clearFontUnlocked()
setFont().
\row
- \o Event handling
- \o exec(),
+ \li Event handling
+ \li exec(),
processEvents(),
exit(),
quit().
@@ -263,22 +271,22 @@ static inline void clearFontUnlocked()
notify().
\row
- \o Windows
- \o allWindows(),
+ \li Windows
+ \li allWindows(),
topLevelWindows(),
focusWindow(),
clipboard(),
topLevelAt().
\row
- \o Advanced cursor handling
- \o overrideCursor(),
+ \li Advanced cursor handling
+ \li overrideCursor(),
setOverrideCursor(),
restoreOverrideCursor().
\row
- \o Miscellaneous
- \o startingUp(),
+ \li Miscellaneous
+ \li startingUp(),
closingDown(),
type().
\endtable
@@ -306,9 +314,9 @@ static inline void clearFontUnlocked()
All Qt programs automatically support the following command line options:
\list
- \o -reverse, sets the application's layout direction to
+ \li -reverse, sets the application's layout direction to
Qt::RightToLeft
- \o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
+ \li -qmljsdebugger=, activates the QML/JS debugger with a specified port.
The value must be of format port:1234[,block], where block is optional
and will make the application wait until a debugger connects to it.
\endlist
@@ -326,8 +334,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
: QCoreApplication(p)
{
- d_func()->init();
-}
+ d_func()->init(); }
/*!
Destructs the application.
@@ -931,6 +938,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QPointF globalPoint = e->globalPos;
Qt::MouseButton button = Qt::NoButton;
+ bool doubleClick = false;
if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) {
type = QEvent::MouseMove;
@@ -938,8 +946,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
mousePressButton = Qt::NoButton;
- }
- else { // Check to see if a new button has been pressed/released.
+ } else { // Check to see if a new button has been pressed/released.
for (int check = Qt::LeftButton;
check <= int(Qt::MaxMouseButton);
check = check << 1) {
@@ -954,33 +961,26 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
buttons = e->buttons;
if (button & e->buttons) {
- if ((e->timestamp - mousePressTime) < static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval()) &&
- button == mousePressButton) {
- type = QEvent::MouseButtonDblClick;
- mousePressButton = Qt::NoButton;
- }
- else {
- type = QEvent::MouseButtonPress;
- mousePressTime = e->timestamp;
- mousePressButton = button;
- const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
- mousePressX = point.x();
- mousePressY = point.y();
- }
- }
- else
+ ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
+ doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
+ type = QEvent::MouseButtonPress;
+ mousePressTime = e->timestamp;
+ mousePressButton = button;
+ const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
+ mousePressX = point.x();
+ mousePressY = point.y();
+ } else {
type = QEvent::MouseButtonRelease;
+ }
}
-
if (window) {
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers);
ev.setTimestamp(e->timestamp);
#ifndef QT_NO_CURSOR
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- for (int i = 0; i < cursors.count(); ++i)
- if (cursors.at(i))
- cursors.at(i).data()->pointerEvent(ev);
+ if (const QScreen *screen = window->screen())
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ cursor->pointerEvent(ev);
#endif
QGuiApplication::sendSpontaneousEvent(window, &ev);
if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
@@ -1015,12 +1015,16 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
fake.synthetic = true;
processTouchEvent(&fake);
}
+ if (doubleClick) {
+ mousePressButton = Qt::NoButton;
+ QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, localPoint, localPoint, globalPoint,
+ button, buttons, e->modifiers);
+ dblClickEvent.setTimestamp(e->timestamp);
+ QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
+ }
}
}
-
-//### there's a lot of duplicated logic here -- refactoring required!
-
void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
{
if (!e->window)
@@ -1039,8 +1043,6 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
}
}
-
-
// Remember, Qt convention is: keyboard state is state *before*
void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
@@ -1547,49 +1549,62 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
}
-Qt::DropAction QGuiApplicationPrivate::processDrag(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
static QPointer<QWindow> currentDragWindow;
- QDragManager *manager = QDragManager::self();
+ static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction;
+ QPlatformDrag *platformDrag = platformIntegration()->drag();
+ if (!platformDrag) {
+ lastAcceptedDropAction = Qt::IgnoreAction;
+ return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
+ }
+
if (!dropData) {
if (currentDragWindow.data() == w)
currentDragWindow = 0;
QDragLeaveEvent e;
QGuiApplication::sendEvent(w, &e);
- manager->global_accepted_action = Qt::IgnoreAction;
- return Qt::IgnoreAction;
+ lastAcceptedDropAction = Qt::IgnoreAction;
+ return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
}
- QDragMoveEvent me(p, manager->possible_actions, dropData,
+ QDragMoveEvent me(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
+
if (w != currentDragWindow) {
+ lastAcceptedDropAction = Qt::IgnoreAction;
if (currentDragWindow) {
QDragLeaveEvent e;
QGuiApplication::sendEvent(currentDragWindow, &e);
- manager->global_accepted_action = Qt::IgnoreAction;
}
currentDragWindow = w;
- QDragEnterEvent e(p, manager->possible_actions, dropData,
+ QDragEnterEvent e(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
QGuiApplication::sendEvent(w, &e);
- manager->global_accepted_action = e.isAccepted() ? e.dropAction() : Qt::IgnoreAction;
- if (manager->global_accepted_action != Qt::IgnoreAction) {
- me.setDropAction(manager->global_accepted_action);
- me.accept();
- }
+ if (e.isAccepted() && e.dropAction() != Qt::IgnoreAction)
+ lastAcceptedDropAction = e.dropAction();
+ }
+
+ // Handling 'DragEnter' should suffice for the application.
+ if (lastAcceptedDropAction != Qt::IgnoreAction
+ && (supportedActions & lastAcceptedDropAction)) {
+ me.setDropAction(lastAcceptedDropAction);
+ me.accept();
}
QGuiApplication::sendEvent(w, &me);
- manager->global_accepted_action = me.isAccepted() ? me.dropAction() : Qt::IgnoreAction;
- return manager->global_accepted_action;
+ lastAcceptedDropAction = me.isAccepted() ?
+ me.dropAction() : Qt::IgnoreAction;
+ return QPlatformDragQtResponse(me.isAccepted(), lastAcceptedDropAction, me.answerRect());
}
-Qt::DropAction QGuiApplicationPrivate::processDrop(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- QDragManager *manager = QDragManager::self();
- QDropEvent de(p, manager->possible_actions, dropData,
+ QDropEvent de(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
QGuiApplication::sendEvent(w, &de);
- manager->global_accepted_action = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction;
- return manager->global_accepted_action;
+
+ Qt::DropAction acceptedAction = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction;
+ QPlatformDropQtResponse response(de.isAccepted(),acceptedAction);
+ return response;
}
#ifndef QT_NO_CLIPBOARD
@@ -1798,16 +1813,11 @@ void QGuiApplication::changeOverrideCursor(const QCursor &cursor)
#ifndef QT_NO_CURSOR
-static void applyCursor(QWindow *w, const QCursor &c)
-{
- QCursor cc = c;
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- int cursorCount = cursors.count();
- for (int i = 0; i < cursorCount; ++i) {
- const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
- if (cursor)
- cursor.data()->changeCursor(&cc, w);
- }
+static inline void applyCursor(QWindow *w, QCursor c)
+{
+ if (const QScreen *screen = w->screen())
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ cursor->changeCursor(&c, w);
}
static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 68546ce0cf..d9477a3e9e 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -53,6 +53,8 @@
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qshortcutmap_p.h"
+#include "qplatformdrag_qpa.h"
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -121,8 +123,8 @@ public:
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
- static Qt::DropAction processDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
- static Qt::DropAction processDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
+ static QPlatformDropQtResponse processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 7053f01196..b0200335d7 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -164,14 +164,14 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
three different ways:
\list
- \o For standard shortcuts, a \l{QKeySequence::StandardKey}{standard key}
+ \li For standard shortcuts, a \l{QKeySequence::StandardKey}{standard key}
can be used to request the platform-specific key sequence associated
with each shortcut.
- \o For custom shortcuts, human-readable strings such as "Ctrl+X" can
+ \li For custom shortcuts, human-readable strings such as "Ctrl+X" can
be used, and these can be translated into the appropriate shortcuts
for users of different languages. Translations are made in the
"QShortcut" context.
- \o For hard-coded shortcuts, integer key codes can be specified with
+ \li For hard-coded shortcuts, integer key codes can be specified with
a combination of values defined by the Qt::Key and Qt::Modifier enum
values. Each key code consists of a single Qt::Key value and zero or
more modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT and Qt::META.
@@ -206,7 +206,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
code point of the character; for example, 'A' gives the same key sequence
as Qt::Key_A.
- \bold{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
+ \b{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
and Qt::ControlModifier correspond to the \key Command keys on the
Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
Qt::MetaModifier correspond to the \key Control keys. Developers on
@@ -225,72 +225,72 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
corresponds to the \key Control keys.
\table
- \header \i StandardKey \i Windows \i Mac OS X \i KDE \i GNOME
- \row \i HelpContents \i F1 \i Ctrl+? \i F1 \i F1
- \row \i WhatsThis \i Shift+F1 \i Shift+F1 \i Shift+F1 \i Shift+F1
- \row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O
- \row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W
- \row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S
- \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q
- \row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S
- \row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N
- \row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D
- \row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del
- \row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins
- \row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins
- \row \i Preferences \i \i Ctrl+, \i \i
- \row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14
- \row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z \i Ctrl+Shift+Z \i Ctrl+Shift+Z
- \row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left
- \row \i Forward \i Alt+Right, Shift+Backspace \i Ctrl+] \i Alt+Right \i Alt+Right
- \row \i Refresh \i F5 \i F5 \i F5 \i Ctrl+R, F5
- \row \i ZoomIn \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus
- \row \i ZoomOut \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus
- \row \i Print \i Ctrl+P \i Ctrl+P \i Ctrl+P \i Ctrl+P
- \row \i AddTab \i Ctrl+T \i Ctrl+T \i Ctrl+Shift+N, Ctrl+T \i Ctrl+T
- \row \i NextChild \i Ctrl+Tab, Forward, Ctrl+F6 \i Ctrl+}, Forward, Ctrl+Tab \i Ctrl+Tab, Forward, Ctrl+Comma \i Ctrl+Tab, Forward
- \row \i PreviousChild \i Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \i Ctrl+{, Back, Ctrl+Shift+Tab \i Ctrl+Shift+Tab, Back, Ctrl+Period \i Ctrl+Shift+Tab, Back
- \row \i Find \i Ctrl+F \i Ctrl+F \i Ctrl+F \i Ctrl+F
- \row \i FindNext \i F3, Ctrl+G \i Ctrl+G \i F3 \i Ctrl+G, F3
- \row \i FindPrevious \i Shift+F3, Ctrl+Shift+G \i Ctrl+Shift+G \i Shift+F3 \i Ctrl+Shift+G, Shift+F3
- \row \i Replace \i Ctrl+H \i (none) \i Ctrl+R \i Ctrl+H
- \row \i SelectAll \i Ctrl+A \i Ctrl+A \i Ctrl+A \i Ctrl+A
- \row \i Bold \i Ctrl+B \i Ctrl+B \i Ctrl+B \i Ctrl+B
- \row \i Italic \i Ctrl+I \i Ctrl+I \i Ctrl+I \i Ctrl+I
- \row \i Underline \i Ctrl+U \i Ctrl+U \i Ctrl+U \i Ctrl+U
- \row \i MoveToNextChar \i Right \i Right \i Right \i Right
- \row \i MoveToPreviousChar \i Left \i Left \i Left \i Left
- \row \i MoveToNextWord \i Ctrl+Right \i Alt+Right \i Ctrl+Right \i Ctrl+Right
- \row \i MoveToPreviousWord \i Ctrl+Left \i Alt+Left \i Ctrl+Left \i Ctrl+Left
- \row \i MoveToNextLine \i Down \i Down \i Down \i Down
- \row \i MoveToPreviousLine \i Up \i Up \i Up \i Up
- \row \i MoveToNextPage \i PgDown \i PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\i PgDown \i PgDown
- \row \i MoveToPreviousPage \i PgUp \i PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \i PgUp \i PgUp
- \row \i MoveToStartOfLine \i Home \i Ctrl+Left, Meta+Left \i Home \i Home
- \row \i MoveToEndOfLine \i End \i Ctrl+Right, Meta+Right \i End \i End
- \row \i MoveToStartOfBlock \i (none) \i Alt+Up, Meta+A \i (none) \i (none)
- \row \i MoveToEndOfBlock \i (none) \i Alt+Down, Meta+E \i (none) \i (none)
- \row \i MoveToStartOfDocument\i Ctrl+Home \i Ctrl+Up, Home \i Ctrl+Home \i Ctrl+Home
- \row \i MoveToEndOfDocument \i Ctrl+End \i Ctrl+Down, End \i Ctrl+End \i Ctrl+End
- \row \i SelectNextChar \i Shift+Right \i Shift+Right \i Shift+Right \i Shift+Right
- \row \i SelectPreviousChar \i Shift+Left \i Shift+Left \i Shift+Left \i Shift+Left
- \row \i SelectNextWord \i Ctrl+Shift+Right \i Alt+Shift+Right \i Ctrl+Shift+Right \i Ctrl+Shift+Right
- \row \i SelectPreviousWord \i Ctrl+Shift+Left \i Alt+Shift+Left \i Ctrl+Shift+Left \i Ctrl+Shift+Left
- \row \i SelectNextLine \i Shift+Down \i Shift+Down \i Shift+Down \i Shift+Down
- \row \i SelectPreviousLine \i Shift+Up \i Shift+Up \i Shift+Up \i Shift+Up
- \row \i SelectNextPage \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown
- \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
- \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home
- \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none)
- \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home
- \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
- \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace
- \row \i DeleteEndOfWord \i Ctrl+Del \i (none) \i Ctrl+Del \i Ctrl+Del
- \row \i DeleteEndOfLine \i (none) \i (none) \i Ctrl+K \i Ctrl+K
- \row \i InsertParagraphSeparator \i Enter \i Enter \i Enter \i Enter
- \row \i InsertLineSeparator \i Shift+Enter \i Meta+Enter \i Shift+Enter \i Shift+Enter
+ \header \li StandardKey \li Windows \li Mac OS X \li KDE \li GNOME
+ \row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1
+ \row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1
+ \row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O
+ \row \li Close \li Ctrl+F4, Ctrl+W \li Ctrl+W, Ctrl+F4 \li Ctrl+W \li Ctrl+W
+ \row \li Save \li Ctrl+S \li Ctrl+S \li Ctrl+S \li Ctrl+S
+ \row \li Quit \li \li Ctrl+Q \li Qtrl+Q \li Qtrl+Q
+ \row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S
+ \row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N
+ \row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
+ \row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del
+ \row \li Copy \li Ctrl+C, Ctrl+Ins \li Ctrl+C \li Ctrl+C, F16, Ctrl+Ins \li Ctrl+C, F16, Ctrl+Ins
+ \row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins
+ \row \li Preferences \li \li Ctrl+, \li \li
+ \row \li Undo \li Ctrl+Z, Alt+Backspace \li Ctrl+Z \li Ctrl+Z, F14 \li Ctrl+Z, F14
+ \row \li Redo \li Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \li Ctrl+Shift+Z \li Ctrl+Shift+Z \li Ctrl+Shift+Z
+ \row \li Back \li Alt+Left, Backspace \li Ctrl+[ \li Alt+Left \li Alt+Left
+ \row \li Forward \li Alt+Right, Shift+Backspace \li Ctrl+] \li Alt+Right \li Alt+Right
+ \row \li Refresh \li F5 \li F5 \li F5 \li Ctrl+R, F5
+ \row \li ZoomIn \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus
+ \row \li ZoomOut \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus
+ \row \li Print \li Ctrl+P \li Ctrl+P \li Ctrl+P \li Ctrl+P
+ \row \li AddTab \li Ctrl+T \li Ctrl+T \li Ctrl+Shift+N, Ctrl+T \li Ctrl+T
+ \row \li NextChild \li Ctrl+Tab, Forward, Ctrl+F6 \li Ctrl+}, Forward, Ctrl+Tab \li Ctrl+Tab, Forward, Ctrl+Comma \li Ctrl+Tab, Forward
+ \row \li PreviousChild \li Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \li Ctrl+{, Back, Ctrl+Shift+Tab \li Ctrl+Shift+Tab, Back, Ctrl+Period \li Ctrl+Shift+Tab, Back
+ \row \li Find \li Ctrl+F \li Ctrl+F \li Ctrl+F \li Ctrl+F
+ \row \li FindNext \li F3, Ctrl+G \li Ctrl+G \li F3 \li Ctrl+G, F3
+ \row \li FindPrevious \li Shift+F3, Ctrl+Shift+G \li Ctrl+Shift+G \li Shift+F3 \li Ctrl+Shift+G, Shift+F3
+ \row \li Replace \li Ctrl+H \li (none) \li Ctrl+R \li Ctrl+H
+ \row \li SelectAll \li Ctrl+A \li Ctrl+A \li Ctrl+A \li Ctrl+A
+ \row \li Bold \li Ctrl+B \li Ctrl+B \li Ctrl+B \li Ctrl+B
+ \row \li Italic \li Ctrl+I \li Ctrl+I \li Ctrl+I \li Ctrl+I
+ \row \li Underline \li Ctrl+U \li Ctrl+U \li Ctrl+U \li Ctrl+U
+ \row \li MoveToNextChar \li Right \li Right \li Right \li Right
+ \row \li MoveToPreviousChar \li Left \li Left \li Left \li Left
+ \row \li MoveToNextWord \li Ctrl+Right \li Alt+Right \li Ctrl+Right \li Ctrl+Right
+ \row \li MoveToPreviousWord \li Ctrl+Left \li Alt+Left \li Ctrl+Left \li Ctrl+Left
+ \row \li MoveToNextLine \li Down \li Down \li Down \li Down
+ \row \li MoveToPreviousLine \li Up \li Up \li Up \li Up
+ \row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\li PgDown \li PgDown
+ \row \li MoveToPreviousPage \li PgUp \li PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \li PgUp \li PgUp
+ \row \li MoveToStartOfLine \li Home \li Ctrl+Left, Meta+Left \li Home \li Home
+ \row \li MoveToEndOfLine \li End \li Ctrl+Right, Meta+Right \li End \li End
+ \row \li MoveToStartOfBlock \li (none) \li Alt+Up, Meta+A \li (none) \li (none)
+ \row \li MoveToEndOfBlock \li (none) \li Alt+Down, Meta+E \li (none) \li (none)
+ \row \li MoveToStartOfDocument\li Ctrl+Home \li Ctrl+Up, Home \li Ctrl+Home \li Ctrl+Home
+ \row \li MoveToEndOfDocument \li Ctrl+End \li Ctrl+Down, End \li Ctrl+End \li Ctrl+End
+ \row \li SelectNextChar \li Shift+Right \li Shift+Right \li Shift+Right \li Shift+Right
+ \row \li SelectPreviousChar \li Shift+Left \li Shift+Left \li Shift+Left \li Shift+Left
+ \row \li SelectNextWord \li Ctrl+Shift+Right \li Alt+Shift+Right \li Ctrl+Shift+Right \li Ctrl+Shift+Right
+ \row \li SelectPreviousWord \li Ctrl+Shift+Left \li Alt+Shift+Left \li Ctrl+Shift+Left \li Ctrl+Shift+Left
+ \row \li SelectNextLine \li Shift+Down \li Shift+Down \li Shift+Down \li Shift+Down
+ \row \li SelectPreviousLine \li Shift+Up \li Shift+Up \li Shift+Up \li Shift+Up
+ \row \li SelectNextPage \li Shift+PgDown \li Shift+PgDown \li Shift+PgDown \li Shift+PgDown
+ \row \li SelectPreviousPage \li Shift+PgUp \li Shift+PgUp \li Shift+PgUp \li Shift+PgUp
+ \row \li SelectStartOfLine \li Shift+Home \li Ctrl+Shift+Left \li Shift+Home \li Shift+Home
+ \row \li SelectEndOfLine \li Shift+End \li Ctrl+Shift+Right \li Shift+End \li Shift+End
+ \row \li SelectStartOfBlock \li (none) \li Alt+Shift+Up, Meta+Shift+A \li (none) \li (none)
+ \row \li SelectEndOfBlock \li (none) \li Alt+Shift+Down, Meta+Shift+E \li (none) \li (none)
+ \row \li SelectStartOfDocument\li Ctrl+Shift+Home \li Ctrl+Shift+Up, Shift+Home \li Ctrl+Shift+Home\li Ctrl+Shift+Home
+ \row \li SelectEndOfDocument \li Ctrl+Shift+End \li Ctrl+Shift+Down, Shift+End \li Ctrl+Shift+End \li Ctrl+Shift+End
+ \row \li DeleteStartOfWord \li Ctrl+Backspace \li Alt+Backspace \li Ctrl+Backspace \li Ctrl+Backspace
+ \row \li DeleteEndOfWord \li Ctrl+Del \li (none) \li Ctrl+Del \li Ctrl+Del
+ \row \li DeleteEndOfLine \li (none) \li (none) \li Ctrl+K \li Ctrl+K
+ \row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
+ \row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter \li Shift+Enter \li Shift+Enter
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -934,16 +934,6 @@ QKeySequence::QKeySequence()
Note the "File|Open" translator comment. It is by no means
necessary, but it provides some context for the human translator.
*/
-QKeySequence::QKeySequence(const QString &key)
-{
- d = new QKeySequencePrivate();
- assign(key);
-}
-
-/*!
- \since 4.7
- Creates a key sequence from the \a key string based on \a format.
-*/
QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
{
d = new QKeySequencePrivate();
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index d1e7d06653..e8dd134bc3 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -146,8 +146,7 @@ public:
};
QKeySequence();
- QKeySequence(const QString &key);
- QKeySequence(const QString &key, SequenceFormat format);
+ QKeySequence(const QString &key, SequenceFormat format = NativeText);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 3e2c35f088..d5c4d6c762 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -49,9 +49,7 @@
#include <private/qobject_p.h>
#include <qmutex.h>
-#ifndef QT_NO_DEBUG
#include <QtCore/QHash>
-#endif
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 6d3d1c9580..9a2eb12e3f 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -342,9 +342,9 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
The color groups:
\list
- \i The Active group is used for the window that has keyboard focus.
- \i The Inactive group is used for other windows.
- \i The Disabled group is used for widgets (not windows) that are
+ \li The Active group is used for the window that has keyboard focus.
+ \li The Inactive group is used for other windows.
+ \li The Disabled group is used for widgets (not windows) that are
disabled for some reason.
\endlist
@@ -844,7 +844,8 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2)
return true;
}
-/*! \obsolete
+/*! \fn int QPalette::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this QPalette
object. Distinct QPalette objects can only have the same serial
@@ -860,10 +861,6 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2)
\sa operator==()
*/
-int QPalette::serialNumber() const
-{
- return d->ser_no;
-}
/*!
Returns a number that identifies the contents of this QPalette
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index cc710fa67a..ca619a89b4 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -139,7 +139,9 @@ public:
inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
bool isCopyOf(const QPalette &p) const;
- int serialNumber() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
+#endif
qint64 cacheKey() const;
QPalette resolve(const QPalette &) const;
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index fd7bcdcf18..a4e998ddbc 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -43,13 +43,22 @@
#include <QPainter>
#include <QBitmap>
#include <QGuiApplication>
+#include <QScreen>
+#include <QPlatformScreen>
#include <private/qguiapplication_p.h>
#include <QDebug>
QT_BEGIN_NAMESPACE
-QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
+QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
+{
+ QList<QPlatformCursor *> result;
+ foreach (const QScreen *screen, QGuiApplicationPrivate::screen_list)
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ result.push_back(cursor);
+ return result;
+}
/*!
\class QPlatformCursor
@@ -93,10 +102,8 @@ QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
Constructs a QPlatformCursor for the given \a screen.
*/
-QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
- : screen(scr)
+QPlatformCursor::QPlatformCursor()
{
- QPlatformCursorPrivate::instances.append(this);
}
QPoint QPlatformCursor::pos() const
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index a8cbb282fa..e29cf87d03 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -74,13 +74,12 @@ class QPlatformCursor;
class Q_GUI_EXPORT QPlatformCursorPrivate {
public:
- static QList<QWeakPointer<QPlatformCursor> > getInstances() { return instances; }
- static QList<QWeakPointer<QPlatformCursor> > instances;
+ static QList<QPlatformCursor *> getInstances();
};
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
- QPlatformCursor(QPlatformScreen *);
+ QPlatformCursor();
// input methods
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
@@ -88,11 +87,8 @@ public:
virtual QPoint pos() const;
virtual void setPos(const QPoint &pos);
-protected:
- QPlatformScreen* screen; // Where to request an update
-
private:
- Q_DECLARE_PRIVATE(QPlatformCursor);
+ Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/qplatformdrag_qpa.cpp b/src/gui/kernel/qplatformdrag_qpa.cpp
new file mode 100644
index 0000000000..832b91db7e
--- /dev/null
+++ b/src/gui/kernel/qplatformdrag_qpa.cpp
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformdrag_qpa.h"
+
+#include <QtGui/private/qdnd_p.h>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QGuiApplication>
+#include <QtCore/QEventLoop>
+
+QT_BEGIN_NAMESPACE
+
+QPlatformDropQtResponse::QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction)
+ : m_accepted(accepted)
+ , m_accepted_action(acceptedAction)
+{
+}
+
+bool QPlatformDropQtResponse::isAccepted() const
+{
+ return m_accepted;
+}
+
+Qt::DropAction QPlatformDropQtResponse::acceptedAction() const
+{
+ return m_accepted_action;
+}
+
+QPlatformDragQtResponse::QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect)
+ : QPlatformDropQtResponse(accepted,acceptedAction)
+ , m_answer_rect(answerRect)
+{
+}
+
+QRect QPlatformDragQtResponse::answerRect() const
+{
+ return m_answer_rect;
+}
+
+class QPlatformDragPrivate {
+public:
+ QPlatformDragPrivate() : cursor_drop_action(Qt::IgnoreAction) {}
+
+ Qt::DropAction cursor_drop_action;
+};
+
+QPlatformDrag::QPlatformDrag() : d_ptr(new QPlatformDragPrivate)
+{
+}
+
+QPlatformDrag::~QPlatformDrag()
+{
+}
+
+QDrag *QPlatformDrag::currentDrag() const
+{
+ return QDragManager::self()->object();
+}
+
+Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
+ Qt::KeyboardModifiers modifiers) const
+{
+#ifdef QDND_DEBUG
+ qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
+ qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
+#endif
+
+ Qt::DropAction default_action = Qt::IgnoreAction;
+
+ if (currentDrag()) {
+ default_action = currentDrag()->defaultAction();
+ }
+
+
+ if (default_action == Qt::IgnoreAction) {
+ //This means that the drag was initiated by QDrag::start and we need to
+ //preserve the old behavior
+ default_action = Qt::CopyAction;
+ }
+
+ if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
+ default_action = Qt::LinkAction;
+ else if (modifiers & Qt::ControlModifier)
+ default_action = Qt::CopyAction;
+ else if (modifiers & Qt::ShiftModifier)
+ default_action = Qt::MoveAction;
+ else if (modifiers & Qt::AltModifier)
+ default_action = Qt::LinkAction;
+
+#ifdef QDND_DEBUG
+ qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
+#endif
+
+ // Check if the action determined is allowed
+ if (!(possibleActions & default_action)) {
+ if (possibleActions & Qt::CopyAction)
+ default_action = Qt::CopyAction;
+ else if (possibleActions & Qt::MoveAction)
+ default_action = Qt::MoveAction;
+ else if (possibleActions & Qt::LinkAction)
+ default_action = Qt::LinkAction;
+ else
+ default_action = Qt::IgnoreAction;
+ }
+
+#ifdef QDND_DEBUG
+ qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
+#endif
+
+ return default_action;
+}
+
+/*!
+ \brief Called to notify QDrag about changes of the current action.
+ */
+
+void QPlatformDrag::updateAction(Qt::DropAction action)
+{
+ Q_D(QPlatformDrag);
+ if (d->cursor_drop_action != action) {
+ d->cursor_drop_action = action;
+ emit currentDrag()->actionChanged(action);
+ }
+}
+
+static const char *const default_pm[] = {
+"13 9 3 1",
+". c None",
+" c #000000",
+"X c #FFFFFF",
+"X X X X X X X",
+" X X X X X X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X X X X X X ",
+"X X X X X X X",
+};
+
+Q_GLOBAL_STATIC_WITH_ARGS(QPixmap,qt_drag_default_pixmap,(default_pm))
+
+QPixmap QPlatformDrag::defaultPixmap()
+{
+ return *qt_drag_default_pixmap();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 0c215071d3..7d22c69947 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -43,6 +43,7 @@
#define QPLATFORMDRAG_H
#include <QtCore/qglobal.h>
+#include <QtGui/QPixmap>
QT_BEGIN_HEADER
@@ -51,18 +52,54 @@ QT_BEGIN_NAMESPACE
class QMimeData;
class QMouseEvent;
+class QDrag;
+class QObject;
+class QEvent;
+class QPlatformDragPrivate;
-class QPlatformDrag
+class Q_GUI_EXPORT QPlatformDropQtResponse
{
public:
- virtual ~QPlatformDrag() {}
+ QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction);
+ bool isAccepted() const;
+ Qt::DropAction acceptedAction() const;
+private:
+ bool m_accepted;
+ Qt::DropAction m_accepted_action;
+
+};
+
+class Q_GUI_EXPORT QPlatformDragQtResponse : public QPlatformDropQtResponse
+{
+public:
+ QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect);
+
+ QRect answerRect() const;
+
+private:
+ QRect m_answer_rect;
+};
+
+class Q_GUI_EXPORT QPlatformDrag
+{
+ Q_DECLARE_PRIVATE(QPlatformDrag)
+public:
+ QPlatformDrag();
+ virtual ~QPlatformDrag();
+
+ QDrag *currentDrag() const;
virtual QMimeData *platformDropData() = 0;
- virtual void startDrag() {}
- virtual void move(const QMouseEvent *me) = 0;
- virtual void drop(const QMouseEvent *me) = 0;
- virtual void cancel() = 0;
+ virtual Qt::DropAction drag(QDrag *m_drag) = 0;
+ void updateAction(Qt::DropAction action);
+
+ Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const;
+
+ static QPixmap defaultPixmap();
+
+private:
+ QPlatformDragPrivate *d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 7237849011..f87a2956a3 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -132,7 +132,7 @@ void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const
The event filter function set here is called for all messages
received from the platform if they are given type \eventType.
- It is \i not called for messages that are not meant for Qt objects.
+ It is \e not called for messages that are not meant for Qt objects.
The type of event is specific to the platform plugin chosen at run-time.
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index c832d853f4..022f198073 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -41,6 +41,7 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qguiapplication.h>
+#include <QtGui/qplatformcursor_qpa.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <QtGui/qplatformintegration_qpa.h>
@@ -250,4 +251,14 @@ QPlatformScreenPageFlipper *QPlatformScreen::pageFlipper() const
return 0;
}
+/*!
+ Reimplement this function in subclass to return the cursor of the screen.
+
+ The default implementation returns 0.
+*/
+QPlatformCursor *QPlatformScreen::cursor() const
+{
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index e4b9b762b1..b6eb91f9b2 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -63,21 +63,13 @@ class QPlatformBackingStore;
class QPlatformOpenGLContext;
class QPlatformScreenPrivate;
class QPlatformWindow;
+class QPlatformCursor;
+class QPlatformScreenPageFlipper;
class QScreen;
class QSurfaceFormat;
typedef QPair<qreal, qreal> QDpi;
-class Q_GUI_EXPORT QPlatformScreenPageFlipper : public QObject
-{
- Q_OBJECT
-public:
- virtual bool displayBuffer(void *bufferHandle) = 0;
-
- signals:
- void bufferDisplayed(void *bufferHandle);
- void bufferReleased(void *bufferHandle);
-};
class Q_GUI_EXPORT QPlatformScreen
{
@@ -112,6 +104,7 @@ public:
virtual QString name() const { return QString(); }
virtual QPlatformScreenPageFlipper *pageFlipper() const;
+ virtual QPlatformCursor *cursor() const;
protected:
QScopedPointer<QPlatformScreenPrivate> d_ptr;
diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
new file mode 100644
index 0000000000..d652e34e5e
--- /dev/null
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformscreenpageflipper_qpa.h"
+
+QT_BEGIN_NAMESPACE
+
+QPlatformScreenBuffer::QPlatformScreenBuffer()
+ : m_destroyed(false)
+ , m_ready(true)
+{
+
+}
+
+QPlatformScreenBuffer::~QPlatformScreenBuffer()
+{
+
+}
+
+bool QPlatformScreenBuffer::isDestroyed() const
+{
+ return m_destroyed;
+}
+
+bool QPlatformScreenBuffer::isReady() const
+{
+ return m_ready;
+}
+
+void QPlatformScreenBuffer::aboutToBeDisplayed()
+{
+}
+
+void QPlatformScreenBuffer::displayed()
+{
+}
+
+QPlatformScreenPageFlipper::QPlatformScreenPageFlipper(QObject *parent)
+ :QObject(parent)
+{
+
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.h b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
new file mode 100644
index 0000000000..850f9d8d2f
--- /dev/null
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMSCREENPAGEFLIPPER_QPA_H
+#define QPLATFORMSCREENPAGEFLIPPER_QPA_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QPlatformScreenBuffer {
+public:
+ QPlatformScreenBuffer();
+ virtual ~QPlatformScreenBuffer();
+
+ bool isDestroyed() const;
+ bool isReady() const;
+
+ virtual void aboutToBeDisplayed();
+ virtual void displayed();
+ virtual void release() = 0;
+
+ virtual void *handle() const = 0;
+
+protected:
+ bool m_destroyed;
+ bool m_ready;
+};
+
+class Q_GUI_EXPORT QPlatformScreenPageFlipper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QPlatformScreenPageFlipper(QObject *parent = 0);
+
+ virtual bool displayBuffer(QPlatformScreenBuffer *) = 0;
+
+signals:
+ void bufferDisplayed(QPlatformScreenBuffer *);
+ void bufferReleased(QPlatformScreenBuffer *);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMSCREENPAGEFLIPPER_QPA_H
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index 3f6b69b902..c6314825d7 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -102,6 +102,11 @@ QT_BEGIN_NAMESPACE
\sa themeHint(), QStyle::pixelMetric()
*/
+QPlatformTheme::~QPlatformTheme()
+{
+
+}
+
QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const
{
Q_UNUSED(menu);
@@ -132,6 +137,12 @@ const QPalette *QPlatformTheme::palette(Palette type) const
return 0;
}
+const QFont *QPlatformTheme::font(Font type) const
+{
+ Q_UNUSED(type)
+ return 0;
+}
+
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 31a52a9391..6ac6a0f573 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -55,6 +55,7 @@ class QPlatformMenuBar;
class QPlatformDialogHelper;
class QVariant;
class QPalette;
+class QFont;
class Q_GUI_EXPORT QPlatformTheme
{
@@ -86,9 +87,47 @@ public:
enum Palette {
SystemPalette,
ToolTipPalette,
+ ToolButtonPalette,
+ ButtonPalette,
+ HeaderPalette,
+ ComboBoxPalette,
+ ItemViewPalette,
+ MessageBoxLabelPelette,
+ TabBarPalette,
+ LabelPalette,
+ GroupBoxPalette,
+ MenuPalette,
+ MenuBarPalette,
+ TextEditPalette,
+ TextLineEditPalette,
NPalettes
};
+ enum Font {
+ SystemFont,
+ MenuFont,
+ MenuBarFont,
+ MenuItemFont,
+ MessageBoxFont,
+ LabelFont,
+ TipLabelFont,
+ StatusBarFont,
+ TitleBarFont,
+ MdiSubWindowTitleFont,
+ DockWidgetTitleFont,
+ PushButtonFont,
+ ToolButtonFont,
+ ItemViewFont,
+ ListViewFont,
+ HeaderViewFont,
+ ListBoxFont,
+ ComboMenuItemFont,
+ ComboLineEditFont,
+ SmallFont,
+ MiniFont,
+ NFonts
+ };
+
enum KeyboardSchemes
{
WindowsKeyboardScheme,
@@ -99,6 +138,8 @@ public:
CdeKeyboardScheme
};
+ virtual ~QPlatformTheme();
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
@@ -107,6 +148,8 @@ public:
virtual const QPalette *palette(Palette type = SystemPalette) const;
+ virtual const QFont *font(Font type = SystemFont) const;
+
virtual QVariant themeHint(ThemeHint hint) const;
};
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 40a4ec07a6..5b77d97950 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -43,6 +43,7 @@
#include "private/qguiapplication_p.h"
#include "private/qtouchdevice_p.h"
#include <QAbstractEventDispatcher>
+#include <QPlatformDrag>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -447,14 +448,14 @@ int QWindowSystemInterface::windowSystemEventsQueued()
return QWindowSystemInterfacePrivate::windowSystemEventsQueued();
}
-Qt::DropAction QWindowSystemInterface::handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- return QGuiApplicationPrivate::processDrag(w, dropData, p);
+ return QGuiApplicationPrivate::processDrag(w, dropData, p,supportedActions);
}
-Qt::DropAction QWindowSystemInterface::handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- return QGuiApplicationPrivate::processDrop(w, dropData, p);
+ return QGuiApplicationPrivate::processDrop(w, dropData, p,supportedActions);
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 836fb40bd7..6dae11ea81 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE
class QMimeData;
class QTouchDevice;
+class QPlatformDragQtResponse;
+class QPlatformDropQtResponse;
class Q_GUI_EXPORT QWindowSystemInterface
@@ -122,8 +124,8 @@ public:
static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion &region);
// Drag and drop. These events are sent immediately.
- static Qt::DropAction handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
- static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
+ static QPlatformDropQtResponse handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);