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

Conflicts:
	src/widgets/kernel/qshortcut.cpp
	tests/auto/network/access/spdy/tst_spdy.cpp

Change-Id: If76c434beac2c0a393440aa365f89f77439774ce
This commit is contained in:
Qt Forward Merge Bot 2020-01-16 01:00:11 +01:00 committed by Edward Welbourne
commit 0a4e5bb265
71 changed files with 848 additions and 540 deletions

View File

@ -1484,6 +1484,11 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
{ {
"type": "emccVersion", "type": "emccVersion",
"condition": "config.wasm" "condition": "config.wasm"
},
{
"type": "error",
"condition": "config.ios && features.debug && !features.debug_and_release",
"message": "Debug build wihtout Release build is not currently supported on ios see QTBUG-71990. Use -debug-and-release."
} }
], ],

View File

@ -238,8 +238,7 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 1 \snippet threads/mandelbrot/mandelbrotwidget.cpp 1
The interesting part of the constructor is the The interesting part of the constructor is the
qRegisterMetaType() and QObject::connect() calls. Let's start QObject::connect() call.
with the \l{QObject::connect()}{connect()} call.
Although it looks like a standard signal-slot connection between Although it looks like a standard signal-slot connection between
two \l{QObject}s, because the signal is emitted in a different two \l{QObject}s, because the signal is emitted in a different
@ -254,9 +253,10 @@
With queued connections, Qt must store a copy of the arguments With queued connections, Qt must store a copy of the arguments
that were passed to the signal so that it can pass them to the that were passed to the signal so that it can pass them to the
slot later on. Qt knows how to take of copy of many C++ and Qt slot later on. Qt knows how to take of copy of many C++ and Qt
types, but QImage isn't one of them. We must therefore call the types, so, no further action is needed for QImage.
template function qRegisterMetaType() before we can use QImage If a custom type was used, a call to the template function
as a parameter in queued connections. qRegisterMetaType() would be required before the type
could be used as a parameter in queued connections.
\snippet threads/mandelbrot/mandelbrotwidget.cpp 2 \snippet threads/mandelbrot/mandelbrotwidget.cpp 2
\snippet threads/mandelbrot/mandelbrotwidget.cpp 3 \snippet threads/mandelbrot/mandelbrotwidget.cpp 3

View File

@ -212,14 +212,17 @@ macx-xcode {
QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS) QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS) QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
} else { } else {
simulator: \ simulator {
version_identifier = $$simulator.deployment_identifier version_identifier = $$simulator.deployment_identifier
else: \ sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk)
} else {
version_identifier = $$device.deployment_identifier version_identifier = $$device.deployment_identifier
sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk)
}
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_path $$version_min_flag
} }
# Enable precompiled headers for multiple architectures # Enable precompiled headers for multiple architectures

View File

@ -303,7 +303,9 @@ SUBDIRS = kernel \
#! [51] #! [51]
CONFIG += ordered SUBDIRS += my_executable my_library tests doc
my_executable.depends = my_library
tests.depends = my_executable
#! [51] #! [51]

View File

@ -936,7 +936,9 @@
file. file.
\row \li ordered \li When using the \c subdirs template, this option \row \li ordered \li When using the \c subdirs template, this option
specifies that the directories listed should be processed in the specifies that the directories listed should be processed in the
order in which they are given. order in which they are given. \note The use of this option is discouraged.
Specify dependencies as described in the \l{#SUBDIRS}{SUBDIRS}
variable documentation.
\row \li precompile_header \li Enables support for the use of \row \li precompile_header \li Enables support for the use of
\l{Using Precompiled Headers}{precompiled headers} in projects. \l{Using Precompiled Headers}{precompiled headers} in projects.
\row \li precompile_header_c (MSVC only) \li Enables support for the use of \row \li precompile_header_c (MSVC only) \li Enables support for the use of
@ -2730,21 +2732,35 @@
\snippet code/doc_src_qmake-manual.pro 50 \snippet code/doc_src_qmake-manual.pro 50
If you need to ensure that the subdirectories are built in the order in If you need to ensure that the subdirectories are built in a particular
which they are specified, update the \l{#CONFIG}{CONFIG} variable to order, use the \c .depends modifier on the relevant \c SUBDIRS elements.
include the \c ordered option:
For example:
\snippet code/doc_src_qmake-manual.pro 51 \snippet code/doc_src_qmake-manual.pro 51
It is possible to modify this default behavior of \c SUBDIRS by giving The configuration above ensures that \c{my_library} is built before
additional modifiers to \c SUBDIRS elements. Supported modifiers are: \c{my_executable} and that \c{my_executable} is built before \c{tests}.
However, \c{doc} can be built in parallel with the other subdirectories,
thus speeding up the build process.
\note Multiple dependencies can be listed and they will all be built before
the target that depends on them.
\note Using \l{#CONFIG}{CONFIG += ordered} is discouraged as it can slow down
multi-core builds. Unlike the example shown above, all builds will happen
sequentially even if they don't have dependencies.
Beside defining the build order, it is possible to modify the default behavior
of \c SUBDIRS by giving additional modifiers to \c SUBDIRS elements.
Supported modifiers are:
\table \table
\header \li Modifier \li Effect \header \li Modifier \li Effect
\row \li .subdir \li Use the specified subdirectory instead of \c SUBDIRS value. \row \li .subdir \li Use the specified subdirectory instead of \c SUBDIRS value.
\row \li .file \li Specify the subproject \c pro file explicitly. Cannot be \row \li .file \li Specify the subproject \c pro file explicitly. Cannot be
used in conjunction with \c .subdir modifier. used in conjunction with \c .subdir modifier.
\row \li .depends \li This subproject depends on specified subproject. \row \li .depends \li This subproject depends on specified subproject(s).
\row \li .makefile \li The makefile of subproject. \row \li .makefile \li The makefile of subproject.
Available only on platforms that use makefiles. Available only on platforms that use makefiles.
\row \li .target \li Base string used for makefile targets related to this \row \li .target \li Base string used for makefile targets related to this

View File

@ -1520,7 +1520,7 @@ MakefileGenerator::createObjectList(const ProStringList &sources)
if (!noIO()) { if (!noIO()) {
// Ensure that the final output directory of each object exists // Ensure that the final output directory of each object exists
QString outRelativePath = fileFixify(dir, FileFixifyBackwards); QString outRelativePath = fileFixify(dir, FileFixifyBackwards);
if (!mkdir(outRelativePath)) if (!outRelativePath.isEmpty() && !mkdir(outRelativePath))
warn_msg(WarnLogic, "Cannot create directory '%s'", outRelativePath.toLatin1().constData()); warn_msg(WarnLogic, "Cannot create directory '%s'", outRelativePath.toLatin1().constData());
} }
} else { } else {

View File

@ -37,5 +37,5 @@
QCborValueRef qfloat16 QDeferredDeleteEvent QSpecialInteger QLittleEndianStorageType QCborValueRef qfloat16 QDeferredDeleteEvent QSpecialInteger QLittleEndianStorageType
QBigEndianStorageType QFactoryInterface QFutureWatcherBase QJsonValuePtr QBigEndianStorageType QFactoryInterface QFutureWatcherBase QJsonValuePtr
QJsonValueRefPtr QLinkedListNode QAbstractConcatenable QStringBuilderCommon QJsonValueRefPtr QLinkedListNode QAbstractConcatenable QStringBuilderCommon
QTextCodec::ConverterState QThreadStorageData) QTextCodec::ConverterState QThreadStorageData QTextStreamManipulator)
*/ */

View File

@ -893,7 +893,7 @@ QT_WARNING_POP
#endif #endif
QT_WARNING_PUSH QT_WARNING_PUSH
// warning: noexcept-expression evaluates to false because of a call to void swap(..., ...)' // warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)'
QT_WARNING_DISABLE_GCC("-Wnoexcept") QT_WARNING_DISABLE_GCC("-Wnoexcept")
namespace QtPrivate namespace QtPrivate

View File

@ -253,7 +253,8 @@ QT_WARNING_POP
// size_t. Implementations for 8- and 16-bit types will work but may not be as // size_t. Implementations for 8- and 16-bit types will work but may not be as
// efficient. Implementations for 64-bit may be missing on 32-bit platforms. // efficient. Implementations for 64-bit may be missing on 32-bit platforms.
#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || __has_builtin(__builtin_add_overflow) #if ((defined(Q_CC_INTEL) ? (Q_CC_INTEL >= 1800 && !defined(Q_OS_WIN)) : defined(Q_CC_GNU)) \
&& Q_CC_GNU >= 500) || __has_builtin(__builtin_add_overflow)
// GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows // GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows
template <typename T> inline template <typename T> inline

View File

