Merge "Merge remote-tracking branch 'origin/5.13' into 5.14"

This commit is contained in:
Liang Qi 2019-09-30 12:57:57 +02:00
commit 6f9a215cc4
35 changed files with 4488 additions and 3356 deletions

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
#ifndef QT_NO_TRANSLATION #ifndef QT_NO_TRANSLATION
QString translatorFileName = QLatin1String("qt_"); QString translatorFileName = QLatin1String("qtbase_");
translatorFileName += QLocale::system().name(); translatorFileName += QLocale::system().name();
QTranslator *translator = new QTranslator(&app); QTranslator *translator = new QTranslator(&app);
if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
#ifndef QT_NO_TRANSLATION #ifndef QT_NO_TRANSLATION
QString translatorFileName = QLatin1String("qt_"); QString translatorFileName = QLatin1String("qtbase_");
translatorFileName += QLocale::system().name(); translatorFileName += QLocale::system().name();
QTranslator *translator = new QTranslator(&app); QTranslator *translator = new QTranslator(&app);
if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs")); QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
#ifndef QT_NO_TRANSLATION #ifndef QT_NO_TRANSLATION
QString translatorFileName = QLatin1String("qt_"); QString translatorFileName = QLatin1String("qtbase_");
translatorFileName += QLocale::system().name(); translatorFileName += QLocale::system().name();
QTranslator *translator = new QTranslator(&app); QTranslator *translator = new QTranslator(&app);
if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))

View File

@ -128,7 +128,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
#ifndef QT_NO_TRANSLATION #ifndef QT_NO_TRANSLATION
QString translatorFileName = QLatin1String("qt_"); QString translatorFileName = QLatin1String("qtbase_");
translatorFileName += QLocale::system().name(); translatorFileName += QLocale::system().name();
QTranslator *translator = new QTranslator(&app); QTranslator *translator = new QTranslator(&app);
if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))

View File

@ -992,6 +992,22 @@
\row \li embed_translations \li Embed the generated translations from \row \li embed_translations \li Embed the generated translations from
\c lrelease in the executable, under \l{QM_FILES_RESOURCE_PREFIX}. \c lrelease in the executable, under \l{QM_FILES_RESOURCE_PREFIX}.
Requires \c lrelease to be set, too. Not set by default. Requires \c lrelease to be set, too. Not set by default.
\row \li create_libtool \li Create a libtool .la file for the currently
built library.
\row \li create_pc \li Create a pkg-config .pc file for the currently built
library.
\row \li no_batch \li NMake only: Turn off generation of NMake batch rules
or inference rules.
\row \li skip_target_version_ext \li Suppress the automatic version number
appended to the DLL file name on Windows.
\row \li suppress_vcproj_warnings \li Suppress warnings of the VS project
generator.
\row \li windeployqt \li Automatically invoke windeployqt after linking,
and add the output as deployment items.
\row \li dont_recurse \li Suppress qmake recursion for the current
subproject.
\row \li no_include_pwd \li Do not add the current directory to
INCLUDEPATHS.
\endtable \endtable
When you use the \c debug_and_release option (which is the default under When you use the \c debug_and_release option (which is the default under
@ -1039,6 +1055,8 @@
qmake will process all libraries linked to qmake will process all libraries linked to
by the application and find their meta-information (see by the application and find their meta-information (see
\l{LibDepend}{Library Dependencies} for more info). \l{LibDepend}{Library Dependencies} for more info).
\row \li no_install_prl \li This option disables the generation of
installation rules for generated .prl files.
\endtable \endtable
\note The \c create_prl option is required when \e {building} a \note The \c create_prl option is required when \e {building} a

View File

@ -0,0 +1,42 @@
From 3442a3ce9c2bd366eb0bd1c18d37a6ce732a888d Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Wed, 25 Sep 2019 09:17:01 +0200
Subject: [PATCH] Fix CVE-2019-16168 in SQLite
v3.29.0 is the latest and there is no indication as to when the next
release is so we will apply this separately for now and it can be
reverted once it is in a release that we ship with.
This patch is taken from https://www.sqlite.org/src/info/98357d8c1263920b
Change-Id: I82d398b093b67842a4369e3220c01e7eea30763a
---
src/3rdparty/sqlite/sqlite3.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 61bfdeb766..b3e6ae27b6 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -105933,7 +105933,9 @@ static void decodeIntArray(
if( sqlite3_strglob("unordered*", z)==0 ){
pIndex->bUnordered = 1;
}else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
- pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
+ int sz = sqlite3Atoi(z+3);
+ if( sz<2 ) sz = 2;
+ pIndex->szIdxRow = sqlite3LogEst(sz);
}else if( sqlite3_strglob("noskipscan*", z)==0 ){
pIndex->noSkipScan = 1;
}
@@ -143260,6 +143262,7 @@ static int whereLoopAddBtreeIndex(
** it to pNew->rRun, which is currently set to the cost of the index
** seek only. Then, if this is a non-covering index, add the cost of
** visiting the rows in the main table. */
+ assert( pSrc->pTab->szTabRow>0 );
rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);
if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){
--
2.20.1 (Apple Git-117)

View File

@ -6,8 +6,8 @@
"Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.", "Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
"Homepage": "https://www.sqlite.org/", "Homepage": "https://www.sqlite.org/",
"Version": "3.28.0", "Version": "3.29.0",
"DownloadLocation": "https://www.sqlite.org/2019/sqlite-amalgamation-3280000.zip", "DownloadLocation": "https://www.sqlite.org/2019/sqlite-amalgamation-3290000.zip",
"License": "Public Domain", "License": "Public Domain",
"Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed." "Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
} }

File diff suppressed because it is too large Load Diff

View File

