Commit Graph

45221 Commits

Author SHA1 Message Date
Amir Masoud Abdol
3431aeafc0 Resolve symbol conflict between qmutex_unix and qwaitcondition_unix.cpp
In `qmutex_unix.cpp`, renamed `report_error` to `qt_report_error`; and
in `qwaitcondition_unix.cpp` renamed `report_error` to
`qt_report_pthread_error`. In addition, I removed the temporary
exclusion of the qwaitcondition_unix.cpp from unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia411bf1d8ca77512cf3898acb28b37f343ff94fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-19 09:20:16 +02:00
Ahmad Samir
393e496385 Moc/Symbols: fix narrowing conversion warnings
- Port to qsizetype
- Use range-for/algorithms instead of index-based loops

Drive-by changes:
- Methods defined in-class are implicitly "inline"
- Make two methods const (saves using std::as_const in one place), and
  there is no reason why they are not const
- For consistency initialize members in-class / in constructor init-list

Pick-to: 6.5
Change-Id: If7f1546625028cbe13339430977b19952fedbd42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-18 22:39:38 +03:00
Ahmad Samir
d413917eb3 Moc: fix some narrowing conversion warnings by using reverse iterators
And de-duplicating some code.

Pick-to: 6.5
Change-Id: Ibfb581cd296a120ff8328ae672020cc36ca5d328
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-18 22:39:30 +03:00
Ahmad Samir
976c3615a3 Moc: fix some narrowing conversion warnings by using range operations
I.e. range-for and in one case QList::append(iterator, iterator).

Drive-by changes:
- Check a QByteArray isn't empty before using at()
- Shorten a long line, QString::fromLocal8Bit() works with QByteArray

Pick-to: 6.5
Change-Id: I7e54ce39f65ccb1fe5e60693ac98e239b9f0d794
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-18 22:39:25 +03:00
Ahmad Samir
5c7702a8f9 moc/utils.h: fix a narrowing conversion warning
By taking a qsizetype, and using std::all_of.

Pick-to: 6.5
Change-Id: If81465194d92d04af637b0032d9504d6524893aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-18 22:39:20 +03:00
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
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ø
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
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
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
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
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
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
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
Ievgenii Meshcheriakov
a035e8b768 QDBusMetaObjectGenerator: Use uniform loops to iterate over methods
Use the same structure for iterating over signals and other
methods in 3 places. Introduce MethodMap type alias to make
types shorter.

Change-Id: I732b582fc8c47616037087b77a79eb13ecf17019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-15 14:02:47 +02:00
Ievgenii Meshcheriakov
0f37c47713 QtDBus: Convert some loops to ranged for loops
Convert some loops that are using Java-style iterators into
ranged for loops for better readability.

Change-Id: I14f6339608d201fe06a753be236db52815cbf5c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-15 14:02:47 +02:00
Edward Welbourne
4768fcf836 Fix case-sensitivity of exponent separator check in Cyrillic fall-back
When matching the locale's correct exponent separator, QLocale was
doing a case-insensitive match; but the Cyrillic fall-back was
matching case-sensitively, so failed to catch the case of lower-case e
and its Cyrillic equivalent, when used in a Cyrillic font in place of
the upper-case form of the other, where that's the locale's official
separator. So make this comparison case-insensitive.

Added some test-cases for the lower-case exponential separator.

Pick-to: 6.5
Fixes: QTBUG-113443
Change-Id: I18e22d7b3451fbb61e87d5b93661eadff3c7356e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-15 14:02:47 +02:00
Edward Welbourne
7337474d04 Convert remaining QT_NO_XMLSTREAM* to use feature system
Replace the check in qxmlstream.h with a QT_REQUIRE_CONFIG since the
code that includes this header does no checking, whether on the define
or the feature, so is better off getting told about the missing
feature at the point of include than complaining about an undefined
type despite its header being overtly included.

For the rest, just do the usual transformation to QT_CONFIG(),
flipping the ones that were #ifdef rather than #ifndef, so the
condition is positive. Shifted a couple of open-braces of classes to
the next line, where they belong, in the process.

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