@ -1004,7 +1004,7 @@ QT_WARNING_POP
/*! /*!
\internal \internal
Returns true if we emitted readyRead(). Returns \c true if we emitted readyRead().
*/ */
bool QProcessPrivate::tryReadFromChannel(Channel *channel) bool QProcessPrivate::tryReadFromChannel(Channel *channel)
{ {
@ -2187,6 +2187,8 @@ bool QProcess::startDetached(qint64 *pid)
This method is an alias for start(), and exists only to fully implement This method is an alias for start(), and exists only to fully implement
the interface defined by QIODevice. the interface defined by QIODevice.
Returns \c true if the program has been started.
\sa start(), setProgram(), setArguments() \sa start(), setProgram(), setArguments()
*/ */
bool QProcess::open(OpenMode mode) bool QProcess::open(OpenMode mode)

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 Intel Corporation. ** Copyright (C) 2020 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtCore module of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
@ -60,14 +60,14 @@
#include "private/qtools_p.h" #include "private/qtools_p.h"
#include "private/qsystemerror_p.h" #include "private/qsystemerror_p.h"
#ifndef QT_NO_COMPRESS
# include <zconf.h>
# include <zlib.h>
#endif
#if QT_CONFIG(zstd) #if QT_CONFIG(zstd)
# include <zstd.h> # include <zstd.h>
#endif #endif
#ifdef Q_OS_UNIX
# include "private/qcore_unix_p.h"
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY) #if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
# define QT_USE_MMAP # define QT_USE_MMAP
# include <sys/mman.h> # include <sys/mman.h>
@ -296,6 +296,8 @@ public:
void ensureInitialized() const; void ensureInitialized() const;
void ensureChildren() const; void ensureChildren() const;
qint64 uncompressedSize() const Q_DECL_PURE_FUNCTION;
qsizetype decompress(char *buffer, qsizetype bufferSize) const;
bool load(const QString &file); bool load(const QString &file);
void clear(); void clear();
@ -440,6 +442,78 @@ QResourcePrivate::ensureChildren() const
} }
} }
qint64 QResourcePrivate::uncompressedSize() const
{
switch (compressionAlgo) {
case QResource::NoCompression:
return size;
case QResource::ZlibCompression:
#ifndef QT_NO_COMPRESS
if (size_t(size) >= sizeof(quint32))
return qFromBigEndian<quint32>(data);
#else
Q_ASSERT(!"QResource: Qt built without support for Zlib compression");
Q_UNREACHABLE();
#endif
break;
case QResource::ZstdCompression: {
#if QT_CONFIG(zstd)
size_t n = ZSTD_getFrameContentSize(data, size);
return ZSTD_isError(n) ? -1 : qint64(n);
#else
// This should not happen because we've refused to load such resource
Q_ASSERT(!"QResource: Qt built without support for Zstd compression");
Q_UNREACHABLE();
#endif
}
}
return -1;
}
qsizetype QResourcePrivate::decompress(char *buffer, qsizetype bufferSize) const
{
Q_ASSERT(data);
switch (compressionAlgo) {
case QResource::NoCompression:
Q_UNREACHABLE();
break;
case QResource::ZlibCompression: {
#ifndef QT_NO_COMPRESS
uLong len = uLong(bufferSize);
int res = ::uncompress(reinterpret_cast<Bytef *>(buffer), &len,
data + sizeof(quint32), uLong(size - sizeof(quint32)));
if (res != Z_OK) {
qWarning("QResource: error decompressing zlib content (%d)", res);
return -1;
}
return len;
#else
Q_UNREACHABLE();
#endif
}
case QResource::ZstdCompression: {
#if QT_CONFIG(zstd)
size_t usize = ZSTD_decompress(buffer, bufferSize, data, size);
if (ZSTD_isError(usize)) {
qWarning("QResource: error decompressing zstd content: %s", ZSTD_getErrorName(usize));
return -1;
}
return usize;
#else
Q_UNREACHABLE();
#endif
}
}
return -1;
}
/*! /*!
Constructs a QResource pointing to \a file. \a locale is used to Constructs a QResource pointing to \a file. \a locale is used to
load a specific localization of a resource data. load a specific localization of a resource data.
@ -600,9 +674,12 @@ QResource::Compression QResource::compressionAlgorithm() const
} }
/*! /*!
Returns the size of the data backing the resource. Returns the size of the stored data backing the resource.
\sa data(), isFile() If the resource is compressed, this function returns the size of the
compressed data. See uncompressedSize() for the uncompressed size.
\sa data(), uncompressedSize(), isFile()
*/ */
qint64 QResource::size() const qint64 QResource::size() const
@ -613,12 +690,29 @@ qint64 QResource::size() const
} }
/*! /*!
Returns direct access to a read only segment of data that this resource \since 5.15
represents. If the resource is compressed the data returned is compressed
and the appropriate library functions must be used to access the data. If
the resource is a directory \nullptr is returned.
\sa size(), compressionAlgorithm(), isFile() Returns the size of the data in this resource. If the data was not
compressed, this function returns the same as size(). If it was, then this
function extracts the size of the original uncompressed data from the
stored stream.
\sa size(), uncompressedData(), isFile()
*/
qint64 QResource::uncompressedSize() const
{
Q_D(const QResource);
d->ensureInitialized();
return d->uncompressedSize();
}
/*!
Returns direct access to a segment of read-only data, that this resource
represents. If the resource is compressed, the data returned is also
compressed. The caller must then decompress the data or use
uncompressedData(). If the resource is a directory, \c nullptr is returned.
\sa uncompressedData(), size(), isFile()
*/ */
const uchar *QResource::data() const const uchar *QResource::data() const
@ -628,6 +722,42 @@ const uchar *QResource::data() const
return d->data; return d->data;
} }
/*!
\since 5.15
Returns the resource data, decompressing it first, if the data was stored
compressed. If the resource is a directory or an error occurs while
decompressing, a null QByteArray is returned.
\note If the data was compressed, this function will decompress every time
it is called. The result is not cached between calls.
\sa uncompressedData(), size(), isCompressed(), isFile()
*/
QByteArray QResource::uncompressedData() const
{
Q_D(const QResource);
qint64 n = uncompressedSize();
if (n < 0)
return QByteArray();
if (n > std::numeric_limits<QByteArray::size_type>::max()) {
qWarning("QResource: compressed content does not fit into a QByteArray; use QFile instead");
return QByteArray();
}
if (d->compressionAlgo == NoCompression)
return QByteArray::fromRawData(reinterpret_cast<const char *>(d->data), n);
// decompress
QByteArray result(n, Qt::Uninitialized);
n = d->decompress(result.data(), n);
if (n < 0)
result.clear();
else
result.truncate(n);
return result;
}
/*! /*!
\since 5.8 \since 5.8
@ -1445,13 +1575,7 @@ bool QResourceFileEngine::link(const QString &)
qint64 QResourceFileEngine::size() const qint64 QResourceFileEngine::size() const
{ {
Q_D(const QResourceFileEngine); Q_D(const QResourceFileEngine);
if (!d->resource.isValid()) return d->resource.isValid() ? d->resource.uncompressedSize() : 0;
return 0;
if (d->resource.compressionAlgorithm() != QResource::NoCompression) {
d->uncompress();
return d->uncompressed.size();
}
return d->resource.size();
} }
qint64 QResourceFileEngine::pos() const qint64 QResourceFileEngine::pos() const
@ -1609,12 +1733,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
Q_Q(QResourceFileEngine); Q_Q(QResourceFileEngine);
Q_UNUSED(flags); Q_UNUSED(flags);
qint64 max = resource.size(); qint64 max = resource.uncompressedSize();
if (resource.compressionAlgorithm() != QResource::NoCompression) {
uncompress();
max = uncompressed.size();
}
qint64 end; qint64 end;
if (offset < 0 || size <= 0 || !resource.isValid() || if (offset < 0 || size <= 0 || !resource.isValid() ||
add_overflow(offset, size, &end) || end > max) { add_overflow(offset, size, &end) || end > max) {
@ -1623,8 +1742,12 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
} }
const uchar *address = resource.data(); const uchar *address = resource.data();
if (resource.compressionAlgorithm() != QResource::NoCompression) if (resource.compressionAlgorithm() != QResource::NoCompression) {
uncompress();
if (uncompressed.isNull())
return nullptr;
address = reinterpret_cast<const uchar *>(uncompressed.constData()); address = reinterpret_cast<const uchar *>(uncompressed.constData());
}
return const_cast<uchar *>(address) + offset; return const_cast<uchar *>(address) + offset;
} }
@ -1637,41 +1760,10 @@ bool QResourceFileEnginePrivate::unmap(uchar *ptr)
void QResourceFileEnginePrivate::uncompress() const void QResourceFileEnginePrivate::uncompress() const
{ {
if (uncompressed.isEmpty() && resource.size()) { if (resource.compressionAlgorithm() == QResource::NoCompression
quint64 size; || !uncompressed.isEmpty() || resource.size() == 0)
switch (resource.compressionAlgorithm()) { return; // nothing to do
case QResource::NoCompression: uncompressed = resource.uncompressedData();
return; // nothing to do
case QResource::ZlibCompression:
#ifndef QT_NO_COMPRESS
uncompressed = qUncompress(resource.data(), resource.size());
#else
Q_ASSERT(!"QResourceFileEngine::open: Qt built without support for Zlib compression");
#endif
break;
case QResource::ZstdCompression:
#if QT_CONFIG(zstd)
size = ZSTD_getFrameContentSize(resource.data(), resource.size());
if (!ZSTD_isError(size)) {
if (size >= MaxAllocSize) {
qWarning("QResourceFileEngine::open: content bigger than memory (size %lld)", size);
} else {
uncompressed = QByteArray(size, Qt::Uninitialized);
size = ZSTD_decompress(const_cast<char *>(uncompressed.data()), size,
resource.data(), resource.size());
}
}
if (ZSTD_isError(size))
qWarning("QResourceFileEngine::open: error decoding: %s", ZSTD_getErrorName(size));
#else
Q_UNUSED(size);
Q_ASSERT(!"QResourceFileEngine::open: Qt built without support for Zstd compression");
#endif
break;
}
}
} }
#endif // !defined(QT_BOOTSTRAPPED) #endif // !defined(QT_BOOTSTRAPPED)

View File

@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtCore module of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
@ -75,6 +76,8 @@ public:
Compression compressionAlgorithm() const; Compression compressionAlgorithm() const;
qint64 size() const; qint64 size() const;
const uchar *data() const; const uchar *data() const;
qint64 uncompressedSize() const;
QByteArray uncompressedData() const;
QDateTime lastModified() const; QDateTime lastModified() const;
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)

View File

@ -212,6 +212,7 @@ Qt::ItemFlags QStringListModel::flags(const QModelIndex &index) const
\a index in the model, to the provided \a value. \a index in the model, to the provided \a value.
The dataChanged() signal is emitted if the item is changed. The dataChanged() signal is emitted if the item is changed.
Returns \c true after emitting the dataChanged() signal.
\sa Qt::ItemDataRole, data() \sa Qt::ItemDataRole, data()
*/ */
@ -249,6 +250,8 @@ bool QStringListModel::clearItemData(const QModelIndex &index)
specified, indicating that the rows are inserted in the top level of specified, indicating that the rows are inserted in the top level of
the model. the model.
Returns \c true if the insertion was successful.
\sa QAbstractItemModel::insertRows() \sa QAbstractItemModel::insertRows()
*/ */
@ -275,6 +278,8 @@ bool QStringListModel::insertRows(int row, int count, const QModelIndex &parent)
specified, indicating that the rows are removed in the top level of specified, indicating that the rows are removed in the top level of
the model. the model.
Returns \c true if the row removal was successful.
\sa QAbstractItemModel::removeRows() \sa QAbstractItemModel::removeRows()
*/ */

