summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/pcre2/qt_attribution.json2
-rw-r--r--src/android/templates/build.gradle2
-rw-r--r--src/corelib/global/qcompilerdetection.h18
-rw-r--r--src/corelib/global/qfloat16.h17
-rw-r--r--src/corelib/global/qglobal.cpp24
-rw-r--r--src/corelib/global/qglobal.h18
-rw-r--r--src/corelib/global/qsysinfo.h1
-rw-r--r--src/corelib/io/qdatastream.cpp20
-rw-r--r--src/corelib/io/qdatastream.h2
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/io/qfileselector.cpp10
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp21
-rw-r--r--src/corelib/io/qloggingregistry.cpp83
-rw-r--r--src/corelib/io/qloggingregistry_p.h7
-rw-r--r--src/corelib/io/qprocess_unix.cpp4
-rw-r--r--src/corelib/io/qurl.h4
-rw-r--r--src/corelib/kernel/qjni.cpp2
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
-rw-r--r--src/corelib/kernel/qvariant.cpp21
-rw-r--r--src/corelib/thread/qthreadpool.h2
-rw-r--r--src/corelib/tools/qarraydata.h14
-rw-r--r--src/corelib/tools/qarraydatapointer.h2
-rw-r--r--src/corelib/tools/qbytearray.h60
-rw-r--r--src/corelib/tools/qdatetime.cpp3
-rw-r--r--src/corelib/tools/qdatetime.h20
-rw-r--r--src/corelib/tools/qline.h18
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qmap.h6
-rw-r--r--src/corelib/tools/qpoint.h6
-rw-r--r--src/corelib/tools/qrect.h46
-rw-r--r--src/corelib/tools/qregularexpression.cpp35
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h5
-rw-r--r--src/corelib/tools/qsimd_p.h5
-rw-r--r--src/corelib/tools/qsize.h26
-rw-r--r--src/corelib/tools/qstring.h230
-rw-r--r--src/corelib/tools/qstringbuilder.cpp28
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h4
-rw-r--r--src/corelib/tools/qversionnumber.h32
-rw-r--r--src/dbus/Qt5DBusMacros.cmake3
-rw-r--r--src/gui/configure.json26
-rw-r--r--src/gui/doc/qtgui.qdocconf3
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/image/qimage.h8
-rw-r--r--src/gui/image/qpnghandler.cpp2
-rw-r--r--src/gui/kernel/qevent.cpp14
-rw-r--r--src/gui/kernel/qguiapplication.cpp14
-rw-r--r--src/gui/kernel/qopenglwindow.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp2
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.cpp7
-rw-r--r--src/gui/kernel/qtouchdevice.cpp5
-rw-r--r--src/gui/kernel/qwindow.cpp4
-rw-r--r--src/gui/math3d/qgenericmatrix.h2
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp4
-rw-r--r--src/gui/math3d/qmatrix4x4.h3
-rw-r--r--src/gui/math3d/qquaternion.h6
-rw-r--r--src/gui/math3d/qvector2d.h2
-rw-r--r--src/gui/math3d/qvector4d.h2
-rw-r--r--src/gui/opengl/qopengl.h6
-rw-r--r--src/gui/opengl/qopengltexture.cpp6
-rw-r--r--src/gui/painting/qcolor.h10
-rw-r--r--src/gui/painting/qgrayraster.c6
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qpainterpath.h16
-rw-r--r--src/gui/painting/qpolygon.h18
-rw-r--r--src/gui/painting/qregion.h28
-rw-r--r--src/gui/painting/qtransform.h6
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp21
-rw-r--r--src/gui/text/qplatformfontdatabase.h7
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp10
-rw-r--r--src/network/access/qhstspolicy.cpp8
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp6
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp6
-rw-r--r--src/network/ssl/qsslellipticcurve.h4
-rw-r--r--src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc8
-rw-r--r--src/platformsupport/accessibility/accessibility.pro1
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience.pro1
-rw-r--r--src/platformsupport/clipboard/clipboard.pro1
-rw-r--r--src/platformsupport/devicediscovery/devicediscovery.pro1
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp8
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm211
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h6
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm37
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h2
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp12
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h1
-rw-r--r--src/platformsupport/glxconvenience/glxconvenience.pro1
-rw-r--r--src/platformsupport/graphics/graphics.pro1
-rw-r--r--src/platformsupport/kmsconvenience/kmsconvenience.pro1
-rw-r--r--src/platformsupport/platformcompositor/platformcompositor.pro1
-rw-r--r--src/platformsupport/themes/themes.pro1
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp69
-rw-r--r--src/plugins/platforms/android/androidjnimain.h2
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp13
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h7
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp3
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp10
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp10
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp7
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp53
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp3
-rw-r--r--src/plugins/platforms/winrt/winrt.pro1
-rw-r--r--src/plugins/platformthemes/gtk3/gtk3.pro1
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.cpp2
-rw-r--r--src/sql/doc/src/sql-driver.qdoc54
-rw-r--r--src/sql/doc/src/sql-programming.qdoc13
-rw-r--r--src/testlib/qtest.h6
-rw-r--r--src/tools/bootstrap/bootstrap.pro1
-rw-r--r--src/widgets/configure.json4
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp9
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp5
-rw-r--r--src/widgets/kernel/qlayout.cpp31
-rw-r--r--src/widgets/kernel/qsizepolicy.h3
-rw-r--r--src/widgets/kernel/qwidget.cpp8
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp11
-rw-r--r--src/widgets/widgets/qmenu.cpp143
-rw-r--r--src/widgets/widgets/qmenu_p.h15
-rw-r--r--src/widgets/widgets/qsplitter.cpp4
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp1
128 files changed, 1080 insertions, 817 deletions
diff --git a/src/3rdparty/pcre2/qt_attribution.json b/src/3rdparty/pcre2/qt_attribution.json
index 2e80d51298..bcf7650993 100644
--- a/src/3rdparty/pcre2/qt_attribution.json
+++ b/src/3rdparty/pcre2/qt_attribution.json
@@ -2,7 +2,7 @@
"Id": "pcre2",
"Name": "PCRE2",
"QDocModule": "qtcore",
- "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre2 or -no-pcre2 to avoid.",
+ "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre or -no-pcre to avoid.",
"Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.",
"Homepage": "http://www.pcre.org/",
diff --git a/src/android/templates/build.gradle b/src/android/templates/build.gradle
index dbe841255d..3a3e0cd165 100644
--- a/src/android/templates/build.gradle
+++ b/src/android/templates/build.gradle
@@ -4,7 +4,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.2.3'
}
}
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index fcfe020509..5fc7ac9c7e 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -172,7 +172,11 @@
/* Clang also masquerades as GCC */
# if defined(__apple_build_version__)
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
-# if __apple_build_version__ >= 7000053
+# if __apple_build_version__ >= 8020041
+# define Q_CC_CLANG 309
+# elif __apple_build_version__ >= 8000038
+# define Q_CC_CLANG 308
+# elif __apple_build_version__ >= 7000053
# define Q_CC_CLANG 306
# elif __apple_build_version__ >= 6000051
# define Q_CC_CLANG 305
@@ -628,10 +632,7 @@
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
-# ifndef Q_OS_OSX
-// C++11 thread_local is broken on OS X (Clang doesn't support it either)
-# define Q_COMPILER_THREAD_LOCAL
-# endif
+# define Q_COMPILER_THREAD_LOCAL
# define Q_COMPILER_UDL
# endif
# ifdef _MSC_VER
@@ -993,6 +994,10 @@
# endif /* __cplusplus */
#endif /* Q_CC_MSVC */
+#ifdef Q_COMPILER_UNICODE_STRINGS
+# define Q_STDLIB_UNICODE_STRINGS
+#endif
+
#ifdef __cplusplus
# include <utility>
# if defined(Q_OS_QNX)
@@ -1015,8 +1020,9 @@
# undef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_RVALUE_REFS
# undef Q_COMPILER_REF_QUALIFIERS
-# undef Q_COMPILER_UNICODE_STRINGS
# undef Q_COMPILER_NOEXCEPT
+// Disable C++11 library features:
+# undef Q_STDLIB_UNICODE_STRINGS
# endif // !_HAS_CPP0X
# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T
# undef Q_COMPILER_NULLPTR
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 05b88e0e92..b0272c51c3 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -81,18 +81,18 @@ private:
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
// The remainder of these utility functions complement qglobal.h
-inline Q_REQUIRED_RESULT int qRound(qfloat16 d) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline int qRound(qfloat16 d) Q_DECL_NOTHROW
{ return qRound(static_cast<float>(d)); }
-inline Q_REQUIRED_RESULT qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
{ return qRound64(static_cast<float>(d)); }
-inline Q_REQUIRED_RESULT bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
{
float f1 = static_cast<float>(p1);
float f2 = static_cast<float>(p2);
@@ -105,7 +105,7 @@ inline Q_REQUIRED_RESULT bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOT
return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
}
-inline Q_REQUIRED_RESULT bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
{
return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
}
@@ -115,6 +115,7 @@ inline int qIntCast(qfloat16 f) Q_DECL_NOTHROW
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
+QT_WARNING_DISABLE_GCC("-Wold-style-cast")
inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
{
#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__))
@@ -246,7 +247,7 @@ QT_WARNING_POP
/*!
\internal
*/
-inline Q_REQUIRED_RESULT bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
{
return qAbs(static_cast<float>(f)) <= 0.001f;
}
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index e7bfbb2903..6de03d73b3 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2643,12 +2643,14 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
- "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
- "watchos" for watchOS systems, and "darwin" in case the system could not
- be determined.
+ \b{\macos note}: this function returns "osx" for all \macos systems,
+ regardless of Apple naming convention. The returned string will be updated
+ for Qt 6. Note that this function erroneously returned "macos" for \macos
+ 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
- \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
+ \b{Darwin, iOS, tvOS, and watchOS note}: this function returns "ios" for
+ iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and
+ "darwin" in case the system could not be determined.
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2681,10 +2683,12 @@ QString QSysInfo::productType()
#elif defined(Q_OS_WATCHOS)
return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
- const auto version = QOperatingSystemVersion::current();
- if (version.majorVersion() == 10 && version.minorVersion() < 12)
- return QStringLiteral("osx");
+ // ### Qt6: remove fallback
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QStringLiteral("macos");
+# else
+ return QStringLiteral("osx");
+# endif
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
@@ -3198,12 +3202,16 @@ static QBasicMutex environmentMutex;
Returns the value of the environment variable with name \a
varName. To get the variable string, use QByteArray::constData().
+ To convert the data to a QString use QString::fromLocal8Bit().
\note qgetenv() was introduced because getenv() from the standard
C library was deprecated in VC2005 (and later versions). qgetenv()
uses the new replacement function in VC, and calls the standard C
library's implementation on all other platforms.
+ \warning Don't use qgetenv on Windows if the content may contain
+ non-US-ASCII characters, like file paths.
+
\sa qputenv(), qEnvironmentVariableIsSet(), qEnvironmentVariableIsEmpty()
*/
QByteArray qgetenv(const char *varName)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 49577caba2..e04d9fdefa 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -783,26 +783,22 @@ typedef void (*QFunctionPointer)();
# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
#endif
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2)
{
return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2)
{
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(float f)
{
return qAbs(f) <= 0.00001f;
}
@@ -812,8 +808,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-static inline bool qIsNull(double d)
+Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(double d)
{
union U {
double d;
@@ -829,8 +824,7 @@ static inline bool qIsNull(double d)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-static inline bool qIsNull(float f)
+Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(float f)
{
union U {
float f;
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index ff0a784ace..f443ab4b93 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -213,6 +213,7 @@ public:
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
+QT_WARNING_DISABLE_INTEL(1478)
QT_WARNING_DISABLE_INTEL(1786)
QT_WARNING_DISABLE_MSVC(4996)
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 58e2500057..9044ad74b1 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -772,6 +772,17 @@ int QDataStream::readBlock(char *data, int len)
}
/*!
+ \fn QDataStream &QDataStream::operator>>(std::nullptr &ptr)
+ \since 5.9
+ \overload
+
+ Simulates reading a \c{std::nullptr_t} from the stream into \a ptr and
+ returns a reference to the stream. This function does not actually read
+ anything from the stream, as \c{std::nullptr_t} values are stored as 0
+ bytes.
+*/
+
+/*!
\fn QDataStream &QDataStream::operator>>(quint8 &i)
\overload
@@ -1085,6 +1096,15 @@ int QDataStream::readRawData(char *s, int len)
QDataStream write functions
*****************************************************************************/
+/*!
+ \fn QDataStream &QDataStream::operator<<(std::nullptr ptr)
+ \since 5.9
+ \overload
+
+ Simulates writing a \c{std::nullptr_t}, \a ptr, to the stream and returns a
+ reference to the stream. This function does not actually write anything to
+ the stream, as \c{std::nullptr_t} values are stored as 0 bytes.
+*/
/*!
\fn QDataStream &QDataStream::operator<<(quint8 i)
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 993a20fcd3..0a429d091a 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -153,6 +153,7 @@ public:
QDataStream &operator>>(quint32 &i);
QDataStream &operator>>(qint64 &i);
QDataStream &operator>>(quint64 &i);
+ QDataStream &operator>>(std::nullptr_t &ptr) { ptr = nullptr; return *this; }
QDataStream &operator>>(bool &i);
QDataStream &operator>>(qfloat16 &f);
@@ -168,6 +169,7 @@ public:
QDataStream &operator<<(quint32 i);
QDataStream &operator<<(qint64 i);
QDataStream &operator<<(quint64 i);
+ QDataStream &operator<<(std::nullptr_t) { return *this; }
QDataStream &operator<<(bool i);
QDataStream &operator<<(qfloat16 f);
QDataStream &operator<<(float f);
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index d5f32a6efd..ee8ef679a9 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -139,7 +139,7 @@ public:
inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); }
#ifdef Q_COMPILER_UNICODE_STRINGS
- inline QDebug &operator<<(char16_t t) { return *this << QChar(t); }
+ inline QDebug &operator<<(char16_t t) { return *this << QChar(ushort(t)); }
inline QDebug &operator<<(char32_t t) { putUcs4(t); return maybeSpace(); }
#endif
inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); }
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index cb4f5c4b07..9db67f2f9b 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -363,6 +363,7 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
// similar, but not identical to QSysInfo::osType
+ // ### Qt6: remove macOS fallbacks to "mac" and the future compatibility
QStringList ret;
#if defined(Q_OS_WIN)
ret << QStringLiteral("windows");
@@ -380,12 +381,11 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
# endif
QString productName = QSysInfo::productType();
-# ifdef Q_OS_MACOS
- if (productName != QLatin1String("osx"))
- ret << QStringLiteral("osx"); // compatibility
-# endif
if (productName != QLatin1String("unknown"))
- ret << productName; // "opensuse", "fedora", "macos", "ios", "android"
+ ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
+# if defined(Q_OS_MACOS)
+ ret << QStringLiteral("macos"); // future compatibility
+# endif
#endif
return ret;
}
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index b8dca93f61..929db259ec 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1,5 +1,6 @@
/****************************************************************************
**
+** Copyright (C) 2017 Intel Corporation.
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Contact: https://www.qt.io/licensing/
@@ -607,25 +608,7 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
if (!createParents)
return false;
- // we need the cleaned path in order to create the parents
- // and we save errno just in case encodeName needs to load codecs
- int savedErrno = errno;
- bool pathChanged;
- {
- QString cleanName = QDir::cleanPath(dirName);
-
- // Check if the cleaned name is the same or not. If we were given a
- // path with resolvable "../" sections, cleanPath will remove them, but
- // this may change the target dir if one of those segments was a
- // symlink. This operation depends on cleanPath's optimization of
- // returning the original string if it didn't modify anything.
- pathChanged = !dirName.isSharedWith(cleanName);
- if (pathChanged)
- nativeName = QFile::encodeName(cleanName);
- }
-
- errno = savedErrno;
- return createDirectoryWithParents(nativeName, pathChanged);
+ return createDirectoryWithParents(nativeName, false);
}
//static
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index ff865dc9a1..47fb1fb6b8 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -186,9 +186,10 @@ void QLoggingRule::parse(const QStringRef &pattern)
*/
void QLoggingSettingsParser::setContent(const QString &content)
{
- QString content_ = content;
- QTextStream stream(&content_, QIODevice::ReadOnly);
- setContent(stream);
+ _rules.clear();
+ const auto lines = content.splitRef(QLatin1Char('\n'));
+ for (const auto &line : lines)
+ parseNextLine(line);
}
/*!
@@ -198,42 +199,50 @@ void QLoggingSettingsParser::setContent(const QString &content)
void QLoggingSettingsParser::setContent(QTextStream &stream)
{
_rules.clear();
- while (!stream.atEnd()) {
- QString line = stream.readLine();
-
- // Remove all whitespace from line
- line = line.simplified();
- line.remove(QLatin1Char(' '));
+ QString line;
+ while (stream.readLineInto(&line))
+ parseNextLine(QStringRef(&line));
+}
- // comment
- if (line.startsWith(QLatin1Char(';')))
- continue;
+/*!
+ \internal
+ Parses one line of the configuation file
+*/
- if (line.startsWith(QLatin1Char('[')) && line.endsWith(QLatin1Char(']'))) {
- // new section
- _section = line.mid(1, line.size() - 2);
- continue;
- }
+void QLoggingSettingsParser::parseNextLine(QStringRef line)
+{
+ // Remove whitespace at start and end of line:
+ line = line.trimmed();
+
+ // comment
+ if (line.startsWith(QLatin1Char(';')))
+ return;
+
+ if (line.startsWith(QLatin1Char('[')) && line.endsWith(QLatin1Char(']'))) {
+ // new section
+ auto sectionName = line.mid(1, line.size() - 2).trimmed();
+ m_inRulesSection = sectionName.compare(QLatin1String("rules"), Qt::CaseInsensitive) == 0;
+ return;
+ }
- if (_section.compare(QLatin1String("rules"), Qt::CaseInsensitive) == 0) {
- int equalPos = line.indexOf(QLatin1Char('='));
- if (equalPos != -1) {
- if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {
- const QStringRef pattern = line.leftRef(equalPos);
- const QStringRef valueStr = line.midRef(equalPos + 1);
- int value = -1;
- if (valueStr == QLatin1String("true"))
- value = 1;
- else if (valueStr == QLatin1String("false"))
- value = 0;
- QLoggingRule rule(pattern, (value == 1));
- if (rule.flags != 0 && (value != -1))
- _rules.append(rule);
- else
- warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
- } else {
+ if (m_inRulesSection) {
+ int equalPos = line.indexOf(QLatin1Char('='));
+ if (equalPos != -1) {
+ if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {
+ const auto pattern = line.left(equalPos).trimmed();
+ const auto valueStr = line.mid(equalPos + 1).trimmed();
+ int value = -1;
+ if (valueStr == QLatin1String("true"))
+ value = 1;
+ else if (valueStr == QLatin1String("false"))
+ value = 0;
+ QLoggingRule rule(pattern, (value == 1));
+ if (rule.flags != 0 && (value != -1))
+ _rules.append(rule);
+ else
warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
- }
+ } else {
+ warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
}
}
}
@@ -286,7 +295,7 @@ void QLoggingRegistry::init()
if (!rulesSrc.isEmpty()) {
QTextStream stream(rulesSrc);
QLoggingSettingsParser parser;
- parser.setSection(QStringLiteral("Rules"));
+ parser.setImplicitRulesSection(true);
parser.setContent(stream);
er += parser.rules();
}
@@ -350,7 +359,7 @@ void QLoggingRegistry::unregisterCategory(QLoggingCategory *cat)
void QLoggingRegistry::setApiRules(const QString &content)
{
QLoggingSettingsParser parser;
- parser.setSection(QStringLiteral("Rules"));
+ parser.setImplicitRulesSection(true);
parser.setContent(content);
if (qtLoggingDebug())
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index 23740c4955..69fc6ea4ec 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -93,7 +93,7 @@ Q_DECLARE_TYPEINFO(QLoggingRule, Q_MOVABLE_TYPE);
class Q_AUTOTEST_EXPORT QLoggingSettingsParser
{
public:
- void setSection(const QString &section) { _section = section; }
+ void setImplicitRulesSection(bool inRulesSection) { m_inRulesSection = inRulesSection; }
void setContent(const QString &content);
void setContent(QTextStream &stream);
@@ -101,7 +101,10 @@ public:
QVector<QLoggingRule> rules() const { return _rules; }
private:
- QString _section;
+ void parseNextLine(QStringRef line);
+
+private:
+ bool m_inRulesSection = false;
QVector<QLoggingRule> _rules;
};
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index e72773d7a4..251f68c9b4 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -122,6 +122,10 @@ QT_BEGIN_NAMESPACE
#if !defined(Q_OS_DARWIN)
+QT_BEGIN_INCLUDE_NAMESPACE
+extern char **environ;
+QT_END_INCLUDE_NAMESPACE
+
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
QProcessEnvironment env;
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index c16825a033..0bb8707ff9 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -196,7 +196,7 @@ public:
QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
QString toString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
QString toDisplayString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
- QUrl adjusted(FormattingOptions options) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QUrl adjusted(FormattingOptions options) const;
QByteArray toEncoded(FormattingOptions options = FullyEncoded) const;
static QUrl fromEncoded(const QByteArray &url, ParsingMode mode = TolerantMode);
@@ -255,7 +255,7 @@ public:
QString fragment(ComponentFormattingOptions options = PrettyDecoded) const;
void setFragment(const QString &fragment, ParsingMode mode = TolerantMode);
- QUrl resolved(const QUrl &relative) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QUrl resolved(const QUrl &relative) const;
bool isRelative() const;
bool isParentOf(const QUrl &url) const;
diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp
index 41d55c8fde..60154328c2 100644
--- a/src/corelib/kernel/qjni.cpp
+++ b/src/corelib/kernel/qjni.cpp
@@ -64,9 +64,7 @@ static QString qt_convertJString(jstring string)
static inline bool exceptionCheckAndClear(JNIEnv *env)
{
if (Q_UNLIKELY(env->ExceptionCheck())) {
-#ifdef QT_DEBUG
env->ExceptionDescribe();
-#endif // QT_DEBUG
env->ExceptionClear();
return true;
}
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index fc8d7dcfea..b75f2ad9dc 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1350,6 +1350,7 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::QJsonDocument:
return false;
case QMetaType::Nullptr:
+ stream << *static_cast<const std::nullptr_t *>(data);
return true;
case QMetaType::Long:
stream << qlonglong(*static_cast<const long *>(data));
@@ -1573,6 +1574,7 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::QJsonDocument:
return false;
case QMetaType::Nullptr:
+ stream >> *static_cast<std::nullptr_t *>(data);
return true;
case QMetaType::Long: {
qlonglong l;
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index c908e7cdbc..e636c6fe52 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -649,6 +649,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::Bool:
*ba = QByteArray(d->data.b ? "true" : "false");
break;
+ case QVariant::Uuid:
+ *ba = v_cast<QUuid>(d)->toByteArray();
+ break;
default:
#ifndef QT_NO_QOBJECT
{
@@ -916,6 +919,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::String:
*static_cast<QUuid *>(result) = QUuid(*v_cast<QString>(d));
break;
+ case QVariant::ByteArray:
+ *static_cast<QUuid *>(result) = QUuid(*v_cast<QByteArray>(d));
+ break;
default:
return false;
}
@@ -2526,8 +2532,9 @@ QRegularExpression QVariant::toRegularExpression() const
/*!
\since 5.0
- Returns the variant as a QUuid if the variant has userType() \l
- QUuid; otherwise returns a default constructed QUuid.
+ Returns the variant as a QUuid if the variant has type()
+ \l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString;
+ otherwise returns a default-constructed QUuid.
\sa canConvert(), convert()
*/
@@ -2874,7 +2881,8 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QStringList*/ 1 << QVariant::List | 1 << QVariant::String,
/*QByteArray*/ 1 << QVariant::String | 1 << QVariant::Int | 1 << QVariant::UInt | 1 << QVariant::Bool
- | 1 << QVariant::Double | 1 << QVariant::LongLong | 1 << QVariant::ULongLong,
+ | 1 << QVariant::Double | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
+ | 1 << QVariant::Uuid,
/*QBitArray*/ 0,
@@ -2910,7 +2918,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QEasingCurve*/ 0,
-/*QUuid*/ 1 << QVariant::String
+/*QUuid*/ 1 << QVariant::String | 1 << QVariant::ByteArray,
};
static const size_t qCanConvertMatrixMaximumTargetType = 8 * sizeof(*qCanConvertMatrix);
@@ -2965,7 +2973,7 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
\l QMetaType::UInt, \l QMetaType::ULongLong
\row \li \l QMetaType::QByteArray \li \l QMetaType::Double,
\l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString,
- \l QMetaType::UInt, \l QMetaType::ULongLong
+ \l QMetaType::UInt, \l QMetaType::ULongLong, \l QMetaType::QUuid
\row \li \l QMetaType::QChar \li \l QMetaType::Bool, \l QMetaType::Int,
\l QMetaType::UInt, \l QMetaType::LongLong, \l QMetaType::ULongLong
\row \li \l QMetaType::QColor \li \l QMetaType::QString
@@ -2995,7 +3003,7 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
\l QMetaType::QDate, \l QMetaType::QDateTime, \l QMetaType::Double,
\l QMetaType::QFont, \l QMetaType::Int, \l QMetaType::QKeySequence,
\l QMetaType::LongLong, \l QMetaType::QStringList, \l QMetaType::QTime,
- \l QMetaType::UInt, \l QMetaType::ULongLong
+ \l QMetaType::UInt, \l QMetaType::ULongLong, \l QMetaType::QUuid
\row \li \l QMetaType::QStringList \li \l QMetaType::QVariantList,
\l QMetaType::QString (if the list contains exactly one item)
\row \li \l QMetaType::QTime \li \l QMetaType::QString
@@ -3005,6 +3013,7 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
\row \li \l QMetaType::ULongLong \li \l QMetaType::Bool,
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int,
\l QMetaType::LongLong, \l QMetaType::QString, \l QMetaType::UInt
+ \row \li \l QMetaType::QUuid \li \l QMetaType::QByteArray, \l QMetaType::QString
\endtable
A QVariant containing a pointer to a type derived from QObject will also return true for this
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index 74a8c28fc8..09b7f96f48 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -88,7 +88,7 @@ public:
QT_DEPRECATED_X("use tryTake(), but note the different deletion rules")
void cancel(QRunnable *runnable);
#endif
- bool tryTake(QRunnable *runnable) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT bool tryTake(QRunnable *runnable);
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index bc20932cca..88f0cfb0ea 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -112,12 +112,10 @@ struct Q_CORE_EXPORT QArrayData
return result;
}
- static QArrayData *allocate(size_t objectSize, size_t alignment,
- size_t capacity, AllocationOptions options = Default)
- Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize,
- size_t newCapacity, AllocationOptions newOptions = Default)
- Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QArrayData *allocate(size_t objectSize, size_t alignment,
+ size_t capacity, AllocationOptions options = Default) Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize,
+ size_t newCapacity, AllocationOptions newOptions = Default) Q_DECL_NOTHROW;
static void deallocate(QArrayData *data, size_t objectSize,
size_t alignment) Q_DECL_NOTHROW;
@@ -217,8 +215,8 @@ struct QTypedArrayData
class AlignmentDummy { QArrayData header; T data; };
- static QTypedArrayData *allocate(size_t capacity,
- AllocationOptions options = Default) Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT static QTypedArrayData *allocate(size_t capacity,
+ AllocationOptions options = Default)
{
Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
return static_cast<QTypedArrayData *>(QArrayData::allocate(sizeof(T),
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index b97dde5a61..51cfa6e849 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -174,7 +174,7 @@ public:
}
private:
- Data *clone(QArrayData::AllocationOptions options) const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Data *clone(QArrayData::AllocationOptions options) const
{
Data *x = Data::allocate(d->detachCapacity(d->size), options);
Q_CHECK_PTR(x);
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 4763afafe1..453f28f39f 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -231,10 +231,10 @@ public:
int count(const char *a) const;
int count(const QByteArray &a) const;
- QByteArray left(int len) const Q_REQUIRED_RESULT;
- QByteArray right(int len) const Q_REQUIRED_RESULT;
- QByteArray mid(int index, int len = -1) const Q_REQUIRED_RESULT;
- QByteArray chopped(int len) const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray left(int len) const;
+ Q_REQUIRED_RESULT QByteArray right(int len) const;
+ Q_REQUIRED_RESULT QByteArray mid(int index, int len = -1) const;
+ Q_REQUIRED_RESULT QByteArray chopped(int len) const
{ Q_ASSERT(len >= 0); Q_ASSERT(len <= size()); return left(size() - len); }
bool startsWith(const QByteArray &a) const;
@@ -249,41 +249,41 @@ public:
void chop(int n);
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
-# if defined(Q_CC_GNU)
+# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
# pragma push_macro("Q_REQUIRED_RESULT")
# undef Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed
# endif
- Q_ALWAYS_INLINE QByteArray toLower() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() const &
{ return toLower_helper(*this); }
- Q_ALWAYS_INLINE QByteArray toLower() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() &&
{ return toLower_helper(*this); }
- Q_ALWAYS_INLINE QByteArray toUpper() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() const &
{ return toUpper_helper(*this); }
- Q_ALWAYS_INLINE QByteArray toUpper() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() &&
{ return toUpper_helper(*this); }
- Q_ALWAYS_INLINE QByteArray trimmed() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() const &
{ return trimmed_helper(*this); }
- Q_ALWAYS_INLINE QByteArray trimmed() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() &&
{ return trimmed_helper(*this); }
- Q_ALWAYS_INLINE QByteArray simplified() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() const &
{ return simplified_helper(*this); }
- Q_ALWAYS_INLINE QByteArray simplified() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() &&
{ return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT")
# endif
#else
- QByteArray toLower() const Q_REQUIRED_RESULT;
- QByteArray toUpper() const Q_REQUIRED_RESULT;
- QByteArray trimmed() const Q_REQUIRED_RESULT;
- QByteArray simplified() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QByteArray toLower() const;
+ Q_REQUIRED_RESULT QByteArray toUpper() const;
+ Q_REQUIRED_RESULT QByteArray trimmed() const;
+ Q_REQUIRED_RESULT QByteArray simplified() const;
#endif
- QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const Q_REQUIRED_RESULT;
- QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const;
+ Q_REQUIRED_RESULT QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const;
QByteArray &prepend(char c);
inline QByteArray &prepend(int count, char c);
@@ -318,7 +318,7 @@ public:
QList<QByteArray> split(char sep) const;
- QByteArray repeated(int times) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QByteArray repeated(int times) const;
#ifndef QT_NO_CAST_TO_ASCII
QT_ASCII_CAST_WARN QByteArray &append(const QString &s);
@@ -368,16 +368,16 @@ public:
QByteArray &setNum(double, char f = 'g', int prec = 6);
QByteArray &setRawData(const char *a, uint n); // ### Qt 6: use an int
- static QByteArray number(int, int base = 10) Q_REQUIRED_RESULT;
- static QByteArray number(uint, int base = 10) Q_REQUIRED_RESULT;
- static QByteArray number(qlonglong, int base = 10) Q_REQUIRED_RESULT;
- static QByteArray number(qulonglong, int base = 10) Q_REQUIRED_RESULT;
- static QByteArray number(double, char f = 'g', int prec = 6) Q_REQUIRED_RESULT;
- static QByteArray fromRawData(const char *, int size) Q_REQUIRED_RESULT;
- static QByteArray fromBase64(const QByteArray &base64, Base64Options options) Q_REQUIRED_RESULT;
- static QByteArray fromBase64(const QByteArray &base64) Q_REQUIRED_RESULT; // ### Qt6 merge with previous
- static QByteArray fromHex(const QByteArray &hexEncoded) Q_REQUIRED_RESULT;
- static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%') Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QByteArray number(int, int base = 10);
+ Q_REQUIRED_RESULT static QByteArray number(uint, int base = 10);
+ Q_REQUIRED_RESULT static QByteArray number(qlonglong, int base = 10);
+ Q_REQUIRED_RESULT static QByteArray number(qulonglong, int base = 10);
+ Q_REQUIRED_RESULT static QByteArray number(double, char f = 'g', int prec = 6);
+ Q_REQUIRED_RESULT static QByteArray fromRawData(const char *, int size);
+ Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64, Base64Options options);
+ Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64); // ### Qt6 merge with previous
+ Q_REQUIRED_RESULT static QByteArray fromHex(const QByteArray &hexEncoded);
+ Q_REQUIRED_RESULT static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%');
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QByteArray fromCFData(CFDataRef data);
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index ba1dacff8f..7ab7c0e2df 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2317,10 +2317,11 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
tm local;
bool valid = false;
-#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// localtime() is required to work as if tzset() was called before it.
// localtime_r() does not have this requirement, so make an explicit call.
+ // The explicit call should also request the timezone info be re-parsed.
qt_tzset();
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// Use the reentrant version of localtime() where available
// as is thread-safe and doesn't use a shared static data area
tm *res = 0;
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index e3552f5c82..815fa12b23 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -106,9 +106,9 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
#endif // < Qt 6
void getDate(int *year, int *month, int *day) const;
- QDate addDays(qint64 days) const Q_REQUIRED_RESULT;
- QDate addMonths(int months) const Q_REQUIRED_RESULT;
- QDate addYears(int years) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QDate addDays(qint64 days) const;
+ Q_REQUIRED_RESULT QDate addMonths(int months) const;
+ Q_REQUIRED_RESULT QDate addYears(int years) const;
qint64 daysTo(const QDate &) const;
Q_DECL_CONSTEXPR bool operator==(const QDate &other) const { return jd == other.jd; }
@@ -172,9 +172,9 @@ public:
#endif
bool setHMS(int h, int m, int s, int ms = 0);
- QTime addSecs(int secs) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QTime addSecs(int secs) const;
int secsTo(const QTime &) const;
- QTime addMSecs(int ms) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QTime addMSecs(int ms) const;
int msecsTo(const QTime &) const;
Q_DECL_CONSTEXPR bool operator==(const QTime &other) const { return mds == other.mds; }
@@ -306,11 +306,11 @@ public:
#endif
QString toString(QStringView format) const;
#endif
- QDateTime addDays(qint64 days) const Q_REQUIRED_RESULT;
- QDateTime addMonths(int months) const Q_REQUIRED_RESULT;
- QDateTime addYears(int years) const Q_REQUIRED_RESULT;
- QDateTime addSecs(qint64 secs) const Q_REQUIRED_RESULT;
- QDateTime addMSecs(qint64 msecs) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QDateTime addDays(qint64 days) const;
+ Q_REQUIRED_RESULT QDateTime addMonths(int months) const;
+ Q_REQUIRED_RESULT QDateTime addYears(int years) const;
+ Q_REQUIRED_RESULT QDateTime addSecs(qint64 secs) const;
+ Q_REQUIRED_RESULT QDateTime addMSecs(qint64 msecs) const;
QDateTime toTimeSpec(Qt::TimeSpec spec) const;
inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); }
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index 5b5ca3b4c8..6361c1af9f 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -73,10 +73,10 @@ public:
inline void translate(const QPoint &p);
inline void translate(int dx, int dy);
- Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const;
- Q_DECL_CONSTEXPR inline QPoint center() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPoint center() const;
inline void setP1(const QPoint &p1);
inline void setP2(const QPoint &p2);
@@ -221,7 +221,7 @@ public:
Q_DECL_CONSTEXPR inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2);
Q_DECL_CONSTEXPR inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { }
- static QLineF fromPolar(qreal length, qreal angle) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QLineF fromPolar(qreal length, qreal angle);
Q_DECL_CONSTEXPR bool isNull() const;
@@ -245,8 +245,8 @@ public:
qreal angleTo(const QLineF &l) const;
- QLineF unitVector() const Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QLineF normalVector() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QLineF unitVector() const;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF normalVector() const;
// ### Qt 6: rename intersects() or intersection() and rename IntersectType IntersectionType
IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const;
@@ -257,10 +257,10 @@ public:
inline void translate(const QPointF &p);
inline void translate(qreal dx, qreal dy);
- Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const;
- Q_DECL_CONSTEXPR inline QPointF center() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPointF center() const;
inline void setP1(const QPointF &p1);
inline void setP2(const QPointF &p2);
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index bad1481575..d5a024177d 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -38,13 +38,13 @@
**
****************************************************************************/
+#include "qglobal.h"
+
#if !defined(QWS) && defined(Q_OS_MAC)
# include "private/qcore_mac_p.h"
# include <CoreFoundation/CoreFoundation.h>
#endif
-#include "qglobal.h"
-
#include "qplatformdefs.h"
#include "qdatastream.h"
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 3ee6ab8c58..a3b11eddcf 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -209,8 +209,10 @@ struct QMapData : public QMapDataBase
Node *root() const { return static_cast<Node *>(header.left); }
- const Node *end() const { return static_cast<const Node *>(&header); }
- Node *end() { return static_cast<Node *>(&header); }
+ // using reinterpret_cast because QMapDataBase::header is not
+ // actually a QMapNode.
+ const Node *end() const { return reinterpret_cast<const Node *>(&header); }
+ Node *end() { return reinterpret_cast<Node *>(&header); }
const Node *begin() const { if (root()) return static_cast<const Node*>(mostLeftNode); return end(); }
Node *begin() { if (root()) return static_cast<Node*>(mostLeftNode); return end(); }
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 7b1004897a..0f3e0c3517 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -94,7 +94,7 @@ public:
friend Q_DECL_CONSTEXPR inline const QPoint operator/(const QPoint &, qreal);
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW;
#endif
private:
@@ -256,8 +256,8 @@ public:
Q_DECL_CONSTEXPR QPoint toPoint() const;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW;
#endif
private:
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index 4030cccbd5..19ff87b420 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -70,7 +70,7 @@ public:
Q_DECL_CONSTEXPR inline int top() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline int right() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline int bottom() const Q_DECL_NOTHROW;
- QRect normalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QRect normalized() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline int x() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline int y() const Q_DECL_NOTHROW;
@@ -104,9 +104,9 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void translate(int dx, int dy) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPoint &p) Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QRect transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect transposed() const Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void moveTo(int x, int t) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPoint &p) Q_DECL_NOTHROW;
@@ -118,7 +118,7 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
Q_DECL_RELAXED_CONSTEXPR inline void adjust(int x1, int y1, int x2, int y2) Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline QSize size() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline int width() const Q_DECL_NOTHROW;
@@ -136,8 +136,8 @@ public:
bool contains(const QPoint &p, bool proper=false) const Q_DECL_NOTHROW;
inline bool contains(int x, int y) const Q_DECL_NOTHROW;
inline bool contains(int x, int y, bool proper) const Q_DECL_NOTHROW;
- inline QRect united(const QRect &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- inline QRect intersected(const QRect &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT inline QRect united(const QRect &other) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT inline QRect intersected(const QRect &other) const Q_DECL_NOTHROW;
bool intersects(const QRect &r) const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline QRect marginsAdded(const QMargins &margins) const Q_DECL_NOTHROW;
@@ -146,15 +146,15 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline QRect &operator-=(const QMargins &margins) Q_DECL_NOTHROW;
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED QRect unite(const QRect &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return united(r); }
- QT_DEPRECATED QRect intersect(const QRect &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return intersected(r); }
+ Q_REQUIRED_RESULT QT_DEPRECATED QRect unite(const QRect &r) const Q_DECL_NOTHROW { return united(r); }
+ Q_REQUIRED_RESULT QT_DEPRECATED QRect intersect(const QRect &r) const Q_DECL_NOTHROW { return intersected(r); }
#endif
friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) Q_DECL_NOTHROW;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW;
#endif
private:
@@ -520,7 +520,7 @@ public:
Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline bool isEmpty() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW;
- QRectF normalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QRectF normalized() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline qreal left() const Q_DECL_NOTHROW { return xp; }
Q_DECL_CONSTEXPR inline qreal top() const Q_DECL_NOTHROW { return yp; }
@@ -560,10 +560,10 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void translate(qreal dx, qreal dy) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPointF &p) Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRectF transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF transposed() const Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void moveTo(qreal x, qreal y) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPointF &p) Q_DECL_NOTHROW;
@@ -575,7 +575,7 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
Q_DECL_RELAXED_CONSTEXPR inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline QSizeF size() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline qreal width() const Q_DECL_NOTHROW;
@@ -592,8 +592,8 @@ public:
bool contains(const QRectF &r) const Q_DECL_NOTHROW;
bool contains(const QPointF &p) const Q_DECL_NOTHROW;
inline bool contains(qreal x, qreal y) const Q_DECL_NOTHROW;
- inline QRectF united(const QRectF &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- inline QRectF intersected(const QRectF &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT inline QRectF united(const QRectF &other) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT inline QRectF intersected(const QRectF &other) const Q_DECL_NOTHROW;
bool intersects(const QRectF &r) const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline QRectF marginsAdded(const QMarginsF &margins) const Q_DECL_NOTHROW;
@@ -602,19 +602,19 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator-=(const QMarginsF &margins) Q_DECL_NOTHROW;
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED QRectF unite(const QRectF &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return united(r); }
- QT_DEPRECATED QRectF intersect(const QRectF &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return intersected(r); }
+ Q_REQUIRED_RESULT QT_DEPRECATED QRectF unite(const QRectF &r) const Q_DECL_NOTHROW { return united(r); }
+ Q_REQUIRED_RESULT QT_DEPRECATED QRectF intersect(const QRectF &r) const Q_DECL_NOTHROW { return intersected(r); }
#endif
friend Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QRect toAlignedRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QRect toAlignedRect() const Q_DECL_NOTHROW;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW;
#endif
private:
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index 8ad907f72b..86bc99716d 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -445,19 +445,25 @@ QT_BEGIN_NAMESPACE
Other differences are outlined below.
- \section2 Exact matching
+ \section2 Porting from QRegExp::exactMatch()
QRegExp::exactMatch() in Qt 4 served two purposes: it exactly matched
a regular expression against a subject string, and it implemented partial
- matching. In fact, if an exact match was not found, one could still find
- out how much of the subject string was matched by the regular expression
- by calling QRegExp::matchedLength(). If the returned length was equal
- to the subject string's length, then one could desume that a partial match
- was found.
+ matching.
- QRegularExpression supports partial matching explicitly by means of the
- appropriate MatchType. If instead you simply want to be sure that the
- subject string matches the regular expression exactly, you can wrap the
+ \section3 Porting from QRegExp's Exact Matching
+
+ Exact matching indicates whether the regular expression matches the entire
+ subject string. For example, the classes yield on the subject string \c{"abc123"}:
+
+ \table
+ \header \li \li QRegExp::exactMatch() \li QRegularExpressionMatch::hasMatch()
+ \row \li \c{"\\d+"} \li \b false \li \b true
+ \row \li \c{"[a-z]+\\d+"} \li \b true \li \b true
+ \endtable
+
+ Exact matching is not reflected in QRegularExpression. If you want to be
+ sure that the subject string matches the regular expression exactly, you can wrap the
pattern between a couple of anchoring expressions. Simply
putting the pattern between the \c{^} and the \c{$} anchors is enough
in most cases:
@@ -479,6 +485,17 @@ QT_BEGIN_NAMESPACE
Note the usage of the non-capturing group in order to preserve the meaning
of the branch operator inside the pattern.
+ \section3 Porting from QRegExp's Partial Matching
+
+ When using QRegExp::exactMatch(), if an exact match was not found, one
+ could still find out how much of the subject string was matched by the
+ regular expression by calling QRegExp::matchedLength(). If the returned length
+ was equal to the subject string's length, then one could conclude that a partial
+ match was found.
+
+ QRegularExpression supports partial matching explicitly by means of the
+ appropriate MatchType.
+
\section2 Global matching
Due to limitations of the QRegExp API it was impossible to implement global
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 0d42c8a212..15573c5588 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -260,6 +260,7 @@ namespace QtSharedPointer {
internalSafetyCheckRemove(self);
deleter(self);
}
+ static void noDeleter(ExternalRefCountData *) { }
static inline ExternalRefCountData *create(T **ptr, DestroyerFn destroy)
{
@@ -433,11 +434,13 @@ public:
# else
typename Private::DestroyerFn destroy = &Private::deleter;
# endif
+ typename Private::DestroyerFn noDestroy = &Private::noDeleter;
QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
+ result.d = Private::create(&result.value, noDestroy);
// now initialize the data
new (result.data()) T(std::forward<Args>(arguments)...);
+ result.d->destroyer = destroy;
result.d->setQObjectShared(result.value, true);
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalSafetyCheckAdd(result.d, result.value);
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 59a8dd9d0c..725b6b6765 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -166,10 +166,11 @@
# define __MIPS_DSPR2__
# endif
#elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
- || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \
+ || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && Q_CC_GNU >= 409) \
+ || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 308)) \
&& !defined(QT_BOOTSTRAPPED)
# define QT_COMPILER_SUPPORTS_SIMD_ALWAYS
-# define QT_COMPILER_SUPPORTS_HERE(x) QT_COMPILER_SUPPORTS(x)
+# define QT_COMPILER_SUPPORTS_HERE(x) ((__ ## x ## __) || QT_COMPILER_SUPPORTS(x))
# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
/* GCC requires attributes for a function */
# define QT_FUNCTION_TARGET(x) __attribute__((__target__(QT_FUNCTION_TARGET_STRING_ ## x)))
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index cd5f8adbf5..bb29dca7c4 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -64,15 +64,15 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) Q_DECL_NOTHROW;
void transpose() Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW;
inline void scale(int w, int h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW;
inline void scale(const QSize &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW;
- QSize scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QSize scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline int &rwidth() Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline int &rheight() Q_DECL_NOTHROW;
@@ -91,7 +91,7 @@ public:
friend inline const QSize operator/(const QSize &, qreal);
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW;
#endif
private:
@@ -228,15 +228,15 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) Q_DECL_NOTHROW;
void transpose() Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW;
inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW;
inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW;
- QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW;
- Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline qreal &rwidth() Q_DECL_NOTHROW;
Q_DECL_RELAXED_CONSTEXPR inline qreal &rheight() Q_DECL_NOTHROW;
@@ -257,8 +257,8 @@ public:
Q_DECL_CONSTEXPR inline QSize toSize() const Q_DECL_NOTHROW;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
- static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW;
#endif
private:
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index f9761ac11a..5130ee99f4 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -312,58 +312,58 @@ public:
const QChar operator[](uint i) const;
QCharRef operator[](uint i);
- inline QChar front() const Q_REQUIRED_RESULT { return at(0); }
- inline QCharRef front() Q_REQUIRED_RESULT;
- inline QChar back() const Q_REQUIRED_RESULT { return at(size() - 1); }
- inline QCharRef back() Q_REQUIRED_RESULT;
-
- QString arg(qlonglong a, int fieldwidth=0, int base=10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(qulonglong a, int fieldwidth=0, int base=10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(long a, int fieldwidth=0, int base=10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(ulong a, int fieldwidth=0, int base=10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(int a, int fieldWidth = 0, int base = 10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(uint a, int fieldWidth = 0, int base = 10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(short a, int fieldWidth = 0, int base = 10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(ushort a, int fieldWidth = 0, int base = 10,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(char a, int fieldWidth = 0,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(QChar a, int fieldWidth = 0,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT inline QChar front() const { return at(0); }
+ Q_REQUIRED_RESULT inline QCharRef front();
+ Q_REQUIRED_RESULT inline QChar back() const { return at(size() - 1); }
+ Q_REQUIRED_RESULT inline QCharRef back();
+
+ Q_REQUIRED_RESULT QString arg(qlonglong a, int fieldwidth=0, int base=10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(qulonglong a, int fieldwidth=0, int base=10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(long a, int fieldwidth=0, int base=10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(ulong a, int fieldwidth=0, int base=10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(int a, int fieldWidth = 0, int base = 10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(uint a, int fieldWidth = 0, int base = 10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(short a, int fieldWidth = 0, int base = 10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(ushort a, int fieldWidth = 0, int base = 10,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(char a, int fieldWidth = 0,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(QChar a, int fieldWidth = 0,
+ QChar fillChar = QLatin1Char(' ')) const;
#if QT_STRINGVIEW_LEVEL < 2
- QString arg(const QString &a, int fieldWidth = 0,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString arg(const QString &a, int fieldWidth = 0,
+ QChar fillChar = QLatin1Char(' ')) const;
#endif
- QString arg(QStringView a, int fieldWidth = 0,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(QLatin1String a, int fieldWidth = 0,
- QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
- const QString &a4) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
- const QString &a4, const QString &a5) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
- const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
+ Q_REQUIRED_RESULT QString arg(QStringView a, int fieldWidth = 0,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(QLatin1String a, int fieldWidth = 0,
+ QChar fillChar = QLatin1Char(' ')) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
+ const QString &a4) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
+ const QString &a4, const QString &a5) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
+ const QString &a4, const QString &a5, const QString &a6) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
- const QString &a7) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
+ const QString &a7) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
- const QString &a7, const QString &a8) const Q_REQUIRED_RESULT;
- QString arg(const QString &a1, const QString &a2, const QString &a3,
+ const QString &a7, const QString &a8) const;
+ Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
- const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT;
+ const QString &a7, const QString &a8, const QString &a9) const;
QString &vsprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(2, 0);
QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
@@ -425,16 +425,16 @@ public:
#ifndef QT_NO_REGULAREXPRESSION
QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif
- QString left(int n) const Q_REQUIRED_RESULT;
- QString right(int n) const Q_REQUIRED_RESULT;
- QString mid(int position, int n = -1) const Q_REQUIRED_RESULT;
- QString chopped(int n) const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QString left(int n) const;
+ Q_REQUIRED_RESULT QString right(int n) const;
+ Q_REQUIRED_RESULT QString mid(int position, int n = -1) const;
+ Q_REQUIRED_RESULT QString chopped(int n) const
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return left(size() - n); }
- QStringRef leftRef(int n) const Q_REQUIRED_RESULT;
- QStringRef rightRef(int n) const Q_REQUIRED_RESULT;
- QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QStringRef leftRef(int n) const;
+ Q_REQUIRED_RESULT QStringRef rightRef(int n) const;
+ Q_REQUIRED_RESULT QStringRef midRef(int position, int n = -1) const;
bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool startsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@@ -445,48 +445,48 @@ public:
bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
- QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
+ Q_REQUIRED_RESULT QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
-# if defined(Q_CC_GNU)
+# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
# pragma push_macro("Q_REQUIRED_RESULT")
# undef Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed
# endif
- Q_ALWAYS_INLINE QString toLower() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() const &
{ return toLower_helper(*this); }
- Q_ALWAYS_INLINE QString toLower() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() &&
{ return toLower_helper(*this); }
- Q_ALWAYS_INLINE QString toUpper() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() const &
{ return toUpper_helper(*this); }
- Q_ALWAYS_INLINE QString toUpper() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() &&
{ return toUpper_helper(*this); }
- Q_ALWAYS_INLINE QString toCaseFolded() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() const &
{ return toCaseFolded_helper(*this); }
- Q_ALWAYS_INLINE QString toCaseFolded() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() &&
{ return toCaseFolded_helper(*this); }
- Q_ALWAYS_INLINE QString trimmed() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() const &
{ return trimmed_helper(*this); }
- Q_ALWAYS_INLINE QString trimmed() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() &&
{ return trimmed_helper(*this); }
- Q_ALWAYS_INLINE QString simplified() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() const &
{ return simplified_helper(*this); }
- Q_ALWAYS_INLINE QString simplified() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() &&
{ return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT")
# endif
#else
- QString toLower() const Q_REQUIRED_RESULT;
- QString toUpper() const Q_REQUIRED_RESULT;
- QString toCaseFolded() const Q_REQUIRED_RESULT;
- QString trimmed() const Q_REQUIRED_RESULT;
- QString simplified() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString toLower() const;
+ Q_REQUIRED_RESULT QString toUpper() const;
+ Q_REQUIRED_RESULT QString toCaseFolded() const;
+ Q_REQUIRED_RESULT QString trimmed() const;
+ Q_REQUIRED_RESULT QString simplified() const;
#endif
- QString toHtmlEscaped() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString toHtmlEscaped() const;
QString &insert(int i, QChar c);
QString &insert(int i, const QChar *uc, int len);
@@ -545,21 +545,21 @@ public:
enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };
- QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
- QVector<QStringRef> splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
- QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
- QVector<QStringRef> splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ Q_REQUIRED_RESULT QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ Q_REQUIRED_RESULT QVector<QStringRef> splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#ifndef QT_NO_REGEXP
- QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
- QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
+ Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif
#ifndef QT_NO_REGULAREXPRESSION
- QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
- QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
+ Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif
enum NormalizationForm {
NormalizationForm_D,
@@ -567,31 +567,31 @@ public:
NormalizationForm_KD,
NormalizationForm_KC
};
- QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const;
- QString repeated(int times) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QString repeated(int times) const;
const ushort *utf16() const;
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
- QByteArray toLatin1() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toLatin1() const &
{ return toLatin1_helper(*this); }
- QByteArray toLatin1() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toLatin1() &&
{ return toLatin1_helper_inplace(*this); }
- QByteArray toUtf8() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toUtf8() const &
{ return toUtf8_helper(*this); }
- QByteArray toUtf8() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toUtf8() &&
{ return toUtf8_helper(*this); }
- QByteArray toLocal8Bit() const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toLocal8Bit() const &
{ return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); }
- QByteArray toLocal8Bit() && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toLocal8Bit() &&
{ return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); }
#else
- QByteArray toLatin1() const Q_REQUIRED_RESULT;
- QByteArray toUtf8() const Q_REQUIRED_RESULT;
- QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QByteArray toLatin1() const;
+ Q_REQUIRED_RESULT QByteArray toUtf8() const;
+ Q_REQUIRED_RESULT QByteArray toLocal8Bit() const;
#endif
- QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector<uint> toUcs4() const;
// note - this are all inline so we can benefit from strlen() compile time optimizations
static inline QString fromLatin1(const char *str, int size = -1)
@@ -629,12 +629,12 @@ public:
{ return fromLatin1(str, size); }
QT_DEPRECATED static inline QString fromAscii(const QByteArray &str)
{ return fromLatin1(str); }
- QByteArray toAscii() const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QByteArray toAscii() const
{ return toLatin1(); }
#endif
inline int toWCharArray(wchar_t *array) const;
- static inline QString fromWCharArray(const wchar_t *string, int size = -1) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT static inline QString fromWCharArray(const wchar_t *string, int size = -1);
QString &setRawData(const QChar *unicode, int size);
QString &setUnicode(const QChar *unicode, int size);
@@ -823,7 +823,7 @@ public:
static inline QString fromStdWString(const std::wstring &s);
inline std::wstring toStdWString() const;
-#if defined(Q_COMPILER_UNICODE_STRINGS) || defined(Q_QDOC)
+#if defined(Q_STDLIB_UNICODE_STRINGS) || defined(Q_QDOC)
static inline QString fromStdU16String(const std::u16string &s);
inline std::u16string toStdU16String() const;
static inline QString fromStdU32String(const std::u32string &s);
@@ -1409,7 +1409,7 @@ inline std::wstring QString::toStdWString() const
inline QString QString::fromStdWString(const std::wstring &s)
{ return fromWCharArray(s.data(), int(s.size())); }
-#if defined(Q_COMPILER_UNICODE_STRINGS)
+#if defined(Q_STDLIB_UNICODE_STRINGS)
inline QString QString::fromStdU16String(const std::u16string &s)
{ return fromUtf16(s.data(), int(s.size())); }
@@ -1495,15 +1495,15 @@ public:
int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- QVector<QStringRef> split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
- QVector<QStringRef> split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector<QStringRef> split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ Q_REQUIRED_RESULT QVector<QStringRef> split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- QStringRef left(int n) const Q_REQUIRED_RESULT;
- QStringRef right(int n) const Q_REQUIRED_RESULT;
- QStringRef mid(int pos, int n = -1) const Q_REQUIRED_RESULT;
- QStringRef chopped(int n) const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QStringRef left(int n) const;
+ Q_REQUIRED_RESULT QStringRef right(int n) const;
+ Q_REQUIRED_RESULT QStringRef mid(int pos, int n = -1) const;
+ Q_REQUIRED_RESULT QStringRef chopped(int n) const
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return left(size() - n); }
void truncate(int pos) Q_DECL_NOTHROW { m_size = qBound(0, pos, m_size); }
@@ -1550,13 +1550,13 @@ public:
inline const_reverse_iterator crend() const { return rend(); }
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED QByteArray toAscii() const Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT QT_DEPRECATED QByteArray toAscii() const
{ return toLatin1(); }
#endif
- QByteArray toLatin1() const Q_REQUIRED_RESULT;
- QByteArray toUtf8() const Q_REQUIRED_RESULT;
- QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
- QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QByteArray toLatin1() const;
+ Q_REQUIRED_RESULT QByteArray toUtf8() const;
+ Q_REQUIRED_RESULT QByteArray toLocal8Bit() const;
+ Q_REQUIRED_RESULT QVector<uint> toUcs4() const;
inline void clear() { m_string = Q_NULLPTR; m_position = m_size = 0; }
QString toString() const;
@@ -1600,7 +1600,7 @@ public:
static int localeAwareCompare(const QStringRef &s1, const QString &s2);
static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
- QStringRef trimmed() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QStringRef trimmed() const;
short toShort(bool *ok = Q_NULLPTR, int base = 10) const;
ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const;
int toInt(bool *ok = Q_NULLPTR, int base = 10) const;
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index de12de19cb..70152a9202 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\reentrant
\since 4.6
- \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks.
+ \brief The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks.
\ingroup tools
\ingroup shared
@@ -58,22 +58,34 @@ QT_BEGIN_NAMESPACE
To build a QString by multiple concatenations, QString::operator+()
- is typically used. This causes \e{n - 1} reallocations when building
- a string from \e{n} chunks.
+ is typically used. This causes \e{n - 1} allocations when building
+ a string from \e{n} chunks. The same is true for QByteArray.
QStringBuilder uses expression templates to collect the individual
chunks, compute the total size, allocate the required amount of
- memory for the final QString object, and copy the chunks into the
+ memory for the final string object, and copy the chunks into the
allocated memory.
The QStringBuilder class is not to be used explicitly in user
code. Instances of the class are created as return values of the
- operator%() function, acting on objects of type QString,
- QLatin1String, QStringRef, QChar, QCharRef,
- QLatin1Char, and \c char.
+ operator%() function, acting on objects of the following types:
+
+ For building QStrings:
+
+ \li QString, QStringRef,
+ \li QChar, QCharRef, QLatin1Char,
+ \li QLatin1String,
+ \li QByteArray, \c char, \c{const char[]}.
+
+ The types in the last list point are only available when
+ QT_NO_CAST_FROM_ASCII is not defined.
+
+ For building QByteArrays:
+
+ \li QByteArray, \c char, \c{const char[]}.
Concatenating strings with operator%() generally yields better
- performance then using \c QString::operator+() on the same chunks
+ performance than using \c QString::operator+() on the same chunks
if there are three or more of them, and performs equally well in other
cases.
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index 0038908160..74b79dce16 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -154,12 +154,12 @@ public:
QLocale::Country country);
// returns "UTC" QString and QByteArray
- static inline QString utcQString() Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT static inline QString utcQString()
{
return QStringLiteral("UTC");
}
- static inline QByteArray utcQByteArray() Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT static inline QByteArray utcQByteArray()
{
return QByteArrayLiteral("UTC");
}
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index a7f91e220c..3836bc2119 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -248,43 +248,43 @@ public:
inline explicit QVersionNumber(int maj, int min, int mic)
{ m_segments.setSegments(3, maj, min, mic); }
- inline bool isNull() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline bool isNull() const Q_DECL_NOTHROW
{ return segmentCount() == 0; }
- inline bool isNormalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline bool isNormalized() const Q_DECL_NOTHROW
{ return isNull() || segmentAt(segmentCount() - 1) != 0; }
- inline int majorVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline int majorVersion() const Q_DECL_NOTHROW
{ return segmentAt(0); }
- inline int minorVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline int minorVersion() const Q_DECL_NOTHROW
{ return segmentAt(1); }
- inline int microVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline int microVersion() const Q_DECL_NOTHROW
{ return segmentAt(2); }
- Q_CORE_EXPORT QVersionNumber normalized() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT QVersionNumber normalized() const;
- Q_CORE_EXPORT QVector<int> segments() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT QVector<int> segments() const;
- inline int segmentAt(int index) const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline int segmentAt(int index) const Q_DECL_NOTHROW
{ return (m_segments.size() > index) ? m_segments.at(index) : 0; }
- inline int segmentCount() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT inline int segmentCount() const Q_DECL_NOTHROW
{ return m_segments.size(); }
- Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW;
- Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW;
- Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2);
- Q_CORE_EXPORT QString toString() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT QString toString() const;
#if QT_STRINGVIEW_LEVEL < 2
- Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR);
#endif
- Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr) Q_REQUIRED_RESULT;
- Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr) Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr);
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr);
private:
#ifndef QT_NO_DATASTREAM
diff --git a/src/dbus/Qt5DBusMacros.cmake b/src/dbus/Qt5DBusMacros.cmake
index 2364c6710c..ef3eb73276 100644
--- a/src/dbus/Qt5DBusMacros.cmake
+++ b/src/dbus/Qt5DBusMacros.cmake
@@ -92,7 +92,6 @@ function(QT5_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -optio
cmake_parse_arguments(_DBUS_INTERFACE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_customName ${_DBUS_INTERFACE_UNPARSED_ARGUMENTS})
- set(_qt4_dbus_options ${_DBUS_INTERFACE_OPTIONS})
get_filename_component(_in_file ${_header} ABSOLUTE)
get_filename_component(_basename ${_header} NAME_WE)
@@ -112,7 +111,7 @@ function(QT5_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -optio
endif()
add_custom_command(OUTPUT ${_target}
- COMMAND ${Qt5DBus_QDBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target}
+ COMMAND ${Qt5DBus_QDBUSCPP2XML_EXECUTABLE} ${_DBUS_INTERFACE_OPTIONS} ${_in_file} -o ${_target}
DEPENDS ${_in_file} VERBATIM
)
endfunction()
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 91e6bebc7f..854b187eb6 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -243,7 +243,7 @@
]
},
"xcb_syslibs": {
- "label": "XCB (secondary)",
+ "label": "XCB (extensions)",
"test": "qpa/xcb-syslibs",
"sources": [
{ "type": "pkgConfig",
@@ -737,11 +737,11 @@
"output": [ "privateFeature" ]
},
"system-xcb": {
- "label": "Using system provided XCB libraries",
- "enable": "input.xcb == 'system' || input.xcb == 'yes'",
- "disable": "input.xcb == 'qt' || input.xcb == 'no'",
+ "label": "Using system-provided XCB libraries",
+ "enable": "input.xcb == 'system'",
+ "disable": "input.xcb == 'qt'",
"autoDetect": "!config.darwin",
- "condition": "libs.xcb && libs.xcb_syslibs",
+ "condition": "features.xcb && libs.xcb_syslibs",
"output": [ "privateFeature" ]
},
"x11-prefix": {
@@ -757,8 +757,14 @@
},
"xcb-render": {
"label": "XCB render",
- "emitIf": "features.system-xcb",
- "condition": "libs.xcb_render",
+ "emitIf": "features.xcb",
+ "condition": "!features.system-xcb || libs.xcb_render",
+ "output": [ "privateFeature" ]
+ },
+ "xkb": {
+ "label": "XCB XKB",
+ "emitIf": "features.xcb",
+ "condition": "!features.system-xcb || libs.xcb_xkb",
"output": [ "privateFeature" ]
},
"xcb-xlib": {
@@ -775,6 +781,7 @@
},
"xinput2": {
"label": "Xinput2",
+ "emitIf": "features.xcb",
"condition": "libs.xinput2",
"output": [ "privateFeature" ]
},
@@ -791,11 +798,6 @@
"condition": "libs.xkbcommon_x11",
"output": [ "privateFeature" ]
},
- "xkb": {
- "label": "XCB XKB",
- "condition": "features.system-xcb && libs.xcb_xkb",
- "output": [ "privateFeature" ]
- },
"xkb-config-root": {
"label": "XKB config root",
"emitIf": "features.xcb",
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 591d024f8f..3b3ebafc2d 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -39,7 +39,8 @@ depends += \
qtquick \
qtwidgets \
qtdoc \
- qmake
+ qmake \
+ qttestlib
headerdirs += ..
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index c1ea053204..fffd7a1ac2 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1071,7 +1071,7 @@ QImage::operator QVariant() const
Nothing is done if there is just a single reference.
- \sa copy(), isDetached(), {Implicit Data Sharing}
+ \sa copy(), {QImage::isDetached()}{isDetached()}, {Implicit Data Sharing}
*/
void QImage::detach()
{
@@ -2127,7 +2127,7 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
/*!
\since 5.9
- Changes the format of the image without changing the data. Only
+ Changes the \a format of the image without changing the data. Only
works between formats of the same depth.
Returns \c true if successful.
@@ -4671,7 +4671,7 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
}
// initizialize the data
- if (d->format == QImage::Format_Indexed8) {
+ if (target_format == QImage::Format_Indexed8) {
if (dImage.d->colortable.size() < 256) {
// colors are left in the color table, so pick that one as transparent
dImage.d->colortable.append(0x0);
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 204e7a54b2..225ef3d2e8 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -179,9 +179,9 @@ public:
Format format() const;
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP)
- Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const & Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
{ return convertToFormat_helper(f, flags); }
- Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) && Q_REQUIRED_RESULT
+ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
{
if (convertToFormat_inplace(f, flags))
return std::move(*this);
@@ -189,9 +189,9 @@ public:
return convertToFormat_helper(f, flags);
}
#else
- QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
#endif
- QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
bool reinterpretAsFormat(Format f);
int width() const;
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 1d19c165fc..9506a95506 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -830,7 +830,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, c
int color_type = 0;
- if (image.colorCount()) {
+ if (image.format() <= QImage::Format_Indexed8) {
if (image.isGrayscale())
color_type = PNG_COLOR_TYPE_GRAY;
else
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index ac9edc8eb0..2777e408c1 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4090,6 +4090,20 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
}
dbg << ')';
break;
+ case QEvent::ScrollPrepare: {
+ const QScrollPrepareEvent *se = static_cast<const QScrollPrepareEvent *>(e);
+ dbg << "QScrollPrepareEvent(viewportSize=" << se->viewportSize()
+ << ", contentPosRange=" << se->contentPosRange()
+ << ", contentPos=" << se->contentPos() << ')';
+ }
+ break;
+ case QEvent::Scroll: {
+ const QScrollEvent *se = static_cast<const QScrollEvent *>(e);
+ dbg << "QScrollEvent(contentPos=" << se->contentPos()
+ << ", overshootDistance=" << se->overshootDistance()
+ << ", scrollState=" << se->scrollState() << ')';
+ }
+ break;
default:
dbg << eventClassName(type) << '(';
QtDebugUtils::formatQEnum(dbg, type);
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a3b2c4c1e4..56f112c36c 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2027,13 +2027,23 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::focusWindow();
}
+#if defined(Q_OS_ANDROID)
+ static bool backKeyPressAccepted = false;
+ static bool menuKeyPressAccepted = false;
+#endif
+
#if !defined(Q_OS_OSX)
// FIXME: Include OS X in this code path by passing the key event through
// QPlatformInputContext::filterEvent().
if (e->keyType == QEvent::KeyPress && window) {
if (QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
- e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount))
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount)) {
+#if defined(Q_OS_ANDROID)
+ backKeyPressAccepted = e->key == Qt::Key_Back;
+ menuKeyPressAccepted = e->key == Qt::Key_Menu;
+#endif
return;
+ }
}
#endif
@@ -2050,8 +2060,6 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
else
ev.setAccepted(false);
- static bool backKeyPressAccepted = false;
- static bool menuKeyPressAccepted = false;
if (e->keyType == QEvent::KeyPress) {
backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted();
menuKeyPressAccepted = e->key == Qt::Key_Menu && ev.isAccepted();
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index e1bd3d11b2..5170c7ab63 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -528,7 +528,9 @@ QImage QOpenGLWindow::grabFramebuffer()
return QImage();
makeCurrent();
- return qt_gl_read_framebuffer(size() * devicePixelRatio(), false, false);
+ QImage img = qt_gl_read_framebuffer(size() * devicePixelRatio(), false, false);
+ img.setDevicePixelRatio(devicePixelRatio());
+ return img;
}
/*!
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp
index 8080cb91ad..d42231e958 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.cpp
+++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp
@@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE
QPlatformGraphicsBuffer is intended to be created by using platform specific
APIs available from QtPlatformHeaders, or there might be accessor functions
similar to the accessor function that QPlatformBackingstore has.
+
+ \internal
*/
/*!
diff --git a/src/gui/kernel/qplatformsystemtrayicon.cpp b/src/gui/kernel/qplatformsystemtrayicon.cpp
index 973b998059..5481997b3c 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.cpp
+++ b/src/gui/kernel/qplatformsystemtrayicon.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtGui
\brief The QPlatformSystemTrayIcon class abstracts the system tray icon and interaction.
+ \internal
\sa QSystemTrayIcon
*/
@@ -82,16 +83,10 @@ QT_BEGIN_NAMESPACE
\sa activated()
*/
-/*!
- \internal
- */
QPlatformSystemTrayIcon::QPlatformSystemTrayIcon()
{
}
-/*!
- \internal
- */
QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
{
}
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 97cc8d179d..0f13412fb1 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -215,7 +215,10 @@ static void cleanupDevicesList()
/*!
Returns a list of all registered devices.
- \note The returned list cannot be used to add new devices. Use QWindowSystemInterface::registerTouchDevice() instead.
+ \note The returned list cannot be used to add new devices. To add a simulated
+ touch screen for an autotest, QTest::createTouchDevice() can be used.
+ To add real touch screens to QPA plugins, the private
+ \c QWindowSystemInterface::registerTouchDevice() function can be used.
*/
QList<const QTouchDevice *> QTouchDevice::devices()
{
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 3f5f71002b..6e7be2aec2 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1317,6 +1317,10 @@ void QWindow::setTransientParent(QWindow *parent)
qWarning() << parent << "must be a top level window.";
return;
}
+ if (parent == this) {
+ qWarning() << "transient parent" << parent << "can not be same as window";
+ return;
+ }
d->transientParent = parent;
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 9a1ab54124..6a2a9e5bae 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -64,7 +64,7 @@ public:
void fill(T value);
- QGenericMatrix<M, N, T> transposed() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QGenericMatrix<M, N, T> transposed() const;
QGenericMatrix<N, M, T>& operator+=(const QGenericMatrix<N, M, T>& other);
QGenericMatrix<N, M, T>& operator-=(const QGenericMatrix<N, M, T>& other);
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index b6381e1d8f..6b18e1ab03 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1940,7 +1940,7 @@ QMatrix4x4 QMatrix4x4::orthonormalInverse() const
Normally the QMatrix4x4 class keeps track of this special type internally
as operations are performed. However, if the matrix is modified
- directly with operator()() or data(), then QMatrix4x4 will lose track of
+ directly with {QLoggingCategory::operator()}{operator()()} or data(), then QMatrix4x4 will lose track of
the special type and will revert to the safest but least efficient
operations thereafter.
@@ -1948,7 +1948,7 @@ QMatrix4x4 QMatrix4x4::orthonormalInverse() const
the programmer can force QMatrix4x4 to recover the special type if
the elements appear to conform to one of the known optimized types.
- \sa operator()(), data(), translate()
+ \sa {QLoggingCategory::operator()}{operator()()}, data(), translate()
*/
void QMatrix4x4::optimize()
{
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index aca685920e..4db96d07c0 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -423,8 +423,9 @@ inline QMatrix4x4& QMatrix4x4::operator-=(const QMatrix4x4& other)
return *this;
}
-inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& other)
+inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& o)
{
+ const QMatrix4x4 other = o; // prevent aliasing when &o == this ### Qt 6: take o by value
flagBits |= other.flagBits;
if (flagBits < Rotation2D) {
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index eff427117f..7f7f89db4d 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -90,14 +90,14 @@ public:
float length() const;
float lengthSquared() const;
- QQuaternion normalized() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QQuaternion normalized() const;
void normalize();
inline QQuaternion inverted() const;
- QQuaternion conjugated() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QQuaternion conjugated() const;
#if QT_DEPRECATED_SINCE(5, 5)
- QT_DEPRECATED QQuaternion conjugate() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QT_DEPRECATED QQuaternion conjugate() const;
#endif
QVector3D rotatedVector(const QVector3D& vector) const;
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index bdb56c9c1f..5e0394b998 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -82,7 +82,7 @@ public:
float length() const;
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
- QVector2D normalized() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector2D normalized() const;
void normalize();
float distanceToPoint(const QVector2D &point) const;
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index f63b2f141b..be373aa806 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -88,7 +88,7 @@ public:
float length() const;
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
- QVector4D normalized() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector4D normalized() const;
void normalize();
QVector4D &operator+=(const QVector4D &vector);
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index a76da20910..b5df68a3aa 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -49,7 +49,7 @@
# include <QtCore/qt_windows.h>
#endif
-// Note: Mac OSX is a "controlled platform" for OpenGL ABI so we
+// Note: Apple is a "controlled platform" for OpenGL ABI so we
// use the system provided headers there. Controlled means that the
// headers always match the actual driver implementation so there
// is no possibility of drivers exposing additional functionality
@@ -64,7 +64,7 @@
// which the system headers do not.
#if defined(QT_OPENGL_ES_2)
-# if defined(Q_OS_MAC) // iOS
+# if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
# if defined(QT_OPENGL_ES_3)
# include <OpenGLES/ES3/gl.h>
# include <OpenGLES/ES3/glext.h>
@@ -81,7 +81,7 @@
*/
typedef void* GLeglImageOES;
-# else // "uncontrolled" ES2 platforms
+# elif !defined(Q_OS_DARWIN) // "uncontrolled" ES2 platforms
// In "es2" builds (QT_OPENGL_ES_2) additional defines indicate GLES 3.0 or
// higher is available *at build time*. In this case include the corresponding
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 0831bfe706..766d4a327a 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -3302,6 +3302,9 @@ void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace,
/*!
\since 5.9
\overload
+
+ Parameter \a layerCount is the number of layers in a texture array
+ that are being uploaded/populated by this call.
*/
void QOpenGLTexture::setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options)
{
@@ -3476,6 +3479,9 @@ void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cube
/*!
\since 5.9
\overload
+
+ Parameter \a layerCount is the number of layers in a texture array
+ that are being uploaded/populated by this call.
*/
void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options)
{
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index e254de6ad0..0c5ebcbda9 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -197,7 +197,7 @@ public:
QColor toCmyk() const Q_DECL_NOTHROW;
QColor toHsl() const Q_DECL_NOTHROW;
- QColor convertTo(Spec colorSpec) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QColor convertTo(Spec colorSpec) const Q_DECL_NOTHROW;
static QColor fromRgb(QRgb rgb) Q_DECL_NOTHROW;
static QColor fromRgba(QRgb rgba) Q_DECL_NOTHROW;
@@ -217,10 +217,10 @@ public:
static QColor fromHsl(int h, int s, int l, int a = 255);
static QColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
- QColor light(int f = 150) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QColor lighter(int f = 150) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QColor dark(int f = 200) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- QColor darker(int f = 200) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QColor light(int f = 150) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QColor lighter(int f = 150) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QColor dark(int f = 200) const Q_DECL_NOTHROW;
+ Q_REQUIRED_RESULT QColor darker(int f = 200) const Q_DECL_NOTHROW;
bool operator==(const QColor &c) const Q_DECL_NOTHROW;
bool operator!=(const QColor &c) const Q_DECL_NOTHROW;
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 7b35cd6143..0143e9b602 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -188,11 +188,7 @@ typedef ptrdiff_t QT_FT_PtrDist;
#include <stdlib.h>
#include <stdio.h>
- /* This macro is used to indicate that a function parameter is unused. */
- /* Its purpose is simply to reduce compiler warnings. Note also that */
- /* simply defining it as `(void)x' doesn't avoid warnings with certain */
- /* ANSI compilers (e.g. LCC). */
-#define QT_FT_UNUSED( x ) (x) = (x)
+#define QT_FT_UNUSED( x ) (void) x
#define QT_FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
#define QT_FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 76bf61671c..15e0ab5be1 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -108,7 +108,7 @@ public:
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
- QMatrix inverted(bool *invertible = Q_NULLPTR) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = Q_NULLPTR) const;
bool operator==(const QMatrix &) const;
bool operator!=(const QMatrix &) const;
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 131fcde8cc..db39c1c5a0 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -154,8 +154,8 @@ public:
void translate(qreal dx, qreal dy);
inline void translate(const QPointF &offset);
- QPainterPath translated(qreal dx, qreal dy) const Q_REQUIRED_RESULT;
- inline QPainterPath translated(const QPointF &offset) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPainterPath translated(qreal dx, qreal dy) const;
+ Q_REQUIRED_RESULT inline QPainterPath translated(const QPointF &offset) const;
QRectF boundingRect() const;
QRectF controlPointRect() const;
@@ -165,7 +165,7 @@ public:
bool isEmpty() const;
- QPainterPath toReversed() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPainterPath toReversed() const;
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
@@ -185,12 +185,12 @@ public:
bool intersects(const QPainterPath &p) const;
bool contains(const QPainterPath &p) const;
- QPainterPath united(const QPainterPath &r) const Q_REQUIRED_RESULT;
- QPainterPath intersected(const QPainterPath &r) const Q_REQUIRED_RESULT;
- QPainterPath subtracted(const QPainterPath &r) const Q_REQUIRED_RESULT;
- QPainterPath subtractedInverted(const QPainterPath &r) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPainterPath united(const QPainterPath &r) const;
+ Q_REQUIRED_RESULT QPainterPath intersected(const QPainterPath &r) const;
+ Q_REQUIRED_RESULT QPainterPath subtracted(const QPainterPath &r) const;
+ Q_REQUIRED_RESULT QPainterPath subtractedInverted(const QPainterPath &r) const;
- QPainterPath simplified() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPainterPath simplified() const;
bool operator==(const QPainterPath &other) const;
bool operator!=(const QPainterPath &other) const;
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index c57802e84e..f192e8d10b 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -78,8 +78,8 @@ public:
void translate(int dx, int dy);
void translate(const QPoint &offset);
- QPolygon translated(int dx, int dy) const Q_REQUIRED_RESULT;
- inline QPolygon translated(const QPoint &offset) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPolygon translated(int dx, int dy) const;
+ Q_REQUIRED_RESULT inline QPolygon translated(const QPoint &offset) const;
QRect boundingRect() const;
@@ -95,9 +95,9 @@ public:
bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
- QPolygon united(const QPolygon &r) const Q_REQUIRED_RESULT;
- QPolygon intersected(const QPolygon &r) const Q_REQUIRED_RESULT;
- QPolygon subtracted(const QPolygon &r) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPolygon united(const QPolygon &r) const;
+ Q_REQUIRED_RESULT QPolygon intersected(const QPolygon &r) const;
+ Q_REQUIRED_RESULT QPolygon subtracted(const QPolygon &r) const;
};
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygon)
@@ -162,7 +162,7 @@ public:
void translate(const QPointF &offset);
inline QPolygonF translated(qreal dx, qreal dy) const;
- QPolygonF translated(const QPointF &offset) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPolygonF translated(const QPointF &offset) const;
QPolygon toPolygon() const;
@@ -172,9 +172,9 @@ public:
bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
- QPolygonF united(const QPolygonF &r) const Q_REQUIRED_RESULT;
- QPolygonF intersected(const QPolygonF &r) const Q_REQUIRED_RESULT;
- QPolygonF subtracted(const QPolygonF &r) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QPolygonF united(const QPolygonF &r) const;
+ Q_REQUIRED_RESULT QPolygonF intersected(const QPolygonF &r) const;
+ Q_REQUIRED_RESULT QPolygonF subtracted(const QPolygonF &r) const;
};
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygonF)
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 4f0a071da8..8dd7649447 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -99,23 +99,23 @@ public:
void translate(int dx, int dy);
inline void translate(const QPoint &p) { translate(p.x(), p.y()); }
- QRegion translated(int dx, int dy) const Q_REQUIRED_RESULT;
- inline QRegion translated(const QPoint &p) const Q_REQUIRED_RESULT { return translated(p.x(), p.y()); }
+ Q_REQUIRED_RESULT QRegion translated(int dx, int dy) const;
+ Q_REQUIRED_RESULT inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); }
- QRegion united(const QRegion &r) const Q_REQUIRED_RESULT;
- QRegion united(const QRect &r) const Q_REQUIRED_RESULT;
- QRegion intersected(const QRegion &r) const Q_REQUIRED_RESULT;
- QRegion intersected(const QRect &r) const Q_REQUIRED_RESULT;
- QRegion subtracted(const QRegion &r) const Q_REQUIRED_RESULT;
- QRegion xored(const QRegion &r) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QRegion united(const QRegion &r) const;
+ Q_REQUIRED_RESULT QRegion united(const QRect &r) const;
+ Q_REQUIRED_RESULT QRegion intersected(const QRegion &r) const;
+ Q_REQUIRED_RESULT QRegion intersected(const QRect &r) const;
+ Q_REQUIRED_RESULT QRegion subtracted(const QRegion &r) const;
+ Q_REQUIRED_RESULT QRegion xored(const QRegion &r) const;
#if QT_DEPRECATED_SINCE(5, 0)
- inline QT_DEPRECATED QRegion unite(const QRegion &r) const Q_REQUIRED_RESULT { return united(r); }
- inline QT_DEPRECATED QRegion unite(const QRect &r) const Q_REQUIRED_RESULT { return united(r); }
- inline QT_DEPRECATED QRegion intersect(const QRegion &r) const Q_REQUIRED_RESULT { return intersected(r); }
- inline QT_DEPRECATED QRegion intersect(const QRect &r) const Q_REQUIRED_RESULT { return intersected(r); }
- inline QT_DEPRECATED QRegion subtract(const QRegion &r) const Q_REQUIRED_RESULT { return subtracted(r); }
- inline QT_DEPRECATED QRegion eor(const QRegion &r) const Q_REQUIRED_RESULT { return xored(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion unite(const QRegion &r) const { return united(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion unite(const QRect &r) const { return united(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion intersect(const QRegion &r) const { return intersected(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion intersect(const QRect &r) const { return intersected(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion subtract(const QRegion &r) const { return subtracted(r); }
+ Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion eor(const QRegion &r) const { return xored(r); }
#endif
bool intersects(const QRegion &r) const;
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 5ca1d46982..06ae611861 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -116,9 +116,9 @@ public:
qreal m21, qreal m22, qreal m23,
qreal m31, qreal m32, qreal m33);
- QTransform inverted(bool *invertible = Q_NULLPTR) const Q_REQUIRED_RESULT;
- QTransform adjoint() const Q_REQUIRED_RESULT;
- QTransform transposed() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QTransform inverted(bool *invertible = Q_NULLPTR) const;
+ Q_REQUIRED_RESULT QTransform adjoint() const;
+ Q_REQUIRED_RESULT QTransform transposed() const;
QTransform &translate(qreal dx, qreal dy);
QTransform &scale(qreal sx, qreal sy);
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 599b18ac05..4ad826e87b 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -45,6 +45,7 @@
#include <qpa/qplatformscreen.h>
#include <QtCore/QLibraryInfo>
#include <QtCore/QDir>
+#include <QtCore/QMetaEnum>
#include <algorithm>
#include <iterator>
@@ -201,6 +202,26 @@ QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWr
return *this;
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QSupportedWritingSystems &sws)
+{
+ QMetaObject mo = QFontDatabase::staticMetaObject;
+ QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("WritingSystem"));
+
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "QSupportedWritingSystems(";
+ int i = sws.d->vector.indexOf(true);
+ while (i > 0) {
+ debug << me.valueToKey(i);
+ i = sws.d->vector.indexOf(true, i + 1);
+ if (i > 0)
+ debug << ", ";
+ }
+ debug << ")";
+ return debug;
+}
+#endif
+
/*!
Destroys the supported writing systems object.
*/
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index 2d99183ca3..2ca783f0fd 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -84,11 +84,18 @@ private:
friend Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
friend Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &);
+#endif
};
Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &);
+#endif
+
class QFontRequestPrivate;
class QFontEngineMulti;
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 8834afc80e..fcda17605f 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -292,7 +292,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
/*!
Constructs a QSyntaxHighlighter with the given \a parent.
- If the parent is a QTextEdit, it installs the syntaxhighlighter on the
+ If the parent is a QTextEdit, it installs the syntax highlighter on the
parents document. The specified QTextEdit also becomes the owner of
the QSyntaxHighlighter.
*/
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 3a78296c57..ea37695f4e 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -825,9 +825,13 @@ bool QTextHtmlImporter::closeTag()
break;
case Html_div:
- if (closedNode->children.isEmpty())
- break;
- Q_FALLTHROUGH();
+ if (cursor.position() > 0) {
+ const QChar curChar = cursor.document()->characterAt(cursor.position() - 1);
+ if (!closedNode->children.isEmpty() && curChar != QChar::LineSeparator) {
+ blockTagClosed = true;
+ }
+ }
+ break;
default:
if (closedNode->isBlock())
blockTagClosed = true;
diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp
index 0ea9f3f046..ab4695480b 100644
--- a/src/network/access/qhstspolicy.cpp
+++ b/src/network/access/qhstspolicy.cpp
@@ -103,11 +103,11 @@ QHstsPolicy::QHstsPolicy() : d(new QHstsPolicyPrivate)
}
/*!
- Constructs QHstsPolicy with \a expiry (in UTC); \a includeSubDomains parameter
- defines if this policy must also include subdomains, \a host data is interpreted
- according to \a mode.
+ Constructs QHstsPolicy with \a expiry (in UTC):
+ - \a host data is interpreted according to \a mode;
+ - \a flags selects options to apply to this policy.
- \sa QUrl::setHost(), QUrl::ParsingMode
+ \sa QUrl::setHost(), QUrl::ParsingMode, QHstsPolicy::PolicyFlag
*/
QHstsPolicy::QHstsPolicy(const QDateTime &expiry, PolicyFlags flags,
const QString &host, QUrl::ParsingMode mode)
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index d242bdba82..6d1ee645fe 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -114,7 +114,7 @@ QNetworkAccessFtpBackend::~QNetworkAccessFtpBackend()
//if backend destroyed while in use, then abort (this is the code path from QNetworkReply::abort)
if (ftp && state != Disconnecting)
ftp->abort();
- disconnectFromFtp();
+ disconnectFromFtp(RemoveCachedConnection);
}
void QNetworkAccessFtpBackend::open()
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 018586f9dc..d57acc2f6b 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -739,7 +739,7 @@ bool QNetworkAccessManager::isStrictTransportSecurityEnabled() const
\note While processing HTTP responses, QNetworkAccessManager can also update
the HSTS cache, removing or updating exitsting policies or introducing new
- known hosts. The current implementation thus is server-driven, client code
+ \a knownHosts. The current implementation thus is server-driven, client code
can provide QNetworkAccessManager with previously known or discovered
policies, but this information can be overridden by "Strict-Transport-Security"
response headers.
@@ -1045,7 +1045,7 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess
{
Q_D(const QNetworkAccessManager);
- if (d->networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined))
+ if (d->customNetworkConfiguration && d->networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined))
return UnknownAccessibility;
if (d->networkSessionRequired) {
@@ -1841,6 +1841,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
} else if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
reallyOnline = true;
}
+ online = reallyOnline;
if (!reallyOnline) {
if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) {
@@ -1856,7 +1857,6 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
emit q->networkAccessibleChanged(networkAccessible);
}
}
- online = reallyOnline;
if (online && (state != QNetworkSession::Connected && state != QNetworkSession::Roaming)) {
_q_networkSessionClosed();
createSession(q->configuration());
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index bdb23ede1d..fec3b0a100 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1883,6 +1883,12 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
}
}
+
+ // A signal we've emitted might be handled by a slot that aborts,
+ // so we need to check for that and bail out if it's happened:
+ if (!q->isOpen())
+ return;
+
// If there are still bytes available in the cacheLoadDevice then the user did not read
// in response to the readyRead() signal. This means we have to load from the cacheLoadDevice
// and buffer that stuff. This is needed to be able to properly emit finished() later.
diff --git a/src/network/ssl/qsslellipticcurve.h b/src/network/ssl/qsslellipticcurve.h
index 0e7cc60e31..231566063e 100644
--- a/src/network/ssl/qsslellipticcurve.h
+++ b/src/network/ssl/qsslellipticcurve.h
@@ -64,8 +64,8 @@ public:
Q_NETWORK_EXPORT static QSslEllipticCurve fromShortName(const QString &name);
Q_NETWORK_EXPORT static QSslEllipticCurve fromLongName(const QString &name);
- Q_NETWORK_EXPORT QString shortName() const Q_REQUIRED_RESULT;
- Q_NETWORK_EXPORT QString longName() const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT Q_NETWORK_EXPORT QString shortName() const;
+ Q_REQUIRED_RESULT Q_NETWORK_EXPORT QString longName() const;
Q_DECL_CONSTEXPR bool isValid() const Q_DECL_NOTHROW
{
diff --git a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
index 898b1bbb29..9061690681 100644
--- a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
+++ b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
@@ -168,10 +168,10 @@
\fn bool QWindowsWindowFunctions::isTabletMode()
This is a convenience function that can be used directly instead of resolving
- the function pointer. The function can be used to query whether Windows 10
- operates in \e{Tablet Mode}. In this mode, Windows forces all application
- main windows to open in maximized state. Applications should then avoid
- resizing windows or restoring geometries to non-maximized states.
+ the function pointer. Returns true if Windows 10 operates in \e{Tablet Mode}.
+ In this mode, Windows forces all application main windows to open in maximized
+ state. Applications should then avoid resizing windows or restoring geometries
+ to non-maximized states.
\sa QWidget::showMaximized(), QWidget::saveGeometry(), QWidget::restoreGeometry()
\since 5.9
diff --git a/src/platformsupport/accessibility/accessibility.pro b/src/platformsupport/accessibility/accessibility.pro
index 5004dc8cbe..1806d75630 100644
--- a/src/platformsupport/accessibility/accessibility.pro
+++ b/src/platformsupport/accessibility/accessibility.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += \
qaccessiblebridgeutils_p.h
diff --git a/src/platformsupport/cglconvenience/cglconvenience.pro b/src/platformsupport/cglconvenience/cglconvenience.pro
index 0422a844aa..89d1fc4643 100644
--- a/src/platformsupport/cglconvenience/cglconvenience.pro
+++ b/src/platformsupport/cglconvenience/cglconvenience.pro
@@ -5,7 +5,6 @@ QT = core-private gui
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += \
cglconvenience_p.h
diff --git a/src/platformsupport/clipboard/clipboard.pro b/src/platformsupport/clipboard/clipboard.pro
index 70ae7ebace..916f6b0c06 100644
--- a/src/platformsupport/clipboard/clipboard.pro
+++ b/src/platformsupport/clipboard/clipboard.pro
@@ -5,7 +5,6 @@ QT = core-private gui
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += qmacmime_p.h
SOURCES += qmacmime.mm
diff --git a/src/platformsupport/devicediscovery/devicediscovery.pro b/src/platformsupport/devicediscovery/devicediscovery.pro
index b429b8b97e..881ec4d41e 100644
--- a/src/platformsupport/devicediscovery/devicediscovery.pro
+++ b/src/platformsupport/devicediscovery/devicediscovery.pro
@@ -6,7 +6,6 @@ QT_FOR_CONFIG += gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += qdevicediscovery_p.h
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index a997bf0ba1..969a9c17e0 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -901,7 +901,13 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef
bool forcedAntialiasSetting = !antialias;
const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
- bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY"));
+ bool useXftConf = false;
+
+ if (services) {
+ const QList<QByteArray> desktopEnv = services->desktopEnvironment().split(':');
+ useXftConf = desktopEnv.contains("GNOME") || desktopEnv.contains("UNITY");
+ }
+
if (useXftConf && !forcedAntialiasSetting) {
void *antialiasResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index ce9b61ba4c..d89a81be6b 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -199,10 +199,6 @@ static CFArrayRef availableFamilyNames()
void QCoreTextFontDatabase::populateFontDatabase()
{
- // The caller (QFontDB) expects the db to be populate only with system fonts, so we need
- // to make sure that any previously registered app fonts become invisible.
- removeApplicationFonts();
-
QCFType<CFArrayRef> familyNames = availableFamilyNames();
const int numberOfFamilies = CFArrayGetCount(familyNames);
for (int i = 0; i < numberOfFamilies; ++i) {
@@ -255,6 +251,24 @@ struct FontDescription {
QSupportedWritingSystems writingSystems;
};
+#ifndef QT_NO_DEBUG_STREAM
+Q_DECL_UNUSED static inline QDebug operator<<(QDebug debug, const FontDescription &fd)
+{
+ QDebugStateSaver saver(debug);
+ return debug.nospace() << "FontDescription("
+ << "familyName=" << QString(fd.familyName)
+ << ", styleName=" << QString(fd.styleName)
+ << ", foundry=" << fd.foundryName
+ << ", weight=" << fd.weight
+ << ", style=" << fd.style
+ << ", stretch=" << fd.stretch
+ << ", pixelSize=" << fd.pixelSize
+ << ", fixedPitch=" << fd.fixedPitch
+ << ", writingSystems=" << fd.writingSystems
+ << ")";
+}
+#endif
+
static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
{
QCFType<CFDictionaryRef> styles = (CFDictionaryRef) CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute);
@@ -358,9 +372,22 @@ void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font, con
fd.pixelSize, fd.fixedPitch, fd.writingSystems, (void *) font);
}
+static NSString * const kQtFontDataAttribute = @"QtFontDataAttribute";
+
+template <typename T>
+T *descriptorAttribute(CTFontDescriptorRef descriptor, CFStringRef name)
+{
+ return [static_cast<T *>(CTFontDescriptorCopyAttribute(descriptor, name)) autorelease];
+}
+
void QCoreTextFontDatabase::releaseHandle(void *handle)
{
- CFRelease(CTFontDescriptorRef(handle));
+ CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(handle);
+ if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
+ QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
+ delete fontData;
+ }
+ CFRelease(descriptor);
}
extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
@@ -395,61 +422,31 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::fontEngine(const
{
CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(usrPtr);
- QByteArray filename;
- if (NSURL *url = [static_cast<NSURL *>(CTFontDescriptorCopyAttribute(descriptor, kCTFontURLAttribute)) autorelease]) {
- if ([url.scheme isEqual:@"qrc"])
- filename = ":";
- else if (!url.fileURL)
- qWarning() << "QFontDatabase: Unknown scheme" << url.scheme << "in font descriptor URL";
+ if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
+ Q_ASSERT(url.fileURL);
+ QFontEngine::FaceId faceId;
+ faceId.filename = QString::fromNSString(url.path).toUtf8();
+ return QFontEngineFT::create(fontDef, faceId);
- filename += QString::fromNSString(url.path).toUtf8();
+ } else if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
+ QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
+ return QFontEngineFT::create(*fontData, fontDef.pixelSize,
+ static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
}
- Q_ASSERT(!filename.isEmpty());
-
- QFontEngine::FaceId faceId;
- faceId.filename = filename;
- return QFontEngineFT::create(fontDef, faceId);
+ Q_UNREACHABLE();
}
#endif
-static void releaseFontData(void* info, const void* data, size_t size)
-{
- Q_UNUSED(data);
- Q_UNUSED(size);
- delete (QByteArray*)info;
-}
-
-template <>
-QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+template <class T>
+QFontEngine *QCoreTextFontDatabaseEngineFactory<T>::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
- Q_UNUSED(hintingPreference);
-
- QByteArray* fontDataCopy = new QByteArray(fontData);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
- fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
-
- CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider);
-
- QFontEngine *fontEngine = NULL;
- if (cgFont == NULL) {
- qWarning("QCoreTextFontDatabase::fontEngine: CGFontCreateWithDataProvider failed");
- } else {
- QFontDef def;
- def.pixelSize = pixelSize;
- def.pointSize = pixelSize * 72.0 / qt_defaultDpi();
- fontEngine = new QCoreTextFontEngine(cgFont, def);
- CFRelease(cgFont);
- }
-
- return fontEngine;
+ return T::create(fontData, pixelSize, hintingPreference);
}
+// Explicitly instantiate so that we don't need the plugin to involve FreeType
+template class QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
#ifndef QT_NO_FREETYPE
-template <>
-QFontEngine *QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
-{
- return QFontEngineFT::create(fontData, pixelSize, hintingPreference);
-}
+template class QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
#endif
QFont::StyleHint styleHintFromNSString(NSString *style)
@@ -584,90 +581,41 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
return fallbackLists[styleLookupKey.arg(styleHint)];
}
-template <>
-CFArrayRef QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::createDescriptorArrayForFont(CTFontRef font, const QString &fileName)
-{
- Q_UNUSED(fileName)
- CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
- QCFType<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(font);
- CFArrayAppendValue(array, descriptor);
- return array;
-}
-
-#ifndef QT_NO_FREETYPE
-template <>
-CFArrayRef QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::createDescriptorArrayForFont(CTFontRef font, const QString &fileName)
-{
- CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
- QCFType<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(font);
-
- // The physical font source URL (usually a local file or Qt resource) is only required for
- // FreeType, when using non-system fonts, and needs some hackery to attach in a format
- // agreeable to OSX.
- if (!fileName.isEmpty()) {
- QCFType<CFURLRef> fontURL;
-
- if (fileName.startsWith(QLatin1String(":/"))) {
- // QUrl::fromLocalFile() doesn't accept qrc pseudo-paths like ":/fonts/myfont.ttf".
- // Therefore construct from QString with the qrc:// scheme -> "qrc:///fonts/myfont.ttf".
- fontURL = QUrl(QStringLiteral("qrc://") + fileName.mid(1)).toCFURL();
- } else {
- // At this point we hope that filename is in a format that QUrl can handle.
- fontURL = QUrl::fromLocalFile(fileName).toCFURL();
- }
-
- QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 1,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributes, kCTFontURLAttribute, fontURL);
- descriptor = CTFontDescriptorCreateCopyWithAttributes(descriptor, attributes);
- }
-
- CFArrayAppendValue(array, descriptor);
- return array;
-}
-#endif
-
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
QCFType<CFArrayRef> fonts;
- QStringList families;
- CFErrorRef error = 0;
if (!fontData.isEmpty()) {
- QByteArray* fontDataCopy = new QByteArray(fontData);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
- fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
- QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
- if (cgFont) {
- if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
- QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
- fonts = createDescriptorArrayForFont(font, fileName);
- m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
- }
+ QCFType<CFDataRef> fontDataReference = fontData.toRawCFData();
+ if (QCFType<CTFontDescriptorRef> descriptor = CTFontManagerCreateFontDescriptorFromData(fontDataReference)) {
+ // There's no way to get the data back out of a font descriptor created with
+ // CTFontManagerCreateFontDescriptorFromData, so we attach the data manually.
+ NSDictionary *attributes = @{ kQtFontDataAttribute : [NSValue valueWithPointer:new QByteArray(fontData)] };
+ descriptor = CTFontDescriptorCreateCopyWithAttributes(descriptor, (CFDictionaryRef)attributes);
+ CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(array, descriptor);
+ fonts = array;
}
} else {
- QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
- if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
- fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
- m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
- }
+ QCFType<CFURLRef> fontURL = QUrl::fromLocalFile(fileName).toCFURL();
+ fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
}
- if (error) {
- NSLog(@"Unable to register font: %@", error);
- CFRelease(error);
- }
+ if (!fonts)
+ return QStringList();
- if (fonts) {
- const int numFonts = CFArrayGetCount(fonts);
- for (int i = 0; i < numFonts; ++i) {
- CTFontDescriptorRef fontDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fonts, i));
- populateFromDescriptor(fontDescriptor);
- QCFType<CFStringRef> familyName = CFStringRef(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute));
- families.append(QCFString(familyName));
- }
+ QStringList families;
+ const int numFonts = CFArrayGetCount(fonts);
+ for (int i = 0; i < numFonts; ++i) {
+ CTFontDescriptorRef fontDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fonts, i));
+ populateFromDescriptor(fontDescriptor);
+ QCFType<CFStringRef> familyName = CFStringRef(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute));
+ families.append(QString::fromCFString(familyName));
}
+ // Note: We don't do font matching via CoreText for application fonts, so we don't
+ // need to enable font matching for them via CTFontManagerEnableFontDescriptors.
+
return families;
}
@@ -846,22 +794,5 @@ QList<int> QCoreTextFontDatabase::standardSizes() const
return ret;
}
-void QCoreTextFontDatabase::removeApplicationFonts()
-{
- if (m_applicationFonts.isEmpty())
- return;
-
- for (const QVariant &font : qAsConst(m_applicationFonts)) {
- CFErrorRef error;
- if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
- CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
- } else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
- CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
- }
- }
-
- m_applicationFonts.clear();
-}
-
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 8e5449ac90..9c2a4cf1ca 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -87,13 +87,9 @@ public:
private:
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
- virtual CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName) = 0;
mutable QString defaultFontName;
- void removeApplicationFonts();
-
- QVector<QVariant> m_applicationFonts;
mutable QSet<CTFontDescriptorRef> m_systemFontDescriptors;
mutable QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
};
@@ -107,8 +103,6 @@ class QCoreTextFontDatabaseEngineFactory : public QCoreTextFontDatabase
public:
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
-protected:
- CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName) override;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index c8ae342f16..49a6049c4b 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -177,6 +177,43 @@ CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
return transform;
}
+// Keeps font data alive until engine is disposed
+class QCoreTextRawFontEngine : public QCoreTextFontEngine
+{
+public:
+ QCoreTextRawFontEngine(CGFontRef font, const QFontDef &def, const QByteArray &fontData)
+ : QCoreTextFontEngine(font, def)
+ , m_fontData(fontData)
+ {}
+ QByteArray m_fontData;
+};
+
+QCoreTextFontEngine *QCoreTextFontEngine::create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ Q_UNUSED(hintingPreference);
+
+ QCFType<CFDataRef> fontDataReference = fontData.toRawCFData();
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithCFData(fontDataReference);
+
+ // Note: CTFontCreateWithGraphicsFont (which we call from the QCoreTextFontEngine
+ // constructor) has a bug causing it to retain the CGFontRef but never release it.
+ // The result is that we are leaking the CGFont, CGDataProvider, and CGData, but
+ // as the CGData is created from the raw QByteArray data, which we deref in the
+ // subclass above during destruction, we're at least not leaking the font data,
+ // (unless CoreText copies it internally). http://stackoverflow.com/questions/40805382/
+ QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
+
+ if (!cgFont) {
+ qWarning("QCoreTextFontEngine::create: CGFontCreateWithDataProvider failed");
+ return nullptr;
+ }
+
+ QFontDef def;
+ def.pixelSize = pixelSize;
+ def.pointSize = pixelSize * 72.0 / qt_defaultDpi();
+ return new QCoreTextRawFontEngine(cgFont, def, fontData);
+}
+
QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def)
: QFontEngine(Mac)
{
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 0074790e43..2986f0aaec 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -123,6 +123,8 @@ public:
static int antialiasingThreshold;
static QFontEngine::GlyphFormat defaultGlyphFormat;
+
+ static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
private:
void init();
QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool colorful, const QTransform &m);
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
index 683b7f65ad..f07e711048 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
@@ -355,6 +355,13 @@ void QWindowsFontEngineDirectWrite::collectMetrics()
m_faceId.filename = QFile::encodeName(filenameFromFontFile(fontFile));
fontFile->Release();
}
+
+ QByteArray table = getSfntTable(MAKE_TAG('h', 'h', 'e', 'a'));
+ const int advanceWidthMaxLocation = 10;
+ if (table.size() >= advanceWidthMaxLocation + int(sizeof(quint16))) {
+ quint16 advanceWidthMax = qFromBigEndian<quint16>(table.constData() + advanceWidthMaxLocation);
+ m_maxAdvanceWidth = DESIGN_TO_LOGICAL(advanceWidthMax);
+ }
}
QFixed QWindowsFontEngineDirectWrite::underlinePosition() const
@@ -607,8 +614,9 @@ QFixed QWindowsFontEngineDirectWrite::xHeight() const
qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
{
- // ###
- return 0;
+ return fontDef.styleStrategy & QFont::ForceIntegerMetrics
+ ? m_maxAdvanceWidth.round().toReal()
+ : m_maxAdvanceWidth.toReal();
}
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
index 65b16b9ba7..db4e79e44f 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
@@ -143,6 +143,7 @@ private:
QFixed m_descent;
QFixed m_xHeight;
QFixed m_lineGap;
+ QFixed m_maxAdvanceWidth;
FaceId m_faceId;
QString m_uniqueFamilyName;
};
diff --git a/src/platformsupport/glxconvenience/glxconvenience.pro b/src/platformsupport/glxconvenience/glxconvenience.pro
index 41c96d8f0d..58fa9fc479 100644
--- a/src/platformsupport/glxconvenience/glxconvenience.pro
+++ b/src/platformsupport/glxconvenience/glxconvenience.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
LIBS_PRIVATE += $$QMAKE_LIBS_X11
diff --git a/src/platformsupport/graphics/graphics.pro b/src/platformsupport/graphics/graphics.pro
index 878fca7f49..9886ee0332 100644
--- a/src/platformsupport/graphics/graphics.pro
+++ b/src/platformsupport/graphics/graphics.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += $$PWD/qrasterbackingstore_p.h
SOURCES += $$PWD/qrasterbackingstore.cpp
diff --git a/src/platformsupport/kmsconvenience/kmsconvenience.pro b/src/platformsupport/kmsconvenience/kmsconvenience.pro
index d0ff0d4efb..5ea2e3f208 100644
--- a/src/platformsupport/kmsconvenience/kmsconvenience.pro
+++ b/src/platformsupport/kmsconvenience/kmsconvenience.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS +=
qkmsdevice_p.h
diff --git a/src/platformsupport/platformcompositor/platformcompositor.pro b/src/platformsupport/platformcompositor/platformcompositor.pro
index 633e71fb9d..81c31571d0 100644
--- a/src/platformsupport/platformcompositor/platformcompositor.pro
+++ b/src/platformsupport/platformcompositor/platformcompositor.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
SOURCES += \
qopenglcompositor.cpp \
diff --git a/src/platformsupport/themes/themes.pro b/src/platformsupport/themes/themes.pro
index 2aeb1f89ad..aeed4d2f47 100644
--- a/src/platformsupport/themes/themes.pro
+++ b/src/platformsupport/themes/themes.pro
@@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
unix:!darwin: \
include($$PWD/genericunix/genericunix.pri)
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 17c197ea38..e47dd91a3e 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -82,8 +82,8 @@ static jobject m_serviceObject = nullptr;
static jmethodID m_setSurfaceGeometryMethodID = nullptr;
static jmethodID m_destroySurfaceMethodID = nullptr;
-static bool m_activityActive = true; // defaults to true because when the platform plugin is
- // initialized, QtActivity::onResume() has already been called
+static int m_pendingApplicationState = -1;
+static QBasicMutex m_pendingAppStateMtx;
static jclass m_bitmapClass = nullptr;
static jmethodID m_createBitmapMethodID = nullptr;
@@ -130,13 +130,22 @@ static const char m_qtTag[] = "Qt";
static const char m_classErrorMsg[] = "Can't find class \"%s\"";
static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
+static void flushPendingApplicationState();
+
namespace QtAndroid
{
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration)
{
- m_surfacesMutex.lock();
+ QMutexLocker lock(&m_surfacesMutex);
m_androidPlatformIntegration = androidPlatformIntegration;
- m_surfacesMutex.unlock();
+
+ // flush the pending state if necessary.
+ if (m_androidPlatformIntegration) {
+ flushPendingApplicationState();
+ } else {
+ QMutexLocker locker(&m_pendingAppStateMtx);
+ m_pendingApplicationState = -1;
+ }
}
QAndroidPlatformIntegration *androidPlatformIntegration()
@@ -215,12 +224,6 @@ namespace QtAndroid
m_statusBarShowing = false;
}
- void setApplicationActive()
- {
- if (m_activityActive)
- QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
- }
-
jobject createBitmap(QImage img, JNIEnv *env)
{
if (!m_bitmapClass)
@@ -402,11 +405,16 @@ namespace QtAndroid
if (surfaceId == -1)
return;
- QJNIEnvironmentPrivate env;
- if (!env)
- return;
+ {
+ QMutexLocker lock(&m_surfacesMutex);
+ const auto &it = m_surfaces.find(surfaceId);
+ if (it != m_surfaces.end())
+ m_surfaces.erase(it);
+ }
- env->CallStaticVoidMethod(m_applicationClass,
+ QJNIEnvironmentPrivate env;
+ if (env)
+ env->CallStaticVoidMethod(m_applicationClass,
m_destroySurfaceMethodID,
surfaceId);
}
@@ -441,6 +449,16 @@ namespace QtAndroid
} // namespace QtAndroid
+// Force an update of the pending application state (state set before the platform plugin was created)
+static void flushPendingApplicationState()
+{
+ QMutexLocker locker(&m_pendingAppStateMtx);
+ if (m_pendingApplicationState == -1)
+ return;
+
+ QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(m_pendingApplicationState));
+ m_pendingApplicationState = -1;
+}
static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobject applicationAssetManager*/)
{
@@ -584,18 +602,12 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface,
{
QMutexLocker lock(&m_surfacesMutex);
const auto &it = m_surfaces.find(id);
- if (it == m_surfaces.end()) {
- qWarning()<<"Can't find surface" << id;
+ if (it == m_surfaces.end())
return;
- }
- auto surfaceClient = it.value();
- if (!surfaceClient) // This should never happen...
- return;
-
- surfaceClient->surfaceChanged(env, jSurface, w, h);
- if (!jSurface)
- m_surfaces.erase(it);
+ auto surfaceClient = it.value();
+ if (surfaceClient)
+ surfaceClient->surfaceChanged(env, jSurface, w, h);
}
static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
@@ -656,13 +668,14 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state)
{
- m_activityActive = (state == Qt::ApplicationActive);
-
- if (!m_main || !m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration()) {
- QAndroidPlatformIntegration::setDefaultApplicationState(Qt::ApplicationState(state));
+ if (!m_main || !QtAndroid::androidPlatformIntegration()) {
+ QMutexLocker locker(&m_pendingAppStateMtx);
+ m_pendingApplicationState = Qt::ApplicationState(state);
return;
}
+ flushPendingApplicationState();
+
if (state == Qt::ApplicationActive)
QtAndroidPrivate::handleResume();
else if (state == Qt::ApplicationInactive)
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 218e52ccc1..170596082d 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -85,8 +85,6 @@ namespace QtAndroid
jobject activity();
jobject service();
- void setApplicationActive();
-
void showStatusBar();
void hideStatusBar();
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 0668c43d18..ec09965f45 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -86,8 +86,6 @@ int QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight = 71;
Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOrientation;
Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
-Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive;
-
bool QAndroidPlatformIntegration::m_showPasswordEnabled = false;
void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
@@ -143,6 +141,12 @@ void *QAndroidPlatformNativeInterface::nativeResourceForWindow(const QByteArray
return nullptr;
}
+void QAndroidPlatformNativeInterface::customEvent(QEvent *event)
+{
+ if (event->type() == QEvent::User)
+ QtAndroid::setAndroidPlatformIntegration(static_cast<QAndroidPlatformIntegration *>(QGuiApplicationPrivate::platformIntegration()));
+}
+
QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &paramList)
: m_touchDevice(nullptr)
#ifndef QT_NO_ACCESSIBILITY
@@ -170,7 +174,6 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
m_mainThread = QThread::currentThread();
- QtAndroid::setAndroidPlatformIntegration(this);
m_androidFDB = new QAndroidPlatformFontDatabase();
m_androidPlatformServices = new QAndroidPlatformServices();
@@ -233,7 +236,9 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
}
}
- QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState);
+ // We can't safely notify the jni bridge that we're up and running just yet, so let's postpone
+ // it for now.
+ QCoreApplication::postEvent(m_androidPlatformNativeInterface, new QEvent(QEvent::User));
}
static bool needsBasicRenderloopWorkaround()
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index 0d2a0d2ad6..047eaf122e 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -68,6 +68,9 @@ public:
void *nativeResourceForIntegration(const QByteArray &resource) override;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
std::shared_ptr<AndroidStyle> m_androidStyle;
+
+protected:
+ void customEvent(QEvent *event) override;
};
class QAndroidPlatformIntegration : public QPlatformIntegration
@@ -125,7 +128,6 @@ public:
QTouchDevice *touchDevice() const { return m_touchDevice; }
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
- static void setDefaultApplicationState(Qt::ApplicationState applicationState) { m_defaultApplicationState = applicationState; }
#if QT_CONFIG(vulkan)
QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override;
@@ -148,9 +150,6 @@ private:
static Qt::ScreenOrientation m_orientation;
static Qt::ScreenOrientation m_nativeOrientation;
-
- static Qt::ApplicationState m_defaultApplicationState;
-
static bool m_showPasswordEnabled;
QPlatformFontDatabase *m_androidFDB;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 89ac0cbd93..8d98882e9e 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -69,10 +69,7 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
{
- bool ret = QEGLPlatformContext::makeCurrent(surface);
- QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
-
- return ret;
+ return QEGLPlatformContext::makeCurrent(surface);
}
EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index 9b3f555272..3a79e32abe 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -321,10 +321,13 @@ void QAndroidPlatformScreen::doRedraw()
}
}
if (!hasVisibleRasterWindows) {
+ lockSurface();
if (m_id != -1) {
QtAndroid::destroySurface(m_id);
+ releaseSurface();
m_id = -1;
}
+ unlockSurface();
return;
}
QMutexLocker lock(&m_surfaceMutex);
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index 74dc955814..98b93508ce 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -96,11 +96,6 @@ void QAndroidPlatformWindow::setVisible(bool visible)
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QPlatformWindow::setVisible(visible);
-
- // The Android Activity is activated before Qt is initialized, causing the application state to
- // never be set to 'active'. We explicitly set this state when the first window becomes visible.
- if (visible)
- QtAndroid::setApplicationActive();
}
void QAndroidPlatformWindow::setWindowState(Qt::WindowStates state)
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 602cea97a7..cfa7541dfa 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -491,7 +491,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw, WId nativeHandle)
"QT_MAC_WANTS_LAYER");
[m_view setWantsLayer:enable];
}
- setGeometry(tlw->geometry());
+
+ setGeometry(initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight));
+
recreateWindowIfNeeded();
tlw->setGeometry(geometry());
if (tlw->isTopLevel())
@@ -1721,7 +1723,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBeChildNSWindow, bool sh
{
QMacAutoReleasePool pool;
- QRect rect = initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight);
+ QRect rect = geometry();
QScreen *targetScreen = nullptr;
for (QScreen *screen : QGuiApplication::screens()) {
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
index 2040d6bc0e..5f85e4b0b0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
@@ -140,11 +140,11 @@ void QEglFSKmsGbmDevice::destroyGlobalCursor()
void QEglFSKmsGbmDevice::handleDrmEvent()
{
- drmEventContext drmEvent = {
- DRM_EVENT_CONTEXT_VERSION,
- Q_NULLPTR, // vblank handler
- pageFlipHandler // page flip handler
- };
+ drmEventContext drmEvent;
+ memset(&drmEvent, 0, sizeof(drmEvent));
+ drmEvent.version = DRM_EVENT_CONTEXT_VERSION;
+ drmEvent.vblank_handler = nullptr;
+ drmEvent.page_flip_handler = pageFlipHandler;
drmHandleEvent(fd(), &drmEvent);
}
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
index 2ca251c4af..c9fbb8281c 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
@@ -312,11 +312,11 @@ void QLinuxFbDevice::swapBuffers(Output *output)
const int fbIdx = output->backFb;
while (output->backFb == fbIdx) {
- drmEventContext drmEvent = {
- DRM_EVENT_CONTEXT_VERSION,
- nullptr,
- pageFlipHandler
- };
+ drmEventContext drmEvent;
+ memset(&drmEvent, 0, sizeof(drmEvent));
+ drmEvent.version = DRM_EVENT_CONTEXT_VERSION;
+ drmEvent.vblank_handler = nullptr;
+ drmEvent.page_flip_handler = pageFlipHandler;
// Blocks until there is something to read on the drm fd
// and calls back pageFlipHandler once the flip completes.
drmHandleEvent(fd(), &drmEvent);
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index e066ab37c2..2253e3b23d 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -694,7 +694,7 @@ void QQnxWindow::initWindow()
void QQnxWindow::createWindowGroup()
{
// Generate a random window group name
- m_windowGroupName = QUuid::createUuid().toString().toLatin1();
+ m_windowGroupName = QUuid::createUuid().toByteArray();
// Create window group so child windows can be parented by container window
Q_SCREEN_CHECKERROR(screen_create_window_group(m_window, m_windowGroupName.constData()),
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 6614c76a53..a049b8c40c 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -88,6 +88,11 @@
#include "qwindowsopengltester.h"
+static inline void initOpenGlBlacklistResources()
+{
+ Q_INIT_RESOURCE(openglblacklists);
+}
+
QT_BEGIN_NAMESPACE
/*!
@@ -210,7 +215,7 @@ static inline unsigned parseOptions(const QStringList &paramList,
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
{
- Q_INIT_RESOURCE(openglblacklists);
+ initOpenGlBlacklistResources();
static bool dpiAwarenessSet = false;
int tabletAbsoluteRange = -1;
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index edfcf038d7..7ac4bdac6c 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -101,22 +101,26 @@ QT_BEGIN_NAMESPACE
struct KeyInfo {
KeyInfo()
: virtualKey(0)
+ , isAutoRepeat(false)
{
}
KeyInfo(const QString &text, quint32 virtualKey)
: text(text)
, virtualKey(virtualKey)
+ , isAutoRepeat(false)
{
}
KeyInfo(quint32 virtualKey)
: virtualKey(virtualKey)
+ , isAutoRepeat(false)
{
}
QString text;
quint32 virtualKey;
+ bool isAutoRepeat;
};
static inline Qt::ScreenOrientations qtOrientationsFromNative(DisplayOrientations native)
@@ -681,21 +685,26 @@ Qt::KeyboardModifiers QWinRTScreen::keyboardModifiers() const
Qt::KeyboardModifiers mods;
CoreVirtualKeyStates mod;
- d->coreWindow->GetAsyncKeyState(VirtualKey_Shift, &mod);
- if (mod == CoreVirtualKeyStates_Down)
+ HRESULT hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Shift, &mod);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (mod & CoreVirtualKeyStates_Down)
mods |= Qt::ShiftModifier;
- d->coreWindow->GetAsyncKeyState(VirtualKey_Menu, &mod);
- if (mod == CoreVirtualKeyStates_Down)
+ hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Menu, &mod);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (mod & CoreVirtualKeyStates_Down)
mods |= Qt::AltModifier;
- d->coreWindow->GetAsyncKeyState(VirtualKey_Control, &mod);
- if (mod == CoreVirtualKeyStates_Down)
+ hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Control, &mod);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (mod & CoreVirtualKeyStates_Down)
mods |= Qt::ControlModifier;
- d->coreWindow->GetAsyncKeyState(VirtualKey_LeftWindows, &mod);
- if (mod == CoreVirtualKeyStates_Down) {
+ hr = d->coreWindow->GetAsyncKeyState(VirtualKey_LeftWindows, &mod);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (mod & CoreVirtualKeyStates_Down) {
mods |= Qt::MetaModifier;
} else {
- d->coreWindow->GetAsyncKeyState(VirtualKey_RightWindows, &mod);
- if (mod == CoreVirtualKeyStates_Down)
+ hr = d->coreWindow->GetAsyncKeyState(VirtualKey_RightWindows, &mod);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (mod & CoreVirtualKeyStates_Down)
mods |= Qt::MetaModifier;
}
return mods;
@@ -971,6 +980,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
if (!shouldAutoRepeat(key))
return S_OK;
+ d->activeKeys[key].isAutoRepeat = true;
// If the key was pressed before trigger a key release before the next key press
QWindowSystemInterface::handleExtendedKeyEvent(
topWindow(),
@@ -981,7 +991,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
virtualKey,
0,
QString(),
- status.WasKeyDown,
+ d->activeKeys.value(key).isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
} else {
@@ -992,16 +1002,26 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis))
return S_OK;
+ Qt::KeyboardModifiers modifiers = keyboardModifiers();
+ // If the key actually pressed is a modifier key, then we remove its modifier key from the
+ // state, since a modifier-key can't have itself as a modifier (see qwindowskeymapper.cpp)
+ if (key == Qt::Key_Control)
+ modifiers = modifiers ^ Qt::ControlModifier;
+ else if (key == Qt::Key_Shift)
+ modifiers = modifiers ^ Qt::ShiftModifier;
+ else if (key == Qt::Key_Alt)
+ modifiers = modifiers ^ Qt::AltModifier;
+
QWindowSystemInterface::handleExtendedKeyEvent(
topWindow(),
QEvent::KeyPress,
key,
- keyboardModifiers(),
+ modifiers,
!status.ScanCode ? -1 : status.ScanCode,
virtualKey,
0,
QString(),
- status.WasKeyDown,
+ d->activeKeys.value(key).isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
return S_OK;
@@ -1051,20 +1071,19 @@ HRESULT QWinRTScreen::onCharacterReceived(ICoreWindow *, ICharacterReceivedEvent
const Qt::KeyboardModifiers modifiers = keyboardModifiers();
const Qt::Key key = qKeyFromCode(keyCode, modifiers);
const QString text = QChar(keyCode);
- const quint32 virtualKey = d->activeKeys.value(key).virtualKey;
+ const KeyInfo info = d->activeKeys.value(key);
QWindowSystemInterface::handleExtendedKeyEvent(
topWindow(),
QEvent::KeyPress,
key,
modifiers,
!status.ScanCode ? -1 : status.ScanCode,
- virtualKey,
+ info.virtualKey,
0,
text,
- status.WasKeyDown,
+ info.isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
- d->activeKeys.insert(key, KeyInfo(text, virtualKey));
return S_OK;
}
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index 6b35bde83e..5696ae7a10 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -146,6 +146,8 @@ static void nativeColorSettings(QPalette &p)
if (uiColorSettings(L"Hotlight", UIElementType_Hotlight, &color))
p.setColor(QPalette::BrightText, fromColor(color));
+ // Starting with SDK 15063 those have been removed.
+#ifndef QT_WINRT_DISABLE_PHONE_COLORS
//Phone related
if (uiColorSettings(L"PopupBackground", UIElementType_PopupBackground, &color)) {
p.setColor(QPalette::ToolTipBase, fromColor(color));
@@ -186,6 +188,7 @@ static void nativeColorSettings(QPalette &p)
if (uiColorSettings(L"TextContrastWithHigh", UIElementType_TextContrastWithHigh, &color))
p.setColor(QPalette::BrightText, fromColor(color));
+#endif // QT_WINRT_DISABLE_PHONE_COLORS
}
QWinRTTheme::QWinRTTheme()
diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro
index 35801fdacc..02a848b03f 100644
--- a/src/plugins/platforms/winrt/winrt.pro
+++ b/src/plugins/platforms/winrt/winrt.pro
@@ -51,6 +51,7 @@ OTHER_FILES += winrt.json
WINRT_SDK_VERSION_STRING = $$(UCRTVersion)
WINRT_SDK_VERSION = $$member($$list($$split(WINRT_SDK_VERSION_STRING, .)), 2)
lessThan(WINRT_SDK_VERSION, 14322): DEFINES += QT_WINRT_LIMITED_DRAGANDDROP
+greaterThan(WINRT_SDK_VERSION, 14393): DEFINES += QT_WINRT_DISABLE_PHONE_COLORS
contains(DEFINES, QT_NO_DRAGANDDROP) {
SOURCES -= qwinrtdrag.cpp
diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro
index c291ac56a0..cac6f7054d 100644
--- a/src/plugins/platformthemes/gtk3/gtk3.pro
+++ b/src/plugins/platformthemes/gtk3/gtk3.pro
@@ -9,6 +9,7 @@ QT += core-private gui-private theme_support-private
CONFIG += X11
QMAKE_USE += gtk3
+DEFINES += GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
HEADERS += \
qgtk3dialoghelpers.h \
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
index 7e6eb7c559..99e8ec8999 100644
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
@@ -86,7 +86,7 @@ static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
LPWSTR printerIdUtf16 = const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(printerId.utf16()));
// Allocate the required DEVMODE buffer
LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0);
- if (dmSize < 0)
+ if (dmSize <= 0)
return Q_NULLPTR;
LPDEVMODE pDevMode = reinterpret_cast<LPDEVMODE>(malloc(dmSize));
// Get the default DevMode
diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index 57a53006c4..2811230106 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -62,7 +62,7 @@
\endtable
SQLite is the in-process database system with the best test coverage
- and support on all platforms. Oracle via OCI, and PostreSQL and MySQL
+ and support on all platforms. Oracle via OCI, PostgreSQL, and MySQL
through either ODBC or a native driver are well-tested on Windows and
Linux. The completeness of the support for other systems depends on the
availability and quality of client libraries.
@@ -92,7 +92,7 @@
on Windows), then pass the following parameter to configure: \c
-I/usr/local/mysql (or \c{-I C:\mysql\include} for Windows).
- On Windows the \c -I parameter doesn't accept spaces in
+ On Windows, the \c -I parameter doesn't accept spaces in
filenames, so use the 8.3 name instead; for example, use
\c{C:\progra~1\mysql} instead of \c{C:\Program Files\mysql}.
@@ -110,7 +110,7 @@
\section3 QMYSQL Stored Procedure Support
MySQL 5 introduces stored procedure support at the SQL level, but no
- API to control IN, OUT and INOUT parameters. Therefore, parameters
+ API to control IN, OUT, and INOUT parameters. Therefore, parameters
have to be set and read using SQL commands instead of QSqlQuery::bindValue().
Example stored procedure:
@@ -141,8 +141,8 @@
\section3 How to Build the QMYSQL Plugin on Unix and \macos
- You need the MySQL header files and as well as the shared library
- \c{libmysqlclient.so}. Depending on your Linux distribution you may
+ You need the MySQL header files, as well as the shared library
+ \c{libmysqlclient.so}. Depending on your Linux distribution, you may
need to install a package which is usually called "mysql-devel".
Tell \l qmake where to find the MySQL header files and shared
@@ -168,10 +168,10 @@
If you are not using a Microsoft compiler, replace \c nmake with \c
make in the line above.
- \note Including \c{"-o Makefile"} as an argument to \l qmake to
- tell it where to build the makefile can cause the plugin to be
- built in release mode only. If you are expecting a debug version
- to be built as well, don't use the \c{"-o Makefile"} option.
+ \note Including \c{"-o Makefile"} as an argument to \l qmake, to
+ tell it where to build the makefile, can cause the plugin to be
+ built in release mode only. If you intend to build a debug version
+ as well, don't use the \c{"-o Makefile"} option.
\target QOCI
\section2 QOCI for the Oracle Call Interface (OCI)
@@ -184,7 +184,7 @@
It's possible to connect to a Oracle database without a tnsnames.ora file.
This requires that the database SID is passed to the driver as the database
- name and that a hostname is given.
+ name, and that a hostname is given.
\section3 OCI User Authentication
@@ -230,13 +230,13 @@
\snippet code/doc_src_sql-driver.qdoc 7
\b{Note:} If you are using the Oracle Instant Client package,
- you will need to set LD_LIBRARY_PATH when building the OCI SQL plugin
+ you will need to set LD_LIBRARY_PATH when building the OCI SQL plugin,
and when running an application that uses the OCI SQL plugin. You can
- avoid this requirement by setting and RPATH and listing all of the
+ avoid this requirement by setting RPATH, and listing all of the
libraries to link to. Here is an example:
\snippet code/doc_src_sql-driver.qdoc 32
- If you wish to build the OCI plugin manually with this method the procedure looks like this:
+ If you wish to build the OCI plugin manually with this method, the procedure looks like this:
\snippet code/doc_src_sql-driver.qdoc 33
\section3 How to Build the OCI Plugin on Windows
@@ -254,7 +254,7 @@
If you are not using a Microsoft compiler, replace \c nmake with \c
make in the line above.
- When you run your application you will also need to add the \c oci.dll
+ When you run your application, you will also need to add the \c oci.dll
path to your \c PATH environment variable:
\snippet code/doc_src_sql-driver.qdoc 9
@@ -271,25 +271,25 @@
driver manager that is installed on your system. The QODBC plugin
then allows you to use these data sources in your Qt applications.
- \b{Note:} You should use native drivers in preference to the ODBC
- driver where they are available. ODBC support can be used as a fallback
- for compliant databases if no native drivers are available.
+ \b{Note:} You should use the native driver, if it is available, instead
+ of the ODBC driver. ODBC support can be used as a fallback for compliant
+ databases if no native driver is available.
- On Windows an ODBC driver manager should be installed by default.
- For Unix systems there are some implementations which must be
+ On Windows, an ODBC driver manager should be installed by default.
+ For Unix systems, there are some implementations which must be
installed first. Note that every client that uses your application is
required to have an ODBC driver manager installed, otherwise the
QODBC plugin will not work.
- Be aware that when connecting to an ODBC datasource you must pass in
- the name of the ODBC datasource to the QSqlDatabase::setDatabaseName()
- function rather than the actual database name.
+ When connecting to an ODBC datasource, you should pass the name
+ of the ODBC datasource to the QSqlDatabase::setDatabaseName()
+ function, rather than the actual database name.
The QODBC Plugin needs an ODBC compliant driver manager version 2.0 or
- later to work. Some ODBC drivers claim to be version 2.0 compliant,
+ later. Some ODBC drivers claim to be version-2.0-compliant,
but do not offer all the necessary functionality. The QODBC plugin
therefore checks whether the data source can be used after a
- connection has been established and refuses to work if the check
+ connection has been established, and refuses to work if the check
fails. If you don't like this behavior, you can remove the \c{#define
ODBC_CHECK_DRIVER} line from the file \c{qsql_odbc.cpp}. Do this at
your own risk!
@@ -332,7 +332,7 @@
driver and the DBMS must also support Unicode.
Some driver managers and drivers don't support UNICODE. To use the
- QODBC plugin with such drivers it has to be compiled with the
+ QODBC plugin with such drivers, it has to be compiled with
Q_ODBC_VERSION_2 defined.
For the Oracle 9 ODBC driver (Windows), it is necessary to check
@@ -368,9 +368,9 @@
The QPSQL driver supports version 7.3 and higher of the PostgreSQL server.
We recommend that you use a client library from version 7.3.15, 7.4.13,
- 8.0.8, 8.1.4 or more recent as these versions contain security fixes, and
+ 8.0.8, 8.1.4, or more recent, as these versions contain security fixes, and
as the QPSQL driver might not build with older versions of the client
- library depending on your platform.
+ library, depending on your platform.
For more information about PostgreSQL visit \l http://www.postgresql.org.
diff --git a/src/sql/doc/src/sql-programming.qdoc b/src/sql/doc/src/sql-programming.qdoc
index 39381ff296..ece89a30ab 100644
--- a/src/sql/doc/src/sql-programming.qdoc
+++ b/src/sql/doc/src/sql-programming.qdoc
@@ -227,7 +227,7 @@
Databases, please refer to \l{Data Types for Qt-supported Database
Systems} {this table}.
- You can iterate back and forth using QSqlQuery::next(),
+ You can navigate within the dataset using QSqlQuery::next(),
QSqlQuery::previous(), QSqlQuery::first(), QSqlQuery::last(), and
QSqlQuery::seek(). The current row index is returned by
QSqlQuery::at(), and the total number of rows in the result set
@@ -242,11 +242,10 @@
\snippet sqldatabase/sqldatabase.cpp 33
- If you iterate through a result set only using next() and seek()
- with positive values, you can call
- QSqlQuery::setForwardOnly(true) before calling exec(). This is an
- easy optimization that will speed up the query significantly when
- operating on large result sets.
+ If you navigate within a result set, and use next() and seek()
+ only for browsing forward, you can call QSqlQuery::setForwardOnly(true)
+ before calling exec(). This is an easy optimization that will speed up
+ the query significantly when operating on large result sets.
\section2 Inserting, Updating, and Deleting Records
@@ -592,7 +591,7 @@
QDataWidgetMapper operates on a specific database table, mapping items
in the table on a row-by-row or column-by-column basis. As a result,
- using QDataWidgetMapper with a SQL model is as simple as using it with
+ using QDataWidgetMapper with an SQL model is as simple as using it with
any other table model.
\image qdatawidgetmapper-simple.png
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 94f36c330b..30aadfba92 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -53,6 +53,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
+#include <QtCore/quuid.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
@@ -164,6 +165,11 @@ template<> inline char *toString(const QUrl &uri)
return qstrdup(uri.toEncoded().constData());
}
+template <> inline char *toString(const QUuid &uuid)
+{
+ return qstrdup(uuid.toByteArray().constData());
+}
+
template<> inline char *toString(const QVariant &v)
{
QByteArray vstring("QVariant(");
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 507b5260cd..521dd5f0f2 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -120,7 +120,6 @@ mac {
macx {
OBJECTIVE_SOURCES += \
- ../../corelib/kernel/qcore_foundation.mm \
../../corelib/io/qstandardpaths_mac.mm
} else:unix {
SOURCES += \
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 152c204613..b1a301c7d0 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -19,9 +19,9 @@
"libraries": {
"gtk3": {
- "label": "GTK+",
+ "label": "GTK+ >= 3.6",
"sources": [
- { "type": "pkgConfig", "args": "gtk+-3.0" }
+ { "type": "pkgConfig", "args": "gtk+-3.0 >= 3.6" }
]
}
},
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 1ff4f8e88a..999e551af4 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -719,6 +719,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
}
QImage temp(img.height(), img.width(), img.format());
+ temp.setDevicePixelRatio(img.devicePixelRatioF());
if (transposed >= 0) {
if (img.depth() == 8) {
qt_memrotate270(reinterpret_cast<const quint8*>(img.bits()),
@@ -780,6 +781,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
if (source.format() == QImage::Format_Indexed8 || source.format() == QImage::Format_Grayscale8) {
// assumes grayscale
QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatioF());
const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
int sx = srcImage.bytesPerLine();
@@ -801,6 +803,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
return dest;
} else if (source.format() == QImage::Format_ARGB8565_Premultiplied) {
QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatioF());
const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
int sx = srcImage.bytesPerLine();
@@ -837,6 +840,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
}
QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatioF());
const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits());
int sx = srcImage.bytesPerLine() >> 2;
@@ -881,7 +885,7 @@ Q_WIDGETS_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius,
if (p) {
p->scale(scale, scale);
p->setRenderHint(QPainter::SmoothPixmapTransform);
- p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage);
+ p->drawImage(QRect(QPoint(0, 0), blurImage.size() / blurImage.devicePixelRatioF()), blurImage);
}
}
@@ -1111,6 +1115,7 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q
srcImage = srcImage.convertToFormat(srcImage.hasAlphaChannel() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
destImage = QImage(rect.size(), srcImage.format());
}
+ destImage.setDevicePixelRatio(src.devicePixelRatioF());
// do colorizing
QPainter destPainter(&destImage);
@@ -1315,6 +1320,7 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
return;
QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied);
+ tmp.setDevicePixelRatio(px.devicePixelRatioF());
tmp.fill(0);
QPainter tmpPainter(&tmp);
tmpPainter.setCompositionMode(QPainter::CompositionMode_Source);
@@ -1323,6 +1329,7 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
// blur the alpha channel
QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied);
+ blurred.setDevicePixelRatio(px.devicePixelRatioF());
blurred.fill(0);
QPainter blurPainter(&blurred);
qt_blurImage(&blurPainter, tmp, d->radius, false, true);
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index f2b8b66fed..3ce9c835db 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -2981,6 +2981,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectI
return brect;
#else //QT_NO_GRAPHICSEFFECT
+ Q_UNUSED(topMostEffectItem);
return q_ptr->boundingRect();
#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index e6726285d9..35f6298a8a 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1225,15 +1225,15 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event)
*/
bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
{
+#if QT_CONFIG(gestures)
if (QGraphicsObject *object = item->toGraphicsObject()) {
-#ifndef QT_NO_GESTURES
QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager;
if (gestureManager) {
if (gestureManager->filterEvent(object, event))
return true;
}
-#endif // QT_NO_GESTURES
}
+#endif // QT_CONFIG(gestures)
if (filterEvent(item, event))
return false;
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index eee818b685..1e6fbfd239 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -269,12 +269,13 @@ int QDesktopWidget::screenNumber(const QWidget *w) const
QRect frame = w->frameGeometry();
if (!w->isWindow())
frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
- const QRect nativeFrame = QHighDpi::toNativePixels(frame, winHandle);
QScreen *widgetScreen = Q_NULLPTR;
int largestArea = 0;
foreach (QScreen *screen, screens) {
- const QRect intersected = screen->handle()->geometry().intersected(nativeFrame);
+ const QRect deviceIndependentScreenGeometry =
+ QHighDpi::fromNativePixels(screen->handle()->geometry(), screen);
+ const QRect intersected = deviceIndependentScreenGeometry.intersected(frame);
int area = intersected.width() * intersected.height();
if (largestArea < area) {
widgetScreen = screen;
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f88ed350c7..129c12885a 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -641,21 +641,11 @@ void QLayout::childEvent(QChildEvent *e)
if (!d->enabled)
return;
- if (e->type() == QEvent::ChildRemoved) {
- QChildEvent *c = (QChildEvent*)e;
- int i = 0;
-
- QLayoutItem *item;
- while ((item = itemAt(i))) {
- if (item == static_cast<QLayout*>(c->child())) {
- takeAt(i);
- invalidate();
- break;
- } else {
- ++i;
- }
- }
- }
+ if (e->type() != QEvent::ChildRemoved)
+ return;
+
+ if (QLayout *childLayout = qobject_cast<QLayout *>(e->child()))
+ removeItem(childLayout);
}
/*!
@@ -766,13 +756,10 @@ QSize QLayout::totalMaximumSize() const
QLayout::~QLayout()
{
Q_D(QLayout);
- /*
- This function may be called during the QObject destructor,
- when the parent no longer is a QWidget.
- */
- if (d->topLevel && parent() && parent()->isWidgetType() &&
- ((QWidget*)parent())->layout() == this)
- ((QWidget*)parent())->d_func()->layout = 0;
+ if (d->topLevel && parent() && parent()->isWidgetType() && parentWidget()->layout() == this)
+ parentWidget()->d_func()->layout = 0;
+ else if (QLayout *parentLayout = qobject_cast<QLayout *>(parent()))
+ parentLayout->removeItem(this);
}
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 6cb4e147e9..dba742dec5 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -159,10 +159,11 @@ public:
Q_DECL_RELAXED_CONSTEXPR void setRetainSizeWhenHidden(bool retainSize) Q_DECL_NOTHROW { bits.retainSizeWhenHidden = retainSize; }
Q_DECL_RELAXED_CONSTEXPR void transpose() Q_DECL_NOTHROW { *this = transposed(); }
+ Q_REQUIRED_RESULT
#ifndef Q_QDOC
QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
#endif
- QSizePolicy transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ QSizePolicy transposed() const Q_DECL_NOTHROW
{
return QSizePolicy(bits.transposed());
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index e26e9af2c5..7112e1c783 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -340,10 +340,6 @@ QWidgetPrivate::~QWidgetPrivate()
if (extra)
deleteExtra();
-
-#ifndef QT_NO_GRAPHICSEFFECT
- delete graphicsEffect;
-#endif //QT_NO_GRAPHICSEFFECT
}
/*!
@@ -1717,6 +1713,10 @@ QWidget::~QWidget()
} QT_CATCH(const std::exception&) {
// if this fails we can't do anything about it but at least we are not allowed to throw.
}
+
+#if QT_CONFIG(graphicseffect)
+ delete d->graphicsEffect;
+#endif
}
int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index c874b12e45..123aa351cd 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1956,10 +1956,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
#if QT_CONFIG(spinbox) || QT_CONFIG(slider)
QColor buttonColor = d->buttonColor(option->palette);
+ QColor gradientStopColor = buttonColor;
#endif
#if QT_CONFIG(slider)
QColor gradientStartColor = buttonColor.lighter(118);
- QColor gradientStopColor = buttonColor;
#endif
QColor outline = d->outline(option->palette);
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 7c5ba79cb6..e1c7a4e280 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -533,6 +533,17 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
return nullptr;
#endif
}
+
+ // QTBUG-59957: clear button should be the leftmost action.
+ if (!before && !(flags & SideWidgetClearButton) && position == QLineEdit::TrailingPosition) {
+ for (const SideWidgetEntry &e : trailingSideWidgets) {
+ if (e.flags & SideWidgetClearButton) {
+ before = e.action;
+ break;
+ }
+ }
+ }
+
// If there is a 'before' action, it takes preference
// There's a bug in GHS compiler that causes internal error on the following code.
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index a06b9b404f..8498835a34 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -84,18 +84,38 @@ class QTornOffMenu : public QMenu
Q_OBJECT
class QTornOffMenuPrivate : public QMenuPrivate
{
- Q_DECLARE_PUBLIC(QMenu)
+ Q_DECLARE_PUBLIC(QTornOffMenu)
public:
- QTornOffMenuPrivate(QMenu *p) : causedMenu(p) {
+ QTornOffMenuPrivate(QMenu *p) : causedMenu(p), initialized(false) {
tornoff = 1;
causedPopup.widget = 0;
- causedPopup.action = ((QTornOffMenu*)p)->d_func()->causedPopup.action;
- causedStack = ((QTornOffMenu*)p)->d_func()->calcCausedStack();
+ causedPopup.action = p->d_func()->causedPopup.action;
+ causedStack = p->d_func()->calcCausedStack();
+ }
+
+ void setMenuSize(const QSize &menuSize) {
+ Q_Q(QTornOffMenu);
+ QSize size = menuSize;
+ const QPoint p = (!initialized) ? causedMenu->pos() : q->pos();
+ QRect screen = popupGeometry(QApplication::desktop()->screenNumber(p));
+ const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q);
+ const int titleBarHeight = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, q);
+ if (scroll && (size.height() > screen.height() - titleBarHeight || size.width() > screen.width())) {
+ const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
+ const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuHMargin, 0, q);
+ scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown);
+ size.setWidth(qMin(actionRects.at(getLastVisibleAction()).right() + fw + hmargin + rightmargin + 1, screen.width()));
+ size.setHeight(screen.height() - desktopFrame * 2 - titleBarHeight);
+ }
+ q->setFixedSize(size);
}
+
QVector<QPointer<QWidget> > calcCausedStack() const Q_DECL_OVERRIDE { return causedStack; }
QPointer<QMenu> causedMenu;
QVector<QPointer<QWidget> > causedStack;
+ bool initialized;
};
+
public:
QTornOffMenu(QMenu *p) : QMenu(*(new QTornOffMenuPrivate(p)))
{
@@ -109,11 +129,22 @@ public:
setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
setWindowTitle(p->windowTitle());
setEnabled(p->isEnabled());
+#if QT_CONFIG(cssparser)
+ setStyleSheet(p->styleSheet());
+#endif
+ if (style() != p->style())
+ setStyle(p->style());
+ int leftMargin, topMargin, rightMargin, bottomMargin;
+ p->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
+ setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);
+ setLayoutDirection(p->layoutDirection());
//QObject::connect(this, SIGNAL(triggered(QAction*)), this, SLOT(onTrigger(QAction*)));
//QObject::connect(this, SIGNAL(hovered(QAction*)), this, SLOT(onHovered(QAction*)));
QList<QAction*> items = p->actions();
for(int i = 0; i < items.count(); i++)
addAction(items.at(i));
+ d->setMenuSize(sizeHint());
+ d->initialized = true;
}
void syncWithMenu(QMenu *menu, QActionEvent *act)
{
@@ -127,12 +158,17 @@ public:
}
void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE
{
+ Q_D(QTornOffMenu);
QMenu::actionEvent(e);
- setFixedSize(sizeHint());
+ if (d->initialized) {
+ d->setMenuSize(sizeHint());
+ }
}
+
public slots:
void onTrigger(QAction *action) { d_func()->activateAction(action, QAction::Trigger, false); }
void onHovered(QAction *action) { d_func()->activateAction(action, QAction::Hover, false); }
+
private:
Q_DECLARE_PRIVATE(QTornOffMenu)
friend class QMenuPrivate;
@@ -267,9 +303,6 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
int lastVisibleAction = getLastVisibleAction();
- int max_column_width = 0,
- dh = screen.height(),
- y = 0;
QStyle *style = q->style();
QStyleOption opt;
opt.init(q);
@@ -279,6 +312,10 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q);
const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q);
const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0;
+ const int base_y = vmargin + fw + topmargin + (scroll ? scroll->scrollOffset : 0) + tearoffHeight;
+ int max_column_width = 0;
+ int dh = screen.height();
+ int y = base_y;
//for compatibility now - will have to refactor this away
tabWidth = 0;
@@ -356,25 +393,25 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
max_column_width = qMax(max_column_width, sz.width());
//wrapping
if (!scroll &&
- y+sz.height()+vmargin > dh - (deskFw * 2)) {
+ y + sz.height() + vmargin + bottommargin + fw > dh - (deskFw * 2)) {
ncols++;
- y = vmargin;
+ y = base_y;
+ } else {
+ y += sz.height();
}
- y += sz.height();
//update the item
actionRects[i] = QRect(0, 0, sz.width(), sz.height());
}
}
max_column_width += tabWidth; //finally add in the tab width
- const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();
- const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));
- max_column_width = qMax(min_column_width, max_column_width);
+ if (!tornoff || (tornoff && scroll)) { // exclude non-scrollable tear-off menu since the tear-off menu has a fixed size
+ const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();
+ const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));
+ max_column_width = qMax(min_column_width, max_column_width);
+ }
//calculate position
- const int base_y = vmargin + fw + topmargin +
- (scroll ? scroll->scrollOffset : 0) +
- tearoffHeight;
int x = hmargin + fw + leftmargin;
y = base_y;
@@ -383,7 +420,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
if (rect.isNull())
continue;
if (!scroll &&
- y+rect.height() > dh - deskFw * 2) {
+ y + rect.height() + vmargin + bottommargin + fw > dh - deskFw * 2) {
x += max_column_width + hmargin;
y = base_y;
}
@@ -632,6 +669,7 @@ void QMenuSloppyState::reset()
m_enabled = false;
m_first_mouse = true;
m_init_guard = false;
+ m_use_reset_action = true;
m_uni_dir_discarded_count = 0;
m_time.stop();
m_reset_action = Q_NULLPTR;
@@ -684,6 +722,7 @@ void QMenuSloppyState::setSubMenuPopup(const QRect &actionRect, QAction *resetAc
{
m_enabled = true;
m_init_guard = true;
+ m_use_reset_action = true;
m_time.stop();
m_action_rect = actionRect;
m_sub_menu = subMenu;
@@ -744,10 +783,12 @@ void QMenuSloppyState::timeout()
if (m_sub_menu)
menu_priv->hideMenu(m_sub_menu);
- if (reallyHasMouse)
- menu_priv->setCurrentAction(m_reset_action,0);
- else
+ if (reallyHasMouse) {
+ if (m_use_reset_action)
+ menu_priv->setCurrentAction(m_reset_action, 0);
+ } else {
menu_priv->setCurrentAction(Q_NULLPTR, 0);
+ }
}
//return the top causedPopup.widget that is not a QMenu
@@ -761,7 +802,7 @@ QWidget *QMenuPrivate::topCausedWidget() const
QAction *QMenuPrivate::actionAt(QPoint p) const
{
- if (!q_func()->rect().contains(p)) //sanity check
+ if (!rect().contains(p)) //sanity check
return 0;
for(int i = 0; i < actionRects.count(); i++) {
@@ -855,6 +896,19 @@ void QMenuPrivate::drawTearOff(QPainter *painter, const QRect &rect)
q->style()->drawControl(QStyle::CE_MenuTearoff, &menuOpt, painter, q);
}
+QRect QMenuPrivate::rect() const
+{
+ Q_Q(const QMenu);
+ QStyle *style = q->style();
+ QStyleOption opt(0);
+ opt.init(q);
+ const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, &opt, q);
+ const int vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, &opt, q);
+ const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q);
+ return (q->rect().adjusted(hmargin + fw + leftmargin, vmargin + fw + topmargin,
+ -(hmargin + fw + rightmargin), -(vmargin + fw + bottommargin)));
+}
+
QMenuPrivate::ScrollerTearOffItem::ScrollerTearOffItem(QMenuPrivate::ScrollerTearOffItem::Type type, QMenuPrivate *mPrivate, QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f), menuPrivate(mPrivate), scrollType(type)
{
@@ -989,7 +1043,9 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
}
if (!(newScrollFlags & QMenuScroller::ScrollDown) && (scroll->scrollFlags & QMenuScroller::ScrollDown)) {
- newOffset = q->height() - (saccum - newOffset) - fw*2 - vmargin; //last item at bottom
+ newOffset = q->height() - (saccum - newOffset) - fw*2 - vmargin - topmargin - bottommargin; //last item at bottom
+ if (tearoff)
+ newOffset -= q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q);
}
if (!(newScrollFlags & QMenuScroller::ScrollUp) && (scroll->scrollFlags & QMenuScroller::ScrollUp)) {
@@ -1141,15 +1197,23 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
{
Q_Q(QMenu);
QPoint pos = q->mapFromGlobal(e->globalPos());
+
+ QStyle *style = q->style();
+ QStyleOption opt(0);
+ opt.init(q);
+ const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, &opt, q);
+ const int vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, &opt, q);
+ const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q);
+
if (scroll && !activeMenu) { //let the scroller "steal" the event
bool isScroll = false;
if (pos.x() >= 0 && pos.x() < q->width()) {
- for(int dir = QMenuScroller::ScrollUp; dir <= QMenuScroller::ScrollDown; dir = dir << 1) {
+ for (int dir = QMenuScroller::ScrollUp; dir <= QMenuScroller::ScrollDown; dir = dir << 1) {
if (scroll->scrollFlags & dir) {
if (dir == QMenuScroller::ScrollUp)
- isScroll = (pos.y() <= scrollerHeight());
+ isScroll = (pos.y() <= scrollerHeight() + fw + vmargin + topmargin);
else if (dir == QMenuScroller::ScrollDown)
- isScroll = (pos.y() >= q->height() - scrollerHeight());
+ isScroll = (pos.y() >= q->height() - scrollerHeight() - fw - vmargin - bottommargin);
if (isScroll) {
scroll->scrollDirection = dir;
break;
@@ -1166,7 +1230,8 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
}
if (tearoff) { //let the tear off thingie "steal" the event..
- QRect tearRect(0, 0, q->width(), q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q));
+ QRect tearRect(leftmargin + hmargin + fw, topmargin + vmargin + fw, q->width() - fw * 2 - hmargin * 2 -leftmargin - rightmargin,
+ q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q));
if (scroll && scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
tearRect.translate(0, scrollerHeight());
q->update(tearRect);
@@ -2615,21 +2680,28 @@ void QMenu::paintEvent(QPaintEvent *e)
//calculate the scroll up / down rect
const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
+ const int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin,0, this);
+ const int vmargin = style()->pixelMetric(QStyle::PM_MenuVMargin, 0, this);
+
QRect scrollUpRect, scrollDownRect;
+ const int leftmargin = fw + hmargin + d->leftmargin;
+ const int topmargin = fw + vmargin + d->topmargin;
+ const int bottommargin = fw + vmargin + d->bottommargin;
+ const int contentWidth = width() - (fw + hmargin) * 2 - d->leftmargin - d->rightmargin;
if (d->scroll) {
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
- scrollUpRect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight());
+ scrollUpRect.setRect(leftmargin, topmargin, contentWidth, d->scrollerHeight());
if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)
- scrollDownRect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2),
- d->scrollerHeight());
+ scrollDownRect.setRect(leftmargin, height() - d->scrollerHeight() - bottommargin,
+ contentWidth, d->scrollerHeight());
}
//calculate the tear off rect
QRect tearOffRect;
if (d->tearoff) {
- tearOffRect.setRect(fw, fw, width() - (fw * 2),
- style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
+ tearOffRect.setRect(leftmargin, topmargin, contentWidth,
+ style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
tearOffRect.translate(0, d->scrollerHeight());
}
@@ -2646,6 +2718,12 @@ void QMenu::paintEvent(QPaintEvent *e)
emptyArea -= QRegion(actionRect);
QRect adjustedActionRect = actionRect;
+ if (!scrollUpTearOffRect.isEmpty() && adjustedActionRect.bottom() <= scrollUpTearOffRect.top())
+ continue;
+
+ if (!scrollDownRect.isEmpty() && adjustedActionRect.top() >= scrollDownRect.bottom())
+ continue;
+
if (adjustedActionRect.intersects(scrollUpTearOffRect)) {
if (adjustedActionRect.bottom() <= scrollUpTearOffRect.bottom())
continue;
@@ -3476,7 +3554,6 @@ void QMenu::actionEvent(QActionEvent *e)
}
if (isVisible()) {
- d->updateActionRects();
resize(sizeHint());
update();
}
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 898fa3161b..2f04fac3c0 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -95,6 +95,7 @@ public:
, m_select_other_actions(false)
, m_first_mouse(true)
, m_init_guard(false)
+ , m_use_reset_action(true)
, m_uni_dir_discarded_count(0)
, m_uni_dir_fail_at_count(0)
, m_timeout(0)
@@ -182,9 +183,17 @@ public:
QSetValueOnDestroy<bool> setFirstMouse(m_first_mouse, false);
QSetValueOnDestroy<QPointF> setPreviousPoint(m_previous_point, mousePos);
- if (resetAction && resetAction->isSeparator())
+ if (resetAction && resetAction->isSeparator()) {
m_reset_action = Q_NULLPTR;
- else {
+ m_use_reset_action = true;
+ } else if (m_reset_action != resetAction) {
+ if (m_use_reset_action && resetAction) {
+ const QList<QAction *> actions = m_menu->actions();
+ const int resetIdx = actions.indexOf(resetAction);
+ const int originIdx = actions.indexOf(m_origin_action);
+ if (resetIdx > -1 && originIdx > -1 && qAbs(resetIdx - originIdx) > 1)
+ m_use_reset_action = false;
+ }
m_reset_action = resetAction;
}
@@ -249,6 +258,7 @@ private:
bool m_init_guard;
bool m_discard_state_when_entering_parent;
bool m_dont_start_time_on_leave;
+ bool m_use_reset_action;
short m_uni_dir_discarded_count;
short m_uni_dir_fail_at_count;
short m_timeout;
@@ -463,6 +473,7 @@ public:
void drawScroller(QPainter *painter, ScrollerTearOffItem::Type type, const QRect &rect);
void drawTearOff(QPainter *painter, const QRect &rect);
+ QRect rect() const;
};
#endif // QT_NO_MENU
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index e92347c65c..1676c188a6 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1145,6 +1145,10 @@ void QSplitter::insertWidget(int index, QWidget *widget)
\note The splitter takes ownership of \a widget and sets the parent of the
replaced widget to null.
+ \note Because \a widget gets \l{QWidget::setParent()}{reparented} into the splitter,
+ its \l{QWidget::}{geometry} may not be set right away, but only after \a widget will
+ receive the appropriate events.
+
\sa insertWidget(), indexOf()
*/
QWidget *QSplitter::replaceWidget(int index, QWidget *widget)
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 66bf2919eb..1abc9bef8e 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -2578,6 +2578,8 @@ void QTextEdit::setText(const QString &text)
if (format == Qt::RichText)
setHtml(text);
else
+#else
+ Q_UNUSED(format);
#endif
setPlainText(text);
}
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 0d34fae78f..116855c8d3 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -3119,6 +3119,7 @@ void QWidgetTextControlPrivate::append(const QString &text, Qt::TextFormat forma
tmp.insertText(text);
}
#else
+ Q_UNUSED(format);
tmp.insertText(text);
#endif // QT_NO_TEXTHTMLPARSER
if (!cursor.hasSelection())