Commit Graph

62288 Commits

Author SHA1 Message Date
Thiago Macieira
13a1995e9d QProcess/Unix: add a few, basic session & terminal management flags
Doing setsid() and disconnecting from the controlling terminal are, in
addition to resetting the standard file descriptors to /dev/null, a
common task that daemons do. These options allow a QProcess to force a
child to be a daemon.

QProcess ensures that the operations are done in the correct order.

Change-Id: I3e3bfef633af4130a03afffd175e9451d2716d7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-08 15:03:23 -07:00
Volker Hilsheimer
8f1df9aaa8 QProcess on QNX: only expect failure if there is one
The QProcessunixProcessParameters sometimes fails in CI with an XPASS.
Unclear under what conditions QNX behaves correctly, so accept that it
is unpredictable and only expect a failure when a failure is imminent.

Amends f9c87cfd44.

Change-Id: Icf70861343747e6323c7953a2462b7bbc46549b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-09 00:03:23 +02:00
Christian Ehrlicher
7a732413ff QtSql: Stylistic fixes based on the Qt 6.6 api review
Amends 12909d7c3d and 0efd8854c4.

Pick-to: 6.6
Change-Id: Id7cb7377bcd1f32092330d2fc5b2fa5b83ce941f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-08 18:34:10 +00:00
Axel Spoerl
25f7d95fce tst_QDialogButtonBox::hideAndShowButton: Wait for focus widget
Spin the event loop with QTRY_VERIFY when checking the dialog box's
focus widget, to stop flaking.

Pick-to: 6.6 6.5
Change-Id: I24fab1264796e05645da4c12e4672daec9b06067
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-08 17:16:54 +02:00
Giuseppe D'Angelo
04f2acf93a qtpaths: generate proper JSON
The "manual" generation left a trailing comma in the object definition.
This is illegal, as per RFC 8259:

      object = begin-object [ member *( value-separator member ) ]
               end-object

Hence, the resulting JSON does not get accepted by any parser.

Let's just not do that and use QJsonDocument.

Change-Id: I882486e55f66c52d142638f37584088091bbc123
Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-115124
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-07-08 10:50:41 +02:00
Thiago Macieira
7c25358144 Remove QGenericAtomicOps
Commit c5b816393d ("Get rid of
bootstrapped atomics", 6.5) removed the last use of them.

Pick-to: 6.6
Change-Id: I53335f845a1345299031fffd176f52293e4b9752
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 17:11:36 -07:00
Andrius Štikonas
25b4bd5841 QStorageInfo: Correctly decode backslash in file system labels
At the moment labels such as "one\two" are incorrectly
decoded as "one\x5ctwo".

Backslashes were originally excluded after Thiago Maciera's review,
see commit 8f1277da8c.

Now Thiago agrees that original reasoning for excluding backslash
was incorrect and we do want to decode them.

Pick-to: 6.5 6.6
Change-Id: I8f13fc678b40a7a9474a0171c50e3e221dfe85c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-07 23:38:18 +00:00
Christian Ehrlicher
4b7b5edf26 SQL/SQLite: add case folding for non-ascii characters
SQLite does not provide a proper case folding for non-ascii characters
due to a lack of a proper ICU library. Therefore add an option so Qt can
do it for SQLite.
[ChangeLog][SQL][SQLite] Add new option
QSQLITE_ENABLE_NON_ASCII_CASE_FOLDING for correct case folding of
non-ascii characters.

Fixes: QTBUG-18871
Change-Id: Ib62fedf750f05e50a581604253cf30d81e367b42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-08 00:08:44 +02:00
Michael Weghorn
98e4e992fe a11y macOS: Report selection/Bridge QAccessibleSelectionInterface
On macOS, support NSAccessibilityProtocol's accessibilitySelectedChildren
method [1] by retrieving the selected children via the
QAccessibleSelectionInterface introduced in commit
9d16d5e224.

This e.g. makes a "selected children" attribute show up
in "UI Browser" [2] for the item views in the "interview" example
(examples/widgets/itemviews/interview/interview.app/Contents/MacOS/interview)
and that one has an array containing the selected items as value.

Sample scenario:

1) run the interview example (examples/widgets/itemviews/interview/interview.app)
2) select "Item 1:0", "Item 2:0" and "Item 3:0" by left-clicking
  on "Item 1:0" in the left view, then shift+clicking on "Item 3:0".
3) start UI Browser and navigate to the "group (group 1)" element
   and check that the value of its "selected children" attribute is an
   array containing the three selected items