View File

@ -137,13 +137,12 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
#endif #endif
return false; return false;
} }
const SectionNode &node = sectionNodes.at(index);
const QDate date = v.date(); QCalendar::YearMonthDay date = calendar.partsFromDate(v.date());
if (!date.isValid())
return false;
const QTime time = v.time(); const QTime time = v.time();
int year = date.year(calendar);
int month = date.month(calendar);
int day = date.day(calendar);
int hour = time.hour(); int hour = time.hour();
int minute = time.minute(); int minute = time.minute();
int second = time.second(); int second = time.second();
@ -152,14 +151,15 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
// Only offset from UTC is amenable to setting an int value: // Only offset from UTC is amenable to setting an int value:
int offset = tspec == Qt::OffsetFromUTC ? v.offsetFromUtc() : 0; int offset = tspec == Qt::OffsetFromUTC ? v.offsetFromUtc() : 0;
const SectionNode &node = sectionNodes.at(index);
switch (node.type) { switch (node.type) {
case Hour24Section: case Hour12Section: hour = newVal; break; case Hour24Section: case Hour12Section: hour = newVal; break;
case MinuteSection: minute = newVal; break; case MinuteSection: minute = newVal; break;
case SecondSection: second = newVal; break; case SecondSection: second = newVal; break;
case MSecSection: msec = newVal; break; case MSecSection: msec = newVal; break;
case YearSection2Digits: case YearSection2Digits:
case YearSection: year = newVal; break; case YearSection: date.year = newVal; break;
case MonthSection: month = newVal; break; case MonthSection: date.month = newVal; break;
case DaySection: case DaySection:
case DayOfWeekSectionShort: case DayOfWeekSectionShort:
case DayOfWeekSectionLong: case DayOfWeekSectionLong:
@ -169,7 +169,7 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
// to 31 for february should return true // to 31 for february should return true
return false; return false;
} }
day = newVal; date.day = newVal;
break; break;
case TimeZoneSection: case TimeZoneSection:
if (newVal < absoluteMin(index) || newVal > absoluteMax(index)) if (newVal < absoluteMin(index) || newVal > absoluteMax(index))
@ -185,15 +185,14 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
} }
if (!(node.type & DaySectionMask)) { if (!(node.type & DaySectionMask)) {
if (day < cachedDay) if (date.day < cachedDay)
day = cachedDay; date.day = cachedDay;
const int max = calendar.daysInMonth(month, year); const int max = calendar.daysInMonth(date.month, date.year);
if (day > max) { if (date.day > max)
day = max; date.day = max;
}
} }
const QDate newDate(year, month, day, calendar); const QDate newDate = calendar.dateFromParts(date);
const QTime newTime(hour, minute, second, msec); const QTime newTime(hour, minute, second, msec);
if (!newDate.isValid() || !newTime.isValid()) if (!newDate.isValid() || !newTime.isValid())
return false; return false;

View File

@ -374,7 +374,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
*/ */
/*! /*!
\enum QLineF::IntersectionType \enum QLineF::IntersectType
Describes the intersection between two lines. Describes the intersection between two lines.

View File

@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE
of the scope. of the scope.
\ingroup misc \ingroup misc
QScopeGuard<F> is a class which sole purpose is to run a function \e F in QScopeGuard<F> is a class of which the sole purpose is to run the function
its destructor. This is useful for guaranteeing your cleanup code is \a f in its destructor. This is useful for guaranteeing
executed, whether the function is exited normally, exited early by a return your cleanup code is executed, whether the function is exited normally,
statement, or exited by an exception. exited early by a return statement, or exited by an exception.
If \e F is a lambda then you cannot instantiate the template directly, If \e F is a lambda then you cannot instantiate the template directly,
therefore the qScopeGuard() helper is provided and QScopeGuard<F> is made a therefore the qScopeGuard() helper is provided and QScopeGuard<F> is made a

View File

@ -1285,6 +1285,8 @@
\relates QSharedPointer \relates QSharedPointer
\since 5.14 \since 5.14
Returns a shared pointer to the pointer held by \a src.
Same as qSharedPointerObjectCast(). This function is provided for STL Same as qSharedPointerObjectCast(). This function is provided for STL
compatibility. compatibility.
*/ */

View File

