Commit Graph

61747 Commits

Author SHA1 Message Date
Thiago Macieira
5b6f59d6e7 IPC: QNativeIpcKey: enable the slow path
I had designed this to be fast for the common, new case of using
QNativeIpcKey objects with a key, a type and maybe in the future we'd
need a flag or two. Turns out that the very first thing I'll need is a
QString, so enable this code path.

This isn't currently exercised because it's not possible to enter it,
yet. It'll come in the next commit.

Change-Id: Idd5e1bb52be047d7b4fffffd17506af2f2de3060
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-18 11:01:51 -03:00
Thiago Macieira
d31a046956 IPC: QNativeIpcKey: use actual QUrl to format and parse the string form
Instead of pretending to be QUrl and doing a poor job at it. I'm not
going to implement QUrlQuery parsing and I'll need one option now to
store the original, legacy key.

Change-Id: Idd5e1bb52be047d7b4fffffd175068c6a82c039b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-18 09:01:50 -05:00
Antti Määttä
d5f5f1a42a CTF: Remove extraneous semicolon in metadata
Removes extra semicolon from floating point array metadata.

Pick-to: 6.5
Change-Id: If3e8b8097ff0c08c1f1f84cadbe389c7f7a2b1aa
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-05-18 14:20:02 +03:00
Matti Paaso
5379e93c65 Add Axivion analysis commands
Task-number: QTQAINFRA-5244
Change-Id: Ib577237d73863140386edce9acc2913acc9e2813
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-05-17 14:04:48 +03:00
Dennis Oberst
15eca98214 QPartialOrdering: update docs and change parameter names
Let's be more explicit with QPartialOrdering's showcase of its
functionality in the docs and define a possible function-declaration.
Also change all parameter names to lhs and rhs, respectively.

Pick-to: 6.5 6.2 5.15
Change-Id: Ibc5c0b418bff3278e10e415c7f5bfa86227fc066
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-17 10:09:18 +02:00
Antti Määttä
4dd9a27640 CTF: Use UTC date-time in metadata
Force UTC date-time and use ISO date-time. Also isMonotonic is
always true so the conditionals can be removed.

Change-Id: I7419d62ee7a526c3c6d4b7628d52d45b601e84d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-17 11:00:55 +03:00
Marc Mutz
8712e35aec QVarLengthArray/QList: make assign() return a reference to *this
While std::vector::assign() returns void, std::basic_string::assign()
returns std::basic_string&. In Qt, we want to be consistent between
{QVLA,QList,QString,QByteArray}::assign(), and returning *this is the
more general solution, so do that.

Task-number: QTBUG-106196
Task-number: QTBUG-106200
Change-Id: I2689b4af032ab6fb3f8fbcb4d825d5201ea5abeb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-17 06:44:45 +02:00
Marc Mutz
782ccc6de5 QList: re-use the prepend buffer, if any, on assign()
Task-number: QTBUG-106196
Change-Id: I62d8610529cab528ae1b114d29707133b4fc28dc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-17 06:44:39 +02:00
Thiago Macieira
06830bd78d QDnsLookup: reject looking up domain names that are too long
Both the libresolv and the Win32 API operate in 32-bit quantities, so we
could be aliasing with low values. In any case, RFC 1035 limits to 255.

    Various objects and parameters in the DNS have size limits.  They are
    listed below.  Some could be easily changed, others are more
    fundamental.

    labels          63 octets or less

    names           255 octets or less

Pick-to: 6.5
Change-Id: I3e3bfef633af4130a03afffd175e8957cd860bef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 19:31:37 -07:00
Thiago Macieira
37f1fb78ee QSemaphore: add QDeadlineTimer API
This removes the last use of QtPrivate::convertToMilliseconds().

Change-Id: I6f518d59e63249ddbf43fffd1759fee2e00d36f4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-05-16 19:13:03 -07:00
Tor Arne Vestbø
fda4da6df9 shortcuteditor example: Don't reference null-action
The parent nodes of the leaf ShortcutEditorModelItem nodes
do not have an action item.

Pick-to: 6.5
Change-Id: If9f8554101974a96f95db048b1bd691f3e89a23a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-17 00:25:40 +02:00
Tor Arne Vestbø
bc4e9e432a Fix unused variable 'FakeErrnoForThrow' [-Wunused-const-variable]
Amends ba05af82d3.

Change-Id: I979d43af3e937edd69b75c9138f1b24ebdc8fac3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-16 21:54:40 +00:00
Thiago Macieira
9cef9df822 QModelIndex: improve qHash
QModelIndex's qHash is really bad. It was retained from Qt 5, but ends
up producing poor results in large hashes.

This can't be fixed in Qt 6.

Task-number: QTBUG-113613
Change-Id: I5f7f427ded124479baa6fffd175f7810e1dc2580
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-05-16 14:54:39 -07:00
Thiago Macieira
e1c3083dad QDnsLookup: make the query() function non-static
Simplifies arguments and will allow me to add stateful helper methods.

Change-Id: I3e3bfef633af4130a03afffd175d6044829a96f2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 11:46:42 -07:00
Thiago Macieira
365af87f94 QDnsLookup/Windows: don't append domain search suffixes
The Unix code doesn't do that.

[ChangeLog][Important Behavior Changes] QDnsLookup on Windows will no
longer append the system's configured domain name for look ups that
contained only a single label (that is, no dots). This matches the Unix
behavior.

Change-Id: I5f7f427ded124479baa6fffd175f69e537cf9ca2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 11:46:41 -07:00
Thiago Macieira
eb51454b90 QDnsLookup/Unix: rework the buffer-size check code
This is neater with a simple offset and avoids the potential UB code this
was carrying in:
  p += size;
  (p < response + responseLength)

It's UB to add to a pointer a size that moves it past the end of its
array. In practice we don't expect this to happen because of
construction (p is always pointing to a heap or auxiliary-thread stack
buffer), but in theory it could happen that said buffer is too close to
the end of the virtual address space and adding `size` causes it to
overflow back to small values.

Change-Id: I5f7f427ded124479baa6fffd175f59939c15c666
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 11:46:40 -07:00
Marc Mutz
7ca633d9a8 QArrayDataPointer: add a C++20 ranges-style optional projection to assign()
This will be useful for implementing QString::assign(), which
otherwise has the problem that it's d_ptr is based on char16_t, but
it's assign() is supposed to be able to deal with iterators whose
value_type returns QChar.

Task-number: QTBUG-106198
Change-Id: I87882bf749b4e21b7b32391167962d3e6bae9983
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 20:09:40 +02:00
Dennis Oberst
bbbe5f45c4 QList: add STL-style assign()
Implemented assign() methods for QList to align with the criteria of
std::vector, addressing the previously missing functionality.

Reference:
https://en.cppreference.com/w/cpp/container/vector/assign

[ChangeLog][QtCore][QList] Added assign().

Fixes: QTBUG-106196
Change-Id: I5df8689c020dafde68d2cd7d09c769744fa8f137
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 20:09:39 +02:00
Marc Mutz
d8bdb66e82 tst_ContainerApiSymmetry: fix spacing of template <typename
This file, like the majority of qtbase, uses a space between template
and the opening of the template argument list. Add it.

Change-Id: I927cb2b1b9620ae108e913343d995373493e8981
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 20:09:39 +02:00
Edward Welbourne
d75e772e22 RSS listing example: prefer setDevice() over addData(readAll())
The network reply is a QIODevice, so the QXmlStreamReader can be set
to read from it directly, which it might potentially do incrementally,
rather than by reading all the data in one go.

In the process, change the set-up of the reply to first check that it
got a valid URL, then check it got a reply, before doing things with
that reply.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I3642e24e0d10721e4a0325b35a94dcb5dfbcd4e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-16 20:09:38 +02:00
David Edmundson
0c5135a9df Clarify documentation about QGuiApplication::setDesktopFileName format
Whislt the documentation says "base name" there are lots of examples in
the wild of clients using the wrong name here. Writing it explicitly
might help.

Task-number: QTBUG-75521
Pick-to: 6.5
Change-Id: Ic17ca161cf58449e85e25d9b6b8ace44fe14f18a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-05-16 18:09:38 +00:00
Tor Arne Vestbø
842dbca617 macOS: Detect menu bar roles for untranslated menu titles as well
If an application added an "About" menu action, and then loaded
the qtbase translations, we would try to match the incoming menu
title ("About") against QCoreApplication::translate("QCocoaMenuItem",
"About"), which since qtbase provides translation in the QCocoaMenuItem
context would fail, and we would not detect the menu item role
successfully.

For this to work, the application developer would need to add their
own translations for every menu item, and these translations would
have to match the QCocoaMenuItem translations in qtbase.

By also comparing the menu titles against the untranslated heuristics
we now account for the situation that the app has not translated
its menu items.

If the app does add translations of its menu items these still need
to match the QCocoaMenuItem context translations.

Change-Id: Ic2f019cd42b7e080187f9738840f84b0cec239df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-16 20:09:38 +02:00
Alexey Edelev
c33427240f Make sure that -utf-8 flag only apply to MSVC
INTERFACE scope propagates the '-utf-8' flag to the target dependencies.
So if Qt is built using MSVC, but the depending targets use different
compiler this flag will break the compilation.

