From 4451c86dfd134f35795383bf632f161629a720e4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Mar 2019 19:30:58 +0000 Subject: Doc-fixes in QRandomGenerator::bounded(int...) They return int, not quint32. Change-Id: I9879b58cccf9ea324ea1fc0c567a9d30b82fa44d Reviewed-by: Thiago Macieira (cherry picked from commit 6ed2ea86db63c72a38a60543da5a95d3543d39b1) --- src/corelib/global/qrandom.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 6195c324e7..90df8653a7 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -930,7 +930,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn quint32 QRandomGenerator::bounded(int highest) + \fn int QRandomGenerator::bounded(int highest) \overload Generates one random 32-bit quantity in the range between 0 (inclusive) and @@ -957,7 +957,6 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \snippet code/src_corelib_global_qrandom.cpp 14 - Note that this function cannot be used to obtain values in the full 32-bit range of quint32. Instead, use generate(). @@ -965,7 +964,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn quint32 QRandomGenerator::bounded(int lowest, int highest) + \fn int QRandomGenerator::bounded(int lowest, int highest) \overload Generates one random 32-bit quantity in the range between \a lowest -- cgit v1.2.3 From 3f17029aa12eafd3f8ddd5e0b246a6bf22eabfe3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 4 Feb 2019 17:10:22 +0100 Subject: Fix resolving NTFS symbolic links that point to UNC shares Without this change, the target of a symbolic link that points to a UNC share would include UNC in the target path, and not be correctly made absolute. Add a relevant test case, and use the opportunity to factor out the helper code that creates NTFS symlinks into a function that takes care of error handling. The file created with the new test case only gets cleaned up correctly when passing the file path into QDir::rmdir, which is either way the right thing to do. [ChangeLog][QtCore][QFileInfo] Fixed resolving of symbolic links to UNC shares on NTFS file systems. Change-Id: I9ba75d627aedf7c4cc289f0cb71088d795d30d8a Fixes: QTBUG-73688 Task-number: QTBUG-63970 Task-number: QTBUG-30401 Task-number: QTBUG-20791 Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine_win.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 2020e34f93..279918b812 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -310,9 +310,18 @@ static QString readSymLink(const QFileSystemEntry &link) const wchar_t* PathBuffer = &rdb->SymbolicLinkReparseBuffer.PathBuffer[offset]; result = QString::fromWCharArray(PathBuffer, length); } - // cut-off "//?/" and "/??/" - if (result.size() > 4 && result.at(0) == QLatin1Char('\\') && result.at(2) == QLatin1Char('?') && result.at(3) == QLatin1Char('\\')) + // cut-off "\\?\" and "\??\" + if (result.size() > 4 + && result.at(0) == QLatin1Char('\\') + && result.at(2) == QLatin1Char('?') + && result.at(3) == QLatin1Char('\\')) { result = result.mid(4); + // cut off UNC in addition when the link points at a UNC share + // in which case we need to prepend another backslash to get \\server\share + if (result.leftRef(3) == QLatin1String("UNC")) { + result.replace(0, 3, QLatin1Char('\\')); + } + } } free(rdb); CloseHandle(handle); -- cgit v1.2.3 From 064a731a110efc5ad7e314bc686f74c759f39437 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 10 Apr 2019 10:38:05 +0200 Subject: Correct the description of the "C" locale It is not identical to en_US, as we have long claimed. Fixes: QTBUG-75069 Change-Id: I236adcefdcb4120d2bf5adbcde727c5e3ca13986 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 11 +++++++++++ src/corelib/tools/qlocale.qdoc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index df768fb875..506b32a257 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2351,6 +2351,17 @@ QString QLocale::toString(double i, char f, int prec) const Returns a QLocale object initialized to the "C" locale. + This locale is based on en_US but with various quirks of its own, such as + simplified number formatting and its own date formatting. It implements the + POSIX standards that describe the behavior of standard library functions of + the "C" programming language. + + Among other things, this means its collation order is based on the ASCII + values of letters, so that (for case-sensitive sorting) all upper-case + letters sort before any lower-case one (rather than each letter's upper- and + lower-case forms sorting adjacent to one another, before the next letter's + two forms). + \sa system() */ diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc index 76ca909d83..4a4aa4ba2b 100644 --- a/src/corelib/tools/qlocale.qdoc +++ b/src/corelib/tools/qlocale.qdoc @@ -104,7 +104,7 @@ This enumerated type is used to specify a language. \value AnyLanguage - \value C The "C" locale is identical in behavior to English/UnitedStates. + \value C A simplified English locale; see QLocale::c() \value Abkhazian \value Oromo \value Afan Obsolete, please use Oromo -- cgit v1.2.3 From 2a815855a9b91a3537ab3d804ad1ee47d741b64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Wed, 3 Apr 2019 18:30:43 +0200 Subject: corelib: invokeMethod: Allow non copyable functors to be used [ChangeLog][QtCore][QMetaObject] Non-copyable lambdas can now be used with invokeMethod(). For consistency reasons, the functor object is now always moved. Fixes: QTBUG-69683 Change-Id: I66ff5e21d6d1926f0f7c5f8c304bed1a90b69917 Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobjectdefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index d7ed2b0282..059bb44e10 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -523,7 +523,7 @@ struct Q_CORE_EXPORT QMetaObject Qt::ConnectionType type = Qt::AutoConnection, decltype(function()) *ret = nullptr) { return invokeMethodImpl(context, - new QtPrivate::QFunctorSlotObjectWithNoArgs(function), + new QtPrivate::QFunctorSlotObjectWithNoArgs(std::move(function)), type, ret); } @@ -535,7 +535,7 @@ struct Q_CORE_EXPORT QMetaObject invokeMethod(QObject *context, Func function, typename std::result_of::type *ret) { return invokeMethodImpl(context, - new QtPrivate::QFunctorSlotObjectWithNoArgs(function), + new QtPrivate::QFunctorSlotObjectWithNoArgs(std::move(function)), Qt::AutoConnection, ret); } -- cgit v1.2.3 From 8ae8c6690b41f6cd40dae14d471ce29b500c66c9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Apr 2019 15:03:23 +0200 Subject: MinGW: Fix developer build In some build configurations, the build with MinGW would fail due to missing declaration of localtime_r(). This is only visible when _POSIX_THREAD_SAFE_FUNCTIONS is defined, which is achieved by including . Amends 6c543879a31d7d13a6b87e6332f6913f2f89f5e6. Task-number: QTBUG-71030 Change-Id: I71296f24a450159d1c548e1ad836a2b42e42009f Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal_p.h | 3 +++ src/corelib/tools/qdatetime.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h index d52f6268e4..58bc8b7bf3 100644 --- a/src/corelib/global/qglobal_p.h +++ b/src/corelib/global/qglobal_p.h @@ -61,6 +61,9 @@ #endif #if defined(__cplusplus) +#ifdef Q_CC_MINGW +# include // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r() +#endif #include QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 80d6dada60..511dbf0db8 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -58,6 +58,9 @@ #endif #include +#ifdef Q_CC_MINGW +# include // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r() +#endif #include #ifdef Q_OS_WIN # include -- cgit v1.2.3 From 20e286107344f2cb188f5292d31dc62bf7708365 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 13 Apr 2019 15:38:15 +0200 Subject: Optimize QAbstractTableModel::hasChildren Valid indexes cannot have children, in a table model, so there's no point in asking the model about it (by calling rowCount and columnCount). Change-Id: Ic2d7b52538a7b67acb2c35b26e69bba5956ef5af Reviewed-by: Giuseppe D'Angelo Reviewed-by: Friedemann Kleint Reviewed-by: Christian Ehrlicher --- src/corelib/itemmodels/qabstractitemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 18f0f6f55f..25a80a640c 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -3618,7 +3618,7 @@ QModelIndex QAbstractTableModel::sibling(int row, int column, const QModelIndex bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const { - if (parent.model() == this || !parent.isValid()) + if (!parent.isValid()) return rowCount(parent) > 0 && columnCount(parent) > 0; return false; } -- cgit v1.2.3 From 9dfc2aa75d930c6676f901e817bbc8c900a966f5 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 11 Apr 2019 12:35:12 +0200 Subject: Purge use of some deprecated methods from QDateTime tests QDateTime's short names setUtcOffset() and utcOffset() have been deprecated since 5.2, in favor of setOffsetFromUtc() and offsetFromUtc(). QDate's shortDayName() and shortMOnthName() have been deprecated since 5.10, in favor of QLocale's dayName() and monthName(). Also, the tests that were using them are testing methods only present when the datestring feature is enabled; so condition them on that feature. Change-Id: Ibfd4b132523ca8fbc1cb163353a44e0500877fd5 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 43271b34ed..8b2a60acaa 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -335,7 +335,7 @@ public: inline bool operator>(const QDateTime &other) const { return other < *this; } inline bool operator>=(const QDateTime &other) const { return !(*this < other); } -#if QT_DEPRECATED_SINCE(5, 2) +#if QT_DEPRECATED_SINCE(5, 2) // ### Qt 6: remove QT_DEPRECATED void setUtcOffset(int seconds); QT_DEPRECATED int utcOffset() const; #endif // QT_DEPRECATED_SINCE -- cgit v1.2.3