@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.28.0" #define SQLITE_VERSION "3.29.0"
#define SQLITE_VERSION_NUMBER 3028000 #define SQLITE_VERSION_NUMBER 3029000
#define SQLITE_SOURCE_ID "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50" #define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -1296,8 +1296,14 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
** to test whether a file is at least readable. The file can be a ** to test whether a file is at least readable. The SQLITE_ACCESS_READ
** directory. ** flag is never actually used and is not implemented in the built-in
** VFSes of SQLite. The file is named by the second argument and can be a
** directory. The xAccess method returns [SQLITE_OK] on success or some
** non-zero error code if there is an I/O error or if the name of
** the file given in the second argument is illegal. If SQLITE_OK
** is returned, then non-zero or zero is written into *pResOut to indicate
** whether or not the file is accessible.
** **
** ^SQLite will always allocate at least mxPathname+1 bytes for the ** ^SQLite will always allocate at least mxPathname+1 bytes for the
** output buffer xFullPathname. The exact size of the output buffer ** output buffer xFullPathname. The exact size of the output buffer
@ -2198,6 +2204,7 @@ struct sqlite3_mem_methods {
** features include but are not limited to the following: ** features include but are not limited to the following:
** <ul> ** <ul>
** <li> The [PRAGMA writable_schema=ON] statement. ** <li> The [PRAGMA writable_schema=ON] statement.
** <li> The [PRAGMA journal_mode=OFF] statement.
** <li> Writes to the [sqlite_dbpage] virtual table. ** <li> Writes to the [sqlite_dbpage] virtual table.
** <li> Direct writes to [shadow tables]. ** <li> Direct writes to [shadow tables].
** </ul> ** </ul>
@ -2213,6 +2220,34 @@ struct sqlite3_mem_methods {
** integer into which is written 0 or 1 to indicate whether the writable_schema ** integer into which is written 0 or 1 to indicate whether the writable_schema
** is enabled or disabled following this call. ** is enabled or disabled following this call.
** </dd> ** </dd>
**
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
** the legacy behavior of the [ALTER TABLE RENAME] command such it
** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
** additional information. This feature can also be turned on and off
** using the [PRAGMA legacy_alter_table] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DML]]
** <dt>SQLITE_DBCONFIG_DQS_DML</td>
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DML statement
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DDL]]
** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DDL statements,
** such as CREATE TABLE and CREATE INDEX. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
** </dl> ** </dl>
*/ */
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@ -2227,7 +2262,10 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */ #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */
/* /*
** CAPI3REF: Enable Or Disable Extended Result Codes ** CAPI3REF: Enable Or Disable Extended Result Codes
@ -7319,7 +7357,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_SORTER_MMAP 24
#define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_IMPOSTER 25
#define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
#define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */ #define SQLITE_TESTCTRL_RESULT_INTREAL 27
#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */
/* /*
** CAPI3REF: SQL Keyword Checking ** CAPI3REF: SQL Keyword Checking

View File

@ -416,7 +416,7 @@ public:
LoadArchiveMemberHint = 0x04 LoadArchiveMemberHint = 0x04
}; };
Q_DECLARE_FLAGS(LoadHints, LoadHint) Q_DECLARE_FLAGS(LoadHints, LoadHint)
Q_FLAG(LoadHints) Q_FLAG(LoadHint)
... ...
} }
//! [39] //! [39]

View File

@ -90,47 +90,6 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
static qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept;
# ifdef Q_PROCESSOR_X86_64
# define _rdrandXX_step _rdrand64_step
# else
# define _rdrandXX_step _rdrand32_step
# endif
static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept
{
unsigned *ptr = reinterpret_cast<unsigned *>(buffer);
unsigned *end = ptr + count;
int retries = 10;
while (ptr + sizeof(qregisteruint)/sizeof(*ptr) <= end) {
if (_rdrandXX_step(reinterpret_cast<qregisteruint *>(ptr)))
ptr += sizeof(qregisteruint)/sizeof(*ptr);
else if (--retries == 0)
goto out;
}
while (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) {
bool ok = _rdrand32_step(ptr);
if (!ok && --retries)
continue;
if (ok)
++ptr;
break;
}
out:
return ptr - reinterpret_cast<unsigned *>(buffer);
}
#else
static qsizetype qt_random_cpu(void *, qsizetype)
{
return 0;
}
#endif
enum { enum {
// may be "overridden" by a member enum // may be "overridden" by a member enum
FillBufferNoexcept = true FillBufferNoexcept = true
@ -371,8 +330,8 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
} }
qsizetype filled = 0; qsizetype filled = 0;
if (qt_has_hwrng() && (uint(qt_randomdevice_control.loadAcquire()) & SkipHWRNG) == 0) if (qHasHwrng() && (uint(qt_randomdevice_control.loadAcquire()) & SkipHWRNG) == 0)
filled += qt_random_cpu(buffer, count); filled += qRandomCpu(buffer, count);
if (filled != count && (uint(qt_randomdevice_control.loadAcquire()) & SkipSystemRNG) == 0) { if (filled != count && (uint(qt_randomdevice_control.loadAcquire()) & SkipSystemRNG) == 0) {
qsizetype bytesFilled = qsizetype bytesFilled =

View File

@ -81,14 +81,6 @@ static const struct {
} qt_randomdevice_control; } qt_randomdevice_control;
#endif #endif
inline bool qt_has_hwrng()
{
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
return qCpuHasFeature(RDRND);
#else
return false;
#endif
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -249,16 +249,18 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
isSymLink(). The symLinkTarget() function provides the name of the file isSymLink(). The symLinkTarget() function provides the name of the file
the symlink points to. the symlink points to.
On Unix (including \macos and iOS), the symlink has the same size() has On Unix (including \macos and iOS), the property getter functions in this
the file it points to, because Unix handles symlinks class return the properties such as times and size of the target file, not
transparently; similarly, opening a symlink using QFile the symlink, because Unix handles symlinks transparently. Opening a symlink
effectively opens the link's target. For example: using QFile effectively opens the link's target. For example:
\snippet code/src_corelib_io_qfileinfo.cpp 0 \snippet code/src_corelib_io_qfileinfo.cpp 0
On Windows, shortcuts are \c .lnk files. The reported size() is that of On Windows, shortcuts (\c .lnk files) are currently treated as symlinks. As
the shortcut (not the link's target), and opening a shortcut using QFile on Unix systems, the property getters return the size of the targeted file,
opens the \c .lnk file. For example: not the \c .lnk file itself. This behavior is deprecated and will likely be
removed in a future version of Qt, after which \c .lnk files will be treated
as regular files.
\snippet code/src_corelib_io_qfileinfo.cpp 1 \snippet code/src_corelib_io_qfileinfo.cpp 1
@ -903,6 +905,9 @@ QDir QFileInfo::absoluteDir() const
/*! /*!
Returns \c true if the user can read the file; otherwise returns \c false. Returns \c true if the user can read the file; otherwise returns \c false.
If the file is a symlink, this function returns true if the target is
readable (not the symlink).
\note If the \l{NTFS permissions} check has not been enabled, the result \note If the \l{NTFS permissions} check has not been enabled, the result
on Windows will merely reflect whether the file exists. on Windows will merely reflect whether the file exists.
@ -920,6 +925,9 @@ bool QFileInfo::isReadable() const
/*! /*!
Returns \c true if the user can write to the file; otherwise returns \c false. Returns \c true if the user can write to the file; otherwise returns \c false.
If the file is a symlink, this function returns true if the target is
writeable (not the symlink).
\note If the \l{NTFS permissions} check has not been enabled, the result on \note If the \l{NTFS permissions} check has not been enabled, the result on
Windows will merely reflect whether the file is marked as Read Only. Windows will merely reflect whether the file is marked as Read Only.
@ -937,6 +945,9 @@ bool QFileInfo::isWritable() const
/*! /*!
Returns \c true if the file is executable; otherwise returns \c false. Returns \c true if the file is executable; otherwise returns \c false.
If the file is a symlink, this function returns true if the target is
executable (not the symlink).
\sa isReadable(), isWritable(), permission() \sa isReadable(), isWritable(), permission()
*/ */
bool QFileInfo::isExecutable() const bool QFileInfo::isExecutable() const
@ -951,8 +962,13 @@ bool QFileInfo::isExecutable() const
/*! /*!
Returns \c true if this is a `hidden' file; otherwise returns \c false. Returns \c true if this is a `hidden' file; otherwise returns \c false.
\b{Note:} This function returns \c true for the special entries \b{Note:} This function returns \c true for the special entries "." and
"." and ".." on Unix, even though QDir::entryList threats them as shown. ".." on Unix, even though QDir::entryList threats them as shown. And note
that, since this function inspects the file name, on Unix it will inspect
the name of the symlink, if this file is a symlink, not the target's name.
On Windows, this function returns \c true if the target file is hidden (not
the symlink).
*/ */
bool QFileInfo::isHidden() const bool QFileInfo::isHidden() const
{ {
@ -991,6 +1007,9 @@ bool QFileInfo::isNativePath() const
link to a file. Returns \c false if the link to a file. Returns \c false if the
object points to something which isn't a file, such as a directory. object points to something which isn't a file, such as a directory.
If the file is a symlink, this function returns true if the target is a
regular file (not the symlink).
\sa isDir(), isSymLink(), isBundle() \sa isDir(), isSymLink(), isBundle()
*/ */
bool QFileInfo::isFile() const bool QFileInfo::isFile() const
@ -1006,6 +1025,9 @@ bool QFileInfo::isFile() const
Returns \c true if this object points to a directory or to a symbolic Returns \c true if this object points to a directory or to a symbolic
link to a directory; otherwise returns \c false. link to a directory; otherwise returns \c false.
If the file is a symlink, this function returns true if the target is a
directory (not the symlink).
\sa isFile(), isSymLink(), isBundle() \sa isFile(), isSymLink(), isBundle()
*/ */
bool QFileInfo::isDir() const bool QFileInfo::isDir() const
@ -1023,6 +1045,9 @@ bool QFileInfo::isDir() const
Returns \c true if this object points to a bundle or to a symbolic Returns \c true if this object points to a bundle or to a symbolic
link to a bundle on \macos and iOS; otherwise returns \c false. link to a bundle on \macos and iOS; otherwise returns \c false.
If the file is a symlink, this function returns true if the target is a
bundle (not the symlink).
\sa isDir(), isSymLink(), isFile() \sa isDir(), isSymLink(), isFile()
*/ */
bool QFileInfo::isBundle() const bool QFileInfo::isBundle() const
@ -1044,7 +1069,8 @@ bool QFileInfo::isBundle() const
the \l{symLinkTarget()}{link's target}. the \l{symLinkTarget()}{link's target}.
In addition, true will be returned for shortcuts (\c *.lnk files) on In addition, true will be returned for shortcuts (\c *.lnk files) on
Windows. Opening those will open the \c .lnk file itself. Windows. This behavior is deprecated and will likely change in a future
version of Qt. Opening those will open the \c .lnk file itself.
Example: Example:
@ -1190,6 +1216,9 @@ QString QFileInfo::symLinkTarget() const
milliseconds). On Windows, it will return an empty string unless milliseconds). On Windows, it will return an empty string unless
the \l{NTFS permissions} check has been enabled. the \l{NTFS permissions} check has been enabled.
If the file is a symlink, this function returns the owner of the target
(not the symlink).
\sa ownerId(), group(), groupId() \sa ownerId(), group(), groupId()
*/ */
QString QFileInfo::owner() const QString QFileInfo::owner() const
@ -1206,6 +1235,9 @@ QString QFileInfo::owner() const
On Windows and on systems where files do not have owners this On Windows and on systems where files do not have owners this
function returns ((uint) -2). function returns ((uint) -2).
If the file is a symlink, this function returns the id of the owner of the target
(not the symlink).
\sa owner(), group(), groupId() \sa owner(), group(), groupId()
*/ */
uint QFileInfo::ownerId() const uint QFileInfo::ownerId() const
@ -1225,6 +1257,9 @@ uint QFileInfo::ownerId() const
This function can be time consuming under Unix (in the order of This function can be time consuming under Unix (in the order of
milliseconds). milliseconds).
If the file is a symlink, this function returns the owning group of the
target (not the symlink).
\sa groupId(), owner(), ownerId() \sa groupId(), owner(), ownerId()
*/ */
QString QFileInfo::group() const QString QFileInfo::group() const
@ -1241,6 +1276,9 @@ QString QFileInfo::group() const
On Windows and on systems where files do not have groups this On Windows and on systems where files do not have groups this
function always returns (uint) -2. function always returns (uint) -2.
If the file is a symlink, this function returns the id of the group owning the
target (not the symlink).
\sa group(), owner(), ownerId() \sa group(), owner(), ownerId()
*/ */
uint QFileInfo::groupId() const uint QFileInfo::groupId() const
@ -1266,6 +1304,9 @@ uint QFileInfo::groupId() const
Example: Example:
\snippet code/src_corelib_io_qfileinfo.cpp 10 \snippet code/src_corelib_io_qfileinfo.cpp 10
If the file is a symlink, this function checks the permissions of the
target (not the symlink).
\sa isReadable(), isWritable(), isExecutable() \sa isReadable(), isWritable(), isExecutable()
*/ */
bool QFileInfo::permission(QFile::Permissions permissions) const bool QFileInfo::permission(QFile::Permissions permissions) const
@ -1288,6 +1329,9 @@ bool QFileInfo::permission(QFile::Permissions permissions) const
\note The result might be inaccurate on Windows if the \note The result might be inaccurate on Windows if the
\l{NTFS permissions} check has not been enabled. \l{NTFS permissions} check has not been enabled.
If the file is a symlink, this function returns the permissions of the
target (not the symlink).
*/ */
QFile::Permissions QFileInfo::permissions() const QFile::Permissions QFileInfo::permissions() const
{ {
@ -1305,6 +1349,9 @@ QFile::Permissions QFileInfo::permissions() const
Returns the file size in bytes. If the file does not exist or cannot be Returns the file size in bytes. If the file does not exist or cannot be
fetched, 0 is returned. fetched, 0 is returned.
If the file is a symlink, the size of the target file is returned
(not the symlink).
\sa exists() \sa exists()
*/ */
qint64 QFileInfo::size() const qint64 QFileInfo::size() const
@ -1334,6 +1381,9 @@ qint64 QFileInfo::size() const
the time the file was created, metadataChangeTime() to get the time its the time the file was created, metadataChangeTime() to get the time its
metadata was last changed, or lastModified() to get the time it was last modified. metadata was last changed, or lastModified() to get the time it was last modified.
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa birthTime(), metadataChangeTime(), lastModified(), lastRead() \sa birthTime(), metadataChangeTime(), lastModified(), lastRead()
*/ */
QDateTime QFileInfo::created() const QDateTime QFileInfo::created() const
@ -1352,6 +1402,9 @@ QDateTime QFileInfo::created() const
If the file birth time is not available, this function returns an invalid If the file birth time is not available, this function returns an invalid
QDateTime. QDateTime.
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa lastModified(), lastRead(), metadataChangeTime() \sa lastModified(), lastRead(), metadataChangeTime()
*/ */
QDateTime QFileInfo::birthTime() const QDateTime QFileInfo::birthTime() const
@ -1366,6 +1419,9 @@ QDateTime QFileInfo::birthTime() const
user writes or sets inode information (for example, changing the file user writes or sets inode information (for example, changing the file
permissions). permissions).
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa lastModified(), lastRead() \sa lastModified(), lastRead()
*/ */
QDateTime QFileInfo::metadataChangeTime() const QDateTime QFileInfo::metadataChangeTime() const
@ -1376,6 +1432,9 @@ QDateTime QFileInfo::metadataChangeTime() const
/*! /*!
Returns the date and local time when the file was last modified. Returns the date and local time when the file was last modified.
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa birthTime(), lastRead(), metadataChangeTime(), fileTime() \sa birthTime(), lastRead(), metadataChangeTime(), fileTime()
*/ */
QDateTime QFileInfo::lastModified() const QDateTime QFileInfo::lastModified() const
@ -1389,6 +1448,9 @@ QDateTime QFileInfo::lastModified() const
On platforms where this information is not available, returns the On platforms where this information is not available, returns the
same as lastModified(). same as lastModified().
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa birthTime(), lastModified(), metadataChangeTime(), fileTime() \sa birthTime(), lastModified(), metadataChangeTime(), fileTime()
*/ */
QDateTime QFileInfo::lastRead() const QDateTime QFileInfo::lastRead() const
@ -1402,6 +1464,9 @@ QDateTime QFileInfo::lastRead() const
Returns the file time specified by \a time. If the time cannot be Returns the file time specified by \a time. If the time cannot be
determined, an invalid date time is returned. determined, an invalid date time is returned.
If the file is a symlink, the time of the target file is returned
(not the symlink).
\sa QFile::FileTime, QDateTime::isValid() \sa QFile::FileTime, QDateTime::isValid()
*/ */
QDateTime QFileInfo::fileTime(QFile::FileTime time) const QDateTime QFileInfo::fileTime(QFile::FileTime time) const

View File

@ -69,7 +69,9 @@ static bool checkNameDecodable(const char *d_name, qsizetype len)
# ifdef QT_LOCALE_IS_UTF8 # ifdef QT_LOCALE_IS_UTF8
int mibEnum = 106; int mibEnum = 106;
# else # else
int mibEnum = codec->mibEnum(); int mibEnum = 4; // Latin 1
if (codec)
mibEnum = codec->mibEnum();
# endif # endif
if (Q_LIKELY(mibEnum == 106)) // UTF-8 if (Q_LIKELY(mibEnum == 106)) // UTF-8
return QUtf8::isValidUtf8(d_name, len).isValidUtf8; return QUtf8::isValidUtf8(d_name, len).isValidUtf8;

View File

@ -376,6 +376,38 @@ static quint64 detectProcessorFeatures()
features &= ~AllAVX512; features &= ~AllAVX512;
} }
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
/**
* Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a
* failing random generation instruction, which always returns
* 0xffffffff, even when generation was "successful".
*
* This code checks if hardware random generator generates four consecutive
* equal numbers. If it does, then we probably have a failing one and
* should disable it completely.
*
* https://bugreports.qt.io/browse/QTBUG-69423
*/
if (features & CpuFeatureRDRND) {
const qsizetype testBufferSize = 4;
unsigned testBuffer[4] = {};
const qsizetype generated = qRandomCpu(testBuffer, testBufferSize);
if (Q_UNLIKELY(generated == testBufferSize &&
testBuffer[0] == testBuffer[1] &&
testBuffer[1] == testBuffer[2] &&
testBuffer[2] == testBuffer[3])) {
fprintf(stderr, "WARNING: CPU random generator seem to be failing, disable hardware random number generation\n");
fprintf(stderr, "WARNING: RDRND generated: 0x%x 0x%x 0x%x 0x%x\n",
testBuffer[0], testBuffer[1], testBuffer[2], testBuffer[3]);
features &= ~CpuFeatureRDRND;
}
}
#endif
return features; return features;
} }
@ -590,4 +622,40 @@ void qDumpCPUFeatures()
puts(""); puts("");
} }
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
# ifdef Q_PROCESSOR_X86_64
# define _rdrandXX_step _rdrand64_step
# else
# define _rdrandXX_step _rdrand32_step
# endif
QT_FUNCTION_TARGET(RDRND) qsizetype qRandomCpu(void *buffer, qsizetype count) noexcept
{
unsigned *ptr = reinterpret_cast<unsigned *>(buffer);
unsigned *end = ptr + count;
int retries = 10;
while (ptr + sizeof(qregisteruint)/sizeof(*ptr) <= end) {
if (_rdrandXX_step(reinterpret_cast<qregisteruint *>(ptr)))
ptr += sizeof(qregisteruint)/sizeof(*ptr);
else if (--retries == 0)
goto out;
}
while (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) {
bool ok = _rdrand32_step(ptr);
if (!ok && --retries)
continue;
if (ok)
++ptr;
break;
}
out:
return ptr - reinterpret_cast<unsigned *>(buffer);
}
#endif
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -346,6 +346,15 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2];
#endif #endif
Q_CORE_EXPORT quint64 qDetectCpuFeatures(); Q_CORE_EXPORT quint64 qDetectCpuFeatures();
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
Q_CORE_EXPORT qsizetype qRandomCpu(void *, qsizetype) noexcept;
#else
static inline qsizetype qRandomCpu(void *, qsizetype) noexcept
{
return 0;
}
#endif
static inline quint64 qCpuFeatures() static inline quint64 qCpuFeatures()
{ {
quint64 features = qt_cpu_features[0].loadRelaxed(); quint64 features = qt_cpu_features[0].loadRelaxed();
@ -362,6 +371,15 @@ static inline quint64 qCpuFeatures()
#define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \ #define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \
|| ((qCpuFeatures() & CpuFeature ## feature) == CpuFeature ## feature)) || ((qCpuFeatures() & CpuFeature ## feature) == CpuFeature ## feature))
inline bool qHasHwrng()
{
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
return qCpuHasFeature(RDRND);
#else
return false;
#endif
}
#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i)

View File

@ -104,7 +104,7 @@ public:
QVarLengthArray<T, Prealloc> &operator=(std::initializer_list<T> list) QVarLengthArray<T, Prealloc> &operator=(std::initializer_list<T> list)
{ {
resize(list.size()); resize(int(list.size())); // ### q6sizetype
std::copy(list.begin(), list.end(), std::copy(list.begin(), list.end(),
QT_MAKE_CHECKED_ARRAY_ITERATOR(this->begin(), this->size())); QT_MAKE_CHECKED_ARRAY_ITERATOR(this->begin(), this->size()));
return *this; return *this;

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtGui module of the Qt Toolkit. ** This file is part of the QtGui module of the Qt Toolkit.
@ -2096,10 +2096,11 @@ uint qHash(const QFont &font, uint seed) noexcept
*/ */
bool QFont::fromString(const QString &descrip) bool QFont::fromString(const QString &descrip)
{ {
const auto l = descrip.splitRef(QLatin1Char(',')); const QStringRef sr = QStringRef(&descrip).trimmed();
const auto l = sr.split(QLatin1Char(','));
int count = l.count(); const int count = l.count();
if (!count || (count > 2 && count < 9) || count > 11) { if (!count || (count > 2 && count < 9) || count > 11 ||
l.first().isEmpty()) {
qWarning("QFont::fromString: Invalid description '%s'", qWarning("QFont::fromString: Invalid description '%s'",
descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data());
return false; return false;

View File

@ -467,6 +467,14 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
if (fallbackList.isEmpty()) if (fallbackList.isEmpty())
return fallbackList; return fallbackList;
// .Apple Symbols Fallback will be at the beginning of the list and we will
// detect that this has glyphs for Arabic and other writing systems.
// Since it is a symbol font, it should be the last resort, so that
// the proper fonts for these writing systems are preferred.
int symbolIndex = fallbackList.indexOf(QLatin1String(".Apple Symbols Fallback"));
if (symbolIndex >= 0)
fallbackList.move(symbolIndex, fallbackList.size() - 1);
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
// Since we are only returning a list of default fonts for the current language, we do not // Since we are only returning a list of default fonts for the current language, we do not
// cover all Unicode completely. This was especially an issue for some of the common script // cover all Unicode completely. This was especially an issue for some of the common script
@ -481,6 +489,15 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
fallbackList.append(QStringLiteral("Apple Symbols")); fallbackList.append(QStringLiteral("Apple Symbols"));
#endif #endif
// Since iOS 13, the cascade list may contain meta-fonts which have not been
// populated to the database, such as ".AppleJapaneseFont". It is important that we
// include this in the fallback list, in order to get fallback support for all
// languages
for (const QString &fallback : fallbackList) {
if (!QPlatformFontDatabase::isFamilyPopulated(fallback))
const_cast<QCoreTextFontDatabase *>(this)->populateFamily(fallback);
}
extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &); extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &);
fallbackList = qt_sort_families_by_writing_system(script, fallbackList); fallbackList = qt_sort_families_by_writing_system(script, fallbackList);

View File

@ -465,7 +465,8 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
return QStringList(QLatin1String("android")); return QStringList(QLatin1String("android"));
} }
return QStringList(QLatin1String("fusion")); return QStringList(QLatin1String("fusion"));
case DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::AndroidLayout);
case MouseDoubleClickDistance: case MouseDoubleClickDistance:
{ {
int minimumDistance = qEnvironmentVariableIntValue("QT_ANDROID_MINIMUM_MOUSE_DOUBLE_CLICK_DISTANCE"); int minimumDistance = qEnvironmentVariableIntValue("QT_ANDROID_MINIMUM_MOUSE_DOUBLE_CLICK_DISTANCE");
@ -489,8 +490,6 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
Q_FALLTHROUGH(); Q_FALLTHROUGH();
} }
case DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::AndroidLayout);
default: default:
return QPlatformTheme::themeHint(hint); return QPlatformTheme::themeHint(hint);
} }

View File

@ -885,13 +885,6 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
result.profile = QSurfaceFormat::CoreProfile; result.profile = QSurfaceFormat::CoreProfile;
else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
result.profile = QSurfaceFormat::CompatibilityProfile; result.profile = QSurfaceFormat::CompatibilityProfile;
if (result.version < 0x0400)
return result;
// v4.0 onwards
value = 0;
QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value);
if (value == LOSE_CONTEXT_ON_RESET_ARB)
result.options |= QSurfaceFormat::ResetNotification;
return result; return result;
} }
@ -969,6 +962,7 @@ QOpenGLTemporaryContext::~QOpenGLTemporaryContext()
*/ */
#define SAMPLE_BUFFER_EXTENSION "GL_ARB_multisample" #define SAMPLE_BUFFER_EXTENSION "GL_ARB_multisample"
#define ROBUSTNESS_EXTENSION "GL_ARB_robustness"
QOpenGLStaticContext::QOpenGLStaticContext() : QOpenGLStaticContext::QOpenGLStaticContext() :
vendor(QOpenGLStaticContext::getGlString(GL_VENDOR)), vendor(QOpenGLStaticContext::getGlString(GL_VENDOR)),
@ -989,9 +983,31 @@ QOpenGLStaticContext::QOpenGLStaticContext() :
wglGetExtensionsStringARB(reinterpret_cast<WglGetExtensionsStringARB>( wglGetExtensionsStringARB(reinterpret_cast<WglGetExtensionsStringARB>(
reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("wglGetExtensionsStringARB")))) reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("wglGetExtensionsStringARB"))))
{ {
if (defaultFormat.version < 0x0300) {
if (extensionNames.startsWith(SAMPLE_BUFFER_EXTENSION " ") if (extensionNames.startsWith(SAMPLE_BUFFER_EXTENSION " ")
|| extensionNames.indexOf(" " SAMPLE_BUFFER_EXTENSION " ") != -1) || extensionNames.indexOf(" " SAMPLE_BUFFER_EXTENSION " ") != -1)
extensions |= SampleBuffers; extensions |= SampleBuffers;
if (extensionNames.startsWith(ROBUSTNESS_EXTENSION " ")
|| extensionNames.indexOf(" " ROBUSTNESS_EXTENSION " ") != -1)
extensions |= Robustness;
} else {
typedef const GLubyte * (APIENTRY *glGetStringi_t)(GLenum, GLuint);
auto glGetStringi = reinterpret_cast<glGetStringi_t>(
reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("glGetStringi")));
if (glGetStringi) {
GLint n = 0;
QOpenGLStaticContext::opengl32.glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (GLint i = 0; i < n; ++i) {
const char *p = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
if (p) {
if (!strcmp(p, SAMPLE_BUFFER_EXTENSION))
extensions |= SampleBuffers;
else if (!strcmp(p, ROBUSTNESS_EXTENSION))
extensions |= Robustness;
}
}
}
}
} }
QByteArray QOpenGLStaticContext::getGlString(unsigned int which) QByteArray QOpenGLStaticContext::getGlString(unsigned int which)
@ -1230,27 +1246,11 @@ bool QWindowsGLContext::updateObtainedParams(HDC hdc, int *obtainedSwapInterval)
if (m_staticContext->wglGetSwapInternalExt && obtainedSwapInterval) if (m_staticContext->wglGetSwapInternalExt && obtainedSwapInterval)
*obtainedSwapInterval = m_staticContext->wglGetSwapInternalExt(); *obtainedSwapInterval = m_staticContext->wglGetSwapInternalExt();
bool hasRobustness = false; if (testFlag(m_staticContext->extensions, QOpenGLStaticContext::Robustness)) {
if (m_obtainedFormat.majorVersion() < 3) { GLint value = 0;
const char *exts = reinterpret_cast<const char *>(QOpenGLStaticContext::opengl32.glGetString(GL_EXTENSIONS)); QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value);
hasRobustness = exts && strstr(exts, "GL_ARB_robustness"); if (value == LOSE_CONTEXT_ON_RESET_ARB)
} else { m_obtainedFormat.setOption(QSurfaceFormat::ResetNotification);
typedef const GLubyte * (APIENTRY *glGetStringi_t)(GLenum, GLuint);
auto glGetStringi = reinterpret_cast<glGetStringi_t>(
reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("glGetStringi")));
if (glGetStringi) {
GLint n = 0;
QOpenGLStaticContext::opengl32.glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (GLint i = 0; i < n; ++i) {
const char *p = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
if (p && !strcmp(p, "GL_ARB_robustness")) {
hasRobustness = true;
break;
}
}
}
}
if (hasRobustness) {
m_getGraphicsResetStatus = reinterpret_cast<GlGetGraphicsResetStatusArbType>( m_getGraphicsResetStatus = reinterpret_cast<GlGetGraphicsResetStatusArbType>(
reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("glGetGraphicsResetStatusARB"))); reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("glGetGraphicsResetStatusARB")));
} }