Guard the flag using genex.

Amends e3cc2487ce63cae42d8054b38fdb54abe8545007

Pick-to: 6.5
Task-number: QTBUG-112737
Change-Id: Ie0576667108820dd61035debfc1fcc030ef3536a
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-16 19:11:11 +02:00
Volker Hilsheimer
b7c15f7f24 Remove the "classwizard" example
It adds nothing new to what the trivial and license wizard examples
show, other than a bunch of somewhat messy and outdated code to generate
C++ code files based on the input.

The example is referenced in a few parts of the documentation, but there
are equivalent snippets in the trivial and license wizard examples, so
point at those instead, and add some relevant API usage where needed.

Pick-to: 6.5
Change-Id: If1ff57e775bad28920d9e019aeccae69d1f4d127
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-16 18:33:18 +02:00
Volker Hilsheimer
11da92ba94 Convert "extension" dialog example into snippets
Pick-to: 6.5
Task-number: QTBUG-108751
Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-16 18:33:18 +02:00
Marc Mutz
cb2ff3b733 Make QGenericRunnable a private nested class of QRunnable
We don't intend to make QGenericRunnable public API, so prevent people
from using it outside QRunnable::create().

Change-Id: I49f182463ca307aaf6370adfa43bae14b4ce0df8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-16 17:55:49 +02:00
Oliver Wolff
47e63d436e Don't grab QWhatsThis background on Windows
The workaround also is no longer needed on Windows so it can be removed
completely.

This patch amends 6a28b391f7.

Task-number: QTBUG-113556
Pick-to: 6.5
Change-Id: I69155e54da26acd49faf72816d1439fb3e322de9
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-16 15:55:49 +00:00
Fabian Kosmale
3cee2f1950 q20chrono: Fix feature test macro check
While the comment behind the else already had the correct value, the
actual check and the comment behind the endif had the wrong one. This
would cause build /headers clean check failures when using older
compilers in C++20/2a mode.
Also, remove the check for __cplusplus: A sufficiently high enough value
of __cpp_lib_chrono already implies __cplusplus > 201703L; the only
thing the check did was to hide the issue on more modern compilers.

Fixes compilation with e.g. gcc 9.3.
Amends bde5eeecaf

Change-Id: I74e761d9dc4048e9abf9cea9ea7e63260ea1111e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-05-16 17:55:49 +02:00
Volker Hilsheimer
8e94af2ed0 Revamp the shapedclock example
Rename it to "Translucent Background", as that's what the example shows
how to do. And modern applications shouldn't use a (binary) mask to
create shaped windows. Instead, set the TranslucentBackground attribute,
don't paint pixels that should be fully transparent and use anti-aliased
or semi-opaque painting for pixels that should be translucent.

Adjust the example and documentation accordingly. Move the statment that
widget masks create coarse visual clipping to the QWidget::setMask
documentation.

Pick-to: 6.5
Change-Id: Id49d854093f2cb471afb178d32723081c7543543
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-05-16 13:37:38 +02:00
Volker Hilsheimer
322387ce7b Accessibility: call update handler even if not active
Update handlers should get informed about accessibility updates even if
the platform's accessibility bridge is not activated. E.g. an analytics
or test framework (like Qt Insights) might want to use the handler to
record relevant events.

While many events are only delivered if QAccessible::isActive returns
true to avoid spending computing time on creating the relevant event
data (e.g. in item views that can be expensive), the most important
events are still delivered. And requiring activation of accessibility
before events can be recorded through a handler has side effects on
performance, which we want to avoid.

Change-Id: I896b873574f6ad2527f755912d4950aa1f898097
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-05-16 13:36:20 +02:00
Fabian Kosmale
fd565750f3 qoffscreensurface.h: Add module to Q_MOC_INCLUDE
Depending on the build configuration, just using <QScreen> will not find
the header.

Pick-to: 6.5
Fixes: QTBUG-113619
Change-Id: Iaaf6f75ce82f8e32a1b1835614accd898b45824e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-16 10:47:21 +02:00
Thiago Macieira
5f5daae04a QHash: suppress GCC 12 & 13 warning that QHash could overflow
It can't unless you really have so many elements that it should
overflow. When growing, we call bucketsForCapacity(), which won't
overflow; when copying/detaching, we allocate the exact same amount of
memory that we've previously allocated, so that has to be good too.

