diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-24 03:32:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-24 03:32:18 (GMT) |
commit | 236e57bc9d85c4b05514dd3b792bf8e144320023 (patch) | |
tree | 84ffaf917021ca2229b32662884af889eba7994e | |
parent | d0f74ae9712b2225c12c95891357c5f93c30996c (diff) | |
parent | 789e2e08d8969aaebae82f45d48f3d550c8c1d64 (diff) | |
download | Qt-236e57bc9d85c4b05514dd3b792bf8e144320023.zip Qt-236e57bc9d85c4b05514dd3b792bf8e144320023.tar.gz Qt-236e57bc9d85c4b05514dd3b792bf8e144320023.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
tst_qthread: fix compilation
Round origin of text in OpenVG engine
QThread::exec(): Fix possibility to enter several time the event loop
QMessageBox: change the documentation to reflect that it is application modal
Compile on OpenBSD
Doc: Q_PROPERTY, implements the setter/getter in the example
Dynamically register the event number.
Fix wrong error assumption when converting "0.0" to double
-rw-r--r-- | doc/src/snippets/code/doc_src_properties.qdoc | 17 | ||||
-rw-r--r-- | doc/src/snippets/moc/myclass2.h | 7 | ||||
-rw-r--r-- | src/corelib/thread/qthread.cpp | 4 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 13 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 1 | ||||
-rw-r--r-- | src/gui/dialogs/qmessagebox.cpp | 88 | ||||
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qthread/tst_qthread.cpp | 41 | ||||
-rw-r--r-- | tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp | 12 | ||||
-rw-r--r-- | tools/qmeegographicssystemhelper/qmeegoswitchevent.h | 12 |
10 files changed, 124 insertions, 75 deletions
diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc index 7704160..a4ed409 100644 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ b/doc/src/snippets/code/doc_src_properties.qdoc @@ -91,7 +91,7 @@ for (int i=0; i<count; ++i) { class MyClass : public QObject { Q_OBJECT - Q_PROPERTY(Priority priority READ priority WRITE setPriority) + Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) Q_ENUMS(Priority) public: @@ -100,8 +100,19 @@ public: enum Priority { High, Low, VeryHigh, VeryLow }; - void setPriority(Priority priority); - Priority priority() const; + void setPriority(Priority priority) + { + m_priority = priority; + emit priorityChanged(priority); + } + Priority priority() const + { return m_priority; } + +signals: + void priorityChanged(Priority); + +private: + Priority m_priority; }; //! [5] diff --git a/doc/src/snippets/moc/myclass2.h b/doc/src/snippets/moc/myclass2.h index ca79515..daea23c 100644 --- a/doc/src/snippets/moc/myclass2.h +++ b/doc/src/snippets/moc/myclass2.h @@ -58,8 +58,11 @@ public: MyClass(QObject *parent = 0); ~MyClass(); - void setPriority(Priority priority); - Priority priority() const; + void setPriority(Priority priority) { m_priority = priority; } + Priority priority() const { return m_priority; } + +private: + Priority m_priority; }; //! [0] diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 69b70cb..6fb182b 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -482,8 +482,10 @@ int QThread::exec() Q_D(QThread); QMutexLocker locker(&d->mutex); d->data->quitNow = false; - if (d->exited) + if (d->exited) { + d->exited = false; return d->returnCode; + } locker.unlock(); QEventLoop eventLoop; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index a44a0e8..e3b587d 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -97,6 +97,11 @@ # define SCHED_IDLE 5 #endif +#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#define QT_HAS_THREAD_PRIORITY_SCHEDULING +#endif + + QT_BEGIN_NAMESPACE #ifndef QT_NO_THREAD @@ -503,6 +508,7 @@ void QThread::usleep(unsigned long usecs) thread_sleep(&ti); } +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING // Does some magic and calculate the Unix scheduler priorities // sched_policy is IN/OUT: it must be set to a valid policy before calling this function // sched_priority is OUT only @@ -533,6 +539,7 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr *sched_priority = prio; return true; } +#endif void QThread::start(Priority priority) { @@ -553,7 +560,7 @@ void QThread::start(Priority priority) d->priority = priority; -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING) && !defined(Q_OS_SYMBIAN) // ### Need to implement thread sheduling and priorities for symbian os. Implementation removed for now switch (priority) { case InheritPriority: @@ -594,7 +601,7 @@ void QThread::start(Priority priority) break; } } -#endif // _POSIX_THREAD_PRIORITY_SCHEDULING +#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING #ifdef Q_OS_SYMBIAN if (d->stackSize == 0) @@ -757,7 +764,7 @@ void QThread::setPriority(Priority priority) // copied from start() with a few modifications: -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING int sched_policy; sched_param param; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index d152682..83d6dcd 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -7308,6 +7308,7 @@ Q_CORE_EXPORT char *qdtoa( double d, int mode, int ndigits, int *decpt, int *sig Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok) { + errno = 0; double ret = strtod((char*)s00, (char**)se); if (ok) { if((ret == 0.0l && errno == ERANGE) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index fe25b0f..2f8b9e2 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -776,10 +776,8 @@ QMessageBox::QMessageBox(QWidget *parent) added at any time using addButton(). The \a parent and \a f arguments are passed to the QDialog constructor. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. On Mac OS X, if \a parent is not 0 and you want your message box to appear as a Qt::Sheet of that parent, set the message box's @@ -1549,10 +1547,8 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa question(), warning(), critical() */ @@ -1579,10 +1575,8 @@ QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QStr \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa information(), warning(), critical() */ @@ -1607,10 +1601,8 @@ QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa question(), information(), critical() */ @@ -1635,10 +1627,8 @@ QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -1670,7 +1660,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString The about box has a single button labelled "OK". On Mac OS X, the about box is popped up as a modeless window; on other platforms, - it is currently a window modal. + it is currently application modal. \sa QWidget::windowIcon(), QApplication::activeWindow() */ @@ -1723,7 +1713,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te QApplication provides this functionality as a slot. On Mac OS X, the about box is popped up as a modeless window; on - other platforms, it is currently window modal. + other platforms, it is currently application modal. \sa QApplication::aboutQt() */ @@ -1983,10 +1973,8 @@ void QMessageBoxPrivate::retranslateStrings() \snippet doc/src/snippets/dialogs/dialogs.cpp 2 - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. The \a parent and \a f arguments are passed to the QDialog constructor. @@ -2035,10 +2023,8 @@ QMessageBox::QMessageBox(const QString &title, const QString &text, Icon icon, Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2073,10 +2059,8 @@ int QMessageBox::information(QWidget *parent, const QString &title, const QStrin supply 0, 1 or 2 to make pressing \key Esc equivalent to clicking the relevant button. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2125,10 +2109,8 @@ int QMessageBox::information(QWidget *parent, const QString &title, const QStrin Returns the identity (QMessageBox::Yes, or QMessageBox::No, etc.) of the button that was clicked. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2163,10 +2145,8 @@ int QMessageBox::question(QWidget *parent, const QString &title, const QString& supply 0, 1 or 2 to make pressing Escape equivalent to clicking the relevant button. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2215,10 +2195,8 @@ int QMessageBox::question(QWidget *parent, const QString &title, const QString& Returns the identity (QMessageBox::Ok or QMessageBox::No or ...) of the button that was clicked. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2253,10 +2231,8 @@ int QMessageBox::warning(QWidget *parent, const QString &title, const QString& t supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2304,10 +2280,8 @@ int QMessageBox::warning(QWidget *parent, const QString &title, const QString& t Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2343,10 +2317,8 @@ int QMessageBox::critical(QWidget *parent, const QString &title, const QString& supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index aea203f..430575b 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3543,8 +3543,8 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) // Set the glyph drawing origin. VGfloat origin[2]; - origin[0] = positions[0].x.toReal(); - origin[1] = positions[0].y.toReal(); + origin[0] = positions[0].x.round().toReal(); + origin[1] = positions[0].y.round().toReal(); vgSetfv(VG_GLYPH_ORIGIN, 2, origin); // Fast anti-aliasing for paths, better for images. diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 843749a..b0efb5a 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -106,6 +106,7 @@ private slots: void adoptMultipleThreads(); void QTBUG13810_exitAndStart(); + void QTBUG15378_exitAndExec(); void stressTest(); }; @@ -976,5 +977,45 @@ void tst_QThread::QTBUG13810_exitAndStart() } +void tst_QThread::QTBUG15378_exitAndExec() +{ + class Thread : public QThread { + public: + QSemaphore sem1; + QSemaphore sem2; + volatile int value; + void run() { + sem1.acquire(); + value = exec(); //First entrence + sem2.release(); + value = exec(); // Second loop + } + }; + Thread thread; + thread.value = 0; + thread.start(); + thread.exit(556); + thread.sem1.release(); //should exit the first loop + thread.sem2.acquire(); + int v = thread.value; + QCOMPARE(v, 556); + + //test that the thread is running by executing queued connected signal there + Syncronizer sync1; + sync1.moveToThread(&thread); + Syncronizer sync2; + sync2.moveToThread(&thread); + connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection); + connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection); + QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89)); + QTest::qWait(50); + while(!thread.wait(10)) + QTest::qWait(10); + QCOMPARE(sync2.m_prop, 89); + QCOMPARE(sync1.m_prop, 89); +} + + + QTEST_MAIN(tst_QThread) #include "tst_qthread.moc" diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp b/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp index b136ce8..22ea0fe 100644 --- a/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp @@ -41,7 +41,9 @@ #include "qmeegoswitchevent.h" -QMeeGoSwitchEvent::QMeeGoSwitchEvent(const QString &graphicsSystemName, QMeeGoSwitchEvent::State s) : QEvent((QEvent::Type) QMeeGoSwitchEvent::SwitchEvent) +static int switchEventNumber = -1; + +QMeeGoSwitchEvent::QMeeGoSwitchEvent(const QString &graphicsSystemName, QMeeGoSwitchEvent::State s) : QEvent(QMeeGoSwitchEvent::eventNumber()) { name = graphicsSystemName; switchState = s; @@ -55,4 +57,12 @@ QString QMeeGoSwitchEvent::graphicsSystemName() const QMeeGoSwitchEvent::State QMeeGoSwitchEvent::state() const { return switchState; +} + +QEvent::Type QMeeGoSwitchEvent::eventNumber() +{ + if (switchEventNumber < 0) + switchEventNumber = QEvent::registerEventType(); + + return (QEvent::Type) switchEventNumber; }
\ No newline at end of file diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h index 2d8371e..0ddbd3d 100644 --- a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h +++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h @@ -62,11 +62,6 @@ public: DidSwitch }; - //! The event type id to use to detect this event. - enum Type { - SwitchEvent = QEvent::User + 1024 - }; - //! Constructor for the event. /*! Creates a new event with the given name and the given state. @@ -83,6 +78,13 @@ public: //! Returns the state represented by this event. State state() const; + //! Returns the event type/number for QMeeGoSwitchEvent. + /*! + The type is registered on first access. Use this to detect incoming + QMeeGoSwitchEvents. + */ + QEvent::Type eventNumber(); + private: QString name; State switchState; |