From 28973e50710cfcd96da037cdad7f46700221c185 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 20 Dec 2010 15:50:41 +1000 Subject: Make it clear which security updates are needed for Visual Studio 2005. As well as Service Pack 1, the compiler also needs four additional security updates in order to work correctly with Qt's pre-built binary package. Task-number: QTBUG-7633 Reviewed-by: Toby Tomkins --- doc/src/getting-started/installation.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index a68310c..5b009cd 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -963,6 +963,7 @@ We hope you will enjoy using Qt. first install the Visual Studio Service Pack 1 available \l{http://www.microsoft.com/downloads/details.aspx?FamilyId=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en}{here} to avoid runtime conflicts. + Additionally, you must use the Check for Updates feature in the Help menu of the Visual Studio 2005 IDE to apply at least the following security updates: KB937061, KB971023, KB971090, KB973673. If you are using a source edition of Qt, you must first install Perl so that the syncqt script invoked by configure can be executed. You can download -- cgit v0.12 From de72670c620e1193fa875bf1a4adee553700bacb Mon Sep 17 00:00:00 2001 From: Ville Pernu Date: Mon, 20 Dec 2010 09:57:24 +0200 Subject: QNAM HTTP: Fix missing error() signal During download, if a QAbstractSocket::RemoteHostClosedError occurs, the error handling is deferred to _q_disconnected() slot. However, the error message is not saved for the function, and thus the _q_disconnected only emits a finished-signal. We now store an unhandled error into a private member. It is handled and reset by the _q_disconnected (or more specifically, allDone-function). Also, an additional check is made that there are no simultaneous HTTP errors. If a HTTP error exists, any socket errors are suppressed. Task-Number: QT-3494 Reviewed-By: Markus Goetz --- src/network/access/qhttpnetworkconnectionchannel.cpp | 20 +++++++++++++++++++- src/network/access/qhttpnetworkconnectionchannel_p.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index c8caad4..c4471eb 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -66,6 +66,7 @@ QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() , bytesTotal(0) , resendCurrent(false) , lastStatus(0) + , unhandledError(QNetworkReply::NoError) , pendingEncrypt(false) , reconnectAttempts(2) , authMethod(QAuthenticatorPrivate::None) @@ -642,7 +643,23 @@ void QHttpNetworkConnectionChannel::allDone() // slot connected to it. The socket will not fire readyRead signal, if we are already // in the slot connected to readyRead if (emitFinished) - QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); + { + // Check whether _q_error was invoked previously and if it left a socket + // error unhandled AND that there are no http errors. + // In case there are both socket errors and http errors, the socket error is suppressed. + // Http errors are handled in the QNetworkAccessHttpBackend. + if(unhandledError != QNetworkReply::NoError && reply->statusCode() == 200) { + QString errorString = connection->d_func()->errorDetail(unhandledError, socket, socket->errorString()); + qRegisterMetaType("QNetworkReply::NetworkError"); + QMetaObject::invokeMethod(reply, "finishedWithError", + Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, unhandledError), + Q_ARG(QString, errorString)); + } else { + QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); + } + unhandledError = QNetworkReply::NoError; // Reset the value + } // reset the reconnection attempts after we receive a complete reply. // in case of failures, each channel will attempt two reconnects before emitting error. reconnectAttempts = 2; @@ -964,6 +981,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket errorCode = QNetworkReply::RemoteHostClosedError; } } else { + unhandledError = QNetworkReply::RemoteHostClosedError; return; } break; diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index fd18042..e1d42fb 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -105,6 +105,7 @@ public: qint64 bytesTotal; bool resendCurrent; int lastStatus; // last status received on this channel + QNetworkReply::NetworkError unhandledError; // Stored code of an unhandled error. bool pendingEncrypt; // for https (send after encrypted) int reconnectAttempts; // maximum 2 reconnection attempts QAuthenticatorPrivate::Method authMethod; -- cgit v0.12 From d9dbdb1afde441c8ab87f42b4a5e0e29ad54480c Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 20 Dec 2010 14:05:53 +0100 Subject: Fixed QStatusBar not to repaint itself too early When the toplevel containing a statusbar is initially shown, QStatusBar will repaint itself way too early - repaint() is called from the LayoutRequest event causing a whole window repaint before the window was resized to the proper size. This caused Qt Creator to paint itself in small size in a maximized window on its startup. Task-number: QTBUG-14547 Reviewed-by: Olivier Goffart --- src/gui/widgets/qstatusbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp index c88d2a1..c60913e 100644 --- a/src/gui/widgets/qstatusbar.cpp +++ b/src/gui/widgets/qstatusbar.cpp @@ -575,7 +575,7 @@ void QStatusBar::reformat() d->savedStrut = maxH; vbox->addSpacing(2); d->box->activate(); - repaint(); + update(); } /*! -- cgit v0.12 From 4ff05f2ed8cef9a126af023a4692eb8c50a0a892 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 21 Dec 2010 15:58:12 +1000 Subject: Fix number of chapters in qtestlib tutorial. Task-number: QTBUG-10248 Reviewed-by: Trust Me --- doc/src/development/qtestlib.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index e53957f..38c2220 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -370,7 +370,7 @@ \title QTestLib Tutorial This tutorial gives a short introduction to how to use some of the - features of the QTestLib framework. It is divided into four + features of the QTestLib framework. It is divided into five chapters: \list 1 -- cgit v0.12 From afa22a20c1b89960b647b0e3a9dc390fe6f87eae Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 22 Dec 2010 08:48:40 +1000 Subject: tst_headers: make failure more detailed when failing to open a file Replace QVERIFY(f.open(...)) with QVERIFY2(f.open(...), qPrintable(f.errorString())) This pattern should be followed for all functions which can provide an error string on failure. --- tests/auto/headers/tst_headers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 7ccf058..8c8bc2c 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -203,7 +203,7 @@ void tst_Headers::licenseCheck() QFETCH(QString, sourceFile); QFile f(sourceFile); - QVERIFY(f.open(QIODevice::ReadOnly)); + QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QByteArray data = f.readAll(); data.replace("\r\n", "\n"); // Windows data.replace('\r', '\n'); // Mac OS9 @@ -264,7 +264,7 @@ void tst_Headers::privateSlots() return; QFile f(header); - QVERIFY(f.open(QIODevice::ReadOnly)); + QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QStringList content = QString::fromLocal8Bit(f.readAll()).split("\n"); foreach (QString line, content) { @@ -286,7 +286,7 @@ void tst_Headers::macros() return; QFile f(header); - QVERIFY(f.open(QIODevice::ReadOnly)); + QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QByteArray data = f.readAll(); QStringList content = QString::fromLocal8Bit(data.replace('\r', "")).split("\n"); -- cgit v0.12 From 55c32b91a298d52bd7c29968d21b4b7a5ee741e4 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Wed, 22 Dec 2010 16:03:35 +1000 Subject: Docs: QTBUG-9150 Incorrect snippet in class doc. --- src/sql/models/qsqltablemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 8589163..974cf7b 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -265,7 +265,7 @@ QSqlRecord QSqlTableModelPrivate::primaryValues(int row) QSqlTableModel can also be used to access a database programmatically, without binding it to a view: - \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 25 + \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 21 The code snippet above extracts the \c salary field from record 4 in the result set of the query \c{SELECT * from employee}. -- cgit v0.12 From cafbb2943eea989b0eeadb0c54c151ad921691b9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Dec 2010 19:44:53 +0100 Subject: Do not crash in case a future version of libdbus has a new kind of message. --- src/dbus/qdbusintegrator.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 1842e5a..f64b7ca 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -565,10 +565,8 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg) return true; case QDBusMessage::ReplyMessage: case QDBusMessage::ErrorMessage: - return false; // we don't handle those here case QDBusMessage::InvalidMessage: - Q_ASSERT_X(false, "QDBusConnection", "Invalid message found when processing"); - break; + return false; // we don't handle those here } return false; -- cgit v0.12 From fb9ded4e5e3e85672beef83945b3a7e17371368c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Dec 2010 12:12:30 +0100 Subject: Work around an apparent GCC optimiser bug accessing arrays beyond end Accessing arrays beyond their end is known to cause problems in gcc 4.4 and 4.5. So don't try to be too smart in accessing m[0][index] but instead access the array as it's meant to be. Upstream bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247#c10 Reviewed-by: Olivier Goffart --- src/gui/math3d/qgenericmatrix.h | 68 ++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index 3224ae2..f91bce7 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -198,52 +198,58 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix QGenericMatrix::transposed template Q_OUTOFLINE_TEMPLATE QGenericMatrix& QGenericMatrix::operator+=(const QGenericMatrix& other) { - for (int index = 0; index < N * M; ++index) - m[0][index] += other.m[0][index]; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + m[col][row] += other.m[col][row]; return *this; } template Q_OUTOFLINE_TEMPLATE QGenericMatrix& QGenericMatrix::operator-=(const QGenericMatrix& other) { - for (int index = 0; index < N * M; ++index) - m[0][index] -= other.m[0][index]; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + m[col][row] -= other.m[col][row]; return *this; } template Q_OUTOFLINE_TEMPLATE QGenericMatrix& QGenericMatrix::operator*=(T factor) { - for (int index = 0; index < N * M; ++index) - m[0][index] *= factor; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + m[col][row] *= factor; return *this; } template Q_OUTOFLINE_TEMPLATE bool QGenericMatrix::operator==(const QGenericMatrix& other) const { - for (int index = 0; index < N * M; ++index) { - if (m[0][index] != other.m[0][index]) - return false; - } + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) { + if (m[col][row] != other.m[col][row]) + return false; + } return true; } template Q_OUTOFLINE_TEMPLATE bool QGenericMatrix::operator!=(const QGenericMatrix& other) const { - for (int index = 0; index < N * M; ++index) { - if (m[0][index] != other.m[0][index]) - return true; - } + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) { + if (m[col][row] != other.m[col][row]) + return true; + } return false; } template Q_OUTOFLINE_TEMPLATE QGenericMatrix& QGenericMatrix::operator/=(T divisor) { - for (int index = 0; index < N * M; ++index) - m[0][index] /= divisor; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + m[col][row] /= divisor; return *this; } @@ -251,8 +257,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator+(const QGenericMatrix& m1, const QGenericMatrix& m2) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = m1.m[0][index] + m2.m[0][index]; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = m1.m[col][row] + m2.m[col][row]; return result; } @@ -260,8 +267,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator-(const QGenericMatrix& m1, const QGenericMatrix& m2) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = m1.m[0][index] - m2.m[0][index]; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = m1.m[col][row] - m2.m[col][row]; return result; } @@ -284,8 +292,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator-(const QGenericMatrix& matrix) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = -matrix.m[0][index]; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = -matrix.m[col][row]; return result; } @@ -293,8 +302,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator*(T factor, const QGenericMatrix& matrix) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] * factor; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = matrix.m[col][row] * factor; return result; } @@ -302,8 +312,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator*(const QGenericMatrix& matrix, T factor) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] * factor; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = matrix.m[col][row] * factor; return result; } @@ -311,8 +322,9 @@ template Q_OUTOFLINE_TEMPLATE QGenericMatrix operator/(const QGenericMatrix& matrix, T divisor) { QGenericMatrix result(1); - for (int index = 0; index < N * M; ++index) - result.m[0][index] = matrix.m[0][index] / divisor; + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[col][row] = matrix.m[col][row] / divisor; return result; } -- cgit v0.12 From e1ac82f713ab2a766ae518f3ec7a7f76689acb48 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 23 Dec 2010 13:14:06 +1000 Subject: Improve docs for QTEST_MAIN macro. The macro doesn't always create a QApplication, it depends on whether QT_GUI_LIB is defined. Task-number: QTBUG-3899 Reviewed-by: Rohan McGovern --- src/testlib/qtestcase.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index e3a8726..207873e 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -298,10 +298,14 @@ QT_BEGIN_NAMESPACE \relates QTest - Implements a main() function that instantiates a QApplication object and + Implements a main() function that instantiates an application object and the \a TestClass, and executes all tests in the order they were defined. Use this macro to build stand-alone executables. + If \c QT_GUI_LIB is defined, the application object will be a QApplication, + otherwise it will be a QCoreApplication. If qmake is used and the configuration + includes \c{QT += gui}, then \c QT_GUI_LIB will be defined automatically. + \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian), this macro will forcfully disable it to simplify the usage of key events when writing autotests. If you wish to write a test case that uses keypad navigation, you should -- cgit v0.12 From 26d2580daab37f4a6ff595a5f18b8a49249b5da1 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Thu, 23 Dec 2010 14:31:54 +0100 Subject: improve performance of QTextEngine, esp. setBoundary by using non-detaching operator[] Improves scrolling in testfile content.xml attached to QTBUG-9549. According to callgrind, the improvement is nearly 35% (comparing total incl. cost of QTextEngine::setBoundary) total incl cost / calls to setBoundary = before: 6.0883269E9 / 46520 = approx. 130875.47 after: 2.4834313E9 / 29370 = approx. 84556.733 in relation this gives us: 84556.733 / 130875.47 = approx. 0.64608542 Merge-request: 975 Reviewed-by: Harald Fernengel --- src/gui/text/qtextengine.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3bd6122..17d5fc1 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -894,16 +894,16 @@ void QTextEngine::shapeText(int item) const if (letterSpacingIsAbsolute) glyphs.advances_x[i-1] += letterSpacing; else { - const QFixed advance = glyphs.advances_x[i-1]; - glyphs.advances_x[i-1] += (letterSpacing - 100) * advance / 100; + QFixed &advance = glyphs.advances_x[i-1]; + advance += (letterSpacing - 100) * advance / 100; } } } if (letterSpacingIsAbsolute) glyphs.advances_x[si.num_glyphs-1] += letterSpacing; else { - const QFixed advance = glyphs.advances_x[si.num_glyphs-1]; - glyphs.advances_x[si.num_glyphs-1] += (letterSpacing - 100) * advance / 100; + QFixed &advance = glyphs.advances_x[si.num_glyphs-1]; + advance += (letterSpacing - 100) * advance / 100; } } if (wordSpacing != 0) { @@ -2521,14 +2521,14 @@ void QTextEngine::setBoundary(int strPos) const return; int itemToSplit = 0; - while (itemToSplit < layoutData->items.size() && layoutData->items[itemToSplit].position <= strPos) + while (itemToSplit < layoutData->items.size() && layoutData->items.at(itemToSplit).position <= strPos) itemToSplit++; itemToSplit--; - if (layoutData->items[itemToSplit].position == strPos) { + if (layoutData->items.at(itemToSplit).position == strPos) { // already a split at the requested position return; } - splitItem(itemToSplit, strPos - layoutData->items[itemToSplit].position); + splitItem(itemToSplit, strPos - layoutData->items.at(itemToSplit).position); } void QTextEngine::splitItem(int item, int pos) const -- cgit v0.12