Replaces our mix of comments for annotating intended absence of break
in switches with the C++17 attribute [[fallthrough]], or its earlier
a clang extension counterpart.
Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
imageReadMimeFormats and imageWriteMimeFormats had
duplicated source code.
While touching the code, do some optimizations:
- use QStringBuilder more
- replace index based loop with 'range for'
Change-Id: I174456bf4e55e030930b9b5a4aaef57c722d8f05
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
SSE2 has had a vectorized code-path for rotated sampling for a long
time, but the NEON version has been missing due to a bug in the original
commit. This patch reintroduces the NEON optimization.
Change-Id: I69d63b60faee9ebf5d69192acd680f35b9619a23
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Type punning even over a union is not legal C++, and also causes the
compilers to produce poorly performing code.
This has already been fixed for the SSE2 code in bilinear sampling but
not for the NEON code.
Change-Id: Id5e184051e0bd78db730d83ef0dda56ac3206e5b
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Replace substring functions that return QString
with corresponding functions that return QStringRef.
Change-Id: I3c485f89352a1ee66076fba74fd486da9349c354
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Instead of guessing which styles we have available (always bold/italic)
register the ones we actually find.
Change-Id: I57380d0417411456a3037f8769440e7b43517e0e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
... and mark the library with QT_NO_FOREACH.
Change-Id: I4924f1419f470b5fa92bb2f3fdefa745b65957f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Fix the occurrences where the wrong classes are mentioned.
Change-Id: Ia291af77f0f454a39cab93e7376a110c19a07771
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I5a6937545561c51add0d48a618b1921cf9201c4b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
They were masked by the pointless user-defined copy special member
functions, which we cannot remove because it would change the way
the iterators are passed by value into functions, on some platforms.
Add a reminder for Qt 6 to fix the issue for good.
Change-Id: I039093894db4a4e5e4bbf94fb346fd90311316c0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- add Q_DECLARE_TYPEINFO for types held in Qt containers (incl. QVariant)
- port Q_FOREACH to C++11 range-for
- port uses of inefficient QLists to QVector
Fixes errors pointed out by my tree's static checks.
Change-Id: I7176b4b12ed47ed23166857bd127c459ea2a48d5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The only difference between the sample widget sets was:
- widgets << new QLabel("TESTING TESTING");
+ widgets << new QLabel("<b>TESTING TESTING</b>");
I chose the latter, because it's the more complex example
and neither the hoverColors nor focusColors tests suggest
the boldness of the text matters.
Part of port away from Q_FOREACH.
Change-Id: I9a928de4e781b96ad00a8c9515977c35ebfa6c24
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Defined out-of-line, not exported, not used anywhere in QtGui,
so it can be removed.
Change-Id: Ib049bad7d02e5412c063965cd81c8d95e1c1c183
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
MakefileGenerater::Compiler is larger than a void*, so holding
it in QList is horribly inefficient.
Fix by using QVector instead.
Change-Id: I9ea173271caf9b4995d311c3864c6967da049380
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
It's empty, but non-trivial, thus preventing move special member
functions from being generated by the compiler (now that qmake
is compiled as C++11, too).
The default ctor was also empty - removed, too.
Change-Id: I714db524f681f1fc250d21926245757e97351e87
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Has a few too many fields for defining a member-swap
(which would be required to mark it shared).
Change-Id: Iecbeec9e60a9884cb4a984c58cb192918cef799d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
When adding color font support to the Freetype engine, we added
a special case to some functions based on the assumption that
color fonts do not contain the latin alphabet. The reason for
the assumption is that color fonts are currently most popular
for emojis and the most popular ones on Linux did not contain
the latin alphabet. But there is nothing special about color
fonts making them less likely to contain latin characters
than other fonts especially made for non-latin writing systems.
If we want an additional fallback when the x character is
not available, this should be implemented for all font engines
and font types.
Change-Id: I1c4aa28d49c38ba7a416c1cae50a1d1c09cbda41
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
The short-cuts in qdrawhelper's qt_alphargbblit_argb32 expects the
alpha value of the A32 glyphs to be 0xff.
Since the alpha value is not otherwise used, set it to that.
The reported image format is also changed to RGB32, matching
coretext and windows fontengines, and expected by the OpenGL
paintengine.
Change-Id: I0873156d716566f7f1634249155b6c9983a3d0de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
It's empty, but non-trivial, thus preventing move special member
functions from being generated by the compiler (now that qmake
is compiled as C++11, too).
Change-Id: I7e4b6d7f604020dd5e6da81f7a046202c8b78e09
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
It's empty, but non-trivial, thus preventing move special member
functions from being generated by the compiler (now that qmake
is compiled as C++11, too).
Change-Id: I9431311d24da802f147ce10e475936838bb85d41
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
It doesn't save any memory, generates worse code, and
prevents a member-swap from being added.
Change-Id: Iddc0f1338478e465f34076857e266f1912fbaba6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Cap height is an important metric of font, in particular it is
required to make decent implementation of "initial-letter"
CSS property in QtWebKit.
Note that some fonts lack cap height metadata, so we need to
fall back to measuring H letter height.
Change-Id: Icf69d92159d070889085e20d31f2e397d796d940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
- port Q_FOREACH to C++11 range-for
(incl. one case of iterating over QHash::keys())
- port uses of inefficient QLists to QVector
- add Q_DECLARE_TYPEINFO for types held in Qt containers
Fixes errors pointed out by my tree's static checks.
Change-Id: I30eb432528fa3008240b5c217d5f2f9ddc3679be
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
We require Q_COMPILER_VARIADIC_TEMPLATES since Qt 5.7,
so remove the non-variadic version which anyway has
zero test coverage.
Change-Id: I24dd22a798e11d797238f9209312802d1d84a672
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We require Q_COMPILER_RVALUE_REFS (implicitly used, but not explicitly
checked for) and Q_COMPILER_VARIADIC_TEMPLATES since Qt 5.7, so remove
the non-variadic version which anyway has zero test coverage.
Change-Id: Ie3658ff6ae71a66df9d35100c3d6df41f2326c80
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We require Q_COMPILER_RVALUE_REFS and _VARIADIC_TEMPLATES since Qt 5.7,
so remove the non-variadic version which anyway has zero test coverage.
Also drop #include <utility>, as that is included from qglobal.h already,
and drop QSKIP from test.
Change-Id: I1fc7f7068eac80ad6fd85e1d8f6d33c5c7bb67db
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Previously the private APIs for QTriangulator and QTriangulatingStroker
were located in src/gui/opengl because they were used by the OpenGL
paint engine. These API's are not actually specific to OpenGL however,
and were not being built when QT_NO_OPENGL was defined. It makes more
sense for these classes to belong in the painting subgroup.
Aside from the OpenGL paint engine, these private APIs are used by
QtLocation to triangulate polylines to be rendered by QtQuick.
Change-Id: Idb4d1e5b2a51394d4c6bcdf9ab1ece99de23d4de
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If an entire font family is condensed or stretched and we match by
family name, the default stretch factor of 100 will make the font
engine try to synthesize it back to medium stretched font.
The existing code is already made to deal with a stretch of 0 that is
no longer used. This patch reintroduces 0 stretch to indicate no
specific stretch has been requested. Specifically setting stretch to
100 on a QFont will introduce the old behavior.
[ChangeLog][QtGui][QFont] The default value of QFont::stretch() is
now 0 to indicate any default stretch is acceptable.
Task-number: QTBUG-48043
Change-Id: I574747f980fd4f9893df828818aae99a07b41623
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This is most likely a left over from Qt 4.
Change-Id: I5a13d31e815cf2047bcc064e9418c061ee82e58b
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
- port Q_FOREACH to C++11 range-for
- port uses of inefficient QLists to QVector
Fixes errors pointed out by my tree's static checks.
Change-Id: Ica50f44d862f635df06cb8f09ce506b9d30fdfc5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There's no sharing, and the use of QSharedPointer(T*)
triggers my tree's static analyzer.
Easiest fix is to port to QScopedPointer, which is the
correct smart pointer to begin with.
Change-Id: I105c1a334c3d6712a475600c8394b0bebc420677
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- port Q_FOREACH to C++11 range-for
(except in the Q_FOREACH tests :)
- port uses of inefficient QLists to QVector
- include QTest, not QtTest
Fixes some errors pointed out by my tree's static checks.
Change-Id: Ibb21a280537af74dda5679ec7c75d59477b6de55
Reviewed-by: David Faure <david.faure@kdab.com>
- port uses of dynamic containers with static content to constexpr
C arrays
Fixes errors pointed out by my tree's static checks.
Change-Id: I5e1cafa6e428500afae0d653ce48a7fb465c19ed
Reviewed-by: David Faure <david.faure@kdab.com>
Commit 4a40c717f3 optimized
QString::compare_helper(QChar*, int, char*, int), but got
the case wrong where the rhs is null, but the lhs is empty,
not null (which is the case even with a null QString, as
QString().constData() != nullptr). The correct result in
this case is 0, since in Qt empty and null strings compare
equal.
Fix by checking the length of lhs, not its pointer.
Task-number: QTBUG-55154
Change-Id: I3ec2cd25d9bdca90cf3f5568a875b1e52c779979
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Both were mapped to QVariant() before. Instead, use a null pointer
QVariant for a null JSON value.
[ChangeLog][QtCore][QJsonValue] QJsonValue(Null).toVariant() now returns
a QVariant of type QMetaType::Nullptr instead of an invalid QVariant.
Task-number: QTBUG-43077
Change-Id: Ife611f418583dbff542210bc8c5cd65201212a6e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Move the code from QtWidgets/QFileIconEngine into a new class with
virtuals in QtPlatformSupport so that platforms can reuse it.
Prototypically use the class in the Windows and macOS QPA plugins.
Remove QPlatformTheme::fileIconPixmap() and change the type
of the hint QPlatformTheme::IconPixmapSizes from QList<int>
to QList<QSize> so that it fits better with the icon code.
Change-Id: I580e936f3507218757565ca099272cd575b3a779
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Re-use methods of QStringRef.
Change-Id: I0f79ee6767653c694ac6a342263c046a5f5f3baa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Add a way to return an icon instead of a pixmap of a specific size for a
file for usage by QFileIconProvider, etc.
Fall back to fileIconPixmap() if fileIcon() returns a null icon.
This allows for supporting XDG theme icons and Qt Quick applications
accessing file icons.
Change-Id: I9ffbd6602e1a6a490c0046d950636447c5127474
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
That basically involves reformatting the loop to use iterators.
Change-Id: Ie8e80e7f32b386eae50ab4520c62219e18d2a1bd
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Nothing fancy, just a safety-net for a following refactoring.
Change-Id: I5be87c86cd61e24bf96881d2485dd7560ea6184a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This reverts commit 12d71f4ea2.
This change is breaking a build + incomplete as my test revealed.
Will have to re-try later.
Change-Id: I7ea089093a832aa5822caaaac56e62f5fda4df17
Reviewed-by: Liang Qi <liang.qi@qt.io>
... by using the recently-added QUtf8::convertToUnicode()
and a QVarLengthArray instead of QString::fromUtf8().
Like elsewhere in QString, use a QVarLengthArray<ushort>
instead of the more natural <QChar> to avoid instantiating
another QVLA.
Assume that length2 is usually set to a non-negative value.
Not because that's necessarily the frequent case, but
because a negative length2 leads to an expensive strlen,
that usually dwarfs the additional branch cost.
Check for data2 == nullptr early to avoid having to check
it later twice.
Change-Id: I04bda44ed857451efdf04c3283b5726480dd8c0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code depends on qApp to be visible in the scope
Change-Id: Ibeb54c90f5a65f441e9eb90b848952b955c71f0d
Reviewed-by: Jesus Fernandez <jesus.fernandez@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The class doesn't exist and should not be forward declared nor declared
as private of QDBusVirtualObject
Change-Id: Icf3ca2b2be5ae0a8111785af485a0b6601002a25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>