From a427b1b551aee413e6d83affafc4b8bcb2716bfc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 12 Sep 2018 19:41:11 +0200 Subject: normalize layout of 5.11.2 changelog Change-Id: I15fc16072d39e08d549c51097fe39c8ecd4a3a16 Reviewed-by: Jani Heikkinen --- dist/changes-5.11.2 | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/dist/changes-5.11.2 b/dist/changes-5.11.2 index 5bb61339dd..9add4cc9b2 100644 --- a/dist/changes-5.11.2 +++ b/dist/changes-5.11.2 @@ -17,10 +17,6 @@ https://bugreports.qt.io/ Each of these identifiers can be entered in the bug tracker to obtain more information about a particular change. -**************************************************************************** -* Qt 5.11.2 Changes * -**************************************************************************** - **************************************************************************** * Licensing * **************************************************************************** @@ -32,9 +28,12 @@ information about a particular change. provided for builds from released branches of Qt. **************************************************************************** -* QtCore * +* Library * **************************************************************************** +QtCore +------ + - QFile: * [QTBUG-69417] Fixed a regression in QFile::copy() that caused the original file not to be copied entirely if it was modified outside of @@ -85,9 +84,8 @@ information about a particular change. prohibited Unicode codepoints to report isValid() == true, despite clearing the hostname. -**************************************************************************** -* QtGui * -**************************************************************************** +QtGui +----- - QMatrix: * The qHash() implementation for QMatrix has been changed. @@ -101,9 +99,10 @@ information about a particular change. * [QTBUG-70096] Fixed a possible crash when combining QStaticText, QOpenGLWidget and Qt Quick in the same application. -**************************************************************************** -* QtWidgets * -**************************************************************************** + - Qt programs in Flatpak environment can now trigger IBus input method. + +QtWidgets +--------- - QMessageBox: * [QTBUG-69526] A message box with two buttons, one of which is the "Show @@ -121,9 +120,3 @@ information about a particular change. - [QTBUG-69274] SQLite was updated to version 3.24.0. - [QTBUG-69271] PCRE2 was updated to version 10.31. -**************************************************************************** -* plugins * -**************************************************************************** - - - ibus: - * Qt programs in Flatpak environment can now trigger IBus input method. -- cgit v1.2.3 From b0dce506cc91c4b623eb323db7bbc18469e721c2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 12 Sep 2018 20:36:26 +0200 Subject: add buildsystem+qmake changelog Change-Id: Ifb17f3bac7e065e7e50f7c0492ede2faf4c56f27 Reviewed-by: Jani Heikkinen --- dist/changes-5.11.2 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dist/changes-5.11.2 b/dist/changes-5.11.2 index 9add4cc9b2..acf8570e8e 100644 --- a/dist/changes-5.11.2 +++ b/dist/changes-5.11.2 @@ -120,3 +120,40 @@ QtWidgets - [QTBUG-69274] SQLite was updated to version 3.24.0. - [QTBUG-69271] PCRE2 was updated to version 10.31. +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-63452] Fixed re-configuring commercial builds after more than a day. + - [QTBUG-63483] Fixed -sysroot being ignored by various configure tests. + - [QTBUG-67443] Fixed build with some MinGW distributions. + - [QTBUG-69176] Fixed setting variables with digits in their names on + the configure command line. + - [MSVC][ICC] Fixed build with MSVC 2017 15.8. + - Fixed -L & -F being ignored by library configure tests. + - Added support for building with Wayland on macOS. + +qmake +----- + + - [QTBUG-22863][QTBUG-68635] Fixed support for file names containing colons + or hash marks - to a degree. + - [QTBUG-35713][Android@Win] Fixed building of static libraries with DESTDIR. + - [QTBUG-37592][Darwin] Switching the SDK version on an existing build will + now raise an error. + - [QTBUG-59967][VS2012+] Fixed handling of QMAKE_MANIFEST. + - [QTBUG-65072][Android@Win] Fixed inconsistent use of path separators in + generated dependencies with lead to build rules not being found. + - [QTBUG-69244][Xcode] Fixed shadow builds of SUBDIRS projects. + - [QTBUG-69279][Xcode] Fixed clobbering of build directory name in debug + builds of libraries with CONFIG+=create_prl when the path contains the + library name itself. + - [QTBUG-69770][VS] Fixed compilation of generated C++ sources with non-.cpp + file extensions. + - [QTBUG-69769][VS] Fixed QMAKE_EXTRA_COMPILERS for non-debug&release builds. + - [Darwin] Fixed QMAKE_BUNDLE not being used for the bundle identifier. + - Clang-based mkspecs now support CROSS_COMPILE. + - Added support for C++14/17 with MSVC 2017 15.7. -- cgit v1.2.3 From 1511bfef52b0731e1fdeafd685bf4954024da0e9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 2 Aug 2018 18:15:33 +0200 Subject: Disable RGB64 backend for ARGB32 when it will be very slow Fixes a speed regression on ARGB32 painting on low end hardware introduced when it was switched to using the RGB64 raster routines. It turns out several of our embedded QPA targets use ARGB32 as native format. Task-number: QTBUG-69724 Change-Id: I6d7993c12da46a85b8354eb905930dae9602b5e6 Reviewed-by: Lars Knoll --- src/gui/painting/qdrawhelper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index b277278fe0..0f2d163840 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5322,8 +5322,10 @@ void qBlendTexture(int count, const QSpan *spans, void *userData) case QImage::Format_RGB16: proc = processTextureSpansRGB16[blendType]; break; +#if defined(__SSE2__) || defined(__ARM_NEON__) || (Q_PROCESSOR_WORDSIZE == 8) case QImage::Format_ARGB32: case QImage::Format_RGBA8888: +#endif case QImage::Format_BGR30: case QImage::Format_A2BGR30_Premultiplied: case QImage::Format_RGB30: -- cgit v1.2.3 From cb5c24fa26142edaff8fd2c9787dbe45c222b4ff Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 14 Sep 2018 17:38:53 -0700 Subject: Fix integer overflow in very long sections in ELF objects The source is an ElfXX_Off, which is an unsigned 32- or 64-bit. That means any section bigger than 2 GB would cause an overflow when we assigned in m_stringTableFileOffset = strtab.offset; Change-Id: Ib47c56818178458a88b4fffd15546bd47a89894e Fixes: QTBUG-70560 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/plugin/qelfparser_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index 1d3578255f..cdf055329d 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -84,7 +84,7 @@ public: int m_endian; int m_bits; - int m_stringTableFileOffset; + qelfoff_t m_stringTableFileOffset; template T read(const char *s) -- cgit v1.2.3 From 12c357bebb19407ee8e034f3679b6c8b77ece9c1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 17 Sep 2018 16:40:26 +0200 Subject: Document IAccessible2 version The update to 1.3.0 was done in b2a7d865b2660d83fa899a213826525788d66b95. Change-Id: Ie4227d49a1ee0707abff754a5edbcb2b9663ccfe Reviewed-by: Friedemann Kleint --- src/3rdparty/iaccessible2/qt_attribution.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json index 545ffe4d63..290d0d4b7d 100644 --- a/src/3rdparty/iaccessible2/qt_attribution.json +++ b/src/3rdparty/iaccessible2/qt_attribution.json @@ -6,6 +6,7 @@ "Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA", "Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2", + "Version": "1.3.0", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", -- cgit v1.2.3 From 8aa9bb6d3fcb45579f3dc45c5bdef6d33a9f9d24 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sat, 15 Sep 2018 01:06:11 +0200 Subject: Clarify docs regarding the states of a QFutureWatcher with no future set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-55554 Change-Id: I49b475a95d8ee65864cfa6d1024cb17cfe648b43 Reviewed-by: Topi Reiniö --- src/corelib/thread/qfuturewatcher.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp index 5b68af1fbc..faeb6b3a28 100644 --- a/src/corelib/thread/qfuturewatcher.cpp +++ b/src/corelib/thread/qfuturewatcher.cpp @@ -98,7 +98,9 @@ QT_BEGIN_NAMESPACE /*! \fn template QFutureWatcher::QFutureWatcher(QObject *parent) - Constructs a new QFutureWatcher with the given \a parent. + Constructs a new QFutureWatcher with the given \a parent. Until a future is + set with setFuture(), the functions isStarted(), isCanceled(), and + isFinished() return \c true. */ QFutureWatcherBase::QFutureWatcherBase(QObject *parent) :QObject(*new QFutureWatcherBasePrivate, parent) @@ -241,7 +243,7 @@ QString QFutureWatcherBase::progressText() const /*! \fn template bool QFutureWatcher::isStarted() const Returns \c true if the asynchronous computation represented by the future() - has been started; otherwise returns \c false. + has been started, or if no future has been set; otherwise returns \c false. */ bool QFutureWatcherBase::isStarted() const { @@ -272,7 +274,7 @@ bool QFutureWatcherBase::isRunning() const /*! \fn template bool QFutureWatcher::isCanceled() const Returns \c true if the asynchronous computation has been canceled with the - cancel() function; otherwise returns \c false. + cancel() function, or if no future has been set; otherwise returns \c false. Be aware that the computation may still be running even though this function returns \c true. See cancel() for more details. -- cgit v1.2.3 From 4fc4f7b0ce0e6ee186a7d7fe9b5dd20e94efe432 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Sep 2018 09:04:24 -0700 Subject: Export qt_open64 from QtCore Other libs use qcore_unix_p.h. qopenglprogrambinarycache.cpp:function QOpenGLProgramBinaryCache::load(QByteArray const&, unsigned int): error: undefined reference to 'qt_open64(char const*, int, unsigned int)' Change-Id: I44e7d800c68141bdaae0fffd155675d15eded2e4 Reviewed-by: Simon Hausmann Reviewed-by: Eric Lemanissier --- src/corelib/kernel/qcore_unix_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index cb98bef347..5a2a29a327 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -178,7 +178,7 @@ inline void qt_ignore_sigpipe() #if defined(Q_PROCESSOR_X86_32) && defined(__GLIBC__) # if !__GLIBC_PREREQ(2, 22) -int qt_open64(const char *pathname, int flags, mode_t); +Q_CORE_EXPORT int qt_open64(const char *pathname, int flags, mode_t); # undef QT_OPEN # define QT_OPEN qt_open64 # endif -- cgit v1.2.3 From 4b7ff8e98c0208273a25d84e1f0322cad5bce2bf Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 13 Sep 2018 12:59:59 +0200 Subject: Protect HSTS code for no-feature-settings build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under the hood we use QSettings to store HSTS policies. Qt configured with 'no feature settings' would fail to build then. For such builds, we fall back to in-memory only HSTS cache. Change-Id: I6df551d8c6c96d982080a51ce6b1bdce71d04b9f Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- src/network/access/access.pri | 14 ++++++++++---- src/network/access/qhsts.cpp | 19 ++++++++++++++++++- src/network/access/qhsts_p.h | 8 +++++--- src/network/access/qhstsstore_p.h | 2 ++ src/network/access/qnetworkaccessmanager.cpp | 13 +++++++++++++ src/network/access/qnetworkaccessmanager_p.h | 7 ++++++- 6 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/network/access/access.pri b/src/network/access/access.pri index a129beda15..ec0273377f 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -24,8 +24,7 @@ HEADERS += \ access/qabstractnetworkcache.h \ access/qnetworkfile_p.h \ access/qhsts_p.h \ - access/qhstspolicy.h \ - access/qhstsstore_p.h + access/qhstspolicy.h SOURCES += \ access/qnetworkaccessauthenticationmanager.cpp \ @@ -45,8 +44,7 @@ SOURCES += \ access/qabstractnetworkcache.cpp \ access/qnetworkfile.cpp \ access/qhsts.cpp \ - access/qhstspolicy.cpp \ - access/qhstsstore.cpp + access/qhstspolicy.cpp qtConfig(ftp) { HEADERS += \ @@ -66,6 +64,14 @@ qtConfig(networkdiskcache) { SOURCES += access/qnetworkdiskcache.cpp } +qtConfig(settings) { + HEADERS += \ + access/qhstsstore_p.h + + SOURCES += \ + access/qhstsstore.cpp +} + mac: LIBS_PRIVATE += -framework Security include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp index 43a8a3663e..af913ca015 100644 --- a/src/network/access/qhsts.cpp +++ b/src/network/access/qhsts.cpp @@ -37,13 +37,16 @@ ** ****************************************************************************/ -#include "qhstsstore_p.h" #include "qhsts_p.h" #include "QtCore/private/qipaddress_p.h" #include "QtCore/qvector.h" #include "QtCore/qlist.h" +#if QT_CONFIG(settings) +#include "qhstsstore_p.h" +#endif // QT_CONFIG(settings) + QT_BEGIN_NAMESPACE static bool is_valid_domain_name(const QString &host) @@ -83,8 +86,10 @@ void QHstsCache::updateFromHeaders(const QList> &h QHstsHeaderParser parser; if (parser.parse(headers)) { updateKnownHost(url.host(), parser.expirationDate(), parser.includeSubDomains()); +#if QT_CONFIG(settings) if (hstsStore) hstsStore->synchronize(); +#endif // QT_CONFIG(settings) } } @@ -93,12 +98,14 @@ void QHstsCache::updateFromPolicies(const QVector &policies) for (const auto &policy : policies) updateKnownHost(policy.host(), policy.expiry(), policy.includesSubDomains()); +#if QT_CONFIG(settings) if (hstsStore && policies.size()) { // These policies are coming either from store or from QNAM's setter // function. As a result we can notice expired or new policies, time // to sync ... hstsStore->synchronize(); } +#endif // QT_CONFIG(settings) } void QHstsCache::updateKnownHost(const QUrl &url, const QDateTime &expires, @@ -108,8 +115,10 @@ void QHstsCache::updateKnownHost(const QUrl &url, const QDateTime &expires, return; updateKnownHost(url.host(), expires, includeSubDomains); +#if QT_CONFIG(settings) if (hstsStore) hstsStore->synchronize(); +#endif // QT_CONFIG(settings) } void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires, @@ -137,8 +146,10 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires, } knownHosts.insert(pos, {hostName, newPolicy}); +#if QT_CONFIG(settings) if (hstsStore) hstsStore->addToObserved(newPolicy); +#endif // QT_CONFIG(settings) return; } @@ -149,8 +160,10 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires, else return; +#if QT_CONFIG(settings) if (hstsStore) hstsStore->addToObserved(newPolicy); +#endif // QT_CONFIG(settings) } bool QHstsCache::isKnownHost(const QUrl &url) const @@ -187,10 +200,12 @@ bool QHstsCache::isKnownHost(const QUrl &url) const if (pos != knownHosts.end()) { if (pos->second.isExpired()) { knownHosts.erase(pos); +#if QT_CONFIG(settings) if (hstsStore) { // Inform our store that this policy has expired. hstsStore->addToObserved(pos->second); } +#endif // QT_CONFIG(settings) } else if (!superDomainMatch || pos->second.includesSubDomains()) { return true; } @@ -221,6 +236,7 @@ QVector QHstsCache::policies() const return values; } +#if QT_CONFIG(settings) void QHstsCache::setStore(QHstsStore *store) { // Caller retains ownership of store, which must outlive this cache. @@ -248,6 +264,7 @@ void QHstsCache::setStore(QHstsStore *store) updateFromPolicies(restored); } } +#endif // QT_CONFIG(settings) // The parser is quite simple: 'nextToken' knowns exactly what kind of tokens // are valid and it will return false if something else was found; then diff --git a/src/network/access/qhsts_p.h b/src/network/access/qhsts_p.h index bc8708341d..c219d9eab5 100644 --- a/src/network/access/qhsts_p.h +++ b/src/network/access/qhsts_p.h @@ -69,8 +69,6 @@ QT_BEGIN_NAMESPACE template class QList; template class QVector; -class QHstsStore; - class Q_AUTOTEST_EXPORT QHstsCache { public: @@ -85,7 +83,9 @@ public: QVector policies() const; - void setStore(QHstsStore *store); +#if QT_CONFIG(settings) + void setStore(class QHstsStore *store); +#endif // QT_CONFIG(settings) private: @@ -119,7 +119,9 @@ private: }; mutable std::map knownHosts; +#if QT_CONFIG(settings) QHstsStore *hstsStore = nullptr; +#endif // QT_CONFIG(settings) }; class Q_AUTOTEST_EXPORT QHstsHeaderParser diff --git a/src/network/access/qhstsstore_p.h b/src/network/access/qhstsstore_p.h index 13042839c4..e82596b250 100644 --- a/src/network/access/qhstsstore_p.h +++ b/src/network/access/qhstsstore_p.h @@ -53,6 +53,8 @@ #include +QT_REQUIRE_CONFIG(settings); + #include #include diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 96e3f92db1..a2649fe77c 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -48,6 +48,10 @@ #include "qhstspolicy.h" #include "qhsts_p.h" +#if QT_CONFIG(settings) +#include "qhstsstore_p.h" +#endif // QT_CONFIG(settings) + #include "QtNetwork/qnetworksession.h" #include "QtNetwork/private/qsharednetworksession_p.h" @@ -760,9 +764,14 @@ bool QNetworkAccessManager::isStrictTransportSecurityEnabled() const void QNetworkAccessManager::enableStrictTransportSecurityStore(bool enabled, const QString &storeDir) { +#if QT_CONFIG(settings) Q_D(QNetworkAccessManager); d->stsStore.reset(enabled ? new QHstsStore(storeDir) : nullptr); d->stsCache.setStore(d->stsStore.data()); +#else + Q_UNUSED(enabled) Q_UNUSED(storeDir) + qWarning("HSTS permanent store requires the feature 'settings' enabled"); +#endif // QT_CONFIG(settings) } /*! @@ -776,8 +785,12 @@ void QNetworkAccessManager::enableStrictTransportSecurityStore(bool enabled, con bool QNetworkAccessManager::isStrictTransportSecurityStoreEnabled() const { +#if QT_CONFIG(settings) Q_D(const QNetworkAccessManager); return bool(d->stsStore.data()); +#else + return false; +#endif // QT_CONFIG(settings) } /*! diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index ffed24a314..5cab4928e4 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -56,7 +56,6 @@ #include "qnetworkaccesscache_p.h" #include "qnetworkaccessbackend_p.h" #include "qnetworkrequest.h" -#include "qhstsstore_p.h" #include "qhsts_p.h" #include "private/qobject_p.h" #include "QtNetwork/qnetworkproxy.h" @@ -66,6 +65,10 @@ #include "QtNetwork/qnetworkconfigmanager.h" #endif +#if QT_CONFIG(settings) +#include "qhstsstore_p.h" +#endif // QT_CONFIG(settings) + QT_BEGIN_NAMESPACE class QAuthenticator; @@ -215,7 +218,9 @@ public: Q_AUTOTEST_EXPORT static void clearConnectionCache(QNetworkAccessManager *manager); QHstsCache stsCache; +#if QT_CONFIG(settings) QScopedPointer stsStore; +#endif // QT_CONFIG(settings) bool stsEnabled = false; #ifndef QT_NO_BEARERMANAGEMENT -- cgit v1.2.3 From 6948bf20a73d09e867fd7c2d89052237d94b7d6a Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 11 Sep 2018 20:35:13 +0300 Subject: QSslContext: Use 0 instead of TLS_MAX_VERSION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the SSL_CTX_set_max_proto_version manpage [1]: > Setting the minimum or maximum version to 0, will enable protocol > versions down to the lowest version, or up to the highest version > supported by the library, respectively. This should make it possible to use Qt Network with older versions of libssl than it was compiled against. In particular, use with 1.1.0 when compiled against 1.1.1. Also, one of OpenSSL developers is suggesting to remove TLS_MAX_VERSION from the public header in the future [2]. [1] https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_max_proto_version.html#DESCRIPTION [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908567#59 Change-Id: Ie76054b917daa8e54d5c0156e848dbaca7bb8a82 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcontext_openssl11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qsslcontext_openssl11.cpp b/src/network/ssl/qsslcontext_openssl11.cpp index 5c68ed41db..4fb33cb0a4 100644 --- a/src/network/ssl/qsslcontext_openssl11.cpp +++ b/src/network/ssl/qsslcontext_openssl11.cpp @@ -124,20 +124,20 @@ init_context: case QSsl::TlsV1SslV3: case QSsl::AnyProtocol: minVersion = SSL3_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::SecureProtocols: case QSsl::TlsV1_0OrLater: minVersion = TLS1_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::TlsV1_1OrLater: minVersion = TLS1_1_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::TlsV1_2OrLater: minVersion = TLS1_2_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::SslV2: // This protocol is not supported by OpenSSL 1.1 and we handle -- cgit v1.2.3 From e226b0f94afc85f79d82fc54421487bf2a529ba5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 19 Sep 2018 13:28:13 +0200 Subject: Modernize the "textdate" feature Change-Id: Ic0b6f13e17c301ed66d6a8297c242086c94ac87d Reviewed-by: Edward Welbourne Reviewed-by: Lars Knoll --- src/corelib/global/qconfig-bootstrapped.h | 3 ++- src/corelib/tools/qdatetime.cpp | 24 ++++++++++++------------ src/corelib/tools/qdatetime.h | 4 ++-- src/corelib/tools/qdatetimeparser.cpp | 6 +++--- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index c5585ea32a..e5b9cfb05c 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -114,6 +114,7 @@ #define QT_NO_SYSTEMLOCALE #define QT_FEATURE_systemsemaphore -1 #define QT_FEATURE_temporaryfile 1 +#define QT_FEATURE_textdate 1 #define QT_NO_THREAD #define QT_FEATURE_timezone -1 #define QT_FEATURE_topleveldomain -1 diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 49e7173de0..341b525b88 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -171,7 +171,7 @@ static ParsedDate getDateFromJulianDay(qint64 julianDay) static const char monthDays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static const char qt_shortMonthNames[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -200,7 +200,7 @@ static int fromShortMonthName(const QStringRef &monthName) } return -1; } -#endif // QT_NO_TEXTDATE +#endif // textdate #ifndef QT_NO_DATESTRING struct ParsedRfcDateTime { @@ -613,7 +613,7 @@ int QDate::weekNumber(int *yearNumber) const return week; } -#if QT_DEPRECATED_SINCE(5, 11) && !defined(QT_NO_TEXTDATE) +#if QT_DEPRECATED_SINCE(5, 11) && QT_CONFIG(textdate) /*! \since 4.5 \deprecated @@ -775,11 +775,11 @@ QString QDate::longDayName(int weekday, MonthNameType type) } return QString(); } -#endif // QT_NO_TEXTDATE && deprecated +#endif // textdate && deprecated #ifndef QT_NO_DATESTRING -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static QString toStringTextDate(QDate date) { const ParsedDate pd = getDateFromJulianDay(date.toJulianDay()); @@ -789,7 +789,7 @@ static QString toStringTextDate(QDate date) + QString::number(pd.day) + sp + QString::number(pd.year); } -#endif // QT_NO_TEXTDATE +#endif // textdate static QString toStringIsoDate(qint64 jd) { @@ -865,7 +865,7 @@ QString QDate::toString(Qt::DateFormat format) const case Qt::RFC2822Date: return QLocale::c().toString(*this, QStringViewLiteral("dd MMM yyyy")); default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: return toStringTextDate(*this); #endif @@ -1234,7 +1234,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) case Qt::RFC2822Date: return rfcDateImpl(string).date; default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -1255,7 +1255,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) return QDate(year, month, parts.at(2).toInt()); } -#endif // QT_NO_TEXTDATE +#endif // textdate case Qt::ISODate: { // Semi-strict parsing, must be long enough and have non-numeric separators if (string.size() < 10 || string.at(4).isDigit() || string.at(7).isDigit() @@ -3848,7 +3848,7 @@ QString QDateTime::toString(Qt::DateFormat format) const return buf; } default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { const QPair p = getDateTime(d); buf = p.first.toString(Qt::TextDate); @@ -4827,7 +4827,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) date = date.addDays(1); return QDateTime(date, time, spec, offset); } -#if !defined(QT_NO_TEXTDATE) +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -4936,7 +4936,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) return QDateTime(date, time, Qt::UTC); } } -#endif //QT_NO_TEXTDATE +#endif // textdate } return QDateTime(); diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 5a7b75db62..399fba4413 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -81,7 +81,7 @@ public: int daysInYear() const; int weekNumber(int *yearNum = nullptr) const; -#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE +#if QT_DEPRECATED_SINCE(5, 10) && QT_CONFIG(textdate) QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") static QString shortMonthName(int month, MonthNameType type = DateFormat); QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") @@ -90,7 +90,7 @@ public: static QString longMonthName(int month, MonthNameType type = DateFormat); QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") static QString longDayName(int weekday, MonthNameType type = DateFormat); -#endif // QT_NO_TEXTDATE && deprecated +#endif // textdate && deprecated #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index d03518e70d..2007cd597b 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -612,7 +612,7 @@ int QDateTimeParser::sectionSize(int sectionIndex) const int QDateTimeParser::sectionMaxSize(Section s, int count) const { -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) int mcount = 12; #endif @@ -636,14 +636,14 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case DaySection: return 2; case DayOfWeekSectionShort: case DayOfWeekSectionLong: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else mcount = 7; Q_FALLTHROUGH(); #endif case MonthSection: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else if (count <= 2) -- cgit v1.2.3 From b26cd68bf61346273a5a03bbc1e60a7cdffa4f0d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 19 Sep 2018 13:31:18 +0200 Subject: Modernize the "datestring" feature Change-Id: I2236a456fe3758d9054b22e36fe6316f3522d533 Reviewed-by: Lars Knoll Reviewed-by: Edward Welbourne --- src/corelib/global/qconfig-bootstrapped.h | 1 + src/corelib/global/qlibraryinfo.cpp | 4 +-- src/corelib/global/qlibraryinfo.h | 4 +-- src/corelib/kernel/qvariant.cpp | 8 +++--- src/corelib/tools/qdatetime.cpp | 34 +++++++++++++------------ src/corelib/tools/qdatetime.h | 16 ++++++------ src/corelib/tools/qdatetimeparser.cpp | 14 +++++----- src/corelib/tools/qdatetimeparser_p.h | 6 ++--- src/corelib/tools/qlocale.cpp | 12 ++++----- src/corelib/tools/qlocale.h | 2 +- src/network/access/qftp.cpp | 4 +-- src/network/access/qnetworkaccessftpbackend.cpp | 2 +- src/network/access/qnetworkrequest.cpp | 6 ++--- src/network/ssl/qsslcertificate.cpp | 2 +- src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 6 ++--- src/plugins/sqldrivers/psql/qsql_psql.cpp | 12 ++++----- src/sql/kernel/qsqldriver.cpp | 2 +- src/testlib/qtest.h | 4 +-- src/widgets/dialogs/qfilesystemmodel.cpp | 2 +- src/widgets/itemviews/qdirmodel.cpp | 2 +- 20 files changed, 73 insertions(+), 70 deletions(-) diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index e5b9cfb05c..499fd4c9e8 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -77,6 +77,7 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE() ? 1 : -1) #define QT_NO_DATASTREAM +#define QT_FEATURE_datestring 1 #define QT_FEATURE_datetimeparser -1 #define QT_FEATURE_etw -1 #define QT_FEATURE_getauxval (QT_HAS_INCLUDE() ? 1 : -1) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 422d08f32c..e727f00c8e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -267,7 +267,7 @@ QLibraryInfo::licensedProducts() \deprecated This function used to return the installation date for this build of Qt, but now returns a constant date. */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) #if QT_DEPRECATED_SINCE(5, 5) QDate QLibraryInfo::buildDate() @@ -275,7 +275,7 @@ QLibraryInfo::buildDate() return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); } #endif -#endif //QT_NO_DATESTRING +#endif // datestring #if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them # ifdef __INTEL_CLANG_COMPILER diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 809813d99d..80fc5bd4fc 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -56,11 +56,11 @@ public: static QT_DEPRECATED QString licensedProducts(); #endif -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) #if QT_DEPRECATED_SINCE(5, 5) static QT_DEPRECATED QDate buildDate(); #endif // QT_DEPRECATED_SINCE(5, 5) -#endif //QT_NO_DATESTRING +#endif // datestring static const char * build() Q_DECL_NOTHROW; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 6192b66487..57c25a9423 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -445,7 +445,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::Double: *str = QString::number(d->data.d, 'g', QLocale::FloatingPointShortest); break; -#if !defined(QT_NO_DATESTRING) +#if QT_CONFIG(datestring) case QVariant::Date: *str = v_cast(d)->toString(Qt::ISODate); break; @@ -589,7 +589,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) QDate *dt = static_cast(result); if (d->type == QVariant::DateTime) *dt = v_cast(d)->date(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) else if (d->type == QVariant::String) *dt = QDate::fromString(*v_cast(d), Qt::ISODate); #endif @@ -604,7 +604,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::DateTime: *t = v_cast(d)->time(); break; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QVariant::String: *t = QTime::fromString(*v_cast(d), Qt::ISODate); break; @@ -617,7 +617,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::DateTime: { QDateTime *dt = static_cast(result); switch (d->type) { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QVariant::String: *dt = QDateTime::fromString(*v_cast(d), Qt::ISODate); break; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 341b525b88..f5e264798e 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -202,7 +202,7 @@ static int fromShortMonthName(const QStringRef &monthName) } #endif // textdate -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) struct ParsedRfcDateTime { QDate date; QTime time; @@ -241,7 +241,7 @@ static ParsedRfcDateTime rfcDateImpl(const QString &s) return result; } -#endif // QT_NO_DATESTRING +#endif // datestring // Return offset in [+-]HH:mm format static QString toOffsetString(Qt::DateFormat format, int offset) @@ -254,6 +254,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) (qAbs(offset) / 60) % 60); } +#if QT_CONFIG(datestring) // Parse offset in [+-]HH[[:]mm] format static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_NOTHROW { @@ -298,6 +299,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_ *valid = true; return sign * ((hour * 60) + minute) * 60; } +#endif // datestring /***************************************************************************** QDate member functions @@ -777,7 +779,7 @@ QString QDate::longDayName(int weekday, MonthNameType type) } #endif // textdate && deprecated -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) #if QT_CONFIG(textdate) static QString toStringTextDate(QDate date) @@ -939,7 +941,7 @@ QString QDate::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring /*! \fn bool QDate::setYMD(int y, int m, int d) @@ -1201,7 +1203,7 @@ qint64 QDate::daysTo(const QDate &d) const \sa QTime::currentTime(), QDateTime::currentDateTime() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QDate QDate::fromString(const QString &string, Qt::DateFormat format) @@ -1350,7 +1352,7 @@ QDate QDate::fromString(const QString &string, const QString &format) #endif return date; } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \overload @@ -1566,7 +1568,7 @@ int QTime::msec() const return ds() % 1000; } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \overload @@ -1702,7 +1704,7 @@ QString QTime::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring /*! Sets the time to hour \a h, minute \a m, seconds \a s and @@ -1887,7 +1889,7 @@ int QTime::msecsTo(const QTime &t) const operating system; not all systems provide 1-millisecond accuracy. */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, bool *isMidnight24) { @@ -2069,7 +2071,7 @@ QTime QTime::fromString(const QString &string, const QString &format) return time; } -#endif // QT_NO_DATESTRING +#endif // datestring /*! @@ -3773,7 +3775,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) } #endif -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QString QDateTime::toString(Qt::DateFormat format) const @@ -3993,7 +3995,7 @@ QString QDateTime::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date, QTime *time) { @@ -4722,7 +4724,7 @@ int QDateTime::utcOffset() const } #endif // QT_DEPRECATED_SINCE -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format) @@ -5071,7 +5073,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format) return QDateTime(); } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \fn QDateTime QDateTime::toLocalTime() const @@ -5330,7 +5332,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) Date / Time Debug Streams *****************************************************************************/ -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) QDebug operator<<(QDebug dbg, const QDate &date) { QDebugStateSaver saver(dbg); @@ -5382,7 +5384,7 @@ QDebug operator<<(QDebug dbg, const QDateTime &date) } return dbg.nospace() << ')'; } -#endif +#endif // debug_stream && datestring /*! \fn uint qHash(const QDateTime &key, uint seed = 0) \relates QHash diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 399fba4413..43271b34ed 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -91,7 +91,7 @@ public: QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") static QString longDayName(int weekday, MonthNameType type = DateFormat); #endif // textdate && deprecated -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -123,7 +123,7 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d) Q_DECL_CONSTEXPR bool operator>=(const QDate &other) const { return jd >= other.jd; } static QDate currentDate(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QDate fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDate fromString(const QString &s, const QString &format); #endif @@ -167,7 +167,7 @@ public: int minute() const; int second() const; int msec() const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -192,7 +192,7 @@ public: Q_DECL_CONSTEXPR inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; } static QTime currentTime(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QTime fromString(const QString &s, const QString &format); #endif @@ -303,7 +303,7 @@ public: void setMSecsSinceEpoch(qint64 msecs); void setSecsSinceEpoch(qint64 secs); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -342,7 +342,7 @@ public: static QDateTime currentDateTime(); static QDateTime currentDateTimeUtc(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDateTime fromString(const QString &s, const QString &format); #endif @@ -386,7 +386,7 @@ private: friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); #endif }; @@ -401,7 +401,7 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif // QT_NO_DATASTREAM -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) Q_CORE_EXPORT QDebug operator<<(QDebug, const QDate &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QTime &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 2007cd597b..18c44c3a17 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -77,7 +77,7 @@ QDateTimeParser::~QDateTimeParser() int QDateTimeParser::getDigit(const QDateTime &t, int index) const { if (index < 0 || index >= sectionNodes.size()) { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::getDigit() Internal error (%s %d)", qPrintable(t.toString()), index); #else @@ -103,7 +103,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const default: break; } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::getDigit() Internal error 2 (%s %d)", qPrintable(t.toString()), index); #else @@ -127,7 +127,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const { if (index < 0 || index >= sectionNodes.size()) { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::setDigit() Internal error (%s %d %d)", qPrintable(v.toString()), index, newVal); #else @@ -725,7 +725,7 @@ QString QDateTimeParser::sectionText(int sectionIndex) const } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTimeParser::ParsedSection QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionIndex, @@ -1727,7 +1727,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI return PossibleBoth; return (!broken[amindex] ? PossibleAM : PossiblePM); } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \internal @@ -1958,7 +1958,7 @@ QString QDateTimeParser::stateName(State s) const } } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const { QDateTime val(QDate(1900, 1, 1), QDATETIMEEDIT_TIME_MIN); @@ -1983,7 +1983,7 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con } return true; } -#endif // QT_NO_DATESTRING +#endif // datestring QDateTime QDateTimeParser::getMinimum() const { diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index c9e63fe307..f7e6e351fe 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -180,7 +180,7 @@ public: LowerCase }; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const; bool fromString(const QString &text, QDate *date, QTime *time) const; #endif @@ -202,7 +202,7 @@ public: private: int sectionMaxSize(Section s, int count) const; QString sectionText(const QString &text, int sectionIndex, int index) const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) StateNode scanString(const QDateTime &defaultValue, bool fixup, QString *input) const; struct ParsedSection { @@ -237,7 +237,7 @@ private: PossibleBoth = 4 }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; -#endif // QT_NO_DATESTRING +#endif // datestring bool potentialValue(const QStringRef &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 89896cdc60..6361280bc7 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2061,7 +2061,7 @@ QString QLocale::dateTimeFormat(FormatType format) const \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QTime QLocale::toTime(const QString &string, FormatType format) const { return toTime(string, timeFormat(format)); @@ -2079,7 +2079,7 @@ QTime QLocale::toTime(const QString &string, FormatType format) const \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate QLocale::toDate(const QString &string, FormatType format) const { return toDate(string, dateFormat(format)); @@ -2098,7 +2098,7 @@ QDate QLocale::toDate(const QString &string, FormatType format) const \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTime QLocale::toDateTime(const QString &string, FormatType format) const { return toDateTime(string, dateTimeFormat(format)); @@ -2116,7 +2116,7 @@ QDateTime QLocale::toDateTime(const QString &string, FormatType format) const \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QTime QLocale::toTime(const QString &string, const QString &format) const { QTime time; @@ -2147,7 +2147,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate QLocale::toDate(const QString &string, const QString &format) const { QDate date; @@ -2178,7 +2178,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTime QLocale::toDateTime(const QString &string, const QString &format) const { #if QT_CONFIG(datetimeparser) diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index ef7a26ea79..681867d14a 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -1001,7 +1001,7 @@ public: QString dateFormat(FormatType format = LongFormat) const; QString timeFormat(FormatType format = LongFormat) const; QString dateTimeFormat(FormatType format = LongFormat) const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate toDate(const QString &string, FormatType = LongFormat) const; QTime toTime(const QString &string, FormatType = LongFormat) const; QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const; diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 719e3536b4..feece4ebaf 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -525,7 +525,7 @@ static void _q_parseUnixDir(const QStringList &tokens, const QString &userName, // Resolve the modification date by parsing all possible formats QDateTime dateTime; int n = 0; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) do { dateTime = QLocale::c().toDateTime(dateString, formats.at(n++)); } while (n < formats.size() && (!dateTime.isValid())); @@ -600,7 +600,7 @@ static void _q_parseDosDir(const QStringList &tokens, const QString &userName, Q info->setWritable(info->isFile()); QDateTime dateTime; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) dateTime = QLocale::c().toDateTime(tokens.at(1), QLatin1String("MM-dd-yy hh:mmAP")); if (dateTime.date().year() < 1971) { dateTime.setDate(QDate(dateTime.date().year() + 100, diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index c5404e4221..bc44a78a9a 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -370,7 +370,7 @@ void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text) if (id == sizeId) { // reply to the size command setHeader(QNetworkRequest::ContentLengthHeader, text.toLongLong()); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) } else if (id == mdtmId) { QDateTime dt = QDateTime::fromString(text, QLatin1String("yyyyMMddHHmmss")); setHeader(QNetworkRequest::LastModifiedHeader, dt); diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 2fc50a66de..4cb93805dc 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -47,7 +47,7 @@ #include "QtCore/qdatetime.h" #include -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) # include #endif @@ -1159,7 +1159,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value) int pos = value.indexOf(','); QDateTime dt; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) if (pos == -1) { // no comma -> asctime(3) format dt = QDateTime::fromString(QString::fromLatin1(value), Qt::TextDate); @@ -1186,7 +1186,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value) dt = c.toDateTime(sansWeekday, QLatin1String("dd-MMM-yy hh:mm:ss 'GMT'")); } } -#endif // QT_NO_DATESTRING +#endif // datestring if (dt.isValid()) dt.setTimeSpec(Qt::UTC); diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 6433b84e80..9ddcb70b1d 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -699,7 +699,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate) << ", " << certificate.issuerInfo(QSslCertificate::Organization) << ", " << certificate.subjectInfo(QSslCertificate::Organization) << ", " << certificate.subjectAlternativeNames() -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) << ", " << certificate.effectiveDate() << ", " << certificate.expiryDate() #endif diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index 18c8b48462..5a100b8075 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp @@ -126,7 +126,7 @@ static inline QByteArray fromUnicode(QTextCodec *tc, const QString &str) static inline QVariant qDateFromString(const QString &val) { -#ifdef QT_NO_DATESTRING +#if !QT_CONFIG(datestring) Q_UNUSED(val); return QVariant(val); #else @@ -138,7 +138,7 @@ static inline QVariant qDateFromString(const QString &val) static inline QVariant qTimeFromString(const QString &val) { -#ifdef QT_NO_DATESTRING +#if !QT_CONFIG(datestring) Q_UNUSED(val); return QVariant(val); #else @@ -150,7 +150,7 @@ static inline QVariant qTimeFromString(const QString &val) static inline QVariant qDateTimeFromString(QString &val) { -#ifdef QT_NO_DATESTRING +#if !QT_CONFIG(datestring) Q_UNUSED(val); return QVariant(val); #else diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 5e0f7626b4..fe9e098c12 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -679,7 +679,7 @@ QVariant QPSQLResult::data(int i) if (val[0] == '\0') { return QVariant(QDate()); } else { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate)); #else return QVariant(QString::fromLatin1(val)); @@ -687,7 +687,7 @@ QVariant QPSQLResult::data(int i) } case QVariant::Time: { const QString str = QString::fromLatin1(val); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) if (str.isEmpty()) return QVariant(QTime()); else @@ -698,7 +698,7 @@ QVariant QPSQLResult::data(int i) } case QVariant::DateTime: { QString dtval = QString::fromLatin1(val); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) if (dtval.length() < 10) { return QVariant(QDateTime()); } else { @@ -1497,7 +1497,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const } else { switch (int(field.type())) { case QVariant::DateTime: -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) if (field.value().toDateTime().isValid()) { // we force the value to be considered with a timezone information, and we force it to be UTC // this is safe since postgresql stores only the UTC value and not the timezone offset (only used @@ -1510,10 +1510,10 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const } #else r = QLatin1String("NULL"); -#endif // QT_NO_DATESTRING +#endif // datestring break; case QVariant::Time: -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) if (field.value().toTime().isValid()) { r = QLatin1Char('\'') + field.value().toTime().toString(QLatin1String("hh:mm:ss.zzz")) + QLatin1Char('\''); } else diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index 2d306e9fae..8c6ae382f6 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -617,7 +617,7 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const else r = field.value().toString(); break; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QVariant::Date: if (field.value().toDate().isValid()) r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate) diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 1cb6a91d33..5517b8fd73 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -85,7 +85,7 @@ template<> inline char *toString(const QByteArray &ba) return QTest::toPrettyCString(ba.constData(), ba.length()); } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) template<> inline char *toString(const QTime &time) { return time.isValid() @@ -106,7 +106,7 @@ template<> inline char *toString(const QDateTime &dateTime) ? qstrdup(qPrintable(dateTime.toString(QStringViewLiteral("yyyy/MM/dd hh:mm:ss.zzz[t]")))) : qstrdup("Invalid QDateTime"); } -#endif // QT_NO_DATESTRING +#endif // datestring template<> inline char *toString(const QChar &c) { diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 33b8b51216..91c8614c30 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -794,7 +794,7 @@ QString QFileSystemModelPrivate::time(const QModelIndex &index) const { if (!index.isValid()) return QString(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) return node(index)->lastModified().toString(Qt::SystemLocaleDate); #else Q_UNUSED(index); diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index 449850c42e..78fc623fb5 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -1319,7 +1319,7 @@ QString QDirModelPrivate::type(const QModelIndex &index) const QString QDirModelPrivate::time(const QModelIndex &index) const { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) return node(index)->info.lastModified().toString(Qt::LocalDate); #else Q_UNUSED(index); -- cgit v1.2.3 From 02663718a9da95968a7879b792508b8c0ae699b2 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Thu, 20 Sep 2018 22:04:15 +0200 Subject: QHeaderView: Don't unhide hidden sections on layoutChanged() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When storing the persistent indexes within _q_sectionsAboutToBeChanged() there was a limit one how much persistent indexes should be stored due to performance concerns. This resulted in unhiding hidden rows. The rationale behind this was that storing persistent indexes is slow and that hiding a large amount of rows/columns should be done with a QSortFilterProxyModel. Fix it by removing the limit since it does not really hurt performance. Task-number: QTBUG-70633 Change-Id: I2311213c2b63c67e2210aa7f73f07d28dc0e47be Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 9a8206de45..2d30b2650a 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2211,9 +2211,6 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged(const QListindex(0, logical, root) : model->index(logical, 0, root), s}); - - if (layoutChangePersistentSections.size() > 1000) - break; } } -- cgit v1.2.3 From f99e956d65058e22780d99832987edad16f6d077 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 20 Sep 2018 14:26:23 +0200 Subject: Add QT_REQUIRE_CONFIG(ssl) to pre-shared key authenticator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it's done (albeit in old-style there) in other public QSsl-classes. Task-number: QTBUG-70604 Change-Id: If3cd9da0e8f8378fd29a80215cd889e459aa7bce Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- src/network/ssl/qsslpresharedkeyauthenticator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/ssl/qsslpresharedkeyauthenticator.h b/src/network/ssl/qsslpresharedkeyauthenticator.h index a012ff489a..74ab888000 100644 --- a/src/network/ssl/qsslpresharedkeyauthenticator.h +++ b/src/network/ssl/qsslpresharedkeyauthenticator.h @@ -45,6 +45,8 @@ #include #include +QT_REQUIRE_CONFIG(ssl); + QT_BEGIN_NAMESPACE class QSslPreSharedKeyAuthenticatorPrivate; -- cgit v1.2.3 From 5e64957ee4162ecf4456306a530a68761c2b127f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 25 Sep 2018 18:35:31 +0200 Subject: Fix QCompleter popups preventing the application from exiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to an implementation detail regarding setParent() and setWindowFlags(), if a QCompleter popup ends up being the last open window after closing the main window, the application would be prevented from exiting even after selecting an item in the popup. This is due to adjustQuitOnCloseAttribute() not being called when passing a Qt::Popup flag to setParent(parent, windowFlags). Use setWindowFlags() directly, which adjusts the quit on close attribute, and allows an application to exit properly. Change-Id: Ic4cff9504df268556d851e40d5ae08b7ed4dc3bf Fixes: QTBUG-69924 Reviewed-by: Tor Arne Vestbø --- src/widgets/util/qcompleter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 599b983748..22fb0a511d 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1233,7 +1233,14 @@ void QCompleter::setPopup(QAbstractItemView *popup) Qt::FocusPolicy origPolicy = Qt::NoFocus; if (d->widget) origPolicy = d->widget->focusPolicy(); - popup->setParent(0, Qt::Popup); + + // Mark the widget window as a popup, so that if the last non-popup window is closed by the + // user, the application should not be prevented from exiting. It needs to be set explicitly via + // setWindowFlag(), because passing the flag via setParent(parent, windowFlags) does not call + // QWidgetPrivate::adjustQuitOnCloseAttribute(), and causes an application not to exit if the + // popup ends up being the last window. + popup->setParent(nullptr); + popup->setWindowFlag(Qt::Popup); popup->setFocusPolicy(Qt::NoFocus); if (d->widget) d->widget->setFocusPolicy(origPolicy); -- cgit v1.2.3