View File

@ -140,7 +140,8 @@ public:
enum Extensions enum Extensions
{ {
SampleBuffers = 0x1, SampleBuffers = 0x1,
sRGBCapableFramebuffer = 0x2 sRGBCapableFramebuffer = 0x2,
Robustness = 0x4,
}; };
typedef bool typedef bool

View File

@ -2697,12 +2697,18 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
return true; return true;
} }
if (localPos.y() < 0) { if (localPos.y() < 0) {
const int topResizeBarPos = -frameMargins().top(); // We want to return HTCAPTION/true only over the outer sizing frame, not the entire title bar,
if (localPos.y() >= topResizeBarPos) // otherwise the title bar buttons (close, etc.) become unresponsive on Windows 7 (QTBUG-78262).
// However, neither frameMargins() nor GetSystemMetrics(SM_CYSIZEFRAME), etc., give the correct
// sizing frame height in all Windows versions/scales. This empirical constant seems to work, though.
const int sizingHeight = 9;
const int topResizeBarPos = sizingHeight - frameMargins().top();
if (localPos.y() < topResizeBarPos) {
*result = HTCAPTION; // Extend caption over top resize bar, let's user move the window. *result = HTCAPTION; // Extend caption over top resize bar, let's user move the window.
return true; return true;
} }
} }
}
if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) { if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) {
*result = HTBORDER; // Unspecified border, no resize cursor. *result = HTBORDER; // Unspecified border, no resize cursor.
return true; return true;

View File

@ -79,7 +79,7 @@ QSqlDatabase db = QSqlDatabase::addDatabase("MYDRIVER");
//! [3] //! [3]
... ...
db = QSqlDatabase::addDatabase("QODBC"); db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=myaccessfile.mdb"); db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=myaccessfile.mdb");
if (db.open()) { if (db.open()) {
// success! // success!
} }