[1] https://developer.apple.com/documentation/appkit/nsaccessibilityprotocol/1524672-accessibilityselectedchildren
[2] https://latenightsw.com/freeware/ui-browser/

Change-Id: Ic62f7fa82f2d01341a1dbc5ade2bd02c3ff99d9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-08 00:08:44 +02:00
Michael Weghorn
86ea40b478 a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCells
The AT-SPI TableCell interface's GetColumnHeaderCells
and GetRowHeaderCells methods were not documented in
the XML specification until recently, but are actively used,
e.g. also by the Orca screen reader since commit
ac2c4470ff
("Prefer table cell interface for getting row and column headers").

5145d3899d only implemented
the TableCell methods that were contained in the XML spec
by then.

Handle these two methods as well, and add an explicit
warning for the case an unknown method is called.

Related at-spi2-core commit adding the two missing methods to the
AT-SPI TableCell XML spec:
963e991973
("TableCell.xml: Add Get{Column,Row}HeaderCells methods")

Fixes: QTBUG-113110
Change-Id: Ic218cdd021bbc347907762035730e6ae7d387300
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-07 22:08:43 +00:00
Ahmad Samir
644bd3367c qcompilerdetection.h: check __cplusplus is defined before using it
Change-Id: I6f6daabcaf393ffa855461b4cd93863723751343
Pick-to: 6.6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-08 01:08:43 +03:00
Ahmad Samir
22c540a66d QProcess: make UnixProcessFlag an enum class
See: https://lists.qt-project.org/pipermail/development/2023-May/043804.html

Not being an enum class looks more of an oversight, in most places usage
of the enumerators was already prefixed with QProcess::UnixProcessFlag.

Change-Id: Ie37d74e0039d3f65f90af560cb85bb11b77ae20c
Pick-to: 6.6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-08 01:08:43 +03:00
Christian Ehrlicher
cdc608359a QSortFilterProxyModel test: fix failing appearsAndSort
Testcase appearsAndSort failed when running the complete testcase but
not as single test. More irritating was the fact that the error was in
QAbstractItemModelTester::headerDataChanged() but the affected test did
not change any header nor does it use the blamed model...
The reason for this is, that QAbstractProxyModel emits a queued
headerDataChanged signal when the header item count changes and
therefore only evaluated when the event loop is run.
Fix it by calling processEvents() after the rowCount change in
filterColumns().
Amends 72e802f3b0

Pick-to: 6.6 6.5
Change-Id: I10cb5aa9c40a6925113cc9c23616774bf15784a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-07 21:35:47 +00:00
Mårten Nordheim
e115d28ce7 Network plugins: include mocs
Change-Id: I7a64d636f5588bda3633cbb3fb6213232c7654a4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-07 18:25:56 +02:00
Mårten Nordheim
40ee403e78 Gui: include mocs
Change-Id: I915071413b05884e61cfad4924a29b0269fab310
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 18:25:53 +02:00
Mårten Nordheim
8fe793fe4b Core: include mocs
Change-Id: If116c090450836007dca826fba1754058fc754c0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 18:25:50 +02:00
Mårten Nordheim
0e007efd7f QSslServer: include moc
Pick-to: 6.6 6.5
Change-Id: I7849a47b50930640f1937ba34976d2465390daf9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 18:25:46 +02:00
Mårten Nordheim
467b01f494 http2: fix potential warning about narrowing
By passing both arguments as qint64, then casting to qint32.
Since one of the arguments are qint32, the result will fit in qint32.

Change-Id: I98e9b1484549fa5dad340f02eda1b341cf6b293d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-07-07 18:25:31 +02:00
Giuseppe D'Angelo
49d177cfba QString docs: miscellanea improvements around string construction
* Correct the semantics of the QString(const char *) constructor
* Mention operator""
* Get rid of QLatin1StringView
* Improve QStringBuilder docs

Change-Id: I80a0833a6d31fae1b05ee49bdb9d2dc6baf84cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-07 18:19:57 +02:00
Ahmad Samir
71d9ebfb1f QFileInfo: keep member function overloads in Qt7 too
The goal is to use overloading instead of default args that are
non-trivial.

Task-number: QTBUG-98117
Pick-to: 6.6
Change-Id: I120befcbab2afbfe5894bfffe6a2d882d8efd250
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 16:15:54 +00:00
Marc Mutz
508629522d QLockFile: remove unneeded tryLock_impl middle-man
It's perfectly ok to de-inline a function, even an exported one, so
remove the tryLock_impl() middle-man and pull the Qt 7 pre-programming
into the here and now.

