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>
Amends 0f985e16ba, which accidentally
dropped this flag (duh!).
Change-Id: Ie772f9e524625edfcdcda4d73a9a712fcd77f8c8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
We only used it in one location and it's no longer needed.
Change-Id: I2092313b75d4510dda12f8f6decc9652f8191301
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
[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>
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>
This is a limitation of current implementation.
Task-number: QTBUG-92107
Change-Id: Idb1543f432348e66ca20aa67a2498034c2f05fa6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>