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

This commit is contained in:
Qt Forward Merge Bot 2020-01-13 01:00:45 +01:00
commit 46b433b971
11 changed files with 185 additions and 60 deletions

View File

@ -403,6 +403,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath(); const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();
const uint flags = isDir const uint flags = isDir
? (FILE_NOTIFY_CHANGE_DIR_NAME ? (FILE_NOTIFY_CHANGE_DIR_NAME
| FILE_NOTIFY_CHANGE_ATTRIBUTES
| FILE_NOTIFY_CHANGE_FILE_NAME) | FILE_NOTIFY_CHANGE_FILE_NAME)
: (FILE_NOTIFY_CHANGE_DIR_NAME : (FILE_NOTIFY_CHANGE_DIR_NAME
| FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_FILE_NAME

View File

@ -118,7 +118,7 @@ public:
int remainingTime(int timerId) final; int remainingTime(int timerId) final;
void wakeUp() final; void wakeUp() override;
void interrupt() final; void interrupt() final;
void flush() override; void flush() override;

View File

@ -463,10 +463,10 @@ QT_BEGIN_NAMESPACE
\c{\xHHHH} with more than 2 digits. A pattern like \c{\x2022} neeeds to \c{\xHHHH} with more than 2 digits. A pattern like \c{\x2022} neeeds to
be ported to \c{\x{2022}}, or it will match a space (\c{0x20}) followed be ported to \c{\x{2022}}, or it will match a space (\c{0x20}) followed
by the string \c{"22"}. In general, it is highly recommended to always use by the string \c{"22"}. In general, it is highly recommended to always use
curly braces with the \c{\\x} escape, no matter the amount of digits curly braces with the \c{\x} escape, no matter the amount of digits
specified. specified.
\li A 0-to-n quantification like \c{{,n}} needs to be ported to c{{0,n}} to \li A 0-to-n quantification like \c{{,n}} needs to be ported to \c{{0,n}} to
preserve semantics. Otherwise, a pattern such as \c{\d{,3}} would preserve semantics. Otherwise, a pattern such as \c{\d{,3}} would
actually match a digit followed by the exact string \c{"{,3}"}. actually match a digit followed by the exact string \c{"{,3}"}.

View File

@ -5123,21 +5123,25 @@ bool QString::endsWith(QChar c, Qt::CaseSensitivity cs) const
} }
/*! /*!
Returns \c true if the string only contains uppercase letters, Returns \c true if the string is uppercase, that is, it's identical
otherwise returns \c false. to its toUpper() folding.
Note that this does \e not mean that the string does not contain
lowercase letters (some lowercase letters do not have a uppercase
folding; they are left unchanged by toUpper()).
For more information, refer to the Unicode standard, section 3.13.
\since 5.12 \since 5.12
\sa QChar::isUpper(), isLower() \sa QChar::toUpper(), isLower()
*/ */
bool QString::isUpper() const bool QString::isUpper() const
{ {
if (isEmpty()) QStringIterator it(*this);
return false;
const QChar *d = data(); while (it.hasNext()) {
uint uc = it.nextUnchecked();
for (int i = 0, max = size(); i < max; ++i) { if (qGetProp(uc)->cases[QUnicodeTables::UpperCase].diff)
if (!d[i].isUpper())
return false; return false;
} }
@ -5145,21 +5149,25 @@ bool QString::isUpper() const
} }
/*! /*!
Returns \c true if the string only contains lowercase letters, Returns \c true if the string is lowercase, that is, it's identical
otherwise returns \c false. to its toLower() folding.
Note that this does \e not mean that the string does not contain
uppercase letters (some uppercase letters do not have a lowercase
folding; they are left unchanged by toLower()).
For more information, refer to the Unicode standard, section 3.13.
\since 5.12 \since 5.12
\sa QChar::isLower(), isUpper() \sa QChar::toLower(), isUpper()
*/ */
bool QString::isLower() const bool QString::isLower() const
{ {
if (isEmpty()) QStringIterator it(*this);
return false;
const QChar *d = data(); while (it.hasNext()) {
uint uc = it.nextUnchecked();
for (int i = 0, max = size(); i < max; ++i) { if (qGetProp(uc)->cases[QUnicodeTables::LowerCase].diff)
if (!d[i].isLower())
return false; return false;
} }

View File

@ -605,8 +605,13 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
The following parameters are available for \c {-platform windows}: The following parameters are available for \c {-platform windows}:
\list \list
\li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
Qt::GroupSwitchModifier (since Qt 5.12).
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and \li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
\c none disables them. \c none disables them.
\li \c {dpiawareness=[0|1|2} Sets the DPI awareness of the process
(see \l{High DPI Displays}, since Qt 5.4).
\li \c {fontengine=freetype}, uses the FreeType font engine. \li \c {fontengine=freetype}, uses the FreeType font engine.
\li \c {menus=[native|none]}, controls the use of native menus. \li \c {menus=[native|none]}, controls the use of native menus.
@ -616,10 +621,23 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
provide hover signals. They are mainly intended for Qt Quick. provide hover signals. They are mainly intended for Qt Quick.
By default, they will be used if the application is not an By default, they will be used if the application is not an
instance of QApplication or for Qt Quick Controls 2 instance of QApplication or for Qt Quick Controls 2
applications. applications (since Qt 5.10).
\li \c {altgr}, detect the key \c {AltGr} found on some keyboards as \li \c {nocolorfonts} Turn off DirectWrite Color fonts
Qt::GroupSwitchModifier. (since Qt 5.8).
\li \c {nodirectwrite} Turn off DirectWrite fonts (since Qt 5.8).
\li \c {nomousefromtouch} Ignores mouse events synthesized
from touch events by the operating system.
\li \c {nowmpointer} Switches from Pointer Input Messages handling
to legacy mouse handling (since Qt 5.12).
\li \c {reverse} Activates Right-to-left mode (experimental).
Windows title bars will be shown accordingly in Right-to-left locales
(since Qt 5.13).
\li \c {tabletabsoluterange=<value>} Sets a value for mouse mode detection
of WinTab tablets (Legacy, since Qt 5.3).
\endlist \endlist
The following parameter is available for \c {-platform cocoa} (on macOS): The following parameter is available for \c {-platform cocoa} (on macOS):

View File

@ -62,6 +62,9 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// Clang does not consider __declspec(nothrow) as nothrow
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
// Convert from design units to logical pixels // Convert from design units to logical pixels
#define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \ #define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \
QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize) QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize)

View File

@ -33,6 +33,14 @@
#include <emscripten.h> #include <emscripten.h>
#if (__EMSCRIPTEN_major__ > 1 || __EMSCRIPTEN_minor__ > 38 || __EMSCRIPTEN_minor__ == 38 && __EMSCRIPTEN_tiny__ >= 22)
# define EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
#endif
#ifdef EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
#include <emscripten/threading.h>
#endif
class QWasmEventDispatcherPrivate : public QEventDispatcherUNIXPrivate class QWasmEventDispatcherPrivate : public QEventDispatcherUNIXPrivate
{ {
@ -179,3 +187,18 @@ void QWasmEventDispatcher::doMaintainTimers()
emscripten_async_call(callback, this, toWaitDuration); emscripten_async_call(callback, this, toWaitDuration);
m_currentTargetTime = newTargetTime; m_currentTargetTime = newTargetTime;
} }
void QWasmEventDispatcher::wakeUp()
{
#ifdef EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
if (!emscripten_is_main_runtime_thread())
emscripten_async_run_in_main_runtime_thread_(EM_FUNC_SIG_VI, (void*)(&QWasmEventDispatcher::mainThreadWakeUp), this);
#endif
QEventDispatcherUNIX::wakeUp();
}
void QWasmEventDispatcher::mainThreadWakeUp(void *eventDispatcher)
{
emscripten_resume_main_loop(); // Service possible requestUpdate Calls
static_cast<QWasmEventDispatcher *>(eventDispatcher)->processEvents(QEventLoop::AllEvents);
}

View File

@ -51,6 +51,8 @@ public:
protected: protected:
bool processEvents(QEventLoop::ProcessEventsFlags flags) override; bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
void doMaintainTimers(); void doMaintainTimers();
void wakeUp() override;
static void mainThreadWakeUp(void *eventDispatcher);
private: private:
bool m_hasMainLoop = false; bool m_hasMainLoop = false;

View File

@ -107,6 +107,9 @@ private:
ULONG m_ref; ULONG m_ref;
}; };
// Clang does not consider __declspec(nothrow) as nothrow
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QWINDOWSCOMBASE_H #endif // QWINDOWSCOMBASE_H

