Commit Graph

64755 Commits (b8fac538032cee6eb6f4e5dcbb5a31485bb59e46)

Author SHA1 Message Date
Edward Welbourne b8fac53803 Add QCalendar::matchCenturyToWeekday()
This takes a YearMonthDay and a day-of-the-week, returning a QDate
that (if possible, else invalid) has the given day of the week and
differs from the YearMonthDay only in the century. This is useful when
resolving dates with only two-digit year information, which can be
disambiguated by the day of the week. Added tests of the new API.

This adds a new virtual method to QCalendarBackend, for which that
base class does provide a brute force implementation, so derived
classes do not need to add implementations. It is, however, a
binary-incompatible change for any backend plugins that may be in use
to implement custom calendars.

Worked out the details for the Gregorian calendar to make it possible
to compute the right century (and whether any century works) without
trial-and-error searching. Coded that up as its implementation of the
new method.

[ChangeLog][QtCore][QCalendar] Added a matchCenturyToWeekday() method
for use when resolving dates given day, month and last two digits of
the year, along with day of the week. Any custom calendar backend
plugins shall need a recompile and may, optionally, implement the new
virtual method behind this.

Change-Id: I6003c8d9423d6bfb833957bb5120f2d423219c7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-08 11:40:36 +01:00
Kai Köhne c5864a96a6 headersclean: Re-add zero-as-null-pointer-constant warning
Amends 0f985e16ba, which accidentally
dropped this flag (duh!).

Change-Id: Ie772f9e524625edfcdcda4d73a9a712fcd77f8c8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-08 10:40:33 +00:00
Marianne Yrjänä 65081c67f3 Revert "OpenSSL: remove support for 1.1"
This reverts commit d201c0a218.

Reason for revert: QNX have support only for OpenSSL1.1.
QNX will start supporting OpenSSL3 with upcoming QNX8.0 but as long as we want to support QNX7.1 (and even QNX7.0) removing OpenSSL1.1 support from Qt is not an option.

Change-Id: Ia2083eda318779968eb6ee84fff2f56ebe3dadf7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-12-08 06:10:51 +00:00
Marc Mutz e240f559e4 QUrlQuery: drop the qpair.h include
[ChangeLog][QtCore][Potentially Source-Incompatible Changes] qurlquery.h
no longer includes qpair.h (for qMakePair).

Change-Id: I593ca3fee5f330992b46170bb660b1b33a663428
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-08 03:18:32 +01:00
Volker Hilsheimer c0b1eaaaaa QFont::Tag: use new comparison helper macros
Task-number: QTBUG-104111
Change-Id: Id57b075d00e657c2606b6c1a8f1215ed0d067cbd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-08 03:18:32 +01:00
Marc Mutz cd39a469a9 Add tests for CompactStorage
They're too trivial for their own QTestLib-based approach, but we
don't want them in the header, either, reducing the compile times for
all users, so put them into an otherwise empty .cpp file.

Change-Id: Iae7fc4d4a29a0648b91752040854288e02da7045
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-08 04:18:32 +02:00
Marc Mutz b6ff86e556 corelib/CMakeLists.txt: restore lexicographical order of SOURCES
Amends 8d367dec15.

Pick-to: 6.6 6.5
Change-Id: Ia1fd819ebabf6df143c06f56624365d3e37fa1c9
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-08 02:18:32 +00:00
Rym Bouabid 4fa9f13397 Make QAtomicScopedValueRollback public API
Move the private header to public.
Make documentation a part of public interface.

[ChangeLog][QtCore][QAtomicScopedValueRollback] New class.

Task-number: QTBUG-115107
Change-Id: I6c9f5448e74a5b62f4d97ee079944f4b1b731121
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-08 02:24:41 +01:00
Lorn Potter d784c14d10 wasm: prevent native mobile keyboard from popping up always
also fix misspelled 'inputMode' which seems to work.
we need to re focus to the canvas when window is raised
which will automagically close the native keyboard
when user clicks on non edit area.

Fixes: QTBUG-101404
Pick-to: 6.6 6.5
Change-Id: Iced9abc7b23e079b1060d2474a139aa653a8ca01
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-12-08 09:22:33 +10:00
Marc Mutz a5bcb41678 tst_bench_QImageReader: add a benchmark for raw QFatoryLoader operations
This is Eirik's QtCore-only QTBUG-114253 reproducer added to the
nearest fitting existing benchmark.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Iba68bedebae908af497267860e2b230db269787e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-12-07 22:55:08 +00:00
Marc Mutz 6c60117d01 tst_QString: explain TransientDefaultLocale better
A default-constructed QLocale gets initialized with the
currently-active default locale, and apparently retains that setting
henceforth. That is why the `prior` member is not explicitly
initialized, which is confusing at face value.

Explain the mechanism better, and explicitly default-initialize the
member, so the next reader of the code saves the time to research
this.

Amends 76dfda1ad1.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I1d1171f8564c70a971938b92b809f63ba5637d3a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-12-07 23:55:08 +01:00
Marc Mutz f395934419 QTest: Extract Method writePrettyUnicodeChar from toPrettyUnicode
Easier to reason about by separating the concerns into separate
functions.

Pick-to: 6.6 6.5
Change-Id: I34666766ac2879577faea17bbd2b700bcb803f51
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-07 23:55:08 +01:00
Marc Mutz 0a86a77e5f tst_containerapisymmetry: remove the extra push_back
... and make sure it cannot happen again by using Extract Method to
let the compiler do the counting between the resize and the
sequence-of-push_back alternatives, because this author clearly can't.

Amends 3c0fdd7341.

Pick-to: 6.6 6.5
Change-Id: If18f30d60f556e5e668876a38423f3e519fb79b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 23:55:08 +01:00
Marc Mutz 9dd1953218 QByteArray: bring end() into idiomatic form
For contiguous containers, end() is always begin() + size(), so use
that instead of data() + size().

Centralizes what it means to be an iterator in just begin() now, which
will simplify a follow-up commit of Thiago's.

Pick-to: 6.6 6.5
Change-Id: I53ca1a335910bdea3d46b9496ba39bc1a2d3fd93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:55:07 +01:00
Marc Mutz 72422d7d1b QString::indexOf(): fix UB (signed integer overflow) in negative from handling
The `from` value is not constrained, so the code must be able to
handle all values, incl. `Min := numeric_limits<qsizetype>::min()`.

But the result of negating `Min` is not representable in qsizetype, so
it's UB to try.

Fix by multiplying both sides by -1 (which flips the relational
operator).

This works because the size() of a string is always non-negative, and
the negation of all such values is representable in the same type. Add
a comment to avoid a "fix back".

Amends f9b867216b.

Pick-to: 6.6 6.5
Change-Id: I10d2e400b86f07a6a6c0a61080a27f41a16b3517
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:55:07 +01:00
Marc Mutz 8f44ec2e48 QUrlQuery: s/QPair/std::pair/
They're literally the same, QPair is an alias for std::pair, so this
is both SC and BC.

Also port from qMakePair to std::make_pair, so we can later drop the
qpair.h include (not done here to avoid breaking 6.6/6.5 users
relying on this transitive include for qMakePair().

Pick-to: 6.6 6.5
Change-Id: I593ca3fee5f330992b46170bb660b1b33a663427
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-07 23:55:07 +01:00
Marc Mutz 9d54b5c57e QDebug: remove QPair streaming docs
QPair _is_ std::pair. If this wasn't a fake-definition under #ifdef
Q_QDOC, the compiler would have complained long ago.

Pick-to: 6.6 6.5
Change-Id: Idfe589ff13115d3d908572a17b849f634ec86787
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:55:07 +01:00
Thiago Macieira db991cb4e1 QBitArray: replace the member operator~ with a hidden friend
Which takes the array to be inverted by value, so we get free move
semantics and allowing us to perform the negation in-place.

[ChangeLog][Potentially Source-Incompatible Changes] The bitwise AND,
OR, XOR, and NOT operator functions on QBitArray are now hidden
friends. This may cause source-incompatibility in unusual coding styles
(like 'array.operator~()') or with classes that have a casting 'operator
QBitArray()'.

Change-Id: I85b3fc2dd45c4693be13fffd1795ba1fbaf23769
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 14:55:07 -08:00
Thiago Macieira 9b176281df QBitArray: refactor operator~() to write to an uninitialized buffer
No functionality change otherwise.

Change-Id: I85b3fc2dd45c4693be13fffd179627b2747c132b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 14:55:07 -08:00
Thiago Macieira 9323351695 Re-do the namespace fix for the linker scripts
This amends and corrects b63045477e. The
fix there was incorrect for two reasons:
1) it missed one symbol in QtCore (the QFutureInterfaceBase one
   added in 0f0371c830.
2) it only worked for namespaces that were 15 characters long

Instead, just use a wildcard where the namespace should be for Qt
symbols (note: an extra wildcard appears for plain types because they go
from <N><type> to N<N><namespace><N><type>E).

Pick-to: 6.6
Change-Id: Iae41eb8991e349ceb836fffd179d6e709d6632f8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2023-12-07 14:55:06 -08:00
Marc Mutz 40592d38f8 QSpan: add some C++20 reminder code comments
Change-Id: I1cd698bde290cbd37d13103cd6832a739d9c548b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:38:15 +01:00
Marc Mutz 03e78e5d62 Long live QSpan as public API!
Provide qspan_p.h as backward-compatibility header.

[ChangeLog][QtCore][QSpan] New Qt equivalent of std::span.

Fixes: QTBUG-115022
Change-Id: I1cc27dc0aa1f7406f0a41d7a75f176cd7f858feb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 22:38:15 +00:00
Marc Mutz 5885db33e3 QSpan: fix an MSVC warning-turned-error:
qspan_p.h(35): error C2220: the following warning is treated as an error
  qspan_p.h(35): warning C4245: 'initializing': conversion from 'int' to 'const size_t', signed/unsigned mismatch

Add an explicit (functional-style) cast to silence it.

Pick-to: 6.6
Change-Id: Id29fda3def1c60415b3e0fe72eaf82c8bc57d363
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:38:15 +01:00
Ievgenii Meshcheriakov d3860918ea QDBusConnectionPrivate: Close connection after failed q_dbus_bus_register()
The connection should be closed before executing
q_dbus_connection_unref(). Failing to do so results in an assertion
inside libdbus:

    dbus[1573958]: The last reference on a connection was dropped
    without closing the connection. This is a bug in an application.
    See dbus_connection_unref() documentation for details.
    Most likely, the application was supposed to call
    dbus_connection_close(), since this is a private connection.

The q_dbus_bus_register() may fail if maximum number of active
connections for a bus was reached. This can be tested by creating
a custom bus with "max_completed_connections" parameter set to 0.
Add such a test to tst_qdbusconnection.

Fixes: QTBUG-34613
Change-Id: I6ae7df19bf8b6546c2a504931ba852dc15d35f78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:36:15 +01:00
Marc Mutz c39fff0da5 Add missing <=> 0 operator to Qt ordering types
It's required by the standard, see e.g. [1] and the eel.is links in
the code.

[ChangeLog][QtCore][QPartialOrdering] Added three-way comparison
operator (<=>) against literal zero, available when compiling in C++20
mode.

[1] https://en.cppreference.com/w/cpp/utility/compare/partial_ordering#Comparisons

Change-Id: I8a3b76661400930c6e247cf5b138ff52bf784395
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz ccd0dc7f6d QPartialOrdering: add lower-case flags for std/Qt:: compatibility
The misspelt flags (Less, etc) make it hard to use QPartialOrdering
interchangably with Qt or std ordering types, e.g. in generic code.

[ChangeLog][QtCore][QPartialOrdering] Added a set of lower-case flags
(::less, ::greater, etc) to improve source-compatibility with
{Qt,std}::partial_ordering.

Change-Id: I160600c01c4a2ab72c7b217a306d08045e363578
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz 07ed8acdf9 QPartialOrdering: add missing conversions to/from Qt::_ordering types
Since QPartialOrdering is supposed to be a drop-in-replacement for
Qt::partial_ordering, it need to have the same conversions from
Qt::_ordering types that Qt::partial_ordering has.

Fix by adding the necessary conversion and relational operators and
conversion constructors.

Change-Id: Ib8e78c850b43c8bcb3bb15c5f7d25be9d0da7339
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz 1576d70e44 Qt ordering types: unify the form of the implicit conversion operators
The case statements I used when de-pessimising these functions were
pretty long, bumping against line-length limitations and annoying the
reader with overly long repetitive type names.

Add aliases to fix both issues, and also apply the form to
QPartialOrdering's operator std::partial_ordering for consistency.

I was kinda hoping that this would allow to DRY away some of the
repetition with macros, but it didn't work out in the end. It's still
a lot more pleasant to the eye, so don't let the experiment be for
nothing.

Amends 9c03935c9a.

Change-Id: I9786ae5c7be0b8fb30e4df219f1c65b2e8589904
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:14 +01:00
Marc Mutz a0ae96e3e7 QPartialOrdering: add missing conversion from std::{weak,strong}_ordering
QPartialOrdering is suppsed to be a drop-in replacement for
std::partial_ordering, so it has to be convertible from all
std::_ordering types.

It was, however, only convertible from std::partial_ordering, and two
user-defined conversions in a row are not allowed.

Add the missing constructors. They, in turn, can then delegate to the
partial_ordering constructor.

Change-Id: I085d95677b258b4a61aabfd5468c1c43c2212766
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:14 +01:00
Marc Mutz 39c7bf4631 qcompare.h: move QPartialOrdering to the end of the header
This makes sure that everything in-between will not accidentally come
to depend on QPartialOrdering. It also makes it much easier to
centralize the conversions to/from Qt::_ordering types in the
QPartialOrdering class, keeping the newfangled clases clean of legacy.

I should have done it this way to begin with... Mea culpa.

Amends 4b6f757020.

Change-Id: I269bdf0cbde59d317381ccd06001e56d5b3c289a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:14 +01:00
Ivan Solovev 3d231e27a8 Long live qCompareThreeWay()
qCompareThreeWay() is a top-level wrapper around the helper
three-way comparison methods, which is mostly convenient for
generic client code.

When implementing compareThreeWay() for Qt types, we normally
provide the implementation only for (LeftType, RightType) pair,
but not the reversed one.
However, it is expected that qCompareThreeWay() would be available
for both combinations, because the reversed result can be easily
calculated.
Solve it by providing a helper hasCompareThreeWay<LT, RT> variable
and branching the implementation based on its value.

The noexcept check is inspired by the old implementation of qSwap().

[ChangeLog][QtCore] Added qCompareThreeWay() as a public API for
three-way comparison.

Task-number: QTBUG-104113
Change-Id: I6f24494d968c336f3dcdf620004b4190769cbdb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 23:36:14 +01:00
Christian Ehrlicher 7cb25eb33c QIconLoader::actualSize(): respect entry.scale on returned size
entryForSize() might return an entry with a scale != 1 (e.g. when
requesting the actual size for 32x32 it might return an entry with
size=16 and scale=2) but the returned size is not multiplied with this
scale so it returns a wrong size and in the case of QTBUG-114849 to a
wrong painting rect.

Pick-to: 6.6 6.5
Fixes: QTBUG-114849
Change-Id: I311e7401e61425efb20b37d13cc95c4b22d47e76
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-07 23:04:59 +01:00
Rym Bouabid 4b666553b8 Add documentation for the private API QAtomicScopedValueRollback
Task-number: QTBUG-115107
Pick-to: 6.6 6.5
Change-Id: Icdb09d803f1d789b91ae5c1806470d71adb59067
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 23:04:59 +01:00
David Redondo a2ff329d2e Introduce a configure feature for Wayland
Using the presence of the wayland-client lib as a condition.

Fixes: QTBUG-117386
Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 23:04:59 +01:00
Mårten Nordheim 6866e6f2fa Remove QT_MAKE_UNCHECKED_ARRAY_ITERATOR
We only used it in one location and it's no longer needed.

Change-Id: I2092313b75d4510dda12f8f6decc9652f8191301
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 22:56:30 +01:00
Joerg Bornemann a0c9fc6758 CMake: Add a way to pass additional arguments to win/macdeployqt
[ChangeLog][CMake] Added the DEPLOY_TOOL_OPTIONS argument to the
functions qt_generate_deploy_app_script and
qt_deploy_runtime_dependencies.

It doesn't make sense to map every option of the deployment tools to
arguments in our CMake deployment API. Allow the user to specify
extra arguments to windeployqt or macdeployqt.

Task-number: QTBUG-116551
Change-Id: I4cc67ab03f19101b695281e8c80f8af825bab7f6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-12-07 22:56:30 +01:00
Alexey Edelev ea3289460b Make sure that the result variable is empty in _qt_internal_collect_buildsystem_targets
Add the inside-recursion marker to the
_qt_internal_collect_buildsystem_targets function and reset
the result variable only in the top-level function call.

Amends 1c82e92202

Pick-to: 6.5 6.6
Change-Id: I34b1e1edbb8a799900b95f67b80151b372073d2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-07 22:56:30 +01:00
Ievgenii Meshcheriakov c4d598b35b QDBus: Document that calls to local objects are never asynchronous
This is a limitation of current implementation.

Task-number: QTBUG-92107
Change-Id: Idb1543f432348e66ca20aa67a2498034c2f05fa6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 22:56:30 +01:00
Volker Hilsheimer 9bbfdd6844 QIcon: turn platform engines on by default
They are used when an icon is constructed via QIcon::fromTheme, unless
an application-defined theme provides the requested icon. Update the
documentation.

For now we don't provide a way to "opt out". This might change,
depending on the feedback during the Qt 6.7 beta phase.

[ChangeLog][QtGui][QIcon] Qt now has implementations of native icon
engines for macOS, iOS, Windows 10, Windows 11, and Android. These
engines provide access to the native icon libraries and fonts, mapping
standard icons to the corresponding native icon asset. Icons from
application-defined themes take precedence, but the last-resort fallback
icon passed as the second parameter into the
QIcon::fromTheme(QString, QIcon) overload is only used if the icon is
not available from the native library. See the QIcon documentation for
details.

Change-Id: I618e5c137c40f8e6309c0e4d4219a5a2759a475d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 16:43:17 +00:00
Ievgenii Meshcheriakov 850fe6bea5 tst_qdbuslocalcalls: Remove casts to int in arguments to QCOMPARE
Those casts serve no useful purpose. Not having them results in
a slightly cleaner output.

Change-Id: If8ce1c680ce6f80a15534f9f4fe6d19d137f6443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 17:43:17 +01:00
Joerg Bornemann c29029c4cd CMake: Fix generation of target deployment information
The _qt_internal_write_target_deploy_info function doesn't clear its
result variable, which is why we had left-over elements in the targets
variable. Some of these left-overs have a target type that's not
compatible with TARGET_RUNTIME_DLLS, leading to the CMake error:

    Objects of target "lib1" referenced but is not one of the allowed
    target types (EXECUTABLE, SHARED, MODULE).".

Fix this by clearing the targets variable initially.

Fixes: QTBUG-119792
Change-Id: I921aa2f0af72638ed0ed7434450a43c66c1fc9f1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-12-07 16:35:25 +01:00
Eskil Abrahamsen Blomfeldt 2e154ac020 Fix setting variable axes on Freetype
Amends 7bc6f4ae8e.

Some refactoring caused a bug in the conversion from floating
point to the 16.16 fixed point values expected in Freetype. We
now need to do this conversion when passing the value to Freetype.

Task-number: QTBUG-117839
Change-Id: Iebec81adc26b27adf0661422a3f0534e6766d683
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-07 12:53:59 +01:00
Tasuku Suzuki 2e3b4fc53e Fix build with -no-feature-process
androidtestrunner uses QProcess

Task-number: QTBUG-105524
Change-Id: If12eb011bbfb9848593657f86aa78b49309080e7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-12-07 20:53:49 +09:00
Volker Hilsheimer 12694cfc16 QIcon: clean up Windows and Android icon engines
Use good old QString for the list of glyphs, and just render what we
get. The use case where we need to draw multiple symbols on top of
each other is (for now) academic, and we can support emojis just with
QString. Proof the latter point by mapping "banana" to the respective
emoji.

