From e5b8db6d4ecc244f7c35ea96a1f4e76fad47f1c4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 24 Jun 2009 15:59:49 +0200 Subject: QNetworkReplyImpl: Protect against recursive event loops This fixes a bug that occured together with a QProgressDialog. The signal emission was like: readyRead readyRead readyRead [...] readyRead finished readyRead Now finished should be properly at the ending of this sequence. Task-number: 256630 Reviewed-by: Thiago Macieira --- src/network/access/qnetworkreplyimpl.cpp | 36 +++++- src/network/access/qnetworkreplyimpl_p.h | 5 + tests/auto/auto.pro | 1 + .../qnetworkaccessmanager_and_qprogressdialog.pro | 5 + ...t_qnetworkaccessmanager_and_qprogressdialog.cpp | 130 +++++++++++++++++++++ 5 files changed, 175 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro create mode 100644 tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index e8cb6ee..d903d03 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() : copyDevice(0), networkCache(0), cacheEnabled(false), cacheSaveDevice(0), + notificationHandlingPaused(false), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), state(Idle) { @@ -164,9 +165,11 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() lastBytesDownloaded = bytesDownloaded; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); emit q->readyRead(); + resumeNotificationHandling(); } void QNetworkReplyImplPrivate::_q_copyReadChannelFinished() @@ -210,6 +213,9 @@ void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification) void QNetworkReplyImplPrivate::handleNotifications() { + if (notificationHandlingPaused) + return; + NotificationQueue current = pendingNotifications; pendingNotifications.clear(); @@ -248,6 +254,22 @@ void QNetworkReplyImplPrivate::handleNotifications() } } +// Do not handle the notifications while we are emitting downloadProgress +// or readyRead +void QNetworkReplyImplPrivate::pauseNotificationHandling() +{ + notificationHandlingPaused = true; +} + +// Resume notification handling +void QNetworkReplyImplPrivate::resumeNotificationHandling() +{ + Q_Q(QNetworkReplyImpl); + notificationHandlingPaused = false; + if (pendingNotifications.size() >= 1) + QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated)); +} + void QNetworkReplyImplPrivate::createCache() { // check if we can save and if we're allowed to @@ -318,8 +340,10 @@ void QNetworkReplyImplPrivate::consume(qint64 count) bytesUploaded += count; QVariant totalSize = request.header(QNetworkRequest::ContentLengthHeader); + pauseNotificationHandling(); emit q->uploadProgress(bytesUploaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); + resumeNotificationHandling(); } qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const @@ -367,12 +391,14 @@ void QNetworkReplyImplPrivate::feed(const QByteArray &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); emit q->readyRead(); // hopefully we haven't been deleted here if (!qq.isNull()) { + resumeNotificationHandling(); // do we still have room in the buffer? if (nextDownstreamBlockSize() > 0) backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite); @@ -409,19 +435,25 @@ void QNetworkReplyImplPrivate::finished() state = Finished; pendingNotifications.clear(); + pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (bytesDownloaded != lastBytesDownloaded || totalSize.isNull()) + if (bytesDownloaded != lastBytesDownloaded || totalSize.isNull()) { emit q->downloadProgress(bytesDownloaded, bytesDownloaded); - if (bytesUploaded == -1 && outgoingData) + } + if (bytesUploaded == -1 && outgoingData) { emit q->uploadProgress(0, 0); + } + resumeNotificationHandling(); completeCacheSave(); // note: might not be a good idea, since users could decide to delete us // which would delete the backend too... // maybe we should protect the backend + pauseNotificationHandling(); emit q->readChannelFinished(); emit q->finished(); + resumeNotificationHandling(); } void QNetworkReplyImplPrivate::error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage) diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 32bfa4c..65b3679 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -129,6 +129,9 @@ public: void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); void setNetworkCache(QAbstractNetworkCache *networkCache); + + void pauseNotificationHandling(); + void resumeNotificationHandling(); void backendNotify(InternalNotifications notification); void handleNotifications(); void createCache(); @@ -156,6 +159,8 @@ public: QIODevice *cacheSaveDevice; NotificationQueue pendingNotifications; + bool notificationHandlingPaused; + QUrl urlForLastAuthentication; #ifndef QT_NO_NETWORKPROXY QNetworkProxy lastProxyAuthentication; diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 1cdb840..a215daa 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -207,6 +207,7 @@ SUBDIRS += _networkselftest \ qnetworkproxy \ qnetworkrequest \ qnetworkreply \ + qnetworkaccessmanager_and_qprogressdialog \ qnumeric \ qobject \ qobjectrace \ diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro new file mode 100644 index 0000000..7ed5b07 --- /dev/null +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES += tst_qnetworkaccessmanager_and_qprogressdialog.cpp +QT += network + + diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp new file mode 100644 index 0000000..62e4ce5 --- /dev/null +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include + +#include "../network-settings.h" + + +class tst_QNetworkAccessManager_And_QProgressDialog : public QObject +{ +Q_OBJECT +private slots: + void downloadCheck(); +}; + +class DownloadCheckWidget : public QWidget +{ + Q_OBJECT; +public: + DownloadCheckWidget(QWidget *parent = 0) : QWidget(parent) + , progressDlg(this), netmanager(this) + , lateReadyRead(true) + { + progressDlg.setRange(1, 100); + QMetaObject::invokeMethod(this, "go", Qt::QueuedConnection); + } + bool lateReadyRead; +public slots: + void go() + { + QNetworkReply *reply = netmanager.get( + QNetworkRequest( + QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile") + )); + connect(reply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(dataReadProgress(qint64, qint64))); + connect(reply, SIGNAL(readyRead()), + this, SLOT(dataReadyRead())); + connect(reply, SIGNAL(finished()), this, SLOT(finishedFromReply())); + + progressDlg.exec(); + } + void dataReadProgress(qint64 done, qint64 total) + { + QNetworkReply *reply = qobject_cast(sender()); + progressDlg.setMaximum(total); + progressDlg.setValue(done); + } + void dataReadyRead() + { + QNetworkReply *reply = qobject_cast(sender()); + lateReadyRead = true; + } + void finishedFromReply() + { + QNetworkReply *reply = qobject_cast(sender()); + lateReadyRead = false; + reply->deleteLater(); + QTestEventLoop::instance().exitLoop(); + } + + +private: + QProgressDialog progressDlg; + QNetworkAccessManager netmanager; +}; + +void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck() +{ + DownloadCheckWidget widget; + widget.show(); + // run and exit on finished() + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + // run some more to catch the late readyRead() (or: to not catch it) + QTestEventLoop::instance().enterLoop(1); + QVERIFY(QTestEventLoop::instance().timeout()); + // the following fails when a readyRead() was received after finished() + QVERIFY(!widget.lateReadyRead); +} + + + +QTEST_MAIN(tst_QNetworkAccessManager_And_QProgressDialog) +#include "tst_qnetworkaccessmanager_and_qprogressdialog.moc" -- cgit v0.12 From 43a64353939cef7d8c0fbc3d976940f47e142cba Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 25 Jun 2009 13:07:12 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( e65b4879116f4a8b0ee8b09607eef666c68c61d6 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit since the last update: ++ b/WebCore/ChangeLog 2009-06-25 Simon Hausmann Reviewed by and done with Tor Arne Vestbø. Fix shortcut keyboard handling with plugins on the Qt/Mac build. When we receive shortcut events like Ctrl+V then the text in the QKeyEvent is empty. If we're asked to disambiguate the event into a Char keyboard event, we try to detect this situation and still set the text, to ensure that the general event handling sends a key press event after this disambiguation. * platform/qt/PlatformKeyboardEventQt.cpp: (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 14 ++++++++++++++ .../webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 71add8f..e084e27 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 4552f381497b5adc18714d7f6e33eba678e3a9b2 + e65b4879116f4a8b0ee8b09607eef666c68c61d6 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 4b74dcb..c3b6c37 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2009-06-25 Simon Hausmann + + Reviewed by and done with Tor Arne Vestbø. + + Fix shortcut keyboard handling with plugins on the Qt/Mac build. + + When we receive shortcut events like Ctrl+V then the text in the QKeyEvent is + empty. If we're asked to disambiguate the event into a Char keyboard event, + we try to detect this situation and still set the text, to ensure that the + general event handling sends a key press event after this disambiguation. + + * platform/qt/PlatformKeyboardEventQt.cpp: + (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): + 2009-06-23 Thiago Macieira Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp index 88cca5a..955da9b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp @@ -511,6 +511,15 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool) m_text = String(); m_unmodifiedText = String(); } else { + /* + When we receive shortcut events like Ctrl+V then the text in the QKeyEvent is + empty. If we're asked to disambiguate the event into a Char keyboard event, + we try to detect this situation and still set the text, to ensure that the + general event handling sends a key press event after this disambiguation. + */ + if (m_text.isEmpty() && m_windowsVirtualKeyCode && m_qtEvent->key() < Qt::Key_Escape) + m_text.append(UChar(m_windowsVirtualKeyCode)); + m_keyIdentifier = String(); m_windowsVirtualKeyCode = 0; } -- cgit v0.12 From 2d9aaff174d70953ed1f98c24baaf0c9abac78aa Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 25 Jun 2009 22:03:46 +1000 Subject: Bump Qt version number. Reviewed-by: Trust Me --- dist/changes-4.5.3 | 123 +++++++++++++++++++++ src/corelib/global/qglobal.h | 4 +- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- .../tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/test/assistant.qdocconf | 4 +- tools/qdoc3/test/designer.qdocconf | 4 +- tools/qdoc3/test/linguist.qdocconf | 4 +- tools/qdoc3/test/qmake.qdocconf | 4 +- tools/qdoc3/test/qt-build-docs.qdocconf | 8 +- tools/qdoc3/test/qt.qdocconf | 8 +- 11 files changed, 144 insertions(+), 21 deletions(-) create mode 100644 dist/changes-4.5.3 diff --git a/dist/changes-4.5.3 b/dist/changes-4.5.3 new file mode 100644 index 0000000..096d28c --- /dev/null +++ b/dist/changes-4.5.3 @@ -0,0 +1,123 @@ +Qt 4.5.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.5.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://doc.trolltech.com/4.5 + +The Qt version 4.5 series is binary compatible with the 4.4.x series. +Applications compiled for 4.4 will continue to run with 4.5. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Task Tracker: + + http://www.qtsoftware.com/developer/task-tracker + +Each of these identifiers can be entered in the task tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + +General Improvements +-------------------- + +- Documentation and Examples + +Third party components +---------------------- + + +**************************************************************************** +* Library * +**************************************************************************** + + +**************************************************************************** +* Database Drivers * +**************************************************************************** + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Linux/X11 +---------------- + + +Qt for Windows +-------------- + + +Qt for Mac OS X +--------------- + + +Qt for Embedded Linux +--------------------- + + +Qt for Windows CE +----------------- + + +**************************************************************************** +* Compiler Specific Changes * +**************************************************************************** + + +**************************************************************************** +* Tools * +**************************************************************************** + +- Build System + +- Assistant + + +- Designer + + +- Linguist + - Linguist GUI + + - lupdate + + - lrelease + + +- rcc + + +- moc + + +- uic + + +- uic3 + + +- qmake + + +- configure + + +- qtconfig + + +- qt3to4 + + +**************************************************************************** +* Plugins * +**************************************************************************** + + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b8a9024..63f6c31 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.5.2" +#define QT_VERSION_STR "4.5.3" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040502 +#define QT_VERSION 0x040503 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index ae39021..82a1459 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.5.2 + VERSION=4.5.3 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index f7c8a95..d04de64 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.5.2 + VERSION=4.5.3 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index aca97ed..9566e90 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.5.2
Qt 4.5.3
" diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index b6313fa..71de998 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -13,11 +13,11 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Assistant qhp.Assistant.file = assistant.qhp -qhp.Assistant.namespace = com.trolltech.assistant.452 +qhp.Assistant.namespace = com.trolltech.assistant.453 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Assistant.filterAttributes = qt 4.5.2 tools assistant +qhp.Assistant.filterAttributes = qt 4.5.3 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 8d9a49e..0c39bb8 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -13,11 +13,11 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Designer qhp.Designer.file = designer.qhp -qhp.Designer.namespace = com.trolltech.designer.452 +qhp.Designer.namespace = com.trolltech.designer.453 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Designer.filterAttributes = qt 4.5.2 tools designer +qhp.Designer.filterAttributes = qt 4.5.3 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 177a54c..b6bd375 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -13,11 +13,11 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Linguist qhp.Linguist.file = linguist.qhp -qhp.Linguist.namespace = com.trolltech.linguist.452 +qhp.Linguist.namespace = com.trolltech.linguist.453 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Linguist.filterAttributes = qt 4.5.2 tools linguist +qhp.Linguist.filterAttributes = qt 4.5.3 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 20b0acf..83220ae 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -13,11 +13,11 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = qmake qhp.qmake.file = qmake.qhp -qhp.qmake.namespace = com.trolltech.qmake.452 +qhp.qmake.namespace = com.trolltech.qmake.453 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.qmake.filterAttributes = qt 4.5.2 tools qmake +qhp.qmake.filterAttributes = qt 4.5.3 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 7a266ef..5169714 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -20,7 +20,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.452 +qhp.Qt.namespace = com.trolltech.qt.453 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.5.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.5.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.2 +qhp.Qt.filterAttributes = qt 4.5.3 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.5.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.3 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index d366d1d..f1fd8a2 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.452 +qhp.Qt.namespace = com.trolltech.qt.453 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.5.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.5.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.2 +qhp.Qt.filterAttributes = qt 4.5.3 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.5.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.5.3 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From c938ec01a76bf56f667481e626fbb9252ee3d05d Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 25 Jun 2009 14:47:57 +0200 Subject: make invokable constructors work with classes in namespace Use the fully qualified classname at relevant places in the moc-generated code. Also, QMetaObject::newInstance() needs to strip the namespace part, since the constructor signatures don't contain the fully qualified name. Task-number: 246064 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qmetaobject.cpp | 8 +++++++- src/tools/moc/generator.cpp | 4 ++-- tests/auto/qmetaobject/tst_qmetaobject.cpp | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 2d57e0b..71dd5ff 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -218,8 +218,14 @@ QObject *QMetaObject::newInstance(QGenericArgument val0, QGenericArgument val8, QGenericArgument val9) const { + QByteArray constructorName = className(); + { + int idx = constructorName.lastIndexOf(':'); + if (idx != -1) + constructorName.remove(0, idx+1); // remove qualified part + } QVarLengthArray sig; - sig.append(className(), qstrlen(className())); + sig.append(constructorName.constData(), constructorName.length()); sig.append('('); enum { MaximumParamCount = 10 }; diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 4814ecc..54305a3 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -918,7 +918,7 @@ void Generator::generateStaticMetacall(const QByteArray &prefix) fprintf(out, " switch (_id) {\n"); for (int ctorindex = 0; ctorindex < cdef->constructorList.count(); ++ctorindex) { fprintf(out, " case %d: { %s *_r = new %s(", ctorindex, - cdef->classname.constData(), cdef->classname.constData()); + cdef->qualified.constData(), cdef->qualified.constData()); const FunctionDef &f = cdef->constructorList.at(ctorindex); int offset = 1; for (int j = 0; j < f.arguments.count(); ++j) { @@ -936,7 +936,7 @@ void Generator::generateStaticMetacall(const QByteArray &prefix) fprintf(out, " }\n"); if (!isQObject) - fprintf(out, " _id = %s::staticMetaObject.superClass()->static_metacall(_c, _id, _a);\n", cdef->classname.constData()); + fprintf(out, " _id = %s::staticMetaObject.superClass()->static_metacall(_c, _id, _a);\n", cdef->qualified.constData()); fprintf(out, " if (_id < 0)\n return _id;\n"); diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 95d19e2..dea0ffb 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -605,6 +605,19 @@ void tst_QMetaObject::invokeCustomTypes() QCOMPARE(obj.sum, 3); } +namespace NamespaceWithConstructibleClass +{ + +class ConstructibleClass : public QObject +{ + Q_OBJECT +public: + Q_INVOKABLE ConstructibleClass(QObject *parent = 0) + : QObject(parent) {} +}; + +} + void tst_QMetaObject::invokeMetaConstructor() { const QMetaObject *mo = &QtTestObject::staticMetaObject; @@ -619,6 +632,15 @@ void tst_QMetaObject::invokeMetaConstructor() QCOMPARE(obj2->parent(), (QObject*)&obj); QVERIFY(qobject_cast(obj2) != 0); } + // class in namespace + const QMetaObject *nsmo = &NamespaceWithConstructibleClass::ConstructibleClass::staticMetaObject; + { + QtTestObject obj; + QObject *obj2 = nsmo->newInstance(Q_ARG(QObject*, &obj)); + QVERIFY(obj2 != 0); + QCOMPARE(obj2->parent(), (QObject*)&obj); + QVERIFY(qobject_cast(obj2) != 0); + } } void tst_QMetaObject::normalizedSignature_data() -- cgit v0.12 From d553f376a34ea1d27492a1a5fd14f79616f6a27c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Jun 2009 10:03:03 +0200 Subject: Fix build on Solaris: test -e isn't available to Bourne shells I don't know why, even though it's specified in POSIX. But we have to cope with broken stuff. Reviewed-by: Bradley T. Hughes --- config.tests/unix/compile.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 0e73852..a50f49d 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -59,7 +59,7 @@ test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" -test -e Makefile && make distclean >/dev/null 2>&1 +test -r Makefile && make distclean >/dev/null 2>&1 "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" -- cgit v0.12