View File

@ -34,6 +34,9 @@
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QTextStream> #include <QTextStream>
#include <QDir> #include <QDir>
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#include <windows.h>
#endif
/* All tests need to run in temporary directories not used /* All tests need to run in temporary directories not used
* by the application to avoid non-deterministic failures on Windows * by the application to avoid non-deterministic failures on Windows
@ -79,6 +82,9 @@ private slots:
void signalsEmittedAfterFileMoved(); void signalsEmittedAfterFileMoved();
void watchUnicodeCharacters(); void watchUnicodeCharacters();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void watchDirectoryAttributeChanges();
#endif
private: private:
QString m_tempDirPattern; QString m_tempDirPattern;
@ -813,5 +819,27 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters()
QTRY_COMPARE(changedSpy.count(), 1); QTRY_COMPARE(changedSpy.count(), 1);
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QFileSystemWatcher::watchDirectoryAttributeChanges()
{
QTemporaryDir temporaryDirectory(m_tempDirPattern);
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
QDir testDir(temporaryDirectory.path());
const QString subDir(QString::fromLatin1("attrib_test"));
QVERIFY(testDir.mkdir(subDir));
testDir = QDir(temporaryDirectory.path() + QDir::separator() + subDir);
QFileSystemWatcher watcher;
QVERIFY(watcher.addPath(temporaryDirectory.path()));
FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged);
QCOMPARE(changedSpy.count(), 0);
QVERIFY(SetFileAttributes(reinterpret_cast<LPCWSTR>(testDir.absolutePath().utf16()), FILE_ATTRIBUTE_HIDDEN) != 0);
QTRY_COMPARE(changedSpy.count(), 1);
QVERIFY(SetFileAttributes(reinterpret_cast<LPCWSTR>(testDir.absolutePath().utf16()), FILE_ATTRIBUTE_NORMAL) != 0);
QTRY_COMPARE(changedSpy.count(), 2);
}
#endif
QTEST_MAIN(tst_QFileSystemWatcher) QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc" #include "tst_qfilesystemwatcher.moc"

View File

@ -459,8 +459,8 @@ private slots:
void trimmed(); void trimmed();
void toUpper(); void toUpper();
void toLower(); void toLower();
void isUpper(); void isLower_isUpper_data();
void isLower(); void isLower_isUpper();
void toCaseFolded(); void toCaseFolded();
void rightJustified(); void rightJustified();
void leftJustified(); void leftJustified();
@ -2313,44 +2313,83 @@ void tst_QString::toLower()
#endif // icu #endif // icu
} }
void tst_QString::isUpper() void tst_QString::isLower_isUpper_data()
{ {
QVERIFY(!QString().isUpper()); QTest::addColumn<QString>("string");
QVERIFY(!QString("").isUpper()); QTest::addColumn<bool>("isLower");
QVERIFY(QString("TEXT").isUpper()); QTest::addColumn<bool>("isUpper");
QVERIFY(!QString("text").isUpper());
QVERIFY(!QString("Text").isUpper()); int row = 0;
QVERIFY(!QString("tExt").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString() << true << true;
QVERIFY(!QString("teXt").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("") << true << true;
QVERIFY(!QString("texT").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString(" ") << true << true;
QVERIFY(!QString("TExt").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("123") << true << true;
QVERIFY(!QString("teXT").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("@123$#") << true << true;
QVERIFY(!QString("tEXt").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("𝄞𝄴𝆏♫") << true << true; // Unicode Block 'Musical Symbols'
QVERIFY(!QString("tExT").isUpper()); // not foldable
QVERIFY(!QString("@ABYZ[").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("𝚊𝚋𝚌𝚍𝚎") << true << true; // MATHEMATICAL MONOSPACE SMALL A, ... E
QVERIFY(!QString("@abyz[").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("𝙖,𝙗,𝙘,𝙙,𝙚") << true << true; // MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A, ... E
QVERIFY(!QString("`ABYZ{").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("𝗔𝗕𝗖𝗗𝗘") << true << true; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A, ... E
QVERIFY(!QString("`abyz{").isUpper()); QTest::addRow("lower-and-upper-%02d", row++) << QString("𝐀,𝐁,𝐂,𝐃,𝐄") << true << true; // MATHEMATICAL BOLD CAPITAL A, ... E
row = 0;
QTest::addRow("only-lower-%02d", row++) << QString("text") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("àaa") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("øæß") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("text ") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString(" text") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("hello, world!") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("123@abyz[") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("`abyz{") << true << false;
QTest::addRow("only-lower-%02d", row++) << QString("a𝙖a|b𝙗b|c𝙘c|d𝙙d|e𝙚e") << true << false; // MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A, ... E
QTest::addRow("only-lower-%02d", row++) << QString("𐐨") << true << false; // DESERET SMALL LETTER LONG I
// uppercase letters, not foldable
QTest::addRow("only-lower-%02d", row++) << QString("text𝗔text") << true << false; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A
row = 0;
QTest::addRow("only-upper-%02d", row++) << QString("TEXT") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("ÀAA") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("ØÆẞ") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("TEXT ") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString(" TEXT") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("HELLO, WORLD!") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("123@ABYZ[") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("`ABYZ{") << false << true;
QTest::addRow("only-upper-%02d", row++) << QString("A𝐀A|B𝐁B|C𝐂C|D𝐃D|E𝐄E") << false << true; // MATHEMATICAL BOLD CAPITAL A, ... E
QTest::addRow("only-upper-%02d", row++) << QString("𐐀") << false << true; // DESERET CAPITAL LETTER LONG I
// lowercase letters, not foldable
QTest::addRow("only-upper-%02d", row++) << QString("TEXT𝚊TEXT") << false << true; // MATHEMATICAL MONOSPACE SMALL A
row = 0;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("Text") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tExt") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("teXt") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("texT") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("TExt") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("teXT") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tEXt") << false << false;
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tExT") << false << false;
// not foldable
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("TEXT𝚊text") << false << false; // MATHEMATICAL MONOSPACE SMALL A
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("text𝗔TEXT") << false << false; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A
// titlecase, foldable
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("abcLjdef") << false << false; // LATIN CAPITAL LETTER L WITH SMALL LETTER J
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("ABCLjDEF") << false << false; // LATIN CAPITAL LETTER L WITH SMALL LETTER J
} }
void tst_QString::isLower() void tst_QString::isLower_isUpper()
{ {
QVERIFY(!QString().isLower()); QFETCH(QString, string);
QVERIFY(!QString("").isLower()); QFETCH(bool, isLower);
QVERIFY(QString("text").isLower()); QFETCH(bool, isUpper);
QVERIFY(!QString("Text").isLower());
QVERIFY(!QString("tExt").isLower()); QCOMPARE(string.isLower(), isLower);
QVERIFY(!QString("teXt").isLower()); QCOMPARE(string.toLower() == string, isLower);
QVERIFY(!QString("texT").isLower()); QVERIFY(string.toLower().isLower());
QVERIFY(!QString("TExt").isLower());
QVERIFY(!QString("teXT").isLower()); QCOMPARE(string.isUpper(), isUpper);
QVERIFY(!QString("tEXt").isLower()); QCOMPARE(string.toUpper() == string, isUpper);
QVERIFY(!QString("tExT").isLower()); QVERIFY(string.toUpper().isUpper());
QVERIFY(!QString("TEXT").isLower());
QVERIFY(!QString("@ABYZ[").isLower());
QVERIFY(!QString("@abyz[").isLower());
QVERIFY(!QString("`ABYZ{").isLower());
QVERIFY(!QString("`abyz{").isLower());
} }
void tst_QString::toCaseFolded() void tst_QString::toCaseFolded()