Merge remote-tracking branch 'origin/5.14' into 5.15

Change-Id: I8caee4d1ce0eed27d905194df3c3d46c5d07d2b0
This commit is contained in:
Qt Forward Merge Bot 2020-02-12 01:00:49 +01:00
commit 9a5df00a61
9 changed files with 203 additions and 16 deletions

View File

@ -111,7 +111,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
if(current_search_paths)
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${current_search_paths} NO_DEFAULT_PATH)
endif()
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib})
find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
mark_as_advanced(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
if(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
list(APPEND _lib_deps

View File

@ -46,8 +46,8 @@ build_pass:!isEmpty(QT_ARCH): {
EXTENDS = $$section(LIB_FILE, ":", 1, 1)
!isEmpty(EXTENDS): EXTENDS = "extends=\"$$EXTENDS\""
LIB_FILE = $$section(LIB_FILE, ":", 0, 0)
LIB_FILE = $$replace(LIB_FILE,".so", "_$${QT_ARCH}.so")
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,".so", "_$${QT_ARCH}.so")
LIB_FILE = $$replace(LIB_FILE,"\.so", "_$${QT_ARCH}.so")
!isEmpty(EXTENDS): EXTENDS = $$replace(EXTENDS,"\.so", "_$${QT_ARCH}.so")
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" $$EXTENDS />"
}
}
@ -56,14 +56,14 @@ build_pass:!isEmpty(QT_ARCH): {
for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
LIB_FILE = $$section(REPLACEMENT, ":", 1, 1)
REPLACEMENT_FILE = $$replace(REPLACEMENT_FILE,".so", "_$${QT_ARCH}.so")
REPLACEMENT_FILE = $$replace(REPLACEMENT_FILE,"\.so", "_$${QT_ARCH}.so")
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" replaces=\"$$REPLACEMENT_FILE\" />"
}
}
!isEmpty(ANDROID_BUNDLED_FILES) {
for (BUNDLED_FILE, ANDROID_BUNDLED_FILES) {
BUNDLED_FILE = $$replace(BUNDLED_FILE,".so", "_$${QT_ARCH}.so")
BUNDLED_FILE = $$replace(BUNDLED_FILE,"\.so", "_$${QT_ARCH}.so")
FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />"
}
}

View File

@ -34,7 +34,18 @@ defineTest(qtFlattenResources) {
next()
}
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD)
RESOURCES -= $$resource
!android|isEmpty(BUILDS)|build_pass {
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD)
RESOURCES += $$resource_file
} else {
# Android will need a resource file for each architecture make sure it is placed
# correctly for other functions that need the right paths for these files
for (arch, ANDROID_ABIS) {
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD/$$arch)
RESOURCES += $$resource_file
}
}
isEmpty(BUILDS)|build_pass {
# Collection of files, generate qrc file
@ -69,9 +80,6 @@ defineTest(qtFlattenResources) {
!write_file($$resource_file, resource_file_content): \
error()
}
RESOURCES -= $$resource
RESOURCES += $$resource_file
}
export(RCC_DIR)
export(QMAKE_RESOURCES_IMMEDIATE_NR)

View File

@ -917,7 +917,7 @@
Specifies project configuration and compiler options. The values are
recognized internally by qmake and have special meaning.
The following \c CONFIG values control compilation flags:
The following \c CONFIG values control compiler and linker flags:
\table
\header \li Option \li Description
@ -948,6 +948,8 @@
\row \li warn_off \li The compiler should output as few warnings as possible.
\row \li exceptions \li Exception support is enabled. Set by default.
\row \li exceptions_off \li Exception support is disabled.
\row \li ltcg \li Link time code generation is enabled.
This option is off by default.
\row \li rtti \li RTTI support is enabled. By default, the compiler
default is used.
\row \li rtti_off \li RTTI support is disabled. By default, the compiler

View File

