summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@nokia.com>2010-06-02 07:35:14 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2010-06-02 07:37:03 (GMT)
commitf62926954a742990a33a54ad598de1af0989d92b (patch)
tree34a392cc5c8359eac142207c3c726294c514d822 /src
parent37a0291f932b0af0f6844898ccbce52415f0f179 (diff)
downloadQt-f62926954a742990a33a54ad598de1af0989d92b.zip
Qt-f62926954a742990a33a54ad598de1af0989d92b.tar.gz
Qt-f62926954a742990a33a54ad598de1af0989d92b.tar.bz2
Add a new qconfig feature GESTURES
Merge-request: 535 Reviewed-by: Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qconfig-medium.h3
-rw-r--r--src/corelib/global/qconfig-minimal.h3
-rw-r--r--src/corelib/global/qconfig-small.h3
-rw-r--r--src/corelib/global/qfeatures.h3
-rw-r--r--src/corelib/global/qfeatures.txt6
-rw-r--r--src/corelib/global/qnamespace.h4
-rw-r--r--src/corelib/kernel/qcoreevent.h8
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp5
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h4
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp13
-rw-r--r--src/gui/graphicsview/qgraphicsscene.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp9
-rw-r--r--src/gui/kernel/qapplication.h2
-rw-r--r--src/gui/kernel/qapplication_p.h9
-rw-r--r--src/gui/kernel/qapplication_win.cpp15
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm10
-rw-r--r--src/gui/kernel/qevent.cpp5
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qevent_p.h3
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm2
-rw-r--r--src/gui/kernel/qgesture.cpp4
-rw-r--r--src/gui/kernel/qgesture.h4
-rw-r--r--src/gui/kernel/qgesture_p.h4
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qgesturemanager_p.h4
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp4
-rw-r--r--src/gui/kernel/qgesturerecognizer.h4
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm4
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac_p.h4
-rw-r--r--src/gui/kernel/qstandardgestures.cpp4
-rw-r--r--src/gui/kernel/qstandardgestures_p.h4
-rw-r--r--src/gui/kernel/qwidget.cpp9
-rw-r--r--src/gui/kernel/qwidget.h4
-rw-r--r--src/gui/kernel/qwidget_mac.mm4
-rw-r--r--src/gui/kernel/qwidget_p.h5
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win.cpp4
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h5
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp2
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp8
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
-rw-r--r--src/imports/gestures/plugin.cpp3
-rw-r--r--src/imports/gestures/qdeclarativegesturearea.cpp4
-rw-r--r--src/imports/gestures/qdeclarativegesturearea_p.h4
48 files changed, 216 insertions, 9 deletions
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index ccd6759..6cb6c2c 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -213,6 +213,9 @@
#ifndef QT_NO_UNDOVIEW
# define QT_NO_UNDOVIEW
#endif
+#ifndef QT_NO_GESTURES
+# define QT_NO_GESTURES
+#endif
/* Widgets */
#ifndef QT_NO_LCDNUMBER
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index 99b16e8..c285e99 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -447,6 +447,9 @@
#ifndef QT_NO_UNDOVIEW
# define QT_NO_UNDOVIEW
#endif
+#ifndef QT_NO_GESTURES
+# define QT_NO_GESTURES
+#endif
/* Widgets */
#ifndef QT_NO_GROUPBOX
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index 1716b8d..dd74dcf 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -250,6 +250,9 @@
#ifndef QT_NO_SYSTEMTRAYICON
# define QT_NO_SYSTEMTRAYICON
#endif
+#ifndef QT_NO_GESTURES
+# define QT_NO_GESTURES
+#endif
/* Widgets */
#ifndef QT_NO_LCDNUMBER
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index a333153..b606843 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -85,6 +85,9 @@
// Freetype Font Engine
//#define QT_NO_FREETYPE
+// Gesture
+//#define QT_NO_GESTURES
+
// QGroupBox
//#define QT_NO_GROUPBOX
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 3e6af24..4d938a9 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -1185,6 +1185,12 @@ Requires: PROPERTIES
Name: State machine
SeeAlso: ???
+Feature: GESTURES
+Description: Provides a framework for gestures.
+Section: Utilities
+Requires:
+Name: Gesture
+SeeAlso: ???
# SVG
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 08674d2..8504e1e 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1719,6 +1719,7 @@ public:
};
Q_DECLARE_FLAGS(TouchPointStates, TouchPointState)
+#ifndef QT_NO_GESTURES
enum GestureState
{
NoGesture,
@@ -1748,6 +1749,7 @@ public:
IgnoredGesturesPropagateToParent = 0x04
};
Q_DECLARE_FLAGS(GestureFlags, GestureFlag)
+#endif // QT_NO_GESTURES
enum NavigationMode
{
@@ -1777,7 +1779,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates)
+#ifndef QT_NO_GESTURES
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags)
+#endif
typedef bool (*qInternalCallback)(void **);
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index a20d171..9d3513a 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -275,17 +275,19 @@ public:
TouchUpdate = 195,
TouchEnd = 196,
+#ifndef QT_NO_GESTURES
NativeGesture = 197, // Internal for platform gesture support
-
+#endif
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
UpdateSoftKeys = 201, // Internal for compressing soft key updates
WinIdChange = 203,
+#ifndef QT_NO_GESTURES
Gesture = 198,
GestureOverride = 202,
-
+#endif
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event
@@ -327,7 +329,9 @@ private:
friend class QGraphicsView;
friend class QGraphicsViewPrivate;
friend class QGraphicsScenePrivate;
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
+#endif
};
class Q_CORE_EXPORT QTimerEvent : public QEvent
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 135ec303..cede810 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -71,10 +71,12 @@ extern uint qGlobalPostedEventsCount();
#ifndef WM_TOUCH
# define WM_TOUCH 0x0240
#endif
+#ifndef QT_NO_GESTURES
#ifndef WM_GESTURE
# define WM_GESTURE 0x0119
# define WM_GESTURENOTIFY 0x011A
#endif
+#endif // QT_NO_GESTURES
enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
@@ -738,8 +740,10 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|| msg.message == WM_MOUSEWHEEL
|| msg.message == WM_MOUSEHWHEEL
|| msg.message == WM_TOUCH
+#ifndef QT_NO_GESTURES
|| msg.message == WM_GESTURE
|| msg.message == WM_GESTURENOTIFY
+#endif
|| msg.message == WM_CLOSE)) {
// queue user input events for later processing
haveMessage = false;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index b3e1701..8042c46 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1427,12 +1427,14 @@ QGraphicsItem::~QGraphicsItem()
d_ptr->inDestructor = 1;
d_ptr->removeExtraItemCache();
+#ifndef QT_NO_GESTURES
if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) {
QGraphicsObject *o = static_cast<QGraphicsObject *>(this);
QGestureManager *manager = QGestureManager::instance();
foreach (Qt::GestureType type, d_ptr->gestureContext.keys())
manager->cleanupCachedGestures(o, type);
}
+#endif
clearFocus();
@@ -7571,6 +7573,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
QGraphicsItem::d_ptr->isObject = true;
}
+#ifndef QT_NO_GESTURES
/*!
Subscribes the graphics object to the given \a gesture with specific \a flags.
@@ -7594,6 +7597,8 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
if (QGraphicsItem::d_ptr->gestureContext.remove(gesture) && QGraphicsItem::d_ptr->scene)
QGraphicsItem::d_ptr->scene->d_func()->ungrabGesture(this, gesture);
}
+#endif // QT_NO_GESTURES
+
/*!
Updates the item's micro focus. This is slot for convenience.
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 9891af3..d7d5332 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -485,7 +485,9 @@ private:
friend class QGraphicsSceneBspTreeIndexPrivate;
friend class QGraphicsItemEffectSourcePrivate;
friend class QGraphicsTransformPrivate;
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
+#endif
friend class ::tst_QGraphicsItem;
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);
friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *);
@@ -572,8 +574,10 @@ public:
using QObject::children;
#endif
+#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
+#endif
protected Q_SLOTS:
void updateMicroFocus();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index e812f29..bde6e7d 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -525,7 +525,9 @@ public:
QGraphicsItem *focusScopeItem;
Qt::InputMethodHints imHints;
QGraphicsItem::PanelModality panelModality;
+#ifndef QT_NO_GESTURES
QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
+#endif
// Packed 32 bits
quint32 acceptedMouseButtons : 5;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 22c3f92..7b0722e 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -699,6 +699,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize)
emit q->selectionChanged();
+#ifndef QT_NO_GESTURES
QHash<QGesture *, QGraphicsObject *>::iterator it;
for (it = gestureTargets.begin(); it != gestureTargets.end();) {
if (it.value() == item)
@@ -706,6 +707,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
else
++it;
}
+
QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item);
cachedTargetItems.removeOne(dummy);
cachedItemGestures.remove(dummy);
@@ -713,6 +715,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys())
ungrabGesture(item, gesture);
+#endif // QT_NO_GESTURES
}
/*!
@@ -1180,11 +1183,13 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event)
bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
{
if (QGraphicsObject *object = item->toGraphicsObject()) {
+#ifndef QT_NO_GESTURES
QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager;
if (gestureManager) {
if (gestureManager->filterEvent(object, event))
return true;
}
+#endif // QT_NO_GESTURES
}
if (filterEvent(item, event))
@@ -2602,8 +2607,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
d->enableTouchEventsOnViews();
}
+#ifndef QT_NO_GESTURES
foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys())
d->grabGesture(item, gesture);
+#endif
// Update selection lists
if (item->isSelected())
@@ -3525,10 +3532,12 @@ bool QGraphicsScene::event(QEvent *event)
case QEvent::TouchEnd:
d->touchEventHandler(static_cast<QTouchEvent *>(event));
break;
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
case QEvent::GestureOverride:
d->gestureEventHandler(static_cast<QGestureEvent *>(event));
break;
+#endif // QT_NO_GESTURES
default:
return QObject::event(event);
}
@@ -5637,8 +5646,10 @@ bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event)
void QGraphicsScenePrivate::addView(QGraphicsView *view)
{
views << view;
+#ifndef QT_NO_GESTURES
foreach (Qt::GestureType gesture, grabbedGestures.keys())
view->viewport()->grabGesture(gesture);
+#endif
}
void QGraphicsScenePrivate::removeView(QGraphicsView *view)
@@ -5968,6 +5979,7 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel)
dispatchHoverEvent(&hoverEvent);
}
+#ifndef QT_NO_GESTURES
void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures,
Qt::GestureFlag flag,
QHash<QGraphicsObject *, QSet<QGesture *> > *targets,
@@ -6356,6 +6368,7 @@ void QGraphicsScenePrivate::ungrabGesture(QGraphicsItem *item, Qt::GestureType g
view->viewport()->ungrabGesture(gesture);
}
}
+#endif // QT_NO_GESTURES
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h
index c34a303..f8615f4 100644
--- a/src/gui/graphicsview/qgraphicsscene.h
+++ b/src/gui/graphicsview/qgraphicsscene.h
@@ -313,7 +313,9 @@ private:
friend class QGraphicsSceneBspTreeIndex;
friend class QGraphicsSceneBspTreeIndexPrivate;
friend class QGraphicsItemEffectSourcePrivate;
+#ifndef QT_NO_GESTURES
friend class QGesture;
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers)
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 8ad2a0a..f28dfe9 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -299,6 +299,7 @@ public:
void enableTouchEventsOnViews();
QList<QGraphicsObject *> cachedTargetItems;
+#ifndef QT_NO_GESTURES
QHash<QGraphicsObject *, QSet<QGesture *> > cachedItemGestures;
QHash<QGraphicsObject *, QSet<QGesture *> > cachedAlreadyDeliveredGestures;
QHash<QGesture *, QGraphicsObject *> gestureTargets;
@@ -313,6 +314,7 @@ public:
void cancelGesturesForChildren(QGesture *original);
void grabGesture(QGraphicsItem *, Qt::GestureType gesture);
void ungrabGesture(QGraphicsItem *, Qt::GestureType gesture);
+#endif // QT_NO_GESTURES
void updateInputMethodSensitivityInViews();
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index a83b528..0674610 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2688,10 +2688,12 @@ void QGraphicsView::setupViewport(QWidget *widget)
if (d->scene && !d->scene->d_func()->allItemsIgnoreTouchEvents)
widget->setAttribute(Qt::WA_AcceptTouchEvents);
+#ifndef QT_NO_GESTURES
if (d->scene) {
foreach (Qt::GestureType gesture, d->scene->d_func()->grabbedGestures.keys())
widget->grabGesture(gesture);
}
+#endif
widget->setAcceptDrops(acceptDrops());
}
@@ -2838,6 +2840,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
return true;
}
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
case QEvent::GestureOverride:
{
@@ -2851,6 +2854,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
}
return true;
}
+#endif // QT_NO_GESTURES
default:
break;
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 09a3bfe..c9a3e8b 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -187,8 +187,10 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
directPainters = 0;
#endif
+#ifndef QT_NO_GESTURES
gestureManager = 0;
gestureWidget = 0;
+#endif // QT_NO_GESTURES
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
move_cursor = 0;
@@ -3718,6 +3720,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
#endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
}
+#ifndef QT_NO_GESTURES
// walk through parents and check for gestures
if (d->gestureManager) {
switch (e->type()) {
@@ -3762,7 +3765,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
}
}
-
+#endif // QT_NO_GESTURES
// User input and window activation makes tooltips sleep
switch (e->type()) {
@@ -4267,6 +4270,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
res = d->notify_helper(receiver, e);
break;
+#ifndef QT_NO_GESTURES
case QEvent::NativeGesture:
{
// only propagate the first gesture event (after the GID_BEGIN)
@@ -4345,6 +4349,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
break;
}
+#endif // QT_NO_GESTURES
default:
res = d->notify_helper(receiver, e);
break;
@@ -5777,6 +5782,7 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
}
+#ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance()
{
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
@@ -5784,6 +5790,7 @@ QGestureManager* QGestureManager::instance()
qAppPriv->gestureManager = new QGestureManager(qApp);
return qAppPriv->gestureManager;
}
+#endif // QT_NO_GESTURES
// These pixmaps approximate the images in the Windows User Interface Guidelines.
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index c21b982..cb1d063 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -399,7 +399,9 @@ private:
friend class QDirectPainter;
friend class QDirectPainterPrivate;
#endif
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
+#endif
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index e83cd71..3a3f816 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -84,7 +84,9 @@ class QInputContext;
class QObject;
class QWidget;
class QSocketNotifier;
+#ifndef QT_NO_GESTURES
class QGestureManager;
+#endif
extern bool qt_is_gui_used;
#ifndef QT_NO_CLIPBOARD
@@ -200,6 +202,7 @@ typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
+#ifndef QT_NO_GESTURES
typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
@@ -263,6 +266,8 @@ typedef struct tagGESTURECONFIG
#define GID_ROLLOVER 0xf003
#endif
+#endif // QT_NO_GESTURES
+
#endif // Q_WS_WIN
class QScopedLoopLevelCounter
@@ -519,6 +524,7 @@ public:
void sendSyntheticEnterLeave(QWidget *widget);
#endif
+#ifndef QT_NO_GESTURES
QGestureManager *gestureManager;
QWidget *gestureWidget;
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
@@ -526,6 +532,7 @@ public:
QPixmap *copy_cursor;
QPixmap *link_cursor;
#endif
+#endif
#if defined(Q_WS_WIN)
QPixmap *ignore_cursor;
#endif
@@ -554,6 +561,7 @@ public:
QHash<DWORD, int> touchInputIDToTouchPointID;
bool translateTouchEvent(const MSG &msg);
+#ifndef QT_NO_GESTURES
PtrGetGestureInfo GetGestureInfo;
PtrGetGestureExtraArgs GetGestureExtraArgs;
PtrCloseGestureInfoHandle CloseGestureInfoHandle;
@@ -562,6 +570,7 @@ public:
PtrBeginPanningFeedback BeginPanningFeedback;
PtrUpdatePanningFeedback UpdatePanningFeedback;
PtrEndPanningFeedback EndPanningFeedback;
+#endif // QT_NO_GESTURES
#endif
#ifdef QT_RX71_MULTITOUCH
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 60fc5e1..c52fbdf 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -52,9 +52,11 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include <windowsm.h>
#include <tpcshell.h>
#ifdef QT_WINCE_GESTURES
+#ifndef QT_NO_GESTURES
#include <gesture.h>
#endif
#endif
+#endif
#include "qapplication.h"
#include "qdesktopwidget.h"
@@ -198,6 +200,7 @@ struct SHRGINFO {
#define SPI_SETSIPINFO 224
#endif
+#ifndef QT_NO_GESTURES
typedef DWORD (API *AygRecognizeGesture)(SHRGINFO*);
static AygRecognizeGesture ptrRecognizeGesture = 0;
static bool aygResolved = false;
@@ -211,6 +214,7 @@ static void resolveAygLibs()
ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture");
}
}
+#endif // QT_NO_GESTURES
#endif
@@ -463,7 +467,9 @@ public:
bool translateConfigEvent(const MSG &msg);
bool translateCloseEvent(const MSG &msg);
bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets);
+#ifndef QT_NO_GESTURES
bool translateGestureEvent(const MSG &msg, const GESTUREINFO &gi);
+#endif
void repolishStyle(QStyle &style);
inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); }
inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); }
@@ -843,6 +849,7 @@ void qt_init(QApplicationPrivate *priv, int)
ptrSetProcessDPIAware();
#endif
+#ifndef QT_NO_GESTURES
priv->GetGestureInfo = 0;
priv->GetGestureExtraArgs = 0;
priv->CloseGestureInfoHandle = 0;
@@ -883,6 +890,7 @@ void qt_init(QApplicationPrivate *priv, int)
(PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
"EndPanningFeedback");
#endif
+#endif // QT_NO_GESTURES
}
/*****************************************************************************
@@ -1667,12 +1675,14 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
shrg.ptDown.y = GET_Y_LPARAM(lParam);
shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
resolveAygLibs();
+#ifndef QT_NO_GESTURES
if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) {
if (QApplication::activePopupWidget())
QApplication::activePopupWidget()->close();
QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos);
result = qt_sendSpontaneousEvent(alienWidget, &e);
}
+#endif // QT_NO_GESTURES
}
}
}
@@ -2556,6 +2566,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
}
result = false;
break;
+#ifndef QT_NO_GESTURES
#if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
case WM_GESTURE: {
GESTUREINFO gi;
@@ -2590,6 +2601,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
break;
}
#endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
+#endif // QT_NO_GESTURES
#ifndef QT_NO_CURSOR
case WM_SETCURSOR: {
QCursor *ovr = QApplication::overrideCursor();
@@ -3825,6 +3837,7 @@ bool QETWidget::translateCloseEvent(const MSG &)
return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
}
+#ifndef QT_NO_GESTURES
bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi)
{
const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
@@ -3863,7 +3876,7 @@ bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi)
qt_sendSpontaneousEvent(widget, &event);
return true;
}
-
+#endif // QT_NO_GESTURES
void QApplication::setCursorFlashTime(int msecs)
{
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 4953c48..eec9699 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -952,12 +952,14 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Zoom;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = [event magnification];
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)rotateWithEvent:(NSEvent *)event;
@@ -965,12 +967,14 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Rotate;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = -[event rotation];
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)swipeWithEvent:(NSEvent *)event;
@@ -978,6 +982,7 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::Swipe;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
@@ -991,6 +996,7 @@ static int qCocoaViewCount = 0;
else if ([event deltaY] == -1)
qNGEvent.angle = 270.0f;
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)beginGestureWithEvent:(NSEvent *)event;
@@ -998,11 +1004,13 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)endGestureWithEvent:(NSEvent *)event;
@@ -1010,11 +1018,13 @@ static int qCocoaViewCount = 0;
if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
return;
+#ifndef QT_NO_GESTURES
QNativeGestureEvent qNGEvent;
qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
+#endif // QT_NO_GESTURES
}
- (void)frameDidChange:(NSNotification *)note
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index acf7184..92eed33 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3421,9 +3421,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
return dbg.space();
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
n = "Gesture";
break;
+#endif
default:
dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
return dbg.space();
@@ -4254,6 +4256,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
return *this;
}
+#ifndef QT_NO_GESTURES
/*!
\class QGestureEvent
\since 4.6
@@ -4558,4 +4561,6 @@ const QGestureEventPrivate *QGestureEvent::d_func() const
*/
#endif
+#endif // QT_NO_GESTURES
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 90242fe..9c70c02 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -62,7 +62,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QAction;
+#ifndef QT_NO_GESTURES
class QGesture;
+#endif
class Q_GUI_EXPORT QInputEvent : public QEvent
{
@@ -824,6 +826,7 @@ protected:
friend class QApplicationPrivate;
};
+#ifndef QT_NO_GESTURES
class QGesture;
class QGestureEventPrivate;
class Q_GUI_EXPORT QGestureEvent : public QEvent
@@ -875,6 +878,7 @@ private:
friend class QApplication;
friend class QGestureManager;
};
+#endif // QT_NO_GESTURES
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 5c94a23..e323aa9 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -120,6 +120,7 @@ public:
qreal pressure;
};
+#ifndef QT_NO_GESTURES
class QNativeGestureEvent : public QEvent
{
public:
@@ -164,7 +165,7 @@ public:
QMap<Qt::GestureType, bool> accepted;
QMap<Qt::GestureType, QWidget *> targetWidgets;
};
-
+#endif // QT_NO_GESTURES
class QFileOpenEventPrivate
{
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 0d93b9f..e26fbde 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -492,6 +492,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSOtherMouseDown:
case NSOtherMouseUp:
case NSOtherMouseDragged:
+#ifndef QT_NO_GESTURES
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
case NSEventTypeGesture: // touch events
case NSEventTypeMagnify:
@@ -500,6 +501,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSEventTypeBeginGesture:
case NSEventTypeEndGesture:
#endif
+#endif // QT_NO_GESTURES
result = true;
break;
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 49bdea7..f5688f4 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -42,6 +42,8 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
/*!
@@ -725,3 +727,5 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index c9bdce6..8c10895 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -49,6 +49,8 @@
#include <QtCore/qrect.h>
#include <QtCore/qmetatype.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_HEADER
Q_DECLARE_METATYPE(Qt::GestureState)
@@ -258,4 +260,6 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
QT_END_HEADER
+#endif // QT_NO_GESTURES
+
#endif // QGESTURE_H
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index bf60f97..f5474c1 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -59,6 +59,8 @@
#include "qelapsedtimer.h"
#include "private/qobject_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QGesturePrivate : public QObjectPrivate
@@ -179,4 +181,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QGESTURE_P_H
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 43facef..03db6ea 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -66,6 +66,8 @@
# define DEBUG qDebug
#endif
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QGestureManager::QGestureManager(QObject *parent)
@@ -691,4 +693,6 @@ void QGestureManager::recycle(QGesture *gesture)
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#include "moc_qgesturemanager_p.cpp"
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index c452f49..747cb1a 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -58,6 +58,8 @@
#include "private/qwidget_p.h"
#include "qgesturerecognizer.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QBasicTimer;
@@ -143,4 +145,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QGESTUREMANAGER_P_H
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
index 9dcca17..3e23bbf 100644
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -44,6 +44,8 @@
#include "private/qgesture_p.h"
#include "private/qgesturemanager_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
/*!
@@ -231,3 +233,5 @@ void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
index 3e17c99..5afb43f 100644
--- a/src/gui/kernel/qgesturerecognizer.h
+++ b/src/gui/kernel/qgesturerecognizer.h
@@ -45,6 +45,8 @@
#include <QtCore/qglobal.h>
#include <QtCore/qnamespace.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -95,4 +97,6 @@ QT_END_NAMESPACE
QT_END_HEADER
+#endif // QT_NO_GESTURES
+
#endif // QGESTURERECOGNIZER_H
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
index fba839b..0ccbb52 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -47,6 +47,8 @@
#include "qwidget.h"
#include "qdebug.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer()
@@ -260,3 +262,5 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture)
#endif // QT_MAC_USE_COCOA
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
index dd8a150..f48c160 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h
+++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
@@ -57,6 +57,8 @@
#include "qpoint.h"
#include "qgesturerecognizer.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QMacSwipeGestureRecognizer : public QGestureRecognizer
@@ -99,4 +101,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QMACSWIPEGESTURERECOGNIZER_MAC_P_H
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index a575717..6960838 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -47,6 +47,8 @@
#include "qabstractscrollarea.h"
#include "qdebug.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
QPanGestureRecognizer::QPanGestureRecognizer()
@@ -563,3 +565,5 @@ void QTapAndHoldGestureRecognizer::reset(QGesture *state)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index 64505d8..da73b85 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -56,6 +56,8 @@
#include "qgesturerecognizer.h"
#include "private/qgesture_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QPanGestureRecognizer : public QGestureRecognizer
@@ -110,4 +112,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QSTANDARDGESTURES_P_H
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index b5879ae..2fc76ed 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -202,7 +202,9 @@ QWidgetPrivate::QWidgetPrivate(int version)
, picture(0)
#elif defined(Q_WS_WIN)
, noPaintOnScreen(0)
+ #ifndef QT_NO_GESTURES
, nativeGesturePanEnabled(0)
+ #endif
#elif defined(Q_WS_MAC)
, needWindowChange(0)
, hasAlienChildren(0)
@@ -1397,8 +1399,10 @@ QWidget::~QWidget()
qWarning("QWidget: %s (%s) deleted while being painted", className(), name());
#endif
+#ifndef QT_NO_GESTURES
foreach (Qt::GestureType type, d->gestureContext.keys())
ungrabGesture(type);
+#endif
// force acceptDrops false before winId is destroyed.
d->registerDropSite(false);
@@ -8539,9 +8543,11 @@ bool QWidget::event(QEvent *event)
#endif // Q_WS_MAC
break;
}
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
event->ignore();
break;
+#endif
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -11957,6 +11963,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
Synonym for QList<QWidget *>.
*/
+#ifndef QT_NO_GESTURES
/*!
Subscribes the widget to a given \a gesture with specific \a flags.
@@ -11984,7 +11991,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
manager->cleanupCachedGestures(this, gesture);
}
}
-
+#endif // QT_NO_GESTURES
/*!
\typedef WId
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index e12148b..941bd68 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -360,8 +360,10 @@ public:
void setGraphicsEffect(QGraphicsEffect *effect);
#endif //QT_NO_GRAPHICSEFFECT
+#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
+#endif
public Q_SLOTS:
void setWindowTitle(const QString &);
@@ -742,8 +744,10 @@ private:
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
friend struct QWidgetExceptionCleaner;
+#ifndef QT_NO_GESTURES
friend class QGestureManager;
friend class QWinNativePanGestureRecognizer;
+#endif // QT_NO_GESTURES
friend class QWidgetEffectSourcePrivate;
#ifdef Q_WS_MAC
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index f12c956..1928599 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -752,6 +752,7 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt
return window;
}
+#ifndef QT_NO_GESTURES
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
/* We build the release package against the 10.4 SDK.
So, to enable gestures for applications running on
@@ -768,6 +769,7 @@ enum {
kEventParamMagnificationAmount = 'magn'
};
#endif
+#endif // QT_NO_GESTURES
// window events
static EventTypeSpec window_events[] = {
@@ -1076,6 +1078,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
handled_event = false;
break; }
+#ifndef QT_NO_GESTURES
case kEventClassGesture: {
// First, find the widget that was under
// the mouse when the gesture happened:
@@ -1142,6 +1145,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
QApplication::sendSpontaneousEvent(widget, &qNGEvent);
break; }
+#endif // QT_NO_GESTURES
default:
handled_event = false;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 3f494d8..f23a94c 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -685,7 +685,9 @@ public:
#ifndef QT_NO_ACTION
QList<QAction*> actions;
#endif
+#ifndef QT_NO_GESTURES
QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
+#endif
// Bit fields.
uint high_attributes[4]; // the low ones are in QWidget::widget_attributes
@@ -714,8 +716,9 @@ public:
void updateX11AcceptFocus();
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN
uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine()
+#ifndef QT_NO_GESTURES
uint nativeGesturePanEnabled : 1;
-
+#endif
bool shouldShowMaximizeButton();
void winUpdateIsOpaque();
void reparentChildren();
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 5482da3..a7e66bf 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2075,7 +2075,7 @@ void QWidgetPrivate::registerTouchWindow()
void QWidgetPrivate::winSetupGestures()
{
-#if !defined(QT_NO_NATIVE_GESTURES)
+#if !defined(QT_NO_GESTURES) && !defined(QT_NO_NATIVE_GESTURES)
Q_Q(QWidget);
if (!q || !q->isVisible() || !nativeGesturePanEnabled)
return;
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
index 0bddbf6..780de5d 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
@@ -50,6 +50,8 @@
#include "private/qapplication_p.h"
#include "private/qwidget_p.h"
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_NATIVE_GESTURES)
@@ -127,3 +129,5 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state)
#endif // QT_NO_NATIVE_GESTURES
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index 146b067..64addeb 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -54,6 +54,7 @@
//
#include <QGestureRecognizer>
+
#include <objbase.h>
class IInkRectangle;
@@ -87,6 +88,8 @@ DECLARE_INTERFACE_(IInkTablets, IDispatch)
STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE;
};
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_NATIVE_GESTURES)
@@ -105,4 +108,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_GESTURES
+
#endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 63ad94e..2b4c9c2 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -474,9 +474,11 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::TouchEnd:
return new QTouchEvent(*static_cast<QTouchEvent*>(e));
+#ifndef QT_NO_GESTURES
case QEvent::NativeGesture:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
+#endif
case QEvent::RequestSoftwareInputPanel:
case QEvent::CloseSoftwareInputPanel:
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 8cffebd..30ce23b 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -295,8 +295,10 @@ void QAbstractScrollAreaPrivate::init()
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
#ifndef Q_WS_MAC
+#ifndef QT_NO_GESTURES
viewport->grabGesture(Qt::PanGesture);
#endif
+#endif
}
#ifdef Q_WS_WIN
@@ -546,8 +548,10 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
d->viewport->setFocusProxy(this);
d->viewport->installEventFilter(d->viewportFilter.data());
#ifndef Q_WS_MAC
+#ifndef QT_NO_GESTURES
d->viewport->grabGesture(Qt::PanGesture);
#endif
+#endif
d->layoutChildren();
if (isVisible())
d->viewport->show();
@@ -960,6 +964,7 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
return false;
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
{
QGestureEvent *ge = static_cast<QGestureEvent *>(e);
@@ -980,6 +985,7 @@ bool QAbstractScrollArea::event(QEvent *e)
}
return false;
}
+#endif // QT_NO_GESTURES
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
case QEvent::ApplicationLayoutDirectionChange:
@@ -1036,9 +1042,11 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e)
#endif
return QFrame::event(e);
case QEvent::LayoutRequest:
+#ifndef QT_NO_GESTURES
case QEvent::Gesture:
case QEvent::GestureOverride:
return event(e);
+#endif
default:
break;
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 2734fba..21c2635 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -1476,6 +1476,7 @@ bool QPlainTextEdit::event(QEvent *e)
d->sendControlEvent(e);
}
#endif
+#ifndef QT_NO_GESTURES
else if (e->type() == QEvent::Gesture) {
QGestureEvent *ge = static_cast<QGestureEvent *>(e);
QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture));
@@ -1499,6 +1500,7 @@ bool QPlainTextEdit::event(QEvent *e)
}
return true;
}
+#endif // QT_NO_GESTURES
return QAbstractScrollArea::event(e);
}
diff --git a/src/imports/gestures/plugin.cpp b/src/imports/gestures/plugin.cpp
index 11f2392..1fc23ca 100644
--- a/src/imports/gestures/plugin.cpp
+++ b/src/imports/gestures/plugin.cpp
@@ -53,7 +53,9 @@ public:
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.gestures"));
+#ifndef QT_NO_GESTURES
qmlRegisterCustomType<QDeclarativeGestureArea>(uri,1,0, "GestureArea", new QDeclarativeGestureAreaParser);
+#endif
}
};
@@ -62,4 +64,3 @@ QT_END_NAMESPACE
#include "plugin.moc"
Q_EXPORT_PLUGIN2(qmlgesturesplugin, QT_PREPEND_NAMESPACE(GestureAreaQmlPlugin));
-
diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp
index 1b0aeeb..22be2f1 100644
--- a/src/imports/gestures/qdeclarativegesturearea.cpp
+++ b/src/imports/gestures/qdeclarativegesturearea.cpp
@@ -55,6 +55,8 @@
#include <private/qobject_p.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_NAMESPACE
class QDeclarativeGestureAreaPrivate : public QDeclarativeItemPrivate
@@ -267,3 +269,5 @@ bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event)
}
QT_END_NAMESPACE
+
+#endif // QT_NO_GESTURES
diff --git a/src/imports/gestures/qdeclarativegesturearea_p.h b/src/imports/gestures/qdeclarativegesturearea_p.h
index 0195511..ff89166 100644
--- a/src/imports/gestures/qdeclarativegesturearea_p.h
+++ b/src/imports/gestures/qdeclarativegesturearea_p.h
@@ -50,6 +50,8 @@
#include <QtCore/qstring.h>
#include <QtGui/qgesture.h>
+#ifndef QT_NO_GESTURES
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -97,4 +99,6 @@ QML_DECLARE_TYPE(QDeclarativeGestureArea)
QT_END_HEADER
+#endif // QT_NO_GESTURES
+
#endif