summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp30
-rw-r--r--src/corelib/global/qnamespace.h33
-rw-r--r--src/corelib/global/qnamespace.qdoc43
3 files changed, 92 insertions, 14 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 742f4ec..5a7b559 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -46,6 +46,7 @@
#include "qthreadstorage.h"
#include "qdir.h"
#include "qstringlist.h"
+#include "qdatetime.h"
#ifndef QT_NO_QOBJECT
#include <private/qthread_p.h>
@@ -2523,6 +2524,33 @@ void qsrand(uint seed)
#endif
}
+/*! \internal
+ \relates <QtGlobal>
+ \since 4.6
+
+ Seed the PRNG, but only if it has not already been seeded.
+
+ The default seed is a combination of current time, a stack address and a
+ serial counter (since thread stack addresses are re-used).
+*/
+void qsrand()
+{
+#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+ SeedStorageType *pseed = randTLS()->localData();
+ if (pseed) {
+ // already seeded
+ return;
+ }
+ randTLS()->setLocalData(pseed = new SeedStorageType);
+ static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
+ *pseed = QDateTime::currentDateTime().toTime_t()
+ + quintptr(&pseed)
+ + serial.fetchAndAddRelaxed(1);
+#else
+ // On Windows, we assume that rand() already does the right thing
+#endif
+}
+
/*!
\relates <QtGlobal>
\since 4.2
@@ -2645,7 +2673,7 @@ int qrand()
\relates <QtGlobal>
Marks the string literal \a sourceText for dynamic translation in
- the given \a context, i.e the stored \a sourceText will not be
+ the given \a context; i.e, the stored \a sourceText will not be
altered. The \a context is typically a class and also needs to
be specified as string literal.
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 4234a7e..f28f94e 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -44,10 +44,6 @@
#include <QtCore/qglobal.h>
-#ifdef Q_OS_SYMBIAN
-# include <e32def.h>
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -501,8 +497,6 @@ public:
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
- WA_DontUseStandardGestures = 124,
-
// Add new attributes before this line
WA_AttributeCount
};
@@ -1615,9 +1609,29 @@ public:
enum GestureState
{
NoGesture,
- GestureStarted = 1,
- GestureUpdated = 2,
- GestureFinished = 3
+ GestureStarted = 1,
+ GestureUpdated = 2,
+ GestureFinished = 3,
+ GestureCanceled = 4
+ };
+
+ enum GestureType
+ {
+ TapGesture = 1,
+ TapAndHoldGesture = 2,
+ PanGesture = 3,
+ PinchGesture = 4,
+ SwipeGesture = 5,
+
+ CustomGesture = 0x0100,
+
+ LastGestureType = ~0u
+ };
+
+ enum GestureContext
+ {
+ WidgetGesture = 0,
+ WidgetWithChildrenGesture = 3
};
enum NavigationMode
@@ -1638,7 +1652,6 @@ public:
;
#endif
-
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Orientations)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::KeyboardModifiers)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ab232bf..ba05b00 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1225,8 +1225,6 @@
\value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
touch events to be sent to the widget.
- \value WA_DontUseStandardGestures Disables standard gestures on Qt widgets.
-
\omitvalue WA_SetLayoutDirection
\omitvalue WA_InputMethodTransparent
\omitvalue WA_WState_CompressKeys
@@ -2798,15 +2796,54 @@
This enum type describes the state of a gesture.
- \value NoGesture Initial state
\value GestureStarted A continuous gesture has started.
\value GestureUpdated A gesture continues.
\value GestureFinished A gesture has finished.
+ \value GestureCanceled A gesture was canceled.
+ \omitvalue NoGesture
\sa QGesture
*/
/*!
+ \enum Qt::GestureType
+ \since 4.6
+
+ This enum type describes the standard gestures.
+
+ \value TapGesture A Tap gesture.
+ \value TapAndHoldGesture A Tap-And-Hold (Long-Tap) gesture.
+ \value PanGesture A Pan gesture.
+ \value PinchGesture A Pinch gesture.
+ \value SwipeGesture A Swipe gesture.
+ \value CustomGesture User-defined gesture ID.
+ \value LastGestureType Last user gesture ID.
+
+ User-defined gestures are registered with the
+ QApplication::registerGestureRecognizer() function which generates a custom gesture ID
+ in the range of values from CustomGesture to LastGestureType.
+
+ \sa QGesture, QWidget::grabGesture()
+*/
+
+/*!
+ \enum Qt::GestureContext
+ \since 4.6
+
+ This enum type describes the context of a gesture.
+
+ For a QGesture to trigger, the gesture recognizer should filter events for
+ a widget tree. This enum describes for which widget the gesture recognizer
+ should filter events:
+
+ \value WidgetGesture Gestures can only start over the widget itself.
+ \value WidgetWithChildrenGesture Gestures can start on the widget or over
+ any of its children.
+
+ \sa QWidget::grabGesture()
+*/
+
+/*!
\enum Qt::NavigationMode
\since 4.6