Commit Graph

61312 Commits

Author SHA1 Message Date
Tor Arne Vestbø
920bcc0946 macdeployqt: Detect debug dylibs, not just debug frameworks
A debug dylib has a binary name like libQt6Core_debug.6.dylib

Pick-to: 6.5
Change-Id: I54a7a7017b880c734777d0738acf46c19689148d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-05-05 19:05:08 +02:00
Tor Arne Vestbø
760f99bfa8 test: Don't remove macdeployqt test directory when debugging test
Pick-to: 6.5
Change-Id: If0e6f836638d8ddb6b0d6c2be6ae4dd09b76eb7a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-05-05 19:05:08 +02:00
Tor Arne Vestbø
e36082dcdc test: Pass -use-debug-libs for macdeploy test when built as debug
As this is a strong indication that Qt was also built in debug.
Otherwise the test will fail locally for a debug build.

Pick-to: 6.5
Change-Id: I5f494017f1d89f4076ccaca89aaa67738ef405a9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-05 19:05:08 +02:00
Tor Arne Vestbø
da7b6cb83d Add debug logging to macdeployqt test
Preparation for debugging failures in the 6.2 branch

Pick-to: 6.5 6.2
Task-number: QTBUG-112892
Change-Id: Ib6428fb86be834c84be361a848c0f1306bfc2637
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-05 19:05:07 +02:00
Volker Hilsheimer
61e0671681 QSlotObject helpers: add testcoverage for std::function
Change-Id: I503c627c77eaab7d2e3456f23b55fdfcdc94c0ea
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-05-05 18:07:11 +02:00
Assam Boudjelthia
ac8a39c416 Android: fix content url handling of filenames with spaces
The Android APIs expect the content url filenames to have
percent encoded spaces, so handle that internally, if missing,
under the content file engine.

Fixes: QTBUG-112663
Pick-to: 6.5 6.2 5.15
Change-Id: Ieb2ee41a2587f985b589ca54b88f1cff89992154
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-05-05 17:40:46 +03:00
Marc Mutz
b6d5d419cc QObject: simplify ImplFns of Q(Private)SlotObjects
Drag the cast out of each case to before the switch.

DRYs the code.

Pick-to: 6.5
Change-Id: I117cc5d38379a11e9852fba61794fa59dc24a30f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-05 13:53:44 +02:00
Marc Mutz
3c4743c66c Future-proof QGenericRunnableHelper
Collapse the two function pointers into a single one, taking an Op
enum. Add a possible return value (void*) and extra argument (also
void*). The intent is to allow extensions in a BC way,
e.g. cloning. We can't add new function pointers (sizeof changes), so
we need to fold everything into a single function.

Change-Id: Id0f3f74149c61e4e65622aeabfd2fcea3c6d7fb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-05 13:53:44 +02:00
Piotr Wierciński
fb2fccc534 wasm: Add DOM accessors functions through NativeInterface
Expose document and clientArea emscripten objects through
NativeInterface.
This is required by WebView implementation for wasm platform.

Task-number: QTBUG-75183
Change-Id: I6f2f084a9dbceb80d2186c7395c008f268a91e39
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-05 12:27:36 +02:00
Kai Köhne
a1f7fb73c2 Doc: Fix links to QDomDocument::setContent()
Mark the deprecated signature as overload. Otherwise qdoc
does not know which method to link to in case of \l setContent().

Pick-to: 6.5
Change-Id: I48a4cee39cd870c960decf0bc1bb9b6dffcbbd70
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-05 10:55:27 +01:00
Eskil Abrahamsen Blomfeldt
2bd610ed12 Update download location for Harfbuzz as well
This amends 151287fb51.

qt_attribution.json now has the download link for the
Harfbuzz version used. It was for the wrong version
before, but now it should be correct.