@ -60,6 +60,7 @@
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
# include <mntent.h>
# include <sys/statvfs.h>
# include <sys/sysmacros.h>
#elif defined(Q_OS_SOLARIS)
# include <sys/mnttab.h>
# include <sys/statvfs.h>
@ -152,7 +153,7 @@ private:
//(2) parent ID: the ID of the parent mount (or of self for the top of the mount tree).
// int parent_id;
//(3) major:minor: the value of st_dev for files on this filesystem (see stat(2)).
// dev_t rdev;
dev_t rdev;
//(4) root: the pathname of the directory in the filesystem which forms the root of this mount.
char *subvolume;
//(5) mount point: the pathname of the mount point relative to the process's root directory.
@ -503,8 +504,7 @@ inline bool QStorageIterator::next()
int rdevminor = qstrtoll(ptr + 1, const_cast<const char **>(&ptr), 10, &ok);
if (!ptr || !ok)
return false;
Q_UNUSED(rdevmajor);
Q_UNUSED(rdevminor);
mnt.rdev = makedev(rdevmajor, rdevminor);
if (*ptr != ' ')
return false;
@ -566,6 +566,21 @@ inline QByteArray QStorageIterator::fileSystemType() const
inline QByteArray QStorageIterator::device() const
{
// check that the device exists
if (mnt.mnt_fsname[0] == '/' && access(mnt.mnt_fsname, F_OK) != 0) {
// It doesn't, so let's try to resolve the dev_t from /dev/block.
// Note how strlen("4294967295") == digits10 + 1, so we need to add 1
// for each number, plus the ':'.
char buf[sizeof("/dev/block/") + 2 * std::numeric_limits<unsigned>::digits10 + 3];
QByteArray dev(PATH_MAX, Qt::Uninitialized);
char *devdata = dev.data();
snprintf(buf, sizeof(buf), "/dev/block/%u:%u", major(mnt.rdev), minor(mnt.rdev));
if (realpath(buf, devdata)) {
dev.truncate(strlen(devdata));
return dev;
}
}
return QByteArray(mnt.mnt_fsname);
}

View File

@ -100,10 +100,13 @@ bool QAndroidPlatformFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::Win
void QAndroidPlatformFileDialogHelper::exec()
{
m_eventLoop.exec(QEventLoop::DialogExec);
}
void QAndroidPlatformFileDialogHelper::hide()
{
if (m_eventLoop.isRunning())
m_eventLoop.exit();
QtAndroidPrivate::unregisterActivityResultListener(this);
}

View File

@ -41,6 +41,7 @@
#define QANDROIDPLATFORMFILEDIALOGHELPER_H
#include <jni.h>
#include <QEventLoop>
#include <qpa/qplatformdialoghelper.h>
#include <QtCore/private/qjnihelpers_p.h>
@ -72,6 +73,7 @@ public:
bool handleActivityResult(jint requestCode, jint resultCode, jobject data) override;
private:
QEventLoop m_eventLoop;
QUrl m_selectedFile;
};

View File

