From 4cedc55327d79aeee18c602fa0822283b27a74e9 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 21 Jul 2014 12:40:00 +0200 Subject: Windows: Add Qt Creator PATH update tip for missing SQL client dlls This patch aims to provide an additional tip for users having trouble with e.g. the MySQL plugin. After a successful build most users are struggling with loading failure due the fact that the client libraries folder is not contained in the PATH environment variable. This tip helps them overcome that in a controlled manner with Qt Creator. Change-Id: I2dc5c9c6d8d8976686d74c369b6e1683c479f35c Reviewed-by: Jerome Pasion --- src/sql/doc/src/sql-driver.qdoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 9858e30ff9..71d2fb4f85 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -700,7 +700,10 @@ system. On Unix, run the command \c{ldd} and pass the name of the plugin as parameter, for example \c{ldd libqsqlmysql.so}. You will get a warning if any of the client libraries couldn't be found. - On Windows, you can use Visual Studio's dependency walker. + On Windows, you can use Visual Studio's dependency walker. With + Qt Creator, you can update the \c PATH environment variable in the + \gui Run section of the \gui Project panel to include the path to + the folder containing the client libraries. \li Compile Qt with \c{QT_DEBUG_COMPONENT} defined to get very verbose debug output when loading plugins. \endlist -- cgit v1.2.3 From b0d0a2680afffe02713ee4110c7996ee423c1d1e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 22 Jul 2014 13:45:58 +0200 Subject: QPixmap::fromImage() should detach when changing QImage format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QPixmap::fromImage() detects an ARGB32 image with only opaque pixels it will do a conversion where it only changes the advertised format of the image. This conversion was lacking a check to see if it the QImage was shared before doing so, which this patch adds. Task-number: QTBUG-40282 Change-Id: I3acf221b76735637cef04c2104a33f87e5f09d54 Reviewed-by: Andreas Löw Reviewed-by: Friedemann Kleint --- src/gui/image/qpixmap_raster.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index d879a5cb61..639650dd89 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -343,6 +343,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32 || sourceImage.format() == QImage::Format_ARGB32_Premultiplied)) { + inPlace = inPlace && sourceImage.isDetached(); image = sourceImage; if (!inPlace) image.detach(); -- cgit v1.2.3 From fac1d4d17e849e069424e62cb0ef5fd4509c5066 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 22 Jul 2014 14:14:22 +0200 Subject: Windows: Fix assignment of margins in QPageSetupDialog. Task-number: QTBUG-40061 Change-Id: Id5c952a7d6280f2ab7180bff01911d6cffe57034 Reviewed-by: Kai Koehne --- src/printsupport/dialogs/qpagesetupdialog_win.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp index 5da87cce18..fd3a676369 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp @@ -137,9 +137,8 @@ int QPageSetupDialog::exec() QDialog::setVisible(false); if (result) { engine->setGlobalDevMode(psd.hDevNames, psd.hDevMode); - d->printer->setPageMargins(QMarginsF(psd.rtMargin.left / multiplier, psd.rtMargin.right / multiplier, - psd.rtMargin.top / multiplier, psd.rtMargin.bottom / multiplier), - layout.units()); + const QMarginsF margins(psd.rtMargin.left, psd.rtMargin.top, psd.rtMargin.right, psd.rtMargin.bottom); + d->printer->setPageMargins(margins / multiplier, layout.units()); // copy from our temp DEVMODE struct if (!engine->globalDevMode() && hDevMode) { -- cgit v1.2.3 From 66dbee12785d5474ec5ee787675eea6b271e6d2c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 22 Jul 2014 13:17:18 +0200 Subject: Doc: corrected autolink errors in qnamespace.qdoc Task-number: QTBUG-40362 Change-Id: Ic2a0740a12c98a60cb1d178c4d42c4ae1c39869c Reviewed-by: Jerome Pasion --- src/corelib/global/qnamespace.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 4227dd358e..a47f2e2945 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -488,7 +488,7 @@ the underlines. \value TextDontPrint Treat this text as "hidden" and don't print it. \value TextIncludeTrailingSpaces When this option is set, - QTextLine::naturalTextWidth() and naturalTextRect() will + QTextLine::naturalTextWidth() and QTextLine::naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded. \value TextJustificationForced Ensures that text lines are justified. @@ -1880,7 +1880,7 @@ menu, and in contrast to \c NoContextMenu, the handling is \e not deferred to the widget's parent. This means that all right mouse button events are guaranteed to be delivered to the widget itself - through mousePressEvent(), and mouseReleaseEvent(). + through QWidget::mousePressEvent(), and QWidget::mouseReleaseEvent(). \value DefaultContextMenu the widget's QWidget::contextMenuEvent() handler is called. \value ActionsContextMenu the widget displays its QWidget::actions() as context menu. \value CustomContextMenu the widget emits the QWidget::customContextMenuRequested() signal. @@ -2236,9 +2236,9 @@ \enum Qt::TextFormat This enum is used in widgets that can display both plain text and - rich text, e.g. QLabel. It is used for deciding whether a text + rich text, for example QLabel. It is used for deciding whether a text string should be interpreted as one or the other. This is normally - done by passing one of the enum values to a setTextFormat() + done by passing one of the enum values to a QTextEdit::setTextFormat() function. \value PlainText The text string is interpreted as a plain text @@ -2438,7 +2438,7 @@ \value ImSurroundingText The plain text around the input area, for example the current paragraph. \value ImCurrentSelection The currently selected text. \value ImMaximumTextLength The maximum number of characters that the widget can hold. If there is no limit, - QVariant() is returned. + QVariant::QVariant() is returned. \value ImAnchorPosition The position of the selection anchor. This may be less or greater than \c ImCursorPosition, depending on which side of selection the cursor is. If there is no selection, it returns the same as \c ImCursorPosition. -- cgit v1.2.3 From c94bf2cfbae06878857f2018367a1c2dff399d80 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Jul 2014 22:24:41 -0700 Subject: Use the stateless UTF-8 encoder in QStringRef::toUtf8 QString::toUtf8 already does it. I guess I forgot to update this part in d51130cc3a00df8147e2eb0799e06865c901c6e0. Change-Id: I83feafcb0383758f7e64d5142f57a7ae6a2ff351 Reviewed-by: Olivier Goffart --- src/corelib/tools/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a018b81c38..83f1bac2ef 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9516,7 +9516,7 @@ QByteArray QStringRef::toUtf8() const if (isNull()) return QByteArray(); - return QUtf8::convertFromUnicode(constData(), length(), 0); + return QUtf8::convertFromUnicode(constData(), length()); } /*! -- cgit v1.2.3 From b99fa32d70e6511ae8bc1c6e806dbbb042dc8090 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 23 Jul 2014 16:35:01 +0200 Subject: QNAM: Fix CPU load for limited upload QIODevice This fixes high CPU load for upload devices that don't generate a constant stream of data. Their readData() function was called all the time without returning actual data. This was noticed when implementing an upload device that emits data in a limited way for bandwidth limiting. [ChangeLog][QtNetwork][QNetworkAccessManager] Fixed high CPU load when handling POST/upload QIODevice that generates data on readyRead(). Change-Id: Iefbcb1a21d8aedef1eb11761232dd16a049018dc Reviewed-by: Richard J. Moore --- src/network/access/qnetworkreplyhttpimpl.cpp | 19 +++++++++++++++++++ src/network/access/qnetworkreplyhttpimpl_p.h | 4 ++++ 2 files changed, 23 insertions(+) (limited to 'src') diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 56105a544b..4efb2f6a2a 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -863,6 +863,11 @@ void QNetworkReplyHttpImplPrivate::postRequest() forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread() delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); + // If the device in the user thread claims it has more data, keep the flow to HTTP thread going + QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()), + q, SLOT(uploadByteDeviceReadyReadSlot()), + Qt::QueuedConnection); + // From main thread to user thread: QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)), forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection); @@ -1284,6 +1289,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) // call readPointer qint64 currentUploadDataLength = 0; char *data = const_cast(uploadByteDevice->readPointer(maxSize, currentUploadDataLength)); + + if (currentUploadDataLength == 0) { + // No bytes from upload byte device. There will be bytes later, it will emit readyRead() + // and our uploadByteDeviceReadyReadSlot() is called. + return; + } + // Let's make a copy of this data QByteArray dataArray(data, currentUploadDataLength); @@ -1291,6 +1303,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) emit q->haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); } +void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot() +{ + // Start the flow between this thread and the HTTP thread again by triggering a upload. + wantUploadDataSlot(1024); +} + + /* A simple web page that can be used to test us: http://www.procata.com/cachetest/ */ diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h index d21659ce82..06a5383ae4 100644 --- a/src/network/access/qnetworkreplyhttpimpl_p.h +++ b/src/network/access/qnetworkreplyhttpimpl_p.h @@ -129,6 +129,7 @@ public: Q_PRIVATE_SLOT(d_func(), void resetUploadDataSlot(bool *r)) Q_PRIVATE_SLOT(d_func(), void wantUploadDataSlot(qint64)) Q_PRIVATE_SLOT(d_func(), void sentUploadDataSlot(qint64)) + Q_PRIVATE_SLOT(d_func(), void uploadByteDeviceReadyReadSlot()) Q_PRIVATE_SLOT(d_func(), void emitReplyUploadProgress(qint64, qint64)) Q_PRIVATE_SLOT(d_func(), void _q_cacheSaveDeviceAboutToClose()) @@ -300,6 +301,9 @@ public: void wantUploadDataSlot(qint64); void sentUploadDataSlot(qint64); + // From user's QNonContiguousByteDevice + void uploadByteDeviceReadyReadSlot(); + Q_DECLARE_PUBLIC(QNetworkReplyHttpImpl) }; -- cgit v1.2.3 From 553325abfd988b062195caae280bbf75b8474ca4 Mon Sep 17 00:00:00 2001 From: Artem Shevchenko Date: Sun, 27 Jul 2014 13:25:06 +0300 Subject: Fix buffer overrun error with some proxy servers In some cases, depending on the proxy server response, the current implementation of QHttpSocketEngine may write to memory beyond the allocated buffer size. That will trigger undefined behavior on UNIX systems and a buffer overrun exception if compiled with visual studio. Change-Id: I5769d10c56b6a7483d6d94672aa4321287b82651 Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart --- src/network/socket/qhttpsocketengine.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 2e920ad69f..0a25815752 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -568,9 +568,6 @@ void QHttpSocketEngine::slotSocketReadNotification() char dummybuffer[4096]; while (d->pendingResponseData) { int read = d->socket->read(dummybuffer, qMin(sizeof(dummybuffer), (size_t)d->pendingResponseData)); - if (read >= 0) - dummybuffer[read] = 0; - if (read == 0) return; if (read == -1) { -- cgit v1.2.3 From ec703836b314c419a1c463dc105234f733031535 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 9 Jul 2014 11:58:44 +0200 Subject: Improve dbus cross compilation Building QtDBus on Linux host for QNX target had two issues: * Configure check failed, because dbus-1 library was not linked in, if target platform doesn't support pkg-config. * Host tools were not built, because pkg-config was not used to locate dbus headers on the host. Task-number: QTBUG-37324 Change-Id: I71d8309599fd40ef2dd8c9e3b44b93a7482019f1 Reviewed-by: Rolf Eike Beer Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/tools/bootstrap-dbus/bootstrap-dbus.pro | 2 +- src/tools/qdbuscpp2xml/qdbuscpp2xml.pro | 2 +- src/tools/qdbusxml2cpp/qdbusxml2cpp.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tools/bootstrap-dbus/bootstrap-dbus.pro b/src/tools/bootstrap-dbus/bootstrap-dbus.pro index 62f9f96a9b..fb06b4d8a2 100644 --- a/src/tools/bootstrap-dbus/bootstrap-dbus.pro +++ b/src/tools/bootstrap-dbus/bootstrap-dbus.pro @@ -15,7 +15,7 @@ MODULE_PRIVATE_INCLUDES = \ load(qt_module) -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS SOURCES = \ ../../dbus/qdbusintrospection.cpp \ diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro index 655158e457..d65b5ce6ef 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro @@ -3,7 +3,7 @@ QT = core-private force_bootstrap: QT += bootstrap_dbus-private else: QT += dbus-private DEFINES += QT_NO_CAST_FROM_ASCII -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS include(../moc/moc.pri) diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro index dcc36c7913..6efcf323b8 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro @@ -3,7 +3,7 @@ QT = core-private force_bootstrap: QT += bootstrap_dbus-private else: QT += dbus-private DEFINES += QT_NO_CAST_FROM_ASCII -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS SOURCES = qdbusxml2cpp.cpp -- cgit v1.2.3 From 7e74f8f398deb8ed84f6c4613de6dab2066dc9de Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 24 Jul 2014 10:06:10 +0300 Subject: Fix compilation if EC is disabled in OpenSSL Some Linux distributions disable EC by default which causes compile errors on those platforms. Task-number: QTBUG-40394 Change-Id: If5816d473bd1d64b1d4977860db662704a83310f Reviewed-by: Richard J. Moore --- src/network/ssl/qsslcontext.cpp | 2 ++ src/network/ssl/qsslsocket_openssl_symbols.cpp | 4 ++++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 2 ++ 3 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp index f5e5352d5e..addf7a2ff5 100644 --- a/src/network/ssl/qsslcontext.cpp +++ b/src/network/ssl/qsslcontext.cpp @@ -315,11 +315,13 @@ init_context: q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh); q_DH_free(dh); +#ifndef OPENSSL_NO_EC // Set temp ECDH params EC_KEY *ecdh = 0; ecdh = q_EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); q_SSL_CTX_set_tmp_ecdh(sslContext->ctx, ecdh); q_EC_KEY_free(ecdh); +#endif // OPENSSL_NO_EC return sslContext; } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index d4a4117b8b..4e6200f880 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -365,8 +365,10 @@ DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s, DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG) DEFINEFUNC3(BIGNUM *, BN_bin2bn, const unsigned char *s, s, int len, len, BIGNUM *ret, ret, return 0, return) +#ifndef OPENSSL_NO_EC DEFINEFUNC(EC_KEY *, EC_KEY_new_by_curve_name, int nid, nid, return 0, return) DEFINEFUNC(void, EC_KEY_free, EC_KEY *ecdh, ecdh, return, DUMMYARG) +#endif // OPENSSL_NO_EC #define RESOLVEFUNC(func) \ if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \ @@ -845,8 +847,10 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(DH_new) RESOLVEFUNC(DH_free) RESOLVEFUNC(BN_bin2bn) +#ifndef OPENSSL_NO_EC RESOLVEFUNC(EC_KEY_new_by_curve_name) RESOLVEFUNC(EC_KEY_free) +#endif // OPENSSL_NO_EC symbolsResolved = true; delete libs.first; diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 0f3d2673c2..68f5709b93 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -434,10 +434,12 @@ void q_DH_free(DH *dh); BIGNUM *q_BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); #define q_SSL_CTX_set_tmp_dh(ctx, dh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_DH, 0, (char *)dh) +#ifndef OPENSSL_NO_EC // EC Diffie-Hellman support EC_KEY *q_EC_KEY_new_by_curve_name(int nid); void q_EC_KEY_free(EC_KEY *ecdh); #define q_SSL_CTX_set_tmp_ecdh(ctx, ecdh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_ECDH, 0, (char *)ecdh) +#endif // OPENSSL_NO_EC #define q_BIO_get_mem_data(b, pp) (int)q_BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) #define q_BIO_pending(b) (int)q_BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) -- cgit v1.2.3