Pick-to: 6.5 6.5.1
Task-number: QTBUG-113352
Change-Id: If79f6a814d909e687c8371aa0948b11b88f3d14b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-05 10:22:05 +02:00
Antti Määttä
fa67cd0334 Use boolean to indicate QTableWidgetItem is header item
QTableWidgetItem uses additional enum flag ItemIsHeaderItem which has
the same numerical value as ItemFlag ItemNeverHasChildren.
This causes conflict since the user can set the latter flag using
the setFlags, while the ItemIsHeaderItem is only used internally
to mark header items.

Remove the additional flag and use boolean instead to fix the conflict.

Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113209
Change-Id: Icff549c7e452d9f84575a524361719204817274e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-05 05:28:19 +00:00
Volker Hilsheimer
2434573f5e QTabBar: don't overshoot when scrolling right
Amends ca15f650a1, after which scrolling
right to fill any gap might have resulted in overshooting to a negative
scrollOffset.

When we scroll right to fit the current tab, then we never want to end
up with a negative scroll, so clamp the result accordingly.

Augment test case accordingly. Since some styles align the tab bar in
the center, replace the calculation of the scroll offset with access to
the private data member (which inverts the sign when compared to the
calculated value).

Task-number: QTBUG-113140
Fixes: QTBUG-113376
Pick-to: 6.5 6.5.1
Change-Id: Ibdc6686b9dbd41b1ae3560e2227fa121d9b20e18
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-04 19:58:50 +00:00
Thiago Macieira
275e0e48a9 Deprecate Q_ASSUME
No replacement provided because we didn't agree on how to do it. But the
current implementation is bad (with GCC, at least), so tell people to
stop using it.

[ChangeLog][Deprecations] The Q_ASSUME macro is now deprecated. Do not
use it in new code and consider removing it from existing code.

Change-Id: Idd5e1bb52be047d7b4fffffd175322ee3402756b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-04 16:58:49 -03:00
Thiago Macieira
c98d70ef7b QMutex: remove unused tst_QMutex forward declaration
Commit d4b206b246, which split
QRecursiveMutex from QMutex and thus rewrote a lot of the tests, removed
the friendship, but not the forward-declaration.

Pick-to: 6.5 6.2
Change-Id: I6f518d59e63249ddbf43fffd1759d28f1547ec9f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 19:41:48 +00:00
Volker Hilsheimer
6ef5e186a9 Simplify invokeMethod implementations using QSlotObject helpers
Remove duplication for overloads covering member function pointer
or function pointer cases, as those are now covered by the new
QtPrivate::makeSlotObject helper.

Change-Id: Ife1e05416958e40a4759ca06cf7db185031b8a86
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-04 19:40:33 +02:00
Mårten Nordheim
a443b5f2ec Update public suffix list
The removed testdata is no longer valid because their entries were
removed from the list.

Fixes: QTBUG-113339
Pick-to: 6.5 6.5.1
Change-Id: I34bd56394ab3c0ef2f930d5b21c3fe1089262dbd
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-04 17:40:33 +00:00
Marc Mutz
3fda04644a QRunnable: Extract Method warnNullCallable()
The warning doesn't depend on the template argument, so factor it into
an out-of-line Q_DECL_COLD_FUNCTION. This will automatically mark the
is_null check as [[unlikely]], too.