View File

@ -2774,8 +2774,11 @@ template <> Q_TESTLIB_EXPORT char *QTest::toString<char>(const char &t)
*/ */
char *QTest::toString(const char *str) char *QTest::toString(const char *str)
{ {
if (!str) if (!str) {
return nullptr; char *msg = new char[1];
*msg = '\0';
return msg;
}
char *msg = new char[strlen(str) + 1]; char *msg = new char[strlen(str) + 1];
return qstrcpy(msg, str); return qstrcpy(msg, str);
} }

View File

@ -55,10 +55,14 @@
#if QT_CONFIG(lineedit) #if QT_CONFIG(lineedit)
#include "qlineedit.h" #include "qlineedit.h"
#endif #endif
#include <qpointer.h>
#include "qpainter.h" #include "qpainter.h"
#include "qwindow.h" #include "qwindow.h"
#include "qpushbutton.h" #include "qpushbutton.h"
#include "qset.h" #include "qset.h"
#if QT_CONFIG(shortcut)
# include "qshortcut.h"
#endif
#include "qstyle.h" #include "qstyle.h"
#include "qvarlengtharray.h" #include "qvarlengtharray.h"
#if defined(Q_OS_MACX) #if defined(Q_OS_MACX)
@ -232,31 +236,24 @@ void QWizardField::findProperty(const QWizardDefaultProperty *properties, int pr
class QWizardLayoutInfo class QWizardLayoutInfo
{ {
public: public:
inline QWizardLayoutInfo() int topLevelMarginLeft = -1;
: topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1), int topLevelMarginRight = -1;
topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1), int topLevelMarginTop = -1;
childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1), int topLevelMarginBottom = -1;
wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false), int childMarginLeft = -1;
subTitle(false), extension(false), sideWidget(false) {} int childMarginRight = -1;
int childMarginTop = -1;
int topLevelMarginLeft; int childMarginBottom = -1;
int topLevelMarginRight; int hspacing = -1;
int topLevelMarginTop; int vspacing = -1;
int topLevelMarginBottom; int buttonSpacing = -1;
int childMarginLeft; QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
int childMarginRight; bool header = false;
int childMarginTop; bool watermark = false;
int childMarginBottom; bool title = false;
int hspacing; bool subTitle = false;
int vspacing; bool extension = false;
int buttonSpacing; bool sideWidget = false;
QWizard::WizardStyle wizStyle;
bool header;
bool watermark;
bool title;
bool subTitle;
bool extension;
bool sideWidget;
bool operator==(const QWizardLayoutInfo &other); bool operator==(const QWizardLayoutInfo &other);
inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); } inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); }
@ -486,21 +483,18 @@ class QWizardPagePrivate : public QWidgetPrivate
public: public:
enum TriState { Tri_Unknown = -1, Tri_False, Tri_True }; enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };
inline QWizardPagePrivate()
: wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
bool cachedIsComplete() const; bool cachedIsComplete() const;
void _q_maybeEmitCompleteChanged(); void _q_maybeEmitCompleteChanged();
void _q_updateCachedCompleteState(); void _q_updateCachedCompleteState();
QWizard *wizard; QWizard *wizard = nullptr;
QString title; QString title;
QString subTitle; QString subTitle;
QPixmap pixmaps[QWizard::NPixmaps]; QPixmap pixmaps[QWizard::NPixmaps];
QVector<QWizardField> pendingFields; QVector<QWizardField> pendingFields;
mutable TriState completeState; mutable TriState completeState = Tri_Unknown;
bool explicitlyFinal; bool explicitlyFinal = false;
bool commit; bool commit = false;
bool initialized = false; bool initialized = false;
QMap<int, QString> buttonCustomTexts; QMap<int, QString> buttonCustomTexts;
}; };
@ -556,42 +550,6 @@ public:
Forward Forward
}; };
inline QWizardPrivate()
: start(-1)
, startSetByUser(false)
, current(-1)
, canContinue(false)
, canFinish(false)
, disableUpdatesCount(0)
, wizStyle(QWizard::ClassicStyle)
, opts(0)
, buttonsHaveCustomLayout(false)
, titleFmt(Qt::AutoText)
, subTitleFmt(Qt::AutoText)
, placeholderWidget1(0)
, placeholderWidget2(0)
, headerWidget(0)
, watermarkLabel(0)
, sideWidget(0)
, pageFrame(0)
, titleLabel(0)
, subTitleLabel(0)
, bottomRuler(0)
#if QT_CONFIG(style_windowsvista)
, vistaHelper(0)
, vistaInitPending(true)
, vistaState(QVistaHelper::Dirty)
, vistaStateChanged(false)
, inHandleAeroStyleChange(false)
#endif
, minimumWidth(0)
, minimumHeight(0)
, maximumWidth(QWIDGETSIZE_MAX)
, maximumHeight(QWIDGETSIZE_MAX)
{
std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));
}
void init(); void init();
void reset(); void reset();
void cleanupPagesNotInHistory(); void cleanupPagesNotInHistory();
@ -631,21 +589,21 @@ public:
QMap<QString, int> fieldIndexMap; QMap<QString, int> fieldIndexMap;
QVector<QWizardDefaultProperty> defaultPropertyTable; QVector<QWizardDefaultProperty> defaultPropertyTable;
QList<int> history; QList<int> history;
int start; int start = -1;
bool startSetByUser; bool startSetByUser = false;
int current; int current = -1;
bool canContinue; bool canContinue = false;
bool canFinish; bool canFinish = false;
QWizardLayoutInfo layoutInfo; QWizardLayoutInfo layoutInfo;
int disableUpdatesCount; int disableUpdatesCount = 0;
QWizard::WizardStyle wizStyle; QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
QWizard::WizardOptions opts; QWizard::WizardOptions opts;
QMap<int, QString> buttonCustomTexts; QMap<int, QString> buttonCustomTexts;
bool buttonsHaveCustomLayout; bool buttonsHaveCustomLayout = false;
QList<QWizard::WizardButton> buttonsCustomLayout; QList<QWizard::WizardButton> buttonsCustomLayout;
Qt::TextFormat titleFmt; Qt::TextFormat titleFmt = Qt::AutoText;
Qt::TextFormat subTitleFmt; Qt::TextFormat subTitleFmt = Qt::AutoText;
mutable QPixmap defaultPixmaps[QWizard::NPixmaps]; mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
union { union {
@ -660,32 +618,35 @@ public:
} btn; } btn;
mutable QAbstractButton *btns[QWizard::NButtons]; mutable QAbstractButton *btns[QWizard::NButtons];
}; };
QWizardAntiFlickerWidget *antiFlickerWidget; QWizardAntiFlickerWidget *antiFlickerWidget = nullptr;
QWidget *placeholderWidget1; QWidget *placeholderWidget1 = nullptr;
QWidget *placeholderWidget2; QWidget *placeholderWidget2 = nullptr;
QWizardHeader *headerWidget; QWizardHeader *headerWidget = nullptr;
QWatermarkLabel *watermarkLabel; QWatermarkLabel *watermarkLabel = nullptr;
QWidget *sideWidget; QWidget *sideWidget = nullptr;
QFrame *pageFrame; QFrame *pageFrame = nullptr;
QLabel *titleLabel; QLabel *titleLabel = nullptr;
QLabel *subTitleLabel; QLabel *subTitleLabel = nullptr;
QWizardRuler *bottomRuler; QWizardRuler *bottomRuler = nullptr;
QVBoxLayout *pageVBoxLayout; QVBoxLayout *pageVBoxLayout = nullptr;
QHBoxLayout *buttonLayout; QHBoxLayout *buttonLayout = nullptr;
QGridLayout *mainLayout; QGridLayout *mainLayout = nullptr;
#if QT_CONFIG(style_windowsvista) #if QT_CONFIG(style_windowsvista)
QVistaHelper *vistaHelper; QVistaHelper *vistaHelper = nullptr;
bool vistaInitPending; # if QT_CONFIG(shortcut)
QVistaHelper::VistaState vistaState; QPointer<QShortcut> vistaNextShortcut;
bool vistaStateChanged;
bool inHandleAeroStyleChange;
# endif # endif
int minimumWidth; bool vistaInitPending = true;
int minimumHeight; QVistaHelper::VistaState vistaState = QVistaHelper::Dirty;
int maximumWidth; bool vistaStateChanged = false;
int maximumHeight; bool inHandleAeroStyleChange = false;
#endif
int minimumWidth = 0;
int minimumHeight = 0;
int maximumWidth = QWIDGETSIZE_MAX;
int maximumHeight = QWIDGETSIZE_MAX;
}; };
static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate) static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
@ -720,6 +681,8 @@ void QWizardPrivate::init()
{ {
Q_Q(QWizard); Q_Q(QWizard);
std::fill(btns, btns + QWizard::NButtons, nullptr);
antiFlickerWidget = new QWizardAntiFlickerWidget(q, this); antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);
wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q)); wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));
if (wizStyle == QWizard::MacStyle) { if (wizStyle == QWizard::MacStyle) {
@ -1461,10 +1424,17 @@ void QWizardPrivate::updateButtonTexts()
// Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right // Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right
// even in RTL mode, so do the same, even if it might be counter-intuitive. // even in RTL mode, so do the same, even if it might be counter-intuitive.
// The shortcut for 'back' is set in class QVistaBackButton. // The shortcut for 'back' is set in class QVistaBackButton.
#if QT_CONFIG(shortcut) #if QT_CONFIG(shortcut) && QT_CONFIG(style_windowsvista)
if (btns[QWizard::NextButton] && isVistaThemeEnabled()) if (btns[QWizard::NextButton] && isVistaThemeEnabled()) {
btns[QWizard::NextButton]->setShortcut(QKeySequence(Qt::ALT | Qt::Key_Right)); if (vistaNextShortcut.isNull()) {
#endif vistaNextShortcut =
new QShortcut(QKeySequence(Qt::ALT | Qt::Key_Right),
btns[QWizard::NextButton], SLOT(animateClick()));
}
} else {
delete vistaNextShortcut;
}
#endif // shortcut && style_windowsvista
} }
void QWizardPrivate::updateButtonLayout() void QWizardPrivate::updateButtonLayout()