@ -667,9 +667,9 @@ QHoverEvent::~QHoverEvent()
if that widget does not handle the event they are sent to the if that widget does not handle the event they are sent to the
focus widget. Wheel events are generated for both mouse wheels focus widget. Wheel events are generated for both mouse wheels
and trackpad scroll gestures. There are two ways to read the and trackpad scroll gestures. There are two ways to read the
wheel event delta: angleDelta() returns the delta in wheel wheel event delta: angleDelta() returns the deltas in wheel
degrees. This value is always provided. pixelDelta() returns degrees. These values are always provided. pixelDelta() returns
the delta in screen pixels and is available on platforms that the deltas in screen pixels, and is available on platforms that
have high-resolution trackpads, such as \macos. If that is the have high-resolution trackpads, such as \macos. If that is the
case, source() will return Qt::MouseEventSynthesizedBySystem. case, source() will return Qt::MouseEventSynthesizedBySystem.
@ -852,7 +852,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
by \a globalPos. by \a globalPos.
\a pixelDelta contains the scrolling distance in pixels on screen, while \a pixelDelta contains the scrolling distance in pixels on screen, while
\a angleDelta contains the wheel rotation distance. \a pixelDelta is \a angleDelta contains the wheel rotation angle. \a pixelDelta is
optional and can be null. optional and can be null.
The mouse and keyboard states at the time of the event are specified by The mouse and keyboard states at the time of the event are specified by
@ -914,10 +914,16 @@ QWheelEvent::~QWheelEvent()
/*! /*!
\fn QPoint QWheelEvent::angleDelta() const \fn QPoint QWheelEvent::angleDelta() const
Returns the distance that the wheel is rotated, in eighths of a Returns the relative amount that the wheel was rotated, in eighths of a
degree. A positive value indicates that the wheel was rotated degree. A positive value indicates that the wheel was rotated forwards away
forwards away from the user; a negative value indicates that the from the user; a negative value indicates that the wheel was rotated
wheel was rotated backwards toward the user. backwards toward the user. \c angleDelta().y() provides the angle through
which the common vertical mouse wheel was rotated since the previous event.
\c angleDelta().x() provides the angle through which the horizontal mouse
wheel was rotated, if the mouse has a horizontal wheel; otherwise it stays
at zero. Some mice allow the user to tilt the wheel to perform horizontal
scrolling, and some touchpads support a horizontal scrolling gesture; that
will also appear in \c angleDelta().x().
Most mouse types work in steps of 15 degrees, in which case the Most mouse types work in steps of 15 degrees, in which case the
delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees. delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
@ -926,7 +932,9 @@ QWheelEvent::~QWheelEvent()
that are less than 120 units (less than 15 degrees). To support this that are less than 120 units (less than 15 degrees). To support this
possibility, you can either cumulatively add the delta values from events possibility, you can either cumulatively add the delta values from events
until the value of 120 is reached, then scroll the widget, or you can until the value of 120 is reached, then scroll the widget, or you can
partially scroll the widget in response to each wheel event. partially scroll the widget in response to each wheel event. But to
provide a more native feel, you should prefer \l pixelDelta() on platforms
where it's available.
Example: Example:
@ -937,6 +945,8 @@ QWheelEvent::~QWheelEvent()
\li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
\endlist \endlist
\see pixelDelta()
*/ */
/*! /*!

View File

@ -207,7 +207,12 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
charFmt.setFontWeight(QFont::Bold); charFmt.setFontWeight(QFont::Bold);
blockFmt.setHeadingLevel(int(detail->level)); blockFmt.setHeadingLevel(int(detail->level));
m_needsInsertBlock = false; m_needsInsertBlock = false;
m_cursor->insertBlock(blockFmt, charFmt); if (m_doc->isEmpty()) {
m_cursor->setBlockFormat(blockFmt);
m_cursor->setCharFormat(charFmt);
} else {
m_cursor->insertBlock(blockFmt, charFmt);
}
qCDebug(lcMD, "H%d", detail->level); qCDebug(lcMD, "H%d", detail->level);
} break; } break;
case MD_BLOCK_LI: { case MD_BLOCK_LI: {
@ -592,7 +597,12 @@ void QTextMarkdownImporter::insertBlock()
blockFormat.setMarker(m_markerType); blockFormat.setMarker(m_markerType);
if (!m_listStack.isEmpty()) if (!m_listStack.isEmpty())
blockFormat.setIndent(m_listStack.count()); blockFormat.setIndent(m_listStack.count());
m_cursor->insertBlock(blockFormat, charFormat); if (m_doc->isEmpty()) {
m_cursor->setBlockFormat(blockFormat);
m_cursor->setCharFormat(charFormat);
} else {
m_cursor->insertBlock(blockFormat, charFormat);
}
if (m_needsInsertList) { if (m_needsInsertList) {
m_listStack.push(m_cursor->createList(m_listFormat)); m_listStack.push(m_cursor->createList(m_listFormat));
} else if (!m_listStack.isEmpty() && m_listItem) { } else if (!m_listStack.isEmpty() && m_listItem) {

View File

@ -383,27 +383,6 @@ QHostInfo QHostInfo::fromName(const QString &name)
return hostInfo; return hostInfo;
} }
#ifndef QT_NO_BEARERMANAGEMENT
QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetworkSession> session)
{
#if defined QHOSTINFO_DEBUG
qDebug("QHostInfoPrivate::fromName(\"%s\") with session %p",name.toLatin1().constData(), session.data());
#endif
QHostInfo hostInfo = QHostInfoAgent::fromName(name, session);
QHostInfoLookupManager* manager = theHostInfoLookupManager();
manager->cache.put(name, hostInfo);
return hostInfo;
}
#endif
#ifndef QT_NO_BEARERMANAGEMENT
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
{
return QHostInfoAgent::fromName(hostName);
}
#endif
QHostInfo QHostInfoAgent::reverseLookup(const QHostAddress &address) QHostInfo QHostInfoAgent::reverseLookup(const QHostAddress &address)
{ {
QHostInfo results; QHostInfo results;

View File

@ -119,9 +119,6 @@ class QHostInfoAgent
{ {
public: public:
static QHostInfo fromName(const QString &hostName); static QHostInfo fromName(const QString &hostName);
#ifndef QT_NO_BEARERMANAGEMENT
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
#endif
private: private:
static QHostInfo lookup(const QString &hostName); static QHostInfo lookup(const QString &hostName);
static QHostInfo reverseLookup(const QHostAddress &address); static QHostInfo reverseLookup(const QHostAddress &address);
@ -136,10 +133,6 @@ public:
lookupId(0) lookupId(0)
{ {
} }
#ifndef QT_NO_BEARERMANAGEMENT
//not a public API yet
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
#endif
static int lookupHostImpl(const QString &name, static int lookupHostImpl(const QString &name,
const QObject *receiver, const QObject *receiver,
QtPrivate::QSlotObjectBase *slotObj, QtPrivate::QSlotObjectBase *slotObj,

View File

@ -2144,20 +2144,13 @@ bool QAbstractSocket::waitForConnected(int msecs)
#endif #endif
QHostInfo::abortHostLookup(d->hostLookupId); QHostInfo::abortHostLookup(d->hostLookupId);
d->hostLookupId = -1; d->hostLookupId = -1;
#ifndef QT_NO_BEARERMANAGEMENT QHostAddress temp;
if (networkSession) { if (temp.setAddress(d->hostName)) {
d->_q_startConnecting(QHostInfoPrivate::fromName(d->hostName, networkSession)); QHostInfo info;
} else info.setAddresses(QList<QHostAddress>() << temp);
#endif d->_q_startConnecting(info);
{ } else {
QHostAddress temp; d->_q_startConnecting(QHostInfo::fromName(d->hostName));
if (temp.setAddress(d->hostName)) {
QHostInfo info;
info.setAddresses(QList<QHostAddress>() << temp);
d->_q_startConnecting(info);
} else {
d->_q_startConnecting(QHostInfo::fromName(d->hostName));
}
} }
} }
if (state() == UnconnectedState) if (state() == UnconnectedState)

View File

@ -25,7 +25,6 @@ SOURCES += main.mm \
qcocoaclipboard.mm \ qcocoaclipboard.mm \
qcocoadrag.mm \ qcocoadrag.mm \
qmacclipboard.mm \ qmacclipboard.mm \
qcocoasystemsettings.mm \
qcocoainputcontext.mm \ qcocoainputcontext.mm \
qcocoaservices.mm \ qcocoaservices.mm \
qcocoasystemtrayicon.mm \ qcocoasystemtrayicon.mm \
@ -59,7 +58,6 @@ HEADERS += qcocoaintegration.h \
qcocoaclipboard.h \ qcocoaclipboard.h \
qcocoadrag.h \ qcocoadrag.h \
qmacclipboard.h \ qmacclipboard.h \
qcocoasystemsettings.h \
qcocoainputcontext.h \ qcocoainputcontext.h \
qcocoaservices.h \ qcocoaservices.h \
qcocoasystemtrayicon.h \ qcocoasystemtrayicon.h \

View File

@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QCOCOASYSTEMSETTINGS_H
#define QCOCOASYSTEMSETTINGS_H
#include <QtCore/qhash.h>
#include <QtGui/qpalette.h>
#include <qpa/qplatformtheme.h>
QT_BEGIN_NAMESPACE
QPalette * qt_mac_createSystemPalette();
QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes();
QT_END_NAMESPACE
#endif

View File

@ -1,245 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qcocoasystemsettings.h"
#include "qcocoahelpers.h"
#include <QtCore/private/qcore_mac_p.h>
#include <QtGui/qfont.h>
#include <QtGui/private/qcoregraphics_p.h>
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
@interface NSColor (MojaveForwardDeclarations)
@property (class, strong, readonly) NSColor *selectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSArray<NSColor *> *alternatingContentBackgroundColors NS_AVAILABLE_MAC(10_14);
// Missing from non-Mojave SDKs, even if introduced in 10.10
@property (class, strong, readonly) NSColor *linkColor NS_AVAILABLE_MAC(10_10);
@end
#endif
QT_BEGIN_NAMESPACE
QPalette * qt_mac_createSystemPalette()
{
QColor qc;
// Standard palette initialization (copied from Qt 4 styles)
QBrush backgroundBrush = qt_mac_toQBrush([NSColor windowBackgroundColor]);
QColor background = backgroundBrush.color();
QColor light(background.lighter(110));
QColor dark(background.darker(160));
QColor mid(background.darker(140));
QPalette *palette = new QPalette(Qt::black, background, light, dark, mid, Qt::black, Qt::white);
palette->setBrush(QPalette::Window, backgroundBrush);
palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Text, dark);
palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush);
QBrush textBackgroundBrush = qt_mac_toQBrush([NSColor textBackgroundColor]);
palette->setBrush(QPalette::Active, QPalette::Base, textBackgroundBrush);
palette->setBrush(QPalette::Inactive, QPalette::Base, textBackgroundBrush);
palette->setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
palette->setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
palette->setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
// System palette initialization:
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
if (__builtin_available(macOS 10.14, *)) {
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
} else {
palette->setBrush(QPalette::Inactive, QPalette::Highlight, br);
palette->setBrush(QPalette::Disabled, QPalette::Highlight, br);
}
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
qc = qt_mac_toQColor([NSColor controlTextColor]);
palette->setColor(QPalette::Active, QPalette::Text, qc);
palette->setColor(QPalette::Active, QPalette::WindowText, qc);
palette->setColor(QPalette::Active, QPalette::HighlightedText, qc);
palette->setColor(QPalette::Inactive, QPalette::Text, qc);
palette->setColor(QPalette::Inactive, QPalette::WindowText, qc);
palette->setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
palette->setColor(QPalette::Disabled, QPalette::Text, qc);
palette->setColor(QPalette::Disabled, QPalette::WindowText, qc);
palette->setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
palette->setBrush(QPalette::ToolTipBase, qt_mac_toQBrush([NSColor controlColor]));
palette->setColor(QPalette::Normal, QPalette::Link, qt_mac_toQColor([NSColor linkColor]));
return palette;
}
struct QMacPaletteMap {
inline QMacPaletteMap(QPlatformTheme::Palette p, NSColor *a, NSColor *i) :
active(a), inactive(i), paletteRole(p) { }
NSColor *active;
NSColor *inactive;
QPlatformTheme::Palette paletteRole;
};
#define MAC_PALETTE_ENTRY(pal, active, inactive) \
QMacPaletteMap(pal, [NSColor active], [NSColor inactive])
static QMacPaletteMap mac_widget_colors[] = {
MAC_PALETTE_ENTRY(QPlatformTheme::ToolButtonPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ButtonPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::HeaderPalette, headerTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ComboBoxPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ItemViewPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MessageBoxLabelPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TabBarPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::LabelPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::GroupBoxPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MenuPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MenuBarPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TextEditPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TextLineEditPalette, textColor, disabledControlTextColor)
};
#undef MAC_PALETTE_ENTRY
static const int mac_widget_colors_count = sizeof(mac_widget_colors) / sizeof(mac_widget_colors[0]);
QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
{
QHash<QPlatformTheme::Palette, QPalette*> palettes;
QColor qc;
for (int i = 0; i < mac_widget_colors_count; i++) {
QPalette &pal = *qt_mac_createSystemPalette();
if (mac_widget_colors[i].active) {
qc = qt_mac_toQColor(mac_widget_colors[i].active);
pal.setColor(QPalette::Active, QPalette::Text, qc);
pal.setColor(QPalette::Inactive, QPalette::Text, qc);
pal.setColor(QPalette::Active, QPalette::WindowText, qc);
pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Active, QPalette::ButtonText, qc);
pal.setColor(QPalette::Inactive, QPalette::ButtonText, qc);
qc = qt_mac_toQColor(mac_widget_colors[i].inactive);
pal.setColor(QPalette::Disabled, QPalette::Text, qc);
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Disabled, QPalette::ButtonText, qc);
}
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
NSColor *selectedMenuItemColor = nil;
if (__builtin_available(macOS 10.14, *)) {
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
selectedMenuItemColor = [[NSColor selectedContentBackgroundColor] highlightWithLevel:0.4];
} else {
// selectedMenuItemColor would presumably be the correct color to use as the background
// for selected menu items. But that color is always blue, and doesn't follow the
// appearance color in system preferences. So we therefore deliberatly choose to use
// keyboardFocusIndicatorColor instead, which appears to have the same color value.
selectedMenuItemColor = [NSColor keyboardFocusIndicatorColor];
}
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
qc = qt_mac_toQColor([NSColor labelColor]);
pal.setBrush(QPalette::ButtonText, qc);
pal.setBrush(QPalette::Text, qc);
qc = qt_mac_toQColor([NSColor selectedMenuItemTextColor]);
pal.setBrush(QPalette::HighlightedText, qc);
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
pal.setBrush(QPalette::Disabled, QPalette::Text, qc);
} else if ((mac_widget_colors[i].paletteRole == QPlatformTheme::ButtonPalette)
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::HeaderPalette)
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::TabBarPalette)) {
pal.setColor(QPalette::Disabled, QPalette::ButtonText,
pal.color(QPalette::Disabled, QPalette::Text));
pal.setColor(QPalette::Inactive, QPalette::ButtonText,
pal.color(QPalette::Inactive, QPalette::Text));
pal.setColor(QPalette::Active, QPalette::ButtonText,
pal.color(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
NSArray<NSColor *> *baseColors = nil;
NSColor *activeHighlightColor = nil;
if (__builtin_available(macOS 10.14, *)) {
baseColors = [NSColor alternatingContentBackgroundColors];
activeHighlightColor = [NSColor selectedContentBackgroundColor];
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
} else {
baseColors = [NSColor controlAlternatingRowBackgroundColors];
activeHighlightColor = [NSColor alternateSelectedControlColor];
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
pal.brush(QPalette::Active, QPalette::Text));
}
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
pal.setBrush(QPalette::Active, QPalette::Highlight,
qt_mac_toQBrush(activeHighlightColor));
pal.setBrush(QPalette::Active, QPalette::HighlightedText,
qt_mac_toQBrush([NSColor alternateSelectedControlTextColor]));
pal.setBrush(QPalette::Inactive, QPalette::Text,
pal.brush(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextEditPalette) {
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
pal.setBrush(QPalette::Inactive, QPalette::Text,
pal.brush(QPalette::Active, QPalette::Text));
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
pal.brush(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextLineEditPalette
|| mac_widget_colors[i].paletteRole == QPlatformTheme::ComboBoxPalette) {
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
pal.setBrush(QPalette::Disabled, QPalette::Base,
pal.brush(QPalette::Active, QPalette::Base));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::LabelPalette) {
qc = qt_mac_toQColor([NSColor labelColor]);
pal.setBrush(QPalette::Inactive, QPalette::ToolTipText, qc);
}
palettes.insert(mac_widget_colors[i].paletteRole, &pal);
}
return palettes;
}
QT_END_NAMESPACE

View File

@ -45,7 +45,6 @@
#include <QtCore/QOperatingSystemVersion> #include <QtCore/QOperatingSystemVersion>
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include "qcocoasystemsettings.h"
#include "qcocoasystemtrayicon.h" #include "qcocoasystemtrayicon.h"
#include "qcocoamenuitem.h" #include "qcocoamenuitem.h"
#include "qcocoamenu.h" #include "qcocoamenu.h"
@ -80,8 +79,203 @@
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
@interface NSColor (MojaveForwardDeclarations)
@property (class, strong, readonly) NSColor *selectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSArray<NSColor *> *alternatingContentBackgroundColors NS_AVAILABLE_MAC(10_14);
// Missing from non-Mojave SDKs, even if introduced in 10.10
@property (class, strong, readonly) NSColor *linkColor NS_AVAILABLE_MAC(10_10);
@end
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static QPalette *qt_mac_createSystemPalette()
{
QColor qc;
// Standard palette initialization (copied from Qt 4 styles)
QBrush backgroundBrush = qt_mac_toQBrush([NSColor windowBackgroundColor]);
QColor background = backgroundBrush.color();
QColor light(background.lighter(110));
QColor dark(background.darker(160));
QColor mid(background.darker(140));
QPalette *palette = new QPalette(Qt::black, background, light, dark, mid, Qt::black, Qt::white);
palette->setBrush(QPalette::Window, backgroundBrush);
palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Text, dark);
palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush);
QBrush textBackgroundBrush = qt_mac_toQBrush([NSColor textBackgroundColor]);
palette->setBrush(QPalette::Active, QPalette::Base, textBackgroundBrush);
palette->setBrush(QPalette::Inactive, QPalette::Base, textBackgroundBrush);
palette->setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
palette->setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
palette->setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
// System palette initialization:
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
if (__builtin_available(macOS 10.14, *)) {
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
} else {
palette->setBrush(QPalette::Inactive, QPalette::Highlight, br);
palette->setBrush(QPalette::Disabled, QPalette::Highlight, br);
}
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
qc = qt_mac_toQColor([NSColor controlTextColor]);
palette->setColor(QPalette::Active, QPalette::Text, qc);
palette->setColor(QPalette::Active, QPalette::WindowText, qc);
palette->setColor(QPalette::Active, QPalette::HighlightedText, qc);
palette->setColor(QPalette::Inactive, QPalette::Text, qc);
palette->setColor(QPalette::Inactive, QPalette::WindowText, qc);
palette->setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
palette->setColor(QPalette::Disabled, QPalette::Text, qc);
palette->setColor(QPalette::Disabled, QPalette::WindowText, qc);
palette->setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
palette->setBrush(QPalette::ToolTipBase, qt_mac_toQBrush([NSColor controlColor]));
palette->setColor(QPalette::Normal, QPalette::Link, qt_mac_toQColor([NSColor linkColor]));
return palette;
}
struct QMacPaletteMap {
inline QMacPaletteMap(QPlatformTheme::Palette p, NSColor *a, NSColor *i) :
active(a), inactive(i), paletteRole(p) { }
NSColor *active;
NSColor *inactive;
QPlatformTheme::Palette paletteRole;
};
#define MAC_PALETTE_ENTRY(pal, active, inactive) \
QMacPaletteMap(pal, [NSColor active], [NSColor inactive])
static QMacPaletteMap mac_widget_colors[] = {
MAC_PALETTE_ENTRY(QPlatformTheme::ToolButtonPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ButtonPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::HeaderPalette, headerTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ComboBoxPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::ItemViewPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MessageBoxLabelPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TabBarPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::LabelPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::GroupBoxPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MenuPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::MenuBarPalette, controlTextColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TextEditPalette, textColor, disabledControlTextColor),
MAC_PALETTE_ENTRY(QPlatformTheme::TextLineEditPalette, textColor, disabledControlTextColor)
};
#undef MAC_PALETTE_ENTRY
static const int mac_widget_colors_count = sizeof(mac_widget_colors) / sizeof(mac_widget_colors[0]);
static QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
{
QHash<QPlatformTheme::Palette, QPalette*> palettes;
QColor qc;
for (int i = 0; i < mac_widget_colors_count; i++) {
QPalette &pal = *qt_mac_createSystemPalette();
if (mac_widget_colors[i].active) {
qc = qt_mac_toQColor(mac_widget_colors[i].active);
pal.setColor(QPalette::Active, QPalette::Text, qc);
pal.setColor(QPalette::Inactive, QPalette::Text, qc);
pal.setColor(QPalette::Active, QPalette::WindowText, qc);
pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Active, QPalette::ButtonText, qc);
pal.setColor(QPalette::Inactive, QPalette::ButtonText, qc);
qc = qt_mac_toQColor(mac_widget_colors[i].inactive);
pal.setColor(QPalette::Disabled, QPalette::Text, qc);
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Disabled, QPalette::ButtonText, qc);
}
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
NSColor *selectedMenuItemColor = nil;
if (__builtin_available(macOS 10.14, *)) {
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
selectedMenuItemColor = [[NSColor selectedContentBackgroundColor] highlightWithLevel:0.4];
} else {
// selectedMenuItemColor would presumably be the correct color to use as the background
// for selected menu items. But that color is always blue, and doesn't follow the
// appearance color in system preferences. So we therefore deliberatly choose to use
// keyboardFocusIndicatorColor instead, which appears to have the same color value.
selectedMenuItemColor = [NSColor keyboardFocusIndicatorColor];
}
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
qc = qt_mac_toQColor([NSColor labelColor]);
pal.setBrush(QPalette::ButtonText, qc);
pal.setBrush(QPalette::Text, qc);
qc = qt_mac_toQColor([NSColor selectedMenuItemTextColor]);
pal.setBrush(QPalette::HighlightedText, qc);
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
pal.setBrush(QPalette::Disabled, QPalette::Text, qc);
} else if ((mac_widget_colors[i].paletteRole == QPlatformTheme::ButtonPalette)
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::HeaderPalette)
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::TabBarPalette)) {
pal.setColor(QPalette::Disabled, QPalette::ButtonText,
pal.color(QPalette::Disabled, QPalette::Text));
pal.setColor(QPalette::Inactive, QPalette::ButtonText,
pal.color(QPalette::Inactive, QPalette::Text));
pal.setColor(QPalette::Active, QPalette::ButtonText,
pal.color(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
NSArray<NSColor *> *baseColors = nil;
NSColor *activeHighlightColor = nil;
if (__builtin_available(macOS 10.14, *)) {
baseColors = [NSColor alternatingContentBackgroundColors];
activeHighlightColor = [NSColor selectedContentBackgroundColor];
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
} else {
baseColors = [NSColor controlAlternatingRowBackgroundColors];
activeHighlightColor = [NSColor alternateSelectedControlColor];
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
pal.brush(QPalette::Active, QPalette::Text));
}
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
pal.setBrush(QPalette::Active, QPalette::Highlight,
qt_mac_toQBrush(activeHighlightColor));
pal.setBrush(QPalette::Active, QPalette::HighlightedText,
qt_mac_toQBrush([NSColor alternateSelectedControlTextColor]));
pal.setBrush(QPalette::Inactive, QPalette::Text,
pal.brush(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextEditPalette) {
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
pal.setBrush(QPalette::Inactive, QPalette::Text,
pal.brush(QPalette::Active, QPalette::Text));
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
pal.brush(QPalette::Active, QPalette::Text));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextLineEditPalette
|| mac_widget_colors[i].paletteRole == QPlatformTheme::ComboBoxPalette) {
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
pal.setBrush(QPalette::Disabled, QPalette::Base,
pal.brush(QPalette::Active, QPalette::Base));
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::LabelPalette) {
qc = qt_mac_toQColor([NSColor labelColor]);
pal.setBrush(QPalette::Inactive, QPalette::ToolTipText, qc);
}
palettes.insert(mac_widget_colors[i].paletteRole, &pal);
}
return palettes;
}
const char *QCocoaTheme::name = "cocoa"; const char *QCocoaTheme::name = "cocoa";
QCocoaTheme::QCocoaTheme() QCocoaTheme::QCocoaTheme()

View File

@ -198,7 +198,9 @@ void QWasmClipboard::installEventHandlers(const QString &canvasId)
return; return;
// Fallback path for browsers which do not support direct clipboard access // Fallback path for browsers which do not support direct clipboard access
val canvas = val::global(canvasId.toUtf8().constData()); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.toUtf8().constData()));
canvas.call<void>("addEventListener", std::string("cut"), canvas.call<void>("addEventListener", std::string("cut"),
val::module_property("qtClipboardCutTo")); val::module_property("qtClipboardCutTo"));
canvas.call<void>("addEventListener", std::string("copy"), canvas.call<void>("addEventListener", std::string("copy"),

View File

@ -36,6 +36,8 @@
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#include <emscripten/bind.h> #include <emscripten/bind.h>
using namespace emscripten;
void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window) void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
{ {
if (!windowCursor || !window) if (!windowCursor || !window)
@ -54,8 +56,10 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
htmlCursorName = "auto"; htmlCursorName = "auto";
// Set cursor on the canvas // Set cursor on the canvas
QString canvasId = QWasmScreen::get(screen)->canvasId(); QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8();
emscripten::val canvasStyle = emscripten::val::global(canvasId.toUtf8().constData())["style"]; val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.constData()));
val canvasStyle = canvas["style"];
canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData())); canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData()));
} }

View File

@ -47,9 +47,10 @@
#include <iostream> #include <iostream>
QT_BEGIN_NAMESPACE
using namespace emscripten; using namespace emscripten;
QT_BEGIN_NAMESPACE
typedef struct emkb2qt { typedef struct emkb2qt {
const char *em; const char *em;
unsigned int qt; unsigned int qt;
@ -353,10 +354,11 @@ void QWasmEventTranslator::initEventHandlers()
g_useNaturalScrolling = false; // make this !default on macOS g_useNaturalScrolling = false; // make this !default on macOS
if (emscripten::val::global("window")["safari"].isUndefined()) { if (emscripten::val::global("window")["safari"].isUndefined()) {
val document = val::global("document");
emscripten::val::global(canvasId).call<void>("addEventListener", val canvas = document.call<val>("getElementById", val(canvasId));
std::string("wheel"), canvas.call<void>("addEventListener",
val::module_property("qtMouseWheelEvent")); std::string("wheel"),
val::module_property("qtMouseWheelEvent"));
} }
} }

View File

@ -106,7 +106,7 @@ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QWasmOpenGLContext::createEmscriptenContext(cons
attributes.depth = useDepthStencil; attributes.depth = useDepthStencil;
attributes.stencil = useDepthStencil; attributes.stencil = useDepthStencil;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvasId.toLocal8Bit().constData(), &attributes); EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvasId.toUtf8().constData(), &attributes);
return context; return context;
} }

View File

@ -44,6 +44,7 @@
#include <QtGui/qguiapplication.h> #include <QtGui/qguiapplication.h>
#include <private/qhighdpiscaling_p.h> #include <private/qhighdpiscaling_p.h>
using namespace emscripten;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -184,13 +185,15 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
QSizeF cssSize(css_width, css_height); QSizeF cssSize(css_width, css_height);
QSizeF canvasSize = cssSize * devicePixelRatio(); QSizeF canvasSize = cssSize * devicePixelRatio();
emscripten::val canvas = emscripten::val::global(canvasId.constData()); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.constData()));
canvas.set("width", canvasSize.width()); canvas.set("width", canvasSize.width());
canvas.set("height", canvasSize.height()); canvas.set("height", canvasSize.height());
QPoint offset; QPoint offset;
offset.setX(emscripten::val::global(canvasId.constData())["offsetTop"].as<int>()); offset.setX(canvas["offsetTop"].as<int>());
offset.setY(emscripten::val::global(canvasId.constData())["offsetLeft"].as<int>()); offset.setY(canvas["offsetLeft"].as<int>());
emscripten::val rect = canvas.call<emscripten::val>("getBoundingClientRect"); emscripten::val rect = canvas.call<emscripten::val>("getBoundingClientRect");
QPoint position(rect["left"].as<int>() - offset.x(), rect["top"].as<int>() - offset.y()); QPoint position(rect["left"].as<int>() - offset.x(), rect["top"].as<int>() - offset.y());

View File

@ -604,15 +604,12 @@ QString QWindowsContext::registerWindowClass(QString cname,
// each one has to have window class names with a unique name // each one has to have window class names with a unique name
// The first instance gets the unmodified name; if the class // The first instance gets the unmodified name; if the class
// has already been registered by another instance of Qt then // has already been registered by another instance of Qt then
// add a UUID. // add a UUID. The check needs to be performed for each name
static int classExists = -1; // in case new message windows are added (QTBUG-81347).
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr)); const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
if (classExists == -1) { WNDCLASS wcinfo;
WNDCLASS wcinfo; const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE
classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo); && wcinfo.lpfnWndProc != proc;
classExists = classExists && wcinfo.lpfnWndProc != proc;
}
if (classExists) if (classExists)
cname += QUuid::createUuid().toString(); cname += QUuid::createUuid().toString();

View File

@ -52,6 +52,8 @@
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h> #include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h>
#include <QtCore/private/qwinregistry_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace QWindowsUiAutomation; using namespace QWindowsUiAutomation;
@ -85,12 +87,63 @@ bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARA
return false; return false;
} }
// Retrieve sound name by checking the icon property of a message box
// should it be the event object.
static QString alertSound(const QObject *object)
{
if (object->inherits("QMessageBox")) {
enum MessageBoxIcon { // Keep in sync with QMessageBox::Icon
Information = 1,
Warning = 2,
Critical = 3
};
switch (object->property("icon").toInt()) {
case Information:
return QStringLiteral("SystemAsterisk");
case Warning:
return QStringLiteral("SystemExclamation");
case Critical:
return QStringLiteral("SystemHand");
}
}
return QStringLiteral("SystemAsterisk");
}
static QString soundFileName(const QString &soundName)
{
const QString key = QStringLiteral("AppEvents\\Schemes\\Apps\\.Default\\")
+ soundName + QStringLiteral("\\.Current");
return QWinRegistryKey(HKEY_CURRENT_USER, key).stringValue(L"");
}
static void playSystemSound(const QString &soundName)
{
if (!soundName.isEmpty() && !soundFileName(soundName).isEmpty()) {
PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), nullptr,
SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
}
}
// Handles accessibility update notifications. // Handles accessibility update notifications.
void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{ {
if (!event) if (!event)
return; return;
switch (event->type()) {
case QAccessible::PopupMenuStart:
playSystemSound(QStringLiteral("MenuPopup"));
break;
case QAccessible::MenuCommand:
playSystemSound(QStringLiteral("MenuCommand"));
break;
case QAccessible::Alert:
playSystemSound(alertSound(event->object()));
break;
default:
break;
}
QAccessibleInterface *accessible = event->accessibleInterface(); QAccessibleInterface *accessible = event->accessibleInterface();
if (!isActive() || !accessible || !accessible->isValid()) if (!isActive() || !accessible || !accessible->isValid())
return; return;

View File

@ -102,9 +102,9 @@
\since 5.14 \since 5.14
Constructs a new QSignalSpy that listens for emissions of the \a signal Constructs a new QSignalSpy that listens for emissions of the \a signal
from the QObject \a object. If QSignalSpy is not able to listen for a from the QObject \a obj. If QSignalSpy is not able to listen for a
valid signal (for example, because \a object is \nullptr or \a signal does valid signal (for example, because \a obj is \nullptr or \a signal does
not denote a valid signal of \a object), an explanatory warning message not denote a valid signal of \a obj), an explanatory warning message
will be output using qWarning() and subsequent calls to \c isValid() will will be output using qWarning() and subsequent calls to \c isValid() will
return false. return false.

View File

@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
static const char *standardImports = static const char *standardImports =
R"I(from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, R"I(from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint,
QRect, QSize, QUrl, Qt) QRect, QSize, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont, from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap,
QRadialGradient) QRadialGradient)
from PySide2.QtWidgets import * from PySide2.QtWidgets import *
@ -114,11 +114,29 @@ void WriteImports::acceptCustomWidget(DomCustomWidget *node)
const auto &className = node->elementClass(); const auto &className = node->elementClass();
if (className.contains(QLatin1String("::"))) if (className.contains(QLatin1String("::")))
return; // Exclude namespaced names (just to make tests pass). return; // Exclude namespaced names (just to make tests pass).
const QString &qtModule = qtModuleOf(node); const QString &importModule = qtModuleOf(node);
auto &output = m_uic->output(); auto &output = m_uic->output();
if (!qtModule.isEmpty()) // For starting importing PySide2 modules
output << "from PySide2." << qtModule << ' '; if (!importModule.isEmpty()) {
output << "import " << className << '\n'; output << "from ";
if (importModule.startsWith(QLatin1String("Qt")))
output << "PySide2.";
output << importModule;
if (!className.isEmpty())
output << " import " << className << "\n\n";
} else {
// When the elementHeader is not set, we know it's the continuation
// of a PySide2 import or a normal import of another module.
if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) {
output << "import " << className << '\n';
} else { // When we do have elementHeader, we know it's a relative import.
QString modulePath = node->elementHeader()->text();
// '.h' is added by default on headers for <customwidget>
if (modulePath.endsWith(QLatin1String(".h")))
modulePath.chop(2);
output << "from " << modulePath << " import " << className << '\n';
}
}
} }
} // namespace Python } // namespace Python

View File

@ -2378,7 +2378,8 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
This function is used to access local files on Qt for WebAssembly, where the web This function is used to access local files on Qt for WebAssembly, where the web
sandbox places restrictions on how such access may happen. Its implementation will sandbox places restrictions on how such access may happen. Its implementation will
make the browser display a native file dialog, where the user makes the file selection. make the browser display a native file dialog, where the user makes the file selection
based on the parameter \a nameFilter.
It can also be used on other platforms, where it will fall back to using QFileDialog. It can also be used on other platforms, where it will fall back to using QFileDialog.

View File

@ -1213,7 +1213,8 @@ QMimeData *QFileSystemModel::mimeData(const QModelIndexList &indexes) const
/*! /*!
Handles the \a data supplied by a drag and drop operation that ended with Handles the \a data supplied by a drag and drop operation that ended with
the given \a action over the row in the model specified by the \a row and the given \a action over the row in the model specified by the \a row and
\a column and by the \a parent index. \a column and by the \a parent index. Returns true if the operation was
successful.
\sa supportedDropActions() \sa supportedDropActions()
*/ */

View File

@ -5952,7 +5952,11 @@ void QWidget::setWindowTitle(const QString &title)
has been set, windowIcon() returns the application icon has been set, windowIcon() returns the application icon
(QApplication::windowIcon()). (QApplication::windowIcon()).
\sa windowTitle \note On \macos, window icons represent the active document,
and will not be displayed unless a file path has also been
set using setFilePath.
\sa windowTitle, setFilePath
*/ */
QIcon QWidget::windowIcon() const QIcon QWidget::windowIcon() const
{ {

View File

@ -497,14 +497,20 @@ bool QScrollBar::event(QEvent *event)
void QScrollBar::wheelEvent(QWheelEvent *event) void QScrollBar::wheelEvent(QWheelEvent *event)
{ {
event->ignore(); event->ignore();
bool horizontal = qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y());
// The vertical wheel can be used to scroll a horizontal scrollbar, but only if
// there is no simultaneous horizontal wheel movement. This is to avoid chaotic
// scrolling on touchpads.
if (!horizontal && event->angleDelta().x() != 0 && orientation() == Qt::Horizontal)
return;
// scrollbar is a special case - in vertical mode it reaches minimum // scrollbar is a special case - in vertical mode it reaches minimum
// value in the upper position, however QSlider's minimum value is on // value in the upper position, however QSlider's minimum value is on
// the bottom. So we need to invert the value, but since the scrollbar is // the bottom. So we need to invert the value, but since the scrollbar is
// inverted by default, we need to invert the delta value only for the // inverted by default, we need to invert the delta value only for the
// horizontal orientation. // horizontal orientation.
int delta = (orientation() == Qt::Horizontal ? -event->angleDelta().x() : event->angleDelta().y()); int delta = horizontal ? -event->angleDelta().x() : event->angleDelta().y();
Q_D(QScrollBar); Q_D(QScrollBar);
if (d->scrollByDelta(orientation(), event->modifiers(), delta)) if (d->scrollByDelta(horizontal ? Qt::Horizontal : Qt::Vertical, event->modifiers(), delta))
event->accept(); event->accept();
if (event->phase() == Qt::ScrollBegin) if (event->phase() == Qt::ScrollBegin)

View File

@ -0,0 +1,5 @@
<RCC version="1.0">
<qresource>
<file>zero.txt</file>
</qresource>
</RCC>

View File

@ -0,0 +1,7 @@
#!/bin/sh
count=`awk '/ZERO_FILE_LEN/ { print $3 }' tst_qresourceengine.cpp`
dd if=/dev/zero of=zero.txt bs=1 count=$count
rcc --binary -o uncompressed.rcc --no-compress compressed.qrc
rcc --binary -o zlib.rcc --compress-algo zlib --compress 9 compressed.qrc
rcc --binary -o zstd.rcc --compress-algo zstd --compress 19 compressed.qrc
rm zero.txt

View File

@ -1,7 +1,7 @@
CONFIG += testcase CONFIG += testcase
TARGET = tst_qresourceengine TARGET = tst_qresourceengine
QT = core testlib QT = core-private testlib
SOURCES = tst_qresourceengine.cpp SOURCES = tst_qresourceengine.cpp
RESOURCES += testqrc/test.qrc RESOURCES += testqrc/test.qrc
@ -15,7 +15,8 @@ QMAKE_DISTCLEAN += $${runtime_resource.target}
TESTDATA += \ TESTDATA += \
parentdir.txt \ parentdir.txt \
testqrc/* testqrc/* \
*.rcc
GENERATED_TESTDATA = $${runtime_resource.target} GENERATED_TESTDATA = $${runtime_resource.target}
android:!android-embedded { android:!android-embedded {

View File

@ -27,9 +27,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QScopeGuard>
#include <QtCore/private/qglobal_p.h>
class tst_QResourceEngine: public QObject class tst_QResourceEngine: public QObject
{ {
@ -50,6 +51,8 @@ private slots:
void checkUnregisterResource_data(); void checkUnregisterResource_data();
void checkUnregisterResource(); void checkUnregisterResource();
void compressedResource_data();
void compressedResource();
void checkStructure_data(); void checkStructure_data();
void checkStructure(); void checkStructure();
void searchPath_data(); void searchPath_data();
@ -105,6 +108,75 @@ void tst_QResourceEngine::cleanupTestCase()
QVERIFY(QResource::unregisterResource(m_runtimeResourceRcc, "/secondary_root/")); QVERIFY(QResource::unregisterResource(m_runtimeResourceRcc, "/secondary_root/"));
} }
void tst_QResourceEngine::compressedResource_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("compressionAlgo");
QTest::addColumn<bool>("supported");
QTest::newRow("uncompressed")
<< QFINDTESTDATA("uncompressed.rcc") << int(QResource::NoCompression) << true;
QTest::newRow("zlib")
<< QFINDTESTDATA("zlib.rcc") << int(QResource::ZlibCompression) << true;
QTest::newRow("zstd")
<< QFINDTESTDATA("zstd.rcc") << int(QResource::ZstdCompression) << QT_CONFIG(zstd);
}
// Note: generateResource.sh parses this line. Make sure it's a simple number.
#define ZERO_FILE_LEN 16384
// End note
void tst_QResourceEngine::compressedResource()
{
QFETCH(QString, fileName);
QFETCH(int, compressionAlgo);
QFETCH(bool, supported);
const QByteArray expectedData(ZERO_FILE_LEN, '\0');
QVERIFY(!QResource("zero.txt").isValid());
QCOMPARE(QResource::registerResource(fileName), supported);
if (!supported)
return;
auto unregister = qScopeGuard([=] { QResource::unregisterResource(fileName); });
QResource resource("zero.txt");
QVERIFY(resource.isValid());
QVERIFY(resource.size() > 0);
QVERIFY(resource.data());
QCOMPARE(resource.compressionAlgorithm(), QResource::Compression(compressionAlgo));
if (compressionAlgo == QResource::NoCompression) {
QCOMPARE(resource.size(), ZERO_FILE_LEN);
QCOMPARE(memcmp(resource.data(), expectedData.data(), ZERO_FILE_LEN), 0);
// API guarantees it will be QByteArray::fromRawData:
QCOMPARE(static_cast<const void *>(resource.uncompressedData().constData()),
static_cast<const void *>(resource.data()));
} else {
// reasonable expectation:
QVERIFY(resource.size() < ZERO_FILE_LEN);
}
// using the engine
QFile f(":/zero.txt");
QVERIFY(f.exists());
QVERIFY(f.open(QIODevice::ReadOnly));
// verify that we can decompress correctly
QCOMPARE(resource.uncompressedSize(), ZERO_FILE_LEN);
QCOMPARE(f.size(), ZERO_FILE_LEN);
QByteArray data = resource.uncompressedData();
QCOMPARE(data.size(), expectedData.size());
QCOMPARE(data, expectedData);
// decompression through the engine
data = f.readAll();
QCOMPARE(data.size(), expectedData.size());
QCOMPARE(data, expectedData);
}
void tst_QResourceEngine::checkStructure_data() void tst_QResourceEngine::checkStructure_data()
{ {
QTest::addColumn<QString>("pathName"); QTest::addColumn<QString>("pathName");
@ -140,7 +212,13 @@ void tst_QResourceEngine::checkStructure_data()
<< "parentdir.txt" << "parentdir.txt"
<< "runtime_resource.rcc" << "runtime_resource.rcc"
#endif #endif
<< "search_file.txt") << "search_file.txt"
#if defined(BUILTIN_TESTDATA)
<< "uncompressed.rcc"
<< "zlib.rcc"
<< "zstd.rcc"
#endif
)
<< rootContents << rootContents
<< QLocale::c() << QLocale::c()
<< qlonglong(0); << qlonglong(0);

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -88,7 +88,7 @@ private slots:
void toStringDateFormat(); void toStringDateFormat();
void isLeapYear(); void isLeapYear();
void yearsZeroToNinetyNine(); void yearsZeroToNinetyNine();
void negativeYear() const; void printNegativeYear_data() const;
void printNegativeYear() const; void printNegativeYear() const;
void roundtripGermanLocale() const; void roundtripGermanLocale() const;
#if QT_CONFIG(textdate) && QT_DEPRECATED_SINCE(5, 10) #if QT_CONFIG(textdate) && QT_DEPRECATED_SINCE(5, 10)
@ -1458,33 +1458,28 @@ void tst_QDate::yearsZeroToNinetyNine()
} }
} }
void tst_QDate::printNegativeYear_data() const
void tst_QDate::negativeYear() const
{ {
QDate y(-20, 3, 4); QTest::addColumn<int>("year");
QVERIFY(y.isValid()); QTest::addColumn<QString>("expect");
QCOMPARE(y.year(), -20); QTest::newRow("millennium") << -1000 << QStringLiteral("-1000");
QTest::newRow("century") << -500 << QStringLiteral("-0500");
QTest::newRow("decade") << -20 << QStringLiteral("-0020");
QTest::newRow("year") << -7 << QStringLiteral("-0007");
} }
void tst_QDate::printNegativeYear() const void tst_QDate::printNegativeYear() const
{ {
{ QFETCH(int, year);
QDate date(-500, 3, 4); QFETCH(QString, expect);
QVERIFY(date.isValid()); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0500")); expect.replace(QLatin1Char('-'), QLocale().negativeSign());
} #endif
{ QDate date(year, 3, 4);
QDate date(-10, 3, 4); QVERIFY(date.isValid());
QVERIFY(date.isValid()); QCOMPARE(date.year(), year);
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0010")); QCOMPARE(date.toString(QLatin1String("yyyy")), expect);
}
{
QDate date(-2, 3, 4);
QVERIFY(date.isValid());
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0002"));
}
} }
void tst_QDate::roundtripGermanLocale() const void tst_QDate::roundtripGermanLocale() const

View File

@ -55,12 +55,13 @@ private slots:
void thematicBreaks(); void thematicBreaks();
void lists_data(); void lists_data();
void lists(); void lists();
void avoidBlankLineAtBeginning_data();
void avoidBlankLineAtBeginning();
}; };
void tst_QTextMarkdownImporter::headingBulletsContinuations() void tst_QTextMarkdownImporter::headingBulletsContinuations()
{ {
const QStringList expectedBlocks = QStringList() << const QStringList expectedBlocks = QStringList() <<
"" << // we could do without this blank line before the heading, but currently it happens
"heading" << "heading" <<
"bullet 1 continuation line 1, indented via tab" << "bullet 1 continuation line 1, indented via tab" <<
"bullet 2 continuation line 2, indented via 4 spaces" << "bullet 2 continuation line 2, indented via 4 spaces" <<
@ -222,5 +223,38 @@ void tst_QTextMarkdownImporter::lists()
QCOMPARE(doc.toMarkdown(), rewrite); QCOMPARE(doc.toMarkdown(), rewrite);
} }
void tst_QTextMarkdownImporter::avoidBlankLineAtBeginning_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<int>("expectedNumberOfParagraphs");
QTest::newRow("Text block") << QString("Markdown text") << 1;
QTest::newRow("Headline") << QString("Markdown text\n============") << 1;
QTest::newRow("Code block") << QString(" Markdown text") << 2;
QTest::newRow("Unordered list") << QString("* Markdown text") << 1;
QTest::newRow("Ordered list") << QString("1. Markdown text") << 1;
QTest::newRow("Blockquote") << QString("> Markdown text") << 1;
}
void tst_QTextMarkdownImporter::avoidBlankLineAtBeginning() // QTBUG-81060
{
QFETCH(QString, input);
QFETCH(int, expectedNumberOfParagraphs);
QTextDocument doc;
QTextMarkdownImporter(QTextMarkdownImporter::DialectGitHub).import(&doc, input);
QTextFrame::iterator iterator = doc.rootFrame()->begin();
int i = 0;
while (!iterator.atEnd()) {
QTextBlock block = iterator.currentBlock();
// Make sure there is no empty paragraph at the beginning of the document
if (i == 0)
QVERIFY(!block.text().isEmpty());
++iterator;
++i;
}
QCOMPARE(i, expectedNumberOfParagraphs);
}
QTEST_MAIN(tst_QTextMarkdownImporter) QTEST_MAIN(tst_QTextMarkdownImporter)
#include "tst_qtextmarkdownimporter.moc" #include "tst_qtextmarkdownimporter.moc"

View File

@ -215,7 +215,8 @@ void tst_QFtp::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT
QNetworkConfigurationManager manager; QNetworkConfigurationManager manager;

View File

@ -105,7 +105,8 @@ void tst_QHttpNetworkConnection::initTestCase()
#if defined(QT_TEST_SERVER) #if defined(QT_TEST_SERVER)
QVERIFY(QtNetworkSettings::verifyConnection(httpServerName(), 80)); QVERIFY(QtNetworkSettings::verifyConnection(httpServerName(), 80));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif #endif
} }

View File

@ -1,5 +1,6 @@
TEMPLATE=subdirs TEMPLATE=subdirs
SUBDIRS=\ SUBDIRS=\
selftest \
access \ access \
bearer \ bearer \
kernel \ kernel \

View File

@ -0,0 +1,6 @@
CONFIG += testcase
TARGET = tst_networkselftest
SOURCES += tst_networkselftest.cpp
requires(qtConfig(private_tests))
QT = core network network-private testlib

View File

@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
#include "../../network-settings.h"
class tst_NetworkSelftest : public QObject
{
Q_OBJECT
private slots:
void testServerIsAvailableInCI();
};
void tst_NetworkSelftest::testServerIsAvailableInCI()
{
if (!qEnvironmentVariable("QTEST_ENVIRONMENT").split(' ').contains("ci"))
QSKIP("Not running in the CI");
#if !defined(QT_TEST_SERVER)
QVERIFY2(QtNetworkSettings::verifyTestNetworkSettings(),
"Test server must be available when running in the CI");
#endif
}
QTEST_MAIN(tst_NetworkSelftest)
#include "tst_networkselftest.moc"

View File

@ -87,7 +87,8 @@ private slots:
void tst_PlatformSocketEngine::initTestCase() void tst_PlatformSocketEngine::initTestCase()
{ {
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -129,7 +129,8 @@ void tst_QHttpSocketEngine::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif #endif
} }

View File

@ -142,7 +142,8 @@ void tst_QSocks5SocketEngine::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif #endif
} }

View File

@ -358,7 +358,8 @@ void tst_QTcpSocket::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpServerName(), 21)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpServerName(), 21));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif #endif
} }

View File

@ -399,7 +399,8 @@ void tst_QSslSocket::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 993)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 993));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 13)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 13));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif // QT_TEST_SERVER #endif // QT_TEST_SERVER
#endif // QT_NO_SSL #endif // QT_NO_SSL
} }

View File

@ -109,7 +109,8 @@ void tst_QSslSocket_onDemandCertificates_member::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif // QT_TEST_SERVER #endif // QT_TEST_SERVER
} }

View File

@ -105,7 +105,8 @@ void tst_QSslSocket_onDemandCertificates_static::initTestCase()
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130)); QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
#else #else
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif // QT_TEST_SERVER #endif // QT_TEST_SERVER
} }

View File

@ -38,12 +38,12 @@
from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint,
QRect, QSize, QUrl, Qt) QRect, QSize, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont, from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap,
QRadialGradient) QRadialGradient)
from PySide2.QtWidgets import * from PySide2.QtWidgets import *
import GammaView from gammaview import GammaView
class Ui_Config(object): class Ui_Config(object):

View File

@ -1,3 +1,5 @@
[moveCursorBiggerJump] [moveCursorBiggerJump]
osx osx
[mouseWheel:scroll down per pixel]
macos

View File

@ -22,7 +22,7 @@ opensuse-leap
# QTBUG-68175 # QTBUG-68175
opensuse-42.3 opensuse-42.3
[childEvents] [childEvents]
osx ci macos
[renderInvisible] [renderInvisible]
osx-10.12 osx-10.12
osx-10.11 osx-10.11
@ -34,8 +34,7 @@ osx
[render_systemClip] [render_systemClip]
osx osx
[showMinimizedKeepsFocus] [showMinimizedKeepsFocus]
osx-10.12 ci macos
osx-10.13 ci
[maskedUpdate] [maskedUpdate]
opensuse opensuse
opensuse-leap opensuse-leap
@ -49,3 +48,7 @@ ubuntu
# QTBUG-75270 # QTBUG-75270
winrt winrt
[syntheticEnterLeave]
macos # Can't move cursor (QTBUG-76312)
[taskQTBUG_4055_sendSyntheticEnterLeave]
macos # Can't move cursor (QTBUG-76312)

View File

@ -1,2 +1,4 @@
[task232085_spinBoxLineEditBg] [task232085_spinBoxLineEditBg]
osx osx
[widgetStylePropagation]
macos # QTBUG-75786

View File

@ -11,3 +11,5 @@ osx-10.13
osx-10.14 osx-10.14
[activeSubMenuPosition] [activeSubMenuPosition]
winrt winrt
[submenuTearOffDontClose]
macos # Can't move cursor (QTBUG-76312)

View File

@ -1066,6 +1066,10 @@ static inline QByteArray msgGeometryIntersects(const QRect &r1, const QRect &r2)
void tst_QMenu::pushButtonPopulateOnAboutToShow() void tst_QMenu::pushButtonPopulateOnAboutToShow()
{ {
#ifdef Q_OS_MACOS
QSKIP("Popup menus may partially overlap the button on macOS, and that's okey");
#endif
QPushButton b("Test PushButton"); QPushButton b("Test PushButton");
b.setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); b.setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);

View File

@ -479,7 +479,8 @@ private:
void tst_qnetworkreply::initTestCase() void tst_qnetworkreply::initTestCase()
{ {
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
void tst_qnetworkreply::httpLatency() void tst_qnetworkreply::httpLatency()

View File

@ -81,7 +81,8 @@ void tst_QTcpServer::initTestCase_data()
void tst_QTcpServer::initTestCase() void tst_QTcpServer::initTestCase()
{ {
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
void tst_QTcpServer::init() void tst_QTcpServer::init()

View File

@ -63,7 +63,8 @@ tst_QSslSocket::~tst_QSslSocket()
void tst_QSslSocket::initTestCase() void tst_QSslSocket::initTestCase()
{ {
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
void tst_QSslSocket::init() void tst_QSslSocket::init()

View File

@ -123,7 +123,8 @@ void tst_NetworkStressTest::initTestCase_data()
void tst_NetworkStressTest::initTestCase() void tst_NetworkStressTest::initTestCase()
{ {
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
void tst_NetworkStressTest::init() void tst_NetworkStressTest::init()

View File

@ -105,7 +105,8 @@ protected:
void tst_qnetworkreply::initTestCase() void tst_qnetworkreply::initTestCase()
{ {
qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
} }
void tst_qnetworkreply::limiting_data() void tst_qnetworkreply::limiting_data()