@ -2287,7 +2287,8 @@ static bool mergeGradleProperties(const QString &path, GradleProperties properti
bool buildAndroidProject(const Options &options)
{
GradleProperties localProperties;
localProperties["sdk.dir"] = options.sdkPath.toLocal8Bit();
localProperties["sdk.dir"] = options.sdkPath.toUtf8();
localProperties["ndk.dir"] = options.ndkPath.toUtf8();
if (!mergeGradleProperties(options.outputDirectory + QLatin1String("local.properties"), localProperties))
return false;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
** Copyright (C) 2019 Mail.ru Group.
** Contact: https://www.qt.io/licensing/
**
@ -80,6 +80,13 @@ MAKE_ALL(const char*, QChar)
#undef MAKE_RELOP
// END FIXME
static Q_DECL_CONSTEXPR int sign(int i) noexcept
{
return i < 0 ? -1 :
i > 0 ? +1 :
/*else*/ 0 ;
}
// Return a plain ASCII row name consisting of maximum 16 chars and the
// size for data
static QByteArray rowName(const QByteArray &data)
@ -162,6 +169,12 @@ private Q_SLOTS:
void compare_QStringView_QStringView() { compare_impl<QStringView, QStringView>(); }
void compare_QStringView_QLatin1String_data() { compare_data(); }
void compare_QStringView_QLatin1String() { compare_impl<QStringView, QLatin1String>(); }
#ifdef NOT_YET_IMPLMENTED
void compare_QStringView_QByteArray_data() { compare_data(); }
void compare_QStringView_QByteArray() { compare_impl<QStringView, QByteArray>(); }
void compare_QStringView_const_char_star_data() { compare_data(); }
void compare_QStringView_const_char_star() { compare_impl<QStringView, const char *>(); }
#endif
void compare_QLatin1String_QChar_data() { compare_data(false); }
void compare_QLatin1String_QChar() { compare_impl<QLatin1String, QChar>(); }
@ -204,6 +217,111 @@ private Q_SLOTS:
//void compare_const_char_star_const_char_star_data() { compare_data(); }
//void compare_const_char_star_const_char_star() { compare_impl<const char *, const char *>(); }
private:
void member_compare_data(bool hasConceptOfNullAndEmpty=true) { compare_data(hasConceptOfNullAndEmpty); }
template <typename LHS, typename RHS>
void member_compare_impl() const;
private Q_SLOTS:
// test all combinations of {QChar, QStringRef, QString, QStringView, QLatin1String, QByteArray, const char*}
#ifdef NOT_YET_IMPLEMENTED // probably never will be - what's the point of QChar::compare(QStringView)?
void member_compare_QChar_QChar_data() { member_compare_data(false); }
void member_compare_QChar_QChar() { member_compare_impl<QChar, QChar>(); }
void member_compare_QChar_QStringRef_data() { member_compare_data(false); }
void member_compare_QChar_QStringRef() { member_compare_impl<QChar, QStringRef>(); }
void member_compare_QChar_QString_data() { member_compare_data(false); }
void member_compare_QChar_QString() { member_compare_impl<QChar, QString>(); }
void member_compare_QChar_QStringView_data() { member_compare_data(false); }
void member_compare_QChar_QStringView() { member_compare_impl<QChar, QStringView>(); }
void member_compare_QChar_QLatin1String_data() { member_compare_data(false); }
void member_compare_QChar_QLatin1String() { member_compare_impl<QChar, QLatin1String>(); }
void member_compare_QChar_QByteArray_data() { member_compare_data(false); }
void member_compare_QChar_QByteArray() { member_compare_impl<QChar, QByteArray>(); }
void member_compare_QChar_const_char_star_data() { member_compare_data(false); }
void member_compare_QChar_const_char_star() { member_compare_impl<QChar, const char *>(); }
#endif
void member_compare_QStringRef_QChar_data() { member_compare_data(false); }
void member_compare_QStringRef_QChar() { member_compare_impl<QStringRef, QChar>(); }
void member_compare_QStringRef_QStringRef_data() { member_compare_data(); }
void member_compare_QStringRef_QStringRef() { member_compare_impl<QStringRef, QStringRef>(); }
void member_compare_QStringRef_QString_data() { member_compare_data(); }
void member_compare_QStringRef_QString() { member_compare_impl<QStringRef, QString>(); }
#ifdef NOT_YET_IMPLEMENTED
void member_compare_QStringRef_QStringView_data() { member_compare_data(); }
void member_compare_QStringRef_QStringView() { member_compare_impl<QStringRef, QStringView>(); }
#endif
void member_compare_QStringRef_QLatin1String_data() { member_compare_data(); }
void member_compare_QStringRef_QLatin1String() { member_compare_impl<QStringRef, QLatin1String>(); }
void member_compare_QStringRef_QByteArray_data() { member_compare_data(); }
void member_compare_QStringRef_QByteArray() { member_compare_impl<QStringRef, QByteArray>(); }
#ifdef NOT_YET_IMPLEMENTED
void member_compare_QStringRef_const_char_star_data() { member_compare_data(); }
void member_compare_QStringRef_const_char_star() { member_compare_impl<QStringRef, const char *>(); }
#endif
void member_compare_QString_QChar_data() { member_compare_data(false); }
void member_compare_QString_QChar() { member_compare_impl<QString, QChar>(); }
void member_compare_QString_QStringRef_data() { member_compare_data(); }
void member_compare_QString_QStringRef() { member_compare_impl<QString, QStringRef>(); }
void member_compare_QString_QString_data() { member_compare_data(); }
void member_compare_QString_QString() { member_compare_impl<QString, QString>(); }
void member_compare_QString_QStringView_data() { member_compare_data(); }
void member_compare_QString_QStringView() { member_compare_impl<QString, QStringView>(); }
void member_compare_QString_QLatin1String_data() { member_compare_data(); }
void member_compare_QString_QLatin1String() { member_compare_impl<QString, QLatin1String>(); }
void member_compare_QString_QByteArray_data() { member_compare_data(); }
void member_compare_QString_QByteArray() { member_compare_impl<QString, QByteArray>(); }
void member_compare_QString_const_char_star_data() { member_compare_data(); }
void member_compare_QString_const_char_star() { member_compare_impl<QString, const char *>(); }
#ifdef NOT_YET_IMPLEMENTED // QChar doesn't implicitly convert to QStringView
void member_compare_QStringView_QChar_data() { member_compare_data(false); }
void member_compare_QStringView_QChar() { member_compare_impl<QStringView, QChar>(); }
#endif
void member_compare_QStringView_QStringRef_data() { member_compare_data(); }
void member_compare_QStringView_QStringRef() { member_compare_impl<QStringView, QStringRef>(); }
void member_compare_QStringView_QString_data() { member_compare_data(); }
void member_compare_QStringView_QString() { member_compare_impl<QStringView, QString>(); }
void member_compare_QStringView_QStringView_data() { member_compare_data(); }
void member_compare_QStringView_QStringView() { member_compare_impl<QStringView, QStringView>(); }
#ifdef NOT_YET_IMPLEMENTED
void member_compare_QStringView_QLatin1String_data() { member_compare_data(); }
void member_compare_QStringView_QLatin1String() { member_compare_impl<QStringView, QLatin1String>(); }
void member_compare_QStringView_QByteArray_data() { member_compare_data(); }
void member_compare_QStringView_QByteArray() { member_compare_impl<QStringView, QByteArray>(); }
void member_compare_QStringView_const_char_star_data() { member_compare_data(); }
void member_compare_QStringView_const_char_star() { member_compare_impl<QStringView, const char *>(); }
void member_compare_QLatin1String_QChar_data() { member_compare_data(false); }
void member_compare_QLatin1String_QChar() { member_compare_impl<QLatin1String, QChar>(); }
void member_compare_QLatin1String_QStringRef_data() { member_compare_data(); }
void member_compare_QLatin1String_QStringRef() { member_compare_impl<QLatin1String, QStringRef>(); }
void member_compare_QLatin1String_QString_data() { member_compare_data(); }
void member_compare_QLatin1String_QString() { member_compare_impl<QLatin1String, QString>(); }
void member_compare_QLatin1String_QStringView_data() { member_compare_data(); }
void member_compare_QLatin1String_QStringView() { member_compare_impl<QLatin1String, QStringView>(); }
void member_compare_QLatin1String_QLatin1String_data() { member_compare_data(); }
void member_compare_QLatin1String_QLatin1String() { member_compare_impl<QLatin1String, QLatin1String>(); }
void member_compare_QLatin1String_QByteArray_data() { member_compare_data(); }
void member_compare_QLatin1String_QByteArray() { member_compare_impl<QLatin1String, QByteArray>(); }
void member_compare_QLatin1String_const_char_star_data() { member_compare_data(); }
void member_compare_QLatin1String_const_char_star() { member_compare_impl<QLatin1String, const char *>(); }
void member_compare_QByteArray_QChar_data() { member_compare_data(false); }
void member_compare_QByteArray_QChar() { member_compare_impl<QByteArray, QChar>(); }
void member_compare_QByteArray_QStringRef_data() { member_compare_data(); }
void member_compare_QByteArray_QStringRef() { member_compare_impl<QByteArray, QStringRef>(); }
void member_compare_QByteArray_QString_data() { member_compare_data(); }
void member_compare_QByteArray_QString() { member_compare_impl<QByteArray, QString>(); }
void member_compare_QByteArray_QLatin1String_data() { member_compare_data(); }
void member_compare_QByteArray_QLatin1String() { member_compare_impl<QByteArray, QLatin1String>(); }
#endif
void member_compare_QByteArray_QByteArray_data() { member_compare_data(); }
void member_compare_QByteArray_QByteArray() { member_compare_impl<QByteArray, QByteArray>(); }
void member_compare_QByteArray_const_char_star_data() { member_compare_data(); }
void member_compare_QByteArray_const_char_star() { member_compare_impl<QByteArray, const char *>(); }
private:
void startsWith_data(bool rhsIsQChar = false);
template <typename Haystack, typename Needle> void startsWith_impl() const;
@ -601,7 +719,7 @@ void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty)
QTest::newRow(qUtf8Printable(QLatin1String("'" lhs "' <> '" rhs "': "))) \
<< QStringRef(&pinned[0]) << QLatin1String(lhs) \
<< QStringRef(&pinned[1]) << QLatin1String(rhs) \
<< qstrcmp(lhs, rhs) << qstricmp(lhs, rhs); \
<< sign(qstrcmp(lhs, rhs)) << sign(qstricmp(lhs, rhs)); \
} while (false)
ROW("", "0");
ROW("0", "");
@ -691,6 +809,44 @@ void tst_QStringApiSymmetry::compare_impl() const
#undef CHECK
}
template <typename LHS, typename RHS>
void tst_QStringApiSymmetry::member_compare_impl() const
{
QFETCH(QStringRef, lhsUnicode);
QFETCH(QLatin1String, lhsLatin1);
QFETCH(QStringRef, rhsUnicode);
QFETCH(QLatin1String, rhsLatin1);
QFETCH(const int, caseSensitiveCompareResult);
QFETCH(const int, caseInsensitiveCompareResult);
const auto lhsU8 = lhsUnicode.toUtf8();
const auto rhsU8 = rhsUnicode.toUtf8();
const auto lhs = make<LHS>(lhsUnicode, lhsLatin1, lhsU8);
const auto rhs = make<RHS>(rhsUnicode, rhsLatin1, rhsU8);
#define QVERIFY_NOEXCEPT(expr) do { \
if (has_nothrow_compare<LHS, RHS>::value) {} else \
QEXPECT_FAIL("", "Qt is missing a nothrow utf8-utf16 comparator", Continue); \
QVERIFY(noexcept(expr)); } while (0)
if (std::is_same<LHS, QByteArray>::value || // needs to simply be marked as noexcept
((std::is_same<LHS, QString>::value || std::is_same<LHS, QStringRef>::value)
&& std::is_same<RHS, QChar>::value)) // implict QChar -> QString conversion kills noexcept
QEXPECT_FAIL("", "known issues, will be fixed before 5.14 release", Continue);
QVERIFY_NOEXCEPT(lhs.compare(rhs, Qt::CaseSensitive));
QCOMPARE(sign(lhs.compare(rhs)), caseSensitiveCompareResult);
QCOMPARE(sign(lhs.compare(rhs, Qt::CaseSensitive)), caseSensitiveCompareResult);
if (is_utf8_encoded<LHS>::value && is_utf8_encoded<RHS>::value &&
caseSensitiveCompareResult != caseInsensitiveCompareResult &&
(!QtPrivate::isAscii(lhsUnicode) || !QtPrivate::isAscii(rhsUnicode)))
{
QEXPECT_FAIL("", "Qt is missing a case-insensitive UTF-8/UTF-8 comparator", Continue);
}
QCOMPARE(sign(lhs.compare(rhs, Qt::CaseInsensitive)), caseInsensitiveCompareResult);
}
static QString empty = QLatin1String("");
static QString null;
// the tests below rely on the fact that these objects' names match their contents: