summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qmake/doc/src/qmake-manual.qdoc64
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--qmake/generators/makefile.cpp2
-rw-r--r--qmake/generators/unix/unixmake2.cpp2
-rw-r--r--qmake/meta.cpp7
-rw-r--r--qmake/meta.h2
-rw-r--r--src/corelib/Qt5CoreMacros.cmake4
-rw-r--r--src/corelib/animation/qabstractanimation.cpp2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp2
-rw-r--r--src/corelib/global/qlogging.cpp3
-rw-r--r--src/corelib/global/qtrace_p.h17
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp6
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp4
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp9
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp10
-rw-r--r--src/corelib/kernel/qmetaobject.cpp4
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/plugin/qlibrary.cpp8
-rw-r--r--src/corelib/plugin/qpluginloader.cpp2
-rw-r--r--src/corelib/qtcore.tracepoints10
-rw-r--r--src/corelib/thread/qbasicatomic.h2
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/corelib/tools/qdatetime_p.h4
-rw-r--r--src/corelib/tools/qlocale_p.h6
-rw-r--r--src/corelib/tools/qsharedpointer.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp55
-rw-r--r--src/gui/image/qimage.cpp42
-rw-r--r--src/gui/image/qplatformpixmap.cpp1
-rw-r--r--src/gui/image/qpnghandler.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/painting/qbrush.cpp8
-rw-r--r--src/gui/qtgui.tracepoints6
-rw-r--r--src/gui/text/qtextcursor.cpp23
-rw-r--r--src/network/kernel/kernel.pri3
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp41
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp33
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp92
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp30
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm9
-rw-r--r--src/tools/tracegen/etw.cpp27
-rw-r--r--src/tools/tracegen/lttng.cpp17
-rw-r--r--src/tools/tracegen/provider.cpp19
-rw-r--r--src/tools/tracegen/provider.h1
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/qtwidgets.tracepoints7
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp9
-rw-r--r--src/widgets/styles/styles.pri2
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp43
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp7
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp35
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp34
-rw-r--r--tests/auto/gui/painting/qbrush/tst_qbrush.cpp2
-rw-r--r--tests/auto/network/kernel/qhostinfo/BLACKLIST2
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp68
-rw-r--r--tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp59
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp9
61 files changed, 664 insertions, 228 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 84e3fb6df4..1e1b365141 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -3031,6 +3031,8 @@
\snippet code/doc_src_qmake-manual.pro 159
+ This function was introduced in Qt 5.0.
+
See also \l{clean_path(path)}{clean_path()},
\l{relative_path(filePath[, base])}{relative_path()}.
@@ -3065,6 +3067,8 @@
redundant ones removed, and "."s and ".."s resolved (as far as possible).
This function is a wrapper around QDir::cleanPath.
+ This function was introduced in Qt 5.0.
+
See also \l{absolute_path(path[, base])}{absolute_path()},
\l{relative_path(filePath[, base])}{relative_path()},
\l{shell_path(path)}{shell_path()}, \l{system_path(path)}{system_path()}.
@@ -3079,6 +3083,8 @@
Returns a list of all defined variable names.
+ This function was introduced in Qt 5.0.
+
\section2 escape_expand(arg1 [, arg2 ..., argn])
Accepts an arbitrary number of arguments. It expands the
@@ -3142,6 +3148,8 @@
\snippet code/doc_src_qmake-manual.pro 163
+ This function was introduced in Qt 5.0.
+
\section2 fromfile(filename, variablename)
Evaluates \c filename as a qmake project file and returns the value assigned
@@ -3156,6 +3164,8 @@
The \c getenv function, however, supports environment variables with
parentheses in their name.
+ This function was introduced in Qt 5.12.
+
\section2 join(variablename, glue, before, after)
Joins the value of \c variablename with \c glue. If this value is
@@ -3245,6 +3255,8 @@
sum = $$num_add($$first, $$second_neg)
\endcode
+ This function was introduced in Qt 5.8.
+
\section2 prompt(question [, decorate])
Displays the specified \c question, and returns a value read from stdin.
@@ -3273,6 +3285,8 @@
\note This function is available only on Windows hosts.
+ This function was introduced in Qt 5.12.1.
+
\section2 relative_path(filePath[, base])
Returns the path to \c filePath relative to \c base.
@@ -3285,6 +3299,8 @@
directory; in that case, this function effectively acts as
$$clean_path().
+ This function was introduced in Qt 5.0.
+
See also \l{absolute_path(path[, base])}{absolute_path()},
\l{clean_path(path)}{clean_path()}.
@@ -3304,10 +3320,14 @@
This is an internal function that you will typically not need.
+ This function was introduced in Qt 5.0.
+
\section2 reverse(variablename)
Returns the values of \c variablename in reverse order.
+ This function was introduced in Qt 5.0.
+
\section2 section(variablename, separator, begin, end)
Returns a section of the value of \c variablename. This function is a
@@ -3323,6 +3343,8 @@
This function returns \c path for in-source builds. It returns an empty
string if \c path points outside of the source tree.
+ This function was introduced in Qt 5.0.
+
\section2 shell_path(path)
Converts all directory separators within \c path to separators that are
@@ -3330,12 +3352,16 @@
the shell that is invoked by the make tool). For example, slashes are
converted to backslashes when the Windows shell is used.
+ This function was introduced in Qt 5.0.
+
See also \l{system_path(path)}{system_path()}.
\section2 shell_quote(arg)
Quotes \c arg for the shell that is used while building the project.
+ This function was introduced in Qt 5.0.
+
See also \l{system_quote(arg)}{system_quote()}.
\target fn_size
@@ -3349,6 +3375,8 @@
This is an internal function that you will typically not need.
+ This function was introduced in Qt 5.0.
+
\section2 sorted(variablename)
Returns the list of values in \c variablename with entries sorted
@@ -3357,6 +3385,8 @@
Numerical sorting can be accomplished by zero-padding the values to
a fixed length with the help of the \l{format_number()} function.
+ This function was introduced in Qt 5.8.
+
\section2 split(variablename, separator)
Splits the value of \c variablename into separate values, and returns them
@@ -3403,6 +3433,8 @@
See also \l{member()}, \l{num_add()}.
+ This function was introduced in Qt 5.8.
+
\target str_size()
\section2 str_size(arg)
@@ -3410,6 +3442,8 @@
See also \l{fn_size}{size()}.
+ This function was introduced in Qt 5.8.
+
\target system_replace
\section2 system(command[, mode[, stsvar]])
@@ -3438,6 +3472,8 @@
invoke commands. For example, slashes are converted to backslashes for the
Windows shell.
+ This function was introduced in Qt 5.0.
+
See also \l{shell_path(path)}{shell_path()}.
\section2 system_quote(arg)
@@ -3445,6 +3481,8 @@
Quotes \c arg for the shell that is used by the \c{system()}
functions.
+ This function was introduced in Qt 5.0.
+
See also \l{shell_quote(arg)}{shell_quote()}.
\target take_first()
@@ -3455,6 +3493,8 @@
This provides convenience for implementing queues, for example.
+ This function was introduced in Qt 5.8.
+
See also \l{take_last()}, \l{fn_first}{first()}.
\target take_last()
@@ -3465,6 +3505,8 @@
This provides convenience for implementing stacks, for example.
+ This function was introduced in Qt 5.8.
+
See also \l{take_first()}, \l{fn_last}{last()}.
\target unique
@@ -3485,6 +3527,8 @@
Escapes the values of \c variablename in a way that enables parsing them as
qmake code.
+
+ This function was introduced in Qt 5.0.
*/
/*!
@@ -3508,6 +3552,8 @@
This is an internal function that you will typically not need.
+ This function was introduced in Qt 5.0.
+
\section2 CONFIG(config)
This function can be used to test for variables placed into the
@@ -3714,6 +3760,8 @@
Prints a message on the console. Unlike the \c message function, neither
prepends text nor appends a line break.
+ This function was introduced in Qt 5.0.
+
See also \l{message(string)}{message()}.
\section2 message(string)
@@ -3739,6 +3787,8 @@
Creates the directory path \c dirPath. This function is a wrapper around the
QDir::mkpath function.
+ This function was introduced in Qt 5.0.
+
\section2 requires(condition)
Evaluates \c condition. If the condition is false, qmake skips this
@@ -3765,6 +3815,8 @@
Updates the time stamp of \c filename to match the time stamp of
\c reference_filename.
+ This function was introduced in Qt 5.0.
+
\section2 unset(variablename)
Removes \c variablename from the current context.
@@ -3781,12 +3833,16 @@
the string will be ignored. Comparison is performed segment-wise from left
to right; if one version is a prefix of the other, it is considered smaller.
+ This function was introduced in Qt 5.10.
+
\section2 versionAtMost(variablename, versionNumber)
Tests that the version number from \c variablename is less than or equal to
\c versionNumber. Works as
\l{versionAtLeast(variablename, versionNumber)}{versionAtLeast()}.
+ This function was introduced in Qt 5.10.
+
\section2 warning(string)
Always succeeds, and displays \c string as a warning message to the user.
@@ -3798,6 +3854,8 @@
an empty file. If \c mode is \c append and the file already exists, appends
to it instead of replacing it.
+ This function was introduced in Qt 5.0.
+
\section1 Test Function Library
Complex test functions are implemented in a library of .prf files.
@@ -3844,6 +3902,8 @@
\snippet code/doc_src_qmake-manual.pro 178
+ This function was introduced in Qt 5.0.
+
\section2 qtCompileTest(test)
Builds a test project. If the test passes, true is returned and
@@ -3884,10 +3944,14 @@
See also \l{load(feature)}{load()}.
+ This function was introduced in Qt 5.0.
+
\section2 qtHaveModule(name)
Checks whether the Qt module specified by \c name is present.
For a list of possible values, see \l{Variables#QT}{QT}.
+
+ This function was introduced in Qt 5.0.1.
*/
/*!
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 5407ed6c69..07832041a7 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -856,7 +856,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
(*lit) + Option::dir_sep + lib + Option::prl_ext));
if (!lib_file.isEmpty()) {
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
if(libinfo.readLib(lib_file)) {
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index ab261d02f1..e9dccf0c46 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -912,7 +912,7 @@ MakefileGenerator::processPrlFileCore(QString &origFile, const QStringRef &origN
const QString meta_file = QMakeMetaInfo::checkLib(fixedFile);
if (meta_file.isEmpty())
return false;
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
if (!libinfo.readLib(meta_file)) {
fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 4b33713a75..24215ae7b0 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -407,7 +407,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
ProStringList::ConstIterator it;
for(it = l.begin(); it != l.end(); ++it) {
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
ProString dir;
int slsh = (*it).lastIndexOf(Option::dir_sep);
diff --git a/qmake/meta.cpp b/qmake/meta.cpp
index 2e8759b8ba..c5c14d9b56 100644
--- a/qmake/meta.cpp
+++ b/qmake/meta.cpp
@@ -35,13 +35,6 @@ QT_BEGIN_NAMESPACE
QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
-QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
- : conf(_conf)
-{
-
-}
-
-
bool
QMakeMetaInfo::readLib(const QString &meta_file)
{
diff --git a/qmake/meta.h b/qmake/meta.h
index 4721085fd2..5f41a37df0 100644
--- a/qmake/meta.h
+++ b/qmake/meta.h
@@ -41,11 +41,9 @@ class QMakeProject;
class QMakeMetaInfo
{
- QMakeProject *conf;
ProValueMap vars;
static QHash<QString, ProValueMap> cache_vars;
public:
- QMakeMetaInfo(QMakeProject *_conf);
// These functions expect the path to be normalized
static QString checkLib(const QString &lib);
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 620795d2cf..7ae5e4fd16 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -321,10 +321,10 @@ function(QT5_ADD_BIG_RESOURCES outfiles )
add_custom_command(OUTPUT ${tmpoutfile}
COMMAND ${Qt5Core_RCC_EXECUTABLE} ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile}
DEPENDS ${infile} ${_rc_depends} "${out_depends}" VERBATIM)
- set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOMOC ON)
- set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOUIC ON)
add_custom_target(big_resources_${outfilename} ALL DEPENDS ${tmpoutfile})
add_library(rcc_object_${outfilename} OBJECT ${tmpoutfile})
+ set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOMOC OFF)
+ set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOUIC OFF)
add_dependencies(rcc_object_${outfilename} big_resources_${outfilename})
add_custom_command(OUTPUT ${outfile}
COMMAND ${Qt5Core_RCC_EXECUTABLE}
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 9dd81b2ecd..78b79e574a 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -1083,7 +1083,7 @@ QAbstractAnimation::State QAbstractAnimation::state() const
/*!
If this animation is part of a QAnimationGroup, this function returns a
- pointer to the group; otherwise, it returns 0.
+ pointer to the group; otherwise, it returns \nullptr.
\sa QAnimationGroup::addAnimation()
*/
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 466c575c3e..eb05446beb 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1244,7 +1244,7 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba)
\obsolete
Returns the codec used by QObject::tr() on its argument. If this
- function returns 0 (the default), tr() assumes Latin-1.
+ function returns \nullptr (the default), tr() assumes Latin-1.
*/
/*!
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 168934c202..30232170fb 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -57,6 +57,7 @@
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
#include "private/qsimd_p.h"
+#include <qtcore_tracepoints_p.h>
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1811,6 +1812,8 @@ static void ungrabMessageHandler() { }
static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
{
#ifndef QT_BOOTSTRAPPED
+ Q_TRACE(qt_message_print, msgType, context.category, context.function, context.file, context.line, message);
+
// qDebug, qWarning, ... macros do not check whether category is enabled
if (isDefaultCategory(context.category)) {
if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) {
diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h
index 3d04a7311d..20f2beac98 100644
--- a/src/corelib/global/qtrace_p.h
+++ b/src/corelib/global/qtrace_p.h
@@ -52,11 +52,18 @@
//
/*
- * The Qt tracepoints API consists of only three macros:
+ * The Qt tracepoints API consists of only five macros:
*
* - Q_TRACE(tracepoint, args...)
* Fires 'tracepoint' if it is enabled.
*
+ * - Q_TRACE_EXIT(tracepoint, args...)
+ * Fires 'tracepoint' if it is enabled when the current scope exists.
+ *
+ * - Q_TRACE_SCOPE(tracepoint, args...)
+ * Wrapper around Q_TRACE/_EXIT to trace entry and exit. First it traces
+ * `${tracepoint}_entry` and then `${tracepoint}_exit` on scope exit.
+ *
* - Q_UNCONDITIONAL_TRACE(tracepoint, args...)
* Fires 'tracepoint' unconditionally: no check is performed to query
* whether 'tracepoint' is enabled.
@@ -110,15 +117,23 @@
*/
#include <QtCore/qglobal.h>
+#include <QtCore/qscopeguard.h>
QT_BEGIN_NAMESPACE
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
# define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__)
+# define Q_TRACE_EXIT(x, ...) \
+ const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); });
+# define Q_TRACE_SCOPE(x, ...) \
+ Q_TRACE(x ## _entry, __VA_ARGS__); \
+ Q_TRACE_EXIT(x ## _exit, __VA_ARGS__);
# define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
#else
# define Q_TRACE(x, ...)
+# define Q_TRACE_EXIT(x, ...)
+# define Q_TRACE_SCOPE(x, ...)
# define Q_UNCONDITIONAL_TRACE(x, ...)
# define Q_TRACE_ENABLED(x) false
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index b2d81066db..5bab897d43 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -805,11 +805,11 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
}
//static
-QByteArray QFileSystemEngine::id(int id)
+QByteArray QFileSystemEngine::id(int fd)
{
QT_STATBUF statResult;
- if (QT_FSTAT(id, &statResult)) {
- qErrnoWarning("fstat() failed for fd %d", id);
+ if (QT_FSTAT(fd, &statResult)) {
+ qErrnoWarning("fstat() failed for fd %d", fd);
return QByteArray();
}
QByteArray result = QByteArray::number(quint64(statResult.st_dev), 16);
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 3f4b46573b..2020e34f93 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -555,7 +555,7 @@ typedef struct _FILE_ID_INFO {
#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
-// File ID for Windows up to version 7.
+// File ID for Windows up to version 7 and FAT32 drives
static inline QByteArray fileId(HANDLE handle)
{
#ifndef Q_OS_WINRT
@@ -588,6 +588,8 @@ QByteArray fileIdWin8(HANDLE handle)
result += ':';
// Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex();
+ } else {
+ result = fileId(handle); // GetFileInformationByHandleEx() is observed to fail for FAT32, QTBUG-74759
}
return result;
#else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 1809861fc6..c2c3b2702b 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -86,15 +86,6 @@ static void appendOrganizationAndApp(QString &path) // Courtesy qstandardpaths_u
#endif
}
-static inline QString displayName(QStandardPaths::StandardLocation type)
-{
-#ifndef QT_BOOTSTRAPPED
- return QStandardPaths::displayName(type);
-#else
- return QString::number(type);
-#endif
-}
-
static inline void appendTestMode(QString &path)
{
if (QStandardPaths::isTestModeEnabled())
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index 8e1b560874..ea08ff571f 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -162,7 +162,7 @@ QAbstractEventDispatcher::~QAbstractEventDispatcher()
Returns a pointer to the event dispatcher object for the specified
\a thread. If \a thread is zero, the current thread is used. If no
event dispatcher exists for the specified thread, this function
- returns 0.
+ returns \nullptr.
\b{Note:} If Qt is built without thread support, the \a thread
argument is ignored.
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index c637f0c1c9..596941b5a9 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -778,7 +778,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv
void QCoreApplicationPrivate::init()
{
- Q_TRACE(QCoreApplicationPrivate_init_entry);
+ Q_TRACE_SCOPE(QCoreApplicationPrivate_init);
#if defined(Q_OS_MACOS)
QMacAutoReleasePool pool;
@@ -883,8 +883,6 @@ void QCoreApplicationPrivate::init()
#ifndef QT_NO_QOBJECT
is_app_running = true; // No longer starting up.
#endif
-
- Q_TRACE(QCoreApplicationPrivate_init_exit);
}
/*!
@@ -1199,7 +1197,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
{
// Note: when adjusting the tracepoints in here
// consider adjusting QApplicationPrivate::notify_helper too.
- Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
+ Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
// send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self
@@ -1491,7 +1489,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
*/
void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
{
- Q_TRACE(QCoreApplication_postEvent_entry, receiver, event, event->type());
+ Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type());
if (receiver == 0) {
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
@@ -2923,7 +2921,7 @@ bool QCoreApplication::hasPendingEvents()
/*!
Returns a pointer to the event dispatcher object for the main thread. If no
- event dispatcher exists for the thread, this function returns 0.
+ event dispatcher exists for the thread, this function returns \nullptr.
*/
QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
{
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 5de2717078..b8b5c0de46 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -349,7 +349,7 @@ bool QMetaObject::inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT
\internal
Returns \a obj if object \a obj inherits from this
- meta-object; otherwise returns 0.
+ meta-object; otherwise returns \nullptr.
*/
QObject *QMetaObject::cast(QObject *obj) const
{
@@ -361,7 +361,7 @@ QObject *QMetaObject::cast(QObject *obj) const
\internal
Returns \a obj if object \a obj inherits from this
- meta-object; otherwise returns 0.
+ meta-object; otherwise returns \nullptr.
*/
const QObject *QMetaObject::cast(const QObject *obj) const
{
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index cf838b6947..a791d2e8b3 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2342,7 +2342,7 @@ static void err_info_about_objects(const char * func,
/*!
Returns a pointer to the object that sent the signal, if called in
- a slot activated by a signal; otherwise it returns 0. The pointer
+ a slot activated by a signal; otherwise it returns \nullptr. The pointer
is valid only during the execution of the slot that calls this
function from this object's thread context.
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index aa63ed1a6b..29ef697fe8 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -999,7 +999,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver
/*!
Returns the address of the exported symbol \a symbol. The library is
- loaded if necessary. The function returns 0 if the symbol could
+ loaded if necessary. The function returns \nullptr if the symbol could
not be resolved or if the library could not be loaded.
Example:
@@ -1032,7 +1032,7 @@ QFunctionPointer QLibrary::resolve(const char *symbol)
include the platform-specific file suffix; (see \l{fileName}). The
library remains loaded until the application exits.
- The function returns 0 if the symbol could not be resolved or if
+ The function returns \nullptr if the symbol could not be resolved or if
the library could not be loaded.
\sa resolve()
@@ -1052,7 +1052,7 @@ QFunctionPointer QLibrary::resolve(const QString &fileName, const char *symbol)
(see \l{fileName}). The library remains loaded until the application exits.
\a verNum is ignored on Windows.
- The function returns 0 if the symbol could not be resolved or if
+ The function returns \nullptr if the symbol could not be resolved or if
the library could not be loaded.
\sa resolve()
@@ -1073,7 +1073,7 @@ QFunctionPointer QLibrary::resolve(const QString &fileName, int verNum, const ch
(see \l{fileName}). The library remains loaded until the application exits.
\a version is ignored on Windows.
- The function returns 0 if the symbol could not be resolved or if
+ The function returns \nullptr if the symbol could not be resolved or if
the library could not be loaded.
\sa resolve()
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 0f94bb6adf..00480198bd 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -174,7 +174,7 @@ QPluginLoader::~QPluginLoader()
/*!
Returns the root component object of the plugin. The plugin is
- loaded if necessary. The function returns 0 if the plugin could
+ loaded if necessary. The function returns \nullptr if the plugin could
not be loaded or if the root component object could not be
instantiated.
diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints
index 33734a4274..3a70136741 100644
--- a/src/corelib/qtcore.tracepoints
+++ b/src/corelib/qtcore.tracepoints
@@ -1,3 +1,9 @@
+{
+QT_BEGIN_NAMESPACE
+class QEvent;
+QT_END_NAMESPACE
+}
+
QCoreApplicationPrivate_init_entry()
QCoreApplicationPrivate_init_exit()
@@ -10,6 +16,7 @@ QEvent_ctor(QEvent *event, int type)
QEvent_dtor(QEvent *event, int type)
QCoreApplication_postEvent_entry(QObject *receiver, QEvent *event, int type)
+QCoreApplication_postEvent_exit(QObject *receiver, QEvent *event, int type)
QCoreApplication_postEvent_event_compressed(QObject *receiver, QEvent *event)
QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type)
@@ -17,6 +24,7 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
+QCoreApplication_notify_exit(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
@@ -32,3 +40,5 @@ QMetaObject_activate_begin_slot_functor(void *slotObject)
QMetaObject_activate_end_slot_functor(void *slotObject)
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)
+
+qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message)
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index a0304697b8..6b6ac10713 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtCore/qatomic.h>
+#include <QtCore/qglobal.h>
#ifndef QBASICATOMIC_H
#define QBASICATOMIC_H
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index b023ae9ed2..9f60de1f87 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -920,7 +920,7 @@ QThreadPrivate::~QThreadPrivate()
\since 5.0
Returns a pointer to the event dispatcher object for the thread. If no event
- dispatcher exists for the thread, this function returns 0.
+ dispatcher exists for the thread, this function returns \nullptr.
*/
QAbstractEventDispatcher *QThread::eventDispatcher() const
{
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index 4d30d4192b..b3d00745d0 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -140,6 +140,10 @@ public:
// Inlined for its one caller in qdatetime.cpp
inline void setUtcOffsetByTZ(qint64 atMSecsSinceEpoch);
#endif // timezone
+
+ // ### Qt 5.14: expose publicly in QDateTime
+ // The first and last years of which QDateTime can represent some part:
+ enum class YearRange : qint32 { First = -292275056, Last = +292278994 };
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index a96ecf1c1c..7487c9128c 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -252,10 +252,8 @@ public:
const float huge = std::numeric_limits<float>::infinity();
return d < 0 ? -huge : huge;
}
- if (std::fabs(d) >= std::numeric_limits<double>::min() // i.e. d != 0
- && std::fabs(d) < std::numeric_limits<float>::min()) {
- // Values smaller than std::numeric_limits<double>::min() have
- // failed already; match them.
+ if (d != 0 && float(d) == 0) {
+ // Values that underflow double already failed. Match them:
if (ok != 0)
*ok = false;
return 0;
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index a1caeeb135..6ab84cf3d8 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -875,7 +875,7 @@
\b without ensuring that it cannot get deleted. To have that guarantee,
use toStrongRef(), which returns a QSharedPointer object. If this
function can determine that the pointer has already been deleted, it
- returns 0.
+ returns \nullptr.
It is ok to obtain the value of the pointer and using that value itself,
like for example in debugging statements:
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index d8bfb69a8b..4852d20082 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -501,7 +501,11 @@ bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW
while (ptr + 4 <= end) {
quint32 data = qFromUnaligned<quint32>(ptr);
if (data &= 0x80808080U) {
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ uint idx = qCountLeadingZeroBits(data);
+#else
uint idx = qCountTrailingZeroBits(data);
+#endif
ptr += idx / 8;
return false;
}
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index f75a61977d..7d85bc077d 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -39,6 +39,7 @@
#include "qtimezone.h"
#include "qtimezoneprivate_p.h"
+#include "qdatetime_p.h" // ### Qt 5.14: remove once YearRange is on QDateTime
#include <QtCore/QFile>
#include <QtCore/QHash>
@@ -520,19 +521,14 @@ PosixZone PosixZone::parse(const char *&pos, const char *end)
static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule,
int startYear, int endYear,
- int lastTranMSecs)
+ qint64 lastTranMSecs)
{
QVector<QTimeZonePrivate::Data> result;
- // Limit year by qint64 max size for msecs
- if (startYear > 292278994)
- startYear = 292278994;
- if (endYear > 292278994)
- endYear = 292278994;
-
// POSIX Format is like "TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00"
// i.e. "std offset dst [offset],start[/time],end[/time]"
- // See the section about TZ at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
+ // See the section about TZ at
+ // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
QList<QByteArray> parts = posixRule.split(',');
PosixZone stdZone, dstZone = PosixZone::invalid();
@@ -583,6 +579,13 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
else
stdTime = QTime(2, 0, 0);
+ // Limit year to the range QDateTime can represent:
+ const int minYear = int(QDateTimePrivate::YearRange::First);
+ const int maxYear = int(QDateTimePrivate::YearRange::Last);
+ startYear = qBound(minYear, startYear, maxYear);
+ endYear = qBound(minYear, endYear, maxYear);
+ Q_ASSERT(startYear <= endYear);
+
for (int year = startYear; year <= endYear; ++year) {
QTimeZonePrivate::Data dstData;
QDateTime dst(calculatePosixDate(dstDateRule, year), dstTime, Qt::UTC);
@@ -598,13 +601,16 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
stdData.standardTimeOffset = stdZone.offset;
stdData.daylightTimeOffset = 0;
stdData.abbreviation = stdZone.name;
- // Part of the high year will overflow
- if (year == 292278994 && (dstData.atMSecsSinceEpoch < 0 || stdData.atMSecsSinceEpoch < 0)) {
+ // Part of maxYear will overflow (likewise for minYear, below):
+ if (year == maxYear && (dstData.atMSecsSinceEpoch < 0 || stdData.atMSecsSinceEpoch < 0)) {
if (dstData.atMSecsSinceEpoch > 0) {
result << dstData;
} else if (stdData.atMSecsSinceEpoch > 0) {
result << stdData;
}
+ } else if (year < 1970) { // We ignore DST before the epoch.
+ if (year > minYear || stdData.atMSecsSinceEpoch != QTimeZonePrivate::invalidMSecs())
+ result << stdData;
} else if (dst < std) {
result << dstData << stdData;
} else {
@@ -794,6 +800,8 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
m_tranTimes.append(tran);
}
+ if (m_tranTimes.isEmpty() && m_posixRule.isEmpty())
+ return; // Invalid after all !
if (ianaId.isEmpty())
m_id = systemTimeZoneId();
@@ -954,22 +962,25 @@ QVector<QTimeZonePrivate::Data> QTzTimeZonePrivate::getPosixTransitions(qint64 m
QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
// If the required time is after the last transition (or there were none)
- // and we have a POSIX rule then use it:
- if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch)
- && !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) {
+ // and we have a POSIX rule, then use it:
+ if (!m_posixRule.isEmpty()
+ && (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch)) {
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(forMSecsSinceEpoch);
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
[forMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
return at.atMSecsSinceEpoch <= forMSecsSinceEpoch;
});
- if (it > posixTrans.cbegin()) {
- QTimeZonePrivate::Data data = *--it;
+ // Use most recent, if any in the past; or the first if we have no other rules:
+ if (it > posixTrans.cbegin() || (m_tranTimes.isEmpty() && it < posixTrans.cend())) {
+ QTimeZonePrivate::Data data = *(it > posixTrans.cbegin() ? it - 1 : it);
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
return data;
}
}
+ if (m_tranTimes.isEmpty()) // Only possible if !isValid()
+ return invalidData();
- // Otherwise, if we can find a valid tran, then use its rule:
+ // Otherwise, use the rule for the most recent or first transition:
auto last = std::partition_point(m_tranTimes.cbegin(), m_tranTimes.cend(),
[forMSecsSinceEpoch] (const QTzTransitionTime &at) {
return at.atMSecsSinceEpoch <= forMSecsSinceEpoch;
@@ -989,9 +1000,9 @@ bool QTzTimeZonePrivate::hasTransitions() const
QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const
{
// If the required time is after the last transition (or there were none)
- // and we have a POSIX rule then use it:
- if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch)
- && !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) {
+ // and we have a POSIX rule, then use it:
+ if (!m_posixRule.isEmpty()
+ && (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch)) {
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(afterMSecsSinceEpoch);
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
[afterMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
@@ -1012,9 +1023,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince
QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
{
// If the required time is after the last transition (or there were none)
- // and we have a POSIX rule then use it:
- if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch)
- && !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) {
+ // and we have a POSIX rule, then use it:
+ if (!m_posixRule.isEmpty()
+ && (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch)) {
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(beforeMSecsSinceEpoch);
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
[beforeMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 3e18ca6528..ef0481bdb2 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1089,15 +1089,31 @@ void QImage::detach()
}
-static void copyMetadata(QImageData *dst, const QImageData *src)
+static void copyPhysicalMetadata(QImageData *dst, const QImageData *src)
{
- // Doesn't copy colortable and alpha_clut, or offset.
dst->dpmx = src->dpmx;
dst->dpmy = src->dpmy;
dst->devicePixelRatio = src->devicePixelRatio;
+}
+
+static void copyMetadata(QImageData *dst, const QImageData *src)
+{
+ // Doesn't copy colortable and alpha_clut, or offset.
+ copyPhysicalMetadata(dst, src);
dst->text = src->text;
}
+static void copyMetadata(QImage *dst, const QImage &src)
+{
+ dst->setDotsPerMeterX(src.dotsPerMeterX());
+ dst->setDotsPerMeterY(src.dotsPerMeterY());
+ dst->setDevicePixelRatio(src.devicePixelRatio());
+ const auto textKeys = src.textKeys();
+ for (const auto &key: textKeys)
+ dst->setText(key, src.text(key));
+
+}
+
/*!
\fn QImage QImage::copy(int x, int y, int width, int height) const
\overload
@@ -1309,7 +1325,7 @@ QRect QImage::rect() const
The image depth is the number of bits used to store a single
pixel, also called bits per pixel (bpp).
- The supported depths are 1, 8, 16, 24 and 32.
+ The supported depths are 1, 8, 16, 24, 32 and 64.
\sa bitPlaneCount(), convertToFormat(), {QImage#Image Formats}{Image Formats},
{QImage#Image Information}{Image Information}
@@ -1550,7 +1566,9 @@ void QImage::setColor(int i, QRgb c)
Returns a pointer to the pixel data at the scanline with index \a
i. The first scanline is at index 0.
- The scanline data is aligned on a 32-bit boundary.
+ The scanline data is as minimum 32-bit aligned. For 64-bit formats
+ it follows the native alignment of 64-bit integers (64-bit for most
+ platforms, but notably 32-bit on i386).
\warning If you are accessing 32-bpp image data, cast the returned
pointer to \c{QRgb*} (QRgb has a 32-bit size) and use it to
@@ -2924,8 +2942,10 @@ QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const
}
QImage mask(d->width, d->height, Format_MonoLSB);
- if (!mask.isNull())
+ if (!mask.isNull()) {
dither_to_Mono(mask.d, d, flags, true);
+ copyPhysicalMetadata(mask.d, d);
+ }
return mask;
}
@@ -3043,6 +3063,7 @@ QImage QImage::createHeuristicMask(bool clipTight) const
#undef PIX
+ copyPhysicalMetadata(m.d, d);
return m;
}
#endif //QT_NO_IMAGE_HEURISTIC_MASK
@@ -3086,6 +3107,8 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
}
if (mode == Qt::MaskOutColor)
maskImage.invertPixels();
+
+ copyPhysicalMetadata(maskImage.d, d);
return maskImage;
}
@@ -4655,8 +4678,7 @@ QImage QImage::smoothScaled(int w, int h) const {
static QImage rotated90(const QImage &image)
{
QImage out(image.height(), image.width(), image.format());
- out.setDotsPerMeterX(image.dotsPerMeterY());
- out.setDotsPerMeterY(image.dotsPerMeterX());
+ copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
int w = image.width();
@@ -4684,8 +4706,7 @@ static QImage rotated180(const QImage &image)
return image.mirrored(true, true);
QImage out(image.width(), image.height(), image.format());
- out.setDotsPerMeterX(image.dotsPerMeterY());
- out.setDotsPerMeterY(image.dotsPerMeterX());
+ copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
int w = image.width();
@@ -4697,8 +4718,7 @@ static QImage rotated180(const QImage &image)
static QImage rotated270(const QImage &image)
{
QImage out(image.height(), image.width(), image.format());
- out.setDotsPerMeterX(image.dotsPerMeterY());
- out.setDotsPerMeterY(image.dotsPerMeterX());
+ copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
int w = image.width();
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index 2209c3de4d..a2e01147c4 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -178,6 +178,7 @@ QBitmap QPlatformPixmap::mask() const
if (mask.isNull()) // allocation failed
return QBitmap();
+ mask.setDevicePixelRatio(devicePixelRatio());
mask.setColorCount(2);
mask.setColor(0, QColor(Qt::color0).rgba());
mask.setColor(1, QColor(Qt::color1).rgba());
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 808037f434..801b30881d 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -231,8 +231,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
if (screen_gamma != 0.0 && file_gamma != 0.0)
png_set_gamma(png_ptr, 1.0f / screen_gamma, file_gamma);
- png_uint_32 width;
- png_uint_32 height;
+ png_uint_32 width = 0;
+ png_uint_32 height = 0;
int bit_depth = 0;
int color_type = 0;
png_bytep trans_alpha = 0;
@@ -240,7 +240,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
int num_trans;
png_colorp palette = 0;
int num_palette;
- int interlace_method;
+ int interlace_method = PNG_INTERLACE_LAST;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
png_set_interlace_handling(png_ptr);
@@ -677,7 +677,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
QImage::Format QPngHandlerPrivate::readImageFormat()
{
QImage::Format format = QImage::Format_Invalid;
- png_uint_32 width, height;
+ png_uint_32 width = 0, height = 0;
int bit_depth = 0, color_type = 0;
png_colorp palette;
int num_palette;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index fd01f8bb7b..424af20f26 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1421,7 +1421,7 @@ void QGuiApplicationPrivate::eventDispatcherReady()
void QGuiApplicationPrivate::init()
{
- Q_TRACE(QGuiApplicationPrivate_init_entry);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
#if defined(Q_OS_MACOS)
QMacAutoReleasePool pool;
@@ -1585,8 +1585,6 @@ void QGuiApplicationPrivate::init()
if (!QGuiApplicationPrivate::displayName)
QObject::connect(q, &QGuiApplication::applicationNameChanged,
q, &QGuiApplication::applicationDisplayNameChanged);
-
- Q_TRACE(QGuiApplicationPrivate_init_exit);
}
extern void qt_cleanupFontDatabase();
@@ -1830,7 +1828,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
switch(e->type) {
case QWindowSystemInterfacePrivate::Mouse:
@@ -1940,8 +1938,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
qWarning() << "Unknown user input event type:" << e->type;
break;
}
-
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type);
}
/*! \internal
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 860653cc4c..d071f665bb 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -545,9 +545,11 @@ QBrush::QBrush(const QBrush &other)
*/
QBrush::QBrush(const QGradient &gradient)
{
- Q_ASSERT_X(gradient.type() != QGradient::NoGradient, "QBrush::QBrush",
- "QGradient should not be used directly, use the linear, radial\n"
- "or conical gradients instead");
+ if (Q_UNLIKELY(gradient.type() == QGradient::NoGradient)) {
+ d.reset(nullBrushInstance());
+ d->ref.ref();
+ return;
+ }
const Qt::BrushStyle enum_table[] = {
Qt::LinearGradientPattern,
diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints
index aed6c35c03..0a96a589b1 100644
--- a/src/gui/qtgui.tracepoints
+++ b/src/gui/qtgui.tracepoints
@@ -1,3 +1,9 @@
+{
+QT_BEGIN_NAMESPACE
+class QImageReader;
+QT_END_NAMESPACE
+}
+
QGuiApplicationPrivate_init_entry()
QGuiApplicationPrivate_init_exit()
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 7719a2e6da..c88497840f 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1145,6 +1145,15 @@ bool QTextCursor::isNull() const
\a pos using a \c MoveMode specified by \a m. The cursor is positioned
between characters.
+ \note The "characters" in this case refer to the string of QChar
+ objects, i.e. 16-bit Unicode characters, and \a pos is considered
+ an index into this string. This does not necessarily correspond to
+ individual graphemes in the writing system, as a single grapheme may
+ be represented by multiple Unicode characters, such as in the case
+ of surrogate pairs, linguistic ligatures or diacritics. For a more
+ generic approach to navigating the document, use movePosition(),
+ which will respect the actual grapheme boundaries in the text.
+
\sa position(), movePosition(), anchor()
*/
void QTextCursor::setPosition(int pos, MoveMode m)
@@ -1176,6 +1185,13 @@ void QTextCursor::setPosition(int pos, MoveMode m)
Returns the absolute position of the cursor within the document.
The cursor is positioned between characters.
+ \note The "characters" in this case refer to the string of QChar
+ objects, i.e. 16-bit Unicode characters, and the position is considered
+ an index into this string. This does not necessarily correspond to
+ individual graphemes in the writing system, as a single grapheme may
+ be represented by multiple Unicode characters, such as in the case
+ of surrogate pairs, linguistic ligatures or diacritics.
+
\sa setPosition(), movePosition(), anchor(), positionInBlock()
*/
int QTextCursor::position() const
@@ -1192,6 +1208,13 @@ int QTextCursor::position() const
This is equivalent to \c{ position() - block().position()}.
+ \note The "characters" in this case refer to the string of QChar
+ objects, i.e. 16-bit Unicode characters, and the position is considered
+ an index into this string. This does not necessarily correspond to
+ individual graphemes in the writing system, as a single grapheme may
+ be represented by multiple Unicode characters, such as in the case
+ of surrogate pairs, linguistic ligatures or diacritics.
+
\sa position()
*/
int QTextCursor::positionInBlock() const
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index 11b80d59d5..7074fcd5eb 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -39,8 +39,11 @@ qtConfig(dnslookup) {
unix {
!integrity:qtConfig(dnslookup): SOURCES += kernel/qdnslookup_unix.cpp
+
SOURCES += kernel/qhostinfo_unix.cpp
+ qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
+
qtConfig(linux-netlink): SOURCES += kernel/qnetworkinterface_linux.cpp
else: SOURCES += kernel/qnetworkinterface_unix.cpp
}
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index ce1ec6442a..ee7484ab35 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -59,6 +59,10 @@
# include <gnu/lib-names.h>
#endif
+#if defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen)
+# include <dlfcn.h>
+#endif
+
#include <cstring>
QT_BEGIN_NAMESPACE
@@ -87,6 +91,18 @@ struct QDnsLookupStateDeleter
}
};
+static QFunctionPointer resolveSymbol(QLibrary &lib, const char *sym)
+{
+ if (lib.isLoaded())
+ return lib.resolve(sym);
+
+#if defined(RTLD_DEFAULT) && (defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen))
+ return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_DEFAULT, sym));
+#else
+ return nullptr;
+#endif
+}
+
static bool resolveLibraryInternal()
{
QLibrary lib;
@@ -96,31 +112,30 @@ static bool resolveLibraryInternal()
#endif
{
lib.setFileName(QLatin1String("resolv"));
- if (!lib.load())
- return false;
+ lib.load();
}
- local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));
+ local_dn_expand = dn_expand_proto(resolveSymbol(lib, "__dn_expand"));
if (!local_dn_expand)
- local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));
+ local_dn_expand = dn_expand_proto(resolveSymbol(lib, "dn_expand"));
- local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
+ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "__res_nclose"));
if (!local_res_nclose)
- local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
+ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_9_nclose"));
if (!local_res_nclose)
- local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
+ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_nclose"));
- local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
+ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "__res_ninit"));
if (!local_res_ninit)
- local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
+ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_9_ninit"));
if (!local_res_ninit)
- local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
+ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_ninit"));
- local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery"));
+ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "__res_nquery"));
if (!local_res_nquery)
- local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
+ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_9_nquery"));
if (!local_res_nquery)
- local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
+ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_nquery"));
return true;
}
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index d22608e22f..e4810d68ee 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -66,6 +66,10 @@
# include <gnu/lib-names.h>
#endif
+#if defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen)
+# include <dlfcn.h>
+#endif
+
QT_BEGIN_NAMESPACE
// Almost always the same. If not, specify in qplatformdefs.h.
@@ -115,6 +119,18 @@ struct LibResolv
};
}
+static QFunctionPointer resolveSymbol(QLibrary &lib, const char *sym)
+{
+ if (lib.isLoaded())
+ return lib.resolve(sym);
+
+#if defined(RTLD_DEFAULT) && (defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen))
+ return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_DEFAULT, sym));
+#else
+ return nullptr;
+#endif
+}
+
LibResolv::LibResolv()
{
QLibrary lib;
@@ -124,31 +140,30 @@ LibResolv::LibResolv()
#endif
{
lib.setFileName(QLatin1String("resolv"));
- if (!lib.load())
- return;
+ lib.load();
}
// res_ninit is required for localDomainName()
- local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
+ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "__res_ninit"));
if (!local_res_ninit)
- local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
+ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_ninit"));
if (local_res_ninit) {
// we must now find res_nclose
- local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
+ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_nclose"));
if (!local_res_nclose)
- local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
+ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "__res_nclose"));
if (!local_res_nclose)
local_res_ninit = nullptr;
}
if (ReinitNecessary || !local_res_ninit) {
- local_res_init = res_init_proto(lib.resolve("__res_init"));
+ local_res_init = res_init_proto(resolveSymbol(lib, "__res_init"));
if (!local_res_init)
- local_res_init = res_init_proto(lib.resolve("res_init"));
+ local_res_init = res_init_proto(resolveSymbol(lib, "res_init"));
if (local_res_init && !local_res_ninit) {
// if we can't get a thread-safe context, we have to use the global _res state
- local_res = res_state_ptr(lib.resolve("_res"));
+ local_res = res_state_ptr(resolveSymbol(lib, "_res"));
}
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index 0cebc8d98d..490dbe8c4c 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -163,12 +163,14 @@
return NSViewLayerContentsRedrawDuringViewResize;
}
+#if 0 // Disabled until we enable lazy backingstore resizing
- (NSViewLayerContentsPlacement)layerContentsPlacement
{
// Always place the layer at top left without any automatic scaling,
// so that we can re-use larger layers when resizing a window down.
return NSViewLayerContentsPlacementTopLeft;
}
+#endif
- (void)updateMetalLayerDrawableSize:(CAMetalLayer *)layer
{
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 6da7265cfd..ba441a1921 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -569,12 +569,10 @@ public:
bool isFileSystem() const { return (m_attributes & SFGAO_FILESYSTEM) != 0; }
bool isDir() const { return (m_attributes & SFGAO_FOLDER) != 0; }
- // Copy using IFileOperation
- bool canCopy() const { return (m_attributes & SFGAO_CANCOPY) != 0; }
// Supports IStream
bool canStream() const { return (m_attributes & SFGAO_STREAM) != 0; }
- bool copyData(QIODevice *out);
+ bool copyData(QIODevice *out, QString *errorMessage);
static IShellItems itemsFromItemArray(IShellItemArray *items);
@@ -666,14 +664,19 @@ QWindowsShellItem::IShellItems QWindowsShellItem::itemsFromItemArray(IShellItemA
return result;
}
-bool QWindowsShellItem::copyData(QIODevice *out)
+bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)
{
- if (!canCopy() || !canStream())
+ if (!canStream()) {
+ *errorMessage = QLatin1String("Item not streamable");
return false;
+ }
IStream *istream = nullptr;
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
- if (FAILED(hr))
+ if (FAILED(hr)) {
+ *errorMessage = QLatin1String("BindToHandler() failed: ")
+ + QLatin1String(QWindowsContext::comErrorString(hr));
return false;
+ }
enum : ULONG { bufSize = 102400 };
char buffer[bufSize];
ULONG bytesRead;
@@ -686,7 +689,12 @@ bool QWindowsShellItem::copyData(QIODevice *out)
break;
}
istream->Release();
- return hr == S_OK || hr == S_FALSE;
+ if (hr != S_OK && hr != S_FALSE) {
+ *errorMessage = QLatin1String("Read() failed: ")
+ + QLatin1String(QWindowsContext::comErrorString(hr));
+ return false;
+ }
+ return true;
}
// Helper for "Libraries": collections of folders appearing from Windows 7
@@ -735,8 +743,6 @@ void QWindowsShellItem::format(QDebug &d) const
d << " [dir]";
if (canStream())
d << " [stream]";
- if (canCopy())
- d << " [copyable]";
d << ", normalDisplay=\"" << normalDisplay()
<< "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
<< "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
@@ -967,7 +973,9 @@ void QWindowsNativeFileDialogBase::doExec(HWND owner)
const HRESULT hr = m_fileDialog->Show(owner);
QWindowsDialogs::eatMouseMove();
qCDebug(lcQpaDialogs) << '<' << __FUNCTION__ << " returns " << hex << hr;
- if (hr == S_OK) {
+ // Emit accepted() only if there is a result as otherwise UI hangs occur.
+ // For example, typing in invalid URLs results in empty result lists.
+ if (hr == S_OK && !m_data.selectedFiles().isEmpty()) {
emit accepted();
} else {
emit rejected();
@@ -1393,21 +1401,50 @@ static void cleanupTemporaryItemCopies()
QFile::remove(file);
}
-static QString createTemporaryItemCopy(QWindowsShellItem &qItem)
+// Determine temporary file pattern from a shell item's display
+// name. This can be a URL.
+
+static bool validFileNameCharacter(QChar c)
{
- if (!qItem.canCopy() || !qItem.canStream())
+ return c.isLetterOrNumber() || c == QLatin1Char('_') || c == QLatin1Char('-');
+}
+
+QString tempFilePattern(QString name)
+{
+ const int lastSlash = qMax(name.lastIndexOf(QLatin1Char('/')),
+ name.lastIndexOf(QLatin1Char('\\')));
+ if (lastSlash != -1)
+ name.remove(0, lastSlash + 1);
+
+ int lastDot = name.lastIndexOf(QLatin1Char('.'));
+ if (lastDot < 0)
+ lastDot = name.size();
+ name.insert(lastDot, QStringLiteral("_XXXXXX"));
+
+ for (int i = lastDot - 1; i >= 0; --i) {
+ if (!validFileNameCharacter(name.at(i)))
+ name[i] = QLatin1Char('_');
+ }
+
+ name.prepend(QDir::tempPath() + QLatin1Char('/'));
+ return name;
+}
+
+static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage)
+{
+ if (!qItem.canStream()) {
+ *errorMessage = QLatin1String("Item not streamable");
return QString();
- QString pattern = qItem.normalDisplay();
- const int lastDot = pattern.lastIndexOf(QLatin1Char('.'));
- const QString placeHolder = QStringLiteral("_XXXXXX");
- if (lastDot >= 0)
- pattern.insert(lastDot, placeHolder);
- else
- pattern.append(placeHolder);
-
- QTemporaryFile targetFile(QDir::tempPath() + QLatin1Char('/') + pattern);
+ }
+
+ QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay()));
targetFile.setAutoRemove(false);
- if (!targetFile.open() || !qItem.copyData(&targetFile))
+ if (!targetFile.open()) {
+ *errorMessage = QLatin1String("Cannot create temporary file: ")
+ + targetFile.errorString();
+ return QString();
+ }
+ if (!qItem.copyData(&targetFile, errorMessage))
return QString();
const QString result = targetFile.fileName();
if (temporaryItemCopies()->isEmpty())
@@ -1425,11 +1462,14 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
QWindowsShellItem qItem(item);
const QString path = qItem.path();
if (path.isEmpty() && !qItem.isDir()) {
- const QString temporaryCopy = createTemporaryItemCopy(qItem);
- if (temporaryCopy.isEmpty())
- qWarning() << "Unable to create a local copy of" << qItem;
- else
+ QString errorMessage;
+ const QString temporaryCopy = createTemporaryItemCopy(qItem, &errorMessage);
+ if (temporaryCopy.isEmpty()) {
+ qWarning().noquote() << "Unable to create a local copy of" << qItem
+ << ": " << errorMessage;
+ } else {
result.append(QUrl::fromLocalFile(temporaryCopy));
+ }
} else {
result.append(qItem.url());
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 04ddd3c98c..91fd612cde 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -1208,6 +1208,11 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD
return handled;
}
+inline qreal scaleOneValuator(qreal normValue, qreal screenMin, qreal screenSize)
+{
+ return screenMin + normValue * screenSize;
+}
+
void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletData)
{
auto *ev = reinterpret_cast<const qt_xcb_input_device_event_t *>(event);
@@ -1220,6 +1225,17 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
QPointF global(fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y));
double pressure = 0, rotation = 0, tangentialPressure = 0;
int xTilt = 0, yTilt = 0;
+ static const bool useValuators = !qEnvironmentVariableIsSet("QT_XCB_TABLET_LEGACY_COORDINATES");
+
+ // Valuators' values are relative to the physical size of the current virtual
+ // screen. Therefore we cannot use QScreen/QWindow geometry and should use
+ // QPlatformWindow/QPlatformScreen instead.
+ QRect physicalScreenArea;
+ if (Q_LIKELY(useValuators)) {
+ const QList<QPlatformScreen *> siblings = window->screen()->handle()->virtualSiblings();
+ for (const QPlatformScreen *screen : siblings)
+ physicalScreenArea |= screen->geometry();
+ }
for (QHash<int, TabletData::ValuatorClassInfo>::iterator it = tabletData->valuatorInfo.begin(),
ite = tabletData->valuatorInfo.end(); it != ite; ++it) {
@@ -1228,6 +1244,20 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
xi2GetValuatorValueIfSet(event, classInfo.number, &classInfo.curVal);
double normalizedValue = (classInfo.curVal - classInfo.minVal) / (classInfo.maxVal - classInfo.minVal);
switch (valuator) {
+ case QXcbAtom::AbsX:
+ if (Q_LIKELY(useValuators)) {
+ const qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.x(), physicalScreenArea.width());
+ global.setX(value);
+ local.setX(value - window->handle()->geometry().x());
+ }
+ break;
+ case QXcbAtom::AbsY:
+ if (Q_LIKELY(useValuators)) {
+ qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.y(), physicalScreenArea.height());
+ global.setY(value);
+ local.setY(value - window->handle()->geometry().y());
+ }
+ break;
case QXcbAtom::AbsPressure:
pressure = normalizedValue;
break;
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 9a11c4d818..0745e917a2 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -3411,18 +3411,20 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_IndicatorTabClose: {
// Make close button visible only on the hovered tab.
QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget());
+ const QWidget *closeBtn = w;
if (!tabBar) {
// QStyleSheetStyle instead of CloseButton (which has
// a QTabBar as a parent widget) uses the QTabBar itself:
tabBar = qobject_cast<QTabBar *>(const_cast<QWidget*>(w));
+ closeBtn = decltype(closeBtn)(property("_q_styleSheetRealCloseButton").value<void *>());
}
if (tabBar) {
const bool documentMode = tabBar->documentMode();
const QTabBarPrivate *tabBarPrivate = static_cast<QTabBarPrivate *>(QObjectPrivate::get(tabBar));
const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex();
if (!documentMode ||
- (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
- (w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) {
+ (hoveredTabIndex != -1 && ((closeBtn == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
+ (closeBtn == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) {
const bool hover = (opt->state & State_MouseOver);
const bool selected = (opt->state & State_Selected);
const bool pressed = (opt->state & State_Sunken);
@@ -4323,7 +4325,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
d->setupNSGraphicsContext(cgCtx, YES);
[s.toNSString() drawInRect:textRect
- withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c }];
+ withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c,
+ NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}];
d->restoreNSGraphicsContext(cgCtx);
} else {
diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp
index 8c065f93c9..e839137915 100644
--- a/src/tools/tracegen/etw.cpp
+++ b/src/tools/tracegen/etw.cpp
@@ -110,19 +110,21 @@ static QString createGuid(const QUuid &uuid)
return guid;
}
-static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
+static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
{
- QUuid uuid = QUuid::createUuidV5(QUuid(), providerName.toLocal8Bit());
+ QUuid uuid = QUuid::createUuidV5(QUuid(), provider.name.toLocal8Bit());
- const QString provider = providerVar(providerName);
+ const QString providerV = providerVar(provider.name);
const QString guard = includeGuard(fileName);
const QString guid = createGuid(uuid);
const QString guidString = uuid.toString();
stream << "#ifndef " << guard << "\n"
<< "#define " << guard << "\n"
+ << "\n"
<< "#include <windows.h>\n"
- << "#include <TraceLoggingProvider.h>\n";
+ << "#include <TraceLoggingProvider.h>\n"
+ << "\n";
/* TraceLogging API macros cannot deal with UTF8
* source files, so we work around it like this
@@ -132,30 +134,33 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const QS
"#define _TlgPragmaUtf8Begin\n"
"#define _TlgPragmaUtf8End\n";
+ stream << "\n";
stream << qtHeaders();
-
stream << "\n";
+ if (!provider.prefixText.isEmpty())
+ stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
+
stream << "#ifdef TRACEPOINT_DEFINE\n"
<< "/* " << guidString << " */\n"
- << "TRACELOGGING_DEFINE_PROVIDER(" << provider << ", \""
- << providerName <<"\", " << guid << ");\n\n";
+ << "TRACELOGGING_DEFINE_PROVIDER(" << providerV << ", \""
+ << provider.name <<"\", " << guid << ");\n\n";
stream << "static inline void registerProvider()\n"
<< "{\n"
- << " TraceLoggingRegister(" << provider << ");\n"
+ << " TraceLoggingRegister(" << providerV << ");\n"
<< "}\n\n";
stream << "static inline void unregisterProvider()\n"
<< "{\n"
- << " TraceLoggingUnregister(" << provider << ");\n"
+ << " TraceLoggingUnregister(" << providerV << ");\n"
<< "}\n";
stream << "Q_CONSTRUCTOR_FUNCTION(registerProvider)\n"
<< "Q_DESTRUCTOR_FUNCTION(unregisterProvider)\n\n";
stream << "#else\n"
- << "TRACELOGGING_DECLARE_PROVIDER(" << provider << ");\n"
+ << "TRACELOGGING_DECLARE_PROVIDER(" << providerV << ");\n"
<< "#endif // TRACEPOINT_DEFINE\n\n";
}
@@ -224,7 +229,7 @@ void writeEtw(QFile &file, const Provider &provider)
const QString fileName = QFileInfo(file.fileName()).fileName();
- writePrologue(stream, fileName, provider.name);
+ writePrologue(stream, fileName, provider);
writeTracepoints(stream, provider);
writeEpilogue(stream, fileName);
}
diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp
index 5d41bf5f1f..f0fbca9e16 100644
--- a/src/tools/tracegen/lttng.cpp
+++ b/src/tools/tracegen/lttng.cpp
@@ -104,16 +104,21 @@ static void writeCtfMacro(QTextStream &stream, const Tracepoint::Field &field)
}
}
-static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
+static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
{
+ const QString guard = includeGuard(fileName);
+
stream << "#undef TRACEPOINT_PROVIDER\n";
- stream << "#define TRACEPOINT_PROVIDER " << providerName << "\n\n";
+ stream << "#define TRACEPOINT_PROVIDER " << provider.name << "\n";
+ stream << "\n";
+ // include prefix text or qt headers only once
+ stream << "#if !defined(" << guard << ")\n";
stream << qtHeaders();
-
- const QString guard = includeGuard(fileName);
-
stream << "\n";
+ if (!provider.prefixText.isEmpty())
+ stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
+ stream << "#endif\n\n";
/* the first guard is the usual one, the second is required
* by LTTNG to force the re-evaluation of TRACEPOINT_* macros
@@ -213,7 +218,7 @@ void writeLttng(QFile &file, const Provider &provider)
const QString fileName = QFileInfo(file.fileName()).fileName();
- writePrologue(stream, fileName, provider.name);
+ writePrologue(stream, fileName, provider);
writeTracepoints(stream, provider);
writeEpilogue(stream, fileName);
}
diff --git a/src/tools/tracegen/provider.cpp b/src/tools/tracegen/provider.cpp
index a6523a2e3d..39633efe5d 100644
--- a/src/tools/tracegen/provider.cpp
+++ b/src/tools/tracegen/provider.cpp
@@ -275,9 +275,21 @@ Provider parseProvider(const QString &filename)
Provider provider;
provider.name = QFileInfo(filename).baseName();
+ bool parsingPrefixText = false;
for (int lineNumber = 1; !s.atEnd(); ++lineNumber) {
QString line = s.readLine().trimmed();
+ if (line == QLatin1String("{")) {
+ parsingPrefixText = true;
+ continue;
+ } else if (parsingPrefixText && line == QLatin1String("}")) {
+ parsingPrefixText = false;
+ continue;
+ } else if (parsingPrefixText) {
+ provider.prefixText.append(line);
+ continue;
+ }
+
if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
continue;
@@ -296,7 +308,14 @@ Provider parseProvider(const QString &filename)
}
}
+ if (parsingPrefixText) {
+ panic("Syntax error while processing '%s': "
+ "no closing brace found for prefix text block",
+ qPrintable(filename));
+ }
+
#ifdef TRACEGEN_DEBUG
+ qDebug() << provider.prefixText;
for (auto i = provider.tracepoints.constBegin(); i != provider.tracepoints.constEnd(); ++i)
dumpTracepoint(*i);
#endif
diff --git a/src/tools/tracegen/provider.h b/src/tools/tracegen/provider.h
index 9771e62f4d..9be0c33d89 100644
--- a/src/tools/tracegen/provider.h
+++ b/src/tools/tracegen/provider.h
@@ -86,6 +86,7 @@ struct Provider
{
QString name;
QVector<Tracepoint> tracepoints;
+ QStringList prefixText;
};
Provider parseProvider(const QString &filename);
diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
index a9d95bc02c..645da5bca2 100644
--- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
@@ -286,7 +286,7 @@
QStyleOption to a subclass (e.g., QStyleOptionFocusRect). For
safety, you can use qstyleoption_cast() to ensure that the
pointer type is correct. If the object isn't of the right type,
- qstyleoption_cast() returns 0. For example:
+ qstyleoption_cast() returns \nullptr. For example:
\snippet code/doc_src_qt4-styles.cpp 0
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index eee3e91ac3..d576d323c3 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -1813,7 +1813,7 @@ void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\fn QTableWidgetItem *QTableWidget::itemAt(int ax, int ay) const
Returns the item at the position equivalent to QPoint(\a{ax}, \a{ay}) in
- the table widget's coordinate system, or returns 0 if the specified point
+ the table widget's coordinate system, or returns \nullptr if the specified point
is not covered by an item in the table widget.
\sa item()
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index ebab87b193..fdece8414c 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3697,7 +3697,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
// duplication is because tracepoint symbols are not exported by QtCore.
// If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too.
- Q_TRACE(QApplication_notify_entry, receiver, e, e->type());
+ Q_TRACE_SCOPE(QApplication_notify, receiver, e, e->type());
// send to all application event filters
if (threadRequiresCoreApplication()
diff --git a/src/widgets/qtwidgets.tracepoints b/src/widgets/qtwidgets.tracepoints
index 01a1383670..9c40cdb3e7 100644
--- a/src/widgets/qtwidgets.tracepoints
+++ b/src/widgets/qtwidgets.tracepoints
@@ -1,4 +1,11 @@
+{
+QT_BEGIN_NAMESPACE
+class QEvent;
+QT_END_NAMESPACE
+}
+
QApplication_notify_entry(QObject *receiver, QEvent *event, int type)
+QApplication_notify_exit(QObject *receiver, QEvent *event, int type)
QApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 79fa20851f..73b147e622 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4590,8 +4590,12 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
break;
#if QT_CONFIG(tabbar)
case PE_IndicatorTabClose:
- if (w)
+ if (w) {
+ // QMacStyle needs a real widget, not its parent - to implement
+ // 'document mode' properly, drawing nothing if a tab is not hovered.
+ baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant::fromValue((void *)w));
w = w->parentWidget(); //match on the QTabBar instead of the CloseButton
+ }
pseudoElement = PseudoElement_TabBarTabCloseButton;
#endif
@@ -4609,6 +4613,9 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
} else {
baseStyle()->drawPrimitive(pe, opt, p, w);
}
+
+ if (baseStyle()->property("_q_styleSheetRealCloseButton").toBool())
+ baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant(QVariant::Invalid));
}
QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap,
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 821c40af81..be535c1846 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -33,8 +33,6 @@ SOURCES += \
RESOURCES += styles/qstyle.qrc
-include($$OUT_PWD/qtwidgets-config.pri)
-
qtConfig(animation) {
HEADERS += styles/qstyleanimation_p.h
SOURCES += styles/qstyleanimation.cpp
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 5d344834e6..279ee2e8a0 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -952,29 +952,42 @@ void tst_QLocale::stringToDouble()
void tst_QLocale::stringToFloat_data()
{
+ using Bounds = std::numeric_limits<float>;
toReal_data();
- if (std::numeric_limits<float>::has_infinity) {
- double huge = std::numeric_limits<float>::infinity();
- QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge;
- QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge;
- QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge;
+ const QString C(QStringLiteral("C"));
+ if (Bounds::has_infinity) {
+ double huge = Bounds::infinity();
+ QTest::newRow("C inf") << C << QString("inf") << true << huge;
+ QTest::newRow("C +inf") << C << QString("+inf") << true << +huge;
+ QTest::newRow("C -inf") << C << QString("-inf") << true << -huge;
// Overflow float, but not double:
- QTest::newRow("C big") << QString("C") << QString("3.5e38") << false << huge;
- QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << false << -huge;
+ QTest::newRow("C big") << C << QString("3.5e38") << false << huge;
+ QTest::newRow("C -big") << C << QString("-3.5e38") << false << -huge;
// Overflow double, too:
- QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge;
- QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge;
+ QTest::newRow("C huge") << C << QString("2e308") << false << huge;
+ QTest::newRow("C -huge") << C << QString("-2e308") << false << -huge;
}
- if (std::numeric_limits<float>::has_quiet_NaN)
- QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << double(std::numeric_limits<float>::quiet_NaN());
+ if (Bounds::has_quiet_NaN)
+ QTest::newRow("C qnan") << C << QString("NaN") << true << double(Bounds::quiet_NaN());
+
+ // Minimal float: shouldn't underflow
+ QTest::newRow("C float min")
+ << C << QLocale::c().toString(Bounds::denorm_min()) << true << double(Bounds::denorm_min());
+ QTest::newRow("C float -min")
+ << C << QLocale::c().toString(-Bounds::denorm_min()) << true << -double(Bounds::denorm_min());
// Underflow float, but not double:
- QTest::newRow("C small") << QString("C") << QString("1e-45") << false << 0.;
- QTest::newRow("C -small") << QString("C") << QString("-1e-45") << false << 0.;
+ QTest::newRow("C small") << C << QString("7e-46") << false << 0.;
+ QTest::newRow("C -small") << C << QString("-7e-46") << false << 0.;
+ using Double = std::numeric_limits<double>;
+ QTest::newRow("C double min")
+ << C << QLocale::c().toString(Double::denorm_min()) << false << 0.0;
+ QTest::newRow("C double -min")
+ << C << QLocale::c().toString(-Double::denorm_min()) << false << 0.0;
// Underflow double, too:
- QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.;
- QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.;
+ QTest::newRow("C tiny") << C << QString("2e-324") << false << 0.;
+ QTest::newRow("C -tiny") << C << QString("-2e-324") << false << 0.;
}
void tst_QLocale::stringToFloat()
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index eff9835776..bb6c48a2ed 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -539,8 +539,13 @@ void tst_QTimeZone::checkOffset_data()
int year, month, day, hour, min, sec;
int std, dst;
} table[] = {
- // Zone with no transitions (QTBUG-74614, when TZ backend uses minimalist data)
+ // Zone with no transitions (QTBUG-74614, QTBUG-74666, when TZ backend uses minimal data)
{ "Etc/UTC", "epoch", 1970, 1, 1, 0, 0, 0, 0, 0 },
+ { "Etc/UTC", "pre_int32", 1901, 12, 13, 20, 45, 51, 0, 0 },
+ { "Etc/UTC", "post_int32", 2038, 1, 19, 3, 14, 9, 0, 0 },
+ { "Etc/UTC", "post_uint32", 2106, 2, 7, 6, 28, 17, 0, 0 },
+ { "Etc/UTC", "initial", -292275056, 5, 16, 16, 47, 5, 0, 0 },
+ { "Etc/UTC", "final", 292278994, 8, 17, 7, 12, 55, 0, 0 },
// Kiev: regression test for QTBUG-64122 (on MS):
{ "Europe/Kiev", "summer", 2017, 10, 27, 12, 0, 0, 2 * 3600, 3600 },
{ "Europe/Kiev", "winter", 2017, 10, 29, 12, 0, 0, 2 * 3600, 0 }
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 6bc27a6e16..bb81b9f61f 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -3260,11 +3260,46 @@ void tst_QImage::metadataPassthrough()
QCOMPARE(mirrored.dotsPerMeterY(), a.dotsPerMeterY());
QCOMPARE(mirrored.devicePixelRatio(), a.devicePixelRatio());
+ QTransform t;
+ t.rotate(90);
+ QImage rotated = a.transformed(t);
+ QCOMPARE(rotated.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(rotated.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(rotated.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(rotated.devicePixelRatio(), a.devicePixelRatio());
+
QImage swapped = a.rgbSwapped();
QCOMPARE(swapped.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
QCOMPARE(swapped.dotsPerMeterX(), a.dotsPerMeterX());
QCOMPARE(swapped.dotsPerMeterY(), a.dotsPerMeterY());
QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage converted = a.convertToFormat(QImage::Format_RGB32);
+ QCOMPARE(converted.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(converted.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(converted.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(converted.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage copied = a.copy(0, 0, a.width() / 2, a.height() / 2);
+ QCOMPARE(copied.text(QStringLiteral("Test")), a.text(QStringLiteral("Test")));
+ QCOMPARE(copied.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(copied.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(copied.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage alphaMask = a.createAlphaMask();
+ QCOMPARE(alphaMask.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(alphaMask.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(alphaMask.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage heuristicMask = a.createHeuristicMask();
+ QCOMPARE(heuristicMask.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(heuristicMask.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(heuristicMask.devicePixelRatio(), a.devicePixelRatio());
+
+ QImage maskFromColor = a.createMaskFromColor(qRgb(0, 0, 0));
+ QCOMPARE(maskFromColor.dotsPerMeterX(), a.dotsPerMeterX());
+ QCOMPARE(maskFromColor.dotsPerMeterY(), a.dotsPerMeterY());
+ QCOMPARE(maskFromColor.devicePixelRatio(), a.devicePixelRatio());
}
void tst_QImage::pixelColor()
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 9a338ad55a..4d31d80246 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -121,6 +121,7 @@ private slots:
void copy();
void deepCopyPreservesDpr();
+ void dprPassthrough();
void depthOfNullObjects();
void transformed();
@@ -1169,6 +1170,39 @@ void tst_QPixmap::deepCopyPreservesDpr()
QCOMPARE(dest.devicePixelRatio(), dpr);
}
+void tst_QPixmap::dprPassthrough()
+{
+ const qreal dpr = 2;
+ QPixmap src(32, 32);
+ src.setDevicePixelRatio(dpr);
+ src.fill(Qt::transparent);
+ QCOMPARE(src.devicePixelRatio(), dpr);
+
+ QImage img = src.toImage();
+ QCOMPARE(img.devicePixelRatio(), dpr);
+
+ QPixmap pm(1, 1);
+ pm.convertFromImage(img);
+ QCOMPARE(pm.devicePixelRatio(), dpr);
+
+ QBitmap heuristicMask = src.createHeuristicMask();
+ QCOMPARE(heuristicMask.devicePixelRatio(), dpr);
+
+ QBitmap maskFromColor = src.createMaskFromColor(Qt::white);
+ QCOMPARE(maskFromColor.devicePixelRatio(), dpr);
+
+ QBitmap mask = src.mask();
+ QCOMPARE(mask.devicePixelRatio(), dpr);
+
+ QPixmap scaled = src.scaled(16, 16);
+ QCOMPARE(scaled.devicePixelRatio(), dpr);
+
+ QTransform t;
+ t.rotate(90);
+ QPixmap transformed = src.transformed(t);
+ QCOMPARE(transformed.devicePixelRatio(), dpr);
+}
+
void tst_QPixmap::depthOfNullObjects()
{
QBitmap b1;
diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
index cd3eaa1478..ce6ce15767 100644
--- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
+++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
@@ -345,6 +345,8 @@ void tst_QBrush::gradientPresets()
QGradient invalidPreset(QGradient::Preset(-1));
QCOMPARE(invalidPreset.type(), QGradient::NoGradient);
+ QBrush brush(invalidPreset);
+ QCOMPARE(brush.style(), Qt::NoBrush);
}
void fill(QPaintDevice *pd) {
diff --git a/tests/auto/network/kernel/qhostinfo/BLACKLIST b/tests/auto/network/kernel/qhostinfo/BLACKLIST
index cd4d4eb03c..87c5fe991f 100644
--- a/tests/auto/network/kernel/qhostinfo/BLACKLIST
+++ b/tests/auto/network/kernel/qhostinfo/BLACKLIST
@@ -4,5 +4,3 @@
windows ci
[blockingLookup:a-plus-aaaa]
windows ci
-[reverseLookup:google-public-dns-a.google.com]
-ci
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index 82825f608c..0a130d363e 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -396,6 +396,68 @@ void tst_QHostInfo::lookupConnectToLambda()
QCOMPARE(tmp.join(' '), expected.join(' '));
}
+static QStringList reverseLookupHelper(const QString &ip)
+{
+ QStringList results;
+
+ const QString pythonCode =
+ "import socket;"
+ "import sys;"
+ "print (socket.getnameinfo((sys.argv[1], 0), 0)[0]);";
+
+ QList<QByteArray> lines;
+ QProcess python;
+ python.setProcessChannelMode(QProcess::ForwardedErrorChannel);
+ python.start("python", QStringList() << QString("-c") << pythonCode << ip);
+ if (python.waitForFinished()) {
+ if (python.exitStatus() == QProcess::NormalExit && python.exitCode() == 0)
+ lines = python.readAllStandardOutput().split('\n');
+ for (QByteArray line : lines) {
+ if (!line.isEmpty())
+ results << line.trimmed();
+ }
+ if (!results.isEmpty())
+ return results;
+ }
+
+ qDebug() << "Python failed, falling back to nslookup";
+ QProcess lookup;
+ lookup.setProcessChannelMode(QProcess::ForwardedErrorChannel);
+ lookup.start("nslookup", QStringList(ip));
+ if (!lookup.waitForFinished()) {
+ results << "nslookup failure";
+ qDebug() << "nslookup failure";
+ return results;
+ }
+ lines = lookup.readAllStandardOutput().split('\n');
+
+ QByteArray name;
+
+ const QByteArray nameMarkerNix("name =");
+ const QByteArray nameMarkerWin("Name:");
+ const QByteArray addressMarkerWin("Address:");
+
+ for (QByteArray line : lines) {
+ int index = -1;
+ if ((index = line.indexOf(nameMarkerNix)) != -1) { // Linux and macOS
+ name = line.mid(index + nameMarkerNix.length()).chopped(1).trimmed();
+ results << name;
+ } else if (line.startsWith(nameMarkerWin)) { // Windows formatting
+ name = line.mid(line.lastIndexOf(" ")).trimmed();
+ } else if (line.startsWith(addressMarkerWin)) {
+ QByteArray address = line.mid(addressMarkerWin.length()).trimmed();
+ if (address == ip) {
+ results << name;
+ }
+ }
+ }
+
+ if (results.isEmpty()) {
+ qDebug() << "Failure to parse nslookup output: " << lines;
+ }
+ return results;
+}
+
void tst_QHostInfo::reverseLookup_data()
{
QTest::addColumn<QString>("address");
@@ -403,8 +465,8 @@ void tst_QHostInfo::reverseLookup_data()
QTest::addColumn<int>("err");
QTest::addColumn<bool>("ipv6");
- QTest::newRow("google-public-dns-a.google.com") << QString("8.8.8.8") << QStringList(QString("google-public-dns-a.google.com")) << 0 << false;
- QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 0 << false;
+ QTest::newRow("dns.google") << QString("8.8.8.8") << reverseLookupHelper("8.8.8.8") << 0 << false;
+ QTest::newRow("one.one.one.one") << QString("1.1.1.1") << reverseLookupHelper("1.1.1.1") << 0 << false;
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
}
@@ -422,6 +484,8 @@ void tst_QHostInfo::reverseLookup()
QHostInfo info = QHostInfo::fromName(address);
if (err == 0) {
+ if (!hostNames.contains(info.hostName()))
+ qDebug() << "Failure: expecting" << hostNames << ",got " << info.hostName();
QVERIFY(hostNames.contains(info.hostName()));
QCOMPARE(info.addresses().first(), QHostAddress(address));
} else {
diff --git a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp
index 4cc1810cd4..f4b91265a4 100644
--- a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp
+++ b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp
@@ -59,25 +59,22 @@ class tst_QSizeGrip : public QObject
{
Q_OBJECT
public slots:
- void initTestCase();
- void cleanupTestCase();
+ void cleanup();
private slots:
void hideAndShowOnWindowStateChange_data();
void hideAndShowOnWindowStateChange();
void orientation();
void dontCrashOnTLWChange();
-
-private:
- QLineEdit *dummyWidget;
};
class TestWidget : public QWidget
{
public:
- TestWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0) : QWidget(parent, flags) {}
- QSize sizeHint() const { return QSize(300, 200); }
- void changeEvent(QEvent *event)
+ using QWidget::QWidget;
+
+ QSize sizeHint() const override { return QSize(300, 200); }
+ void changeEvent(QEvent *event) override
{
QWidget::changeEvent(event);
if (isWindow() && event->type() == QEvent::WindowStateChange)
@@ -85,16 +82,9 @@ public:
}
};
-void tst_QSizeGrip::initTestCase()
-{
- dummyWidget = new QLineEdit;
- dummyWidget->show();
-}
-
-void tst_QSizeGrip::cleanupTestCase()
+void tst_QSizeGrip::cleanup()
{
- delete dummyWidget;
- dummyWidget = 0;
+ QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
void tst_QSizeGrip::hideAndShowOnWindowStateChange_data()
@@ -111,46 +101,45 @@ void tst_QSizeGrip::hideAndShowOnWindowStateChange()
QSKIP("Broken on WinRT - QTBUG-68297");
#endif
- QWidget *parentWidget = windowType == Qt::Window ? 0 : new QWidget;
- TestWidget *widget = new TestWidget(parentWidget, Qt::WindowFlags(windowType));
- QSizeGrip *sizeGrip = new QSizeGrip(widget);
+ QScopedPointer<QWidget> parentWidget;
+ if (windowType != Qt::Window)
+ parentWidget.reset(new QWidget);
+ QScopedPointer<TestWidget> widget(new TestWidget(parentWidget.data(), Qt::WindowFlags(windowType)));
+ QSizeGrip *sizeGrip = new QSizeGrip(widget.data());
// Normal.
if (parentWidget)
parentWidget->show();
else
widget->show();
- QVERIFY(sizeGrip->isVisible());
+ QTRY_VERIFY(sizeGrip->isVisible());
widget->showFullScreen();
- QVERIFY(!sizeGrip->isVisible());
+ QTRY_VERIFY(!sizeGrip->isVisible());
widget->showNormal();
- QVERIFY(sizeGrip->isVisible());
+ QTRY_VERIFY(sizeGrip->isVisible());
widget->showMaximized();
#ifndef Q_OS_MAC
- QVERIFY(!sizeGrip->isVisible());
+ QTRY_VERIFY(!sizeGrip->isVisible());
#else
QEXPECT_FAIL("", "QTBUG-23681", Abort);
QVERIFY(sizeGrip->isVisible());
#endif
widget->showNormal();
- QVERIFY(sizeGrip->isVisible());
+ QTRY_VERIFY(sizeGrip->isVisible());
sizeGrip->hide();
- QVERIFY(!sizeGrip->isVisible());
+ QTRY_VERIFY(!sizeGrip->isVisible());
widget->showFullScreen();
widget->showNormal();
- QVERIFY(!sizeGrip->isVisible());
+ QTRY_VERIFY(!sizeGrip->isVisible());
widget->showMaximized();
widget->showNormal();
- QVERIFY(!sizeGrip->isVisible());
-
- delete widget;
- delete parentWidget;
+ QTRY_VERIFY(!sizeGrip->isVisible());
}
void tst_QSizeGrip::orientation()
@@ -196,10 +185,10 @@ void tst_QSizeGrip::dontCrashOnTLWChange()
QMdiArea mdiArea;
mdiArea.show();
- QMainWindow *mw = new QMainWindow();
- QMdiSubWindow *mdi = mdiArea.addSubWindow(mw);
+ QScopedPointer<QMainWindow> mw(new QMainWindow);
+ QMdiSubWindow *mdi = mdiArea.addSubWindow(mw.data());
mw->statusBar()->setSizeGripEnabled(true);
- mdiArea.removeSubWindow(mw);
+ mdiArea.removeSubWindow(mw.data());
delete mdi;
mw->show();
@@ -209,7 +198,7 @@ void tst_QSizeGrip::dontCrashOnTLWChange()
QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(&mdiArea));
- QVERIFY(QTest::qWaitForWindowExposed(mw));
+ QVERIFY(QTest::qWaitForWindowExposed(mw.data()));
}
QTEST_MAIN(tst_QSizeGrip)
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 9e3c761cff..62d03e735d 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -505,8 +505,15 @@ void FileDialogPanel::accepted()
Q_ASSERT(d);
m_result.clear();
QDebug(&m_result).nospace()
+#if QT_VERSION >= 0x050000
+ << "URLs: " << d->selectedUrls() << '\n'
+#endif
<< "Files: " << d->selectedFiles()
- << "\nDirectory: " << d->directory().absolutePath()
+ << "\nDirectory: "
+#if QT_VERSION >= 0x050000
+ << d->directoryUrl() << ", "
+#endif
+ << d->directory().absolutePath()
<< "\nName filter: " << d->selectedNameFilter();
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
}