summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-09-29 10:56:05 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-09-29 10:56:05 (GMT)
commit17c17adbd706d32723ecedeb207c7e467f9fa8eb (patch)
tree22d6d314dc7320d0b728578a734d636a1d74d9ae /src/corelib
parent1ff83d2b44fe07d1bc6b243fad270dfa7d860dc7 (diff)
parentdcd185e58face87105f484e98ecb195af0790a22 (diff)
downloadQt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.zip
Qt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.tar.gz
Qt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.tar.bz2
Merge commit 'qt/4.6' into mmfphonon
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp19
-rw-r--r--src/corelib/animation/qabstractanimation.h2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp14
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h2
-rw-r--r--src/corelib/animation/qpauseanimation.cpp2
-rw-r--r--src/corelib/animation/qpauseanimation.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp2
-rw-r--r--src/corelib/animation/qvariantanimation.h2
-rw-r--r--src/corelib/arch/symbian/qatomic_symbian.cpp7
-rw-r--r--src/corelib/global/qfeatures.h2
-rw-r--r--src/corelib/global/qfeatures.txt2
-rw-r--r--src/corelib/global/qglobal.cpp36
-rw-r--r--src/corelib/global/qnamespace.qdoc4
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp2
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp12
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp3
-rw-r--r--src/corelib/kernel/qcoreevent.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp133
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp8
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp3
-rw-r--r--src/corelib/kernel/qsystemsemaphore_symbian.cpp2
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp10
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h4
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp12
-rw-r--r--src/corelib/statemachine/qsignalevent.h83
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp15
-rw-r--r--src/corelib/statemachine/qstate.cpp4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp93
-rw-r--r--src/corelib/statemachine/qstatemachine.h36
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h7
-rw-r--r--src/corelib/statemachine/qwrappedevent.h80
-rw-r--r--src/corelib/statemachine/statemachine.pri4
-rw-r--r--src/corelib/tools/qlocale.cpp7
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
37 files changed, 303 insertions, 326 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 9027be0..f92c22d 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -194,12 +194,6 @@ QUnifiedTimer *QUnifiedTimer::instance()
void QUnifiedTimer::timerEvent(QTimerEvent *event)
{
- //this is simply the time we last received a tick
- const int oldLastTick = lastTick;
- if (time.isValid())
- lastTick = consistentTiming ? oldLastTick + timingInterval : time.elapsed();
-
-
if (event->timerId() == startStopAnimationTimer.timerId()) {
startStopAnimationTimer.stop();
//we transfer the waiting animations into the "really running" state
@@ -207,13 +201,16 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event)
animationsToStart.clear();
if (animations.isEmpty()) {
animationTimer.stop();
- time = QTime();
} else if (!animationTimer.isActive()) {
animationTimer.start(timingInterval, this);
lastTick = 0;
time.start();
}
} else if (event->timerId() == animationTimer.timerId()) {
+ //this is simply the time we last received a tick
+ const int oldLastTick = lastTick;
+ lastTick = consistentTiming ? oldLastTick + timingInterval : time.elapsed();
+
//we make sure we only call update time if the time has actually changed
//it might happen in some cases that the time doesn't change because events are delayed
//when the CPU load is high
@@ -604,7 +601,7 @@ void QAbstractAnimation::setCurrentTime(int msecs)
}
}
- updateCurrentTime();
+ updateCurrentTime(d->currentTime);
if (d->currentLoop != oldLoop)
emit currentLoopChanged(d->currentLoop);
@@ -705,10 +702,10 @@ bool QAbstractAnimation::event(QEvent *event)
}
/*!
- \fn virtual void QAbstractAnimation::updateCurrentTime() = 0;
+ \fn virtual void QAbstractAnimation::updateCurrentTime(int currentTime) = 0;
- This pure virtual function is called every time the animation's current
- time changes.
+ This pure virtual function is called every time the animation's
+ \a currentTime changes.
\sa updateState()
*/
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index 516f5e9..50b07d7 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -119,7 +119,7 @@ protected:
QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0);
bool event(QEvent *event);
- virtual void updateCurrentTime() = 0;
+ virtual void updateCurrentTime(int currentTime) = 0;
virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
virtual void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 82d5224..5b7fd22 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -125,7 +125,7 @@ int QParallelAnimationGroup::duration() const
/*!
\reimp
*/
-void QParallelAnimationGroup::updateCurrentTime()
+void QParallelAnimationGroup::updateCurrentTime(int currentTime)
{
Q_D(QParallelAnimationGroup);
if (d->animations.isEmpty())
@@ -148,7 +148,7 @@ void QParallelAnimationGroup::updateCurrentTime()
}
}
- bool timeFwd = ((d->currentLoop == d->lastLoop && d->currentTime >= d->lastCurrentTime)
+ bool timeFwd = ((d->currentLoop == d->lastLoop && currentTime >= d->lastCurrentTime)
|| d->currentLoop > d->lastLoop);
#ifdef QANIMATION_DEBUG
qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d",
@@ -160,7 +160,7 @@ void QParallelAnimationGroup::updateCurrentTime()
const int dura = animation->totalDuration();
if (dura == -1 && d->isUncontrolledAnimationFinished(animation))
continue;
- if (dura == -1 || (d->currentTime <= dura && dura != 0)
+ if (dura == -1 || (currentTime <= dura && dura != 0)
|| (dura == 0 && d->currentLoop != d->lastLoop)) {
switch (state()) {
case Running:
@@ -177,18 +177,18 @@ void QParallelAnimationGroup::updateCurrentTime()
if (dura <= 0) {
if (dura == -1)
- animation->setCurrentTime(d->currentTime);
+ animation->setCurrentTime(currentTime);
continue;
}
if ((timeFwd && d->lastCurrentTime <= dura)
|| (!timeFwd && d->currentTime <= dura))
- animation->setCurrentTime(d->currentTime);
- if (d->currentTime > dura)
+ animation->setCurrentTime(currentTime);
+ if (currentTime > dura)
animation->stop();
}
d->lastLoop = d->currentLoop;
- d->lastCurrentTime = d->currentTime;
+ d->lastCurrentTime = currentTime;
}
/*!
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index 6afe4a7..1cab91e 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -67,7 +67,7 @@ protected:
QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent);
bool event(QEvent *event);
- void updateCurrentTime();
+ void updateCurrentTime(int currentTime);
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index c382b19..2fd12aa 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -141,7 +141,7 @@ bool QPauseAnimation::event(QEvent *e)
/*!
\reimp
*/
-void QPauseAnimation::updateCurrentTime()
+void QPauseAnimation::updateCurrentTime(int)
{
}
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index caac9e9..1b81472 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -68,7 +68,7 @@ public:
protected:
bool event(QEvent *e);
- void updateCurrentTime();
+ void updateCurrentTime(int);
private:
Q_DISABLE_COPY(QPauseAnimation)
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 9ad433f..5ca560a 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -334,7 +334,7 @@ int QSequentialAnimationGroup::duration() const
/*!
\reimp
*/
-void QSequentialAnimationGroup::updateCurrentTime()
+void QSequentialAnimationGroup::updateCurrentTime(int currentTime)
{
Q_D(QSequentialAnimationGroup);
if (!d->currentAnimation)
@@ -359,7 +359,7 @@ void QSequentialAnimationGroup::updateCurrentTime()
d->setCurrentAnimation(newAnimationIndex.index);
- const int newCurrentTime = d->currentTime - newAnimationIndex.timeOffset;
+ const int newCurrentTime = currentTime - newAnimationIndex.timeOffset;
if (d->currentAnimation) {
d->currentAnimation->setCurrentTime(newCurrentTime);
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index 1c9e4cc..f30f851 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -77,7 +77,7 @@ protected:
QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent);
bool event(QEvent *event);
- void updateCurrentTime();
+ void updateCurrentTime(int);
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index ae8bf2f..de8185b 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -656,7 +656,7 @@ QVariant QVariantAnimation::interpolated(const QVariant &from, const QVariant &t
/*!
\reimp
*/
-void QVariantAnimation::updateCurrentTime()
+void QVariantAnimation::updateCurrentTime(int)
{
d_func()->recalculateCurrentInterval();
}
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index 98c1aec..bc57b1c 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -102,7 +102,7 @@ protected:
QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = 0);
bool event(QEvent *event);
- void updateCurrentTime();
+ void updateCurrentTime(int);
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
virtual void updateCurrentValue(const QVariant &value) = 0;
diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp
index 1d43fbb..71bd145 100644
--- a/src/corelib/arch/symbian/qatomic_symbian.cpp
+++ b/src/corelib/arch/symbian/qatomic_symbian.cpp
@@ -86,10 +86,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
-// This declspec needs to be explicit. RVCT has a bug which prevents embedded
-// assembler functions from being exported (normally all functions are
-// exported, and Q_CORE_EXPORT resolves to nothing).
-__declspec(dllexport) __asm char q_atomic_swp(volatile char *ptr, char newval)
+Q_CORE_EXPORT __asm char q_atomic_swp(volatile char *ptr, char newval)
{
add r2, pc, #0
bx r2
@@ -100,7 +97,7 @@ __declspec(dllexport) __asm char q_atomic_swp(volatile char *ptr, char newval)
thumb
}
-__declspec(dllexport) __asm int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
+Q_CORE_EXPORT __asm int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
add r2, pc, #0
bx r2
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 29f46f6..36c2cf9 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -847,7 +847,7 @@
#endif
// QPrintPreviewDialog
-#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG))
+#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_MAINWINDOW))
#define QT_NO_PRINTPREVIEWDIALOG
#endif
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 3a6c050..ec47883 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -612,7 +612,7 @@ SeeAlso: ???
Feature: PRINTPREVIEWDIALOG
Description: Provides a dialog for previewing and configuring page layouts for printer output.
Section: Dialogs
-Requires: PRINTPREVIEWWIDGET PRINTDIALOG
+Requires: PRINTPREVIEWWIDGET PRINTDIALOG MAINWINDOW
Name: QPrintPreviewDialog
SeeAlso: ???
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 4974acf..63e2891 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1066,6 +1066,7 @@ bool qSharedBuild()
/*!
\fn QSysInfo::SymbianVersion QSysInfo::symbianVersion()
+ \since 4.6
Returns the version of the Symbian operating system on which the
application is run (Symbian only).
@@ -1073,6 +1074,7 @@ bool qSharedBuild()
/*!
\fn QSysInfo::S60Version QSysInfo::s60Version()
+ \since 4.6
Returns the version of the S60 SDK system on which the
application is run (S60 only).
@@ -1769,25 +1771,6 @@ static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1);
QSysInfo::S60Version QSysInfo::s60Version()
{
-# ifdef Q_CC_NOKIAX86
- // For emulator builds. Emulators don't support the trick we use to figure
- // out which SDK we are running under, so simply hardcode it there.
-# if defined(__SERIES60_31__)
- return SV_S60_3_1;
-
-# elif defined(__S60_32__)
- return SV_S60_3_2;
-
-# elif defined(__S60_50__)
- return SV_S60_5_0;
-
-# else
- return SV_S60_Unknown;
-
-# endif
-
-# else
- // For hardware builds.
if (cachedS60Version != -1)
return cachedS60Version;
@@ -1818,6 +1801,19 @@ QSysInfo::S60Version QSysInfo::s60Version()
delete contents;
}
+# ifdef Q_CC_NOKIAX86
+ // Some emulator environments may not contain the version specific .sis files, so
+ // simply hardcode the version on those environments.
+# if defined(__SERIES60_31__)
+ return cachedS60Version = SV_S60_3_1;
+# elif defined(__S60_32__)
+ return cachedS60Version = SV_S60_3_2;
+# elif defined(__S60_50__)
+ return cachedS60Version = SV_S60_5_0;
+# else
+ return cachedS60Version = SV_S60_Unknown;
+# endif
+# else
return cachedS60Version = SV_S60_Unknown;
# endif
}
@@ -2718,7 +2714,7 @@ int qrand()
\since 4.6
\brief The QT_TRID_NOOP macro marks an id for dynamic translation.
-
+
The only purpose of this macro is to provide an anchor for attaching
meta data like to qtTrId().
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 18b4d67..40dd1d2 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1826,9 +1826,7 @@
\value TabFocus the widget accepts focus by tabbing.
\value ClickFocus the widget accepts focus by clicking.
\value StrongFocus the widget accepts focus by both tabbing
- and clicking. On Mac OS X this will also
- be indicate that the widget accepts tab focus
- when in 'Text/List focus mode'.
+ and clicking.
\value WheelFocus like Qt::StrongFocus plus the widget accepts
focus by using the mouse wheel.
\value NoFocus the widget does not accept focus.
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index b01302b..d9b994e 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -248,7 +248,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine()
eng = QDnotifyFileSystemWatcherEngine::create();
return eng;
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
-# if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+# if 0 && (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
return QFSEventsFileSystemWatcherEngine::create();
else
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index ce6c844..8e2273d 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1226,6 +1226,9 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
/*!
\fn bool QAbstractItemModel::insertRow(int row, const QModelIndex &parent)
+ \note The base class implementation of this function does nothing and
+ returns false.
+
Inserts a single row before the given \a row in the child items of the
\a parent specified.
@@ -1834,6 +1837,9 @@ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
}
/*!
+ \note The base class implementation of this function does nothing and
+ returns false.
+
On models that support this, inserts \a count rows into the model before
the given \a row. Items in the new row will be children of the item
represented by the \a parent model index.
@@ -1849,11 +1855,11 @@ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
Returns true if the rows were successfully inserted; otherwise returns
false.
- The base class implementation does nothing and returns false.
-
If you implement your own model, you can reimplement this function if you
want to support insertions. Alternatively, you can provide your own API for
- altering the data.
+ altering the data. In either case, you will need to call
+ beginInsertRows() and endInsertRows() to notify other components that the
+ model has changed.
\sa insertColumns(), removeRows(), beginInsertRows(), endInsertRows()
*/
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 61b9ee7..8a55bad 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2067,7 +2067,8 @@ QStringList QCoreApplication::arguments()
;
else if (l1arg == "-style" ||
l1arg == "-session" ||
- l1arg == "-graphicssystem")
+ l1arg == "-graphicssystem" ||
+ l1arg == "-testability")
++a;
else
stripped += arg;
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 746474c..185c305 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -192,6 +192,7 @@ QT_BEGIN_NAMESPACE
\value ShortcutOverride Key press in child, for overriding shortcut key handling (QKeyEvent).
\value Show Widget was shown on screen (QShowEvent).
\value ShowToParent A child widget has been shown.
+ \value Signal A signal delivered to a state machine (QStateMachine::SignalEvent).
\value SockAct Socket activated, used to implement QSocketNotifier.
\value StatusTip A status tip is requested (QStatusTipEvent).
\value StyleChange Widget's style has been changed.
@@ -220,7 +221,7 @@ QT_BEGIN_NAMESPACE
\value WindowStateChange The \l{QWidget::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent).
\value WindowTitleChange The window title has changed.
\value WindowUnblocked The window is unblocked after a modal dialog exited.
- \value Wrapped The event is a wrapper for, i.e., contains, another event (QWrappedEvent).
+ \value Wrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent).
\value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows.
\value KeyboardLayoutChange The keyboard layout has changed.
\value DynamicPropertyChange A dynamic property was added, changed or removed from the object.
@@ -269,8 +270,8 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
- \omitvalue Signal
\omitvalue SymbianDeferredFocusChanged
+ \omitvalue UpdateSoftKeys
\omitvalue NativeGesture
*/
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 6e457f4..665b73e 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -127,16 +127,11 @@ struct GTimerSource
GSource source;
QTimerInfoList timerList;
QEventLoop::ProcessEventsFlags processEventsFlags;
+ bool runWithIdlePriority;
};
-static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout)
{
- gint dummy;
- if (!timeout)
- timeout = &dummy;
-
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
timeval tv = { 0l, 0l };
if (!(src->processEventsFlags & QEventLoop::X11ExcludeTimers) && src->timerList.timerWait(tv))
*timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
@@ -146,10 +141,8 @@ static gboolean timerSourcePrepare(GSource *source, gint *timeout)
return (*timeout == 0);
}
-static gboolean timerSourceCheck(GSource *source)
+static gboolean timerSourceCheckHelper(GTimerSource *src)
{
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
if (src->timerList.isEmpty()
|| (src->processEventsFlags & QEventLoop::X11ExcludeTimers))
return false;
@@ -160,9 +153,35 @@ static gboolean timerSourceCheck(GSource *source)
return true;
}
+static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+{
+ gint dummy;
+ if (!timeout)
+ timeout = &dummy;
+
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority) {
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(src, timeout);
+}
+
+static gboolean timerSourceCheck(GSource *source)
+{
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority)
+ return false;
+ return timerSourceCheckHelper(src);
+}
+
static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer)
{
- (void) reinterpret_cast<GTimerSource *>(source)->timerList.activateTimers();
+ GTimerSource *timerSource = reinterpret_cast<GTimerSource *>(source);
+ timerSource->runWithIdlePriority = true;
+ (void) timerSource->timerList.activateTimers();
return true; // ??? don't remove, right again?
}
@@ -175,6 +194,53 @@ static GSourceFuncs timerSourceFuncs = {
NULL
};
+struct GIdleTimerSource
+{
+ GSource source;
+ GTimerSource *timerSource;
+};
+
+static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(timerSource, timeout);
+}
+
+static gboolean idleTimerSourceCheck(GSource *source)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ return false;
+ }
+ return timerSourceCheckHelper(timerSource);
+}
+
+static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
+{
+ GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource;
+ (void) timerSourceDispatch(&timerSource->source, 0, 0);
+ return true;
+}
+
+static GSourceFuncs idleTimerSourceFuncs = {
+ idleTimerSourcePrepare,
+ idleTimerSourceCheck,
+ idleTimerSourceDispatch,
+ NULL,
+ NULL,
+ NULL
+};
+
struct GPostEventSource
{
GSource source;
@@ -235,14 +301,15 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_main_context_ref(mainContext);
} else {
QCoreApplication *app = QCoreApplication::instance();
- if (app && QThread::currentThread() == app->thread()) {
- mainContext = g_main_context_default();
- g_main_context_ref(mainContext);
- } else {
- mainContext = g_main_context_new();
- }
+ if (app && QThread::currentThread() == app->thread()) {
+ mainContext = g_main_context_default();
+ g_main_context_ref(mainContext);
+ } else {
+ mainContext = g_main_context_new();
+ }
}
+ // setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
postEventSource->serialNumber = 1;
@@ -257,14 +324,21 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_source_set_can_recurse(&socketNotifierSource->source, true);
g_source_attach(&socketNotifierSource->source, mainContext);
- // setup timerSource
+ // setup normal and idle timer sources
timerSource = reinterpret_cast<GTimerSource *>(g_source_new(&timerSourceFuncs,
sizeof(GTimerSource)));
(void) new (&timerSource->timerList) QTimerInfoList();
timerSource->processEventsFlags = QEventLoop::AllEvents;
+ timerSource->runWithIdlePriority = false;
g_source_set_can_recurse(&timerSource->source, true);
- g_source_set_priority(&timerSource->source, G_PRIORITY_DEFAULT_IDLE);
g_source_attach(&timerSource->source, mainContext);
+
+ idleTimerSource = reinterpret_cast<GIdleTimerSource *>(g_source_new(&idleTimerSourceFuncs,
+ sizeof(GIdleTimerSource)));
+ idleTimerSource->timerSource = timerSource;
+ g_source_set_can_recurse(&idleTimerSource->source, true);
+ g_source_set_priority(&idleTimerSource->source, G_PRIORITY_DEFAULT_IDLE);
+ g_source_attach(&idleTimerSource->source, mainContext);
}
QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
@@ -272,12 +346,9 @@ QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
{
}
-QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext,
- QObject *parent)
- : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)),
- parent)
-{
-}
+QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, QObject *parent)
+ : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), parent)
+{ }
QEventDispatcherGlib::~QEventDispatcherGlib()
{
@@ -289,6 +360,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
g_source_destroy(&d->timerSource->source);
g_source_unref(&d->timerSource->source);
d->timerSource = 0;
+ g_source_destroy(&d->idleTimerSource->source);
+ g_source_unref(&d->idleTimerSource->source);
+ d->idleTimerSource = 0;
// destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
@@ -324,11 +398,16 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
// tell postEventSourcePrepare() and timerSource about any new flags
QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
d->timerSource->processEventsFlags = flags;
-
+
+ if (!(flags & QEventLoop::EventLoopExec)) {
+ // force timers to be sent at normal priority
+ d->timerSource->runWithIdlePriority = false;
+ }
+
bool result = g_main_context_iteration(d->mainContext, canWait);
while (!result && canWait)
result = g_main_context_iteration(d->mainContext, canWait);
-
+
d->timerSource->processEventsFlags = savedFlags;
if (canWait)
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 8dbc44d..6a4e726 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -98,6 +98,7 @@ protected:
struct GPostEventSource;
struct GSocketNotifierSource;
struct GTimerSource;
+struct GIdleTimerSource;
class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate
{
@@ -108,6 +109,7 @@ public:
GPostEventSource *postEventSource;
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
+ GIdleTimerSource *idleTimerSource;
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index a912971..5a0afb8 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -446,10 +446,10 @@ bool QTimerInfoList::timerWait(timeval &tm)
// Find first waiting timer not already active
QTimerInfo *t = 0;
for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
- if (!(*it)->inTimerEvent) {
- t = *it;
- break;
- }
+ if (!(*it)->inTimerEvent) {
+ t = *it;
+ break;
+ }
}
if (!t)
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 83114dc..0474bf3 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -678,7 +678,8 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|| (msg.message >= WM_MOUSEFIRST
&& msg.message <= WM_MOUSELAST)
|| msg.message == WM_MOUSEWHEEL
- || msg.message == WM_MOUSEHWHEEL)) {
+ || msg.message == WM_MOUSEHWHEEL
+ || msg.message == WM_CLOSE)) {
// queue user input events for later processing
haveMessage = false;
d->queuedUserInputEvents.append(msg);
diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp
index 90f4e70..31fd9e9 100644
--- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp
@@ -66,7 +66,7 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function, int err)
error = QSystemSemaphore::AlreadyExists;
break;
case KErrNotFound:
- errorString = QCoreApplication::tr("%1: doesn't exists", "QSystemSemaphore").arg(function);
+ errorString = QCoreApplication::tr("%1: does not exist", "QSystemSemaphore").arg(function);
error = QSystemSemaphore::NotFound;
break;
case KErrNoMemory:
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index a81fe0f..76baa0a 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -93,6 +93,10 @@ QT_BEGIN_NAMESPACE
\property QAbstractTransition::targetState
\brief the target state of this transition
+
+ If a transition has no target state, the transition may still be
+ triggered, but this will not cause the state machine's configuration to
+ change (i.e. the current state will not be exited and re-entered).
*/
/*!
@@ -187,7 +191,7 @@ QAbstractState *QAbstractTransition::targetState() const
Q_D(const QAbstractTransition);
if (d->targetStates.isEmpty())
return 0;
- return d->targetStates.first();
+ return d->targetStates.first().data();
}
/*!
@@ -211,7 +215,7 @@ QList<QAbstractState*> QAbstractTransition::targetStates() const
Q_D(const QAbstractTransition);
QList<QAbstractState*> result;
for (int i = 0; i < d->targetStates.size(); ++i) {
- QAbstractState *target = d->targetStates.at(i);
+ QAbstractState *target = d->targetStates.at(i).data();
if (target)
result.append(target);
}
@@ -225,7 +229,7 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
{
Q_D(QAbstractTransition);
- for (int i=0; i<targets.size(); ++i) {
+ for (int i = 0; i < targets.size(); ++i) {
QAbstractState *target = targets.at(i);
if (!target) {
qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null");
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 7465243..5b4df1b 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -56,7 +56,7 @@
#include <private/qobject_p.h>
#include <QtCore/qlist.h>
-#include <QtCore/qpointer.h>
+#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +80,7 @@ public:
QStateMachine *machine() const;
void emitTriggered();
- QList<QPointer<QAbstractState> > targetStates;
+ QList<QWeakPointer<QAbstractState> > targetStates;
#ifndef QT_NO_ANIMATION
QList<QAbstractAnimation*> animations;
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 2ce7b4a..f278371 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -44,7 +44,6 @@
#ifndef QT_NO_STATEMACHINE
#include "qeventtransition_p.h"
-#include "qwrappedevent.h"
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine.h"
@@ -83,10 +82,11 @@ QT_BEGIN_NAMESPACE
\section1 Subclassing
When reimplementing the eventTest() function, you should first call the base
- implementation to verify that the event is a QWrappedEvent for the proper
- object and event type. You may then cast the event to a QWrappedEvent and
- get the original event by calling QWrappedEvent::event(), and perform
- additional checks on that object.
+ implementation to verify that the event is a QStateMachine::WrappedEvent for
+ the proper object and event type. You may then cast the event to a
+ QStateMachine::WrappedEvent and get the original event by calling
+ QStateMachine::WrappedEvent::event(), and perform additional checks on that
+ object.
\sa QState::addTransition()
*/
@@ -232,7 +232,7 @@ bool QEventTransition::eventTest(QEvent *event)
{
Q_D(const QEventTransition);
if (event->type() == QEvent::Wrapped) {
- QWrappedEvent *we = static_cast<QWrappedEvent*>(event);
+ QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
return (we->object() == d->object)
&& (we->event()->type() == d->eventType);
}
diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h
deleted file mode 100644
index 6d2bd63..0000000
--- a/src/corelib/statemachine/qsignalevent.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIGNALEVENT_H
-#define QSIGNALEVENT_H
-
-#include <QtCore/qcoreevent.h>
-
-#include <QtCore/qlist.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-#ifndef QT_NO_STATEMACHINE
-
-class Q_CORE_EXPORT QSignalEvent : public QEvent
-{
-public:
- QSignalEvent(QObject *sender, int signalIndex,
- const QList<QVariant> &arguments);
- ~QSignalEvent();
-
- inline QObject *sender() const { return m_sender; }
- inline int signalIndex() const { return m_signalIndex; }
- inline QList<QVariant> arguments() const { return m_arguments; }
-
-private:
- QObject *m_sender;
- int m_signalIndex;
- QList<QVariant> m_arguments;
-
- friend class QSignalTransitionPrivate;
-};
-
-#endif //QT_NO_STATEMACHINE
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 74655e6..9811725 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -44,7 +44,6 @@
#ifndef QT_NO_STATEMACHINE
#include "qsignaltransition_p.h"
-#include "qsignalevent.h"
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine.h"
@@ -68,7 +67,7 @@ QT_BEGIN_NAMESPACE
You can subclass QSignalTransition and reimplement eventTest() to make a
signal transition conditional; the event object passed to eventTest() will
- be a QSignalEvent object. Example:
+ be a QStateMachine::SignalEvent object. Example:
\code
class CheckedTransition : public QSignalTransition
@@ -80,7 +79,7 @@ QT_BEGIN_NAMESPACE
bool eventTest(QEvent *e) const {
if (!QSignalTransition::eventTest(e))
return false;
- QSignalEvent *se = static_cast<QSignalEvent*>(e);
+ QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
return (se->arguments().at(0).toInt() == Qt::Checked);
}
};
@@ -212,9 +211,9 @@ void QSignalTransition::setSignal(const QByteArray &signal)
/*!
\reimp
- The \a event is a QSignalEvent object. The default implementation returns
- true if the event's sender and signal index match this transition, and
- returns false otherwise.
+ The default implementation returns true if the \a event is a
+ QStateMachine::SignalEvent object and the event's sender and signal index
+ match this transition, and returns false otherwise.
*/
bool QSignalTransition::eventTest(QEvent *event)
{
@@ -222,7 +221,7 @@ bool QSignalTransition::eventTest(QEvent *event)
if (event->type() == QEvent::Signal) {
if (d->signalIndex == -1)
return false;
- QSignalEvent *se = static_cast<QSignalEvent*>(event);
+ QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event);
return (se->sender() == d->sender)
&& (se->signalIndex() == d->signalIndex);
}
@@ -250,7 +249,7 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e)
Q_Q(QSignalTransition);
if (e->type() == QEvent::Signal) {
- QSignalEvent *se = static_cast<QSignalEvent *>(e);
+ QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent *>(e);
int savedSignalIndex = se->m_signalIndex;
se->m_signalIndex = originalSignalIndex;
q->onTransition(e);
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 70026b8..a6e4a57 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -291,9 +291,9 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition)
}
transition->setParent(this);
- const QList<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
+ const QList<QWeakPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
for (int i = 0; i < targets.size(); ++i) {
- QAbstractState *t = targets.at(i);
+ QAbstractState *t = targets.at(i).data();
if (!t) {
qWarning("QState::addTransition: cannot add transition to null state");
return 0;
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 7876d43..8d50870c 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -50,7 +50,6 @@
#include "qabstracttransition_p.h"
#include "qsignaltransition.h"
#include "qsignaltransition_p.h"
-#include "qsignalevent.h"
#include "qsignaleventgenerator_p.h"
#include "qabstractstate.h"
#include "qabstractstate_p.h"
@@ -63,7 +62,6 @@
#ifndef QT_NO_STATEMACHINE_EVENTFILTER
#include "qeventtransition.h"
#include "qeventtransition_p.h"
-#include "qwrappedevent.h"
#endif
#ifndef QT_NO_ANIMATION
@@ -806,6 +804,14 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr
}
if (hasValidEndValue) {
+ if (anim->state() == QAbstractAnimation::Running) {
+ // The animation is still running. This can happen if the
+ // animation is a group, and one of its children just finished,
+ // and that caused a state to emit its polished() signal, and
+ // that triggered a transition in the machine.
+ // Just stop the animation so it is correctly restarted again.
+ anim->stop();
+ }
anim->start();
}
}
@@ -1270,12 +1276,19 @@ void QStateMachinePrivate::_q_process()
}
}
-void QStateMachinePrivate::scheduleProcess()
+void QStateMachinePrivate::processEvents(EventProcessingMode processingMode)
{
if ((state != Running) || processing || processingScheduled)
return;
- processingScheduled = true;
- QMetaObject::invokeMethod(q_func(), "_q_process", Qt::QueuedConnection);
+ switch (processingMode) {
+ case DirectProcessing:
+ _q_process();
+ break;
+ case QueuedProcessing:
+ processingScheduled = true;
+ QMetaObject::invokeMethod(q_func(), "_q_process", Qt::QueuedConnection);
+ break;
+ }
}
namespace {
@@ -1337,7 +1350,7 @@ void QStateMachinePrivate::goToState(QAbstractState *targetState)
trans->setTargetState(targetState);
}
- scheduleProcess();
+ processEvents(QueuedProcessing);
}
void QStateMachinePrivate::registerTransitions(QAbstractState *state)
@@ -1514,6 +1527,15 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio
}
QEventTransitionPrivate::get(transition)->registered = false;
}
+
+void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event)
+{
+ Q_ASSERT(qobjectEvents.contains(watched));
+ if (qobjectEvents[watched].contains(event->type())) {
+ internalEventQueue.append(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event)));
+ processEvents(DirectProcessing);
+ }
+}
#endif
void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalIndex,
@@ -1534,8 +1556,8 @@ void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalInd
qDebug() << q_func() << ": sending signal event ( sender =" << sender
<< ", signal =" << sender->metaObject()->method(signalIndex).signature() << ')';
#endif
- internalEventQueue.append(new QSignalEvent(sender, signalIndex, vargs));
- scheduleProcess();
+ internalEventQueue.append(new QStateMachine::SignalEvent(sender, signalIndex, vargs));
+ processEvents(DirectProcessing);
}
/*!
@@ -1770,7 +1792,7 @@ void QStateMachine::stop()
break;
case QStateMachinePrivate::Running:
d->stop = true;
- d->scheduleProcess();
+ d->processEvents(QStateMachinePrivate::QueuedProcessing);
break;
}
}
@@ -1800,7 +1822,7 @@ void QStateMachine::postEvent(QEvent *event, int delay)
d->delayedEvents[tid] = event;
} else {
d->externalEventQueue.append(event);
- d->scheduleProcess();
+ d->processEvents(QStateMachinePrivate::QueuedProcessing);
}
}
@@ -1816,7 +1838,7 @@ void QStateMachine::postInternalEvent(QEvent *event)
qDebug() << this << ": posting internal event" << event;
#endif
d->internalEventQueue.append(event);
- d->scheduleProcess();
+ d->processEvents(QStateMachinePrivate::QueuedProcessing);
}
/*!
@@ -1864,7 +1886,7 @@ bool QStateMachine::event(QEvent *e)
killTimer(tid);
QEvent *ee = d->delayedEvents.take(tid);
d->externalEventQueue.append(ee);
- d->scheduleProcess();
+ d->processEvents(QStateMachinePrivate::DirectProcessing);
return true;
}
}
@@ -1878,9 +1900,7 @@ bool QStateMachine::event(QEvent *e)
bool QStateMachine::eventFilter(QObject *watched, QEvent *event)
{
Q_D(QStateMachine);
- Q_ASSERT(d->qobjectEvents.contains(watched));
- if (d->qobjectEvents[watched].contains(event->type()))
- postEvent(new QWrappedEvent(watched, d->handler->cloneEvent(event)));
+ d->handleFilteredEvent(watched, event);
return false;
}
#endif
@@ -2076,16 +2096,16 @@ QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)
}
/*!
- \class QSignalEvent
+ \class QStateMachine::SignalEvent
- \brief The QSignalEvent class represents a Qt signal event.
+ \brief The SignalEvent class represents a Qt signal event.
\since 4.6
\ingroup statemachine
A signal event is generated by a QStateMachine in response to a Qt
signal. The QSignalTransition class provides a transition associated with a
- signal event. QSignalEvent is part of \l{The State Machine Framework}.
+ signal event. QStateMachine::SignalEvent is part of \l{The State Machine Framework}.
The sender() function returns the object that generated the signal. The
signalIndex() function returns the index of the signal. The arguments()
@@ -2097,25 +2117,25 @@ QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)
/*!
\internal
- Constructs a new QSignalEvent object with the given \a sender, \a
+ Constructs a new SignalEvent object with the given \a sender, \a
signalIndex and \a arguments.
*/
-QSignalEvent::QSignalEvent(QObject *sender, int signalIndex,
- const QList<QVariant> &arguments)
+QStateMachine::SignalEvent::SignalEvent(QObject *sender, int signalIndex,
+ const QList<QVariant> &arguments)
: QEvent(QEvent::Signal), m_sender(sender),
m_signalIndex(signalIndex), m_arguments(arguments)
{
}
/*!
- Destroys this QSignalEvent.
+ Destroys this SignalEvent.
*/
-QSignalEvent::~QSignalEvent()
+QStateMachine::SignalEvent::~SignalEvent()
{
}
/*!
- \fn QSignalEvent::sender() const
+ \fn QStateMachine::SignalEvent::sender() const
Returns the object that emitted the signal.
@@ -2123,7 +2143,7 @@ QSignalEvent::~QSignalEvent()
*/
/*!
- \fn QSignalEvent::signalIndex() const
+ \fn QStateMachine::SignalEvent::signalIndex() const
Returns the index of the signal.
@@ -2131,23 +2151,24 @@ QSignalEvent::~QSignalEvent()
*/
/*!
- \fn QSignalEvent::arguments() const
+ \fn QStateMachine::SignalEvent::arguments() const
Returns the arguments of the signal.
*/
/*!
- \class QWrappedEvent
+ \class QStateMachine::WrappedEvent
- \brief The QWrappedEvent class holds a clone of an event associated with a QObject.
+ \brief The WrappedEvent class holds a clone of an event associated with a QObject.
\since 4.6
\ingroup statemachine
A wrapped event is generated by a QStateMachine in response to a Qt
event. The QEventTransition class provides a transition associated with a
- such an event. QWrappedEvent is part of \l{The State Machine Framework}.
+ such an event. QStateMachine::WrappedEvent is part of \l{The State Machine
+ Framework}.
The object() function returns the object that generated the event. The
event() function returns a clone of the original event.
@@ -2158,32 +2179,32 @@ QSignalEvent::~QSignalEvent()
/*!
\internal
- Constructs a new QWrappedEvent object with the given \a object
+ Constructs a new WrappedEvent object with the given \a object
and \a event.
- The QWrappedEvent object takes ownership of \a event.
+ The WrappedEvent object takes ownership of \a event.
*/
-QWrappedEvent::QWrappedEvent(QObject *object, QEvent *event)
+QStateMachine::WrappedEvent::WrappedEvent(QObject *object, QEvent *event)
: QEvent(QEvent::Wrapped), m_object(object), m_event(event)
{
}
/*!
- Destroys this QWrappedEvent.
+ Destroys this WrappedEvent.
*/
-QWrappedEvent::~QWrappedEvent()
+QStateMachine::WrappedEvent::~WrappedEvent()
{
delete m_event;
}
/*!
- \fn QWrappedEvent::object() const
+ \fn QStateMachine::WrappedEvent::object() const
Returns the object that the event is associated with.
*/
/*!
- \fn QWrappedEvent::event() const
+ \fn QStateMachine::WrappedEvent::event() const
Returns a clone of the original event.
*/
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index dd524dd..a0b2b14 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -44,6 +44,7 @@
#include <QtCore/qstate.h>
+#include <QtCore/qcoreevent.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qset.h>
@@ -56,8 +57,6 @@ QT_MODULE(Core)
#ifndef QT_NO_STATEMACHINE
-class QEvent;
-
class QStateMachinePrivate;
class QAbstractAnimation;
class Q_CORE_EXPORT QStateMachine : public QState
@@ -70,6 +69,39 @@ class Q_CORE_EXPORT QStateMachine : public QState
Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled)
#endif
public:
+ class SignalEvent : public QEvent
+ {
+ public:
+ SignalEvent(QObject *sender, int signalIndex,
+ const QList<QVariant> &arguments);
+ ~SignalEvent();
+
+ inline QObject *sender() const { return m_sender; }
+ inline int signalIndex() const { return m_signalIndex; }
+ inline QList<QVariant> arguments() const { return m_arguments; }
+
+ private:
+ QObject *m_sender;
+ int m_signalIndex;
+ QList<QVariant> m_arguments;
+
+ friend class QSignalTransitionPrivate;
+ };
+
+ class WrappedEvent : public QEvent
+ {
+ public:
+ WrappedEvent(QObject *object, QEvent *event);
+ ~WrappedEvent();
+
+ inline QObject *object() const { return m_object; }
+ inline QEvent *event() const { return m_event; }
+
+ private:
+ QObject *m_object;
+ QEvent *m_event;
+ };
+
enum RestorePolicy {
DoNotRestoreProperties,
RestoreProperties
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index a1b6de2..141bc5c 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -88,6 +88,10 @@ public:
Starting,
Running
};
+ enum EventProcessingMode {
+ DirectProcessing,
+ QueuedProcessing
+ };
enum StopProcessingReason {
EventQueueEmpty,
Finished,
@@ -149,12 +153,13 @@ public:
#ifndef QT_NO_STATEMACHINE_EVENTFILTER
void registerEventTransition(QEventTransition *transition);
void unregisterEventTransition(QEventTransition *transition);
+ void handleFilteredEvent(QObject *watched, QEvent *event);
#endif
void unregisterTransition(QAbstractTransition *transition);
void unregisterAllTransitions();
void handleTransitionSignal(QObject *sender, int signalIndex,
void **args);
- void scheduleProcess();
+ void processEvents(EventProcessingMode processingMode);
#ifndef QT_NO_PROPERTIES
typedef QPair<QObject *, QByteArray> RestorableId;
diff --git a/src/corelib/statemachine/qwrappedevent.h b/src/corelib/statemachine/qwrappedevent.h
deleted file mode 100644
index e0a131b..0000000
--- a/src/corelib/statemachine/qwrappedevent.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWRAPPEDEVENT_H
-#define QWRAPPEDEVENT_H
-
-#include <QtCore/qcoreevent.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-#ifndef QT_NO_STATEMACHINE
-
-class QObject;
-
-class Q_CORE_EXPORT QWrappedEvent : public QEvent
-{
-public:
- QWrappedEvent(QObject *object, QEvent *event);
- ~QWrappedEvent();
-
- inline QObject *object() const { return m_object; }
- inline QEvent *event() const { return m_event; }
-
-private:
- QObject *m_object;
- QEvent *m_event;
-
-private:
- Q_DISABLE_COPY(QWrappedEvent)
-};
-
-#endif //QT_NO_STATEMACHINE
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index 5b19bc1..910cf5e 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -10,7 +10,6 @@ HEADERS += $$PWD/qstatemachine.h \
$$PWD/qhistorystate_p.h \
$$PWD/qabstracttransition.h \
$$PWD/qabstracttransition_p.h \
- $$PWD/qsignalevent.h \
$$PWD/qsignaltransition.h \
$$PWD/qsignaltransition_p.h
@@ -23,8 +22,7 @@ SOURCES += $$PWD/qstatemachine.cpp \
$$PWD/qsignaltransition.cpp
!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
-HEADERS += $$PWD/qwrappedevent.h \
- $$PWD/qeventtransition.h \
+HEADERS += $$PWD/qeventtransition.h \
$$PWD/qeventtransition_p.h
SOURCES += $$PWD/qeventtransition.cpp
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 136bafa..4a66b92 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -637,7 +637,8 @@ static QString winSystemPMText()
}
/*!
- Returns the fallback locale obtained from the system.
+ \since 4.6
+ Returns the fallback locale obtained from the system.
*/
QLocale QSystemLocale::fallbackLocale() const
{
@@ -1156,7 +1157,7 @@ static void getMacPreferredLanguageAndCountry(QString *language, QString *countr
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
- if (CFArrayGetCount(languages) > 0) {
+ if (languages && CFArrayGetCount(languages) > 0) {
QCFType<CFLocaleRef> locale = CFLocaleCreate(kCFAllocatorDefault,
CFStringRef(CFArrayGetValueAtIndex(languages, 0)));
if (language)
@@ -1283,6 +1284,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant /* in */) const
#elif !defined(Q_OS_SYMBIAN)
/*!
+ \since 4.6
+
Returns a fallback locale, that will get used for everything that
is not explicitly overridden by the system locale.
*/
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 4f05eda..2acbf17 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -478,7 +478,7 @@ public:
{ BaseClass::internalSet(other.d, other.value); return *this; }
inline void swap(QSharedPointer &other)
- { internalSwap(other); }
+ { QSharedPointer<T>::internalSwap(other); }
template <class X>
QSharedPointer<X> staticCast() const