There was nothing wrong with the previous code. The warning was showing
how the compiler had detected a possible overflow and caused a call to
operator new(-1) to force std::bad_alloc to be thrown. Disabling the
warning did not work in LTO mode. So we mimic it: Q_CHECK_PTR will call
qBadAlloc() for us if exceptions are enabled, or qt_check_pointer() if
not but assertions are (if neither are, then we have no means of
reporting the error, so let's just assume that it can't happen).

In function ‘allocateSpans’,
    inlined from ‘__ct ’ at qhash.h:581:48,
    inlined from ‘detached’ at qhash.h:596:20,
    [...]
qhash.h:551:19: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]

Commit 1d167b515e is the likely source of
this warning.

Fixes: QTBUG-113335
Pick-to: 6.5
Change-Id: Ieab617d69f3b4b54ab30fffd175bb8d36228209c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-05-15 18:18:01 -07:00
Thiago Macieira
1acbcc318a QHash: centralize the span allocation
Deduplicates code and will allow me to insert some magic.

Pick-to: 6.5
Task-number: QTBUG-113335
Change-Id: Ieab617d69f3b4b54ab30fffd175bb4a2af610ff8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-15 18:18:00 -07:00
Volker Hilsheimer
c6540cb6e4 Doc cleanup: remove old gettingStarted tutorial, move doc file
The Qt getting started tutorial is based on the "notepad" example files
in this directory, the gettingStarted/gsQt files are completely unused
and not referenced in documentation.

Pick-to: 6.5
Change-Id: If8caebd2c8359c81f94f72ef40a1cf92a021a83f
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-15 23:54:01 +02:00
Thiago Macieira
0cb46b25f3 QDnsLookup/Unix: modernize with qFromBigEndian
Instead of explicit code.

Change-Id: I3e3bfef633af4130a03afffd175d515f846a629a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-15 14:54:00 -07:00
Thiago Macieira
25869c0aad QDnsLookup/Unix: do skip DNS records that aren't of class IN
There's nothing saying the server can't supply those to us, so let's
explicitly skip them. The Windows version already does this because the
windns.h API only supports records of class IN.

Test for this after setNameserverPort() is added.

Pick-to: 6.5
Change-Id: I3e3bfef633af4130a03afffd175e6ddc756c91c5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-15 14:54:00 -07:00
Volker Hilsheimer
c113a7a796 QTabBar: Add testcase for tabs not scrolling
Verify that changing a tab's text doesn't scroll.

Fixes: QTBUG-45381
Task-number: QTBUG-113140
Pick-to: 6.5
Change-Id: I02ace9d3fcaa20d8ff5d87ccca5d96a4114b0fb0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-05-15 21:03:00 +02:00
Thiago Macieira
48b6c8503a QProcess/Unix: enable setChildProcessModifier for startDetached
Do this by making the actual child-execution code common between
startProcess() and startDetached(). It does mean we've moved the chdir()
operation from the child to the grandchild process, though.

[ChangeLog][QtCore][QProcess] The modifier function set with
setChildProcessModifier() will now also be executed when the process is
started with startDetached().

Change-Id: Icfe44ecf285a480fafe4fffd174d9aa57dd7dfff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-15 19:10:03 +02:00
Thiago Macieira
fb40737b0d QProcess/Unix: improve the error message if the child modifier throws
Functionality added for 6.5, but after translatable string freeze.

Change-Id: Icfe44ecf285a480fafe4fffd174d984c5349e0cb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-15 19:10:03 +02:00
Thiago Macieira
ba05af82d3 QProcess/Unix: protect against stack unwinding in the child process stub
There are two types of stack unwinding that can happen on Unix systems:
C++ exceptions and PThread cancellations (on some systems, like Linux,
PThread cancellations can be caught in catch(...) statements). We call a
variety of PThread cancellation functions from inside the child stub,
like close(). To avoid problems, we disable PThread cancellations
completely before fork() or vfork().

The C++ exception case is simpler, because we can be sure of catching
them with the catch (...) statement and simply transform them into an
error message. This is also testable, which the PThread cancellation
isn't.

The error message isn't ideal because we're string-frozen. I'll improve
it for 6.6.

Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d97a475c93ff1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-15 10:10:03 -07:00
Ahmad Samir
d2242c353f MOC: pass the erroneous Symbol as an arg to Parser::error() overload
We already know the Symbol while parsing, passing a reference to it to
error() makes it simpler to construct the error message.

This fixes an issue where reporting an error about "NONSENSE" in e.g.:
Q_PROPERTY(Foo* foo NONSENSE foo)

would be off-by-one and the error message would say:
path/to/file.h:11:1: error: Parse error at "foo"

instead of 'at "NONSENSE"', which is where the parser actually found an
unexpected attribute.

