diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-09-28 11:58:22 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-09-28 11:58:22 (GMT) |
commit | e058304cc2adc1115ccc3c557b3a16c6e1c1fa86 (patch) | |
tree | 28c0c97839a95e974728857b50a5afbffeec7d11 | |
parent | e1c95146e889a33108a4b3013ba64a4d15414e87 (diff) | |
parent | db032c025f56d2137b96e49fd817cae35dd5c8a3 (diff) | |
download | Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.zip Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.tar.gz Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
48 files changed, 234 insertions, 302 deletions
diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp index 4a9d845..10c173e 100644 --- a/demos/sub-attaq/states.cpp +++ b/demos/sub-attaq/states.cpp @@ -54,7 +54,6 @@ #include <QtGui/QGraphicsView> #include <QtCore/QStateMachine> #include <QtGui/QKeyEventTransition> -#include <QtCore/QSignalEvent> #include <QtCore/QFinalState> PlayState::PlayState(GraphicsScene *scene, QState *parent) @@ -295,7 +294,7 @@ bool UpdateScoreTransition::eventTest(QEvent *event) if (!QSignalTransition::eventTest(event)) return false; else { - QSignalEvent *se = static_cast<QSignalEvent*>(event); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event); game->score += se->arguments().at(0).toInt(); scene->progressItem->setScore(game->score); return true; @@ -315,7 +314,7 @@ bool WinTransition::eventTest(QEvent *event) if (!QSignalTransition::eventTest(event)) return false; else { - QSignalEvent *se = static_cast<QSignalEvent*>(event); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event); game->score += se->arguments().at(0).toInt(); scene->progressItem->setScore(game->score); return true; diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc index 3eb9249..4f9dc3f 100644 --- a/doc/src/examples/rogue.qdoc +++ b/doc/src/examples/rogue.qdoc @@ -194,7 +194,7 @@ \snippet examples/statemachine/rogue/movementtransition.h 1 - The KeyPress events come wrapped in \l{QWrappedEvent}s. \c event + The KeyPress events come wrapped in \l{QStateMachine::WrappedEvent}s. \c event must be confirmed to be a wrapped event because Qt uses other events internally. After that, it is simply a matter of checking which key has been pressed. diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index 904b551..2b137dd 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -308,9 +308,9 @@ A QStateMachine runs its own event loop. For signal transitions (QSignalTransition objects), QStateMachine automatically posts a - QSignalEvent to itself when it intercepts the corresponding signal; - similarly, for QObject event transitions (QEventTransition objects) a - QWrappedEvent is posted. + QStateMachine::SignalEvent to itself when it intercepts the corresponding + signal; similarly, for QObject event transitions (QEventTransition objects) + a QStateMachine::WrappedEvent is posted. You can post your own events to the state machine using QStateMachine::postEvent(). diff --git a/doc/src/snippets/statemachine/eventtest.cpp b/doc/src/snippets/statemachine/eventtest.cpp index b6397ba..817dbfc 100644 --- a/doc/src/snippets/statemachine/eventtest.cpp +++ b/doc/src/snippets/statemachine/eventtest.cpp @@ -52,7 +52,7 @@ protected: bool eventTest(QEvent *event) { if (event->type() == QEvent::Wrapped) { - QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event(); + QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event(); if (wrappedEvent->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent); // Do your event test diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index f5dca74..250fb85 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -64,7 +64,7 @@ public: virtual bool eventTest(QEvent *e) { if (QSignalTransition::eventTest(e)) { - QVariant key = static_cast<QSignalEvent*>(e)->arguments().at(0); + QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0); return (key.toInt() == int(m_key)); } diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp index 54f4ec0..018b84f 100644 --- a/examples/statemachine/factorial/main.cpp +++ b/examples/statemachine/factorial/main.cpp @@ -98,13 +98,13 @@ public: { 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() > 1; } virtual void onTransition(QEvent *e) { - QSignalEvent *se = static_cast<QSignalEvent*>(e); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); int x = se->arguments().at(0).toInt(); int fac = m_fact->property("fac").toInt(); m_fact->setProperty("fac", x * fac); @@ -128,7 +128,7 @@ public: { 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() <= 1; } diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h index dbaf8d9..b919360 100644 --- a/examples/statemachine/rogue/movementtransition.h +++ b/examples/statemachine/rogue/movementtransition.h @@ -62,8 +62,8 @@ public: protected: bool eventTest(QEvent *event) { if (event->type() == QEvent::Wrapped && - static_cast<QWrappedEvent *>(event)->event()->type() == QEvent::KeyPress) { - QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event(); + static_cast<QStateMachine::WrappedEvent *>(event)->event()->type() == QEvent::KeyPress) { + QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event(); QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent); int key = keyEvent->key(); @@ -78,7 +78,7 @@ protected: //![2] void onTransition(QEvent *event) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>( - static_cast<QWrappedEvent *>(event)->event()); + static_cast<QStateMachine::WrappedEvent *>(event)->event()); int key = keyEvent->key(); switch (key) { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h index 8072162..811818d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h @@ -43,11 +43,12 @@ namespace JSC { #if PLATFORM(QT) #ifdef QT_BUILD_SCRIPT_LIB - virtual void scriptUnload(qint64 id) + virtual void scriptUnload(QT_PREPEND_NAMESPACE(qint64) id) { UNUSED_PARAM(id); }; - virtual void scriptLoad(qint64 id, const UString &program, + virtual void scriptLoad(QT_PREPEND_NAMESPACE(qint64) id, + const UString &program, const UString &fileName, int baseLineNumber) { UNUSED_PARAM(id); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index 7d3a84d..ec242cc 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -3469,7 +3469,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi structure = callDataScopeChain->globalObject()->emptyObjectStructure(); #ifdef QT_BUILD_SCRIPT_LIB // ### world-class hack - QScriptObject* newObject = new (globalData) QScriptObject(structure); + QT_PREPEND_NAMESPACE(QScriptObject)* newObject + = new (globalData) QT_PREPEND_NAMESPACE(QScriptObject)(structure); #else JSObject* newObject = new (globalData) JSObject(structure); #endif diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index a110dcd..0b147df 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -1777,7 +1777,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct) else structure = constructor->scope().node()->globalObject()->emptyObjectStructure(); #ifdef QT_BUILD_SCRIPT_LIB - return new (stackFrame.globalData) QScriptObject(structure); + return new (stackFrame.globalData) QT_PREPEND_NAMESPACE(QScriptObject)(structure); #else return new (stackFrame.globalData) JSObject(structure); #endif @@ -3108,4 +3108,4 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) } // namespace JSC -#endif // ENABLE(JIT) + #endif // ENABLE(JIT) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h index b7af4f8..4d327cc 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h @@ -20,10 +20,12 @@ #ifndef QWEBINSPECTOR_P_H #define QWEBINSPECTOR_P_H +QT_BEGIN_NAMESPACE class QSize; +class QWidget; +QT_END_NAMESPACE class QWebInspector; class QWebPage; -class QWidget; class QWebInspectorPrivate { public: 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_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/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/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 7876d43..503eec0 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 @@ -1534,7 +1532,7 @@ 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)); + internalEventQueue.append(new QStateMachine::SignalEvent(sender, signalIndex, vargs)); scheduleProcess(); } @@ -1880,7 +1878,7 @@ 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))); + postEvent(new QStateMachine::WrappedEvent(watched, d->handler->cloneEvent(event))); return false; } #endif @@ -2076,16 +2074,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 +2095,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 +2121,7 @@ QSignalEvent::~QSignalEvent() */ /*! - \fn QSignalEvent::signalIndex() const + \fn QStateMachine::SignalEvent::signalIndex() const Returns the index of the signal. @@ -2131,23 +2129,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 +2157,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/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/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 diff --git a/src/gui/kernel/qeventdispatcher_x11.cpp b/src/gui/kernel/qeventdispatcher_x11.cpp index ce1a11f..59977ec 100644 --- a/src/gui/kernel/qeventdispatcher_x11.cpp +++ b/src/gui/kernel/qeventdispatcher_x11.cpp @@ -105,7 +105,7 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) // _qt_scrolldone protocols, queue all other // client messages if (event.xclient.format == 32) { - if (event.xclient.message_type == ATOM(WM_PROTOCOLS) || + if (event.xclient.message_type == ATOM(WM_PROTOCOLS) && (Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) { break; } else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) { diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp index 6e98428..f8a638c 100644 --- a/src/gui/kernel/qguieventdispatcher_glib.cpp +++ b/src/gui/kernel/qguieventdispatcher_glib.cpp @@ -120,7 +120,7 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe // _qt_scrolldone protocols, queue all other // client messages if (event.xclient.format == 32) { - if (event.xclient.message_type == ATOM(WM_PROTOCOLS) || + if (event.xclient.message_type == ATOM(WM_PROTOCOLS) && (Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) { break; } else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) { diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 45ecb5a..7874622 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -247,9 +247,15 @@ bool QSoftKeyManager::handleCommand(int command) if (command >= s60CommandStart && QSoftKeyManagerPrivate::softKeySource) { int index = command - s60CommandStart; const QList<QAction*>& softKeys = QSoftKeyManagerPrivate::softKeySource->actions(); - if (index < softKeys.count()) { - softKeys.at(index)->activate(QAction::Trigger); - return true; + for (int i = 0, j = 0; i < softKeys.count(); ++i) { + QAction *action = softKeys.at(i); + if (action->softKeyRole() != QAction::NoSoftKey) { + if (j == index) { + action->activate(QAction::Trigger); + return true; + } + j++; + } } } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 53ef682..2397793 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10145,7 +10145,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); #ifdef Q_WS_WIN - if (attribute == Qt::WA_PaintOnScreen && on) { + // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0 + if (attribute == Qt::WA_PaintOnScreen && on && !inherits("QGLWidget")) { // see qwidget_win.cpp, ::paintEngine for details paintEngine(); if (d->noPaintOnScreen) diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 1038f74..6b9d77c 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -44,11 +44,14 @@ //#include <private/qtextengine_p.h> #include <private/qfontengine_p.h> #include <private/qemulationpaintengine_p.h> +#include <private/qimage_p.h> #include <QDebug> //#define QPAINTBUFFER_DEBUG_DRAW +QT_BEGIN_NAMESPACE + extern int qt_defaultDpiX(); extern int qt_defaultDpiY(); extern void qt_format_text(const QFont &font, @@ -890,6 +893,12 @@ void QPaintBufferEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) buffer->updateBoundingRect(QRectF(pos, pm.size())); } +static inline QImage qpaintbuffer_storable_image(const QImage &src) +{ + QImageData *d = const_cast<QImage &>(src).data_ptr(); + return d->own_data ? src : src.copy(); +} + void QPaintBufferEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags /*flags */) { @@ -897,7 +906,8 @@ void QPaintBufferEngine::drawImage(const QRectF &r, const QImage &image, const Q qDebug() << "QPaintBufferEngine: drawImage: src/dest rects " << r << sr; #endif QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapRect, QVariant(image)); + buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImageRect, + QVariant(qpaintbuffer_storable_image(image))); cmd->extra = buffer->addData((qreal *) &r, 4); buffer->addData((qreal *) &sr, 4); // ### flags... @@ -911,7 +921,8 @@ void QPaintBufferEngine::drawImage(const QPointF &pos, const QImage &image) qDebug() << "QPaintBufferEngine: drawImage: pos:" << pos; #endif QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImagePos, QVariant(image)); + buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImagePos, + QVariant(qpaintbuffer_storable_image(image))); cmd->extra = buffer->addData((qreal *) &pos, 2); if (buffer->calculateBoundingRect) buffer->updateBoundingRect(QRectF(pos, image.size())); @@ -1740,7 +1751,9 @@ struct QPaintBufferCacheEntry QVariant::Type type; quint64 cacheKey; }; +QT_END_NAMESPACE Q_DECLARE_METATYPE(QPaintBufferCacheEntry) +QT_BEGIN_NAMESPACE QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntry &entry) { @@ -1832,3 +1845,4 @@ QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer) return stream; } +QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index a80fa8d..6a7ac73 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -59,6 +59,8 @@ #include <private/qtextengine_p.h> #include <QDebug> +QT_BEGIN_NAMESPACE + class QPaintBufferPrivate; class QPaintBufferPlayback; @@ -440,4 +442,6 @@ private: FreeFunc free; }; +QT_END_NAMESPACE + #endif // QPAINTBUFFER_P_H diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index 825b2ec..dee3168 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_STATEMACHINE #include "qbasickeyeventtransition_p.h" -#include <QtCore/qwrappedevent.h> +#include <QtCore/qstatemachine.h> #include <private/qeventtransition_p.h> QT_BEGIN_NAMESPACE @@ -160,7 +160,7 @@ bool QKeyEventTransition::eventTest(QEvent *event) Q_D(const QKeyEventTransition); if (!QEventTransition::eventTest(event)) return false; - QWrappedEvent *we = static_cast<QWrappedEvent*>(event); + QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event); d->transition->setEventType(we->event()->type()); return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); } diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 564c8d2..86cacf7 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_STATEMACHINE #include "qbasicmouseeventtransition_p.h" -#include <QtCore/qwrappedevent.h> +#include <QtCore/qstatemachine.h> #include <QtGui/qpainterpath.h> #include <private/qeventtransition_p.h> @@ -188,7 +188,7 @@ bool QMouseEventTransition::eventTest(QEvent *event) Q_D(const QMouseEventTransition); if (!QEventTransition::eventTest(event)) return false; - QWrappedEvent *we = static_cast<QWrappedEvent*>(event); + QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event); d->transition->setEventType(we->event()->type()); return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index b6ff39f..d9438fd 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1370,7 +1370,7 @@ int QTextBlock::firstLineNumber() const Sets the line count to \a count. -/sa lineCount() +\sa lineCount() */ void QTextBlock::setLineCount(int count) { diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 858846f..7a3be23 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -184,7 +184,7 @@ QAudioInput::~QAudioInput() Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. - /sa QIODevice + \sa QIODevice */ QIODevice* QAudioInput::start(QIODevice* device) diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 3d3f5f5..81b9496 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -195,7 +195,7 @@ QAudioFormat QAudioOutput::format() const Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. - /sa QIODevice + \sa QIODevice */ QIODevice* QAudioOutput::start(QIODevice* device) diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp index 7982982..edccb3e 100644 --- a/src/script/bridge/qscriptactivationobject.cpp +++ b/src/script/bridge/qscriptactivationobject.cpp @@ -46,7 +46,7 @@ namespace JSC { - ASSERT_CLASS_FITS_IN_CELL(QScript::QScriptActivationObject); + ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::QScriptActivationObject)); } QT_BEGIN_NAMESPACE diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp index 5f419ff..d3767bf 100644 --- a/src/script/bridge/qscriptfunction.cpp +++ b/src/script/bridge/qscriptfunction.cpp @@ -55,8 +55,8 @@ namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWrapper); -ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWithArgWrapper); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::FunctionWrapper)); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::FunctionWithArgWrapper)); } QT_BEGIN_NAMESPACE diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp index 0d899f8..55644fe 100644 --- a/src/script/bridge/qscriptobject.cpp +++ b/src/script/bridge/qscriptobject.cpp @@ -46,8 +46,8 @@ namespace JSC { //QT_USE_NAMESPACE -ASSERT_CLASS_FITS_IN_CELL(QScriptObject); -ASSERT_CLASS_FITS_IN_CELL(QScriptObjectPrototype); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScriptObject)); +ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScriptObjectPrototype)); } QT_BEGIN_NAMESPACE diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 7e7bcd1..1768fe6 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -734,7 +734,7 @@ QT_BEGIN_NAMESPACE \sa QTest::qSleep() */ -/*! \fn void QTest::qWaitForWindowManager(QWidget *window) +/*! \fn void QTest::qWaitForWindowShown(QWidget *window) Waits until the window is shown in the screen. This is mainly useful for asynchronous systems like X11, where a window will be mapped to screen some diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index be1cb98..61aabaa 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2125,15 +2125,17 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); comboBox.show(); + QTest::qWaitForWindowShown(&comboBox); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); QTRY_VERIFY(comboBox.view()); + QTest::qWaitForWindowShown(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); #ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox); QVERIFY(container); - QVERIFY(desktop.screenGeometry(container).contains(container->geometry())); + QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); #endif } diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 9c58b24..4e46819 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -143,9 +143,11 @@ public: // It is only called once. void tst_QGraphicsLinearLayout::initTestCase() { -#ifndef Q_WS_S60 // since the style will influence the results, we have to ensure // that the tests are run using the same style on all platforms +#ifdef Q_WS_S60 + QApplication::setStyle(new QWindowsStyle); +#else QApplication::setStyle(new QPlastiqueStyle); #endif } diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 8a5e344..dd03ef3 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -57,6 +57,8 @@ # define SRCDIR "" #endif +#include "../../shared/util.h" + class Widget : public QWidget { public: @@ -102,11 +104,11 @@ private slots: void eventPropagation_data(); void eventPropagation(); void focusPolicy(); - + void task190318_sizes(); void sizeHint(); - + void task226479_movieResize(); void emptyPixmap(); @@ -413,16 +415,17 @@ void tst_QLabel::task226479_movieResize() paintedRegion += e->region(); QLabel::paintEvent(e); } - + public: QRegion paintedRegion; }; - + Label label; label.resize(350,350); label.show(); QMovie *movie = new QMovie( &label ); label.setMovie(movie); + QTest::qWaitForWindowShown(&label); movie->setFileName(SRCDIR "red.png"); movie->start(); QTest::qWait(50); @@ -431,8 +434,8 @@ void tst_QLabel::task226479_movieResize() movie->setFileName(SRCDIR "green.png"); movie->start(); QTest::qWait(50); - - QCOMPARE(label.paintedRegion , QRegion(label.rect()) ); + + QTRY_COMPARE(label.paintedRegion , QRegion(label.rect()) ); } void tst_QLabel::emptyPixmap() diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index 65f1937..b110114 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -639,9 +639,7 @@ void tst_QMdiArea::changeWindowTitle() mw->setCentralWidget( ws ); mw->menuBar(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif + QTest::qWaitForWindowShown(mw); QWidget *widget = new QWidget( ws ); widget->setWindowTitle( wc ); @@ -655,22 +653,17 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif mw->hide(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); + QTest::qWaitForWindowShown(mw); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif #ifdef USE_SHOW @@ -688,7 +681,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) ); mw->setWindowTitle( mwc2 ); @@ -1697,11 +1690,8 @@ void tst_QMdiArea::tileSubWindows() workspace.setActiveSubWindow(windows.at(5)); workspace.resize(workspace.size() - QSize(10, 10)); workspace.setActiveSubWindow(0); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif QTest::qWait(250); // delayed re-arrange of minimized windows - QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); + QTRY_COMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); // Add another window and verify that the views are not tiled anymore. workspace.addSubWindow(new QPushButton(QLatin1String("I'd like to mess up tiled views")))->show(); @@ -1732,9 +1722,6 @@ void tst_QMdiArea::tileSubWindows() // Verify that we try to resize the area such that all sub-windows are visible. // It's important that tiled windows are NOT overlapping. workspace.resize(350, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(350, 150)); @@ -1761,13 +1748,10 @@ void tst_QMdiArea::tileSubWindows() #ifdef Q_OS_WINCE QSKIP("Not fixed yet! See task 197453", SkipAll); #endif - QCOMPARE(workspace.viewport()->rect().size(), expectedViewportSize); + QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Not enough space for all sub-windows to be visible -> provide scroll bars. workspace.resize(150, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(150, 150)); diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index d5d125a..b897d8f 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1648,9 +1648,9 @@ void tst_QMdiSubWindow::resizeTimer() QMdiArea mdiArea; QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&mdiArea); -#endif + QTest::qWaitForWindowShown(&mdiArea); + QTest::qWait(250); + EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro index 2628f19..e232443 100644 --- a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro +++ b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro @@ -5,9 +5,9 @@ include(../src/src.pri) win32: CONFIG += console mac:CONFIG -= app_bundle -wince*|symbian { +wince* { DEFINES += SRCDIR=\\\"\\\" -} else { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp index 87fc3ee..35f05d1 100644 --- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp +++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp @@ -46,6 +46,13 @@ //TESTED_CLASS= //TESTED_FILES= +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// And underlying Open C have application private dir in default search path +#define SRCDIR "" +#endif + + #define EXISTING_SHARE "existing" class tst_QSystemLock : public QObject @@ -223,7 +230,7 @@ void tst_QSystemLock::processes() QCOMPARE(consumers.first()->exitCode(), 0); delete consumers.takeFirst(); } - QCOMPARE(failedProcesses, unsigned int(0)); + QCOMPARE(failedProcesses, (unsigned int)(0)); } QTEST_MAIN(tst_QSystemLock) diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 81ef498..8788117 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -42,6 +42,8 @@ #include <QtTest/QtTest> #include "qevent.h" +#include "qdialog.h" +#include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" class tst_QSoftKeyManager : public QObject @@ -59,6 +61,7 @@ public slots: void cleanup(); private slots: void updateSoftKeysCompressed(); + void handleCommand(); }; class EventListener : public QObject @@ -133,6 +136,39 @@ void tst_QSoftKeyManager::updateSoftKeysCompressed() QVERIFY(listener.numUpdateSoftKeys == 1); } +/* + This tests that when the S60 environment sends us a command + that it actually gets mapped to the correct action. +*/ +void tst_QSoftKeyManager::handleCommand() +{ + QDialog w; + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, + &w); + + w.show(); + QApplication::processEvents(); + + QCOMPARE(w.actions().count(), 2); + + QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); + QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); + + // These should work eventually, but do not yet +// QTest::keyPress(&w, Qt::Key_Context1); +// QTest::keyPress(&w, Qt::Key_Context2); + + qApp->symbianHandleCommand(6000); + qApp->symbianHandleCommand(6001); + + QApplication::processEvents(); + + QCOMPARE(spy0.count(), 1); + QCOMPARE(spy1.count(), 1); +} + QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index a3f2f54..1fae92b 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1754,7 +1754,7 @@ protected: bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast<QSignalEvent*>(e); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); const_cast<TestSignalTransition*>(this)->m_args = se->arguments(); return true; } @@ -3954,7 +3954,7 @@ public: void onTransition(QEvent *e) { QSignalTransition::onTransition(e); - QSignalEvent *se = static_cast<QSignalEvent*>(e); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); eventSignalIndex = se->signalIndex(); } diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index f5d5040..71218a3 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2339,6 +2339,7 @@ void tst_QTableView::scrollTo() // resizing to this size will ensure that there can ONLY_BE_ONE_CELL inside the view. QSize forcedSize(columnWidth * 2, rowHeight * 2); view.resize(forcedSize); + QTest::qWaitForWindowShown(&view); QTest::qWait(0); QTRY_COMPARE(view.size(), forcedSize); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 4536ed7..a9fa9bc 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -1756,11 +1756,11 @@ void tst_QWidget::setTabOrder() container.show(); container.activateWindow(); + qApp->setActiveWindow(&container); #ifdef Q_WS_X11 QTest::qWaitForWindowShown(&container); QTest::qWait(50); #endif - qApp->setActiveWindow(&container); QTest::qWait(100); @@ -2316,8 +2316,9 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(0)); window.showNormal(); - QTest::qWait(30); qApp->setActiveWindow(&window); + QTest::qWaitForWindowShown(&window); + QTest::qWait(30); #ifdef Q_WS_MAC if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); @@ -3116,7 +3117,7 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(100); + QTest::qWait(200); QTRY_COMPARE(widget.geometry().size(), size); QRect geom; @@ -3126,15 +3127,15 @@ void tst_QWidget::saveRestoreGeometry() geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); QTRY_COMPARE(widget.geometry(), geom); //Restore to full screen widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); QTest::qWait(200); savedGeometry = widget.saveGeometry(); @@ -3165,7 +3166,7 @@ void tst_QWidget::saveRestoreGeometry() QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); QTRY_VERIFY(widget.geometry() != geom); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); QTest::qWait(20); QTRY_COMPARE(widget.geometry(), geom); @@ -5388,7 +5389,7 @@ void tst_QWidget::showAndMoveChild() child.move(desktopDimensions.width()/2, desktopDimensions.height()/2); qApp->processEvents(); - verifyColor(child.geometry().translated(tlwOffset), Qt::blue); + verifyColor(child.geometry().translated(tlwOffset), Qt::blue); verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); } @@ -6407,7 +6408,7 @@ void tst_QWidget::render() qApp->processEvents(); qApp->sendPostedEvents(); - QTest::qWait(100); + QTest::qWait(250); QImage sourceImage = QPixmap::grabWidget(&source).toImage(); qApp->processEvents(); @@ -6513,6 +6514,7 @@ void tst_QWidget::renderInvisible() dummyFocusWidget.show(); QTest::qWaitForWindowShown(&dummyFocusWidget); qApp->processEvents(); + QTest::qWait(100); // Create normal reference image. const QSize calendarSize = calendar->size(); diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 2c5ba72..0a6b7ad 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -230,7 +230,7 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(20); + QTest::qWait(120); QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); |