View File

@ -6204,7 +6204,7 @@ void QWidget::setFocusProxy(QWidget * w)
if (changingAppFocusWidget) { if (changingAppFocusWidget) {
QWidget *newDeepestFocusProxy = d_func()->deepestFocusProxy(); QWidget *newDeepestFocusProxy = d_func()->deepestFocusProxy();
QApplicationPrivate::focus_widget = newDeepestFocusProxy ? newDeepestFocusProxy : this; QApplicationPrivate::setFocusWidget(newDeepestFocusProxy ? newDeepestFocusProxy : this, Qt::NoFocusReason);
} }
} }

View File

@ -320,7 +320,7 @@ void tst_QRandomGenerator::generate32_data()
QTest::newRow("fixed") << (RandomValue32 & RandomDataMask); QTest::newRow("fixed") << (RandomValue32 & RandomDataMask);
QTest::newRow("global") << 0U; QTest::newRow("global") << 0U;
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
if (qt_has_hwrng()) if (qHasHwrng())
QTest::newRow("hwrng") << uint(UseSystemRNG); QTest::newRow("hwrng") << uint(UseSystemRNG);
QTest::newRow("system") << uint(UseSystemRNG | SkipHWRNG); QTest::newRow("system") << uint(UseSystemRNG | SkipHWRNG);
# ifdef HAVE_FALLBACK_ENGINE # ifdef HAVE_FALLBACK_ENGINE
@ -755,7 +755,7 @@ void tst_QRandomGenerator::stdUniformIntDistribution_data()
auto newRow = [&](quint32 max) { auto newRow = [&](quint32 max) {
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
if (qt_has_hwrng()) if (qHasHwrng())
QTest::addRow("hwrng:%u", max) << uint(UseSystemRNG) << max; QTest::addRow("hwrng:%u", max) << uint(UseSystemRNG) << max;
QTest::addRow("system:%u", max) << uint(UseSystemRNG | SkipHWRNG) << max; QTest::addRow("system:%u", max) << uint(UseSystemRNG | SkipHWRNG) << max;
# ifdef HAVE_FALLBACK_ENGINE # ifdef HAVE_FALLBACK_ENGINE
@ -868,7 +868,7 @@ void tst_QRandomGenerator::stdUniformRealDistribution_data()
auto newRow = [&](double min, double sup) { auto newRow = [&](double min, double sup) {
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
if (qt_has_hwrng()) if (qHasHwrng())
QTest::addRow("hwrng:%g-%g", min, sup) << uint(UseSystemRNG) << min << sup; QTest::addRow("hwrng:%g-%g", min, sup) << uint(UseSystemRNG) << min << sup;
QTest::addRow("system:%g-%g", min, sup) << uint(UseSystemRNG | SkipHWRNG) << min << sup; QTest::addRow("system:%g-%g", min, sup) << uint(UseSystemRNG | SkipHWRNG) << min << sup;
# ifdef HAVE_FALLBACK_ENGINE # ifdef HAVE_FALLBACK_ENGINE

View File

@ -3468,6 +3468,9 @@ void tst_QDateTime::timeZones() const
void tst_QDateTime::systemTimeZoneChange() const void tst_QDateTime::systemTimeZoneChange() const
{ {
#ifdef Q_OS_WINRT
QSKIP("UWP applications cannot change the system`s time zone (sandboxing)");
#endif
// Set the timezone to Brisbane time // Set the timezone to Brisbane time
TimeZoneRollback useZone(QByteArray("AEST-10:00")); TimeZoneRollback useZone(QByteArray("AEST-10:00"));
@ -3485,9 +3488,6 @@ void tst_QDateTime::systemTimeZoneChange() const
useZone.reset(QByteArray("IST-05:30")); useZone.reset(QByteArray("IST-05:30"));
QCOMPARE(localDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime)); QCOMPARE(localDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime));
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "WinRT gets this wrong, QTBUG-71185", Continue);
#endif
QVERIFY(localMsecs != localDate.toMSecsSinceEpoch()); QVERIFY(localMsecs != localDate.toMSecsSinceEpoch());
QCOMPARE(utcDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC)); QCOMPARE(utcDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC));
QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs); QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs);