Fixes: QTBUG-36367
Pick-to: 6.5
Change-Id: Ief70e544af41f7575fbeea9b936fa8197c3ef43d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-15 19:20:21 +03:00
Volker Hilsheimer
328680b34b Update screenshot example
Refresh screenshot of the example, and remove "Example" word from title.

Pick-to: 6.5
Change-Id: I88c00db5b25536c45622bc580a9da5aaf01610bc
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-05-15 18:20:21 +02:00
Tor Arne Vestbø
6a28b391f7 Don't grab QWhatsThis background on non-Windows platforms
The logic was introduced in 186589abd48b17fdb9b631211008753e2d1701b3
due to Windows supposedly not supporting NoSystemBackground. It's
not clear whether this is still the case, but as this workaround
causes problems on other platforms, such as bringing up the screen
capturing permission dialog on macOS, it should be limited to Windows.

Fixes: QTBUG-113556
Pick-to: 6.5
Change-Id: I197adb5fc177faebc0f2fcd28612e3daa0c22ed5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-15 18:20:20 +02:00
Ahmad Samir
c4ce22ef24 QEventDispatcher/WASM: fix a lambda name
It's returning milliseconds not nanoseconds.

Change-Id: I7dbc3f4043694b6ddf87c6ad9e4d20d3a9af0fd1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-15 17:21:22 +03:00
Edward Welbourne
30b9c3a135 Shrink the CBOR dumper example's image
Apply optipng -o7 -zm9 -strip all to the image to make it more compact.

Change-Id: Iebfc1f767759b5beac47bd7efa61d1c655163f03
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-15 15:51:01 +02:00
Tor Arne Vestbø
08f85c27bb Darwin: Use direct runtime interface to manage autorelease pools
The Objective-C runtime supports autorelease pools via a language
specific ABI supplement, akin to the “Itanium” generic ABI for C++.

 https://clang.llvm.org/docs/AutomaticReferenceCounting.html#runtime-support

These interfaces are used by NSAutoreleasePool internally, as well as
inserted by the compiler when using the @autoreleasepool syntax in
Objective-C code.

We have our own wrapper, QMacAutoReleasePool, which allows us to
set up pools in C++ code as well. We now use these lower level
interfaces in the implementation, instead of NSAutoreleasePool,
as this reduces overhead due to not needing to allocate and destroy
a NSAutoreleasePool.

This also opens up the possibility of using Automatic Reference Counting
(ARC) in Qt down the road, as explicit NSAutoreleasePool usage is forbidden
in that mode (while @autoreleasepool is not, and uses the runtime ABI
internally as before).

Change-Id: I06fdb4a24ae4972820f866e0a129a1b355bc8a6b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-15 15:51:01 +02:00
Tor Arne Vestbø
7cf7e88417 Darwin: Disable QMacAutoReleasePool tracker unless explicitly enabled
There's a few orders of magnitude of overhead using QMacAutoReleasePool
with the tracker enabled, so disable it even for debug builds, unless
explicit auto release pool debugging has been enabled via the environment
variable QT_DARWIN_DEBUG_AUTORELEASEPOOLS.

Pick-to: 6.5
Change-Id: Iec00c703eb21e1914903954cfd02f9f6b1ec2a1f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-05-15 15:51:00 +02:00
Tor Arne Vestbø
59c686080d Darwin: Disable QMacAutoReleasePool tracker in release builds
It adds overhead that is noticeable, especially in tight loops that
rely on an auto-release pool. For example, this improves the QLocale
date to string transformations an order of a magnitude.

Task-number: QTBUG-104785
Pick-to: 6.5
Change-Id: I246dc4e114bd75dd4e3e9e42b061c4c20c94d522
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-15 15:51:00 +02:00
Tor Arne Vestbø
e95f03f989 Darwin: Remove QMacAutoReleasePool heap allocation detection
This is handled by the Objective-C runtime nowadays, where it will
abort if the situation is detected, with the option to break on
objc_autoreleasePoolInvalid to debug the situation.

Pick-to: 6.5
Change-Id: Idf2c4aacc77e41a3deebf270303f4f13cfb0819b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-15 13:51:00 +00:00
Volker Hilsheimer
f4b338833e Move the addressbook tutorial into manual tests
The tutorial is building an elaborate UI around a QMap. It doesn't use
structured data, and it doesn't use model/view (which the dedicated
addressbook example in itemviews does).

It's not a good way of building an application, and the individual APIs
for creating layouts, dialogs, or import/export are explained well
enough in other examples.

Pick-to: 6.5
Change-Id: Iffe47a0f6e04a933edb917c877ae845f50b74b4a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-15 14:52:17 +02:00