To avoid any potential resizes during append looping
Task-number: QTBUG-119002
Change-Id: I8f4c391f05b5c5bd0b48a4f17b11996652006508
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It is somewhat common HTTP method with RESTful use cases
(partial updates on resources)
Task-number: QTBUG-114637
Change-Id: Id252d3f4b54c3ebb8df5c93259e64a4af2d0ca2f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Added to both QNetworkRequestFactory and QRestAccessManager
Task-number: QTBUG-114717
Change-Id: Ibca55bba548a034a0da7ea60550642c150b63dc2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Provide users with means to use more modern time/duration type.
Please note that since QTimer does not currently support
timeouts larger than 'int' milliseconds, the limit on how long
durations can be expressed, remains. This should not
be an issue in practice with network requests, as a typical
int32 system can express timeouts of ~24 days.
[ChangeLog][QtNetwork][QNetworkAccessManager] Add std::chrono
support for transfer timeout.
[ChangeLog][QtNetwork][QNetworkRequest] Add std::chrono support
for transfer timeout.
Fixes: QTBUG-118714
Change-Id: If85678a5994c59bac5926e47f98c9cfeb2a07c30
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
These include:
- readyRead(), signal for indicating new data availability
- bytesAvailable(), function for checking available data amount
- downloadProgress(), signal for monitoring download progress
Task-number: QTBUG-114717
Change-Id: Id6c49530d7857f5c76bd111eba84525137294ea7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The class provides a way to represent server-side service endpoints.
With RESTful applications these endpoints typically have a need for
repeating requests fields such as headers, query parameters,
bearer token, base URL, SSL configuration. This class allows setting
of the repeating parts, while allowing the setting of changing parts
on a per-request basis.
[ChangeLog][QtNetwork][QNetworkRequestFactory] Added a new convenience
class to help with the needs of repeating network request details
imposed by the server-side service endpoints, which is common
with RESTful applications.
Task-number: QTBUG-113814
Change-Id: Iabcfaed786949ffbb0ad0c75297d0db6ecc1a3cc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
New QHttpHeaders class for use in place of
std::pair<QBA,QBA>, QMap<QBA>, and QMultiMap/Hash<QBA,QBA>
to represent HTTP headers.
[ChangeLog][QtNetwork][QHttpHeaders] New QHttpHeaders class
Task-number: QTBUG-107042
Change-Id: I54766886a491acfc9a813a3414322a75011acb9d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
CMake knows about the ndk path so always pass the ndk-stack path
and not rely on the env var being set.
Change-Id: I2cfd8e0708c6b284964dc3dc85b1f080742b125d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Where a date format only gives the last two digits of the year, along
with month and day of month, the day of the week can help settle the
question of which century to use. The date-time parser has used this
for some time, rather crudely, but only considered centuries adjacent
to the default (1900 through 1999).
Refine that by using QCalendar's new matchCenturyToWeekday(). Simplify
the account of parsing now that client code doesn't have to do this
for itself.
Task-number: QTBUG-46843
Change-Id: Id054cc87ec867a2498145932d721c3368210cba0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There are various pitfalls and reasons to be wary of short formats.
Make clear what the hazards and remedies are. Expand on the existing
paragraph about the base-year for the century of two-digit years.
Task-number: QTBUG-46843
Change-Id: If7c3d13eec826671f8dce686e520a17c11572bc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It previously had to kludge a 1900-to-1999 date into a 1950-to-2049
range; it can now tell QDTP to do that for it. In particular, this
fixes a problem with 00-02-29, which failed to parse using 1900 as
base year so couldn't be corrected to 2000-02-29, which is now the
date it finds directly.
Task-number: QTBUG-46843
Change-Id: I7ac936bdfb15b78daed5d237c5d921c800af4951
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The twentieth century is now some way behind us, so using its years
when parsing a date-time format that only provides the last two digits
is increasingly likely to produce unwelcome results. Most such formats
are saved by the "redundant" presence of a day-of-week field but, for
those that are not (notably including ASN.1 date fields), there is a
need to provide some way to over-ride the twentieth century default.
Allow the caller to pass a base year to the fromString() methods, of
QDate and QDateTime, and to QLocale's toDate() and toDateTime(), that
indicates the first of 100 consecutive years, among which the two
digits given can select a year. Add some test-cases to exercise the
new API.
[ChangeLog][QtCore][QDate] When fromString() has only a two-digit year
to go on, it is now possible to set the start-year of the century
within which this selects.
[ChangeLog][QtCore][QDateTime] When fromString() has only a two-digit
year to go on, it is now possible to set the start-year of the century
within which this selects.
[ChangeLog][QtCore][QLocale] When toDate() or toDateTime() has only a
two-digit year to go on, it is now possible to set the start-year of
the century within which this selects.
Fixes: QTBUG-46843
Change-Id: Ieb312ee9e0b80557a15edcb0e6d75a57b10d7a62
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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 0f985e16ba741695182020f2c6a952f31e44c722, which accidentally
dropped this flag (duh!).
Change-Id: Ie772f9e524625edfcdcda4d73a9a712fcd77f8c8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This reverts commit d201c0a2184881a226bce76528047707e9062856.
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 76dfda1ad12cc42cdd832aed1edbe5f76b0cbb2d.
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 3c0fdd7341ed4bff9b5f041e9f4646265d142303.
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 f9b867216ba2728ff993020599f5062e2f023de1.
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 b63045477ea05c17f9abe9434e6d824453e3935a. The
fix there was incorrect for two reasons:
1) it missed one symbol in QtCore (the QFutureInterfaceBase one
added in 0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1.
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 9c03935c9a22f3f6baa602ec0ea7ce91f4a842f0.
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 4b6f757020382ed157bf6beb572549f05e881359.
Change-Id: I269bdf0cbde59d317381ccd06001e56d5b3c289a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>