Amends 5cea5fc80b.

Pick-to: 6.6
Change-Id: I7e9626a91d8ebd64e02c3784c74621950da669fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-07-07 18:15:40 +02:00
Safiyyah Moosa
44fd4a3ba0 Docs: State that OpenSSL3 is available from 5.15.1
Task-number: QTBUG-114138
Pick-to: 6.5 6.6 5.15
Change-Id: I4d2ef35f99065e6c858044bdd07882e6315129f9
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-07-07 18:15:01 +02:00
Mårten Nordheim
fa0d60b1ff QPlatformWindow: Add missing includes
1. QObject
For ifdef Q_OS_UNIX we inherit from QObject but it's not included
anywhere, only implicitly defined!

This was compiling before because the moc file was compiled together
with _another_ moc file that _did_ include QObject.

2. QWindow
For QT_DECLARE_NATIVE_INTERFACE we need to have QWindow included.

Change-Id: I5fc0c2d52cb23ee0b2a884178e9115b19e77bf41
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-07 12:32:45 +02:00
Marc Mutz
c2956f8f76 QEventLoopLocker: add move SMFs and swap()
[ChangeLog][QEventLoopLocker] Added move special-member-functions and
swap().

Fixes: QTBUG-115011
Change-Id: I81a31133adafa31904e8b7c49015506db8c161c6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-07 12:22:42 +02:00
Marc Mutz
d8a8a3a5dc QEventLoopLocker: inline Private into public class
The Private class consists of just one quintptr member now, so it fits
into the ex-d_ptr member of the public class.

Since no allocations take place anymore, and we widened the contract
to allow for nullptr arguments, mark the constructors as noexcept.

[ChangeLog][QtCore][QEventLoopLocker] No longer allocates; all
operations are noexcept now.

Fixes: QTBUG-114793
Pick-to: 6.6
Change-Id: I89699e331711f517d0502392dba106a47ccc9a0f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-07 12:22:36 +02:00
Giuseppe D'Angelo
5560723e9d QCOMPARE: restore compatibility with braced-init-lists
a611a9f537 (in Qt 5) added support for
mixed-type comparisons through QCOMPARE. That commit added a new
overload for qCompare taking two types, T1 and T2; but it also left the
same-type qCompare(T, T) overload around, guarded by a Qt 6 version
check.

The mixed-type version is however not a generalization of the same-type
one, because it won't work if one of the arguments doesn't participate
in FTAD. Case in point: braced-init-lists. In Qt 5 this worked:

 QCOMPARE(some_container, {42});

