diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-03 11:12:07 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-03 11:12:07 (GMT) |
commit | 49c4c8372cd6bf194c1a36029844eefe94393da0 (patch) | |
tree | 77975968f0b89983ec1fd60910df5147fc27b485 /src | |
parent | a8829a52d65a9759d5dffe98fb07b384c54db1c8 (diff) | |
parent | 1d87017c4681c9d5da14d613b5b84d25620642fe (diff) | |
download | Qt-49c4c8372cd6bf194c1a36029844eefe94393da0.zip Qt-49c4c8372cd6bf194c1a36029844eefe94393da0.tar.gz Qt-49c4c8372cd6bf194c1a36029844eefe94393da0.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix compilation: disable -no-feature-* for bootstrapped
QString: Fix severals bugs when comparing with QStringRef
QProgressBar: make accessors const.
Changes: add patch for artificial emboldening
Added static version of QGLFramebufferObject::release().
Fix compilation on WinXP MinGW32;
Add a new qconfig feature GESTURES
Diffstat (limited to 'src')
55 files changed, 274 insertions, 20 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 52a24de..607ab52 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1720,6 +1720,7 @@ public: }; Q_DECLARE_FLAGS(TouchPointStates, TouchPointState) +#ifndef QT_NO_GESTURES enum GestureState { NoGesture, @@ -1749,6 +1750,7 @@ public: IgnoredGesturesPropagateToParent = 0x04 }; Q_DECLARE_FLAGS(GestureFlags, GestureFlag) +#endif // QT_NO_GESTURES enum NavigationMode { @@ -1778,7 +1780,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/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a0dbb8e..1172a7b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -113,7 +113,7 @@ int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) { if (a == b) - return 0; + return (ae - be); if (a == 0) return 1; if (b == 0) @@ -125,7 +125,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const u uint alast = 0; uint blast = 0; - while (a != e) { + while (a < e) { // qDebug() << hex << alast << blast; // qDebug() << hex << "*a=" << *a << "alast=" << alast << "folded=" << foldCase (*a, alast); // qDebug() << hex << "*b=" << *b << "blast=" << blast << "folded=" << foldCase (*b, blast); @@ -154,7 +154,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b) if (b == 0) return -1; - while (a != ae && *b) { + while (a < ae && *b) { int diff = foldCase(*a) - foldCase(*b); if ((diff)) return diff; @@ -4640,9 +4640,12 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, return length1; if (cs == Qt::CaseSensitive) { - while (uc != e && *c && *uc == *c) + while (uc < e && *c && *uc == *c) uc++, c++; + if (uc == e) + return -*c; + return *uc - *c; } else { return ucstricmp(uc, e, c); 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 a81d4e4..2af031b 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) @@ -692,4 +694,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/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 449dffd..9056012 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -58,6 +58,7 @@ #include <ft2build.h> #include FT_FREETYPE_H #include FT_OUTLINE_H +#include FT_SYNTHESIS_H #include FT_TRUETYPE_TABLES_H #include FT_TYPE1_TABLES_H #include FT_GLYPH_H @@ -617,6 +618,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) cache_cost = 100; kerning_pairs_loaded = false; transform = false; + embolden = false; antialias = true; freetype = 0; default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; @@ -679,10 +681,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) FT_Face face = lockFace(); - //underline metrics if (FT_IS_SCALABLE(face)) { - line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale)); - underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale)); bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC); if (fake_oblique) matrix.xy = 0x10000*3/10; @@ -690,6 +689,12 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) freetype->matrix = matrix; if (fake_oblique) transform = true; + // fake bold + if ((fontDef.weight == QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD)) + embolden = true; + // underline metrics + line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale)); + underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale)); } else { // copied from QFontEngineQPF // ad hoc algorithm @@ -789,6 +794,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph } FT_GlyphSlot slot = face->glyph; + if (embolden) FT_GlyphSlot_Embolden(slot); int left = slot->metrics.horiBearingX; int right = slot->metrics.horiBearingX + slot->metrics.width; int top = slot->metrics.horiBearingY; @@ -934,6 +940,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph return 0; FT_GlyphSlot slot = face->glyph; + if (embolden) FT_GlyphSlot_Embolden(slot); FT_Library library = qt_getFreetype(); info.xOff = TRUNC(ROUND(slot->advance.x)); @@ -1209,6 +1216,8 @@ int QFontEngineFT::synthesized() const int s = 0; if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC)) s = SynthesizedItalic; + if ((fontDef.weight == QFont::Bold) && !(freetype->face->style_flags & FT_STYLE_FLAG_BOLD)) + s |= SynthesizedBold; if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face)) s |= SynthesizedStretch; return s; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 12b7da8..2f05a8b 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -304,6 +304,7 @@ protected: bool antialias; bool transform; + bool embolden; SubpixelAntialiasingType subpixelType; int lcdFilterType; bool canUploadGlyphsToServer; 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/gui/widgets/qprogressbar.h b/src/gui/widgets/qprogressbar.h index b461a21..58bc8b2 100644 --- a/src/gui/widgets/qprogressbar.h +++ b/src/gui/widgets/qprogressbar.h @@ -93,9 +93,11 @@ public: Qt::Orientation orientation() const; void setInvertedAppearance(bool invert); - bool invertedAppearance(); + bool invertedAppearance(); //### Qt5 make const + bool invertedAppearance() const { return const_cast<QProgressBar *>(this)->invertedAppearance(); } void setTextDirection(QProgressBar::Direction textDirection); - QProgressBar::Direction textDirection(); + QProgressBar::Direction textDirection(); //### Qt5 make const + QProgressBar::Direction textDirection() const { return const_cast<QProgressBar *>(this)->textDirection(); } void setFormat(const QString &format); QString format() const; 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 diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 890b029..deffc20 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1024,6 +1024,36 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const } /*! + \fn bool QGLFramebufferObject::bindDefault() + \internal + + Switches rendering back to the default, windowing system provided + framebuffer. + Returns true upon success, false otherwise. + + \sa bind(), release() +*/ +bool QGLFramebufferObject::bindDefault() +{ + QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); + + if (ctx) { + bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); + if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx))) + return false; + + ctx->d_ptr->current_fbo = ctx->d_ptr->default_fbo; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->default_fbo); +#ifdef QT_DEBUG + } else { + qWarning("QGLFramebufferObject::bindDefault() called without current context."); +#endif + } + + return ctx != 0; +} + +/*! \fn bool QGLFramebufferObject::hasOpenGLFramebufferObjects() Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index 306b6ff..6ff6645 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -108,6 +108,8 @@ public: QPaintEngine *paintEngine() const; GLuint handle() const; + static bool bindDefault(); + static bool hasOpenGLFramebufferObjects(); void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 6fd1725..9a35ac5 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -259,14 +259,14 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode static QString qODBCWarn(const QODBCPrivate* odbc, int *nativeCode = 0) { - return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->dpEnv()) + QLatin1Char(' ') + return QString(qWarnODBCHandle(SQL_HANDLE_ENV, odbc->dpEnv()) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->dpDbc()) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_STMT, odbc->hStmt, nativeCode)).simplified(); } static QString qODBCWarn(const QODBCDriverPrivate* odbc, int *nativeCode = 0) { - return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1Char(' ') + return QString(qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->hDbc, nativeCode)).simplified(); } |