Change-Id: I8005a99f015e6eb2a2a635f9d892163f2008a673
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-07 12:39:06 +01:00
Volker Hilsheimer dcfd68c827 QIcon: Clean up documentation
Structure the overview documentation a bit more around the different
ways to create a QIcon (from resources or theme). Replace the use of
QIcon::pixmap with a call to QIcon::paint in the example widget, and
tighten the High-DPI documentation a bit.

This does not add any mentioning of the upcoming "native icon library"
support.

Change-Id: I9cc7eab1fb5d134e5119660b534c2efdb0b03730
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 12:39:06 +01:00
Volker Hilsheimer 7be14ea88b QIcon: use (some) ThemeIcon constants in the Apple engine implementation
Change-Id: I4976bf3b6a389ad772cad9dfa768ab3447c6771c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 12:39:06 +01:00
Volker Hilsheimer 5f1fffc00e QIcon: add theme icon constants
Add a list of constant string literals for a subset of icons from the
freedesktop specification. Those are icons we document to support today,
and that users might have written themes for.

Omit icons that are mime types (we have Q(Abstract)FileIconProvider
and QPlatformTheme::fileIcon for that), the "flag-aa" icon (where 'aa'
is an ISO 3166 country code, and Face* icons. Flags and Face icons can
be added as supported QIcon constants, but should then be rendered as
emojis from the respective font (they are not provided by any of the
native icon libraries or icon fonts).

We use string constants instead of an enum so that we have the same code
path for icon constants, user-defined icons, and native icons. I.e. in
addition to QIcon::fromTheme(QIcon::ThemeIcon::EditCopy), code can
request the icon for "trash.circle.fill" on Apple platforms, or
or for U"\ue5cd" on platforms where the engine is font-based; or an app
can define their own icon name and provide the assets through a theme-
description, as before.

The downside is that we cannot use arrays for looking up the native icon
for an enum-value in the engine implementations, but given that icons
are cached this is an acceptable trade-off.

To make the list of icon contants more manageable, have them in a
separate header file. Since we want those constants to live in the QIcon
"namespace", we then include that header in a declaration of a nested
struct, "ThemeIcon", resulting in e.g. QIcon::ThemeIcon::EditCopy.

Change-Id: Ic20e36ab321e6c4b20806ec0b400bba13fffc983
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 12:39:06 +01:00
Volker Hilsheimer 8988c92b98 QIcon: fall back to QPA engine if themes don't provide the icon
If the QIconLoaderEngine (which respects theme and fallback theme) does
not provide the icon, then try the QIconEngine provided by the
QPlatformTheme implementation of createIconEngine. If that provides the
requested icon, then use it; otherwise keep using an QIconLoaderEngine.

Clean up the logic of that code a bit, while maintaining the invariant
that we need to return a valid QIconEngine pointer.

[ChangeLog][QtGui][QIcon] If neither theme nor fallback theme provide
the requested icon, we fall back to the QPA plugin implementation. On
platforms where an implementation exists, this will override the
explicitly provided fallback (second parameter to QIcon::fromTheme).

Change-Id: Idbf9ed049f5e975e1fbcdbb30dbdf6eac08e5827
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 12:39:06 +01:00
Tinja Paavoseppä 2ed64adb9f Android: Skip focusProxy_QTBUG_51856() test case temporarily
Running the test case leads to multiple calls to show the software
keyboard, which due to Android QPA implementation leads to the
keyboard being shown during subsequent test cases, leading to
random failures. Skip it temporarily on Android until the
Android QPA implementation is fixed.

Task-number: QTBUG-119574
Change-Id: I29f234fe08cb33358cb5cb0f8e51b1cc0f8e8906
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-12-07 10:56:43 +02:00
Tinja Paavoseppä 97625e84b1 Android: Skip showAndMoveChild() test case temporarily
grabWindow() currently returns a null QPixmap on Android due to even
raster windows being backed up by OpenGL/QRhi. The test case uses
grabWindow() internally to grab contents to a pixmap and comparing
whether the pixmap contents are as expected, leading now to failures
due to null QPixmap being returned.

Task-number: QTBUG-118849
Change-Id: I51cda2d43fe482252d5604f6b18281d810aa4d2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 10:56:43 +02:00