but in Qt 6 it does not work any more. The mixed-type overload fails
deduction (can't deduce T2); in Qt 5 the same-type overload deduced
T=SomeContainer, and {42} was used to select a constructor for
SomeContainer.

--

There's a partial, straightforward workaround for this: default T2 to
T1 in the mized-type overload. In that case T2 has a "fallback" if it
cannot be deduced. This is partial because of course doesn't address
the case in which T1 cannot be deduced, but I don't think that is
common at all.

QList is special here, because it has qCompare overloads that makes it
comparable with arrays, initializer lists and more. I don't like that
very much -- we should probably have a qCompare(input_range,
input_range) overload, but that's an exercise for C++20.

Change-Id: I344ba33167829984978cd8d649a1904349a9edab
Pick-to: 6.5 6.6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-07 12:20:50 +02:00
Alexey Edelev
d22a696b66 Add '_sync_headers' for interface libraries to "ALL"
Interface libraries don't build anything, commands that belong them
might not run if nothing depends on an interface library. We still need
to make sure that we run syncqt for interface libraries.
Add '_sync_headers' for interface libraries to "ALL" explictily.

Amends a8cf976ce6

Fixes: QTBUG-115101
Pick-to: 6.5 6.6
Change-Id: I24b34574fdc3060e3a60886620dbe5c1b526f1a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-07 09:20:38 +02:00
Ievgenii Meshcheriakov
f846454993 Fix spelling of D-Bus in the source code
Replace D-BUS with correct splling D-Bus in the source code,
Keep the old spelling inside XML DTD declarations for compatibility.

Change-Id: Ifa5d43f9fa1417431c81cf1bce0d897a966409b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:29 +02:00
Ievgenii Meshcheriakov
b48a588e13 qdbusxml2cpp: Improve error reporting
Use this format when reporting diagnostics relating to a source file:

   <file name>:<line>:<column>: {error|warning|note}: <message>

This makes it easier to find the source elements that caused
a diagnostics report.

Fixes: QTBUG-2597
Change-Id: I8d8d13f7d71d1ce0c5050a0d08dddd33f9997f27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:25 +02:00
Ievgenii Meshcheriakov
2f82ba66e2 qdbusxml2cpp: Move shared state to a class
For better OOP code structure and to get overview
over functions that need this shared state.

Task-number: QTBUG-2597
Change-Id: Ib3a26a1116362c3c798052b6bce8db2062451bdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:21 +02:00
Ievgenii Meshcheriakov
bcc93850fc QDBusIntrospection: Pass diagnostics reporter to parser
This would allow to emit parser-related diagnostics
from tools like qdbusxml2cpp. Also such tools could
stop processing if there were parse errors.

Task-number: QTBUG-2597
Change-Id: I573296bb57613d5a443b8c4dbe645b7e82f65adc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:18 +02:00
Ievgenii Meshcheriakov
2e8a48c1cd QDBusIntrospection: Add Annotation struct
Add a structure for annotation data containing
name, value and location information. This is done
to be able to emit diagnostics related to annotations
that include source location.

Task-number: QTBUG-2597
Change-Id: Ie990bcd0a16752b5f44f4314f8d730dd1b1a30b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:15 +02:00
Ievgenii Meshcheriakov
d625b9bc47 QDBusXmlParser: Accept root node names with a leading slash
Task-number: QTBUG-2597
Change-Id: I72866e8c02a8a5b1f030faf3e580241219626e54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-06 21:51:11 +02:00
Ievgenii Meshcheriakov
248d2103b5 QDBus: Add diagnostics reporting interface
Add an abstract class QDBusIntrospection::DiagnosticsReporter
for reporting errors and warnings. Extend QDBusXmlParser
to accept optional diagnostics reporter and use it when
available.

Report unexpected elements as warnings and the rest of
problems as errors.

This will allow tools like qdbusxml2cpp to show parsing
diagnostics using a custom format.

While at it, s/D-BUS/D-Bus/a

Task-number: QTBUG-2597
Change-Id: Ibec3f5f282cf717d1127eb64c82b4fc695f14a74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:08 +02:00
Ievgenii Meshcheriakov
1572c420f3 QDBusIntrospection: Add source location fields
Add source location to the introspection structs so
that errors and warning produced by qdbusxml2cpp can
be related to the source location.

Task-number: QTBUG-2597
Change-Id: I9a6ada45f9c0357dbfb846f13789c5f261e59d55
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:05 +02:00
Ievgenii Meshcheriakov
058d993611 QDBusXmlParser: Make parser functions members of the class
Also make QXmlStreamReader instance and the current interface
members of the class. This reduces amount of arguments that
need to be passed arounds.

Task-number: QTBUG-2597
Change-Id: Iebd2db98a34019923b7a4fe198cc081cd010c8a3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:51:01 +02:00
Axel Spoerl
d2db1d511d Remove references to Application Example
Removing dangling references to the example due to its move to
manual tests.

Pick-to: 6.6 6.5
Change-Id: I13f5fad93763d1ef70ddd8b3dcf430b5df8e28f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-06 21:42:38 +02:00
Mårten Nordheim
20d3827ecc Android[openssl]: Check existence of OpenSSL .so file before use
VCPKG by default does static builds when building for Android.
This is at odds with the bundling-concept, so it should not be done
unconditionally.

Since we don't necessarily have the WrapOpenSSL target on-hand, let's
just do a file-exists test for the one of the paths we would include.

Pick-to: 6.6 6.5
Change-Id: I3693354308d5168d8a9c3d1659bfa51540114b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-07-06 21:25:51 +02:00
Alexey Edelev
dfddde0b53 Do not generate the deprecated 'QtDBus/qdbusmacros.h'
Task-number: QTBUG-115029
Change-Id: I1ff6e83435820d6be0b70fa4fcf370d9e0c682a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 21:22:43 +02:00
Amir Masoud Abdol
594b932c58 Silence the missing BundleIdentifier warning for non-Xcode generators
It's a bit excessive to warn every developer about this, especially if
they are using non-Xcode generators; besides, we are already generating
a bundle identifier if it is missing anyway.

Pick-to: 6.5 6.6
Change-Id: Ib11ad51a0e516e0ea61ad2f7bf499b846bc0b792
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-06 18:06:34 +02:00
Mårten Nordheim
68043e2ca9 Update public suffix list
Pick-to: 6.6 6.5.2 6.5
Change-Id: Idebcc00133661263d557750abdb31f2816a4e190
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-06 17:53:11 +02:00
Alexey Edelev
0f5fbe369b Re-enable exceptions when building syncqt
syncqt uses iostream API that 'excepts'. So enable exceptions flags
when building it.

Amends 49ce711796

Pick-to: 6.6 6.5
Change-Id: Ib0cd581eaec9ae73edc9de423019098304049463
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-06 12:49:36 +02:00
Kai Köhne
f5ea7dd88b QCA docs: Call QSettings() default constructor
Pick-to: 6.5 6.6
Change-Id: I42c68f7386226a1213f635fbcd8835491450d274
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-07-06 10:52:33 +02:00
Kai Köhne
a1b22bc16c Doc: Mention further uses of QCA::applicationName()
Pick-to: 6.5 6.6
Change-Id: I47c72b30d13b8a2b3cfdad262a539a0865a3d635
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-07-06 10:52:33 +02:00
Kai Köhne
62e3fa28d7 Doc: Improve description of QT_FATAL_ environment vars
Much like QT_FATAL_WARNINGS, QT_FATAL_CRITICALS also is
interpreted as a counter. Revamp both function descriptions
to make scope and purpose clearer.

Also, mention logging rules as a way to surpress output,
in addition to a custom message hander.

Pick-to: 6.5 6.6
Change-Id: I44767abb067a6accd81f13dc549c9787ef9a4729
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 10:52:32 +02:00
Marc Mutz
06d520dbef QLogging: add qYieldCpu() to CAS loop
CAS failures should result in PAUSE/YIELD, cf. qYieldCpu() docs.

qYieldCpu() is only available since Qt 6.3, though, so adding it as a
follow-up with limited pick-to.

Task-number: QTBUG-115062
Pick-to: 6.6 6.5
Change-Id: Ibcc73881875a47935940015e30b9a27a282054d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 09:26:39 +02:00
Marc Mutz
b933a5668c Make sure we don't count down past 0 QT_FATAL_CRITICALS
The old code first checked for == 0, then, if false, executed a
fetchAndAdd(-1), both with relaxed memory ordering. This can lead to
executions that, counter to what the code comment states, can count
down past 0:

    // T1                   T2
    loadRelaxed()                                  // true
                            loadRelaxed()          // true
    fetchAndAddRelaxed(-1)                         // e.g. 1 → 0
                            fetchAndAddRelaxed(-1) // 0 → -1

while fatality is detected exactly once, this execution doesn't stop
at 0 and causes further calls to isFatal() to count down further, with
the (very) remote spectre of underflow past INT_MIN.

Fix by using a CAS loop instead, so each count-down uses only one
step, not two, which therefore can no longer interleave.

Fixes: QTBUG-115062
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If77b906c94cb4b9fa91bfad84fe63bc8d9103b0a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-06 09:26:39 +02:00
Axel Spoerl
bbb71e7e80 QDialogButtonBox - Update focus chain when buttons show or hide
Hiding a button in a QDialogButtonBox doesn't remove its default and
focus behavior. Hiding the button shown in the first position, breaks
the focus chain. Tabbing between the button is no longer possible.

This patch implements listening to the buttons' HideToParent and
ShowToParent events. Hidden buttons are removed from the button box
and kept in a separate hash. That ensures focus chain consistency.
When they are shown again, they are added to the button logic and
their default/focus behavior is restored.

An autotest is added in tst_QDialogButtonBox.

Fixes: QTBUG-114377
Pick-to: 6.6 6.5
Change-Id: Id10c4675f43d6007206e41c694688c4f0a34ee52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-06 08:41:04 +02:00
Thiago Macieira
ef9fe7a99a qC{Debug,Info,Warning,Critical}: move the function call to the macro
The change in commit 04ee5795cc was
source-incompatible if the function in question was a non-static member.
I could add a new, template constructor to catch those, but this is
simpler.

Fixes: QTBUG-115043
Pick-to: 6.5 6.6
Change-Id: I53335f845a1345299031fffd176f1071afbae7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-05 22:24:55 -07:00
Ahmad Samir
5a523981f4 Moc: don't make variables inside an unnamed namespace static
Because an unnamed namespace, and variables inside it, have internal
linkage[1]; and the variable is constexpr in this case so static
redundant.

This fixes a clang-tidy warning:
readability-static-definition-in-anonymous-namespace

[1] https://eel.is/c++draft/basic.link#4

Change-Id: I95600214cd51b03872ee22995d93d1b5658d5a18
Task-number: QTBUG-112870
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-06 06:28:22 +03:00