As a drive-by, use printf-style qWarning() (expands to less code and
doesn't require #include <qdebug.h>).

Change-Id: I9ac2d912eb1d4f3d1d9b41d77700bed6d6850b0a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-05-04 19:40:33 +02:00
Marc Mutz
f7d1dc0eee tst_qthreadpool: expect a warning, cleaning up the test run
Change-Id: Ie9944d05e7afe5740ed10eef39c2df9281985002
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-05-04 19:40:32 +02:00
Volker Hilsheimer
a43ca591c1 Fix hiding in QComboBox when there is no selection
If there is an effect on the selected item we want to show it,
but if there is no item to highligh we just close the combo.

Fixes: QTBUG-113311
Pick-to: 6.5
Change-Id: I287af75d27e6f6ff969e4706e16cc8c4812129ea
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-04 19:40:32 +02:00
Øystein Heskestad
3dd3268ded Revamp DOM Bookmarks example
Fixes: QTBUG-111974
Pick-to: 6.5
Change-Id: Ia62eaf36f616278e49112884db8aec37e2b1dcc5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2023-05-04 17:30:04 +00:00
Mårten Nordheim
4bf82909f1 Make tst_QFont::italicOblique failures easier to debug
It fails locally for me on Lucida Calligraphy.
Lucida Calligraphy only has one style though: Italic.

Change-Id: I42442cb922132a00f09084cef9c739196a9a53c2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-05-04 15:05:18 +02:00
Allan Sandfeld Jensen
0e7e1c3396 Take move-only functions for the threadpool
We never copy the function so only need it to movable. Moves the
functions to templates using the new QRunnable create version.

[ChangeLog][QtCore][QThreadPool] Methods taking callable functions,
can now take move-only lambdas.

Fixes: QTBUG-112302
Change-Id: I2cb200f0abcf7e0fdbef0457fe2a6176764ad93d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 15:05:18 +02:00
Ievgenii Meshcheriakov
1403b63a57 QtDBus: Convert QDBusMetaTypeId into namespace
There are no member variables in this private struct, so it can
as well be a namespace.

Change-Id: I397b9680ee70e17d780db9de33ad44a00ac7792a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 15:05:17 +02:00
Ievgenii Meshcheriakov
08a37f9cee QtDBus: Use non-textual version of QMetaObject::invokeMethod
Use type-checked version for better run-time performance and
compile-time type checking.

Change-Id: I92c97d162137770bc373e28fa8e4e115ac5533e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 15:05:17 +02:00
Ievgenii Meshcheriakov
6f05e91695 QtDBus: Replace some text-based singnal-slot connections
Use type-checked connections for better run-time
performance and compile-time type checking.

This excludes connections to private slots that are
not trivial to replace.

Change-Id: I97f591dba880f8d09c73565f2b5555524f6ab4a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 15:05:16 +02:00
Edward Welbourne
5a3784bba3 Flip string comparisons in savegame example
This follows up to commit 9834e80833,
fixing an accidental flip to the meaning of keywords on the
command-line. If the first word is "load" we should load a prior game,
not start a new one; if the second is "binary" we should use CBOR, the
binary format, not JSON.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: If29070777daf68f2f959bc1ec4ffd67ba90b28ba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 15:05:16 +02:00
Edward Welbourne
b1379d34dd Add a distant-future local-time-type to tst_QDateTime
It turns out glibc stops varying DST changes past where a 32-bit
signed day-count from 1970 reaches (which, all things considered, can
hardly be called a bug, for all that it's ...), at odds with QTZ's
extrapolations from the current IANA DB rules. As the last date QDT
can represent happens to be in the opposite side of everyone's DST
from the one that leaves zones in, this lead to the 2038
local-time-type not reliably being useful for predicting the max-date
behavior. So add a distant-future time-type that probes beyond glibc's
cut-off, and have relevant tests check that instead of the 2038 one.

Change-Id: If4e244d80fe2447da3bb9d5c406808c6c22c0a73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
89febde32f tst_QDateTime: rework initialization of local-time-types
There's no need to check the year or day-of-month (which involve
calendrical calculations) when we can perfectly well just check the
Julian Day number that's implied by the day-number parameters to
setType(), which could just as well return the LocalTimeType to be
assigned to the relevant parameter instead of doing the setting
itself. With that rearrangement, making it into a private static
method, the members it's used to initialize can then be const and
initialized during construction.

Change-Id: Ib7d295c3fbb9b90652952627456cdfb6176b8119
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
7d75039482 Make default local time a static const
QDateTimeParser::fromString(), when parsing a date-time, uses the
start of 1900, in local time, as its default date-time. (This is a bad
choice and steadily getting worse.) This turns out to be somewhat
expensive for some client code, so make it a static const so that we
only compute it on the first call, as for getM{in,ax}imum().

The potential downside is that a change to system time zone won't be
reflected in this value. However, any sane parse-format should require
over-writing all fields of this initial value, in any case, so the
issue is less severe for this default value than for the existing
getM{in,ax}imum() statics.

Change-Id: Iacfd827fe76c4e5fbdc5e5b6efefed13bc673af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
4c93b9c1d0 Refactor QGregorianCalendar::julianFromParts to return std::optional
It's a private static used to optimize internal use, so we can freely
get rid of its out parameter this way.

Change-Id: Id62612987f10ecbbd9702610fd172286adbfd442
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:07 +02:00
Edward Welbourne
22909abeae Split out a helper function for QLocalTime
Packaged calls to QGregorianCalendar::julianFromParts(), to convert a
struct tm's date fields to a Julian Day number: the tmToJd() function
hopefully makes it clearer what's going on.

Change-Id: Icdbd9d4d915a053ab49dabee645582523ac826c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:07 +02:00
Alexey Edelev
4fa6cd8cea Normalize paths using std::filesystem::weakly_canonical
std::filesystem::weakly_canonical resolves symbolic links in paths.
This allows syncqt to work with paths that are symbolic links and
real paths.

Fixes: QTBUG-113295
Pick-to: 6.5
Change-Id: Ie7478b4accf279e8abf9f3849d18807cee99f085
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 12:53:23 +02:00
Amir Masoud Abdol
a0923d5d3a Resolve symbol ambiguity when building with Unity Build
In unity build, we may get `error: reference to 'detail' is ambiguous`
between the `detail` namespace defined in `qpropertyprivate.h`, and
`qflatmap_p.h`. For now, this causes an issue during the compilation of
`qcalendar.cpp` and it may occur in other places where qflatmap is
included.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ie4bbb66543d26a5db58488e924333d98ce0adebf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 12:53:23 +02:00
Marc Mutz
038c1c5978 QString/QByteArray::op>>: don't assume clear() makes the container isNull()
This is something we may want to change at some point, so be explicit
and assign a null container instead of relying on clear().

Add a comment that was present in the QString, but missing in the
QByteArray implementation.

Pick-to: 6.5
Task-number: QTBUG-31283
Task-number: QTBUG-60745
Change-Id: I10d82b8a0c67fff314af526c7b7e0f247c3405fd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-05-04 12:53:23 +02:00
Eskil Abrahamsen Blomfeldt
151287fb51 Update harfbuzz to version 7.2.0
Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113352
Change-Id: I134f5b49c2ae5bef31edfc5cd87f0ff62d6c18b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-04 11:48:29 +02:00
Volker Hilsheimer
1af36eb230 Doc: fix warnings in QTimer
Amends recent changes that added std::chrono support by making
the duration type of QTimer::singleShot a template parameter.

Change-Id: If3b5f0ad99304cb292412bb8467ba6852e47654f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 10:33:27 +02:00
Allan Sandfeld Jensen
178c123a6f Match deadcode elimination with cpu feature check
We check for Haswell, so don't just check for AVX2 when removing
possible dead-code.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-113315
Change-Id: Id341aebcef99065f4b6a96ad0f60b9de40ed55ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 10:33:26 +02:00
Marc Mutz
fd6ecd8561 Q{Any,Utf8,}StringView: fix docs of generic Container ctor
For QAnyStringView, the docs were missing completely.

For QUtf8StringView and QStringView, they weren't updated following
the rewrite of the std::basic_string ctors into generic Container
ones.

Amends 9e1dc1e8a9 and
2c9529e158.

Pick-to: 6.5 6.2
Task-number: QTBUG-112746
Change-Id: I6eef2294db01e35f1a085df7fc76c25c6003530d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 07:07:08 +02:00
Lorn Potter
263e0b899f wasm: Fix permissions
Trying to get a tracks list on a MediaStream without setting
the src will generate an error in the callback and
muck up the permissions handling.

Pick-to: 6.5
Fixes: QTBUG-112901
Change-Id: Ide3a7336597fd0a08764e303dcc8f58755ba915d
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-04 13:01:35 +10:00
Tor Arne Vestbø
5c05eb3ea0 macOS: Don't clam to support action messages from non-Qt menu items
As described in 3bedeb837e, the way
menu items on macOS are typically set up they have an action, e.g.
copy:, but no target, and the system then takes care of finding the
right target at runtime, starting with the first responder, walking
the responder chain, and then moving on to other NSWindows, before
ending up in the NSApplication and its delegate.

As we (still) don't have a mechanism in Qt to forward generic
actions, such as the cut/copy/paste, or selectAll, so we rely on
mapping the actions back to QCocoaNSMenuItem that we can trace
back to a QPlatformMenuItem that we in turn emit activated() for.

Normally this works fine, but in the case where the Qt app is embedded
in a native UI, which has its own menu items with cut/copy/paste,
we'll get callbacks into QNSView for actions triggered by a generic
NSMenuItem.

In that case, we need to bail out, but we want to do so in a way
that lets AppKit continue to walk the responder chain. This is
possible by implementing supplementalTargetForAction:sender:,
where we have access to the sender. If sender doesn't match
the expected QCocoaNSMenuItem we let AppKit find a better match
up the chain.

Since the target we return needs to ultimately respond to the
selectors and/or forward them, we can't point the target back
to ourselves, nor can we point it to the application delegate
directly, as the menu items need to be validated in the context
of the view, so a new per-view QNSViewMenuHelper class has been
added to take the role of forwarding the menu actions.

The logic for forwarding the resulting actions to the application
delegate has been simplified and hardened a bit as well.

A possible scenario with this new approach is that the Qt app
has a line edit focused, and the user tries to activate the
menu item for Paste, but the item is grayed out because we
can not support the action. This is of course confusing for
the user, but less so than having an active menu item that
then doesn't do anything when activated.

Another scenario is that a responder later in the chain does
respond to the paste action, and the menu item will end up
pasting into something that is not the first responder.
This might also be confusing for the user, but it's generally
recommended that implementers of actions like paste only
allow the action if the view is the first responder, and
this is something views have to deal with anyways, so it
doesn't change anything that we're now bailing out earlier
in not accepting the paste.

One benefit of allowing AppKit to find a better target for the
action is that if no target is found, and the user presses the
key equivalent of the disabled menu item, the key event will
be delivered as a normal keyDown to our QNSView, which we do
forward, allowing the Qt app to respond to the action, even
though the action came from a generic menu item. With our old
approach this would not happen, as we would claim to support
the action for our QNSView, but then drop it on the floor when
AppKit tried to deliver it to us.

Change-Id: I609db42df6a107a49e287f435e8808812c83d43e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-04 01:03:52 +02:00
Friedemann Kleint
7d542e1daf Brush up the container code snippets
- Bring iterator loops into a consistent form using auto and
  creating and end variable, use cbegin()/cend() where suitable
- Use (std::)endl instead of Qt::endl for iostreams
- Fix removed container conversion API (QList::fromSet, QSet::toList())
- Use range-based for instead of foreach
- Use initializer lists
- Use qPrintable(QString) for output to std::ostream
- Use qsizetype
- Remove some unused snippets

Complements f6b137bdc4.

Pick-to: 6.5
Change-Id: I8a167099cdb224f45b984fa834d46269144a7ef0
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 01:03:51 +02:00
Ahmad Samir
5c71312ba3 Suppress a redundant GCC warning
The test is accessing an out of bounds index into an array on purpose.

Change-Id: I23cce4093fdfabd177eb34639f26fcd6752c8b34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 02:03:51 +03:00
Marc Mutz
87e90a265f QVarLengthArray: simplify / optimize assign(It, It)
After many failed attempts at addressing my dissatisfaction with the
if (n) checks, I finally realized that the problem is the

    while (first != last && end != end())

loop, which, when exited, gives no indication as to _why_ it was
exited. Any attempt to re-construct the exit condition must needs
re-check something that should be known already.

To fix, then, use a while (true) loop and react on first == last and
dst == end() separately.

As a drive-by, cache end().

Task-number: QTBUG-106200
Change-Id: Ic873774451df4102163e6e65d93c35e5dcbbb037
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-03 20:13:25 +00:00
Marc Mutz
5a3ac484db savegame ex.: revamp the way we (de)serialize JSON
JSON, unlike, say, QDataStream, allows building up objects independent
of some central object, and combining them into a QJsonDocument
later. This suggests returning QJsonObjects from a toJson() const
method instead of having the caller supply a QJsonObject. Doing it
this way enables transparent move semantics to kick in, too.

For deserialization, use a fromJson() named constructor for value-like
classes (where identity doesn't matter, only equality). Keep using
read(), too, and add a note to explain when to use which form.

Also, avoid the triple lookup from

   if (json.contains("key") && json["key"].isSoughtType())
      mFoo = json["key"].toSoughtType();

by using C++17 if-with-initializer and showing the trick with
Undefined never being of isSoughtType():

   if (const QJsonValue v = json["key"]; v.isSoughtType())
      mFoo = v.toSoughtType();

Adjust the discussion to match the new code, up the copyright years
and rename some qdoc snippet markers from nondescript [0]/[1] to
[toJson]/[fromJson].

Task-number: QTBUG-108857
Pick-to: 6.5 6.4 6.2
Change-Id: Icaa14acc7464fef00a59534679d710252e921383
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 21:36:14 +02:00
Tobias Koenig
a7d92f809f Schannel: Remove deprecated SCHANNEL_CRED based code path
Since the required minimum version of Qt is Windows 10 (1809),
the deprecated SCHANNEL_CRED code path to initialize TLS
connections can be removed and the SCH_CREDENTIALS based
path is used for all connections.

Change-Id: I2aef919a45373e55ae96405b7c6f2264378f4464
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 19:36:13 +00:00
Thiago Macieira
6d30e7da3d QProcess: remove the note that it freezes threads on QNX
The notes were added in commit e3363fd945
by Rafael, because at the time QNX 6.5.0 did not support fork() in
multithreaded applications. We had to use posix_spawn(3) and that
doesn't support setting the child's working directory, so we needed to
freeze the application while chdir(2)ing in doSpawn().

doSpawn() was removed in commit 005a8bfbf0
for Qt 5.7, because fork() works since QNX 6.6.0. But the comments were
accidentally left behind.

Fixes: QTBUG-112990
Pick-to: 5.15 6.2 6.5
Change-Id: I3b169860d8bd41e9be6bfffd17577276eaabb855
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-03 11:40:37 -07:00
Amir Masoud Abdol
edabd36cbb Introduce QT_ALLOW_SYMLINK_IN_PATHS flag
`QT_ALLOW_SYMLINK_IN_PATHS` disables the
`qt_internal_check_if_path_has_symlinks` command. This allows people of
Homebrew to get their build working without having to patch the entire
function, as they currently do.

Pick-to: 6.5
Change-Id: I4fed3ca497684364eaabbdbc44f1e148e3f28bd7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-05-03 19:44:45 +02:00
Dennis Oberst
4d404c2936 QVarLengthArray: remove unnecessary exception check
The previous check for a non-throwing copy constructor at:

    if constexpr (IsFwdIt && noexcept(T(*first)))

is not necessary as std::uninitialized_copy provides strong exception
safety.

Additionally, change the phrasing of the overload-resolution \note,
since we're not requiring C++20 std::input_iterator, but the older
C++17 definition.

Amends 7cbdc8abbd.
Amends 2457dd8bd0.

Change-Id: Ie36c8d70dc61aa8cc2a30c9d4110d1beb0d1c2fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-03 15:07:13 +00:00
Volker Hilsheimer
6e2bba71bb Pass functor through as references until stored
Amends 642f799fc6 to avoid unnecessary
copies in between the calls to the QFunctorSlotObject construcotr. We
can't use a univeral reference in the QFunctorSlotObject constructor
as the call is not deduced. So provide two overloads for lvalue and
rvalue references instead.

The compile check in the test now no longer fails as we delay the
storage until one level later, but that's acceptable.

Change-Id: Ide95b4a73c70f6f47698dd1e95138aa5d48ee95d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 14:02:28 +02:00