summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/common/pch/pch.pro1
-rw-r--r--qmake/generators/makefile.cpp2
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/makefiledeps.h4
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h8
-rw-r--r--qmake/library/qmakebuiltins.cpp2
-rw-r--r--qmake/library/qmakeevaluator.cpp6
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp2
-rw-r--r--src/corelib/codecs/qiconvcodec_p.h6
-rw-r--r--src/corelib/codecs/qjiscodec.cpp2
-rw-r--r--src/corelib/global/qcompilerdetection.h12
-rw-r--r--src/corelib/global/qglobal.cpp14
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h6
-rw-r--r--src/corelib/io/qipaddress_p.h6
-rw-r--r--src/corelib/io/qsettings.cpp2
-rw-r--r--src/corelib/io/qsettings_win.cpp2
-rw-r--r--src/corelib/json/qjson.cpp4
-rw-r--r--src/corelib/kernel/qfunctions_fake_env_p.h6
-rw-r--r--src/corelib/kernel/qmetatype.h7
-rw-r--r--src/corelib/kernel/qmimedata.cpp4
-rw-r--r--src/corelib/kernel/qsystemerror.cpp3
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp3
-rw-r--r--src/corelib/kernel/qtranslator.cpp3
-rw-r--r--src/corelib/kernel/qvariant.cpp6
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp26
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h64
-rw-r--r--src/corelib/thread/qmutexpool_p.h4
-rw-r--r--src/corelib/tools/qdatetime.cpp2
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp11
-rw-r--r--src/corelib/tools/qlinkedlist.h16
-rw-r--r--src/corelib/tools/qregexp.cpp6
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h48
-rw-r--r--src/corelib/tools/qunicodetools.cpp4
-rw-r--r--src/corelib/xml/qxmlstream.cpp24
-rw-r--r--src/corelib/xml/qxmlstream_p.h14
-rw-r--r--src/dbus/qdbusmarshaller.cpp8
-rw-r--r--src/dbus/qdbusmetatype.cpp2
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp6
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qpaintengine_pic_p.h7
-rw-r--r--src/gui/image/qpixmap_blitter.cpp4
-rw-r--r--src/gui/image/qpnghandler_p.h6
-rw-r--r--src/gui/image/qppmhandler_p.h6
-rw-r--r--src/gui/image/qxbmhandler_p.h6
-rw-r--r--src/gui/image/qxpmhandler_p.h6
-rw-r--r--src/gui/kernel/qdnd.cpp35
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp4
-rw-r--r--src/gui/opengl/opengl.pri5
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h6
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp9
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h6
-rw-r--r--src/gui/painting/painting.pri5
-rw-r--r--src/gui/painting/qcolor_p.cpp12
-rw-r--r--src/gui/painting/qcolor_p.h1
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp144
-rw-r--r--src/gui/painting/qpathclipper.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp4
-rw-r--r--src/gui/painting/qrbtree_p.h (renamed from src/gui/opengl/qrbtree_p.h)0
-rw-r--r--src/gui/painting/qtransform.cpp12
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp (renamed from src/gui/opengl/qtriangulatingstroker.cpp)0
-rw-r--r--src/gui/painting/qtriangulatingstroker_p.h (renamed from src/gui/opengl/qtriangulatingstroker_p.h)0
-rw-r--r--src/gui/painting/qtriangulator.cpp (renamed from src/gui/opengl/qtriangulator.cpp)17
-rw-r--r--src/gui/painting/qtriangulator_p.h (renamed from src/gui/opengl/qtriangulator_p.h)0
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qcssparser_p.h6
-rw-r--r--src/gui/text/qfont.cpp16
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp15
-rw-r--r--src/gui/text/qfontengine.cpp15
-rw-r--r--src/gui/text/qfontengine_ft.cpp55
-rw-r--r--src/gui/text/qfontengine_ft_p.h1
-rw-r--r--src/gui/text/qfontengine_p.h4
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp5
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h1
-rw-r--r--src/gui/text/qfontmetrics.cpp36
-rw-r--r--src/gui/text/qfontmetrics.h2
-rw-r--r--src/gui/text/qfontsubset.cpp4
-rw-r--r--src/gui/text/qrawfont.cpp17
-rw-r--r--src/gui/text/qrawfont.h1
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextdocument_p.cpp10
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp18
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtextodfwriter_p.h6
-rw-r--r--src/network/access/qftp.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp3
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp7
-rw-r--r--src/network/access/qnetworkcookie.cpp2
-rw-r--r--src/network/kernel/qhostaddress.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface_p.h6
-rw-r--r--src/network/kernel/qnetworkproxy_p.h7
-rw-r--r--src/network/socket/qnativesocketengine_p.h6
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp2
-rw-r--r--src/network/socket/qsctpsocket.cpp2
-rw-r--r--src/network/socket/qsocks5socketengine.cpp4
-rw-r--r--src/network/socket/qtcpserver_p.h6
-rw-r--r--src/network/socket/qtcpsocket_p.h6
-rw-r--r--src/network/ssl/qasn1element_p.h6
-rw-r--r--src/network/ssl/qsslcertificate_p.h6
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h6
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h6
-rw-r--r--src/network/ssl/qsslsocket_p.h6
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h6
-rw-r--r--src/opengl/qglframebufferobject_p.h6
-rw-r--r--src/opengl/qglpixelbuffer_p.h6
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h6
-rw-r--r--src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h6
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm15
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h1
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h6
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h6
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp4
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp57
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro1
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp2
-rw-r--r--src/testlib/qtestcase.qdoc4
-rw-r--r--src/testlib/qtestmouse.h4
-rw-r--r--src/tools/moc/moc.cpp2
-rw-r--r--src/tools/moc/preprocessor.cpp10
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp8
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp3
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp4
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/styles/qcommonstyle.cpp6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp5
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp14
-rw-r--r--src/widgets/util/qflickgesture.cpp10
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h6
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp2
-rw-r--r--src/widgets/widgets/qabstractslider.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
-rw-r--r--src/widgets/widgets/qmenu.cpp3
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h6
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp26
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp6
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
-rw-r--r--tests/auto/gui/text/qfontcache/tst_qfontcache.cpp2
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp20
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc1
-rw-r--r--tests/auto/gui/text/qrawfont/testfont_os2_v1.ttfbin0 -> 72960 bytes
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp30
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp48
179 files changed, 844 insertions, 637 deletions
diff --git a/config.tests/common/pch/pch.pro b/config.tests/common/pch/pch.pro
index a6f842dff0..f6384b71e1 100644
--- a/config.tests/common/pch/pch.pro
+++ b/config.tests/common/pch/pch.pro
@@ -1,3 +1,4 @@
CONFIG += precompile_header
+PRECOMPILED_DIR = .pch
PRECOMPILED_HEADER = header.h
SOURCES = source.cpp
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 0d1831d987..11b1c8329d 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -612,7 +612,7 @@ MakefileGenerator::init()
int x;
//build up a list of compilers
- QList<Compiler> compilers;
+ QVector<Compiler> compilers;
{
const char *builtins[] = { "OBJECTS", "SOURCES", "PRECOMPILED_HEADER", 0 };
for(x = 0; builtins[x]; ++x) {
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index a67a0ec0fc..86fec748eb 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -155,6 +155,8 @@ protected:
};
uint flags, type;
};
+ friend class QTypeInfo<Compiler>;
+
void initCompiler(const Compiler &comp);
enum VPATHFlag {
VPATH_NoFlag = 0x00,
@@ -264,6 +266,7 @@ public:
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
QString shellQuote(const QString &str);
};
+Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(MakefileGenerator::FileFixifyTypes)
inline void MakefileGenerator::setNoIO(bool o)
diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h
index 3b0c6ce803..034197fd31 100644
--- a/qmake/generators/makefiledeps.h
+++ b/qmake/generators/makefiledeps.h
@@ -41,10 +41,10 @@ struct SourceDependChildren;
class SourceFiles;
class QMakeLocalFileName {
- uint is_null : 1;
+ bool is_null;
mutable QString real_name, local_name;
public:
- QMakeLocalFileName() : is_null(1) { }
+ QMakeLocalFileName() : is_null(true) {}
QMakeLocalFileName(const QString &);
bool isNull() const { return is_null; }
inline const QString &real() const { return real_name; }
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index dfbfaacfa8..0f3665eba8 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -860,7 +860,6 @@ class VCConfiguration
public:
// Functions
VCConfiguration();
- ~VCConfiguration(){}
bool suppressUnknownOptionWarnings;
DotNET CompilerVersion;
@@ -936,7 +935,6 @@ class VCFilter
public:
// Functions
VCFilter();
- ~VCFilter(){}
void addFile(const QString& filename);
void addFile(const VCFilterFile& fileInfo);
@@ -962,7 +960,7 @@ public:
VCCLCompilerTool CompilerTool;
};
-typedef QList<VCFilter> VCFilterList;
+typedef QVector<VCFilter> VCFilterList;
class VCProjectSingleConfig
{
public:
@@ -976,9 +974,6 @@ public:
Resources,
Extras
};
- // Functions
- VCProjectSingleConfig(){}
- ~VCProjectSingleConfig(){}
// Variables
QString Name;
@@ -1009,6 +1004,7 @@ public:
const VCFilter &filterByName(const QString &name) const;
const VCFilter &filterForExtraCompiler(const QString &compilerName) const;
};
+Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_MOVABLE_TYPE);
// Tree & Flat view of files --------------------------------------------------
class VCFilter;
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 0cc3b52458..ba621c1c72 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -321,7 +321,7 @@ QMakeEvaluator::quoteValue(const ProString &val)
break;
case 32:
quote = true;
- // fallthrough
+ Q_FALLTHROUGH();
default:
ret += c;
break;
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 9d7ed2099b..789d6d77f0 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -318,7 +318,7 @@ ProStringList QMakeEvaluator::split_value_list(const QStringRef &vals, const Pro
--x;
}
}
- // fallthrough
+ Q_FALLTHROUGH();
default:
hadWord = true;
break;
@@ -1643,7 +1643,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::expandVariableReferences(
tokPtr++;
continue;
}
- // fallthrough
+ Q_FALLTHROUGH();
default:
Q_ASSERT_X(false, "expandVariableReferences", "Unrecognized token");
break;
@@ -2109,7 +2109,7 @@ QString QMakeEvaluator::formatValue(const ProString &val, bool forceQuote)
break;
case 32:
quote = true;
- // fallthrough
+ Q_FALLTHROUGH();
default:
ret += c;
break;
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 240e5100b9..31c2cd08e8 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 752a7c5359..069ba8e51a 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index 5e189f4ced..cfb1f247e0 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index edcae7db2a..1b07e1330a 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index c75933dff8..37318a5339 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 96f1ee16ac..845155dce0 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -411,7 +411,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
switch (errno) {
case EILSEQ:
++invalidCount;
- // fall through
+ Q_FALLTHROUGH();
case EINVAL:
{
inBytes += sizeof(QChar);
diff --git a/src/corelib/codecs/qiconvcodec_p.h b/src/corelib/codecs/qiconvcodec_p.h
index dd078fdda4..238351bc81 100644
--- a/src/corelib/codecs/qiconvcodec_p.h
+++ b/src/corelib/codecs/qiconvcodec_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/codecs/qjiscodec.cpp b/src/corelib/codecs/qjiscodec.cpp
index 9c628c6012..a8625db054 100644
--- a/src/corelib/codecs/qjiscodec.cpp
+++ b/src/corelib/codecs/qjiscodec.cpp
@@ -288,7 +288,7 @@ QString QJisCodec::convertToUnicode(const char* chars, int len, ConverterState *
result += QLatin1Char(ch);
break;
}
- /* fall through */
+ Q_FALLTHROUGH();
case JISX0201_Latin:
u = conv->jisx0201ToUnicode(ch);
result += QValidChar(u);
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 70c9e97c13..085e3063b4 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1341,6 +1341,18 @@
Q_ASSUME_IMPL(valueOfExpression);\
} while (0)
+#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
+# define Q_FALLTHROUGH() [[fallthrough]]
+#elif defined(__cplusplus)
+/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
+# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
+# define Q_FALLTHROUGH() [[clang::fallthrough]]
+# endif
+#endif
+#ifndef Q_FALLTHROUGH
+# define Q_FALLTHROUGH() (void)0
+#endif
+
/*
Sanitize compiler feature availability
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 71cf1da20a..284e833f73 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2957,6 +2957,20 @@ QString QSysInfo::machineHostName()
*/
/*!
+ \macro void Q_FALLTHROUGH()
+ \relates <QtGlobal>
+ \since 5.8
+
+ Can be used in switch statements at the end of case block to tell the compiler
+ and other developers that that the lack of a break statement is intentional.
+
+ This is useful since a missing break statement is often a bug, and some
+ compilers can be configured to emit warnings when one is not found.
+
+ \sa Q_UNREACHABLE()
+*/
+
+/*!
\macro void Q_CHECK_PTR(void *pointer)
\relates <QtGlobal>
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index abf346a717..cdb64d08e1 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -349,7 +349,7 @@ static QString readSymLink(const QFileSystemEntry &link)
if (matchVolName.indexIn(result) == 0) {
DWORD len;
wchar_t buffer[MAX_PATH];
- QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
+ const QString volumeName = QLatin1String("\\\\?\\") + result.leftRef(matchVolName.matchedLength());
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
}
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index 5281d64d63..dc4e5bf38b 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index 57a5abba4f..777d62dc8a 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
index 27910a0543..9d4b6d1fe6 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h
+++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index 1ceda492ef..6c64411f92 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index 9101f73c16..6dff08ac05 100644
--- a/src/corelib/io/qfilesystemwatcher_polling_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 83f3831c5c..e8f5c49dec 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qipaddress_p.h b/src/corelib/io/qipaddress_p.h
index 5a478ae27b..d95cccb3bd 100644
--- a/src/corelib/io/qipaddress_p.h
+++ b/src/corelib/io/qipaddress_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience of
-// qurl*.cpp This header file may change from version to version without
-// notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index a7aa13fa45..ffcb2e2d72 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -813,7 +813,7 @@ StNormal:
++i;
goto StSkipSpaces;
}
- // fallthrough
+ Q_FALLTHROUGH();
default: {
int j = i + 1;
while (j < to) {
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 7c6b782acd..3f06ab7043 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -742,7 +742,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
}
case QVariant::ByteArray:
- // fallthrough intended
+ Q_FALLTHROUGH();
default: {
// If the string does not contain '\0', we can use REG_SZ, the native registry
diff --git a/src/corelib/json/qjson.cpp b/src/corelib/json/qjson.cpp
index 4b98ef076c..e9a1366af0 100644
--- a/src/corelib/json/qjson.cpp
+++ b/src/corelib/json/qjson.cpp
@@ -339,7 +339,7 @@ bool Value::isValid(const Base *b) const
case QJsonValue::Double:
if (latinOrIntValue)
break;
- // fall through
+ Q_FALLTHROUGH();
case QJsonValue::String:
case QJsonValue::Array:
case QJsonValue::Object:
@@ -418,7 +418,7 @@ uint Value::valueToStore(const QJsonValue &v, uint offset)
if (c != INT_MAX)
return c;
}
- // fall through
+ Q_FALLTHROUGH();
case QJsonValue::String:
case QJsonValue::Array:
case QJsonValue::Object:
diff --git a/src/corelib/kernel/qfunctions_fake_env_p.h b/src/corelib/kernel/qfunctions_fake_env_p.h
index 31d8bd2f26..16d18c4d88 100644
--- a/src/corelib/kernel/qfunctions_fake_env_p.h
+++ b/src/corelib/kernel/qfunctions_fake_env_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 9abeefa8d8..9e2a5bf75d 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1622,16 +1622,9 @@ namespace QtPrivate {
{ return -1; }
};
-#ifndef Q_COMPILER_VARIADIC_TEMPLATES
// Function pointers don't derive from QObject
- template <class Result> struct IsPointerToTypeDerivedFromQObject<Result(*)()> { enum { Value = false }; };
- template <class Result, class Arg0> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0)> { enum { Value = false }; };
- template <class Result, class Arg0, class Arg1> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1)> { enum { Value = false }; };
- template <class Result, class Arg0, class Arg1, class Arg2> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1, Arg2)> { enum { Value = false }; };
-#else
template <typename Result, typename... Args>
struct IsPointerToTypeDerivedFromQObject<Result(*)(Args...)> { enum { Value = false }; };
-#endif
template<typename T>
struct QMetaTypeTypeFlags
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 84e680dbd9..a550ca6ca1 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -122,7 +122,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
const QList<QVariant> list = data.toList();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).type() == QVariant::Url) {
- text.append(list.at(i).toUrl().toDisplayString() + QLatin1Char('\n'));
+ text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n');
++numUrls;
}
}
@@ -167,7 +167,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
case QVariant::List: {
if (format != QLatin1String("text/uri-list"))
break;
- // fall through
+ Q_FALLTHROUGH();
}
case QVariant::Url: {
QByteArray ba = data.toByteArray();
diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp
index f38daec4f8..3899f24d3b 100644
--- a/src/corelib/kernel/qsystemerror.cpp
+++ b/src/corelib/kernel/qsystemerror.cpp
@@ -149,12 +149,13 @@ QString QSystemError::toString() const
return windowsErrorString(errorCode);
#else
//unix: fall through as native and standard library are the same
+ Q_FALLTHROUGH();
#endif
case StandardLibraryError:
return standardLibraryErrorString(errorCode);
default:
qWarning("invalid error scope");
- //fall through
+ Q_FALLTHROUGH();
case NoError:
return QLatin1String("No error");
}
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 56337bdb45..c3b8c86063 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -468,7 +468,6 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
// above 20 s, 5% inaccuracy is above 1 s, so we convert to VeryCoarseTimer
if (interval >= 20000) {
t->timerType = Qt::VeryCoarseTimer;
- // fall through
} else {
t->timeout = expected;
if (interval <= 20) {
@@ -479,7 +478,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
}
break;
}
- // fall through
+ Q_FALLTHROUGH();
case Qt::VeryCoarseTimer:
// the very coarse timer is based on full second precision,
// so we keep the interval in seconds (round to closest second)
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index e016773bde..04a5e7ed7a 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -489,8 +489,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
const QString suffixOrDotQM = suffix.isNull() ? dotQmLiteral() : suffix;
QStringRef fname(&filename);
QString realname;
- QString delims;
- delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
+ const QString delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
for (;;) {
QFileInfo fi;
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index a8cc1095fe..72ae3b063f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -203,7 +203,7 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok)
case QMetaType::QJsonValue:
if (!v_cast<QJsonValue>(d)->isDouble())
break;
- // no break
+ Q_FALLTHROUGH();
#endif
case QVariant::Double:
case QVariant::Int:
@@ -278,7 +278,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
case QMetaType::QJsonValue:
if (!v_cast<QJsonValue>(d)->isDouble())
break;
- // no break
+ Q_FALLTHROUGH();
#endif
case QVariant::Double:
case QVariant::Int:
@@ -3119,7 +3119,7 @@ bool QVariant::canConvert(int targetTypeId) const
case QVariant::Int:
if (currentType == QVariant::KeySequence)
return true;
- // fall through
+ Q_FALLTHROUGH();
case QVariant::UInt:
case QVariant::LongLong:
case QVariant::ULongLong:
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index e72f9a30d0..e25eb4272d 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -217,22 +217,24 @@ bool QMimeBinaryProvider::isValid()
bool QMimeBinaryProvider::CacheFileList::checkCacheChanged()
{
bool somethingChanged = false;
- QMutableListIterator<CacheFile *> it(*this);
- while (it.hasNext()) {
- CacheFile *cacheFile = it.next();
+ for (CacheFile *cacheFile : qAsConst(*this)) {
QFileInfo fileInfo(cacheFile->file);
- if (!fileInfo.exists()) { // This can't happen by just running update-mime-database. But the user could use rm -rf :-)
- delete cacheFile;
- it.remove();
- somethingChanged = true;
- } else if (fileInfo.lastModified() > cacheFile->m_mtime) {
- if (!cacheFile->reload()) {
- delete cacheFile;
- it.remove();
- }
+ if (!fileInfo.exists() || fileInfo.lastModified() > cacheFile->m_mtime) {
+ // Deletion can't happen by just running update-mime-database.
+ // But the user could use rm -rf :-)
+ cacheFile->reload(); // will mark itself as invalid on failure
somethingChanged = true;
}
}
+ if (somethingChanged) {
+ auto deleteIfNoLongerValid = [](CacheFile *cacheFile) -> bool {
+ const bool invalid = !cacheFile->isValid();
+ if (invalid)
+ delete cacheFile;
+ return invalid;
+ };
+ erase(std::remove_if(begin(), end(), deleteIfNoLongerValid), end());
+ }
return somethingChanged;
}
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 6f62da484b..0876d141c4 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -91,8 +91,6 @@ public:
QObject *instance(int index) const;
};
-#ifdef Q_COMPILER_VARIADIC_TEMPLATES
-
template <class PluginInterface, class FactoryInterface, typename ...Args>
PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, Args &&...args)
{
@@ -106,68 +104,6 @@ PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, A
return nullptr;
}
-#else
-
-template <class PluginInterface, class FactoryInterface>
- PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1)))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1, class P2>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1, P2 &&p2)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2)))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1, class P2, class P3>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1, P2 &&p2, P3 &&p3)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2), std::forward<P3>(p3)))
- return result;
- }
- return 0;
-}
-
-#endif
-
template <class PluginInterface, class FactoryInterface, typename Arg>
Q_DECL_DEPRECATED PluginInterface *qLoadPlugin1(const QFactoryLoader *loader, const QString &key, Arg &&arg)
{ return qLoadPlugin<PluginInterface, FactoryInterface>(loader, key, std::forward<Arg>(arg)); }
diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h
index b6c837e9f9..58d853b0e3 100644
--- a/src/corelib/thread/qmutexpool_p.h
+++ b/src/corelib/thread/qmutexpool_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QSettings. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index ee5ee5c362..a2c92835fe 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2656,7 +2656,7 @@ static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds)
case Qt::TimeZone:
// Use system time zone instead
spec = Qt::LocalTime;
- // fallthrough
+ Q_FALLTHROUGH();
case Qt::UTC:
case Qt::LocalTime:
offsetSeconds = 0;
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 36ab93df1e..3271e2a8c4 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -602,7 +602,7 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
return 2;
#else
mcount = 7;
- // fall through
+ Q_FALLTHROUGH();
#endif
case MonthSection:
#ifdef QT_NO_TEXTDATE
@@ -770,7 +770,8 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
state = Intermediate;
}
break;
- } // else: fall through
+ }
+ Q_FALLTHROUGH();
case DaySection:
case YearSection:
case YearSection2Digits:
@@ -1155,7 +1156,7 @@ end:
done = true;
break;
}
- // fallthrough
+ Q_FALLTHROUGH();
default: {
int toMin;
int toMax;
@@ -1489,7 +1490,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
switch (sn.type) {
case MSecSection:
ret |= Fraction;
- // fallthrough
+ Q_FALLTHROUGH();
case SecondSection:
case MinuteSection:
case Hour24Section:
@@ -1509,7 +1510,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
switch (sn.count) {
case 2:
ret |= FixedWidth;
- // fallthrough
+ Q_FALLTHROUGH();
case 1:
ret |= (Numeric|AllowPartial);
break;
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index e3eed9184f..62cb17c053 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -136,8 +136,12 @@ public:
Node *i;
inline iterator() : i(0) {}
inline iterator(Node *n) : i(n) {}
- inline iterator(const iterator &o) : i(o.i) {}
- inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(const iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ iterator(iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline T &operator*() const { return i->t; }
inline T *operator->() const { return &i->t; }
inline bool operator==(const iterator &o) const { return i == o.i; }
@@ -169,9 +173,13 @@ public:
Node *i;
inline const_iterator() : i(0) {}
inline const_iterator(Node *n) : i(n) {}
- inline const_iterator(const const_iterator &o) : i(o.i){}
inline const_iterator(iterator ci) : i(ci.i){}
- inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ const_iterator(const const_iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const const_iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ const_iterator(const_iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const_iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline const T &operator*() const { return i->t; }
inline const T *operator->() const { return &i->t; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index f8f3347786..96ddca56af 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -3011,7 +3011,7 @@ int QRegExpEngine::getEscape()
case 'I':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
@@ -3051,7 +3051,7 @@ int QRegExpEngine::getEscape()
case 'C':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
@@ -3097,7 +3097,7 @@ int QRegExpEngine::getEscape()
case 'P':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 7ce12bc244..a0c22c9179 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -67,10 +67,6 @@ QT_END_NAMESPACE
#endif
#include <QtCore/qhashfunctions.h>
-#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
-# include <utility> // for std::forward
-#endif
-
QT_BEGIN_NAMESPACE
@@ -428,7 +424,6 @@ public:
QWeakPointer<T> toWeakRef() const;
-#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
template <typename... Args>
static QSharedPointer create(Args && ...arguments)
{
@@ -450,49 +445,6 @@ public:
result.enableSharedFromThis(result.data());
return result;
}
-#else
- static inline QSharedPointer create()
- {
- typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
-# else
- typename Private::DestroyerFn destroy = &Private::deleter;
-# endif
- QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
-
- // now initialize the data
- new (result.data()) T();
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- internalSafetyCheckAdd(result.d, result.value);
-# endif
- result.d->setQObjectShared(result.value, true);
- result.enableSharedFromThis(result.data());
- return result;
- }
-
- template <typename Arg>
- static inline QSharedPointer create(const Arg &arg)
- {
- typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
-# else
- typename Private::DestroyerFn destroy = &Private::deleter;
-# endif
- QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
-
- // now initialize the data
- new (result.data()) T(arg);
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- internalSafetyCheckAdd(result.d, result.value);
-# endif
- result.d->setQObjectShared(result.value, true);
- return result;
- }
-#endif
private:
explicit QSharedPointer(Qt::Initialization) {}
diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp
index fad4267edc..be1d88e260 100644
--- a/src/corelib/tools/qunicodetools.cpp
+++ b/src/corelib/tools/qunicodetools.cpp
@@ -522,13 +522,13 @@ static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *at
// do not change breaks before and after the expression
for (quint32 j = nestart + 1; j < pos; ++j)
attributes[j].lineBreak = false;
- // fall through
+ Q_FALLTHROUGH();
case LB::NS::None:
nelast = LB::NS::XX; // reset state
break;
case LB::NS::Start:
nestart = i;
- // fall through
+ Q_FALLTHROUGH();
default:
nelast = necur;
break;
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 83b26d50ab..1ffaeca852 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -976,11 +976,11 @@ bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject)
case '\r':
if ((c = filterCarriageReturn()) == 0)
break;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case '\t':
textBuffer += QChar(c);
continue;
@@ -1158,11 +1158,11 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
case '\r':
if (filterCarriageReturn() == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
if (normalizeLiterals)
@@ -1179,7 +1179,7 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
if (c < 0x20) {
putChar(c);
@@ -1201,11 +1201,11 @@ inline int QXmlStreamReaderPrivate::fastScanSpace()
case '\r':
if ((c = filterCarriageReturn()) == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
textBuffer += QChar(c);
@@ -1259,11 +1259,11 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
case '\r':
if ((c = filterCarriageReturn()) == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
textBuffer += QChar(ushort(c));
@@ -1275,7 +1275,7 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
if (c < 0x20) {
putChar(c);
@@ -1339,7 +1339,7 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
textBuffer += QChar(c);
++n;
@@ -2123,7 +2123,7 @@ QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour)
result += readElementText(behaviour);
break;
}
- // Fall through (for ErrorOnUnexpectedElement)
+ Q_FALLTHROUGH();
default:
if (d->error || behaviour == ErrorOnUnexpectedElement) {
if (!d->error)
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index c68d6f0f53..b62cc9ac39 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -1048,7 +1048,7 @@ bool QXmlStreamReaderPrivate::parse()
dtdName.clear();
dtdPublicId.clear();
dtdSystemId.clear();
- // fall through
+ Q_FALLTHROUGH();
case QXmlStreamReader::Comment:
case QXmlStreamReader::Characters:
isCDATA = false;
@@ -1080,7 +1080,7 @@ bool QXmlStreamReaderPrivate::parse()
return false;
}
#endif
- // fall through
+ Q_FALLTHROUGH();
default:
clearTextBuffer();
;
@@ -1124,7 +1124,7 @@ bool QXmlStreamReaderPrivate::parse()
} else {
break;
}
- // fall through
+ Q_FALLTHROUGH();
case ~0U: {
token = EOF_SYMBOL;
if (!tagsDone && !inParseEntity) {
@@ -1338,7 +1338,7 @@ bool QXmlStreamReaderPrivate::parse()
case 17:
case 18:
dtdName = symString(3);
- // fall through
+ Q_FALLTHROUGH();
case 19:
case 20:
@@ -1480,7 +1480,7 @@ bool QXmlStreamReaderPrivate::parse()
if (entityDeclaration.parameter)
raiseWellFormedError(QXmlStream::tr("NDATA in parameter entity declaration."));
}
- //fall through
+ Q_FALLTHROUGH();
case 94:
case 95: {
@@ -1588,7 +1588,7 @@ bool QXmlStreamReaderPrivate::parse()
case 129:
isWhitespace = false;
- // fall through
+ Q_FALLTHROUGH();
case 130:
sym(1).len += fastScanContentCharList();
@@ -1760,7 +1760,7 @@ bool QXmlStreamReaderPrivate::parse()
case 236:
isEmptyElement = true;
- // fall through
+ Q_FALLTHROUGH();
case 237:
setType(QXmlStreamReader::StartElement);
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index 7ba7c79808..4ea6cefff6 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -318,7 +318,7 @@ void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature
case DBUS_TYPE_ARRAY:
*ba += char(code);
*ba += signature;
- // fall through
+ Q_FALLTHROUGH();
case DBUS_TYPE_DICT_ENTRY:
sub.closeCode = 0;
@@ -495,9 +495,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
return true;
default:
- ; // fall through
+ ;
}
- // fall through
+ Q_FALLTHROUGH();
case DBUS_TYPE_STRUCT:
case DBUS_STRUCT_BEGIN_CHAR:
@@ -513,7 +513,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
append(qvariant_cast<QDBusUnixFileDescriptor>(arg));
return true;
}
- // fall through
+ Q_FALLTHROUGH();
default:
qWarning("QDBusMarshaller::appendVariantInternal: Found unknown D-BUS type '%s'",
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 59a71ade3e..fb2b407997 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -373,7 +373,7 @@ int QDBusMetaType::signatureToType(const char *signature)
return qMetaTypeId<QList<QDBusSignature> >();
}
- // fall through
+ Q_FALLTHROUGH();
default:
return QMetaType::UnknownType;
}
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 7e7ce9a7e6..d239a69f73 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -59,10 +59,10 @@ static inline QString typeNameToXml(const char *typeName)
{
// ### copied from qtextdocument.cpp
// ### move this into Qt Core at some point
- QString plain = QLatin1String(typeName);
+ const QLatin1String plain(typeName);
QString rich;
- rich.reserve(int(plain.length() * 1.1));
- for (int i = 0; i < plain.length(); ++i) {
+ rich.reserve(int(plain.size() * 1.1));
+ for (int i = 0; i < plain.size(); ++i) {
if (plain.at(i) == QLatin1Char('<'))
rich += QLatin1String("&lt;");
else if (plain.at(i) == QLatin1Char('>'))
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index bd32ca7bee..9b14500e7a 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1888,7 +1888,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_RGBA8888:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
xorbits = 0xffffff00;
@@ -1900,7 +1900,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_ARGB32:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
xorbits = 0x00ffffff;
break;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 45d57856aa..0320d032b0 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1151,7 +1151,7 @@ bool QImageReader::autoTransform() const
case QImageReaderPrivate::UsePluginDefault:
if (d->initHandler())
return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
- // no break
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 277004d055..7c690c1498 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -44,13 +44,12 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QAbstractItemModel*. This header file may change from version
-// to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
-//
#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpaintengine.h>
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 4032176efc..950695a9d7 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -113,10 +113,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
return qRound(h * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmDepth:
return 32;
- case QPaintDevice::PdmDpiX: // fall-through
+ case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return qt_defaultDpiX();
- case QPaintDevice::PdmDpiY: // fall-through
+ case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY();
case QPaintDevice::PdmDevicePixelRatio:
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 0232df7c3f..269df25794 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 3106d74651..8889d9e663 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index c59872f4be..561153376d 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 51e5d6dc6c..af3e98d3ff 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 21f9b46654..a59612474b 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -149,17 +149,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
-static QStringList imageReadMimeFormats()
+static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
- QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ formats.reserve(imageFormats.size());
+ for (const auto &format : imageFormats)
+ formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
@@ -169,25 +164,15 @@ static QStringList imageReadMimeFormats()
return formats;
}
-
-static QStringList imageWriteMimeFormats()
+static inline QStringList imageReadMimeFormats()
{
- QStringList formats;
- QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ return imageMimeFormats(QImageReader::supportedImageFormats());
+}
- //put png at the front because it is best
- int pngIndex = formats.indexOf(QLatin1String("image/png"));
- if (pngIndex != -1 && pngIndex != 0)
- formats.move(pngIndex, 0);
- return formats;
+static inline QStringList imageWriteMimeFormats()
+{
+ return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 82a88eca04..2afb5e6ba5 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
switch (imageformat) {
case QImage::Format_ARGB32_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
swizzle = true;
break;
case QImage::Format_RGBA8888_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index 2fc9a0e964..2c3cca6b18 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -22,12 +22,9 @@ qtConfig(opengl(es2)?) {
opengl/qopenglpaintengine_p.h \
opengl/qopenglengineshadersource_p.h \
opengl/qopenglcustomshaderstage_p.h \
- opengl/qtriangulatingstroker_p.h \
opengl/qopengltextureglyphcache_p.h \
opengl/qopenglshadercache_p.h \
opengl/qopenglshadercache_meego_p.h \
- opengl/qtriangulator_p.h \
- opengl/qrbtree_p.h \
opengl/qopenglversionfunctions.h \
opengl/qopenglversionfunctionsfactory_p.h \
opengl/qopenglvertexarrayobject.h \
@@ -51,9 +48,7 @@ qtConfig(opengl(es2)?) {
opengl/qopengl2pexvertexarray.cpp \
opengl/qopenglpaintengine.cpp \
opengl/qopenglcustomshaderstage.cpp \
- opengl/qtriangulatingstroker.cpp \
opengl/qopengltextureglyphcache.cpp \
- opengl/qtriangulator.cpp \
opengl/qopenglversionfunctions.cpp \
opengl/qopenglversionfunctionsfactory.cpp \
opengl/qopenglvertexarrayobject.cpp \
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index b6e332fef1..778a38b823 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index 2e74afcbc2..858fc0d857 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -520,8 +520,8 @@ void QOpenGLTextureBlitter::release()
}
/*!
- Enables or disables swizzling for the red and blue color
- channels. An BGRA to RGBA conversion (occurring in the shader on
+ Sets whether swizzling is enabled for the red and blue color channels to
+ \a swizzle. An BGRA to RGBA conversion (occurring in the shader on
the GPU, instead of a slow CPU-side transformation) can be useful
when the source texture contains data from a QImage with a format
like QImage::Format_ARGB32 which maps to BGRA on little endian
@@ -538,10 +538,11 @@ void QOpenGLTextureBlitter::setRedBlueSwizzle(bool swizzle)
}
/*!
- Changes the opacity. The default opacity is 1.0.
+ Changes the opacity to \a opacity. The default opacity is 1.0.
\note the blitter does not alter the blend state. It is up to the
caller of blit() to ensure the correct blend settings are active.
+
*/
void QOpenGLTextureBlitter::setOpacity(float opacity)
{
@@ -613,7 +614,7 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
the source dimensions and will in most cases be set to (0, 0,
image width, image height).
- For unscaled output the size of \a target and \viewport should
+ For unscaled output the size of \a target and \a viewport should
match.
\sa blit()
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index da6ba36643..6a1550dbed 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 2f927aeddb..00f2375923 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -42,6 +42,7 @@ HEADERS += \
painting/qpolygonclipper_p.h \
painting/qrasterdefs_p.h \
painting/qrasterizer_p.h \
+ painting/qrbtree_p.h \
painting/qregion.h \
painting/qrgb.h \
painting/qrgba64.h \
@@ -49,6 +50,8 @@ HEADERS += \
painting/qstroker_p.h \
painting/qtextureglyphcache_p.h \
painting/qtransform.h \
+ painting/qtriangulatingstroker_p.h \
+ painting/qtriangulator_p.h \
painting/qplatformbackingstore.h \
painting/qpathsimplifier_p.h
@@ -92,6 +95,8 @@ SOURCES += \
painting/qstroker.cpp \
painting/qtextureglyphcache.cpp \
painting/qtransform.cpp \
+ painting/qtriangulatingstroker.cpp \
+ painting/qtriangulator.cpp \
painting/qplatformbackingstore.cpp \
painting/qpathsimplifier.cpp
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
index 773e4096ee..b4ade9dc58 100644
--- a/src/gui/painting/qcolor_p.cpp
+++ b/src/gui/painting/qcolor_p.cpp
@@ -343,14 +343,6 @@ bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
return get_named_rgb(name_no_space, rgb);
}
-
-uint qt_get_rgb_val(const char *name)
-{
- QRgb r = 0;
- qt_get_named_rgb(name,&r);
- return r;
-}
-
QStringList qt_get_colornames()
{
int i = 0;
@@ -368,10 +360,6 @@ bool qt_get_named_rgb(const char *, QRgb*)
return false;
}
-uint qt_get_rgb_val(const char *)
-{
- return 0;
-}
QStringList qt_get_colornames()
{
return QStringList();
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index a8d52672f0..b5e92e2ea2 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -57,7 +57,6 @@
QT_BEGIN_NAMESPACE
-uint qt_get_rgb_val(const char *name);
bool qt_get_named_rgb(const char *, QRgb*);
bool qt_get_named_rgb(const QChar *, int len, QRgb*);
bool qt_get_hex_rgb(const char *, QRgb *);
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index a826532b43..2d514e14e0 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -197,7 +197,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
if ((style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge))
|| (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge)))
c = c.color().lighter();
- // fall through!
+ Q_FALLTHROUGH();
case BorderStyle_Solid: {
p->setPen(Qt::NoPen);
p->setBrush(c);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index affbc43afe..a385332d6d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2245,45 +2245,48 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
int32x4_t v_fdx = vdupq_n_s32(fdx*4);
- ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
-
- union Vect_buffer { int32x4_t vect; quint32 i[4]; };
- Vect_buffer v_fx;
-
- for (int i = 0; i < 4; i++) {
- v_fx.i[i] = fx;
- fx += fdx;
- }
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ fx += fdx;
+ v_fx = vsetq_lane_s32(fx, v_fx, 1);
+ fx += fdx;
+ v_fx = vsetq_lane_s32(fx, v_fx, 2);
+ fx += fdx;
+ v_fx = vsetq_lane_s32(fx, v_fx, 3);
+ fx += fdx;
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
const int32x4_t v_fx_r = vdupq_n_s32(0x0800);
while (b < boundedEnd) {
-
- Vect_buffer tl, tr, bl, br;
-
- Vect_buffer v_fx_shifted;
- v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
-
- int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx.vect, v_ffff_mask), v_fx_r), 12);
-
- for (int i = 0; i < 4; i++) {
- int x1 = v_fx_shifted.i[i];
- const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
- const uint *addr_tr = addr_tl + 1;
- tl.i[i] = *addr_tl;
- tr.i[i] = *addr_tr;
- bl.i[i] = *(addr_tl+secondLine);
- br.i[i] = *(addr_tr+secondLine);
- }
-
+ uint32x4x2_t v_top, v_bot;
+
+ int32x4_t v_fx_shifted = vshrq_n_s32(v_fx, 16);
+
+ int x1 = vgetq_lane_s32(v_fx_shifted, 0);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = vgetq_lane_s32(v_fx_shifted, 1);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = vgetq_lane_s32(v_fx_shifted, 2);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = vgetq_lane_s32(v_fx_shifted, 3);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_fx_r), 12);
v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
- interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), v_disty, v_disty_,
+ colorMask, invColorMask, v_256, b);
b+=4;
- v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
+ v_fx = vaddq_s32(v_fx, v_fdx);
}
- fx = v_fx.i[0];
+ fx = vgetq_lane_s32(v_fx, 0);
#endif
}
@@ -2419,6 +2422,87 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
fx = _mm_cvtsi128_si32(v_fx);
fy = _mm_cvtsi128_si32(v_fy);
+#elif defined(__ARM_NEON__)
+ BILINEAR_ROTATE_BOUNDS_PROLOG
+
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+ const int16x8_t invColorMask = vmvnq_s16(colorMask);
+ const int16x8_t v_256 = vdupq_n_s16(256);
+ int32x4_t v_fdx = vdupq_n_s32(fdx * 4);
+ int32x4_t v_fdy = vdupq_n_s32(fdy * 4);
+
+ const uchar *textureData = data->texture.imageData;
+ const int bytesPerLine = data->texture.bytesPerLine;
+
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ int32x4_t v_fy = vmovq_n_s32(fy);
+ fx += fdx; fy += fdy;
+ v_fx = vsetq_lane_s32(fx, v_fx, 1);
+ v_fy = vsetq_lane_s32(fy, v_fy, 1);
+ fx += fdx; fy += fdy;
+ v_fx = vsetq_lane_s32(fx, v_fx, 2);
+ v_fy = vsetq_lane_s32(fy, v_fy, 2);
+ fx += fdx; fy += fdy;
+ v_fx = vsetq_lane_s32(fx, v_fx, 3);
+ v_fy = vsetq_lane_s32(fy, v_fy, 3);
+ fx += fdx; fy += fdy;
+
+ const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+ const int32x4_t v_round = vdupq_n_s32(0x0800);
+
+ while (b < boundedEnd) {
+ uint32x4x2_t v_top, v_bot;
+
+ int32x4_t v_fx_shifted, v_fy_shifted;
+ v_fx_shifted = vshrq_n_s32(v_fx, 16);
+ v_fy_shifted = vshrq_n_s32(v_fy, 16);
+
+ int x1 = vgetq_lane_s32(v_fx_shifted, 0);
+ int y1 = vgetq_lane_s32(v_fy_shifted, 0);
+ const uchar *sl = textureData + bytesPerLine * y1;
+ const uint *s1 = reinterpret_cast<const uint *>(sl);
+ const uint *s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = vgetq_lane_s32(v_fx_shifted, 1);
+ y1 = vgetq_lane_s32(v_fy_shifted, 1);
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = vgetq_lane_s32(v_fx_shifted, 2);
+ y1 = vgetq_lane_s32(v_fy_shifted, 2);
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = vgetq_lane_s32(v_fx_shifted, 3);
+ y1 = vgetq_lane_s32(v_fy_shifted, 3);
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_round), 12);
+ int32x4_t v_disty = vshrq_n_s32(vaddq_s32(vandq_s32(v_fy, v_ffff_mask), v_round), 12);
+ v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
+ v_disty = vorrq_s32(v_disty, vshlq_n_s32(v_disty, 16));
+ int16x8_t v_disty_ = vshlq_n_s16(vreinterpretq_s16_s32(v_disty), 4);
+
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), vreinterpretq_s16_s32(v_disty),
+ v_disty_, colorMask, invColorMask, v_256, b);
+ b += 4;
+ v_fx = vaddq_s32(v_fx, v_fdx);
+ v_fy = vaddq_s32(v_fy, v_fdy);
+ }
+ fx = vgetq_lane_s32(v_fx, 0);
+ fy = vgetq_lane_s32(v_fy, 0);
#endif
}
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 4f2b59c775..f92a681eca 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1760,7 +1760,7 @@ static bool bool_op(bool a, bool b, QPathClipper::Operation op)
switch (op) {
case QPathClipper::BoolAnd:
return a && b;
- case QPathClipper::BoolOr: // fall-through
+ case QPathClipper::BoolOr:
case QPathClipper::Simplify:
return a || b;
case QPathClipper::BoolSub:
@@ -1956,7 +1956,7 @@ QPointF intersectLine(const QPointF &a, const QPointF &b, qreal t)
{
QLineF line(a, b);
switch (edge) {
- case Left: // fall-through
+ case Left:
case Right:
return line.pointAt((t - a.x()) / (b.x() - a.x()));
default:
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 34f1c51f6d..d246c96da6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2091,7 +2091,7 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
// calculate required bounds
QRectF pageRect = m_pageLayout.fullRectPixels(resolution);
@@ -2154,7 +2154,7 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
Q_ASSERT(qFuzzyIsNull(r0)); // QPainter emulates if this is not 0
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index e2c5a82ffc..0c5de36981 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -471,14 +471,14 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
*flags |= TextureSwizzle;
break;
case QImage::Format_RGBA8888_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/opengl/qrbtree_p.h b/src/gui/painting/qrbtree_p.h
index d3ee23a91c..d3ee23a91c 100644
--- a/src/gui/opengl/qrbtree_p.h
+++ b/src/gui/painting/qrbtree_p.h
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 6058811176..2d841b2953 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -446,7 +446,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
break;
case TxProject:
m_33 += dx*m_13 + dy*m_23;
- // Fall through
+ Q_FALLTHROUGH();
case TxShear:
case TxRotate:
affine._dx += dx*affine._m11 + dy*affine._m21;
@@ -508,12 +508,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
case TxProject:
m_13 *= sx;
m_23 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear:
affine._m12 *= sx;
affine._m21 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxScale:
affine._m11 *= sx;
affine._m22 *= sy;
@@ -581,7 +581,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
m_13 += tm13;
m_23 += tm23;
}
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear: {
qreal tm11 = sv*affine._m21;
@@ -663,7 +663,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
@@ -742,7 +742,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
diff --git a/src/gui/opengl/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index d9a3231165..d9a3231165 100644
--- a/src/gui/opengl/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
diff --git a/src/gui/opengl/qtriangulatingstroker_p.h b/src/gui/painting/qtriangulatingstroker_p.h
index 2b0f08972b..2b0f08972b 100644
--- a/src/gui/opengl/qtriangulatingstroker_p.h
+++ b/src/gui/painting/qtriangulatingstroker_p.h
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 601b51a5fb..6604d407f0 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -50,9 +50,10 @@
#include <QtCore/qglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qalgorithms.h>
-
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
+#ifndef QT_NO_OPENGL
+# include <private/qopenglcontext_p.h>
+# include <private/qopenglextensions_p.h>
+#endif
#include <private/qrbtree_p.h>
QT_BEGIN_NAMESPACE
@@ -873,7 +874,7 @@ void QTriangulator<T>::initialize(const QVectorPath &path, const QTransform &mat
case QPainterPath::MoveToElement:
if (!m_indices.isEmpty())
m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON
- // Fall through.
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
m_indices.push_back(T(m_vertices.size()));
m_vertices.resize(m_vertices.size() + 1);
@@ -2099,7 +2100,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#3)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case StartVertex:
if (m_clockwiseOrder) {
leftEdgeNode = searchEdgeLeftOfEdge(j);
@@ -2128,7 +2129,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#4)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case EndVertex:
if (m_clockwiseOrder) {
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
@@ -2267,10 +2268,14 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
static bool hasElementIndexUint()
{
+#ifndef QT_NO_OPENGL
QOpenGLContext *context = QOpenGLContext::currentContext();
if (!context)
return false;
return static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint);
+#else
+ return false;
+#endif
}
Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon,
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h
index 4d1aba099c..4d1aba099c 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/painting/qtriangulator_p.h
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 8894e4884b..4548b6f8b9 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -2111,7 +2111,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
hexCount = qMin(hexCount, 6);
bool ok = false;
- ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
+ ushort code = output.midRef(hexStart, hexCount).toUShort(&ok, 16);
if (ok) {
output.replace(hexStart - 1, hexCount + 1, QChar(code));
i = hexStart;
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index f5cd5395b2..9f79e9934e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 5e72e6969c..3b24039ea6 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1376,6 +1376,7 @@ void QFont::setStyleStrategy(StyleStrategy s)
Predefined stretch values that follow the CSS naming convention. The higher
the value, the more stretched the text is.
+ \value AnyStretch 0 Accept any stretch matched using the other QFont properties (added in Qt 5.8)
\value UltraCondensed 50
\value ExtraCondensed 62
\value Condensed 75
@@ -1402,20 +1403,25 @@ int QFont::stretch() const
/*!
Sets the stretch factor for the font.
- The stretch factor changes the width of all characters in the font
- by \a factor percent. For example, setting \a factor to 150
+ The stretch factor matches a condensed or expanded version of the font or
+ applies a stretch transform that changes the width of all characters
+ in the font by \a factor percent. For example, setting \a factor to 150
results in all characters in the font being 1.5 times (ie. 150%)
- wider. The default stretch factor is 100. The minimum stretch
- factor is 1, and the maximum stretch factor is 4000.
+ wider. The minimum stretch factor is 1, and the maximum stretch factor
+ is 4000. The default stretch factor is \c AnyStretch, which will accept
+ any stretch factor and not apply any transform on the font.
The stretch factor is only applied to outline fonts. The stretch
factor is ignored for bitmap fonts.
+ \note When matching a font with a native non-default stretch factor,
+ requesting a stretch of 100 will stretch it back to a medium width font.
+
\sa stretch(), QFont::Stretch
*/
void QFont::setStretch(int factor)
{
- if (factor < 1 || factor > 4000) {
+ if (factor < 0 || factor > 4000) {
qWarning("QFont::setStretch: Parameter '%d' out of range", factor);
return;
}
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index b295e13f61..6f0dd27fbe 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -113,6 +113,7 @@ public:
};
enum Stretch {
+ AnyStretch = 0,
UltraCondensed = 50,
ExtraCondensed = 62,
Condensed = 75,
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 21823dc12f..9e5d0b4329 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -71,7 +71,7 @@ struct QFontDef
inline QFontDef()
: pointSize(-1.0), pixelSize(-1),
styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
- weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
+ weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(QFont::AnyStretch),
hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true),
fixedPitchComputed(0), reserved(0)
{
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index ef09a0cacd..e8f29ce520 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -951,12 +951,14 @@ QFontEngine *loadSingleEngine(int script,
}
}
- // If the font data's native stretch matches the requested stretch we need to set stretch to 100
- // to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate
- // the new stretch factor. This only done if not matched by styleName.
+ // To avoid synthesized stretch we need a matching stretch to be 100 after this point.
+ // If stretch didn't match exactly we need to calculate the new stretch factor.
+ // This only done if not matched by styleName.
if (style->key.stretch != 0 && request.stretch != 0
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
- def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
+ def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
+ } else {
+ def.stretch = 100;
}
engine = pfdb->fontEngine(def, size->handle);
@@ -1219,7 +1221,8 @@ static int match(int script, const QFontDef &request,
QtFontStyle::Key styleKey;
styleKey.style = request.style;
styleKey.weight = request.weight;
- styleKey.stretch = request.stretch;
+ // Prefer a stretch closest to 100.
+ styleKey.stretch = request.stretch ? request.stretch : 100;
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
@@ -2740,8 +2743,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
// respect the fallback families that might be passed through the request
const QStringList fallBackFamilies = familyList(req);
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index adc8f634dc..dbd47151bd 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -418,6 +418,13 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
return metrics;
}
+QFixed QFontEngine::calculatedCapHeight() const
+{
+ const glyph_t glyph = glyphIndex('H');
+ glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
+ return bb.height;
+}
+
QFixed QFontEngine::xHeight() const
{
const glyph_t glyph = glyphIndex('x');
@@ -1703,6 +1710,11 @@ QFixed QFontEngineBox::ascent() const
return _size;
}
+QFixed QFontEngineBox::capHeight() const
+{
+ return _size;
+}
+
QFixed QFontEngineBox::descent() const
{
return 0;
@@ -2163,6 +2175,9 @@ glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
QFixed QFontEngineMulti::ascent() const
{ return engine(0)->ascent(); }
+QFixed QFontEngineMulti::capHeight() const
+{ return engine(0)->capHeight(); }
+
QFixed QFontEngineMulti::descent() const
{ return engine(0)->descent(); }
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 75e30b9552..46f5e6c070 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -414,6 +414,7 @@ QFontEngine::Properties QFreetypeFace::properties() const
p.italicAngle = 0;
p.capHeight = p.ascent;
p.lineWidth = face->underline_thickness;
+
return p;
}
@@ -585,8 +586,7 @@ static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int
uchar green = src[x + 1];
uchar blue = src[x + 1 + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dd++ = (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
dst += width;
src += src_pitch;
@@ -611,8 +611,7 @@ static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, in
uchar green = src[x + src_pitch];
uchar blue = src[x + src_pitch + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dst++ = (0XFF << 24) | (red << 16) | (green << 8) | blue;
}
src += 3*src_pitch;
}
@@ -1299,6 +1298,18 @@ QFixed QFontEngineFT::ascent() const
return v;
}
+QFixed QFontEngineFT::capHeight() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->version >= 2) {
+ lockFace();
+ QFixed answer = QFixed::fromFixed(FT_MulFix(os2->sCapHeight, freetype->face->size->metrics.y_scale));
+ unlockFace();
+ return answer;
+ }
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineFT::descent() const
{
QFixed v = QFixed::fromFixed(-metrics.descender);
@@ -1317,33 +1328,25 @@ QFixed QFontEngineFT::leading() const
QFixed QFontEngineFT::xHeight() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->sxHeight) {
- lockFace();
- QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->sxHeight) {
+ lockFace();
+ QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
+
return QFontEngine::xHeight();
}
QFixed QFontEngineFT::averageCharWidth() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->xAvgCharWidth) {
- lockFace();
- QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- const qreal aspectRatio = (qreal)xsize / ysize;
- return QFixed::fromReal(fontDef.pixelSize * aspectRatio);
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->xAvgCharWidth) {
+ lockFace();
+ QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
return QFontEngine::averageCharWidth();
@@ -1842,7 +1845,7 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
bytesPerLine = (glyph->width + 3) & ~3;
break;
case QFontEngine::Format_A32:
- format = QImage::Format_ARGB32;
+ format = QImage::Format_RGB32;
bytesPerLine = glyph->width * 4;
break;
default:
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 3cdf0cda47..5ca3721c71 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -209,6 +209,7 @@ private:
int synthesized() const Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index f3eeddab41..69331cb0bb 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -211,6 +211,7 @@ public:
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
virtual QFixed ascent() const = 0;
+ virtual QFixed capHeight() const = 0;
virtual QFixed descent() const = 0;
virtual QFixed leading() const = 0;
virtual QFixed xHeight() const;
@@ -348,6 +349,7 @@ protected:
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
inline void setUserData(const QVariant &userData) { m_userData = userData; }
+ QFixed calculatedCapHeight() const;
private:
struct GlyphCacheEntry {
@@ -414,6 +416,7 @@ public:
virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
@@ -451,6 +454,7 @@ public:
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
index 2e4af09550..110d512d39 100644
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ b/src/gui/text/qfontengine_qpf2.cpp
@@ -459,6 +459,11 @@ QFixed QFontEngineQPF2::ascent() const
return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
}
+QFixed QFontEngineQPF2::capHeight() const
+{
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineQPF2::descent() const
{
return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h
index 50aac245c1..e5c38ffbaf 100644
--- a/src/gui/text/qfontengine_qpf2_p.h
+++ b/src/gui/text/qfontengine_qpf2_p.h
@@ -172,6 +172,7 @@ public:
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 2189923b25..aca59d0288 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -274,6 +274,24 @@ int QFontMetrics::ascent() const
return qRound(engine->ascent());
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+int QFontMetrics::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return qRound(engine->capHeight());
+}
/*!
Returns the descent of the font.
@@ -1138,6 +1156,24 @@ qreal QFontMetricsF::ascent() const
return engine->ascent().toReal();
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+qreal QFontMetricsF::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return engine->capHeight().toReal();
+}
/*!
Returns the descent of the font.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 22e51f29f7..3eac309092 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -73,6 +73,7 @@ public:
{ qSwap(d, other.d); }
int ascent() const;
+ int capHeight() const;
int descent() const;
int height() const;
int leading() const;
@@ -146,6 +147,7 @@ public:
void swap(QFontMetricsF &other) { qSwap(d, other.d); }
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal height() const;
qreal leading() const;
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index c8f0393084..92eeaf7919 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -740,7 +740,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
points->takeLast();
endPoints->append(points->size() - 1);
}
- // fall through
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
p.flags = OnCurve;
break;
@@ -966,7 +966,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc
glyph.advanceWidth = qRound(advance * 2048. / ppem);
glyph.lsb = qRound(lsb * 2048. / ppem);
- if (!path.elementCount()) {
+ if (path.isEmpty()) {
//qDebug("glyph %d is empty", index);
lsb = 0;
glyph.xMin = glyph.xMax = glyph.yMin = glyph.yMax = 0;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index eadb65959a..8e6ffa5e94 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -325,6 +325,23 @@ qreal QRawFont::ascent() const
}
/*!
+ Returns the cap height of this QRawFont in pixel units.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa QFontMetricsF::capHeight()
+*/
+qreal QRawFont::capHeight() const
+{
+ return d->isValid() ? d->fontEngine->capHeight().toReal() : 0.0;
+}
+
+/*!
Returns the descent of this QRawFont in pixel units.
\sa QFontMetricsF::descent()
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 5791c6af16..0252e62370 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -118,6 +118,7 @@ public:
QFont::HintingPreference hintingPreference() const;
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal leading() const;
qreal xHeight() const;
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f824d1b369..f32c31d18e 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -438,7 +438,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
if (relativePos < blockIt.length()-1)
++position;
- // FALL THROUGH!
+ Q_FALLTHROUGH();
}
case QTextCursor::PreviousWord:
case QTextCursor::WordLeft:
@@ -590,9 +590,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
adjustX = false;
break;
}
- case QTextCursor::NextCell: // fall through
- case QTextCursor::PreviousCell: // fall through
- case QTextCursor::NextRow: // fall through
+ case QTextCursor::NextCell:
+ case QTextCursor::PreviousCell:
+ case QTextCursor::NextRow:
case QTextCursor::PreviousRow: {
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
if (!table)
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 3537adba9e..7107c7c26e 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -131,7 +131,7 @@ static bool isValidBlockSeparator(QChar ch)
|| ch == QTextEndOfFrame;
}
-static bool noBlockInString(const QString &str)
+static bool noBlockInString(const QStringRef &str)
{
return !str.contains(QChar::ParagraphSeparator)
&& !str.contains(QTextBeginningOfFrame)
@@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
{
// ##### optimize when only appending to the fragment!
- Q_ASSERT(noBlockInString(text.mid(strPos, length)));
+ Q_ASSERT(noBlockInString(text.midRef(strPos, length)));
split(pos);
uint x = fragments.insert_single(pos, length);
@@ -476,7 +476,7 @@ void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
if (str.size() == 0)
return;
- Q_ASSERT(noBlockInString(str));
+ Q_ASSERT(noBlockInString(QStringRef(&str)));
int strPos = text.length();
text.append(str);
@@ -494,7 +494,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
Q_ASSERT(blocks.size(b) > length);
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
- Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
+ Q_ASSERT(noBlockInString(text.midRef(fragments.fragment(x)->stringPosition, length)));
blocks.setSize(b, blocks.size(b)-length);
@@ -629,7 +629,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
- Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
+ Q_ASSERT(noBlockInString(text.midRef(X->stringPosition, X->size_array[0])));
w = remove_string(key, X->size_array[0], op);
if (needsInsert) {
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 5727b34e86..079b2e01f7 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -827,7 +827,7 @@ bool QTextHtmlImporter::closeTag()
case Html_div:
if (closedNode->children.isEmpty())
break;
- // fall through
+ Q_FALLTHROUGH();
default:
if (closedNode->isBlock())
blockTagClosed = true;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index cad30b0c77..8a13455ee0 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -508,7 +508,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
case QChar::DirAN:
if (eor >= 0)
appendItems(analysis, sor, eor, control, dir);
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirR:
case QChar::DirAL:
dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
@@ -564,7 +564,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.eor = QChar::DirON;
dir = QChar::DirAN;
}
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirEN:
case QChar::DirL:
eor = current;
@@ -744,7 +744,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.last = QChar::DirL;
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
status.last = dirCurrent;
}
@@ -1664,7 +1664,7 @@ void QTextEngine::itemize() const
analysis->bidiLevel = control.baseLevel();
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
analysis->flags = QScriptAnalysis::None;
break;
@@ -2251,7 +2251,6 @@ void QTextEngine::justify(const QScriptLine &line)
case Justification_Prohibited:
break;
case Justification_Space:
- // fall through
case Justification_Arabic_Space:
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
@@ -2264,7 +2263,7 @@ void QTextEngine::justify(const QScriptLine &line)
}
kashida_pos = -1;
kashida_type = Justification_Arabic_Normal;
- // fall through
+ Q_FALLTHROUGH();
case Justification_Character:
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
maxJustify = qMax(maxJustify, justification);
@@ -2712,7 +2711,7 @@ static QString stringMidRetainingBidiCC(const QString &string,
suffix += c;
}
- return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
+ return prefix + ellidePrefix + string.midRef(midStart, midLength) + ellideSuffix + suffix;
}
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
@@ -2875,7 +2874,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (prevCharJoins(layoutData->string, rightPos))
ellipsisText.append(QChar(0x200d) /* ZWJ */);
- return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
+ return layoutData->string.midRef(from, leftPos - from) + ellipsisText + layoutData->string.midRef(rightPos, to - rightPos);
}
return layoutData->string.mid(from, to - from);
@@ -2967,9 +2966,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
switch (tabSpec.type) {
case QTextOption::CenterTab:
length /= 2;
- // fall through
+ Q_FALLTHROUGH();
case QTextOption::DelimiterTab:
- // fall through
case QTextOption::RightTab:
tab = QFixed::fromReal(tabSpec.position) * dpiScale - length;
if (tab < x) // default to tab taking no space
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 7bca50325c..7fac3331f1 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1871,7 +1871,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_big:
case Html_small:
if (node.id != Html_th) {
@@ -1892,7 +1892,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
break;
}
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_center:
case Html_td:
decl = QCss::Declaration();
@@ -1969,7 +1969,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
}
if (node.id != Html_pre)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_br:
case Html_nobr:
decl = QCss::Declaration();
diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index c1a5652760..d0dd7d2b5c 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -48,9 +48,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 7b6f830333..52b9dd9169 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -1121,7 +1121,7 @@ bool QFtpPI::processReply()
case Success:
// success handling
state = Idle;
- // no break!
+ Q_FALLTHROUGH();
case Idle:
if (dtp.hasError()) {
emit error(QFtp::UnknownError, dtp.errorMessage());
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index ee155bdbed..b6a9b80511 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -1060,7 +1060,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (!protocolHandler) {
switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) {
- case QSslConfiguration::NextProtocolNegotiationNegotiated: /* fall through */
+ case QSslConfiguration::NextProtocolNegotiationNegotiated:
case QSslConfiguration::NextProtocolNegotiationUnsupported: {
QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol();
if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) {
@@ -1080,6 +1080,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
"detected unknown Next Protocol Negotiation protocol");
break;
}
+ Q_FALLTHROUGH();
}
case QSslConfiguration::NextProtocolNegotiationNone:
protocolHandler.reset(new QHttpProtocolHandler(this));
diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp
index b486b75449..37e8b9bed8 100644
--- a/src/network/access/qhttpprotocolhandler.cpp
+++ b/src/network/access/qhttpprotocolhandler.cpp
@@ -99,7 +99,7 @@ void QHttpProtocolHandler::_q_receiveReply()
switch (state) {
case QHttpNetworkReplyPrivate::NothingDoneState: {
m_reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
- // fallthrough
+ Q_FALLTHROUGH();
}
case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = m_reply->d_func()->readStatus(m_socket);
@@ -213,7 +213,8 @@ void QHttpProtocolHandler::_q_receiveReply()
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState)
break;
- // everything done, fall through
+ // everything done
+ Q_FALLTHROUGH();
}
case QHttpNetworkReplyPrivate::AllDoneState:
m_channel->allDone();
@@ -428,7 +429,7 @@ bool QHttpProtocolHandler::sendRequest()
}
case QHttpNetworkConnectionChannel::ReadingState:
// ignore _q_bytesWritten in these states
- // fall through
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 7a538cbf08..b7cf989477 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -644,7 +644,7 @@ static QDateTime parseDateString(const QByteArray &dateString)
switch (end - 1) {
case 4:
minutes = atoi(dateString.mid(at + 3, 2).constData());
- // fall through
+ Q_FALLTHROUGH();
case 2:
hours = atoi(dateString.mid(at + 1, 2).constData());
break;
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 95f90af49e..7e3d2c5d6e 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -536,7 +536,7 @@ QHostAddress::QHostAddress(SpecialAddress address)
case LocalHostIPv6:
ip6[15] = 1;
- // fall through
+ Q_FALLTHROUGH();
case AnyIPv6:
d->setAddress(ip6);
return;
diff --git a/src/network/kernel/qnetworkinterface_p.h b/src/network/kernel/qnetworkinterface_p.h
index 2dfc93cc18..ec25fdf37e 100644
--- a/src/network/kernel/qnetworkinterface_p.h
+++ b/src/network/kernel/qnetworkinterface_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/kernel/qnetworkproxy_p.h b/src/network/kernel/qnetworkproxy_p.h
index 0b0dcd3a68..733d8436d0 100644
--- a/src/network/kernel/qnetworkproxy_p.h
+++ b/src/network/kernel/qnetworkproxy_p.h
@@ -40,14 +40,13 @@
#ifndef QNETWORKPROXY_P_H
#define QNETWORKPROXY_P_H
-
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index 1ca0fa0213..46c7ae5c55 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -45,9 +45,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 9ae2d8ba8f..5a9641a9fe 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -712,7 +712,7 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
if (errorDetected)
break;
- // fall through
+ Q_FALLTHROUGH();
}
case WSAEINPROGRESS:
setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);
diff --git a/src/network/socket/qsctpsocket.cpp b/src/network/socket/qsctpsocket.cpp
index f65ffa765d..cb07e80299 100644
--- a/src/network/socket/qsctpsocket.cpp
+++ b/src/network/socket/qsctpsocket.cpp
@@ -504,7 +504,7 @@ QNetworkDatagram QSctpSocket::readDatagram()
}
/*!
- Writes a datagram to the buffer of the current write channel.
+ Writes a \a datagram to the buffer of the current write channel.
Returns true on success; otherwise returns false.
\sa readDatagram(), inDatagramMode(), currentWriteChannel()
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 518ec21f90..a1a8e4649d 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -618,7 +618,7 @@ void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, const QString
QSocks5SocketEngine::tr("Connection to proxy timed out"));
break;
}
- /* fall through */
+ Q_FALLTHROUGH();
default:
q->setError(controlSocketError, data->controlSocket->errorString());
break;
@@ -1205,7 +1205,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification()
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
qWarning("QSocks5SocketEnginePrivate::_q_controlSocketReadNotification: "
"Unexpectedly received data while in state=%d and mode=%d",
diff --git a/src/network/socket/qtcpserver_p.h b/src/network/socket/qtcpserver_p.h
index b11dd93718..71dc4d985f 100644
--- a/src/network/socket/qtcpserver_p.h
+++ b/src/network/socket/qtcpserver_p.h
@@ -45,9 +45,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/socket/qtcpsocket_p.h b/src/network/socket/qtcpsocket_p.h
index 17c44b343c..ba1a0aa920 100644
--- a/src/network/socket/qtcpsocket_p.h
+++ b/src/network/socket/qtcpsocket_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/ssl/qasn1element_p.h b/src/network/ssl/qasn1element_p.h
index f532cec530..2c5019b4f7 100644
--- a/src/network/ssl/qasn1element_p.h
+++ b/src/network/ssl/qasn1element_p.h
@@ -45,9 +45,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h
index 616b5aec6d..0397845f8d 100644
--- a/src/network/ssl/qsslcertificate_p.h
+++ b/src/network/ssl/qsslcertificate_p.h
@@ -48,9 +48,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index 755a08ef6e..b2adb3e547 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -59,9 +59,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 508fdc2a4b..b35a895d38 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -60,9 +60,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 696827daff..cec61d07c1 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -47,9 +47,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 465265da27..95401d10c1 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h
index 61ae10fa70..d3af1fdbaa 100644
--- a/src/opengl/qglframebufferobject_p.h
+++ b/src/opengl/qglframebufferobject_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index c2040589e3..6416e41773 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
index 7d57b97276..6d148753bf 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
index 5682fc72ef..9a23b5c0bd 100644
--- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
+++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp
index ba432db1eb..102bc91647 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler.cpp
+++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp
@@ -172,7 +172,7 @@ void QFbVtHandler::handleSignal()
char sigNo;
if (QT_READ(m_sigFd[1], &sigNo, sizeof(sigNo)) == sizeof(sigNo)) {
switch (sigNo) {
- case SIGINT: // fallthrough
+ case SIGINT:
case SIGTERM:
handleInt();
break;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index fbad61af43..0bc0416eec 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -172,7 +172,7 @@ QFontEngine::GlyphFormat QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
{
CGAffineTransform transform = CGAffineTransformIdentity;
- if (fontDef.stretch != 100)
+ if (fontDef.stretch && fontDef.stretch != 100)
transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1);
return transform;
}
@@ -378,6 +378,19 @@ QFixed QCoreTextFontEngine::ascent() const
? QFixed::fromReal(CTFontGetAscent(ctfont)).round()
: QFixed::fromReal(CTFontGetAscent(ctfont));
}
+
+QFixed QCoreTextFontEngine::capHeight() const
+{
+ QFixed c = QFixed::fromReal(CTFontGetCapHeight(ctfont));
+ if (c <= 0)
+ return calculatedCapHeight();
+
+ if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
+ c = c.round();
+
+ return c;
+}
+
QFixed QCoreTextFontEngine::descent() const
{
QFixed d = QFixed::fromReal(CTFontGetDescent(ctfont));
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index b7c9edc528..d9ffbb5697 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -78,6 +78,7 @@ public:
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 23c158ac34..c9ff17f801 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 2f425ddc02..ac70881f63 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index 426cca139d..85942b56f1 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -111,10 +111,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
case QNetworkConfiguration::ServiceNetwork:
serviceConfig = publicConfig;
// Defer setting engine and signals until open().
- // fall through
+ Q_FALLTHROUGH();
case QNetworkConfiguration::UserChoice:
// Defer setting serviceConfig and activeConfig until open().
- // fall through
+ Q_FALLTHROUGH();
default:
engine = 0;
}
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index 3949113240..b9009fe704 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -489,7 +489,7 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
if (ret > 0)
return ret;
- // fall through
+ Q_FALLTHROUGH();
}
default:
return QPlatformTheme::themeHint(hint);
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 3d0c91c36c..0b5b06c44f 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -200,7 +200,7 @@ int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
val = (int)resolution.vRes;
break;
}
- //otherwise fall through
+ Q_FALLTHROUGH();
}
case QPaintDevice::PdmDpiY:
val = (int)d->resolution.vRes;
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 730d5de450..0ea2fcfa74 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -563,7 +563,7 @@ public:
if (newPen.widthF() <= 1.0)
props.startCap = props.endCap = props.dashCap = D2D1_CAP_STYLE_FLAT;
- // fall through
+ Q_FALLTHROUGH();
default:
props.dashStyle = D2D1_DASH_STYLE_CUSTOM;
break;
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 3a683bd7a0..d4cdf3ef3c 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -945,7 +945,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
switch (et) {
case QtWindows::KeyboardLayoutChangeEvent:
if (QWindowsInputContext *wic = windowsInputContext())
- wic->handleInputLanguageChanged(wParam, lParam); // fallthrough intended.
+ wic->handleInputLanguageChanged(wParam, lParam);
+ Q_FALLTHROUGH();
case QtWindows::KeyDownEvent:
case QtWindows::KeyEvent:
case QtWindows::InputMethodKeyEvent:
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 65f2cd14f6..e87064e385 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -957,7 +957,7 @@ error:
return i18n_name;
}
-static bool addFontToDatabase(const QString &familyName, uchar charSet,
+static bool addFontToDatabase(const QString &familyName, const QString &styleName, uchar charSet,
const TEXTMETRIC *textmetric,
const FONTSIGNATURE *signature,
int type,
@@ -1025,16 +1025,16 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
writingSystems.setSupported(ws);
}
- QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
+ QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
@@ -1049,6 +1049,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
{
const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
const uchar charSet = f->elfLogFont.lfCharSet;
const bool registerAlias = bool(lParam);
@@ -1058,7 +1059,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
const FONTSIGNATURE *signature = Q_NULLPTR;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
- addFontToDatabase(familyName, charSet, textmetric, signature, type, registerAlias);
+ addFontToDatabase(familyName, styleName, charSet, textmetric, signature, type, registerAlias);
// keep on enumerating
return 1;
@@ -1465,6 +1466,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
// Memory fonts won't show up in enumeration, so do add them the hard way.
for (int j = 0; j < families.count(); ++j) {
const QString familyName = families.at(j).name;
+ const QString styleName = families.at(j).style;
familyNames << familyName;
HDC hdc = GetDC(0);
LOGFONT lf;
@@ -1477,7 +1479,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
TEXTMETRIC textMetrics;
GetTextMetrics(hdc, &textMetrics);
- addFontToDatabase(familyName, lf.lfCharSet, &textMetrics, &signatures.at(j),
+ addFontToDatabase(familyName, styleName, lf.lfCharSet, &textMetrics, &signatures.at(j),
TRUETYPE_FONTTYPE, true);
SelectObject(hdc, oldobj);
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index d782519c68..b513d9ad7c 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -160,6 +160,7 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR)
}
static bool addFontToDatabase(const QString &faceName,
+ const QString &styleName,
const QString &fullName,
uchar charSet,
const TEXTMETRIC *textmetric,
@@ -247,19 +248,19 @@ static bool addFontToDatabase(const QString &faceName,
if (!QDir::isAbsolutePath(value))
value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\"));
- QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch,
+ QPlatformFontDatabase::registerFont(faceName, styleName, foundryName, weight, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
@@ -274,6 +275,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
{
const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
const QString fullName = QString::fromWCharArray(f->elfFullName);
const uchar charSet = f->elfLogFont.lfCharSet;
@@ -283,7 +285,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
const FONTSIGNATURE *signature = Q_NULLPTR;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
- addFontToDatabase(faceName, fullName, charSet, textmetric, signature, type, false);
+ addFontToDatabase(faceName, styleName, fullName, charSet, textmetric, signature, type, false);
// keep on enumerating
return 1;
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 744d882bb2..f5d1ed9fad 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -192,6 +192,7 @@ void QWindowsFontEngine::getCMap()
lineWidth = otm->otmsUnderscoreSize;
fsType = otm->otmfsType;
free(otm);
+
} else {
unitsPerEm = tm.tmHeight;
}
@@ -540,6 +541,62 @@ QFixed QWindowsFontEngine::leading() const
return tm.tmExternalLeading;
}
+namespace {
+# pragma pack(1)
+
+ struct OS2Table
+ {
+ quint16 version;
+ qint16 avgCharWidth;
+ quint16 weightClass;
+ quint16 widthClass;
+ quint16 type;
+ qint16 subscriptXSize;
+ qint16 subscriptYSize;
+ qint16 subscriptXOffset;
+ qint16 subscriptYOffset;
+ qint16 superscriptXSize;
+ qint16 superscriptYSize;
+ qint16 superscriptXOffset;
+ qint16 superscriptYOffset;
+ qint16 strikeOutSize;
+ qint16 strikeOutPosition;
+ qint16 familyClass;
+ quint8 panose[10];
+ quint32 unicodeRanges[4];
+ quint8 vendorID[4];
+ quint16 selection;
+ quint16 firstCharIndex;
+ quint16 lastCharIndex;
+ qint16 typoAscender;
+ qint16 typoDescender;
+ qint16 typoLineGap;
+ quint16 winAscent;
+ quint16 winDescent;
+ quint32 codepageRanges[2];
+ qint16 height;
+ qint16 capHeight;
+ quint16 defaultChar;
+ quint16 breakChar;
+ quint16 maxContext;
+ };
+
+# pragma pack()
+}
+
+QFixed QWindowsFontEngine::capHeight() const
+{
+ const QByteArray tableData = getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
+ if (size_t(tableData.size()) >= sizeof(OS2Table)) {
+ const OS2Table *table = reinterpret_cast<const OS2Table *>(tableData.constData());
+ if (qFromBigEndian<quint16>(table->version) >= 2) {
+ qint16 capHeight = qFromBigEndian<qint16>(table->capHeight);
+ if (capHeight > 0)
+ return QFixed(capHeight) / designToDevice;
+ }
+ }
+ return calculatedCapHeight();
+}
QFixed QWindowsFontEngine::xHeight() const
{
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h
index 921351a4b0..b63d8fd282 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.h
+++ b/src/plugins/platforms/windows/qwindowsfontengine.h
@@ -103,6 +103,7 @@ public:
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed averageCharWidth() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
qreal minLeftBearing() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 5408ff41e5..18be3b0ce6 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -208,6 +208,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
, m_lineThickness(-1)
, m_unitsPerEm(-1)
, m_ascent(-1)
+ , m_capHeight(-1)
, m_descent(-1)
, m_xHeight(-1)
, m_lineGap(-1)
@@ -244,6 +245,7 @@ void QWindowsFontEngineDirectWrite::collectMetrics()
m_lineThickness = DESIGN_TO_LOGICAL(metrics.underlineThickness);
m_ascent = DESIGN_TO_LOGICAL(metrics.ascent);
+ m_capHeight = DESIGN_TO_LOGICAL(metrics.capHeight);
m_descent = DESIGN_TO_LOGICAL(metrics.descent);
m_xHeight = DESIGN_TO_LOGICAL(metrics.xHeight);
m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap);
@@ -461,6 +463,16 @@ QFixed QWindowsFontEngineDirectWrite::ascent() const
: m_ascent;
}
+QFixed QWindowsFontEngineDirectWrite::capHeight() const
+{
+ if (m_capHeight <= 0)
+ return calculatedCapHeight();
+
+ return fontDef.styleStrategy & QFont::ForceIntegerMetrics
+ ? m_capHeight.round()
+ : m_capHeight;
+}
+
QFixed QWindowsFontEngineDirectWrite::descent() const
{
return fontDef.styleStrategy & QFont::ForceIntegerMetrics
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
index f038dcfde4..fb2df00b7e 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
@@ -87,6 +87,7 @@ public:
const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
@@ -122,6 +123,7 @@ private:
QFixed m_underlinePosition;
int m_unitsPerEm;
QFixed m_ascent;
+ QFixed m_capHeight;
QFixed m_descent;
QFixed m_xHeight;
QFixed m_lineGap;
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 79befc56c2..841464391d 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -551,14 +551,14 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
break;
case FileLinkIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case FileIcon:
stockId = SIID_DOCNOASSOC;
resourceId = 1;
break;
case DirLinkIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case DirClosedIcon:
case DirIcon:
stockId = SIID_FOLDER;
@@ -572,7 +572,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
break;
case DirLinkOpenIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case DirOpenIcon:
stockId = SIID_FOLDEROPEN;
resourceId = 5;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 59054fae2d..4d903ec8d3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -581,6 +581,8 @@ private:
};
QHash<int, ValuatorClassInfo> valuatorInfo;
};
+ friend class QTypeInfo<TabletData>;
+ friend class QTypeInfo<TabletData::ValuatorClassInfo>;
bool xi2HandleTabletEvent(const void *event, TabletData *tabletData);
void xi2ReportTabletEvent(const void *event, TabletData *tabletData);
QVector<TabletData> m_tabletData;
@@ -683,6 +685,8 @@ private:
friend class QXcbEventReader;
};
+Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE);
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
#define CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(object) ((XVisualInfo *)(object->connection()->createVisualInfoForDefaultVisualId()))
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index f65dbda05d..cb6e95cc9a 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -159,6 +159,7 @@ private:
QPointer<QDrag> drag;
QTime time;
};
+ friend class QTypeInfo<Transaction>;
QVector<Transaction> transactions;
int transaction_expiry_timer;
@@ -167,6 +168,7 @@ private:
int findTransactionByTime(xcb_timestamp_t timestamp);
xcb_window_t findRealWindow(const QPoint & pos, xcb_window_t w, int md, bool ignoreNonXdndAwareWindows);
};
+Q_DECLARE_TYPEINFO(QXcbDrag::Transaction, Q_MOVABLE_TYPE);
#endif // QT_NO_DRAGANDDROP
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index f7244739a5..4803c14c4c 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -212,7 +212,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
if (format == QLatin1String("text/uri-list")) {
const QStringList urls = str.split(QLatin1Char('\n'));
QList<QVariant> list;
- foreach (const QString &s, urls) {
+ for (const QString &s : urls) {
const QUrl url(s.trimmed());
if (url.isValid())
list.append(url);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 10c8c8a2d8..4084dbc1df 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -119,6 +119,8 @@ enum {
QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE);
+
#undef FocusIn
enum QX11EmbedFocusInDetail {
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index 0d5f0ca001..942183877d 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -1,5 +1,6 @@
TARGET = QtXcbQpa
CONFIG += no_module_headers internal_module
+DEFINES += QT_NO_FOREACH
QT += core-private gui-private platformsupport-private
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index ed0422468d..278bb044e1 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -150,7 +150,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
else
d->m_pageLayout.setMode(QPageLayout::StandardMode);
break;
- case PPK_CopyCount: // fallthrough
+ case PPK_CopyCount:
case PPK_NumberOfCopies:
d->copies = value.toInt();
break;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index b3dc33895b..b0f85dc825 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1141,7 +1141,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
#endif // QT_DEBUG_METRICS
break;
- case PPK_CopyCount: // fallthrough
+ case PPK_CopyCount:
case PPK_NumberOfCopies:
if (!d->devMode)
break;
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc
index 8bf3b30ffb..bee8a0ad93 100644
--- a/src/testlib/qtestcase.qdoc
+++ b/src/testlib/qtestcase.qdoc
@@ -1122,10 +1122,10 @@
*/
/*!
- \fn QTest::createTouchDevice()
+ \fn QTouchDevice *QTest::createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen)
\since 5.8
- Creates a dummy touch device for simulation of touch events.
+ Creates a dummy touch device of type \a devType for simulation of touch events.
The touch device will be registered with the QPA window system interface,
and deleted automatically when the QCoreApplication is deleted. So you
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 632b801221..1143361323 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -115,14 +115,14 @@ namespace QTest
case MouseDClick:
qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
- // fall through
+ Q_FALLTHROUGH();
case MousePress:
case MouseClick:
qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
lastMouseButton = button;
if (action == MousePress)
break;
- // fall through
+ Q_FALLTHROUGH();
case MouseRelease:
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
lastMouseTimestamp += 500; // avoid double clicks being generated
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 444da4243b..22207a9030 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -163,7 +163,7 @@ Type Moc::parseType()
case SIGNED:
case UNSIGNED:
hasSignedOrUnsigned = true;
- // fall through
+ Q_FALLTHROUGH();
case CONST:
case VOLATILE:
type.name += lexem();
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 415003e6b1..5ce28d931b 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -251,7 +251,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
}
token = FLOATING_LITERAL;
++data;
- // fall through
+ Q_FALLTHROUGH();
case FLOATING_LITERAL:
while (is_digit_char(*data))
++data;
@@ -321,7 +321,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
}
token = WHITESPACE; // one comment, one whitespace
- // fall through;
+ Q_FALLTHROUGH();
case WHITESPACE:
if (column == 1)
column = 0;
@@ -428,7 +428,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
}
token = PP_FLOATING_LITERAL;
++data;
- // fall through
+ Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
while (is_digit_char(*data))
++data;
@@ -482,7 +482,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
}
token = PP_WHITESPACE; // one comment, one whitespace
- // fall through;
+ Q_FALLTHROUGH();
case PP_WHITESPACE:
while (*data && (*data == ' ' || *data == '\t'))
++data;
@@ -1177,7 +1177,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
case PP_ELIF:
case PP_ELSE:
skipUntilEndif();
- // fall through
+ Q_FALLTHROUGH();
case PP_ENDIF:
until(PP_NEWLINE);
continue;
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 083187555d..26e7b086d9 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -335,28 +335,28 @@ static void parseCmdLine(QStringList &arguments)
switch (c) {
case 'P':
flags |= QDBusConnection::ExportNonScriptableProperties;
- // fall through
+ Q_FALLTHROUGH();
case 'p':
flags |= QDBusConnection::ExportScriptableProperties;
break;
case 'S':
flags |= QDBusConnection::ExportNonScriptableSignals;
- // fall through
+ Q_FALLTHROUGH();
case 's':
flags |= QDBusConnection::ExportScriptableSignals;
break;
case 'M':
flags |= QDBusConnection::ExportNonScriptableSlots;
- // fall through
+ Q_FALLTHROUGH();
case 'm':
flags |= QDBusConnection::ExportScriptableSlots;
break;
case 'A':
flags |= QDBusConnection::ExportNonScriptableContents;
- // fall through
+ Q_FALLTHROUGH();
case 'a':
flags |= QDBusConnection::ExportScriptableContents;
break;
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 3e5242fc9d..df55ca29f1 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -2023,7 +2023,7 @@ void WriteInitialization::addInitializer(Item *item,
const QString &name, int column, const QString &value, const QString &directive, bool translatable) const
{
if (!value.isEmpty())
- item->addSetter(QLatin1String("->set") + name.at(0).toUpper() + name.mid(1) +
+ item->addSetter(QLatin1String("->set") + name.at(0).toUpper() + name.midRef(1) +
QLatin1Char('(') + (column < 0 ? QString() : QString::number(column) +
QLatin1String(", ")) + value + QLatin1String(");"), directive, translatable);
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index ff31a7e874..57b3f47863 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1379,7 +1379,7 @@ void QMessageBox::changeEvent(QEvent *ev)
d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this));
if (d->informativeLabel)
d->informativeLabel->setTextInteractionFlags(flags);
- // intentional fall through
+ Q_FALLTHROUGH();
}
case QEvent::FontChange:
case QEvent::ApplicationFontChange:
@@ -1390,6 +1390,7 @@ void QMessageBox::changeEvent(QEvent *ev)
d->label->setFont(f);
}
#endif
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 4b5e380f4b..5492862287 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -9570,7 +9570,7 @@ public:
shape = qt_regionToPath(QRegion(mask).translated(offset.toPoint()));
break;
}
- // FALL THROUGH
+ Q_FALLTHROUGH();
}
case QGraphicsPixmapItem::BoundingRectShape:
shape.addRect(QRectF(offset.x(), offset.y(), pixmap.width(), pixmap.height()));
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1a0b417034..85bd3003e1 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2563,7 +2563,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
int section = logicalIndexAt(pos);
updateSection(section);
}
- // fall through
+ Q_FALLTHROUGH();
case QHeaderViewPrivate::NoState:
if (d->clickableSections) {
int section = logicalIndexAt(pos);
@@ -2669,7 +2669,7 @@ bool QHeaderView::viewportEvent(QEvent *e)
case QEvent::FontChange:
case QEvent::StyleChange:
d->invalidateCachedSizeHint();
- // Fall through
+ Q_FALLTHROUGH();
case QEvent::Hide:
case QEvent::Show: {
QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 31d60c06d7..1338ce4585 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1738,7 +1738,7 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value)
}
}
}
- // Don't break, but fall through
+ Q_FALLTHROUGH();
default:
if (column < values.count()) {
bool found = false;
@@ -1788,7 +1788,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const
// special case for check state in tristate
if (children.count() && (itemFlags & Qt::ItemIsAutoTristate))
return childrenCheckState(column);
- // fallthrough intended
+ Q_FALLTHROUGH();
default:
if (column >= 0 && column < values.size()) {
const QVector<QWidgetItemData> &column_values = values.at(column);
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 66b622911a..32fe5f5e64 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -450,8 +450,8 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
QApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())?
Qt::ForbiddenCursor:Qt::WhatsThisCursor);
#endif
+ Q_FALLTHROUGH();
}
- // fall through
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
if (leaveOnMouseRelease && e->type() == QEvent::MouseButtonRelease)
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 693f254de1..d0971443ba 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -8835,7 +8835,7 @@ bool QWidget::event(QEvent *event)
case QEvent::KeyRelease:
keyReleaseEvent((QKeyEvent*)event);
- // fall through
+ Q_FALLTHROUGH();
case QEvent::ShortcutOverride:
break;
@@ -8954,7 +8954,7 @@ bool QWidget::event(QEvent *event)
0, this);
break;
}
- // fall through
+ Q_FALLTHROUGH();
#endif
default:
event->ignore();
@@ -9193,7 +9193,7 @@ bool QWidget::event(QEvent *event)
}
if (windowHandle() && !qstrncmp(propName, "_q_platform_", 12))
windowHandle()->setProperty(propName, property(propName));
- // fall through
+ Q_FALLTHROUGH();
}
#endif
default:
@@ -11194,13 +11194,13 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->enforceNativeChildren();
}
#endif
- // fall through
+ Q_FALLTHROUGH();
case Qt::WA_OpaquePaintEvent:
d->updateIsOpaque();
break;
case Qt::WA_NoSystemBackground:
d->updateIsOpaque();
- // fall through...
+ Q_FALLTHROUGH();
case Qt::WA_UpdatesDisabled:
d->updateSystemBackground();
break;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 6cdfc061e1..140f0ad2f3 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -4232,7 +4232,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
switch (sc) {
case SC_GroupBoxFrame:
- // FALL THROUGH
case SC_GroupBoxContents: {
int topMargin = 0;
int topHeight = 0;
@@ -4261,7 +4260,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
break;
}
case SC_GroupBoxCheckBox:
- // FALL THROUGH
case SC_GroupBoxLabel: {
QFontMetrics fontMetrics = groupBox->fontMetrics;
int h = fontMetrics.height();
@@ -4327,7 +4325,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (numSubControls == 1)
break;
offset += buttonWidth + 2;
- //FALL THROUGH
+ Q_FALLTHROUGH();
case SC_MdiNormalButton:
// No offset needed if
// 1) There's only one sub control
@@ -4895,7 +4893,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ProgressBar:
case CT_TabBarTab:
// just return the contentsSize for now
- // fall through intended
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 44555c3058..c5904a5a96 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1100,7 +1100,7 @@ void QRenderRule::fixupBorder(int nativeWidth)
case BorderStyle_Native:
if (bd->borders[i] == 0)
bd->borders[i] = nativeWidth;
- // intentional fall through
+ Q_FALLTHROUGH();
default:
if (bd->colors[i].style() == Qt::NoBrush) // auto-acquire 'color'
bd->colors[i] = color;
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index c3a50968e2..e3bf28608c 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -808,7 +808,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
p->setPen(opt->palette.dark().color());
else
p->setPen(opt->palette.text().color());
- } // Fall through!
+ }
+ Q_FALLTHROUGH();
case PE_IndicatorViewItemCheck:
if (!doRestore) {
p->save();
@@ -2383,7 +2384,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ToolButton:
if (qstyleoption_cast<const QStyleOptionToolButton *>(opt))
return sz += QSize(7, 6);
- // Otherwise, fall through
+ Q_FALLTHROUGH();
default:
sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index ffedc37edb..f3a8544d96 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -3465,13 +3465,13 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarMinButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -3479,25 +3479,25 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
offset += delta;
else if (subControl == SC_TitleBarNormalButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarMaxButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarShadeButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarUnshadeButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
@@ -3576,7 +3576,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
if (numSubControls == 1)
break;
offset += buttonWidth;
- //FALL THROUGH
+ Q_FALLTHROUGH();
case SC_MdiNormalButton:
// No offset needed if
// 1) There's only one sub control
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 4f08664784..57db9ff7fc 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -551,11 +551,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
case QEvent::TouchBegin:
inputType = QScroller::InputPress;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchEnd:
if (!inputType)
inputType = QScroller::InputRelease;
- // fallthrough
+ Q_FALLTHROUGH();
case QEvent::TouchUpdate:
if (!inputType)
inputType = QScroller::InputMove;
@@ -669,7 +669,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
event->accept();
}
}
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchBegin:
q->setHotSpot(globalPos);
result |= scrollerIsActive ? TriggerGesture : MayBeGesture;
@@ -681,7 +681,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
#endif
if (PressDelayHandler::instance()->isDelaying())
result |= ConsumeEventHint;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchUpdate:
result |= scrollerIsActive ? TriggerGesture : Ignore;
break;
@@ -692,7 +692,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
case QEvent::MouseButtonRelease:
if (PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive))
result |= ConsumeEventHint;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchEnd:
result |= scrollerIsActive ? FinishGesture : CancelGesture;
break;
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 7aca6631cc..79e824f4b7 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 1a5b8db33c..d04ee24861 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -1058,7 +1058,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
break;
case Qt::Key_Up:
next = false;
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Down: {
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 4221ff40ef..e85d82edb8 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -933,7 +933,7 @@ void QAbstractSlider::changeEvent(QEvent *ev)
d->repeatActionTimer.stop();
setSliderDown(false);
}
- // fall through...
+ Q_FALLTHROUGH();
default:
QWidget::changeEvent(ev);
}
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index af178ce8f5..693d5f9e93 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -676,7 +676,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Down:
if (!(keyEvent->modifiers() & Qt::AltModifier))
break;
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_F4:
combo->hidePopup();
return true;
@@ -3140,7 +3140,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
return;
} else if (e->modifiers() & Qt::ControlModifier)
break; // pass to line edit for auto completion
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_PageDown:
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index e2271f3d62..5cea9a9ea2 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -2979,7 +2979,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
key_consumed = true;
break;
}
- //FALL THROUGH
+ Q_FALLTHROUGH();
case Qt::Key_Left: {
if (d->currentAction && !d->scroll) {
QAction *nextAction = 0;
@@ -3026,6 +3026,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this))
break;
// for motif, fall through
+ Q_FALLTHROUGH();
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:
#endif
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index 6db8b67820..90be22c271 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
index 5825bdb6d6..2a93250ba5 100644
--- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -61,6 +61,9 @@ struct Match
QStringList captured;
QHash<QString, QString> namedCaptured;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(Match, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(Match)
@@ -85,9 +88,9 @@ bool operator==(const QRegularExpressionMatch &rem, const Match &m)
}
}
- Q_FOREACH (const QString &name, m.namedCaptured.keys()) {
- QString remCaptured = rem.captured(name);
- QString mCaptured = m.namedCaptured.value(name);
+ for (auto it = m.namedCaptured.begin(), end = m.namedCaptured.end(); it != end; ++it) {
+ const QString remCaptured = rem.captured(it.key());
+ const QString mCaptured = it.value();
if (remCaptured != mCaptured
|| remCaptured.isNull() != mCaptured.isNull()
|| remCaptured.isEmpty() != mCaptured.isEmpty()) {
@@ -115,12 +118,11 @@ bool operator!=(const Match &m, const QRegularExpressionMatch &rem)
}
-bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator==(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
QRegularExpressionMatchIterator i = iterator;
- foreach (const Match &expectedMatch, expectedMatchList)
- {
+ for (const Match &expectedMatch : expectedMatchList) {
if (!i.hasNext())
return false;
@@ -135,17 +137,17 @@ bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Mat
return true;
}
-bool operator==(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator==(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return operator==(iterator, expectedMatchList);
}
-bool operator!=(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator!=(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
return !operator==(iterator, expectedMatchList);
}
-bool operator!=(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator!=(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return !operator==(expectedMatchList, iterator);
}
@@ -1117,9 +1119,9 @@ void tst_QRegularExpression::globalMatch_data()
QTest::addColumn<int>("offset");
QTest::addColumn<QRegularExpression::MatchType>("matchType");
QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
- QTest::addColumn<QList<Match> >("matchList");
+ QTest::addColumn<QVector<Match> >("matchList");
- QList<Match> matchList;
+ QVector<Match> matchList;
Match m;
matchList.clear();
@@ -1375,7 +1377,7 @@ void tst_QRegularExpression::globalMatch()
QFETCH(int, offset);
QFETCH(QRegularExpression::MatchType, matchType);
QFETCH(QRegularExpression::MatchOptions, matchOptions);
- QFETCH(QList<Match>, matchList);
+ QFETCH(QVector<Match>, matchList);
testMatch<QRegularExpressionMatchIterator>(regexp,
static_cast<QREGlobalMatchStringPMF>(&QRegularExpression::globalMatch),
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 1bba41816b..d0a0feb125 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -1738,9 +1738,6 @@ void tst_QSharedPointer::creating()
void tst_QSharedPointer::creatingVariadic()
{
-#if !defined(Q_COMPILER_RVALUE_REFS) || !defined(Q_COMPILER_VARIADIC_TEMPLATES)
- QSKIP("This compiler is not in C++11 mode or it doesn't support rvalue refs and variadic templates");
-#else
int i = 42;
{
@@ -1768,12 +1765,10 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->i, 2);
QCOMPARE(ptr->ptr, (void*)0);
-#ifdef Q_COMPILER_NULLPTR
NoDefaultConstructor2(nullptr, 3); // control check
ptr = QSharedPointer<NoDefaultConstructor2>::create(nullptr, 3);
QCOMPARE(ptr->i, 3);
QCOMPARE(ptr->ptr, (void*)nullptr);
-#endif
}
{
NoDefaultConstructorRef1 x(i); // control check
@@ -1809,7 +1804,6 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->str, QString("bytearray"));
QCOMPARE(ptr->i, 42);
}
-#endif
}
void tst_QSharedPointer::creatingQObject()
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 8f0f599622..a0a872710c 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -84,11 +84,11 @@ public:
template <typename MemFun>
void apply0(QString &s, MemFun mf) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); }
template <typename MemFun, typename A1>
void apply1(QString &s, MemFun mf, A1 a1) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(a1, ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); }
};
template <>
@@ -254,6 +254,9 @@ public:
};
} // unnamed namespace
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(CharStarContainer, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(CharStarContainer)
@@ -645,7 +648,7 @@ QString verifyZeroTermination(const QString &str)
} while (0) \
/**/
-typedef QList<int> IntList;
+typedef QVector<int> IntList;
tst_QString::tst_QString()
{
diff --git a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
index 54bc802cf0..fbca313ea3 100644
--- a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
+++ b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
@@ -101,8 +101,6 @@ void tst_QFontCache::engineData()
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
req.family = cacheKey;
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index adaf3b1f7a..f71d808390 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -64,6 +64,8 @@ private slots:
void aliases();
void fallbackFonts();
+ void liberationFont();
+
private:
const QString m_testFont;
};
@@ -275,5 +277,23 @@ void tst_QFontDatabase::fallbackFonts()
}
}
+void tst_QFontDatabase::liberationFont()
+{
+ QString libSans("Liberation Sans");
+ QString libSansNarrow("Liberation Sans Narrow");
+
+ QFontDatabase db;
+ if (!db.hasFamily(libSans) || !db.hasFamily(libSansNarrow))
+ QSKIP("Requires Liberation Sans installed");
+
+ QFont fontLS(libSans);
+ QFont fontLSN(libSansNarrow);
+
+ QFontMetrics fmLS(fontLS);
+ QFontMetrics fmLSN(fontLSN);
+
+ QVERIFY(fmLS.width(QStringLiteral("foo bar")) > fmLSN.width(QStringLiteral("foo bar")));
+}
+
QTEST_MAIN(tst_QFontDatabase)
#include "tst_qfontdatabase.moc"
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
index 8f8e32ed24..c7ac9641d1 100644
--- a/tests/auto/gui/text/qrawfont/testdata.qrc
+++ b/tests/auto/gui/text/qrawfont/testdata.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/">
<file>testfont_bold_italic.ttf</file>
+ <file>testfont_os2_v1.ttf</file>
<file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
new file mode 100644
index 0000000000..ee8b67d892
--- /dev/null
+++ b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
Binary files differ
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index 471b32dd50..3cf108ed62 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -93,6 +93,7 @@ private slots:
private:
QString testFont;
QString testFontBoldItalic;
+ QString testFontOs2V1;
#endif // QT_NO_RAWFONT
};
@@ -110,6 +111,7 @@ void tst_QRawFont::initTestCase()
{
testFont = QFINDTESTDATA("testfont.ttf");
testFontBoldItalic = QFINDTESTDATA("testfont_bold_italic.ttf");
+ testFontOs2V1 = QFINDTESTDATA("testfont_os2_v1.ttf");
if (testFont.isEmpty() || testFontBoldItalic.isEmpty())
QFAIL("qrawfont unittest font files not found!");
@@ -184,6 +186,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
QTest::addColumn<qreal>("pixelSize");
+ QTest::addColumn<int>("capHeight");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -207,7 +210,8 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
fileName = testFontBoldItalic;
title = fileName
@@ -221,7 +225,23 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
+
+ fileName = testFontOs2V1;
+ title = fileName
+ + QLatin1String(": hintingPreference=")
+ + QString::number(*hintingPreference);
+
+ QTest::newRow(qPrintable(title))
+ << fileName
+ << QString::fromLatin1("QtBidiTestFont")
+ << QFont::StyleNormal
+ << QFont::Normal
+ << QFont::HintingPreference(*hintingPreference)
+ << qreal(1000.0)
+ << qreal(10.0)
+ << 7;
++hintingPreference;
}
@@ -236,6 +256,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
QFETCH(qreal, pixelSize);
+ QFETCH(int, capHeight);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -246,6 +267,11 @@ void tst_QRawFont::correctFontData()
QCOMPARE(font.hintingPreference(), hintingPreference);
QCOMPARE(font.unitsPerEm(), unitsPerEm);
QCOMPARE(font.pixelSize(), pixelSize);
+
+ // Some platforms return the actual fractional height of the
+ // H character when the value is missing from the OS/2 table,
+ // so we ceil it off to match (any touched pixel counts).
+ QCOMPARE(qCeil(font.capHeight()), capHeight);
}
void tst_QRawFont::glyphIndices()
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 8d84addedb..b95a17bd4e 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -817,6 +817,24 @@ static bool testForColors(const QImage& image, const QColor& color, bool ensureP
return false;
}
+static const QList<QWidget*> sample_widgets() // returning const to avoid detaching when passing to range-for
+{
+ QList<QWidget *> widgets;
+ widgets << new QPushButton("TESTING TESTING");
+ widgets << new QLineEdit("TESTING TESTING");
+ widgets << new QLabel("TESTING TESTING");
+ QSpinBox *spinbox = new QSpinBox;
+ spinbox->setMaximum(1000000000);
+ spinbox->setValue(123456789);
+ widgets << spinbox;
+ QComboBox *combobox = new QComboBox;
+ combobox->setEditable(true);
+ combobox->addItems(QStringList() << "TESTING TESTING");
+ widgets << combobox;
+ widgets << new QLabel("<b>TESTING TESTING</b>");
+ return widgets;
+}
+
void tst_QStyleSheetStyle::focusColors()
{
// Tests if colors can be changed by altering the focus of the widget.
@@ -833,22 +851,9 @@ void tst_QStyleSheetStyle::focusColors()
" (for example, QTBUG-33959)."
"That doesn't mean that the feature doesn't work in practice.");
#endif
- QList<QWidget *> widgets;
- widgets << new QPushButton("TESTING TESTING");
- widgets << new QLineEdit("TESTING TESTING");
- widgets << new QLabel("TESTING TESTING");
- QSpinBox *spinbox = new QSpinBox;
- spinbox->setMaximum(1000000000);
- spinbox->setValue(123456789);
- widgets << spinbox;
- QComboBox *combobox = new QComboBox;
- combobox->setEditable(true);
- combobox->addItems(QStringList() << "TESTING TESTING");
- widgets << combobox;
- widgets << new QLabel("TESTING TESTING");
- foreach (QWidget *widget, widgets) {
+ for (QWidget *widget : sample_widgets()) {
QDialog frame;
QLayout* layout = new QGridLayout;
@@ -891,21 +896,8 @@ void tst_QStyleSheetStyle::hoverColors()
#ifdef Q_OS_OSX
QSKIP("This test is fragile on Mac, most likely due to QTBUG-33959.");
#endif
- QList<QWidget *> widgets;
- widgets << new QPushButton("TESTING TESTING");
- widgets << new QLineEdit("TESTING TESTING");
- widgets << new QLabel("TESTING TESTING");
- QSpinBox *spinbox = new QSpinBox;
- spinbox->setMaximum(1000000000);
- spinbox->setValue(123456789);
- widgets << spinbox;
- QComboBox *combobox = new QComboBox;
- combobox->setEditable(true);
- combobox->addItems(QStringList() << "TESTING TESTING");
- widgets << combobox;
- widgets << new QLabel("<b>TESTING TESTING</b>");
- foreach (QWidget *widget, widgets) {
+ for (QWidget *widget : sample_widgets()) {
//without Qt::X11BypassWindowManagerHint the window manager may move the window after we moved the cursor
QDialog frame(0, Qt::X11BypassWindowManagerHint);
QLayout* layout = new QGridLayout;