summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/animation/qabstractanimation.cpp12
-rw-r--r--src/corelib/global/qnamespace.h97
-rw-r--r--src/corelib/global/qnamespace.qdoc92
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp184
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp7
-rw-r--r--src/gui/kernel/qapplication.h4
-rw-r--r--src/gui/kernel/qapplication_p.h3
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp6
-rw-r--r--src/gui/kernel/qclipboard_mac.cpp2
-rw-r--r--src/gui/kernel/qclipboard_win.cpp4
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp9
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm7
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp9
-rw-r--r--src/gui/kernel/qevent.cpp84
-rw-r--r--src/gui/kernel/qevent.h5
-rw-r--r--src/gui/kernel/qgesture.cpp44
-rw-r--r--src/gui/kernel/qgesture.h10
-rw-r--r--src/gui/kernel/qgesture_p.h9
-rw-r--r--src/gui/kernel/qgesturemanager.cpp290
-rw-r--r--src/gui/kernel/qgesturemanager_p.h31
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp4
-rw-r--r--src/gui/kernel/qgesturerecognizer.h4
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp286
-rw-r--r--src/gui/kernel/qkeysequence.cpp174
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm19
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h2
-rw-r--r--src/gui/kernel/qwidget.cpp16
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_win.cpp3
-rw-r--r--src/gui/painting/qbackingstore.cpp12
-rw-r--r--src/gui/styles/qgtkstyle.cpp43
-rw-r--r--src/gui/styles/qmacstyle_mac.mm19
-rw-r--r--src/gui/styles/qstyleoption.cpp113
-rw-r--r--src/gui/styles/qstyleoption.h20
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp5
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp53
-rw-r--r--src/gui/widgets/qtabbar.cpp19
-rw-r--r--src/gui/widgets/qtabbar_p.h10
-rw-r--r--src/gui/widgets/qtabwidget.cpp16
-rw-r--r--src/opengl/qwindowsurface_gl.cpp5
-rw-r--r--tests/auto/gestures/tst_gestures.cpp212
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp22
-rw-r--r--tests/auto/qmouseevent/tst_qmouseevent.cpp75
-rw-r--r--tests/manual/gestures/graphicsview/main.cpp4
-rw-r--r--tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp2
-rw-r--r--tests/manual/gestures/scrollarea/mousepangesturerecognizer.h2
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp1
50 files changed, 1646 insertions, 413 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index b8b9214..a4c7e29 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -157,19 +157,7 @@
#ifndef QT_NO_ANIMATION
#define DEFAULT_TIMER_INTERVAL 16
-
-#ifdef Q_WS_WIN
- /// Fix for Qt 4.7
- //on windows if you're currently dragging a widget an inner eventloop was started by the system
- //to make sure that this timer is getting fired, we need to make sure to use the system timers
- //that will send a WM_TIMER event. We do that by settings the timer interval to 11
- //It is 16 because QEventDispatcherWin32Private::registerTimer specifically checks if the interval
- //is greater than 11 to determine if it should use a system timer (or the multimedia timer).
-#define STARTSTOP_TIMER_DELAY 16
-#else
#define STARTSTOP_TIMER_DELAY 0
-#endif
-
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 2b62c6b..aeaca54 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -909,12 +909,10 @@ public:
Key_Dead_Horn = 0x01001262,
// multimedia/internet keys - ignored by default - see QKeyEvent c'tor
-
Key_Back = 0x01000061,
Key_Forward = 0x01000062,
Key_Stop = 0x01000063,
Key_Refresh = 0x01000064,
-
Key_VolumeDown = 0x01000070,
Key_VolumeMute = 0x01000071,
Key_VolumeUp = 0x01000072,
@@ -923,7 +921,6 @@ public:
Key_BassDown = 0x01000075,
Key_TrebleUp = 0x01000076,
Key_TrebleDown = 0x01000077,
-
Key_MediaPlay = 0x01000080,
Key_MediaStop = 0x01000081,
Key_MediaPrevious = 0x01000082,
@@ -932,13 +929,11 @@ public:
#endif
Key_MediaNext = 0x01000083,
Key_MediaRecord = 0x01000084,
-
Key_HomePage = 0x01000090,
Key_Favorites = 0x01000091,
Key_Search = 0x01000092,
Key_Standby = 0x01000093,
Key_OpenUrl = 0x01000094,
-
Key_LaunchMail = 0x010000a0,
Key_LaunchMedia = 0x010000a1,
Key_Launch0 = 0x010000a2,
@@ -957,6 +952,98 @@ public:
Key_LaunchD = 0x010000af,
Key_LaunchE = 0x010000b0,
Key_LaunchF = 0x010000b1,
+ Key_MonBrightnessUp = 0x010000b2,
+ Key_MonBrightnessDown = 0x010000b3,
+ Key_KeyboardLightOnOff = 0x010000b4,
+ Key_KeyboardBrightnessUp = 0x010000b5,
+ Key_KeyboardBrightnessDown = 0x010000b6,
+ Key_PowerOff = 0x010000b7,
+ Key_WakeUp = 0x010000b8,
+ Key_Eject = 0x010000b9,
+ Key_ScreenSaver = 0x010000ba,
+ Key_WWW = 0x010000bb,
+ Key_Memo = 0x010000bc,
+ Key_LightBulb = 0x010000bd,
+ Key_Shop = 0x010000be,
+ Key_History = 0x010000bf,
+ Key_AddFavorite = 0x010000c0,
+ Key_HotLinks = 0x010000c1,
+ Key_BrightnessAdjust = 0x010000c2,
+ Key_Finance = 0x010000c3,
+ Key_Community = 0x010000c4,
+ Key_AudioRewind = 0x010000c5,
+ Key_BackForward = 0x010000c6,
+ Key_ApplicationLeft = 0x010000c7,
+ Key_ApplicationRight = 0x010000c8,
+ Key_Book = 0x010000c9,
+ Key_CD = 0x010000ca,
+ Key_Calculator = 0x010000cb,
+ Key_ToDoList = 0x010000cc,
+ Key_ClearGrab = 0x010000cd,
+ Key_Close = 0x010000ce,
+ Key_Copy = 0x010000cf,
+ Key_Cut = 0x010000d0,
+ Key_Display = 0x010000d1,
+ Key_DOS = 0x010000d2,
+ Key_Documents = 0x010000d3,
+ Key_Excel = 0x010000d4,
+ Key_Explorer = 0x010000d5,
+ Key_Game = 0x010000d6,
+ Key_Go = 0x010000d7,
+ Key_iTouch = 0x010000d8,
+ Key_LogOff = 0x010000d9,
+ Key_Market = 0x010000da,
+ Key_Meeting = 0x010000db,
+ Key_MenuKB = 0x010000dc,
+ Key_MenuPB = 0x010000dd,
+ Key_MySites = 0x010000de,
+ Key_News = 0x010000df,
+ Key_OfficeHome = 0x010000e0,
+ Key_Option = 0x010000e1,
+ Key_Paste = 0x010000e2,
+ Key_Phone = 0x010000e3,
+ Key_Calendar = 0x010000e4,
+ Key_Reply = 0x010000e5,
+ Key_Reload = 0x010000e6,
+ Key_RotateWindows = 0x010000e7,
+ Key_RotationPB = 0x010000e8,
+ Key_RotationKB = 0x010000e9,
+ Key_Save = 0x010000ea,
+ Key_Send = 0x010000eb,
+ Key_Spell = 0x010000ec,
+ Key_SplitScreen = 0x010000ed,
+ Key_Support = 0x010000ee,
+ Key_TaskPane = 0x010000ef,
+ Key_Terminal = 0x010000f0,
+ Key_Tools = 0x010000f1,
+ Key_Travel = 0x010000f2,
+ Key_Video = 0x010000f3,
+ Key_Word = 0x010000f4,
+ Key_Xfer = 0x010000f5,
+ Key_ZoomIn = 0x010000f6,
+ Key_ZoomOut = 0x010000f7,
+ Key_Away = 0x010000f8,
+ Key_Messenger = 0x010000f9,
+ Key_WebCam = 0x010000fa,
+ Key_MailForward = 0x010000fb,
+ Key_Pictures = 0x010000fc,
+ Key_Music = 0x010000fd,
+ Key_Battery = 0x010000fe,
+ Key_Bluetooth = 0x010000ff,
+ Key_WLAN = 0x01000100,
+ Key_UWB = 0x01000101,
+ Key_AudioForward = 0x01000102,
+ Key_AudioRepeat = 0x01000103,
+ Key_AudioRandomPlay = 0x01000104,
+ Key_Subtitle = 0x01000105,
+ Key_AudioCycleTrack = 0x01000106,
+ Key_Time = 0x01000107,
+ Key_Hibernate = 0x01000108,
+ Key_View = 0x01000109,
+ Key_TopMenu = 0x0100010a,
+ Key_PowerDown = 0x0100010b,
+ Key_Suspend = 0x0100010c,
+ Key_ContrastAdjust = 0x0100010d,
Key_MediaLast = 0x0100ffff,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 7e0b933..4e369c9 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1609,6 +1609,98 @@
\value Key_LaunchD
\value Key_LaunchE
\value Key_LaunchF
+ \value Key_MonBrightnessUp
+ \value Key_MonBrightnessDown
+ \value Key_KeyboardLightOnOff
+ \value Key_KeyboardBrightnessUp
+ \value Key_KeyboardBrightnessDown
+ \value Key_PowerOff
+ \value Key_WakeUp
+ \value Key_Eject
+ \value Key_ScreenSaver
+ \value Key_WWW
+ \value Key_Memo
+ \value Key_LightBulb
+ \value Key_Shop
+ \value Key_History
+ \value Key_AddFavorite
+ \value Key_HotLinks
+ \value Key_BrightnessAdjust
+ \value Key_Finance
+ \value Key_Community
+ \value Key_AudioRewind
+ \value Key_BackForward
+ \value Key_ApplicationLeft
+ \value Key_ApplicationRight
+ \value Key_Book
+ \value Key_CD
+ \value Key_Calculator
+ \value Key_ToDoList
+ \value Key_ClearGrab
+ \value Key_Close
+ \value Key_Copy
+ \value Key_Cut
+ \value Key_Display
+ \value Key_DOS
+ \value Key_Documents
+ \value Key_Excel
+ \value Key_Explorer
+ \value Key_Game
+ \value Key_Go
+ \value Key_iTouch
+ \value Key_LogOff
+ \value Key_Market
+ \value Key_Meeting
+ \value Key_MenuKB
+ \value Key_MenuPB
+ \value Key_MySites
+ \value Key_News
+ \value Key_OfficeHome
+ \value Key_Option
+ \value Key_Paste
+ \value Key_Phone
+ \value Key_Calendar
+ \value Key_Reply
+ \value Key_Reload
+ \value Key_RotateWindows
+ \value Key_RotationPB
+ \value Key_RotationKB
+ \value Key_Save
+ \value Key_Send
+ \value Key_Spell
+ \value Key_SplitScreen
+ \value Key_Support
+ \value Key_TaskPane
+ \value Key_Terminal
+ \value Key_Tools
+ \value Key_Travel
+ \value Key_Video
+ \value Key_Word
+ \value Key_Xfer
+ \value Key_ZoomIn
+ \value Key_ZoomOut
+ \value Key_Away
+ \value Key_Messenger
+ \value Key_WebCam
+ \value Key_MailForward
+ \value Key_Pictures
+ \value Key_Music
+ \value Key_Battery
+ \value Key_Bluetooth
+ \value Key_WLAN
+ \value Key_UWB
+ \value Key_AudioForward
+ \value Key_AudioRepeat
+ \value Key_AudioRandomPlay
+ \value Key_Subtitle
+ \value Key_AudioCycleTrack
+ \value Key_Time
+ \value Key_Hibernate
+ \value Key_View
+ \value Key_TopMenu
+ \value Key_PowerDown
+ \value Key_Suspend
+ \value Key_ContrastAdjust
\value Key_MediaLast
\value Key_unknown
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 1e6402f..d13e1d1 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -64,6 +64,15 @@ extern uint qGlobalPostedEventsCount();
# define TIME_KILL_SYNCHRONOUS 0x0100
#endif
+#ifndef QS_RAWINPUT
+# define QS_RAWINPUT 0x0400
+#endif
+
+enum {
+ WM_QT_SOCKETNOTIFIER = WM_USER,
+ WM_QT_SENDPOSTEDEVENTS = WM_USER + 1
+};
+
#if defined(Q_OS_WINCE)
QT_BEGIN_INCLUDE_NAMESPACE
#include <winsock.h>
@@ -327,6 +336,11 @@ public:
// internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd;
+ // for controlling when to send posted events
+ QAtomicInt serialNumber;
+ int lastSerialNumber;
+ QAtomicInt wakeUps;
+
// timers
WinTimerVec timerVec;
WinTimerDict timerDict;
@@ -340,9 +354,6 @@ public:
QSNDict sn_except;
void doWsaAsyncSelect(int socket);
- // event notifier
- QWinEventNotifier wakeUpNotifier;
-
QList<QWinEventNotifier *> winEventNotifierList;
void activateEventNotifier(QWinEventNotifier * wen);
@@ -351,19 +362,13 @@ public:
};
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
- : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0)
+ : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), serialNumber(0), lastSerialNumber(0), wakeUps(0)
{
resolveTimerAPI();
-
- wakeUpNotifier.setHandle(CreateEvent(0, FALSE, FALSE, 0));
- if (!wakeUpNotifier.handle())
- qWarning("QEventDispatcher: Creating QEventDispatcherWin32Private wakeup event failed");
}
QEventDispatcherWin32Private::~QEventDispatcherWin32Private()
{
- wakeUpNotifier.setEnabled(false);
- CloseHandle(wakeUpNotifier.handle());
if (internalHwnd)
DestroyWindow(internalHwnd);
QString className = QLatin1String("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc));
@@ -408,22 +413,35 @@ void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_P
LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
{
- if (message == WM_NCCREATE) {
- return true;
- } else if (message == WM_USER) {
+ if (message == WM_NCCREATE)
+ return true;
- // socket notifier message
- MSG msg;
- msg.hwnd = hwnd;
- msg.message = message;
- msg.wParam = wp;
- msg.lParam = lp;
+ MSG msg;
+ msg.hwnd = hwnd;
+ msg.message = message;
+ msg.wParam = wp;
+ msg.lParam = lp;
+ QCoreApplication *app = QCoreApplication::instance();
+ long result;
+ if (!app) {
+ if (message == WM_TIMER)
+ KillTimer(hwnd, wp);
+ return 0;
+ } else if (app->filterEvent(&msg, &result)) {
+ return result;
+ }
- QCoreApplication *app = QCoreApplication::instance();
- long result;
- if (app && app->filterEvent(&msg, &result))
- return result;
+#ifdef GWLP_USERDATA
+ QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+#else
+ QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA);
+#endif
+ QEventDispatcherWin32Private *d = 0;
+ if (q != 0)
+ d = q->d_func();
+ if (message == WM_QT_SOCKETNOTIFIER) {
+ // socket notifier message
int type = -1;
switch (WSAGETSELECTEVENT(lp)) {
case FD_READ:
@@ -440,56 +458,50 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
break;
}
if (type >= 0) {
-
- #ifdef GWLP_USERDATA
- QEventDispatcherWin32 *eventDispatcher =
- (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- #else
- QEventDispatcherWin32 *eventDispatcher =
- (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA);
- #endif
- if (eventDispatcher) {
- QEventDispatcherWin32Private *d = eventDispatcher->d_func();
- QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };
- QSNDict *dict = sn_vec[type];
-
- QSockNot *sn = dict ? dict->value(wp) : 0;
- if (sn) {
- QEvent event(QEvent::SockAct);
- QCoreApplication::sendEvent(sn->obj, &event);
- }
+ Q_ASSERT(d != 0);
+ QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };
+ QSNDict *dict = sn_vec[type];
+
+ QSockNot *sn = dict ? dict->value(wp) : 0;
+ if (sn) {
+ QEvent event(QEvent::SockAct);
+ QCoreApplication::sendEvent(sn->obj, &event);
}
}
return 0;
-
- } else if (message == WM_TIMER) {
-
- MSG msg;
- msg.hwnd = hwnd;
- msg.message = message;
- msg.wParam = wp;
- msg.lParam = lp;
-
- QCoreApplication *app = QCoreApplication::instance();
- Q_ASSERT_X(app, "qt_interal_proc", "Timer fired, but no QCoreApplication");
- if (!app) {
- KillTimer(hwnd, wp);
- return 0;
+ } else if (message == WM_TIMER) {
+ if (wp == ~0u) {
+ KillTimer(d->internalHwnd, wp);
+ int localSerialNumber = d->serialNumber;
+ (void) d->wakeUps.fetchAndStoreRelease(0);
+ if (localSerialNumber != d->lastSerialNumber) {
+ PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
+ }
+ } else {
+ Q_ASSERT(d != 0);
+ d->sendTimerEvent(wp);
+ }
+ return 0;
+ } else if (message == WM_QT_SENDPOSTEDEVENTS) {
+ int localSerialNumber = d->serialNumber;
+
+ if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) {
+ // delay the next pass of sendPostedEvents() until we get the special
+ // WM_TIMER, which allows all pending Windows messages to be processed
+ SetTimer(d->internalHwnd, ~0u, 0, 0);
+ } else {
+ // nothing pending in the queue, let sendPostedEvents go through
+ d->wakeUps.fetchAndStoreRelease(0);
}
- long result;
- if (app->filterEvent(&msg, &result))
- return result;
-
- QEventDispatcherWin32 *eventDispatcher =
- qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
- Q_ASSERT(eventDispatcher != 0);
- QEventDispatcherWin32Private *d = eventDispatcher->d_func();
- d->sendTimerEvent(wp);
+ if (localSerialNumber != d->lastSerialNumber) {
+ d->lastSerialNumber = localSerialNumber;
+ QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+ }
return 0;
}
- return DefWindowProc(hwnd, message, wp, lp);
+ return DefWindowProc(hwnd, message, wp, lp);
}
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
@@ -538,11 +550,6 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
Q_Q(QEventDispatcherWin32);
int ok = 0;
-
- //in the animation api, we delay the start of the animation
- //for the dock widgets, we need to use a system timer because dragging a native window
- //makes Windows start its own event loop.
- //So if this threshold changes, please change STARTSTOP_TIMER_DELAY in qabstractanimation.cpp accordingly.
if (t->interval > 15 || !t->interval || !qtimeSetEvent) {
ok = 1;
if (!t->interval) // optimization for single-shot-zero-timer
@@ -608,7 +615,7 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket)
sn_event |= FD_OOB;
// BoundsChecker may emit a warning for WSAAsyncSelect when sn_event == 0
// This is a BoundsChecker bug and not a Qt bug
- WSAAsyncSelect(socket, internalHwnd, sn_event ? WM_USER : 0, sn_event);
+ WSAAsyncSelect(socket, internalHwnd, sn_event ? WM_QT_SOCKETNOTIFIER : 0, sn_event);
}
void QEventDispatcherWin32::createInternalHwnd()
@@ -630,6 +637,9 @@ void QEventDispatcherWin32::createInternalHwnd()
// start all normal timers
for (int i = 0; i < d->timerVec.count(); ++i)
d->registerTimer(d->timerVec.at(i));
+
+ // trigger a call to sendPostedEvents()
+ wakeUp();
}
QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent)
@@ -653,9 +663,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
bool canWait;
bool retVal = false;
+ bool seenWM_QT_SENDPOSTEDEVENTS = false;
+ bool needWM_QT_SENDPOSTEDEVENTS = false;
do {
- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
-
DWORD waitRet = 0;
HANDLE pHandles[MAXIMUM_WAIT_OBJECTS - 1];
QVarLengthArray<MSG> processedTimers;
@@ -689,7 +699,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
d->queuedUserInputEvents.append(msg);
}
if (haveMessage && (flags & QEventLoop::ExcludeSocketNotifiers)
- && (msg.message == WM_USER && msg.hwnd == d->internalHwnd)) {
+ && (msg.message == WM_QT_SOCKETNOTIFIER && msg.hwnd == d->internalHwnd)) {
// queue socket events for later processing
haveMessage = false;
d->queuedSocketEvents.append(msg);
@@ -706,7 +716,13 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
}
if (haveMessage) {
- if (msg.message == WM_TIMER) {
+ if (msg.message == WM_QT_SENDPOSTEDEVENTS && !(flags & QEventLoop::EventLoopExec)) {
+ if (seenWM_QT_SENDPOSTEDEVENTS) {
+ needWM_QT_SENDPOSTEDEVENTS = true;
+ continue;
+ }
+ seenWM_QT_SENDPOSTEDEVENTS = true;
+ } else if (msg.message == WM_TIMER) {
// avoid live-lock by keeping track of the timers we've already sent
bool found = false;
for (int i = 0; !found && i < processedTimers.count(); ++i) {
@@ -736,9 +752,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
// still nothing - wait for message or signalled objects
- QThreadData *data = d->threadData;
canWait = (!retVal
- && data->canWait
&& !d->interrupt
&& (flags & QEventLoop::WaitForMoreEvents));
if (canWait) {
@@ -757,6 +771,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
} while (canWait);
+ if (needWM_QT_SENDPOSTEDEVENTS)
+ PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
+
return retVal;
}
@@ -990,7 +1007,11 @@ void QEventDispatcherWin32::activateEventNotifiers()
void QEventDispatcherWin32::wakeUp()
{
Q_D(QEventDispatcherWin32);
- SetEvent(d->wakeUpNotifier.handle());
+ d->serialNumber.ref();
+ if (d->internalHwnd && d->wakeUps.testAndSetAcquire(0, 1)) {
+ // post a WM_QT_SENDPOSTEDEVENTS to this thread if there isn't one already pending
+ PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
+ }
}
void QEventDispatcherWin32::interrupt()
@@ -1003,13 +1024,8 @@ void QEventDispatcherWin32::interrupt()
void QEventDispatcherWin32::flush()
{ }
-
void QEventDispatcherWin32::startingUp()
-{
- Q_D(QEventDispatcherWin32);
-
- if (d->wakeUpNotifier.handle()) d->wakeUpNotifier.setEnabled(true);
-}
+{ }
void QEventDispatcherWin32::closingDown()
{
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index 1660e95..1273d06 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -873,9 +873,11 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
}
case NegativeSign:
case PositiveSign:
+ break;
case AMText:
+ return qt_TDes2QString(TAmPmName(TAmPm(EAm)));
case PMText:
- break;
+ return qt_TDes2QString(TAmPmName(TAmPm(EPm)));
default:
break;
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 85b055e..1ec51da 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -474,9 +474,6 @@ bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
bool QApplicationPrivate::load_testability = false;
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
-bool QApplicationPrivate::inSizeMove = false;
-#endif
#ifdef QT_KEYPAD_NAVIGATION
# ifdef Q_OS_SYMBIAN
Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
@@ -5641,7 +5638,9 @@ Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *reco
*/
void QApplication::unregisterGestureRecognizer(Qt::GestureType type)
{
- QGestureManager::instance()->unregisterGestureRecognizer(type);
+ QApplicationPrivate *d = qApp->d_func();
+ if (d->gestureManager)
+ d->gestureManager->unregisterGestureRecognizer(type);
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 5a8e325..5877ba4 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -288,8 +288,8 @@ public:
static Qt::NavigationMode navigationMode();
#endif
- Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer);
- void unregisterGestureRecognizer(Qt::GestureType type);
+ static Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer);
+ static void unregisterGestureRecognizer(Qt::GestureType type);
Q_SIGNALS:
void lastWindowClosed();
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 65f61e9..0fa7269 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -441,9 +441,6 @@ public:
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- static bool inSizeMove;
-#endif
static void setSystemPalette(const QPalette &pal);
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index e84985e..d98ecbb 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1918,11 +1918,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
#ifndef Q_WS_WINCE
case WM_ENTERSIZEMOVE:
autoCaptureWnd = hwnd;
- QApplicationPrivate::inSizeMove = true;
break;
case WM_EXITSIZEMOVE:
autoCaptureWnd = 0;
- QApplicationPrivate::inSizeMove = false;
break;
#endif
case WM_MOVE: // move window
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 7f11faa..b0ab760 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3752,6 +3752,12 @@ int QApplication::x11ProcessEvent(XEvent* event)
qt_get_net_virtual_roots();
} else if (event->xproperty.atom == ATOM(_NET_WORKAREA)) {
qt_desktopwidget_update_workarea();
+
+ // emit the workAreaResized() signal
+ QDesktopWidget *desktop = QApplication::desktop();
+ int numScreens = desktop->numScreens();
+ for (int i = 0; i < numScreens; ++i)
+ emit desktop->workAreaResized(i);
}
} else if (widget) {
widget->translatePropertyEvent(event);
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index 3db647b..8892269 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -532,7 +532,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
// Try to get the NSStringPboardType from NSPasteboard, newlines are mapped
// correctly (as '\n') in this data. The 'public.utf16-plain-text' type
// usually maps newlines to '\r' instead.
- QString str = qt_mac_get_pasteboardString();
+ QString str = qt_mac_get_pasteboardString(paste);
if (!str.isEmpty())
return str;
}
diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp
index 7f7ef0c..0157052 100644
--- a/src/gui/kernel/qclipboard_win.cpp
+++ b/src/gui/kernel/qclipboard_win.cpp
@@ -51,6 +51,7 @@
#include "qmime.h"
#include "qt_windows.h"
#include "qdnd_p.h"
+#include <private/qwidget_p.h>
QT_BEGIN_NAMESPACE
@@ -140,6 +141,9 @@ public:
clipBoardViewer = new QWidget();
clipBoardViewer->createWinId();
clipBoardViewer->setObjectName(QLatin1String("internal clipboard owner"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(clipBoardViewer);
}
~QClipboardData()
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 9621944..22d7c9e 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -78,6 +78,7 @@
#include "qimagewriter.h"
#include "qvariant.h"
#include "qdnd_p.h"
+#include <private/qwidget_p.h>
#ifndef QT_NO_XFIXES
#include <X11/extensions/Xfixes.h>
@@ -131,6 +132,11 @@ void setupOwner()
requestor = new QWidget(0);
requestor->createWinId();
requestor->setObjectName(QLatin1String("internal clipboard requestor"));
+ // We dont need this internal widgets to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets) {
+ QWidgetPrivate::allWidgets->remove(owner);
+ QWidgetPrivate::allWidgets->remove(requestor);
+ }
qAddPostRoutine(cleanup);
}
@@ -769,6 +775,9 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property,
delete requestor;
requestor = new QWidget(0);
requestor->setObjectName(QLatin1String("internal clipboard requestor"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(requestor);
return QByteArray();
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index ecc6bc9..a16d1f8 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -745,7 +745,7 @@ extern "C" {
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::LeftButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
if (!mouseOK)
[super mouseDragged:theEvent];
@@ -755,7 +755,7 @@ extern "C" {
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::RightButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
if (!mouseOK)
[super rightMouseDragged:theEvent];
@@ -765,8 +765,7 @@ extern "C" {
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, mouseButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
if (!mouseOK)
[super otherMouseDragged:theEvent];
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 02a2c82..14eb976 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -384,10 +384,8 @@ void QDesktopWidget::resizeEvent(QResizeEvent *event)
Q_D(QDesktopWidget);
int oldScreenCount = d->screenCount;
QVector<QRect> oldRects(oldScreenCount);
- QVector<QRect> oldWorks(oldScreenCount);
for (int i = 0; i < oldScreenCount; ++i) {
oldRects[i] = d->rects[i];
- oldWorks[i] = d->workareas[i];
}
d->init();
@@ -397,13 +395,6 @@ void QDesktopWidget::resizeEvent(QResizeEvent *event)
emit resized(i);
}
- // ### workareas are just reset by init, not filled with new values
- // ### so this will not work correctly
- for (int j = 0; j < qMin(oldScreenCount, d->screenCount); ++j) {
- if (oldWorks.at(j) != d->workareas[j])
- emit workAreaResized(j);
- }
-
if (oldScreenCount != d->screenCount) {
emit screenCountChanged(d->screenCount);
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 065bd09..ab43e79 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4262,7 +4262,12 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const
*/
QList<QGesture *> QGestureEvent::activeGestures() const
{
- return d_func()->gestures;
+ QList<QGesture *> gestures;
+ foreach (QGesture *gesture, d_func()->gestures) {
+ if (gesture->state() != Qt::GestureCanceled)
+ gestures.append(gesture);
+ }
+ return gestures;
}
/*!
@@ -4270,7 +4275,12 @@ QList<QGesture *> QGestureEvent::activeGestures() const
*/
QList<QGesture *> QGestureEvent::canceledGestures() const
{
- return d_func()->gestures;
+ QList<QGesture *> gestures;
+ foreach (QGesture *gesture, d_func()->gestures) {
+ if (gesture->state() == Qt::GestureCanceled)
+ gestures.append(gesture);
+ }
+ return gestures;
}
/*!
@@ -4288,9 +4298,8 @@ QList<QGesture *> QGestureEvent::canceledGestures() const
*/
void QGestureEvent::setAccepted(QGesture *gesture, bool value)
{
- setAccepted(false);
if (gesture)
- d_func()->accepted[gesture->gestureType()] = value;
+ setAccepted(gesture->gestureType(), value);
}
/*!
@@ -4304,7 +4313,8 @@ void QGestureEvent::setAccepted(QGesture *gesture, bool value)
*/
void QGestureEvent::accept(QGesture *gesture)
{
- setAccepted(gesture, true);
+ if (gesture)
+ setAccepted(gesture->gestureType(), true);
}
/*!
@@ -4318,7 +4328,8 @@ void QGestureEvent::accept(QGesture *gesture)
*/
void QGestureEvent::ignore(QGesture *gesture)
{
- setAccepted(gesture, false);
+ if (gesture)
+ setAccepted(gesture->gestureType(), false);
}
/*!
@@ -4326,10 +4337,69 @@ void QGestureEvent::ignore(QGesture *gesture)
*/
bool QGestureEvent::isAccepted(QGesture *gesture) const
{
- return gesture ? d_func()->accepted.value(gesture->gestureType(), true) : false;
+ return gesture ? isAccepted(gesture->gestureType()) : false;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType object to the specified
+ \a value.
+
+ Setting the accept flag indicates that the event receiver wants the \a gesture.
+ Unwanted gestures may be propagated to the parent widget.
+
+ By default, gestures in events of type QEvent::Gesture are accepted, and
+ gestures in QEvent::GestureOverride events are ignored.
+
+ For convenience, the accept flag can also be set with
+ \l{QGestureEvent::accept()}{accept(gestureType)}, and cleared with
+ \l{QGestureEvent::ignore()}{ignore(gestureType)}.
+*/
+void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
+{
+ setAccepted(false);
+ d_func()->accepted[gestureType] = value;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType, the equivalent of calling
+ \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, true)}.
+
+ Setting the accept flag indicates that the event receiver wants the
+ gesture. Unwanted gestures may be propagated to the parent widget.
+
+ \sa QGestureEvent::ignore()
+*/
+void QGestureEvent::accept(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, true);
}
/*!
+ Clears the accept flag parameter of the given \a gestureType, the equivalent
+ of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}.
+
+ Clearing the accept flag indicates that the event receiver does not
+ want the gesture. Unwanted gestures may be propgated to the parent widget.
+
+ \sa QGestureEvent::accept()
+*/
+void QGestureEvent::ignore(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, false);
+}
+
+/*!
+ Returns true if the gesture of type \a gestureType is accepted; otherwise
+ returns false.
+*/
+bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
+{
+ return d_func()->accepted.value(gestureType, true);
+}
+
+/*!
+ \internal
+
Sets the widget for this event.
*/
void QGestureEvent::setWidget(QWidget *widget)
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index b7370fd..fb245c0 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -851,6 +851,11 @@ public:
void ignore(QGesture *);
bool isAccepted(QGesture *) const;
+ void setAccepted(Qt::GestureType, bool);
+ void accept(Qt::GestureType);
+ void ignore(Qt::GestureType);
+ bool isAccepted(Qt::GestureType) const;
+
void setWidget(QWidget *widget);
QWidget *widget() const;
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index a161876..850f22c 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -69,10 +69,9 @@ QT_BEGIN_NAMESPACE
\section1 Lifecycle of a Gesture Object
- A QGesture instance is created when the application calls QWidget::grabGesture()
- or QGraphicsObject::grabGesture() to configure a widget or graphics object (the
- target object) for gesture input. One gesture object is created for each target
- object.
+ A QGesture instance is implicitly created when needed and is owned by Qt.
+ Developers should never destroy them or store them for later use as Qt may
+ destroy particular instances of them and create new ones to replace them.
The registered gesture recognizer monitors the input events for the target
object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the
@@ -133,8 +132,8 @@ QGesture::~QGesture()
QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a
local hot-spot.
- If the hot-spot is not set, the targetObject is used as the receiver of the
- gesture event.
+ The hot-spot should be set by the gesture recognizer to allow gesture event
+ delivery to a QGraphicsObject.
*/
/*!
@@ -175,6 +174,29 @@ void QGesture::unsetHotSpot()
}
/*!
+ \enum QGesture::GestureCancelPolicy
+
+ This enum describes how accepting a gesture can cancel other gestures
+ automatically.
+
+ \value CancelNone On accepting this gesture no other gestures will be affected.
+ \value CancelAllInContext On accepting this gesture all gestures that are active
+ in the context (Qt::GestureContext) will be cancelled.
+*/
+
+void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy)
+{
+ Q_D(QGesture);
+ d->gestureCancelPolicy = static_cast<uint>(policy);
+}
+
+QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const
+{
+ Q_D(const QGesture);
+ return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy);
+}
+
+/*!
\class QPanGesture
\since 4.6
\brief The QPanGesture class describes a panning gesture made by the user.
@@ -195,6 +217,16 @@ void QGesture::unsetHotSpot()
*/
/*!
+ \property QGesture::GestureCancelPolicy
+ \brief the policy for deciding what happens on accepting a gesture
+
+ On accepting one gesture Qt can automatically cancel other gestures
+ that belong to other targets. The policy is normally set to not cancel
+ any other gestures and can be set to cancel all active gestures in the
+ context. For example for all child widgets.
+*/
+
+/*!
\property QPanGesture::lastOffset
\brief the last offset recorded for this gesture
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 6469959..524d26e 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -65,6 +65,7 @@ class Q_GUI_EXPORT QGesture : public QObject
Q_PROPERTY(Qt::GestureState state READ state)
Q_PROPERTY(Qt::GestureType gestureType READ gestureType)
+ Q_PROPERTY(QGesture::GestureCancelPolicy gestureCancelPolicy READ gestureCancelPolicy WRITE setGestureCancelPolicy)
Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
@@ -81,6 +82,14 @@ public:
bool hasHotSpot() const;
void unsetHotSpot();
+ enum GestureCancelPolicy {
+ CancelNone = 0,
+ CancelAllInContext
+ };
+
+ void setGestureCancelPolicy(GestureCancelPolicy policy);
+ GestureCancelPolicy gestureCancelPolicy() const;
+
protected:
QGesture(QGesturePrivate &dd, QObject *parent);
@@ -208,6 +217,7 @@ public:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
QT_END_HEADER
#endif // QGESTURE_H
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 975c0c9..34fbb26 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -67,16 +67,17 @@ class QGesturePrivate : public QObjectPrivate
public:
QGesturePrivate()
- : gestureType(Qt::CustomGesture), state(Qt::NoGesture), isHotSpotSet(false),
- targetObject(0)
+ : gestureType(Qt::CustomGesture), state(Qt::NoGesture),
+ isHotSpotSet(false), gestureCancelPolicy(0)
+
{
}
Qt::GestureType gestureType;
Qt::GestureState state;
QPointF hotSpot;
- bool isHotSpotSet;
- QObject *targetObject;
+ uint isHotSpotSet : 1;
+ uint gestureCancelPolicy : 2;
};
class QPanGesturePrivate : public QGesturePrivate
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index ed8e744..f1abc89 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
QGestureManager::QGestureManager(QObject *parent)
- : QObject(parent), state(NotGesture), lastCustomGestureId(0)
+ : QObject(parent), state(NotGesture), m_lastCustomGestureId(0)
{
qRegisterMetaType<Qt::GestureState>();
@@ -82,7 +82,12 @@ QGestureManager::QGestureManager(QObject *parent)
QGestureManager::~QGestureManager()
{
-
+ qDeleteAll(m_recognizers.values());
+ foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) {
+ qDeleteAll(m_obsoleteGestures.value(recognizer));
+ delete recognizer;
+ }
+ m_obsoleteGestures.clear();
}
Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)
@@ -96,20 +101,55 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
Qt::GestureType type = dummy->gestureType();
if (type == Qt::CustomGesture) {
// generate a new custom gesture id
- ++lastCustomGestureId;
- type = Qt::GestureType(Qt::CustomGesture + lastCustomGestureId);
+ ++m_lastCustomGestureId;
+ type = Qt::GestureType(Qt::CustomGesture + m_lastCustomGestureId);
}
- recognizers.insertMulti(type, recognizer);
+ m_recognizers.insertMulti(type, recognizer);
delete dummy;
return type;
}
-void QGestureManager::unregisterGestureRecognizer(Qt::GestureType)
+void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
{
+ QList<QGestureRecognizer *> list = m_recognizers.values(type);
+ m_recognizers.remove(type);
+ foreach (QGesture *g, m_gestureToRecognizer.keys()) {
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
+ if (list.contains(recognizer)) {
+ m_deletedRecognizers.insert(g, recognizer);
+ m_gestureToRecognizer.remove(g);
+ }
+ }
+ foreach (QGestureRecognizer *recognizer, list) {
+ QList<QGesture *> obsoleteGestures;
+ QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type)
+ obsoleteGestures << iter.value();
+ ++iter;
+ }
+ m_obsoleteGestures.insert(recognizer, obsoleteGestures);
+ }
}
-QGesture *QGestureManager::getState(QObject *object, Qt::GestureType type)
+void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType type)
+{
+ QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type && target == objectGesture.object.data()) {
+ qDeleteAll(iter.value());
+ iter = m_objectGestures.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+}
+
+// get or create a QGesture object that will represent the state for a given object, used by the recognizer
+QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type)
{
// if the widget is being deleted we should be carefull and not to
// create a new state, as it will create QWeakPointer which doesnt work
@@ -123,31 +163,35 @@ QGesture *QGestureManager::getState(QObject *object, Qt::GestureType type)
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
}
- QGesture *state =
- objectGestures.value(QGestureManager::ObjectGesture(object, type));
- if (!state) {
- QGestureRecognizer *recognizer = recognizers.value(type);
- if (recognizer) {
- state = recognizer->createGesture(object);
- if (!state)
- return 0;
- if (state->gestureType() == Qt::CustomGesture) {
- // if the recognizer didn't fill in the gesture type, then this
- // is a custom gesture with autogenerated it and we fill it.
- state->d_func()->gestureType = type;
+ QList<QGesture *> states =
+ m_objectGestures.value(QGestureManager::ObjectGesture(object, type));
+ // check if the QGesture for this recognizer has already been created
+ foreach (QGesture *state, states) {
+ if (m_gestureToRecognizer.value(state) == recognizer)
+ return state;
+ }
+
+ Q_ASSERT(recognizer);
+ QGesture *state = recognizer->createGesture(object);
+ if (!state)
+ return 0;
+ state->setParent(this);
+ if (state->gestureType() == Qt::CustomGesture) {
+ // if the recognizer didn't fill in the gesture type, then this
+ // is a custom gesture with autogenerated id and we fill it.
+ state->d_func()->gestureType = type;
#if defined(GESTURE_DEBUG)
- state->setObjectName(QString::number((int)type));
+ state->setObjectName(QString::number((int)type));
#endif
- }
- objectGestures.insert(QGestureManager::ObjectGesture(object, type), state);
- gestureToRecognizer[state] = recognizer;
- gestureOwners[state] = object;
- }
}
+ m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);
+ m_gestureToRecognizer[state] = recognizer;
+ m_gestureOwners[state] = object;
+
return state;
}
-bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
+bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
Qt::GestureType> &contexts,
QEvent *event)
{
@@ -160,61 +204,63 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
// TODO: sort contexts by the gesture type and check if one of the contexts
// is already active.
+ bool ret = false;
+
// filter the event through recognizers
- typedef QMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;
+ typedef QHash<QObject *, Qt::GestureType>::const_iterator ContextIterator;
for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) {
Qt::GestureType gestureType = cit.value();
QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
- rit = recognizers.lowerBound(gestureType),
- re = recognizers.upperBound(gestureType);
+ rit = m_recognizers.lowerBound(gestureType),
+ re = m_recognizers.upperBound(gestureType);
for (; rit != re; ++rit) {
QGestureRecognizer *recognizer = rit.value();
QObject *target = cit.key();
- QGesture *state = getState(target, gestureType);
+ QGesture *state = getState(target, recognizer, gestureType);
if (!state)
continue;
QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event);
QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask;
if (type == QGestureRecognizer::GestureTriggered) {
- DEBUG() << "QGestureManager: gesture triggered: " << state;
+ DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state;
triggeredGestures << state;
} else if (type == QGestureRecognizer::GestureFinished) {
- DEBUG() << "QGestureManager: gesture finished: " << state;
+ DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state;
finishedGestures << state;
} else if (type == QGestureRecognizer::MaybeGesture) {
- DEBUG() << "QGestureManager: maybe gesture: " << state;
+ DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state;
newMaybeGestures << state;
} else if (type == QGestureRecognizer::NotGesture) {
- DEBUG() << "QGestureManager: not gesture: " << state;
+ DEBUG() << "QGestureManager:Recognizer: not gesture: " << state;
notGestures << state;
} else if (type == QGestureRecognizer::Ignore) {
- DEBUG() << "QGestureManager: gesture ignored the event: " << state;
+ DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state;
} else {
- DEBUG() << "QGestureManager: hm, lets assume the recognizer"
+ DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer"
<< "ignored the event: " << state;
}
if (result & QGestureRecognizer::ConsumeEventHint) {
DEBUG() << "QGestureManager: we were asked to consume the event: "
<< state;
- //TODO: consume events if asked
+ ret = true;
}
}
}
- QSet<QGesture *> startedGestures = triggeredGestures - activeGestures;
- triggeredGestures &= activeGestures;
+ QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
+ triggeredGestures &= m_activeGestures;
// check if a running gesture switched back to maybe state
- QSet<QGesture *> activeToMaybeGestures = activeGestures & newMaybeGestures;
+ QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
// check if a running gesture switched back to not gesture state,
// i.e. were canceled
- QSet<QGesture *> activeToCancelGestures = activeGestures & notGestures;
+ QSet<QGesture *> activeToCancelGestures = m_activeGestures & notGestures;
canceledGestures += activeToCancelGestures;
// start timers for new gestures in maybe state
foreach (QGesture *state, newMaybeGestures) {
- QBasicTimer &timer = maybeGestures[state];
+ QBasicTimer &timer = m_maybeGestures[state];
if (!timer.isActive())
timer.start(3000, this);
}
@@ -223,11 +269,11 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
| finishedGestures | canceledGestures
| notGestures);
foreach(QGesture *gesture, notMaybeGestures) {
- QMap<QGesture *, QBasicTimer>::iterator it =
- maybeGestures.find(gesture);
- if (it != maybeGestures.end()) {
+ QHash<QGesture *, QBasicTimer>::iterator it =
+ m_maybeGestures.find(gesture);
+ if (it != m_maybeGestures.end()) {
it.value().stop();
- maybeGestures.erase(it);
+ m_maybeGestures.erase(it);
}
}
@@ -238,7 +284,7 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
Q_ASSERT((finishedGestures & canceledGestures).isEmpty());
Q_ASSERT((canceledGestures & newMaybeGestures).isEmpty());
- QSet<QGesture *> notStarted = finishedGestures - activeGestures;
+ QSet<QGesture *> notStarted = finishedGestures - m_activeGestures;
if (!notStarted.isEmpty()) {
// there are some gestures that claim to be finished, but never started.
// probably those are "singleshot" gestures so we'll fake the started state.
@@ -249,12 +295,12 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
finishedGestures -= undeliveredGestures;
}
- activeGestures += startedGestures;
+ m_activeGestures += startedGestures;
// sanity check: all triggered gestures should already be in active gestures list
- Q_ASSERT((activeGestures & triggeredGestures).size() == triggeredGestures.size());
- activeGestures -= finishedGestures;
- activeGestures -= activeToMaybeGestures;
- activeGestures -= canceledGestures;
+ Q_ASSERT((m_activeGestures & triggeredGestures).size() == triggeredGestures.size());
+ m_activeGestures -= finishedGestures;
+ m_activeGestures -= activeToMaybeGestures;
+ m_activeGestures -= canceledGestures;
// set the proper gesture state on each gesture
foreach (QGesture *gesture, startedGestures)
@@ -268,12 +314,12 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
foreach (QGesture *gesture, activeToMaybeGestures)
gesture->d_func()->state = Qt::GestureFinished;
- if (!activeGestures.isEmpty() || !maybeGestures.isEmpty() ||
+ if (!m_activeGestures.isEmpty() || !m_maybeGestures.isEmpty() ||
!startedGestures.isEmpty() || !triggeredGestures.isEmpty() ||
!finishedGestures.isEmpty() || !canceledGestures.isEmpty()) {
- DEBUG() << "QGestureManager::filterEvent:"
- << "\n\tactiveGestures:" << activeGestures
- << "\n\tmaybeGestures:" << maybeGestures.keys()
+ DEBUG() << "QGestureManager::filterEventThroughContexts:"
+ << "\n\tactiveGestures:" << m_activeGestures
+ << "\n\tmaybeGestures:" << m_maybeGestures.keys()
<< "\n\tstarted:" << startedGestures
<< "\n\ttriggered:" << triggeredGestures
<< "\n\tfinished:" << finishedGestures
@@ -284,24 +330,114 @@ bool QGestureManager::filterEventThroughContexts(const QMap<QObject *,
deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures,
&undeliveredGestures);
- activeGestures -= undeliveredGestures;
+ foreach (QGesture *g, startedGestures) {
+ if (undeliveredGestures.contains(g))
+ continue;
+ if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
+ DEBUG() << "lets try to cancel some";
+ // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
+ cancelGesturesForChildren(g);
+ }
+ }
+
+ m_activeGestures -= undeliveredGestures;
// reset gestures that ended
QSet<QGesture *> endedGestures =
finishedGestures + canceledGestures + undeliveredGestures;
foreach (QGesture *gesture, endedGestures) {
- if (QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0)) {
+ if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0)) {
+ gesture->setGestureCancelPolicy(QGesture::CancelNone);
recognizer->reset(gesture);
+ } else {
+ cleanupGesturesForRemovedRecognizer(gesture);
+ }
+ m_gestureTargets.remove(gesture);
+ }
+ return ret;
+}
+
+// Cancel all gestures of children of the widget that original is associated with
+void QGestureManager::cancelGesturesForChildren(QGesture *original)
+{
+ Q_ASSERT(original);
+ QWidget *originatingWidget = m_gestureTargets.value(original);
+ Q_ASSERT(originatingWidget);
+
+ // iterate over all active gestures and all maybe gestures
+ // for each find the owner
+ // if the owner is part of our sub-hierarchy, cancel it.
+
+ QSet<QGesture*> cancelledGestures;
+ QSet<QGesture*>::Iterator iter = m_activeGestures.begin();
+ while (iter != m_activeGestures.end()) {
+ QWidget *widget = m_gestureTargets.value(*iter);
+ // note that we don't touch the gestures for our originatingWidget
+ if (widget != originatingWidget && originatingWidget->isAncestorOf(widget)) {
+ DEBUG() << " found a gesture to cancel" << (*iter);
+ (*iter)->d_func()->state = Qt::GestureCanceled;
+ cancelledGestures << *iter;
+ iter = m_activeGestures.erase(iter);
+ } else {
+ ++iter;
}
- gestureTargets.remove(gesture);
}
- return false;
+
+ // TODO handle 'maybe' gestures too
+
+ // sort them per target widget by cherry picking from almostCanceledGestures and delivering
+ QSet<QGesture *> almostCanceledGestures = cancelledGestures;
+ while (!almostCanceledGestures.isEmpty()) {
+ QWidget *target = 0;
+ QSet<QGesture*> gestures;
+ iter = almostCanceledGestures.begin();
+ // sort per target widget
+ while (iter != almostCanceledGestures.end()) {
+ QWidget *widget = m_gestureTargets.value(*iter);
+ if (target == 0)
+ target = widget;
+ if (target == widget) {
+ gestures << *iter;
+ iter = almostCanceledGestures.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+ Q_ASSERT(target);
+
+ QSet<QGesture*> undeliveredGestures;
+ deliverEvents(gestures, &undeliveredGestures);
+ }
+
+ for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) {
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(*iter, 0);
+ if (recognizer) {
+ (*iter)->setGestureCancelPolicy(QGesture::CancelNone);
+ recognizer->reset(*iter);
+ } else {
+ cleanupGesturesForRemovedRecognizer(*iter);
+ }
+ }
+}
+
+void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
+{
+ QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);
+ Q_ASSERT(recognizer);
+ m_deletedRecognizers.remove(gesture);
+ if (m_deletedRecognizers.keys(recognizer).isEmpty()) {
+ // no more active gestures, cleanup!
+ qDeleteAll(m_obsoleteGestures.value(recognizer));
+ m_obsoleteGestures.remove(recognizer);
+ delete recognizer;
+ }
}
+// return true if accepted (consumed)
bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
{
QSet<Qt::GestureType> types;
- QMap<QObject *, Qt::GestureType> contexts;
+ QMultiHash<QObject *, Qt::GestureType> contexts;
QWidget *w = receiver;
typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
@@ -334,7 +470,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
{
QSet<Qt::GestureType> types;
- QMap<QObject *, Qt::GestureType> contexts;
+ QMultiHash<QObject *, Qt::GestureType> contexts;
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator;
@@ -352,8 +488,10 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
if (it.value() == Qt::ItemWithChildrenGesture) {
- if (!types.contains(it.key()))
+ if (!types.contains(it.key())) {
+ types.insert(it.key());
contexts.insertMulti(item, it.key());
+ }
}
}
item = item->parentObject();
@@ -363,7 +501,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
bool QGestureManager::filterEvent(QGesture *state, QEvent *event)
{
- QMap<QObject *, Qt::GestureType> contexts;
+ QMultiHash<QObject *, Qt::GestureType> contexts;
contexts.insert(state, state->gestureType());
return filterEventThroughContexts(contexts, event);
}
@@ -377,7 +515,7 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
// sort gestures by types
foreach (QGesture *gesture, gestures) {
- QWidget *receiver = gestureTargets.value(gesture, 0);
+ QWidget *receiver = m_gestureTargets.value(gesture, 0);
Q_ASSERT(receiver);
gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
}
@@ -426,7 +564,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
for (QSet<QGesture *>::const_iterator it = gestures.begin(),
e = gestures.end(); it != e; ++it) {
QGesture *gesture = *it;
- QWidget *target = gestureTargets.value(gesture, 0);
+ QWidget *target = m_gestureTargets.value(gesture, 0);
if (!target) {
// the gesture has just started and doesn't have a target yet.
Q_ASSERT(gesture->state() == Qt::GestureStarted);
@@ -438,12 +576,12 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
}
} else {
// or use the context of the gesture
- QObject *context = gestureOwners.value(gesture, 0);
+ QObject *context = m_gestureOwners.value(gesture, 0);
if (context->isWidgetType())
target = static_cast<QWidget *>(context);
}
if (target)
- gestureTargets.insert(gesture, target);
+ m_gestureTargets.insert(gesture, target);
}
Qt::GestureType gestureType = gesture->gestureType();
@@ -495,7 +633,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
QList<QGesture *> &gestures = normalStartedGestures[w];
gestures.append(gesture);
// override the target
- gestureTargets[gesture] = w;
+ m_gestureTargets[gesture] = w;
} else {
DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture;
QList<QGesture *> &gestures = normalStartedGestures[receiver];
@@ -518,20 +656,24 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
void QGestureManager::timerEvent(QTimerEvent *event)
{
- QMap<QGesture*, QBasicTimer>::iterator it = maybeGestures.begin(),
- e = maybeGestures.end();
+ QHash<QGesture *, QBasicTimer>::iterator it = m_maybeGestures.begin(),
+ e = m_maybeGestures.end();
for (; it != e; ) {
QBasicTimer &timer = it.value();
Q_ASSERT(timer.isActive());
if (timer.timerId() == event->timerId()) {
timer.stop();
QGesture *gesture = it.key();
- it = maybeGestures.erase(it);
+ it = m_maybeGestures.erase(it);
DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:"
<< gesture;
- QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0);
- if (recognizer)
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
+ if (recognizer) {
+ gesture->setGestureCancelPolicy(QGesture::CancelNone);
recognizer->reset(gesture);
+ } else {
+ cleanupGesturesForRemovedRecognizer(gesture);
+ }
} else {
++it;
}
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index f0e7225..4958cdb 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -79,16 +79,18 @@ public:
// declared in qapplication.cpp
static QGestureManager* instance();
+ void cleanupCachedGestures(QObject *target, Qt::GestureType type);
+
protected:
void timerEvent(QTimerEvent *event);
- bool filterEventThroughContexts(const QMap<QObject *, Qt::GestureType> &contexts,
+ bool filterEventThroughContexts(const QMultiHash<QObject *, Qt::GestureType> &contexts,
QEvent *event);
private:
- QMultiMap<Qt::GestureType, QGestureRecognizer *> recognizers;
+ QMultiMap<Qt::GestureType, QGestureRecognizer *> m_recognizers;
- QSet<QGesture *> activeGestures;
- QMap<QGesture *, QBasicTimer> maybeGestures;
+ QSet<QGesture *> m_activeGestures;
+ QHash<QGesture *, QBasicTimer> m_maybeGestures;
enum State {
Gesture,
@@ -104,7 +106,7 @@ private:
Qt::GestureType gesture;
ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
- inline bool operator<(const ObjectGesture& rhs) const
+ inline bool operator<(const ObjectGesture &rhs) const
{
if (object.data() < rhs.object.data())
return true;
@@ -114,20 +116,27 @@ private:
}
};
- QMap<ObjectGesture, QGesture *> objectGestures;
- QMap<QGesture *, QGestureRecognizer *> gestureToRecognizer;
- QHash<QGesture *, QObject *> gestureOwners;
+ QMap<ObjectGesture, QList<QGesture *> > m_objectGestures;
+ QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
+ QHash<QGesture *, QObject *> m_gestureOwners;
+
+ QHash<QGesture *, QWidget *> m_gestureTargets;
- QHash<QGesture *, QWidget *> gestureTargets;
+ int m_lastCustomGestureId;
- int lastCustomGestureId;
+ QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures;
+ QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
+ void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
- QGesture *getState(QObject *widget, Qt::GestureType gesture);
+ QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
+ Qt::GestureType gesture);
void deliverEvents(const QSet<QGesture *> &gestures,
QSet<QGesture *> *undeliveredGestures);
void getGestureTargets(const QSet<QGesture*> &gestures,
QMap<QWidget *, QList<QGesture *> > *conflicts,
QMap<QWidget *, QList<QGesture *> > *normal);
+
+ void cancelGesturesForChildren(QGesture *originatingGesture);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
index ba3a750..2673be3 100644
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QGestureRecognizer::ResultFlags
+ \enum QGestureRecognizer::ResultFlag
This enum describes the result of the current event filtering step in
a gesture recognizer state machine.
@@ -178,7 +178,7 @@ void QGestureRecognizer::reset(QGesture *gesture)
QGesturePrivate *d = gesture->d_func();
d->state = Qt::NoGesture;
d->hotSpot = QPointF();
- d->targetObject = 0;
+ d->isHotSpotSet = false;
}
}
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
index efd8565..a3c990d 100644
--- a/src/gui/kernel/qgesturerecognizer.h
+++ b/src/gui/kernel/qgesturerecognizer.h
@@ -56,7 +56,7 @@ class QGesture;
class Q_GUI_EXPORT QGestureRecognizer
{
public:
- enum ResultFlags
+ enum ResultFlag
{
Ignore = 0x0001,
NotGesture = 0x0002,
@@ -73,7 +73,7 @@ public:
ResultHint_Mask = 0xff00
};
- Q_DECLARE_FLAGS(Result, ResultFlags)
+ Q_DECLARE_FLAGS(Result, ResultFlag)
QGestureRecognizer();
virtual ~QGestureRecognizer();
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 0ce77fe..8164589 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -714,47 +714,144 @@ extern bool qt_sm_blockUserInput;
#define XK_KP_Delete 0xFF9F
#endif
-// the next lines are taken from XFree > 4.0 (X11/XF86keysyms.h), defining some special
+// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special
// multimedia keys. They are included here as not every system has them.
-#define XF86XK_Standby 0x1008FF10
-#define XF86XK_AudioLowerVolume 0x1008FF11
-#define XF86XK_AudioMute 0x1008FF12
-#define XF86XK_AudioRaiseVolume 0x1008FF13
-#define XF86XK_AudioPlay 0x1008FF14
-#define XF86XK_AudioStop 0x1008FF15
-#define XF86XK_AudioPrev 0x1008FF16
-#define XF86XK_AudioNext 0x1008FF17
-#define XF86XK_HomePage 0x1008FF18
-#define XF86XK_Calculator 0x1008FF1D
-#define XF86XK_Mail 0x1008FF19
-#define XF86XK_Start 0x1008FF1A
-#define XF86XK_Search 0x1008FF1B
-#define XF86XK_AudioRecord 0x1008FF1C
-#define XF86XK_Back 0x1008FF26
-#define XF86XK_Forward 0x1008FF27
-#define XF86XK_Stop 0x1008FF28
-#define XF86XK_Refresh 0x1008FF29
-#define XF86XK_Favorites 0x1008FF30
-#define XF86XK_AudioPause 0x1008FF31
-#define XF86XK_AudioMedia 0x1008FF32
-#define XF86XK_MyComputer 0x1008FF33
-#define XF86XK_OpenURL 0x1008FF38
-#define XF86XK_Launch0 0x1008FF40
-#define XF86XK_Launch1 0x1008FF41
-#define XF86XK_Launch2 0x1008FF42
-#define XF86XK_Launch3 0x1008FF43
-#define XF86XK_Launch4 0x1008FF44
-#define XF86XK_Launch5 0x1008FF45
-#define XF86XK_Launch6 0x1008FF46
-#define XF86XK_Launch7 0x1008FF47
-#define XF86XK_Launch8 0x1008FF48
-#define XF86XK_Launch9 0x1008FF49
-#define XF86XK_LaunchA 0x1008FF4A
-#define XF86XK_LaunchB 0x1008FF4B
-#define XF86XK_LaunchC 0x1008FF4C
-#define XF86XK_LaunchD 0x1008FF4D
-#define XF86XK_LaunchE 0x1008FF4E
-#define XF86XK_LaunchF 0x1008FF4F
+#define XF86XK_MonBrightnessUp 0x1008FF02
+#define XF86XK_MonBrightnessDown 0x1008FF03
+#define XF86XK_KbdLightOnOff 0x1008FF04
+#define XF86XK_KbdBrightnessUp 0x1008FF05
+#define XF86XK_KbdBrightnessDown 0x1008FF06
+#define XF86XK_Standby 0x1008FF10
+#define XF86XK_AudioLowerVolume 0x1008FF11
+#define XF86XK_AudioMute 0x1008FF12
+#define XF86XK_AudioRaiseVolume 0x1008FF13
+#define XF86XK_AudioPlay 0x1008FF14
+#define XF86XK_AudioStop 0x1008FF15
+#define XF86XK_AudioPrev 0x1008FF16
+#define XF86XK_AudioNext 0x1008FF17
+#define XF86XK_HomePage 0x1008FF18
+#define XF86XK_Mail 0x1008FF19
+#define XF86XK_Start 0x1008FF1A
+#define XF86XK_Search 0x1008FF1B
+#define XF86XK_AudioRecord 0x1008FF1C
+#define XF86XK_Calculator 0x1008FF1D
+#define XF86XK_Memo 0x1008FF1E
+#define XF86XK_ToDoList 0x1008FF1F
+#define XF86XK_Calendar 0x1008FF20
+#define XF86XK_PowerDown 0x1008FF21
+#define XF86XK_ContrastAdjust 0x1008FF22
+#define XF86XK_Back 0x1008FF26
+#define XF86XK_Forward 0x1008FF27
+#define XF86XK_Stop 0x1008FF28
+#define XF86XK_Refresh 0x1008FF29
+#define XF86XK_PowerOff 0x1008FF2A
+#define XF86XK_WakeUp 0x1008FF2B
+#define XF86XK_Eject 0x1008FF2C
+#define XF86XK_ScreenSaver 0x1008FF2D
+#define XF86XK_WWW 0x1008FF2E
+#define XF86XK_Sleep 0x1008FF2F
+#define XF86XK_Favorites 0x1008FF30
+#define XF86XK_AudioPause 0x1008FF31
+#define XF86XK_AudioMedia 0x1008FF32
+#define XF86XK_MyComputer 0x1008FF33
+#define XF86XK_LightBulb 0x1008FF35
+#define XF86XK_Shop 0x1008FF36
+#define XF86XK_History 0x1008FF37
+#define XF86XK_OpenURL 0x1008FF38
+#define XF86XK_AddFavorite 0x1008FF39
+#define XF86XK_HotLinks 0x1008FF3A
+#define XF86XK_BrightnessAdjust 0x1008FF3B
+#define XF86XK_Finance 0x1008FF3C
+#define XF86XK_Community 0x1008FF3D
+#define XF86XK_AudioRewind 0x1008FF3E
+#define XF86XK_BackForward 0x1008FF3F
+#define XF86XK_Launch0 0x1008FF40
+#define XF86XK_Launch1 0x1008FF41
+#define XF86XK_Launch2 0x1008FF42
+#define XF86XK_Launch3 0x1008FF43
+#define XF86XK_Launch4 0x1008FF44
+#define XF86XK_Launch5 0x1008FF45
+#define XF86XK_Launch6 0x1008FF46
+#define XF86XK_Launch7 0x1008FF47
+#define XF86XK_Launch8 0x1008FF48
+#define XF86XK_Launch9 0x1008FF49
+#define XF86XK_LaunchA 0x1008FF4A
+#define XF86XK_LaunchB 0x1008FF4B
+#define XF86XK_LaunchC 0x1008FF4C
+#define XF86XK_LaunchD 0x1008FF4D
+#define XF86XK_LaunchE 0x1008FF4E
+#define XF86XK_LaunchF 0x1008FF4F
+#define XF86XK_ApplicationLeft 0x1008FF50
+#define XF86XK_ApplicationRight 0x1008FF51
+#define XF86XK_Book 0x1008FF52
+#define XF86XK_CD 0x1008FF53
+#define XF86XK_Calculater 0x1008FF54
+#define XF86XK_Clear 0x1008FF55
+#define XF86XK_ClearGrab 0x1008FE21
+#define XF86XK_Close 0x1008FF56
+#define XF86XK_Copy 0x1008FF57
+#define XF86XK_Cut 0x1008FF58
+#define XF86XK_Display 0x1008FF59
+#define XF86XK_DOS 0x1008FF5A
+#define XF86XK_Documents 0x1008FF5B
+#define XF86XK_Excel 0x1008FF5C
+#define XF86XK_Explorer 0x1008FF5D
+#define XF86XK_Game 0x1008FF5E
+#define XF86XK_Go 0x1008FF5F
+#define XF86XK_iTouch 0x1008FF60
+#define XF86XK_LogOff 0x1008FF61
+#define XF86XK_Market 0x1008FF62
+#define XF86XK_Meeting 0x1008FF63
+#define XF86XK_MenuKB 0x1008FF65
+#define XF86XK_MenuPB 0x1008FF66
+#define XF86XK_MySites 0x1008FF67
+#define XF86XK_News 0x1008FF69
+#define XF86XK_OfficeHome 0x1008FF6A
+#define XF86XK_Option 0x1008FF6C
+#define XF86XK_Paste 0x1008FF6D
+#define XF86XK_Phone 0x1008FF6E
+#define XF86XK_Reply 0x1008FF72
+#define XF86XK_Reload 0x1008FF73
+#define XF86XK_RotateWindows 0x1008FF74
+#define XF86XK_RotationPB 0x1008FF75
+#define XF86XK_RotationKB 0x1008FF76
+#define XF86XK_Save 0x1008FF77
+#define XF86XK_Send 0x1008FF7B
+#define XF86XK_Spell 0x1008FF7C
+#define XF86XK_SplitScreen 0x1008FF7D
+#define XF86XK_Support 0x1008FF7E
+#define XF86XK_TaskPane 0x1008FF7F
+#define XF86XK_Terminal 0x1008FF80
+#define XF86XK_Tools 0x1008FF81
+#define XF86XK_Travel 0x1008FF82
+#define XF86XK_Video 0x1008FF87
+#define XF86XK_Word 0x1008FF89
+#define XF86XK_Xfer 0x1008FF8A
+#define XF86XK_ZoomIn 0x1008FF8B
+#define XF86XK_ZoomOut 0x1008FF8C
+#define XF86XK_Away 0x1008FF8D
+#define XF86XK_Messenger 0x1008FF8E
+#define XF86XK_WebCam 0x1008FF8F
+#define XF86XK_MailForward 0x1008FF90
+#define XF86XK_Pictures 0x1008FF91
+#define XF86XK_Music 0x1008FF92
+#define XF86XK_Battery 0x1008FF93
+#define XF86XK_Bluetooth 0x1008FF94
+#define XF86XK_WLAN 0x1008FF95
+#define XF86XK_UWB 0x1008FF96
+#define XF86XK_AudioForward 0x1008FF97
+#define XF86XK_AudioRepeat 0x1008FF98
+#define XF86XK_AudioRandomPlay 0x1008FF99
+#define XF86XK_Subtitle 0x1008FF9A
+#define XF86XK_AudioCycleTrack 0x1008FF9B
+#define XF86XK_Time 0x1008FF9F
+#define XF86XK_Select 0x1008FFA0
+#define XF86XK_View 0x1008FFA1
+#define XF86XK_TopMenu 0x1008FFA2
+#define XF86XK_Suspend 0x1008FFA7
+#define XF86XK_Hibernate 0x1008FFA8
+
+
// end of XF86keysyms.h
// Special keys used by Qtopia, mapped into the X11 private keypad range.
@@ -942,10 +1039,8 @@ static const unsigned int KeyTbl[] = {
XK_dead_hook, Qt::Key_Dead_Hook,
XK_dead_horn, Qt::Key_Dead_Horn,
- // Special multimedia keys
- // currently only tested with MS internet keyboard
-
- // browsing keys
+ // Special keys from X.org - This include multimedia keys,
+ // wireless/bluetooth/uwb keys, special launcher keys, etc.
XF86XK_Back, Qt::Key_Back,
XF86XK_Forward, Qt::Key_Forward,
XF86XK_Stop, Qt::Key_Stop,
@@ -955,8 +1050,6 @@ static const unsigned int KeyTbl[] = {
XF86XK_OpenURL, Qt::Key_OpenUrl,
XF86XK_HomePage, Qt::Key_HomePage,
XF86XK_Search, Qt::Key_Search,
-
- // media keys
XF86XK_AudioLowerVolume, Qt::Key_VolumeDown,
XF86XK_AudioMute, Qt::Key_VolumeMute,
XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp,
@@ -965,13 +1058,106 @@ static const unsigned int KeyTbl[] = {
XF86XK_AudioPrev, Qt::Key_MediaPrevious,
XF86XK_AudioNext, Qt::Key_MediaNext,
XF86XK_AudioRecord, Qt::Key_MediaRecord,
-
- // launch keys
XF86XK_Mail, Qt::Key_LaunchMail,
XF86XK_MyComputer, Qt::Key_Launch0,
- XF86XK_Calculator, Qt::Key_Launch1,
+ XF86XK_Calculator, Qt::Key_Calculator,
+ XF86XK_Memo, Qt::Key_Memo,
+ XF86XK_ToDoList, Qt::Key_ToDoList,
+ XF86XK_Calendar, Qt::Key_Calendar,
+ XF86XK_PowerDown, Qt::Key_PowerDown,
+ XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust,
XF86XK_Standby, Qt::Key_Standby,
-
+ XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp,
+ XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown,
+ XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff,
+ XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp,
+ XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown,
+ XF86XK_PowerOff, Qt::Key_PowerOff,
+ XF86XK_WakeUp, Qt::Key_WakeUp,
+ XF86XK_Eject, Qt::Key_Eject,
+ XF86XK_ScreenSaver, Qt::Key_ScreenSaver,
+ XF86XK_WWW, Qt::Key_WWW,
+ XF86XK_Sleep, Qt::Key_Sleep,
+ XF86XK_LightBulb, Qt::Key_LightBulb,
+ XF86XK_Shop, Qt::Key_Shop,
+ XF86XK_History, Qt::Key_History,
+ XF86XK_AddFavorite, Qt::Key_AddFavorite,
+ XF86XK_HotLinks, Qt::Key_HotLinks,
+ XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust,
+ XF86XK_Finance, Qt::Key_Finance,
+ XF86XK_Community, Qt::Key_Community,
+ XF86XK_AudioRewind, Qt::Key_AudioRewind,
+ XF86XK_BackForward, Qt::Key_BackForward,
+ XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft,
+ XF86XK_ApplicationRight, Qt::Key_ApplicationRight,
+ XF86XK_Book, Qt::Key_Book,
+ XF86XK_CD, Qt::Key_CD,
+ XF86XK_Calculater, Qt::Key_Calculator,
+ XF86XK_Clear, Qt::Key_Clear,
+ XF86XK_ClearGrab, Qt::Key_ClearGrab,
+ XF86XK_Close, Qt::Key_Close,
+ XF86XK_Copy, Qt::Key_Copy,
+ XF86XK_Cut, Qt::Key_Cut,
+ XF86XK_Display, Qt::Key_Display,
+ XF86XK_DOS, Qt::Key_DOS,
+ XF86XK_Documents, Qt::Key_Documents,
+ XF86XK_Excel, Qt::Key_Excel,
+ XF86XK_Explorer, Qt::Key_Explorer,
+ XF86XK_Game, Qt::Key_Game,
+ XF86XK_Go, Qt::Key_Go,
+ XF86XK_iTouch, Qt::Key_iTouch,
+ XF86XK_LogOff, Qt::Key_LogOff,
+ XF86XK_Market, Qt::Key_Market,
+ XF86XK_Meeting, Qt::Key_Meeting,
+ XF86XK_MenuKB, Qt::Key_MenuKB,
+ XF86XK_MenuPB, Qt::Key_MenuPB,
+ XF86XK_MySites, Qt::Key_MySites,
+ XF86XK_News, Qt::Key_News,
+ XF86XK_OfficeHome, Qt::Key_OfficeHome,
+ XF86XK_Option, Qt::Key_Option,
+ XF86XK_Paste, Qt::Key_Paste,
+ XF86XK_Phone, Qt::Key_Phone,
+ XF86XK_Reply, Qt::Key_Reply,
+ XF86XK_Reload, Qt::Key_Reload,
+ XF86XK_RotateWindows, Qt::Key_RotateWindows,
+ XF86XK_RotationPB, Qt::Key_RotationPB,
+ XF86XK_RotationKB, Qt::Key_RotationKB,
+ XF86XK_Save, Qt::Key_Save,
+ XF86XK_Send, Qt::Key_Send,
+ XF86XK_Spell, Qt::Key_Spell,
+ XF86XK_SplitScreen, Qt::Key_SplitScreen,
+ XF86XK_Support, Qt::Key_Support,
+ XF86XK_TaskPane, Qt::Key_TaskPane,
+ XF86XK_Terminal, Qt::Key_Terminal,
+ XF86XK_Tools, Qt::Key_Tools,
+ XF86XK_Travel, Qt::Key_Travel,
+ XF86XK_Video, Qt::Key_Video,
+ XF86XK_Word, Qt::Key_Word,
+ XF86XK_Xfer, Qt::Key_Xfer,
+ XF86XK_ZoomIn, Qt::Key_ZoomIn,
+ XF86XK_ZoomOut, Qt::Key_ZoomOut,
+ XF86XK_Away, Qt::Key_Away,
+ XF86XK_Messenger, Qt::Key_Messenger,
+ XF86XK_WebCam, Qt::Key_WebCam,
+ XF86XK_MailForward, Qt::Key_MailForward,
+ XF86XK_Pictures, Qt::Key_Pictures,
+ XF86XK_Music, Qt::Key_Music,
+ XF86XK_Battery, Qt::Key_Battery,
+ XF86XK_Bluetooth, Qt::Key_Bluetooth,
+ XF86XK_WLAN, Qt::Key_WLAN,
+ XF86XK_UWB, Qt::Key_UWB,
+ XF86XK_AudioForward, Qt::Key_AudioForward,
+ XF86XK_AudioRepeat, Qt::Key_AudioRepeat,
+ XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay,
+ XF86XK_Subtitle, Qt::Key_Subtitle,
+ XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack,
+ XF86XK_Time, Qt::Key_Time,
+ XF86XK_Select, Qt::Key_Select,
+ XF86XK_View, Qt::Key_View,
+ XF86XK_TopMenu, Qt::Key_TopMenu,
+ XF86XK_Bluetooth, Qt::Key_Bluetooth,
+ XF86XK_Suspend, Qt::Key_Suspend,
+ XF86XK_Hibernate, Qt::Key_Hibernate,
XF86XK_Launch0, Qt::Key_Launch2,
XF86XK_Launch1, Qt::Key_Launch3,
XF86XK_Launch2, Qt::Key_Launch4,
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index b44ef7f..1a76083 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -416,47 +416,139 @@ static const struct {
{ Qt::Key_Menu, QT_TRANSLATE_NOOP("QShortcut", "Menu") },
{ Qt::Key_Help, QT_TRANSLATE_NOOP("QShortcut", "Help") },
- // Multimedia keys
- { Qt::Key_Back, QT_TRANSLATE_NOOP("QShortcut", "Back") },
- { Qt::Key_Forward, QT_TRANSLATE_NOOP("QShortcut", "Forward") },
- { Qt::Key_Stop, QT_TRANSLATE_NOOP("QShortcut", "Stop") },
- { Qt::Key_Refresh, QT_TRANSLATE_NOOP("QShortcut", "Refresh") },
- { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Volume Down") },
- { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP("QShortcut", "Volume Mute") },
- { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Volume Up") },
- { Qt::Key_BassBoost, QT_TRANSLATE_NOOP("QShortcut", "Bass Boost") },
- { Qt::Key_BassUp, QT_TRANSLATE_NOOP("QShortcut", "Bass Up") },
- { Qt::Key_BassDown, QT_TRANSLATE_NOOP("QShortcut", "Bass Down") },
- { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP("QShortcut", "Treble Up") },
- { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP("QShortcut", "Treble Down") },
- { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP("QShortcut", "Media Play") },
- { Qt::Key_MediaStop, QT_TRANSLATE_NOOP("QShortcut", "Media Stop") },
- { Qt::Key_MediaPrevious,QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
- { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
- { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
- { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
- { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
- { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
- { Qt::Key_Standby, QT_TRANSLATE_NOOP("QShortcut", "Standby") },
- { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP("QShortcut", "Open URL") },
- { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP("QShortcut", "Launch Mail") },
- { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP("QShortcut", "Launch Media") },
- { Qt::Key_Launch0, QT_TRANSLATE_NOOP("QShortcut", "Launch (0)") },
- { Qt::Key_Launch1, QT_TRANSLATE_NOOP("QShortcut", "Launch (1)") },
- { Qt::Key_Launch2, QT_TRANSLATE_NOOP("QShortcut", "Launch (2)") },
- { Qt::Key_Launch3, QT_TRANSLATE_NOOP("QShortcut", "Launch (3)") },
- { Qt::Key_Launch4, QT_TRANSLATE_NOOP("QShortcut", "Launch (4)") },
- { Qt::Key_Launch5, QT_TRANSLATE_NOOP("QShortcut", "Launch (5)") },
- { Qt::Key_Launch6, QT_TRANSLATE_NOOP("QShortcut", "Launch (6)") },
- { Qt::Key_Launch7, QT_TRANSLATE_NOOP("QShortcut", "Launch (7)") },
- { Qt::Key_Launch8, QT_TRANSLATE_NOOP("QShortcut", "Launch (8)") },
- { Qt::Key_Launch9, QT_TRANSLATE_NOOP("QShortcut", "Launch (9)") },
- { Qt::Key_LaunchA, QT_TRANSLATE_NOOP("QShortcut", "Launch (A)") },
- { Qt::Key_LaunchB, QT_TRANSLATE_NOOP("QShortcut", "Launch (B)") },
- { Qt::Key_LaunchC, QT_TRANSLATE_NOOP("QShortcut", "Launch (C)") },
- { Qt::Key_LaunchD, QT_TRANSLATE_NOOP("QShortcut", "Launch (D)") },
- { Qt::Key_LaunchE, QT_TRANSLATE_NOOP("QShortcut", "Launch (E)") },
- { Qt::Key_LaunchF, QT_TRANSLATE_NOOP("QShortcut", "Launch (F)") },
+ // Special keys
+ // Includes multimedia, launcher, lan keys ( bluetooth, wireless )
+ // window navigation
+ { Qt::Key_Back, QT_TRANSLATE_NOOP("QShortcut", "Back") },
+ { Qt::Key_Forward, QT_TRANSLATE_NOOP("QShortcut", "Forward") },
+ { Qt::Key_Stop, QT_TRANSLATE_NOOP("QShortcut", "Stop") },
+ { Qt::Key_Refresh, QT_TRANSLATE_NOOP("QShortcut", "Refresh") },
+ { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Volume Down") },
+ { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP("QShortcut", "Volume Mute") },
+ { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Volume Up") },
+ { Qt::Key_BassBoost, QT_TRANSLATE_NOOP("QShortcut", "Bass Boost") },
+ { Qt::Key_BassUp, QT_TRANSLATE_NOOP("QShortcut", "Bass Up") },
+ { Qt::Key_BassDown, QT_TRANSLATE_NOOP("QShortcut", "Bass Down") },
+ { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP("QShortcut", "Treble Up") },
+ { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP("QShortcut", "Treble Down") },
+ { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP("QShortcut", "Media Play") },
+ { Qt::Key_MediaStop, QT_TRANSLATE_NOOP("QShortcut", "Media Stop") },
+ { Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
+ { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
+ { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
+ { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
+ { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
+ { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
+ { Qt::Key_Standby, QT_TRANSLATE_NOOP("QShortcut", "Standby") },
+ { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP("QShortcut", "Open URL") },
+ { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP("QShortcut", "Launch Mail") },
+ { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP("QShortcut", "Launch Media") },
+ { Qt::Key_Launch0, QT_TRANSLATE_NOOP("QShortcut", "Launch (0)") },
+ { Qt::Key_Launch1, QT_TRANSLATE_NOOP("QShortcut", "Launch (1)") },
+ { Qt::Key_Launch2, QT_TRANSLATE_NOOP("QShortcut", "Launch (2)") },
+ { Qt::Key_Launch3, QT_TRANSLATE_NOOP("QShortcut", "Launch (3)") },
+ { Qt::Key_Launch4, QT_TRANSLATE_NOOP("QShortcut", "Launch (4)") },
+ { Qt::Key_Launch5, QT_TRANSLATE_NOOP("QShortcut", "Launch (5)") },
+ { Qt::Key_Launch6, QT_TRANSLATE_NOOP("QShortcut", "Launch (6)") },
+ { Qt::Key_Launch7, QT_TRANSLATE_NOOP("QShortcut", "Launch (7)") },
+ { Qt::Key_Launch8, QT_TRANSLATE_NOOP("QShortcut", "Launch (8)") },
+ { Qt::Key_Launch9, QT_TRANSLATE_NOOP("QShortcut", "Launch (9)") },
+ { Qt::Key_LaunchA, QT_TRANSLATE_NOOP("QShortcut", "Launch (A)") },
+ { Qt::Key_LaunchB, QT_TRANSLATE_NOOP("QShortcut", "Launch (B)") },
+ { Qt::Key_LaunchC, QT_TRANSLATE_NOOP("QShortcut", "Launch (C)") },
+ { Qt::Key_LaunchD, QT_TRANSLATE_NOOP("QShortcut", "Launch (D)") },
+ { Qt::Key_LaunchE, QT_TRANSLATE_NOOP("QShortcut", "Launch (E)") },
+ { Qt::Key_LaunchF, QT_TRANSLATE_NOOP("QShortcut", "Launch (F)") },
+ { Qt::Key_MonBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Up") },
+ { Qt::Key_MonBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Down") },
+ { Qt::Key_KeyboardLightOnOff, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Light On/Off") },
+ { Qt::Key_KeyboardBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Up") },
+ { Qt::Key_KeyboardBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Down") },
+ { Qt::Key_PowerOff, QT_TRANSLATE_NOOP("QShortcut", "Power Off") },
+ { Qt::Key_WakeUp, QT_TRANSLATE_NOOP("QShortcut", "Wake Up") },
+ { Qt::Key_Eject, QT_TRANSLATE_NOOP("QShortcut", "Eject") },
+ { Qt::Key_ScreenSaver, QT_TRANSLATE_NOOP("QShortcut", "Screensaver") },
+ { Qt::Key_WWW, QT_TRANSLATE_NOOP("QShortcut", "WWW") },
+ { Qt::Key_Sleep, QT_TRANSLATE_NOOP("QShortcut", "Sleep") },
+ { Qt::Key_LightBulb, QT_TRANSLATE_NOOP("QShortcut", "LightBulb") },
+ { Qt::Key_Shop, QT_TRANSLATE_NOOP("QShortcut", "Shop") },
+ { Qt::Key_History, QT_TRANSLATE_NOOP("QShortcut", "History") },
+ { Qt::Key_AddFavorite, QT_TRANSLATE_NOOP("QShortcut", "Add Favorite") },
+ { Qt::Key_HotLinks, QT_TRANSLATE_NOOP("QShortcut", "Hot Links") },
+ { Qt::Key_BrightnessAdjust, QT_TRANSLATE_NOOP("QShortcut", "Adjust Brightness") },
+ { Qt::Key_Finance, QT_TRANSLATE_NOOP("QShortcut", "Finance") },
+ { Qt::Key_Community, QT_TRANSLATE_NOOP("QShortcut", "Community") },
+ { Qt::Key_AudioRewind, QT_TRANSLATE_NOOP("QShortcut", "Audio Rewind") },
+ { Qt::Key_BackForward, QT_TRANSLATE_NOOP("QShortcut", "Back Forward") },
+ { Qt::Key_ApplicationLeft, QT_TRANSLATE_NOOP("QShortcut", "Application Left") },
+ { Qt::Key_ApplicationRight, QT_TRANSLATE_NOOP("QShortcut", "Application Right") },
+ { Qt::Key_Book, QT_TRANSLATE_NOOP("QShortcut", "Book") },
+ { Qt::Key_CD, QT_TRANSLATE_NOOP("QShortcut", "CD") },
+ { Qt::Key_Calculator, QT_TRANSLATE_NOOP("QShortcut", "Calculator") },
+ { Qt::Key_Clear, QT_TRANSLATE_NOOP("QShortcut", "Clear") },
+ { Qt::Key_ClearGrab, QT_TRANSLATE_NOOP("QShortcut", "Clear Grab") },
+ { Qt::Key_Close, QT_TRANSLATE_NOOP("QShortcut", "Close") },
+ { Qt::Key_Copy, QT_TRANSLATE_NOOP("QShortcut", "Copy") },
+ { Qt::Key_Cut, QT_TRANSLATE_NOOP("QShortcut", "Cut") },
+ { Qt::Key_Display, QT_TRANSLATE_NOOP("QShortcut", "Display") },
+ { Qt::Key_DOS, QT_TRANSLATE_NOOP("QShortcut", "DOS") },
+ { Qt::Key_Documents, QT_TRANSLATE_NOOP("QShortcut", "Documents") },
+ { Qt::Key_Excel, QT_TRANSLATE_NOOP("QShortcut", "Spreadsheet") },
+ { Qt::Key_Explorer, QT_TRANSLATE_NOOP("QShortcut", "Browser") },
+ { Qt::Key_Game, QT_TRANSLATE_NOOP("QShortcut", "Game") },
+ { Qt::Key_Go, QT_TRANSLATE_NOOP("QShortcut", "Go") },
+ { Qt::Key_iTouch, QT_TRANSLATE_NOOP("QShortcut", "iTouch") },
+ { Qt::Key_LogOff, QT_TRANSLATE_NOOP("QShortcut", "Logoff") },
+ { Qt::Key_Market, QT_TRANSLATE_NOOP("QShortcut", "Market") },
+ { Qt::Key_Meeting, QT_TRANSLATE_NOOP("QShortcut", "Meeting") },
+ { Qt::Key_MenuKB, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Menu") },
+ { Qt::Key_MenuPB, QT_TRANSLATE_NOOP("QShortcut", "Menu PB") },
+ { Qt::Key_MySites, QT_TRANSLATE_NOOP("QShortcut", "My Sites") },
+ { Qt::Key_News, QT_TRANSLATE_NOOP("QShortcut", "News") },
+ { Qt::Key_OfficeHome, QT_TRANSLATE_NOOP("QShortcut", "Home Office") },
+ { Qt::Key_Option, QT_TRANSLATE_NOOP("QShortcut", "Option") },
+ { Qt::Key_Paste, QT_TRANSLATE_NOOP("QShortcut", "Paste") },
+ { Qt::Key_Phone, QT_TRANSLATE_NOOP("QShortcut", "Phone") },
+ { Qt::Key_Reply, QT_TRANSLATE_NOOP("QShortcut", "Reply") },
+ { Qt::Key_Reload, QT_TRANSLATE_NOOP("QShortcut", "Reload") },
+ { Qt::Key_RotateWindows, QT_TRANSLATE_NOOP("QShortcut", "Rotate Windows") },
+ { Qt::Key_RotationPB, QT_TRANSLATE_NOOP("QShortcut", "Rotation PB") },
+ { Qt::Key_RotationKB, QT_TRANSLATE_NOOP("QShortcut", "Rotation KB") },
+ { Qt::Key_Save, QT_TRANSLATE_NOOP("QShortcut", "Save") },
+ { Qt::Key_Send, QT_TRANSLATE_NOOP("QShortcut", "Send") },
+ { Qt::Key_Spell, QT_TRANSLATE_NOOP("QShortcut", "Spellchecker") },
+ { Qt::Key_SplitScreen, QT_TRANSLATE_NOOP("QShortcut", "Split Screen") },
+ { Qt::Key_Support, QT_TRANSLATE_NOOP("QShortcut", "Support") },
+ { Qt::Key_TaskPane, QT_TRANSLATE_NOOP("QShortcut", "Task Panel") },
+ { Qt::Key_Terminal, QT_TRANSLATE_NOOP("QShortcut", "Terminal") },
+ { Qt::Key_Tools, QT_TRANSLATE_NOOP("QShortcut", "Tools") },
+ { Qt::Key_Travel, QT_TRANSLATE_NOOP("QShortcut", "Travel") },
+ { Qt::Key_Video, QT_TRANSLATE_NOOP("QShortcut", "Video") },
+ { Qt::Key_Word, QT_TRANSLATE_NOOP("QShortcut", "Word Processor") },
+ { Qt::Key_Xfer, QT_TRANSLATE_NOOP("QShortcut", "XFer") },
+ { Qt::Key_ZoomIn, QT_TRANSLATE_NOOP("QShortcut", "Zoom In") },
+ { Qt::Key_ZoomOut, QT_TRANSLATE_NOOP("QShortcut", "Zoom Out") },
+ { Qt::Key_Away, QT_TRANSLATE_NOOP("QShortcut", "Away") },
+ { Qt::Key_Messenger, QT_TRANSLATE_NOOP("QShortcut", "Messenger") },
+ { Qt::Key_WebCam, QT_TRANSLATE_NOOP("QShortcut", "WebCam") },
+ { Qt::Key_MailForward, QT_TRANSLATE_NOOP("QShortcut", "Mail Forward") },
+ { Qt::Key_Pictures, QT_TRANSLATE_NOOP("QShortcut", "Pictures") },
+ { Qt::Key_Music, QT_TRANSLATE_NOOP("QShortcut", "Music") },
+ { Qt::Key_Battery, QT_TRANSLATE_NOOP("QShortcut", "Battery") },
+ { Qt::Key_Bluetooth, QT_TRANSLATE_NOOP("QShortcut", "Bluetooth") },
+ { Qt::Key_WLAN, QT_TRANSLATE_NOOP("QShortcut", "Wireless") },
+ { Qt::Key_UWB, QT_TRANSLATE_NOOP("QShortcut", "Ultra Wide Band") },
+ { Qt::Key_AudioForward, QT_TRANSLATE_NOOP("QShortcut", "Audio Forward") },
+ { Qt::Key_AudioRepeat, QT_TRANSLATE_NOOP("QShortcut", "Audio Repeat") },
+ { Qt::Key_AudioRandomPlay, QT_TRANSLATE_NOOP("QShortcut", "Audio Random Play") },
+ { Qt::Key_Subtitle, QT_TRANSLATE_NOOP("QShortcut", "Subtitle") },
+ { Qt::Key_AudioCycleTrack, QT_TRANSLATE_NOOP("QShortcut", "Audio Cycle Track") },
+ { Qt::Key_Time, QT_TRANSLATE_NOOP("QShortcut", "Time") },
+ { Qt::Key_Select, QT_TRANSLATE_NOOP("QShortcut", "Select") },
+ { Qt::Key_View, QT_TRANSLATE_NOOP("QShortcut", "View") },
+ { Qt::Key_TopMenu, QT_TRANSLATE_NOOP("QShortcut", "Top Menu") },
+ { Qt::Key_Suspend, QT_TRANSLATE_NOOP("QShortcut", "Suspend") },
+ { Qt::Key_Hibernate, QT_TRANSLATE_NOOP("QShortcut", "Hibernate") },
// --------------------------------------------------------------
// More consistent namings
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 2b2259c..c0fb8aa 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1152,16 +1152,23 @@ CGFloat qt_mac_get_scalefactor()
#endif
}
-QString qt_mac_get_pasteboardString()
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste)
{
QMacCocoaAutoReleasePool pool;
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- NSString *text = [pb stringForType:NSStringPboardType];
- if (text) {
- return qt_mac_NSStringToQString(text);
+ NSPasteboard *pb = nil;
+ CFStringRef pbname;
+ if (PasteboardCopyName (paste, &pbname)) {
+ pb = [NSPasteboard generalPasteboard];
} else {
- return QString();
+ pb = [NSPasteboard pasteboardWithName:reinterpret_cast<const NSString *>(pbname)];
+ CFRelease (pbname);
}
+ if (pb) {
+ NSString *text = [pb stringForType:NSStringPboardType];
+ if (text)
+ return qt_mac_NSStringToQString(text);
+ }
+ return QString();
}
QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 5318d31..f11ccc5 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -170,7 +170,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
CGFloat qt_mac_get_scalefactor();
-QString qt_mac_get_pasteboardString();
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste);
#ifdef __OBJC__
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 75bdd73..4061c3d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11718,6 +11718,22 @@ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
(void)QGestureManager::instance(); // create a gesture manager
}
+/*!
+ Unsubscribes the widget to a given \a gesture type
+
+ \sa QGestureEvent
+ \since 4.6
+*/
+void QWidget::ungrabGesture(Qt::GestureType gesture)
+{
+ Q_D(QWidget);
+ if (d->gestureContext.remove(gesture)) {
+ QGestureManager *manager = QGestureManager::instance();
+ manager->cleanupCachedGestures(this, gesture);
+ }
+}
+
+
QT_END_NAMESPACE
#include "moc_qwidget.cpp"
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index e603a1a..fce3f09 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -355,6 +355,7 @@ public:
void setGraphicsEffect(QGraphicsEffect *effect);
void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture);
+ void ungrabGesture(Qt::GestureType type);
public Q_SLOTS:
void setWindowTitle(const QString &);
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index fa12b0d..5bf7649 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -161,6 +161,9 @@ static void qt_tablet_init()
qt_tablet_widget = new QWidget(0);
qt_tablet_widget->createWinId();
qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(qt_tablet_widget);
LOGCONTEXT lcMine;
qAddPostRoutine(qt_tablet_cleanup);
struct tagAXIS tpOri[3];
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 3cd1402..00966d6 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -498,18 +498,6 @@ static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately)
if (!widget)
return;
-#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
- if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately
- && !widget->testAttribute(Qt::WA_DontShowOnScreen)) {
- // Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events
- // are blocked until the mouse button is released. See task 146849.
- const QRegion rgn(qt_dirtyRegion(widget));
- InvalidateRgn(widget->internalWinId(), rgn.handle(), false);
- qt_widget_private(widget)->dirty = QRegion();
- return;
- }
-#endif
-
if (updateImmediately) {
QEvent event(QEvent::UpdateRequest);
QApplication::sendEvent(widget, &event);
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index b8d3674..ab0ab3a 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1004,32 +1004,27 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
gtkPainter.setAlphaSupport(false);
GtkShadowType shadow = GTK_SHADOW_OUT;
GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook
- if (const QTabWidget *tabwidget = qobject_cast<const QTabWidget*>(widget)) {
- // We should introduce QStyleOptionTabWidgetFrameV2 to obtain this information
- // No gap if we do not show the actual tabs
- QTabBar *tabBar = tabwidget->findChild<QTabBar*>();
- if (tabwidget->count() > 0 && tabBar->isVisible()) {
- QRect tabRect = tabBar->tabRect(tabBar->currentIndex());
- int begin = 0, size = 0;
- GtkPositionType frameType = GTK_POS_TOP;
- QTabBar::Shape shape = frame->shape;
- if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
- begin = option->direction == Qt::LeftToRight ?
- frame->leftCornerWidgetSize.width() + tabRect.left() :
- frame->rect.width() - frame->tabBarSize.width() + tabRect.left()
- - frame->rightCornerWidgetSize.width();
- size = tabRect.width();
- frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
- } else {
- begin = frame->leftCornerWidgetSize.height() + tabRect.top();
- size = tabRect.height();
- frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
- }
- gtkPainter.paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType,
- begin, size, style);
- break; // done
+ bool reverse = (option->direction == Qt::RightToLeft);
+ QGtk::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
+ if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) {
+ GtkPositionType frameType = GTK_POS_TOP;
+ QTabBar::Shape shape = frame->shape;
+ int gapStart = 0;
+ int gapSize = 0;
+ if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
+ frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
+ gapStart = tabframe->selectedTabRect.left();
+ gapSize = tabframe->selectedTabRect.width();
+ } else {
+ frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
+ gapStart = tabframe->selectedTabRect.y();
+ gapSize = tabframe->selectedTabRect.height();
}
+ gtkPainter.paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType,
+ gapStart, gapSize, style);
+ break; // done
}
+
// Note this is only the fallback option
gtkPainter.paintBox(gtkNotebook, "notebook", option->rect, state, shadow, style);
}
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 63ba641..38c3feb 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -342,12 +342,12 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBaseV2 *tbb, const QWidget
borderHighlightTop = QColor(207, 207, 207);
}
p->setPen(borderHighlightTop);
- p->drawLine(0, 0, width, 0);
+ p->drawLine(tabRect.x(), 0, width, 0);
p->setPen(borderTop);
- p->drawLine(0, 1, width, 1);
+ p->drawLine(tabRect.x(), 1, width, 1);
// center block
- QRect centralRect(0, 2, width, height - 2);
+ QRect centralRect(tabRect.x(), 2, width, height - 2);
if (active) {
QColor mainColor = QColor(120, 120, 120);
p->fillRect(centralRect, mainColor);
@@ -370,9 +370,9 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBaseV2 *tbb, const QWidget
borderBottom = QColor(127, 127, 127);
}
p->setPen(borderHighlightBottom);
- p->drawLine(0, height - 2, width, height - 2);
+ p->drawLine(tabRect.x(), height - 2, width, height - 2);
p->setPen(borderBottom);
- p->drawLine(0, height - 1, width, height - 1);
+ p->drawLine(tabRect.x(), height - 1, width, height - 1);
}
/*
@@ -3637,17 +3637,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
break;
}
}
+ bool stretchTabs = (!verticalTabs && tabRect.height() > 22 || verticalTabs && tabRect.width() > 22);
+
switch (tp) {
case QStyleOptionTab::Beginning:
tdi.position = kHIThemeTabPositionFirst;
- if (sp != QStyleOptionTab::NextIsSelected)
+ if (sp != QStyleOptionTab::NextIsSelected || stretchTabs)
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
break;
case QStyleOptionTab::Middle:
tdi.position = kHIThemeTabPositionMiddle;
if (selected)
tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
- if (sp != QStyleOptionTab::NextIsSelected) // Also when we're selected.
+ if (sp != QStyleOptionTab::NextIsSelected || stretchTabs) // Also when we're selected.
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
break;
case QStyleOptionTab::End:
@@ -3659,9 +3661,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
tdi.position = kHIThemeTabPositionOnly;
break;
}
-
// HITheme doesn't stretch its tabs. Therefore we have to cheat and do the job ourselves.
- if ((!verticalTabs && tabRect.height() > 21 || verticalTabs && tabRect.width() > 21)) {
+ if (stretchTabs) {
HIRect hirect = CGRectMake(0, 0, 23, 23);
QPixmap pm(23, 23);
pm.fill(Qt::transparent);
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 061afcc..f5a2b94 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -4654,6 +4654,119 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
The default value is QSize(-1, -1), i.e. an invalid size.
*/
+
+
+/*!
+
+ \class QStyleOptionTabWidgetFrameV2
+ \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the
+ parameters for drawing the frame around a tab widget.
+
+ QStyleOptionTabWidgetFrameV2 contains all the information that
+ QStyle functions need to draw the frame around QTabWidget.
+
+ For performance reasons, the access to the member variables is
+ direct (i.e., using the \c . or \c -> operator). This low-level feel
+ makes the structures straightforward to use and emphasizes that
+ these are simply parameters used by the style functions.
+
+ For an example demonstrating how style options can be used, see
+ the \l {widgets/styles}{Styles} example.
+
+ \sa QStyleOption, QTabWidget
+*/
+
+
+/*!
+ \variable QStyleOptionTabWidgetFrameV2::tabBarRect
+ \brief the rectangle containing all the tabs
+
+ The default value is a null rectangle, i.e. a rectangle with both
+ the width and the height set to 0.
+*/
+
+/*!
+ \variable QStyleOptionTabWidgetFrameV2::selectedTabRect
+ \brief the rectangle containing the selected tab
+
+ This rectangle is contained within the tabBarRect. The default
+ value is a null rectangle, i.e. a rectangle with both the width
+ and the height set to 0.
+*/
+
+
+/*!
+ Constructs a QStyleOptionTabWidgetFrameV2, initializing the members
+ variables to their default values.
+*/
+
+QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2()
+ : QStyleOptionTabWidgetFrame(Version)
+{
+}
+
+
+/*! \internal */
+QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version)
+ : QStyleOptionTabWidgetFrame(version)
+{
+}
+
+
+/*!
+ Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option
+ which can be either of the QStyleOptionTabWidgetFrameV2 or
+ QStyleOptionTabWidgetFrame types.
+
+ If the \a other style option's version is 1, the new style option's \l
+ selectedTabRect and tabBarRect will contain null rects
+
+ \sa version
+*/
+QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other)
+{
+ QStyleOptionTabWidgetFrameV2::operator=(other);
+
+}
+
+
+/*!
+ Assigns the \a other style option to this style option. The \a
+ other style option can be either of the QStyleOptionFrameV2 or
+ QStyleOptionFrame types.
+
+ If the \a{other} style option's version is 1, this style option's
+ \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If
+ its version is 2, its \l FrameFeature value is simply copied to
+ this style option.
+*/
+QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other)
+{
+ QStyleOptionTabWidgetFrame::operator=(other);
+ if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) {
+ selectedTabRect = f2->selectedTabRect;
+ tabBarRect = f2->tabBarRect;
+ }
+ return *this;
+}
+
+
+/*!
+ \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion
+
+ This enum is used to hold information about the version of the style option, and
+ is defined for each QStyleOption subclass.
+
+ \value Version 2
+
+ The version is used by QStyleOption subclasses to implement
+ extensions without breaking compatibility. If you use
+ qstyleoption_cast(), you normally do not need to check it.
+
+ \sa StyleOptionType
+*/
+
+
#endif // QT_NO_TABWIDGET
#ifndef QT_NO_TABBAR
diff --git a/src/gui/styles/qstyleoption.h b/src/gui/styles/qstyleoption.h
index bf8b479..abd52bf 100644
--- a/src/gui/styles/qstyleoption.h
+++ b/src/gui/styles/qstyleoption.h
@@ -192,8 +192,28 @@ public:
protected:
QStyleOptionTabWidgetFrame(int version);
};
+
+class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame
+{
+public:
+ enum StyleOptionVersion { Version = 2 };
+
+ QRect tabBarRect;
+ QRect selectedTabRect;
+
+ QStyleOptionTabWidgetFrameV2();
+ QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) :
+ QStyleOptionTabWidgetFrame(Version) { *this = other; }
+ QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other);
+ QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other);
+
+protected:
+ QStyleOptionTabWidgetFrameV2(int version);
+};
+
#endif
+
#ifndef QT_NO_TABBAR
class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption
{
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 2d90aa1..ae1d33a 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4325,7 +4325,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabWidgetPane);
if (subRule.hasNativeBorder()) {
subRule.drawBackground(p, opt->rect);
- QStyleOptionTabWidgetFrame frmCopy(*frm);
+ QStyleOptionTabWidgetFrameV2 frmCopy(*frm);
subRule.configurePalette(&frmCopy.palette, QPalette::WindowText, QPalette::Window);
baseStyle()->drawPrimitive(pe, &frmCopy, p, w);
} else {
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index aafd087..9f5440c 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -2217,14 +2217,15 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
int xpos = x;
int margin = cb->frame ? 3 : 0;
int bmarg = cb->frame ? 2 : 0;
- xpos += wi - bmarg - 16;
+ int arrowButtonWidth = bmarg + 16;
+ xpos += wi - arrowButtonWidth;
switch (subControl) {
case SC_ComboBoxFrame:
rect = cb->rect;
break;
case SC_ComboBoxArrow:
- rect.setRect(xpos, y , wi - xpos, he);
+ rect.setRect(xpos, y , arrowButtonWidth, he);
break;
case SC_ComboBoxEditField:
rect.setRect(x + margin, y + margin, wi - 2 * margin - 16, he - 2 * margin);
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 9ef30e5..9fd9ce9 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -47,6 +47,7 @@
#include <private/qpaintengine_raster_p.h>
#include <private/qapplication_p.h>
#include <private/qstylehelper_p.h>
+#include <private/qwidget_p.h>
#include <qlibrary.h>
#include <qpainter.h>
#include <qpaintengine.h>
@@ -299,7 +300,11 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
if (!limboWidget) {
limboWidget = new QWidget(0);
+ limboWidget->createWinId();
limboWidget->setObjectName(QLatin1String("xp_limbo_widget"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(limboWidget);
}
return limboWidget->winId();
@@ -1577,7 +1582,7 @@ case PE_Frame:
// This should work, but currently there's an error in the ::drawBackgroundDirectly()
// code, when using the HDC directly..
if (useGradient) {
- QStyleOptionTabWidgetFrame frameOpt = *tab;
+ QStyleOptionTabWidgetFrameV2 frameOpt = *tab;
frameOpt.rect = widget->rect();
QRect contentsRect = subElementRect(SE_TabWidgetTabContents, &frameOpt, widget);
QRegion reg = option->rect;
@@ -2836,8 +2841,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
State bflags = toolbutton->state & ~State_Sunken;
State mflags = bflags;
-
- if (bflags & State_AutoRaise) {
+ bool autoRaise = flags & State_AutoRaise;
+ if (autoRaise) {
if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
bflags &= ~State_Raised;
}
@@ -2856,8 +2861,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
QStyleOption tool(0);
tool.palette = toolbutton->palette;
if (toolbutton->subControls & SC_ToolButton) {
- if (flags & (State_Sunken | State_On | State_Raised) || !(flags & State_AutoRaise)) {
- if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) {
+ if (flags & (State_Sunken | State_On | State_Raised) || !autoRaise) {
+ if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup && autoRaise) {
XPThemeData theme(widget, p, QLatin1String("TOOLBAR"));
theme.partId = TP_SPLITBUTTON;
theme.rect = button;
@@ -2876,13 +2881,12 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
theme.stateId = stateId;
d->drawBackground(theme);
} else {
- tool.rect = button;
+ tool.rect = option->rect;
tool.state = bflags;
- if (widget && !qobject_cast<QToolBar*>(widget->parentWidget())
- && !(bflags & State_AutoRaise))
- proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
- else
+ if (autoRaise) // for tool bars
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ else
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
}
}
}
@@ -2899,13 +2903,40 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
QStyleOptionToolButton label = *toolbutton;
label.state = bflags;
int fw = 2;
+ if (!autoRaise)
+ label.state &= ~State_Sunken;
label.rect = button.adjusted(fw, fw, -fw, -fw);
proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
- proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
+ if (autoRaise) {
+ proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
+ } else {
+ tool.state = mflags;
+ menuarea.adjust(-2, 0, 0, 0);
+ // Draw menu button
+ if ((bflags & State_Sunken) != (mflags & State_Sunken)){
+ p->save();
+ p->setClipRect(menuarea);
+ tool.rect = option->rect;
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, 0);
+ p->restore();
+ }
+ // Draw arrow
+ p->save();
+ p->setPen(option->palette.dark());
+ p->drawLine(menuarea.left(), menuarea.top() + 3,
+ menuarea.left(), menuarea.bottom() - 3);
+ p->setPen(option->palette.light());
+ p->drawLine(menuarea.left() - 1, menuarea.top() + 3,
+ menuarea.left() - 1, menuarea.bottom() - 3);
+
+ tool.rect = menuarea.adjusted(2, 3, -2, -1);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
+ p->restore();
+ }
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
QRect ir = toolbutton->rect;
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 6c9761c..3935c55 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1694,6 +1694,9 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
d->moveTabFinished(d->pressedIndex);
d->pressedIndex = d->indexAtPos(event->pos());
+#ifdef Q_WS_MAC
+ d->previousPressedIndex = d->pressedIndex;
+#endif
if (d->validIndex(d->pressedIndex)) {
QStyleOptionTabBarBaseV2 optTabBase;
optTabBase.init(this);
@@ -1774,6 +1777,17 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
update();
}
+#ifdef Q_WS_MAC
+ } else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) {
+ int newPressedIndex = d->indexAtPos(event->pos());
+ if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) {
+ d->pressedIndex = d->previousPressedIndex;
+ update(tabRect(d->pressedIndex));
+ } else if(d->pressedIndex != newPressedIndex) {
+ d->pressedIndex = -1;
+ update(tabRect(d->previousPressedIndex));
+ }
+#endif
}
if (event->buttons() != Qt::LeftButton) {
@@ -1798,6 +1812,7 @@ void QTabBarPrivate::setupMovableTab()
QPixmap grabImage(grabRect.size());
grabImage.fill(Qt::transparent);
QStylePainter p(&grabImage, q);
+ p.initFrom(q);
QStyleOptionTabV3 tab;
q->initStyleOption(&tab, pressedIndex);
@@ -1865,7 +1880,9 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
event->ignore();
return;
}
-
+#ifdef Q_WS_MAC
+ d->previousPressedIndex = -1;
+#endif
if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) {
int length = d->tabList[d->pressedIndex].dragOffset;
int width = verticalTabs(d->shape)
diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h
index 494a340..9f3285b 100644
--- a/src/gui/widgets/qtabbar_p.h
+++ b/src/gui/widgets/qtabbar_p.h
@@ -77,7 +77,11 @@ public:
:currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false),
drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false),
selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false),
- dragInProgress(false), documentMode(false), movingTab(0) {}
+ dragInProgress(false), documentMode(false), movingTab(0)
+#ifdef Q_WS_MAC
+ , previousPressedIndex(-1)
+#endif
+ {}
int currentIndex;
int pressedIndex;
@@ -195,7 +199,9 @@ public:
bool documentMode;
QWidget *movingTab;
-
+#ifdef Q_WS_MAC
+ int previousPressedIndex;
+#endif
// shared by tabwidget and qtabbar
static void initStyleBaseOption(QStyleOptionTabBarBaseV2 *optTabBase, QTabBar *tabbar, QSize size)
{
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index 9aeb033..d22bd54 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -313,7 +313,16 @@ void QTabWidget::initStyleOption(QStyleOptionTabWidgetFrame *option) const
: QTabBar::TriangularEast;
break;
}
+
option->tabBarSize = t;
+
+ if (QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<QStyleOptionTabWidgetFrameV2*>(option)) {
+ QRect tbRect = tabBar()->geometry();
+ QRect selectedTabRect = tabBar()->tabRect(tabBar()->currentIndex());
+ tabframe->tabBarRect = tbRect;
+ selectedTabRect.moveTopLeft(selectedTabRect.topLeft() + tbRect.topLeft());
+ tabframe->selectedTabRect = selectedTabRect;
+ }
}
/*!
@@ -756,7 +765,7 @@ void QTabWidget::setUpLayout(bool onlyCheck)
if (onlyCheck && !d->dirty)
return; // nothing to do
- QStyleOptionTabWidgetFrame option;
+ QStyleOptionTabWidgetFrameV2 option;
initStyleOption(&option);
// this must be done immediately, because QWidgetItem relies on it (even if !isVisible())
@@ -1167,8 +1176,8 @@ void QTabWidget::tabRemoved(int index)
void QTabWidget::paintEvent(QPaintEvent *)
{
Q_D(QTabWidget);
- QStylePainter p(this);
if (documentMode()) {
+ QStylePainter p(this, tabBar());
if (QWidget *w = cornerWidget(Qt::TopLeftCorner)) {
QStyleOptionTabBarBaseV2 opt;
QTabBarPrivate::initStyleBaseOption(&opt, tabBar(), w->size());
@@ -1185,8 +1194,9 @@ void QTabWidget::paintEvent(QPaintEvent *)
}
return;
}
+ QStylePainter p(this);
- QStyleOptionTabWidgetFrame opt;
+ QStyleOptionTabWidgetFrameV2 opt;
initStyleOption(&opt);
opt.rect = d->panelRect;
p.drawPrimitive(QStyle::PE_FrameTabWidget, opt);
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 42e1c1e..ebe101d 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -49,12 +49,12 @@
#include <qglpixelbuffer.h>
#include <qcolormap.h>
#include <qdesktopwidget.h>
+#include <private/qwidget_p.h>
#include "qdebug.h"
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#include <qx11info_x11.h>
-#include <private/qwidget_p.h>
#ifndef QT_OPENGL_ES
#include <GL/glx.h>
@@ -195,6 +195,9 @@ public:
if (!initializing && !widget && !cleanedUp) {
initializing = true;
widget = new QGLWidget;
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(widget);
initializing = false;
}
return widget;
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index 92f979f..02c8232 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -103,6 +103,8 @@ int CustomEvent::EventType = 0;
class CustomGestureRecognizer : public QGestureRecognizer
{
public:
+ static bool ConsumeEvents;
+
CustomGestureRecognizer()
{
if (!CustomEvent::EventType)
@@ -117,7 +119,9 @@ public:
QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event)
{
if (event->type() == CustomEvent::EventType) {
- QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint;
+ QGestureRecognizer::Result result = 0;
+ if (CustomGestureRecognizer::ConsumeEvents)
+ result |= QGestureRecognizer::ConsumeEventHint;
CustomGesture *g = static_cast<CustomGesture*>(state);
CustomEvent *e = static_cast<CustomEvent*>(event);
g->serial = e->serial;
@@ -143,6 +147,7 @@ public:
QGestureRecognizer::reset(state);
}
};
+bool CustomGestureRecognizer::ConsumeEvents = false;
// same as CustomGestureRecognizer but triggers early without the maybe state
class CustomContinuousGestureRecognizer : public QGestureRecognizer
@@ -280,6 +285,7 @@ protected:
}
};
+// TODO rename to sendGestureSequence
static void sendCustomGesture(CustomEvent *event, QObject *object, QGraphicsScene *scene = 0)
{
for (int i = CustomGesture::SerialMaybeThreshold;
@@ -322,6 +328,10 @@ private slots:
void multipleGesturesInTree();
void multipleGesturesInComplexTree();
void testMapToScene();
+ void ungrabGesture();
+ void consumeEventHint();
+ void unregisterRecognizer();
+ void autoCancelGestures();
};
tst_Gestures::tst_Gestures()
@@ -334,13 +344,14 @@ tst_Gestures::~tst_Gestures()
void tst_Gestures::initTestCase()
{
- CustomGesture::GestureType = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ CustomGesture::GestureType = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
QVERIFY(CustomGesture::GestureType != Qt::GestureType(0));
QVERIFY(CustomGesture::GestureType != Qt::CustomGesture);
}
void tst_Gestures::cleanupTestCase()
{
+ QApplication::unregisterGestureRecognizer(CustomGesture::GestureType);
}
void tst_Gestures::init()
@@ -372,6 +383,19 @@ void tst_Gestures::customGesture()
QCOMPARE(widget.events.canceled.size(), 0);
}
+void tst_Gestures::consumeEventHint()
+{
+ GestureWidget widget;
+ widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+
+ CustomGestureRecognizer::ConsumeEvents = true;
+ CustomEvent event;
+ sendCustomGesture(&event, &widget);
+ CustomGestureRecognizer::ConsumeEvents = false;
+
+ QCOMPARE(widget.customEventsReceived, 0);
+}
+
void tst_Gestures::autoCancelingGestures()
{
GestureWidget widget;
@@ -534,7 +558,7 @@ void tst_Gestures::conflictingGestures()
parent.reset();
child->reset();
- Qt::GestureType ContinuousGesture = qApp->registerGestureRecognizer(new CustomContinuousGestureRecognizer);
+ Qt::GestureType ContinuousGesture = QApplication::registerGestureRecognizer(new CustomContinuousGestureRecognizer);
static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
child->grabGesture(ContinuousGesture);
// child accepts override. And it also receives another custom gesture.
@@ -547,6 +571,8 @@ void tst_Gestures::conflictingGestures()
QCOMPARE(child->events.all.count(), TotalGestureEventsCount + ContinuousGestureEventsCount);
QCOMPARE(parent.gestureOverrideEventsReceived, 0);
QCOMPARE(parent.gestureEventsReceived, 0);
+
+ QApplication::unregisterGestureRecognizer(ContinuousGesture);
}
void tst_Gestures::finishedWithoutStarted()
@@ -710,6 +736,7 @@ void tst_Gestures::graphicsItemGesture()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
GestureItem *item = new GestureItem("item");
scene.addItem(item);
@@ -772,6 +799,7 @@ void tst_Gestures::graphicsItemTreeGesture()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
GestureItem *item1 = new GestureItem("item1");
item1->setPos(100, 100);
@@ -829,6 +857,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
GestureItem *item1 = new GestureItem("item1");
scene.addItem(item1);
@@ -882,6 +911,7 @@ void tst_Gestures::gestureOverChildGraphicsItem()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
GestureItem *item0 = new GestureItem("item0");
scene.addItem(item0);
@@ -951,7 +981,7 @@ void tst_Gestures::twoGesturesOnDifferentLevel()
GestureWidget *child = new GestureWidget("child");
l->addWidget(child);
- Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture);
child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture);
@@ -978,6 +1008,8 @@ void tst_Gestures::twoGesturesOnDifferentLevel()
QCOMPARE(parent.events.all.size(), TotalGestureEventsCount);
for(int i = 0; i < child->events.all.size(); ++i)
QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType);
+
+ QApplication::unregisterGestureRecognizer(SecondGesture);
}
void tst_Gestures::multipleGesturesInTree()
@@ -989,8 +1021,8 @@ void tst_Gestures::multipleGesturesInTree()
GestureWidget *D = new GestureWidget("D", C);
Qt::GestureType FirstGesture = CustomGesture::GestureType;
- Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3]
A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // |
@@ -1046,6 +1078,9 @@ void tst_Gestures::multipleGesturesInTree()
QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount);
QCOMPARE(A->events.all.count(SecondGesture), 0);
QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount);
+
+ QApplication::unregisterGestureRecognizer(SecondGesture);
+ QApplication::unregisterGestureRecognizer(ThirdGesture);
}
void tst_Gestures::multipleGesturesInComplexTree()
@@ -1057,12 +1092,12 @@ void tst_Gestures::multipleGesturesInComplexTree()
GestureWidget *D = new GestureWidget("D", C);
Qt::GestureType FirstGesture = CustomGesture::GestureType;
- Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType FourthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType FifthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType SixthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
- Qt::GestureType SeventhGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType FourthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType FifthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer);
A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4]
A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // |
@@ -1139,6 +1174,13 @@ void tst_Gestures::multipleGesturesInComplexTree()
QCOMPARE(A->events.all.count(FifthGesture), 0);
QCOMPARE(A->events.all.count(SixthGesture), 0);
QCOMPARE(A->events.all.count(SeventhGesture), 0);
+
+ QApplication::unregisterGestureRecognizer(SecondGesture);
+ QApplication::unregisterGestureRecognizer(ThirdGesture);
+ QApplication::unregisterGestureRecognizer(FourthGesture);
+ QApplication::unregisterGestureRecognizer(FifthGesture);
+ QApplication::unregisterGestureRecognizer(SixthGesture);
+ QApplication::unregisterGestureRecognizer(SeventhGesture);
}
void tst_Gestures::testMapToScene()
@@ -1151,6 +1193,7 @@ void tst_Gestures::testMapToScene()
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
GestureItem *item0 = new GestureItem;
scene.addItem(item0);
@@ -1166,5 +1209,150 @@ void tst_Gestures::testMapToScene()
QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200)));
}
+void tst_Gestures::ungrabGesture() // a method on QWidget
+{
+ class MockGestureWidget : public GestureWidget {
+ public:
+ MockGestureWidget(const char *name = 0, QWidget *parent = 0)
+ : GestureWidget(name, parent) { }
+
+
+ QSet<QGesture*> gestures;
+ protected:
+ bool event(QEvent *event)
+ {
+ if (event->type() == QEvent::Gesture) {
+ QGestureEvent *gestureEvent = static_cast<QGestureEvent*>(event);
+ if (gestureEvent)
+ foreach (QGesture *g, gestureEvent->allGestures())
+ gestures.insert(g);
+ }
+ return GestureWidget::event(event);
+ }
+ };
+
+ MockGestureWidget parent("A");
+ MockGestureWidget *a = &parent;
+ MockGestureWidget *b = new MockGestureWidget("B", a);
+
+ a->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+ b->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture);
+ b->ignoredGestures << CustomGesture::GestureType;
+
+ CustomEvent event;
+ // sending an event will cause the QGesture objects to be instantiated for the widgets
+ sendCustomGesture(&event, b);
+
+ QCOMPARE(a->gestures.count(), 1);
+ QPointer<QGesture> customGestureA;
+ customGestureA = *(a->gestures.begin());
+ QVERIFY(!customGestureA.isNull());
+ QCOMPARE(customGestureA->gestureType(), CustomGesture::GestureType);
+
+ QCOMPARE(b->gestures.count(), 1);
+ QPointer<QGesture> customGestureB;
+ customGestureB = *(b->gestures.begin());
+ QVERIFY(!customGestureB.isNull());
+ QVERIFY(customGestureA.data() == customGestureB.data());
+ QCOMPARE(customGestureB->gestureType(), CustomGesture::GestureType);
+
+ a->gestures.clear();
+ // sending an event will cause the QGesture objects to be instantiated for the widget
+ sendCustomGesture(&event, a);
+
+ QCOMPARE(a->gestures.count(), 1);
+ customGestureA = *(a->gestures.begin());
+ QVERIFY(!customGestureA.isNull());
+ QCOMPARE(customGestureA->gestureType(), CustomGesture::GestureType);
+ QVERIFY(customGestureA.data() != customGestureB.data());
+
+ a->ungrabGesture(CustomGesture::GestureType);
+ QVERIFY(customGestureA.isNull());
+ QVERIFY(!customGestureB.isNull());
+
+ a->gestures.clear();
+ a->reset();
+ // send again to 'b' and make sure a never gets it.
+ sendCustomGesture(&event, b);
+ QCOMPARE(a->gestureEventsReceived, 0);
+ QCOMPARE(a->gestureOverrideEventsReceived, 0);
+}
+
+void tst_Gestures::unregisterRecognizer() // a method on QApplication
+{
+ /*
+ The hardest usecase to get right is when we remove a recognizer while several
+ of the gestures it created are in active state and we immediately add a new recognizer
+ for the same type (thus replacing the old one).
+ The expected result is that all old gestures continue till they are finished/cancelled
+ and the new recognizer starts creating gestures immediately at registration.
+
+ This implies that deleting of the recognizer happens only when there are no more gestures
+ that it created. (since gestures might have a pointer to the recognizer)
+ */
+
+}
+
+void tst_Gestures::autoCancelGestures()
+{
+ class MockRecognizer : public QGestureRecognizer {
+ public:
+ QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event)
+ {
+ Q_UNUSED(gesture);
+ Q_UNUSED(watched);
+ if (event->type() == QEvent::MouseButtonPress)
+ return QGestureRecognizer::GestureTriggered;
+ if (event->type() == QEvent::MouseButtonRelease)
+ return QGestureRecognizer::GestureFinished;
+ return QGestureRecognizer::Ignore;
+ }
+ };
+
+ class MockWidget : public GestureWidget {
+ public:
+ MockWidget(const char *name) : GestureWidget(name) { }
+
+ bool event(QEvent *event)
+ {
+ if (event->type() == QEvent::Gesture) {
+ QGestureEvent *ge = static_cast<QGestureEvent*>(event);
+ Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here...
+ ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext);
+ }
+ return GestureWidget::event(event);
+ }
+ };
+
+ MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext
+ parent.resize(300, 100);
+ GestureWidget *child = new GestureWidget("child", &parent);
+ child->setGeometry(10, 10, 100, 80);
+
+ Qt::GestureType type = QApplication::registerGestureRecognizer(new MockRecognizer());
+ parent.grabGesture(type, Qt::WidgetWithChildrenGesture);
+ child->grabGesture(type, Qt::WidgetWithChildrenGesture);
+
+ /*
+ An event is send to both the child and the parent, when the child gets it a gesture is triggered
+ and send to the child.
+ When the parent gets the event a new gesture is triggered and delivered to the parent. When the
+ parent gets it he accepts it and that causes the cancel policy to activate.
+ The cause of that is the gesture for the child is cancelled and send to the child as such.
+ */
+ QMouseEvent event(QEvent::MouseButtonPress, QPoint(20,20), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QApplication::sendEvent(child, &event);
+ QCOMPARE(child->events.started.count(), 1);
+ QCOMPARE(child->events.all.count(), 1);
+ QCOMPARE(parent.events.all.count(), 0);
+ child->reset();
+ QApplication::sendEvent(&parent, &event);
+ QCOMPARE(parent.events.all.count(), 1);
+ QCOMPARE(parent.events.started.count(), 1);
+ QCOMPARE(child->events.started.count(), 0);
+ QCOMPARE(child->events.all.count(), 1);
+ QCOMPARE(child->events.canceled.count(), 1);
+}
+
QTEST_MAIN(tst_Gestures)
#include "tst_gestures.moc"
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 675e559..5888866 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -129,6 +129,7 @@ private slots:
void style();
void allWidgets();
+ void topLevelWidgets();
void setAttribute();
@@ -1795,6 +1796,27 @@ void tst_QApplication::allWidgets()
QVERIFY(!app.allWidgets().contains(w)); // removal test
}
+void tst_QApplication::topLevelWidgets()
+{
+ int argc = 1;
+ QApplication app(argc, &argv0, QApplication::GuiServer);
+ QWidget *w = new QWidget;
+ w->show();
+#ifndef QT_NO_CLIPBOARD
+ QClipboard *clipboard = QApplication::clipboard();
+ QString originalText = clipboard->text();
+ clipboard->setText(QString("newText"));
+#endif
+ app.processEvents();
+ QVERIFY(QApplication::topLevelWidgets().contains(w));
+ QCOMPARE(QApplication::topLevelWidgets().count(), 1);
+ delete w;
+ w = 0;
+ app.processEvents();
+ QCOMPARE(QApplication::topLevelWidgets().count(), 0);
+}
+
+
void tst_QApplication::setAttribute()
{
diff --git a/tests/auto/qmouseevent/tst_qmouseevent.cpp b/tests/auto/qmouseevent/tst_qmouseevent.cpp
index b961851..d700181 100644
--- a/tests/auto/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/qmouseevent/tst_qmouseevent.cpp
@@ -62,6 +62,7 @@ public:
}
bool mousePressEventRecieved;
bool mouseReleaseEventRecieved;
+ bool mouseMoveEventRecieved;
#ifdef QT3_SUPPORT
int mousePressStateBefore;
int mousePressStateAfter;
@@ -76,6 +77,13 @@ public:
int mouseReleaseButton;
int mouseReleaseButtons;
int mouseReleaseModifiers;
+#ifdef QT3_SUPPORT
+ int mouseMoveStateBefore;
+ int mouseMoveStateAfter;
+#endif
+ int mouseMoveButton;
+ int mouseMoveButtons;
+ int mouseMoveModifiers;
protected:
void mousePressEvent(QMouseEvent *e)
{
@@ -103,6 +111,19 @@ protected:
mouseReleaseEventRecieved = TRUE;
e->accept();
}
+ void mouseMoveEvent(QMouseEvent *e)
+ {
+ QWidget::mouseMoveEvent(e);
+#ifdef QT3_SUPPORT
+ mouseMoveStateBefore = e->state();
+ mouseMoveStateAfter = e->stateAfter();
+#endif
+ mouseMoveButton = e->button();
+ mouseMoveButtons = e->buttons();
+ mouseMoveModifiers = e->modifiers();
+ mouseMoveEventRecieved = TRUE;
+ e->accept();
+ }
};
class tst_QMouseEvent : public QObject
@@ -124,6 +145,8 @@ private slots:
void checkMousePressEvent();
void checkMouseReleaseEvent_data();
void checkMouseReleaseEvent();
+ void checkMouseMoveEvent_data();
+ void checkMouseMoveEvent();
void qt3supportConstructors();
@@ -157,11 +180,14 @@ void tst_QMouseEvent::init()
{
testMouseWidget->mousePressEventRecieved = FALSE;
testMouseWidget->mouseReleaseEventRecieved = FALSE;
+ testMouseWidget->mouseMoveEventRecieved = FALSE;
#ifdef QT3_SUPPORT
testMouseWidget->mousePressStateBefore = 0;
testMouseWidget->mousePressStateAfter = 0;
testMouseWidget->mouseReleaseStateBefore = 0;
testMouseWidget->mouseReleaseStateAfter = 0;
+ testMouseWidget->mouseMoveStateBefore = 0;
+ testMouseWidget->mouseMoveStateAfter = 0;
#endif
testMouseWidget->mousePressButton = 0;
testMouseWidget->mousePressButtons = 0;
@@ -169,6 +195,9 @@ void tst_QMouseEvent::init()
testMouseWidget->mouseReleaseButton = 0;
testMouseWidget->mouseReleaseButtons = 0;
testMouseWidget->mouseReleaseModifiers = 0;
+ testMouseWidget->mouseMoveButton = 0;
+ testMouseWidget->mouseMoveButtons = 0;
+ testMouseWidget->mouseMoveModifiers = 0;
}
void tst_QMouseEvent::cleanup()
@@ -265,6 +294,52 @@ void tst_QMouseEvent::checkMouseReleaseEvent()
#endif
}
+void tst_QMouseEvent::checkMouseMoveEvent_data()
+{
+ QTest::addColumn<int>("buttonMoved");
+ QTest::addColumn<int>("keyPressed");
+
+ QTest::newRow("leftButton-nokey") << int(Qt::LeftButton) << int(Qt::NoButton);
+ QTest::newRow("leftButton-shiftkey") << int(Qt::LeftButton) << int(Qt::ShiftModifier);
+ QTest::newRow("leftButton-controlkey") << int(Qt::LeftButton) << int(Qt::ControlModifier);
+ QTest::newRow("leftButton-altkey") << int(Qt::LeftButton) << int(Qt::AltModifier);
+ QTest::newRow("leftButton-metakey") << int(Qt::LeftButton) << int(Qt::MetaModifier);
+ QTest::newRow("rightButton-nokey") << int(Qt::RightButton) << int(Qt::NoButton);
+ QTest::newRow("rightButton-shiftkey") << int(Qt::RightButton) << int(Qt::ShiftModifier);
+ QTest::newRow("rightButton-controlkey") << int(Qt::RightButton) << int(Qt::ControlModifier);
+ QTest::newRow("rightButton-altkey") << int(Qt::RightButton) << int(Qt::AltModifier);
+ QTest::newRow("rightButton-metakey") << int(Qt::RightButton) << int(Qt::MetaModifier);
+ QTest::newRow("midButton-nokey") << int(Qt::MidButton) << int(Qt::NoButton);
+ QTest::newRow("midButton-shiftkey") << int(Qt::MidButton) << int(Qt::ShiftModifier);
+ QTest::newRow("midButton-controlkey") << int(Qt::MidButton) << int(Qt::ControlModifier);
+ QTest::newRow("midButton-altkey") << int(Qt::MidButton) << int(Qt::AltModifier);
+ QTest::newRow("midButton-metakey") << int(Qt::MidButton) << int(Qt::MetaModifier);
+}
+
+void tst_QMouseEvent::checkMouseMoveEvent()
+{
+ QFETCH(int,buttonMoved);
+ QFETCH(int,keyPressed);
+ int button = (int)Qt::NoButton;
+ int buttons = buttonMoved;
+ int modifiers = keyPressed;
+
+ QTest::mousePress(testMouseWidget, Qt::MouseButton(buttonMoved), Qt::KeyboardModifiers(keyPressed));
+ QTest::mouseMove(testMouseWidget, QPoint(10,10));
+ QVERIFY(testMouseWidget->mouseMoveEventRecieved);
+ QCOMPARE(testMouseWidget->mouseMoveButton, button);
+ QCOMPARE(testMouseWidget->mouseMoveButtons, buttons);
+ QCOMPARE(testMouseWidget->mouseMoveModifiers, modifiers);
+#ifdef QT3_SUPPORT
+ int stateAfter = buttons|modifiers;
+ int stateBefore = stateAfter|button;
+
+ QCOMPARE(testMouseWidget->mouseMoveStateBefore, stateBefore);
+ QCOMPARE(testMouseWidget->mouseMoveStateAfter, stateAfter);
+#endif
+ QTest::mouseRelease(testMouseWidget, Qt::MouseButton(buttonMoved), Qt::KeyboardModifiers(keyPressed));
+}
+
void tst_QMouseEvent::qt3supportConstructors()
{
#if !defined(QT3_SUPPORT)
diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp
index e9065eb..de92afe 100644
--- a/tests/manual/gestures/graphicsview/main.cpp
+++ b/tests/manual/gestures/graphicsview/main.cpp
@@ -152,8 +152,8 @@ private:
MainWindow::MainWindow()
{
- (void)qApp->registerGestureRecognizer(new MousePanGestureRecognizer);
- ThreeFingerSlideGesture::Type = qApp->registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer);
+ (void)QApplication::registerGestureRecognizer(new MousePanGestureRecognizer);
+ ThreeFingerSlideGesture::Type = QApplication::registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer);
tabWidget = new QTabWidget;
diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
index 5f94dbc..63d3e76 100644
--- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
+++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
@@ -49,7 +49,7 @@ MousePanGestureRecognizer::MousePanGestureRecognizer()
{
}
-QGesture* MousePanGestureRecognizer::createGesture(QObject *) const
+QGesture* MousePanGestureRecognizer::createGesture(QObject *)
{
return new QPanGesture;
}
diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h
index c92d477..b062fd0 100644
--- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h
+++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h
@@ -49,7 +49,7 @@ class MousePanGestureRecognizer : public QGestureRecognizer
public:
MousePanGestureRecognizer();
- QGesture* createGesture(QObject *target) const;
+ QGesture* createGesture(QObject *target);
QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event);
void reset(QGesture *state);
};
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 04739d4..2722b2f 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -230,6 +230,7 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
#endif
tabWidget = new QTabWidget(this);
+ tabWidget->setDocumentMode(true);
connect(tabWidget, SIGNAL(currentChanged(int)), this,
SLOT(currentPageChanged(int)));