View File

@ -1,2 +0,0 @@
[insert_remove_loop]
msvc-2019

View File

@ -0,0 +1,6 @@
[basic]
winrt
[resize]
winrt
[painter]
winrt

View File

@ -4,5 +4,3 @@ TARGET = tst_qopenglwindow
QT += core-private gui-private testlib QT += core-private gui-private testlib
SOURCES += tst_qopenglwindow.cpp SOURCES += tst_qopenglwindow.cpp
win32:CONFIG+=insignificant_test # QTBUG-46452, QTBUG-49630

View File

@ -66,6 +66,8 @@ private slots:
void defaultFamily(); void defaultFamily();
void toAndFromString(); void toAndFromString();
void fromStringWithoutStyleName(); void fromStringWithoutStyleName();
void fromDegenerateString_data();
void fromDegenerateString();
void sharing(); void sharing();
void familyNameWithCommaQuote_data(); void familyNameWithCommaQuote_data();
@ -604,6 +606,25 @@ void tst_QFont::fromStringWithoutStyleName()
QCOMPARE(font2.toString(), str); QCOMPARE(font2.toString(), str);
} }
void tst_QFont::fromDegenerateString_data()
{
QTest::addColumn<QString>("string");
QTest::newRow("empty") << QString();
QTest::newRow("justAComma") << ",";
QTest::newRow("commasAndSpaces") << " , , ";
QTest::newRow("spaces") << " ";
QTest::newRow("spacesTabsAndNewlines") << " \t \n";
}
void tst_QFont::fromDegenerateString()
{
QFETCH(QString, string);
QFont f;
QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*Invalid description.*"));
QCOMPARE(f.fromString(string), false);
QCOMPARE(f, QFont());
}
void tst_QFont::sharing() void tst_QFont::sharing()
{ {

View File

@ -2712,15 +2712,10 @@ void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
wizard.show(); wizard.show();
QVERIFY(QTest::qWaitForWindowExposed(&wizard)); QVERIFY(QTest::qWaitForWindowExposed(&wizard));
if (wizard.button(QWizard::NextButton)->text() == "&Next") {
QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(),
QKeySequence(Qt::ALT | Qt::Key_Right));
} else {
QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(), QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(),
QKeySequence::mnemonic(wizard.button(QWizard::NextButton)->text())); QKeySequence::mnemonic(wizard.button(QWizard::NextButton)->text()));
} }
} }
}
QTEST_MAIN(tst_QWizard) QTEST_MAIN(tst_QWizard)
#include "tst_qwizard.moc" #include "tst_qwizard.moc"

View File

@ -379,7 +379,7 @@ void TiledPixmapPainter::paintEvent(QPaintEvent *event)
// large pixmap: 2 x 2 tiles // large pixmap: 2 x 2 tiles
// 2x pixmap : 4 x 4 tiles // 2x pixmap : 4 x 4 tiles
// //
// On a 2x display the 2x pimxap tiles // On a 2x display the 2x pixmap tiles
// will be drawn in high resolution. // will be drawn in high resolution.
p.drawTiledPixmap(QRect(xoff, yoff, tileAreaEdge, tileAreaEdge), pixmap1X); p.drawTiledPixmap(QRect(xoff, yoff, tileAreaEdge, tileAreaEdge), pixmap1X);
yoff += tiles * pixmapEdge + 10; yoff += tiles * pixmapEdge + 10;