Commit Graph

46146 Commits

Author SHA1 Message Date
Oliver Wolff
ae7bc8803f windeployqt: Do not deploy insighttracker plugin by default
Qt insight's TP is using plugin type "generic" so that insight plugins
can be deployed for every Qt application. As "generic" plugins are part
of QtGui windeployqt deploys these if a dependency to QtGui is found.

As defaulting to a deployment of insight plugins might cause confusion
among users, we make deployment of these plugins explicit if the module
is available.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I9d2a8595373d5a15b7afbeaf7174226563b1cb6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-27 11:50:13 +02:00
Edward Welbourne
35d0f012ee Refine minor details in Darwin time-zone backend
It's Darwin, no longer OS X.
Include a link to the URL of NSTimeZone's docs.
Use actuall Q_UNREACHABLE() rather than a comment.
Correct a TODO comment (there *is* API for it, but fiddly).
Make a lower bound constexpr rather than merely const.

Task-number: QTBUG-104012
Change-Id: I9bf2018fa27ac9f6aa38eaebbf6b0f90ff5f6188
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-26 13:00:31 +02:00
Jacek Poplawski
e73e972aa6 Don't include resolv.h when libresolv is disabled
Change-Id: I5b216ed02452549b69847b34139613669905023c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-26 09:03:38 +02:00
Jacek Poplawski
2f3e76da63 VxWorks does not have byteswap.h
Change-Id: I9927fa64e76d59415d4974538383321c6dd6318b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-26 09:03:38 +02:00
Giuseppe D'Angelo
21d3bb9e74 QOpenGLWidget: invalidate the depth/stencil after rendering
We don't need them any more, only the color is used for compositing.
In principle this enables a driver to not writeback their contents into
main memory.

Change-Id: Ibde17af6c14c98ebdca956aaf902dfd728f9219c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-26 06:46:51 +02:00
Giuseppe D'Angelo
76e650045e QSet: document removeIf
The docs were never added (unlike the docs for erase_if).

Change-Id: I7857c5eded68791ddfc4e6ce42a60d5736f5a438
Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-115473
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 23:05:50 +02:00
Giuseppe D'Angelo
8cc8bbb466 QOpenGLWidget: use (and prefer) InvalidateFramebuffer
Desktop GL does not have the GL_EXT_discard_framebuffer extension at
all. Instead, it may have GL_ARB_invalidate_subdata.

Furthermore, GLES >= 3.0 and GL >= 4.3 both support FBO invalidation
through glInvalidateFramebuffer.

Extend the semantics of OpenGLExtension::DiscardFramebuffer to mean that
*any* possibility above is supported, and wrap it in a helper function
that calls whatever support is present. (This is all private API
anyhow.) Technically speaking glInvalidateFramebuffer supports a
superset of what glDiscardFramebufferEXT supports, but we never use such
superset, and the two APIs are otherwise identical.

Then, make QOpenGLWidget call that wrapper.

Change-Id: I64e042daf51493d3834c3ba1b53ae6e224bbc4ed
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-25 23:05:50 +02:00
Ivan Solovev
27b06e50e0 QIntegerForSize: fix check for 128-bit ints
We do not need the Q_CC_GNU check, as the __SIZEOF_INT128__ check is
enough.

Pick-to: 6.6
Change-Id: I12bdd02186c4f5dad0ab3f4596f4b37e5c3f7eee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 19:48:35 +02:00
Thiago Macieira
a7f227f56c Make qYieldCpu() public API
Rewritten to be a bit simpler, added a few more yield/YieldProcessor
alternatives, added RISC-V support.

[ChangeLog][QtCore] Added qYieldCpu() function.

Fixes: QTBUG-103014
Change-Id: I53335f845a1345299031fffd176f59032e7400f5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-07-25 07:21:56 -07:00
Ivan Solovev
aaa8c38353 QProperty: improve QPropertyAlias deprecation
Use QT_DEPRECATED_VERSION_X_6_6 and provide reasons for deprecation
for the enum value and for the QPropertyObserver constructor.

Pick-to: 6.6
Change-Id: I0f9b4c6dc8bb9fd5eac692a6953c90059f3c77ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-25 15:43:05 +02:00
Dennis Oberst
b03f6def31 Doc: add overview page for Qt's comparison types
Provide a centralized overview of Qt's comparison types, available
for three-way comparisons.

Fixes: QTBUG-114402
Change-Id: Ib7229e753ef750d00c208794d1feb3e6d42133ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-25 15:43:05 +02:00
Krzysztof Sommerfeld
62a9178504 Add case for VxWorks platform in initLocale method
Change-Id: Ic0cef59d452c72340f6216c9ae3c261a24c2d296
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 12:44:14 +02:00
Dennis Oberst
c2310f8e03 QNativeIpcKey: add qHash() function
Equality comparable types should define a qHash() function.

Pick-to: 6.6
Change-Id: I1677fbefa3d09d49a292d369b808793f884c32e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 12:31:04 +02:00
Dennis Oberst
c6fe64b17c Add QStrongOrdering and QWeakOrdering
These new classes align with the criteria of std::strong_ordering
and std::weak_ordering and were the missing types required by
the three-way comparison operator.

References:
https://en.cppreference.com/w/cpp/utility/compare/strong_ordering
https://en.cppreference.com/w/cpp/utility/compare/weak_ordering

Change-Id: Ie6620ca98103800fd5504810dc5689c1dd1c2972
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-25 12:31:04 +02:00
Edward Welbourne
669470e2be Clarify QElapsedTimer::hasExpired()'s documentation
The description in terms of timeouts was confusing. Instead, say what
it actually does, in plain terms. Mention that you can do similar for
a duration.

Pick-to: 6.6
Task-number: QTBUG-115447
Change-Id: I4618d7fa290e7959ed3cb51e5c2576b041f77091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 12:31:04 +02:00
Jacek Poplawski
51c66cee67 Remove include ipc.h as it is no longer needed
Change-Id: I8b7c6744794f4369d6e27fdb454a059727413d9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-24 22:24:41 +02:00
Thiago Macieira
4a43149d7b QThreadPipe & QEvent: use a simpler atomic operation
This causes modern compilers (i.e., not MSVC) to emit a single
bit-test-and-set instruction instead of a cmpxchg. It's still an atomic
operation, so it's not that much faster (if at all), but it has simpler
encoding.

Previous:
000000000026bca0 <QEventDispatcherUNIX::wakeUp()>:
  26bca0:       mov    0x8(%rdi),%rdx
  26bca4:       xor    %eax,%eax
  26bca6:       mov    $0x1,%ecx
  26bcab:       lock cmpxchg %ecx,0x98(%rdx)
  26bcb3:       jne    26bcc5 <QEventDispatcherUNIX::wakeUp()+0x25>
  26bcb5:       mov    0x90(%rdx),%edi
  26bcbb:       mov    $0x1,%esi
  26bcc0:       jmp    c01d0 <eventfd_write@plt>
  26bcc5:       ret

Now:
  26b3a0:       mov    0x8(%rdi),%rax
  26b3a4:       lock btsl $0x0,0x98(%rax)
  26b3ad:       jae    26b3b0 <QEventDispatcherUNIX::wakeUp()+0x10>
  26b3af:       ret
  26b3b0:       mov    0x90(%rax),%edi
  26b3b6:       mov    $0x1,%esi
  26b3bb:       jmp    c11d0 <eventfd_write@plt>

Change-Id: I53335f845a1345299031fffd176fa8ac1de3ad13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-24 20:24:36 +00:00
Thiago Macieira
41f4139306 QEventDispatcherUNIX: remove the fallback to pipes on eventfd systems
Linux has had it since 2.6.23, which is positively ancient from our
perspective. No one runs Qt on systems anywhere near that old (I'd be
amazed if anyone managed on CentOS / RHEL 7, which carries Linux 3.10).
And we don't deal with ENOSYS on FreeBSD either.

The removal is accomplished by dead code elimination: it's still
compiled on Linux and FreeBSD.

Drive-by
 - use NSDMI in QThreadPipe
 - remove EINTR_LOOP for eventfd_write(3): it can't be interrupted

Change-Id: I63b988479db546dabffcfffd1766e2c7acc6da46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-24 13:24:36 -07:00
Thiago Macieira
f174ae254b QEventDispatcherUNIX: clean up old cruft
All the timing related code is gone.

Change-Id: I63b988479db546dabffcfffd1766e1f2618650c1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-24 13:24:36 -07:00
Thiago Macieira
a1451bbb57 QEventDispatcherUNIX: convert "eventfd" feature to proper QT_CONFIG
And mark it private.

[ChangeLog][QtCore] Qt no longer sets the QT_NO_EVENTFD feature macro
on systems without eventfd.

Change-Id: I63b988479db546dabffcfffd1766e1df5255c930
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-24 20:24:35 +00:00
Alexandru Croitor
bc2ae5a708 CMake: Fix installed metatypes not being propagated to other repos
The install-time code path that's supposed to propagate and install the
metatypes files was never executed, because of a wrong
PARENT_SCOPE assignment and because the code was overriding the meta
type file name retrieved from a property with an empty non-existent
argument.

This caused build failures in qtdeclarative when qmlcachegen generated
invalid cpp code without having access to the qtbase foreign types.
This only happened in prefix builds.

Use the appropriate variable for the PARENT_SCOPE assignment and
remove the incorrect file name assignment.

Amends c45c32af32

Task-number: QTBUG-115152
Change-Id: I120d53d44382a1ac6f62792ec1620add3e7b136c
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-24 20:26:07 +02:00
Axel Spoerl
4a26ae1b27 QColorDialog: React to HSV values during manual edit instead of change
The existing signal connection can cause a loop and undefined behavior
in the interaction between the line edit for a hex rgb color and the
individual rgb values.

=> Change connection to textEdited, to react only on manual editing.

Fixes: QTBUG-115189
Pick-to: 6.6 6.5
Change-Id: Ie3062c575652b905a8ab16edb2f5f77f8d150f36
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-24 17:03:14 +02:00
Friedemann Kleint
d164ec4abe QXmlStreamReader: Fix translation context of error messages
QObject::tr() should not be used.

Amends c4301be7d5.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5
Change-Id: I09547c3d048d6b3726e33be74b06035f0eec4f31
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-24 14:09:00 +02:00
Marcin Zdunek
1e3d500463 Fix issue with qstorageinfo_unix.cpp not working on Vxworks
Problem was, that qstorageinfo_unix.cpp is using sys/statvfs.h header, but this header is not available in Vxworks(Vxworks has
its own /sys/ directory).As this feature is not there in Vxworks, we are using a "_stub" file to omit whole implementation.
This is the same solution as it was used for Qt5 for Vxworks.

Change-Id: I1bc5a576e63f403c923cbc93571967184677305f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-24 06:59:04 +00:00
Jacek Poplawski
5a0c2cabcd Remove usleep(), getpagesize() and getpwuid() from qfunctions_vxworks
This functionality is now available in VSB

Change-Id: I761d73d8ae100b2e0eae8101479b325ddcbde6cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-24 06:12:42 +02:00
Ahmad Samir
f107773742 QValidator: return State::Intermediate for certain trailing characters
E.g. a group separator, a -/+ sign, or 'e' (exponent). Input ending with
one of these characters now returns Intermediate, as it can become
Acceptable if the user types more characters.

Remove a check from initialResultCheck(), as it's now covered by
QLocaleData::validateChars() checking that the last character in the
buffer is -/+, this works the same if buffer's size is 1.

Extended unittests based on the linked bug report; the other cases for
"last" are already covered by existing unittests.

Task-number: QTBUG-111371
Change-Id: I9b6979c29f07a5f57b040004cd3dbf4e27147c21
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-24 00:04:47 +02:00
Christian Ehrlicher
3d284d9b8d SQLDatabase: merge two global statics into one
Merge the two global statics into one.

Change-Id: I8a93ba848abe31527551313c8a4a449d05e3d680
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-23 16:49:16 +02:00
Christian Ehrlicher
e532933a2a SQL/PSQL: Handle jsonb operators in prepared queries
Add an option to disable handling of positional binding so jsonb
operators are not screwed up

[ChangeLog][QtSql][QSqlQuery] Add setEnablePositionalBinding() to be
able to disable positional binding.

Fixes: QTBUG-96636
Change-Id: I428a9d3b10274b97292ab86a74d9b3971d6f10e9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-23 16:49:15 +02:00
Ahmad Samir
4a7023f5b4 QTimer: add note about QT_NO_CONTEXTLESS_CONNECT to callOnTimeout docs
Drive-by change: use \code, better formatting especially for longer
lines of code.

Change-Id: I90dbde17a5bea276c86304bff64027dd9d248a21
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-23 01:22:15 +03:00
Ahmad Samir
794e0d1ac6 QTimer: fix API docs of callOnTimeOut overload
It actually takes one parameter, because in this overload the connection
type can't be specified, for example:
QTimer timer;
timer.callOnTimeout([]() { qDebug() << "slot"; });

The call chain is:
QObject::connect(timer, &QTimer::timeout, functor);
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 &&slot)
connect(sender, signal, sender, std::forward<Func2>(slot), Qt::DirectConnection);

the connection type is always DirectConnection.

Spotted by Giuseppe in code review.

Pick-to: 6.6 6.5 5.15
Change-Id: Ia8bbd91e98a357244cbfae4e3ed63d4c73038fa2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-07-23 01:22:06 +03:00
Ahmad Samir
9bc43ba1c6 QLocaleData:: port bytearray/stringTo{U}LongLong to QSimpleParsedNumber
Change-Id: I97fe38d9b676cf92003a7323ebb5f56b9b79abad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-22 22:29:31 +02:00
Ahmad Samir
62d1ebe465 QLocale: move QSimpleParsedNumber to qlocale_p.h
It was defined in qlocale_tools_p.h which already includes qlocale_p.h.

Change-Id: I43464a27ec15266ce8632ca30dcd1c57d94b1f25
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-22 22:29:31 +02:00
Ahmad Samir
67129ef9cd QLocaleData: change validateChars() to return validation State
Instead of returning just bool, return a result struct {State,
CharBuff}, a State is useful as it can have an Intermediate state
where the input isn't Acceptable yet, but not Invalid as such. The
example from the linked bug is in tst_QIntValidator::validateFrench(), a
string "1 ", which can be interpretted as a number with a group
separator, but the input shouldn't end with a group separator (changing
the unittest will be done as part of a separate commit).

CharBuff (QVarLengthArray<char, 256>) replaces the QByteArray input
parameter; a QVarLengthArray means no heap allocation in typical
use-cases with input text < 256 characters to validate. This required
minimum changes (QVLA doesn't have startsWith, replaced by comparing
with buff[0]; and for converting to double, wrapped it in a QBAV).

Task-number: QTBUG-111371
Change-Id: I4e0eb612d470ef03faf52031ddfe9c4bdb31e1e1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-22 23:29:31 +03:00
Ahmad Samir
6bb61f7e89 QValidator: de-duplicate some code
QDoubleValidator didn't return Intermediate if the buffer only had one
character, - or +, but it makes sense to check that there too.

In a later commit that check will be moved to QLocaleData::validateChars
(which will return "Intermediate" if the last character in the result
buffer is -/+, in this case it's the last and only character in the
buffer).

Change-Id: I2f9f5b92880b7e9cc1a3ab36b5ec322f57291ee9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-22 22:29:30 +02:00
Ahmad Samir
9d4cd4a63e qstringalgorithms: refactor trimmed_helper_positions
Take by const Str&, trimming a container/view of characters means
removing whitespace from the beginning and end, so the two args were
always cbegin() and cend().

Change-Id: Iac0eda59341f1981204d11013d591013eae3c4e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-22 20:48:11 +03:00
Marc Mutz
19c70f40d2 QDateTimeParser: unbreak C++20 build (implicit capture of *this by [=])
Use [&] instead and remove overparenthefication as a drive-by.

Amends c888e3922d.

Pick-to: 6.6 6.5 6.2
Change-Id: Ic7930d5011c247122a1b3396ea0d6a9a2d6107de
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-07-22 07:27:29 +02:00
Marc Mutz
f82cf6333e Long live QSpan!
QSpan is Qt's version of std::span. While we usually try not to
reimplement std functionality anymore, the situation is different with
QSpan. Spans are non-owning containers, so the usual impedance
mismatch between owning STL and Qt containers doesn't apply here:
QSpan implicitly converts to std::span and vice versa, making STL and
Qt APIs using spans completely interoperable.

We add QSpan mainly for two reasons: First, we don't want to wait
until we require C++20 in Qt and can use std::span. Second, in the
view of this author, some design decisions in std::span hurt the
primary use-case of spans: type-erasure for containers. This results
in two major deviations of QSpan from std::span: First, any rvalue
container is convertible to QSpan, allowing seamless passing of owning
containers to functions taking spans:

    void sspan(std::span<T>);
    void qspan(QSpan<T>);

    std::vector<T> v();
    sspan(v()); // ERROR: rvalue owning container
    auto tmp = v();
    sspan(tmp); // OK, lvalue
    qspan(v()); // OK

This author believes that it's more helpful to have compilers and
static checkers warn about a particular wrong usage than to make
perfectly valid use-cases impossible or needlessly verbose to code.

The second deviation from std::span is that fixed-size span
constructors are also implicit. This isn't as clear-cut, because an
explicit QSpan{arg} isn't per-se bad. However, it means you can't
transparently change from a function taking decltype(arg) to one
taking QSpan and back. Since that's exactly what we intend to do in Qt
going forward, in the interest of source-compatibility, the ctors are
all implicit.

Otherwise, the API of QSpan follows the std::span API very
closely. Like std::span, QSpan isn't equality_comparable, because it's
not clear what equality means for spans (element-wise equal, or (ptr,
size)-wise equal?). The major API additions are Qt-ish versions of std
API functions: isEmpty() on top of empty() and sliced() instead of
subspan(). The (nullary) first()/last() functions (Qt speak for
front()/back()) clash with the std::span function templates of the
same name, so are not provided.

This patch adds QSpan as private API. We intend to make it public API
in the future.

Pick-to: 6.6
Fixes: QTBUG-108124
Change-Id: I3f660be90eb408b9e66ff9eacf5da4cba17212a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-21 17:00:05 +00:00
Edward Welbourne
ca6a0fd63f QDTP: match local-time by preference to its zone
When parsing a string whose time-zone part matches local time's name,
use local time in preference to the QTimeZone with that name. The case
is ambiguous, and the bug was already fixed (by something else) in
dev, but this caused a failure in 6.2 through 6.5; and using local
time is more natural to QDateTime in any case. The fix incidentally
makes the the logic of the zone-resolution code more straightforward
and a closer match to how findTimeZone() found the match.

The issue was hidden from 6.6 by a change [*] to the handling of POSIX
rules, that lead to plain abbreviations such as CEST and BST - for
which the IANA DB has no entry - no longer being considered "valid"
zones, despite being technically valid POSIX zone descriptors
(effectively as aliases for UTC).

[*] commit 41c561ddde

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114575
Change-Id: I4369901afd26961d038e382f4c4a7beb83659ad7
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:01 +02:00
Edward Welbourne
c888e3922d Check QDT's local time abbreviation as well as the qTzName()s
Since QDateTime uses some fall-backs if qTzName() doesn't give it
something useful (as happens on MS-Win when local time is UTC),
QDateTimeParser should check the result of those fall-backs as well as
the qTzName()s when checking for local-time as zone.

Pick-to: 6.6 6.5 6.2
Change-Id: Ic809b7e44cd0c83fb076b24c27547268345fa379
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-21 16:22:01 +00:00
Edward Welbourne
74a60ebf31 Move month names from QGregorianCalendar to QRomanCalendar
The other Roman-based calendars share the same month names as
Gregorian, so it makes sense for them to use the same system fallbacks
as it when available.

Change-Id: Idf2f2901032c7a02d641f00a3993cc95b6bb8067
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:00 +02:00
Edward Welbourne
df736da245 Update system collator when system local is default and updates
Amends commit 94de5f9b25 so that every
change to the default locale is reflected in an update to the default
collator used by QString::localeAwareCompare().

Although the change to the system locale does update the QLocaleData
object shared by all system locale objects, the possible change to its
collator() may imply the default collator needs an update; and the
collator backend's init() may use the language, script and territory
that's changed in setting up the revised collator, even if the QLocale
instance referenced has the same QLocaleData.

Pick-to: 6.6 6.5 6.2
Change-Id: I957486c03c3d779fc9a2f0b889346ec13b1af868
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-21 18:22:00 +02:00
Marc Mutz
ff75ace02d Port QObjectPrivate::connect() to SlotObjUniquePtr internally
This is for consistency with QObject::connectImpl() and
QObjectPrivate::connectImpl(), if nothing else.

See the commit message of the QObject::connectImpl() porting patch for
why we leave the function signature unchanged (key-word:
tail-callability).

Pick-to: 6.6 6.5
Change-Id: I515d3be4a5126f9f4738dd7bde5174377faf2343
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:00 +02:00
Marc Mutz
18857db2dd Port QObjectPrivate::connectImpl() to SlotObjUniquePtr internally
... removing the custom scope-guard which was .dismiss()ed too early
(the allocation of 'c' could theoretically fail, and the old code
would leak the slot object in that case; nothing we're generally
guarding against in Qt, but it's a nice drive-by gain, probably shuts
up static checkers, and makes readers wonder less about the lifetime
of the slot object).

As mentioned in the patch porting QObject::connectImpl(), leave the
unique_ptr out of the function's signature, see there for rationale
(key-word: tail-callability).

Pick-to: 6.6 6.5
Change-Id: Ib90371b9768a72fd62d080b71eef2c82f851db81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:00 +02:00
Marc Mutz
9338207018 Port QObject::connectImpl() to SlotObjUniquePtr internally
This gets rid of the smell that one destroyIfLastRef() call guarded
against nullptr while the other one did not.

Don't change the function signatures, as passing by unique_ptr, while
making the transfer of ownership clear, makes it impossible to call
the function as a tail-call: Non-trivially-copyable arguments live in
the caller's stack frame and the caller has no idea whether the object
was moved from in the callee or not, so it needs to run the dtor,
which prevents this from being tail-callable.

Passing .release(), OTOH, makes it obvious that the unique_ptr is
nullptr afterwards, so leaves the door open for tail-calling.

However, the QObjectPrivate::connectImpl() wasn't, and continues to
not be, a tail-call. Investigating why, while intriguing, is for
another patch (and much more important for the template wrappers of
these functions than then one out-of-line function we're dealing with
here).

Pick-to: 6.6 6.5
Change-Id: Ib951ed2a2b622d70cb12ddbf01c83ec56b1ce70d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:00 +02:00
Marc Mutz
4015f81d31 QMetaObject: port invokeMethodImpl() from QScopeGuard to SlotObjUniquePtr
... so it can use the new QMetaCallEvent() ctors taking that type.

As a consequence, the slot object ref-count is now no longer touched
on the way into the meta-call event (was: upped in QMetaCallEvent
ctor, then downed in QScopeGuard).

Pick-to: 6.6 6.5
Change-Id: Id9bd157792458a3834809c23e94ca5f504f7abd1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 18:22:00 +02:00
Marc Mutz
00dbd3cd26 QMetaCallEvent: add ctors and create() overloads taking SlotObjUniquePtr
This makes it clear who is responsible for obtaining additional strong
reference to the slot objects, because these functions no longer do.

Pick-to: 6.6 6.5
Change-Id: I39187e3c441d8f82d50d907731f1cbdfb2a95b9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 16:21:59 +00:00
Marc Mutz
e60aed5ed0 QFactoryLoader: fix mem-leak on setExtraSearchPath()
When, like in tst_QFactoryLoader::extraSearchPath(), where asan caught
it, or, presumably, on re-creation of a QGuiApplication with a
different QT_QPA_PLATFORM_PLUGIN_PATH, setExtraSearchPath() is called
with a different path than before, then it would leak QLibaryPrivate
objects in the call to libraryList.clear().

Fix by adding QLibraryPrivate::Deleter and holding the objects in
unique_ptr<QLibraryPrivate, Deleter> instead of as raw pointers. This
statically guarantees we're not leaking these objects anywhere else in
QFactoryLoader.

Change the name of the container from libraryList to libraries to catch
any unported users, incl. in older branches.

Since libraryList is now a std::vector (QList cannot hold move-only
types), statically assert that it was never attempted to be copied or
moved, even in older branches, with Q_DISABLE_COPY_MOVE().

Amends ddba24535f.

Not picking to 6.4 and 6.3, as they are closed at this point.

Pick-to: 6.6 6.5
Fixes: QTBUG-115286
Change-Id: I6d1272622b12c505975cc72f9aba0d126d2817e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 16:21:59 +00:00
Alexey Edelev
575b8a7fa2 Check the QTP0002 policy only if paths are set
It doesn't make sense to disturb users with the policy warning if they
don't specify Android paths. Suppress the policy check if Android
paths are not set for the target.

Fixes: QTBUG-115119
Pick-to: 6.6
Change-Id: Ice9d0459c01feb505857133bb942b1b6e775e55a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-21 17:39:16 +02:00
Kai Köhne
056e127ff6 Deprecate QtSystemMsg enum
QtSystemMsg has been an alias to QtCriticalMsg since Qt 4 times,
probably because of the misleading name. Let's formally deprecate
the enum now, so that it at one point (Qt 7?) can be finally removed.

Change-Id: I385b62a77ceb66f75f318a00a73ea5e7333bf4f1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-21 17:39:16 +02:00
Venugopal Shivashankar
28defcfb78 Doc: Change the Qt Testlib example pages
These pages are designed as tutorials, so
they can be \page instead of \example.
Also, reorganized the tutorials, moving them out
of the testlib manual, into several qdoc files.

Task-number: QTBUG-115248
Pick-to: 6.5 6.6
Change-Id: I2cbd66ecc1082ecc9d3d1742b621ee009daf1031
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-07-21 13:08:03 +02:00
Marc Mutz
b91891a76b QtWidgets: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtWidgets's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.

Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: I6a445701e2ac41d67a3ec69715b7bf6ed5ec65f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-21 12:31:45 +02:00
Marc Mutz
a07426d23a QtCore: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtCore's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.

Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: If33a485b697f60a2f4d6198f0798c953fa47af51
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-21 12:31:45 +02:00
Volker Hilsheimer
510224f446 QIconLoader: add some more debugging help
As a drive-by, re-use the result from the first QFile::exists
check.

Pick-to: 6.6
Change-Id: I6b36b165ba3d1f82c9b4be18d44a671f71e8507e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-21 09:22:54 +02:00
Volker Hilsheimer
e1a93b3d9a QIconLoader: reset search paths when theme name is cleared
When we reset the theme so that icons should be provided by the
system theme, then reset the search paths to the system-provided
paths as well. Otherwise we'll keep looking for the system theme
in user-provided search paths, which can't work.

Pick-to: 6.6
Change-Id: I10bcb404db9924e038f6fdc8970e53bbb69ac7d1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-21 09:22:51 +02:00
Volker Hilsheimer
e2f0495e7e QIconLoader: clear cache when the key becomes invalid
Pick-to: 6.6
Change-Id: I6f2745715b902ccbc87d78b1c90f6883cfdd76ae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-21 09:22:48 +02:00
Volker Hilsheimer
cb16ba5980 QIcon: use fallback also with platform icon engine
Amends a452e22546. No new tests, existing
tests fails when QPlatformTheme returns a QIconEngine implementation
that provides the tested icons. However, the existing test fails when
the platform icon engine provides and address-book-new icon, and depends
on the order of test functions, as the name() test function modifies the
global theme name and search path. Fix those issues in the test.

Pick-to: 6.6
Change-Id: Ie1c1d14f08fad5e906296bab662df5cfacdbbf07
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-21 09:22:46 +02:00
Jacek Poplawski
3f9817b26c Add initial support for building for VxWorks using clang
Change-Id: I8c4538cd5582bfea69a6e1890445c4c75e6ca0d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-21 06:08:04 +02:00
Krzysztof Sommerfeld
2540ec8d65 Fix perror calls for VxWorks platform
perror does not support string formatting. The problematic code is in VxWorks ifdef so this error was not breaking the other targets compilation.

Change-Id: I44e5d247bfa76815c81f0d122f0e34b75538dfa9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-20 19:50:14 +00:00
Alexey Edelev
ea4a3d78a7 Make sure that the 3rdparty directory belongs to the module
If the path where Qt sources are located has 3rdparty in it we skip
headers processing since all headers are treated as 3rdparty.

Use path relative to the source directory when indentifying the 3rdparty
header files using regex.

Fixes: QTBUG-115324
Pick-to: 6.5 6.6
Change-Id: If97328cb9a9ece01d43c56022f4613da9b29c03f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-19 21:06:12 +02:00
Christian Ehrlicher
09b81dca4b SQL: use QT_NO_CONTEXTLESS_CONNECT for sql plugins
Use QT_NO_CONTEXTLESS_CONNECT to disable 3-arg connects which are
considered dangerous.

Change-Id: I0ac711491de60e0eeaca9edb60715eafe9da841a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-19 18:42:46 +00:00
Christian Ehrlicher
a0776ae547 SQL plugins: add moc includes
Change-Id: I9ed4b63fd02b4a6fc5f4b614466590cd099609e2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-19 20:42:46 +02:00
Ahmad Samir
e25b0d8f27 QTimerInfo: refactor QTimerInfo
- Add a constructor
- Initialize members in-class
- Reorder the data members so as not to waste space between them, now
  all the padding is at the end

Change-Id: Ic88200fbff049615a6a43e322e724cf619fc3cdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-19 19:40:51 +03:00
Ahmad Samir
619b03401d QTimerInfoList: don't inherit from a container in an exported class
Instead use composition by using a container member; inheriting from
containers has a couple of issues:
- containers (STL and Qt) don't have virtual destructors, which means
  that deleting via a pointer to the base-class would be troublesome
- as it turns out, inheriting from containers, QList in this case,
  in an exported derived-class could lead to binary-incompatibility
  issues (see linked bug report)

Drive-by change:
- group all private members in one place
- make timerInsert() private, nothing should use it from outside the
  class anyway

Change-Id: I69843835d8c854fa4b13e8b4ba3fb69f1484f6a6
Fixes: QTBUG-111959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-19 19:40:51 +03:00
Ahmad Samir
74422bbf02 QTimerInfoList: refactor unregisterTimers()
- Use removeIf(), easier to reason about than removing from the list
  during iteration
- Return true only if any timers were actually unregistered
- Assert in QObject::event() that if the list returned by
  eventDispatcher->registeredTimers() isn't empty, then
  eventDispatcher->unregisteredTimers() returns true

Change-Id: I739a3865b7524a7aab3ff0227e6a060ed98d6191
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-19 19:40:51 +03:00
Ahmad Samir
fa42350c8d QTimerInfoList: use std::upper_bound/rotate
Change-Id: I80899a8c652ac724b0efd82815dddc061fe9f5e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-19 19:40:50 +03:00
Dennis Oberst
464461dea6 QString: make isEmpty(), length() and size() noexcept
They have no preconditions and cannot throw.

As a drive-by, merge the definition of isEmpty() into its declaration.

Pick-to: 6.6
Change-Id: Ifffa0d4cb2a285bb802d39d10a757be9c31cfae1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-19 13:13:20 +00:00
Alexandru Croitor
0cae76c2af CMake: Specify correct \since version for android variable
The QT_ANDROID_DEPLOY_RELEASE variable was added in 6.5.1, not 6.5.2.

Amends 64db65ae90

Pick-to: 6.5 6.6
Fixes: QTBUG-115318
Task-number: QTBUG-112921
Task-number: QTBUG-108132
Task-number: COIN-882
Change-Id: I912fecfc918914709aa5cb9c42c67317f7d3dc89
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-07-19 14:16:55 +02:00
Alexey Edelev
f73249b94d Put arguments in correct order in syncqt parseVersion
Amends 4d4e74e1bcad47476b947b6e3781b046f9505f83

Pick-to: 6.6
Change-Id: Ie3a0147b414303c528b78c20f6502b83c5102344
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-19 14:16:55 +02:00
Mårten Nordheim
061ab84e98 QHostInfo: fix leaking slot object
We were not ref'ing or deref'ing the slot object in the various places
that owned it. So, if, in the end, the QHostInfoResult object didn't
call the slot we would leak the slot object.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-115263
Change-Id: I45f43756c7589470045d97b59257ccfd85a325b7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-19 14:16:55 +02:00
Alexey Edelev
1e3bf10786 Do not generate the deprecated 'QtSql/qsql.h'
Task-number: QTBUG-115029
Change-Id: I1fe496864ce25f20421ca78fbde3fe4eb4b9fc49
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-19 13:51:36 +02:00
Marc Mutz
dc7820a296 QMetaCallEvent::create: extract template-argument-independent code
Extract Method create_impl() with all the stuff that doesn't depend on
create()'s template arguments, which will reduce compile time and
amount of generated code.

Pick-to: 6.6
Change-Id: I9d8f59c168873ac3527b570ef6142079824061cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-19 11:38:02 +00:00
Marc Mutz
cec711092f Port SlotObjectGuard to SlotObjUniquePtr
Pick-to: 6.6 6.5
Change-Id: I81e64db7e1be9076494bee15bbca372ebffeb3e0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-19 13:38:02 +02:00
Marc Mutz
56651915e8 QFutureInterface: port to new SlotObjUniquePtr
... removing a ### comments to that effect.

Pick-to: 6.6
Change-Id: I635ca9593ec72a66d328ff6de61cd311c1b4e89f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-19 13:38:02 +02:00
Marc Mutz
c58074b42d QSlotObjectBase: add Deleter and typedef for a unique_ptr using it
Use it in QMetaCallEvent, to have some automatic test coverage. Other
code that might benefit has undergone changes since 5.15, so will be
ported one-by-one to avoid conflicts on cherry-picks.

Pick-to: 6.6 6.5
Change-Id: I566bab1803e3675f75a9fdf294a4b0f047d21c11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-19 11:38:02 +00:00
Ivan Solovev
4601717378 Guard xmlstream header in a source-compatible way
Using QT_REQUIRE_CONFIG results in a static_assert if the xmlstream
feature is not available. This is a SiC change, as the user has
no reasonable ways to guard against it.
Fix it by using

 if QT_CONFIG(xmlstream)

instead.

This commit amends 7337474d04

Pick-to: 6.6
Change-Id: I0c55e4cff06157743c05a543a092f9be1eb67c2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-19 11:56:52 +02:00
Jaishree Vyas
7c2ecfcf29 Doc: List of all Qt overviews which are now termed as explanation
The autogenerated list of overviews was adding the \group command which
included all the groups instead of overviews.
The idea here is to categorize the overviews later on once we have
the list of all overviews.

Task-number: QTBUG-114762
Pick-to: 6.5 6.6
Change-Id: I3cf53886be277abc86b5ec54d399cd6933fbe882
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-07-19 10:36:59 +02:00
Marc Mutz
7470794865 QMetaCallEvent::create(): re-order operations
... so that everything that requires argv is done first.

Also introduce a new variable, argc, for sizeof...(Args) + 1.

This will allow us to apply Extract Method to the tail end, which now
no longer depends on argv or Args.

As a drive-by, port from std::array to C arrays so we can use
automatic array size deduction: There's still no such thing as partial
CTAD (certainly not in C++17), so if we wanted std::array to deduce
the size, we'd also need to let it deduce the type; and we don't want
to add an ugly cast to the nullptr). C arrays, OTOH, can deduce the
size while fixing the type since K&R C.

Pick-to: 6.6
Change-Id: I5a694d4f4d41974eb4b1075ff030bbef902ed492
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-19 04:52:14 +00:00
Yuhang Zhao
b3930b03cd Windows QPA: fix mail launch in case parameter is wrong
Done-with: Ilya Fedin <fedin-ilja2010@ya.ru>
Pick-to: 6.6 6.5
Change-Id: I7b24ed64533cdf26f3f3d7dba4b5e80490be269c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-07-19 04:43:06 +00:00
Mitch Curtis
14d10c632b Doc: explain how to create a QToolBar
Surprisingly, this wasn't mentioned in the detailed description at all.

Users would need to click on the link for the example in the "See also"
section and then read through it to find any mention of how tool bars
are created.

Pick-to: 6.2 6.5 6.6
Change-Id: I9db23b475009072f34defab38b6d6200a45f2f35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-19 10:23:38 +08:00
Michael Weghorn
4f9c66131d a11y uia: Bridge QAccessibleSelectionInterface
Bridge QAccessibleSelectionInterface that was introduced
in commit 9d16d5e224 to
UIA's ISelectionProvider and ISelectionProvider2 interfaces
by extending the existing WindowsUiaSelectionProvider
to make use of the QAccessibleSelectionInterface.

Also make use of that interface to implement handling
for the ISelectionProviderItem interface methods when
an object has a parent that implements the
QAccessibleSelectionInterface.

Sample use from NVDA's Python console [1] with this
commit in place:

1) start NVDA
2) run the interview example (examples\widgets\itemviews\interview\interview.exe)
3) 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".
4) press Numpad_insert+control+z to start the NVDA Python console and
   capture snapshot variables
5) query and use the interfaces using NVDA's Python console:

    >>> import UIAHandler
    >>> selectionpattern2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2)
    >>> selectionpattern2.CurrentFirstSelectedItem.CurrentName
    'Item 1:0'
    >>> selectionpattern2.CurrentLastSelectedItem.CurrentName
    'Item 3:0'
    >>> selectionpattern2.CurrentItemCount
    3
    >>> selectionitempattern = focus.UIAElement.GetCurrentPattern(10010).QueryInterface(UIAHandler.IUIAutomationSelectionItemPattern)
    >>> selectionitempattern.CurrentIsSelected
    1
    >>> selectionitempattern.RemoveFromSelection()
    0
    >>> selectionitempattern.CurrentIsSelected
    0
    >>> selectionpattern2.CurrentItemCount
    2
    >>> selectionitempattern.Select()
    0
    >>> selectionitempattern.CurrentIsSelected
    1

(Note that calling selectionitempattern.AddToSelection
in that example would also unselect all other currently
selected entries, because the underlying implementation
has a selection mode of QAbstractItemView::SingleSelection
set in QAccessibleTree::selectRow, which gets called
from QAccessibleTable::select via QAccessibleTableCell::selectCell.)

[1] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole

Change-Id: I7003bae5bbcfd5c685620bf710781165ed70f106
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-18 21:49:53 +01:00
Michael Weghorn
3bace699bf a11y uia: Support ISelectionProvider2
Support UIA's ISelectionProvider2 interface [1]
in addition to ISelectionProvider.

The ISelectionProvider2 interface inherits from the
ISelectionProvider interface.

A follow-up commit that will introduce bridging the
QAccessibleSelectionInterface, introduced in commit
9d16d5e224.

While at it, also reserve space for the amount
of children in the QList in QWindowsUiaSelectionProvider::GetSelection
before inserting them one by one, to avoid reallocations.

Sample use of the ISelectionProvider2 interface from NVDA's
Python console [2] with this commit in place:

1) start NVDA
2) run the gallery example (examples\widgets\gallery\gallery.exe)
3) click on the "Style" listbox at the top
4) press Numpad_insert+control+z to start the NVDA Python console and
   capture snapshot variables
5) query and use the interface using NVDA's Python console

    >>> import UIAHandler
    >>> iselection2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2)
    >>> iselection2.CurrentItemCount
    1
    >>> iselection2.CurrentFirstSelectedItem.CurrentName
    'windowsvista'
    >>> iselection2.CurrentLastSelectedItem.CurrentName
    'windowsvista'

[1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2
[2] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole

Change-Id: I43642e9e39b63c65da97af976cc322a8e5868170
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-18 22:49:53 +02:00
Mårten Nordheim
90af40ccd0 Handle authenticate challenge for Negotiate
Because we didn't handle Negotiate in the "Start" phase during
handleAuthenticateChallenge, we would not emit the auth signal before
our second attempt, assuming the server prompts us for one.

Emitting the authenticationRequired signal is needed for users
to be able to set the Service Principal Name (SPN) option.
Alternatively, username and password if not relying on Single sign-on.

Done-by: Emil Wipplinger <>
Pick-to: 6.6 6.5
Fixes: QTBUG-114559
Change-Id: I833c08dfeda36a6548c5ad6b8af4b8aa9d644c45
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-18 19:18:59 +02:00
Axel Spoerl
31da999542 QGenericUnixThemesDBusListener: Remove stray qDebug()
Remove a stray qDebug() statement, that was forgotten in the source.

Pick-to: 6.6 6.5
Change-Id: I5c413b4356f05570474fa2a0d6ad661785c818b0
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-07-18 14:37:53 +00:00
Ivan Solovev
32d44b612c QMutex: add missing <chrono> include
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.

Pick-to: 6.6
Change-Id: If9140499e5dccf0065a4826831d3b83813910318
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-18 15:53:07 +02:00
Ivan Solovev
7a33a08376 QSemaphore: add missing <chrono> include
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.

Pick-to: 6.6
Change-Id: I2cf5dc275c3272151efd655a4fa85936942c5708
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-18 15:53:07 +02:00
Edward Welbourne
d6dacfecb1 Fix warning in recently-added testlib snippet
Amends commit fa296ee1dc to implement
MyObject::startup(), mark it void (its return was ignored) and flag
its static wrapper as [[maybe_unused]] to calm a compiler warning.

As a drive-by, fix indentation of the class definition.

Change-Id: I3918bf8a4625a7e2b4e6d4e0cbfa68a337115865
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-18 15:28:07 +02:00
Kai Köhne
892448b6e0 Make Qt headers work with MSVC /W4
This requires explicitly marking constexpr if conditions to fix C4127
issues:

  qtbase/src/corelib/text/qstringbuilder.h(112):
  error C2220: the following warning is treated as an error
  qtbase/src/corelib/text/qstringbuilder.h(112):
  warning C4127: conditional expression is constant
  qtbase/src/corelib/text/qstringbuilder.h(112):
  note: consider using 'if constexpr' statement instead

Change-Id: I9787fb37099f811c52f93c94c9edb4da8aafdfe5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-18 14:48:19 +02:00
Marc Mutz
3bb488fb2a Use new QByteArray::assign() in QTlsBackendOpenSSL::dhParametersFromPem()
QBA::assign() re-uses existing unshared capacity(), if any, and is
therefore potentially more efficient than = QByteArray(.,.) (and never
slower).

Pick-to: 6.6
Task-number: QTBUG-106201
Change-Id: I2c45aa268c4c06396e9d7e0490666a13d8cfd532
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-18 12:14:09 +02:00
Marc Mutz
676087ef1f QSslDiffieHellmanParameters: fix mem-leak
Says ASAN:

    Direct leak of 524 byte(s) in 1 object(s) allocated from:
    #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196
    #2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65
    #3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45
    #4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54
    #5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435
    #6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139
    #7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285
    #8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94
    #9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98
    [...]

The pointer returned in the out-parameter of a i2d_DHparams() call is
supposed to be OPENSSL_free()ed by the user (this is not at all
obvious from the docs¹, but an SO answer² indicates that's how it
should be (as well as asan stopping from complaining with this
patch applied)).

¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html
² https://stackoverflow.com/a/53563669.

Amends 2cf63c71eb.

[ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of
PEM-encoded Diffie-Hellman parameters.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-18 12:13:54 +02:00
Fabian Kosmale
90226018a9 Provide QStringConverter equivalent of QTextCodec::availableCodecs
A text editor commonly wants to display a list of codecs that are
supported. With the introduction of the ICU based QStringConverter, that
list is no longer statically known. So provide the necessary
functionality.

Fixes: QTBUG-109104
Change-Id: I9ecf59aa6bcc6fe65c8872cab84affafec4fa362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-18 09:38:38 +03:00
Marc Mutz
3a166fa45d SlotObjectGuard: mark ctor nodiscard
QUIP: 19
Pick-to: 6.6
Change-Id: Idaf8cda12fe2ca97a763d78ff4c8cd7304d178e5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-18 08:15:47 +02:00
Edward Welbourne
144e10eafb Treat simple spaces as equivalent in date-time format separators
The user might not be aware of, or able to see, the difference between
Unicode's assorted horizontal spacing characters, leading them to
expect their input to be accepted for a format despite differences in
spacing. So treat the various horizontal spacing (other than tab)
characters as equivalent when matching the separators in a date-time
format. Add a test-case that failed before this fix.

Fixes: QTBUG-114909
Pick-to: 6.6 6.5
Change-Id: I3e798d3e5b89adb8e86168ebd3954904b258d630
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-07-17 23:05:07 +02:00
Edward Welbourne
61b2a6f587 QDTP: Fix handling of no-digit numeric fields
A numeric field with no digits is Intermediate, since digits can be
typed into it. The testing for this was complicated by the fact that a
sign might be either a sign in the field or the start of a following
separator.

Break out the testing of separator matching at the start of a view.
This simplifies the existing checks for full separator match and we
can use it in the no-digit numeric field's handling to make the check
more robust (matching the whole separator, rather than only its first
character). It incidentally prepares the way for other changes.

Pick-to: 6.6 6.5
Task-number: QTBUG-114909
Change-Id: I5abfccbcae3cba0979b4723c400de038fe2bf324
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 23:05:04 +02:00
Li Yefeng
fbd259856d Fix wrong scan code values in key events obtained on Windows
The scan code (Windows) value depends on the extended-key flag
(KF_EXTENDED 0x0100) in the key message. This flag was kept in scan code
value, which is wrong. It is not part of scan code, and when it's on,
another byte 0xE0 should be prepended to scan code. See:
https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag

Change-Id: Iddcabb0aae92bb784883bddc9a34fe134d787b32
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-07-17 17:07:02 +00:00
Ivan Solovev
0b3c5816c6 Explicitly specify the alignment of QUuid::Id128Bytes union
... because otherwise the union can change its alignment based on
the presence of the data128 member.
For example, QtBluetooth explicitly #undef's __SIZEOF_INT128__ in
its removed_api.cpp, which leads to UB without this patch.

Found during API review

Pick-to: 6.6
Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 18:49:16 +02:00
Ivan Solovev
0393fa6bf2 QUuid: handle quint128 and Id128Bytes data in the same way
The QUuid(quint128) ctor was handing the incoming data differently
from the QUuid(Id128Bytes) ctor. Same was valid for the return
values of QUuid::toUint128() vs QUuid::toBytes().
The provided test didn't reveal it, because it was treating the same
128-bit input value as BE in one place, and as LE in another place.

This patch fixes the test, and updates the implementation of
QUuid(quint128) ctor and toUInt128() method to verify that the
updated test passes.

This commit amends 8566c2db85

Pick-to: 6.6
Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 18:49:16 +02:00
Ivan Solovev
ef4e36aa3c QUuid: remove pointless inline keyword
constexpr functions are implicitly inline

Found during API review.

Pick-to: 6.6
Change-Id: I94daa0a67336fa99a1465115edb83e545580a78a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-17 18:49:16 +02:00
Kai Köhne
d4d600d411 Testlib: Make QTEST_ASSERT usable in constexpr functions
Commit 8ea27bb1c6 adapted the definition
of Q_ASSERT already.

Adopt the same logic for QTEST_ASSERT.

Pick-to: 6.5 6.6
Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-17 08:33:40 +00:00
Piotr Wierciński
0493504f34 wasm: Render Qt::SubWindow borderless
Windows with Qt::SubWindow flag should not have platform decoration.

Fixes: QTBUG-115054
Pick-to: 6.5 6.6
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-07-17 10:33:36 +02:00
Axel Spoerl
959a8b3967 Adapt setBackingStore() overrides in QWasmWindow and QEglFSWindow
This is a follow up to a4ca9e8065,
adapting the backing store setters to become proper overrides of
the newly implemented QPlatformWindow::setBackingStore();

Pick-to: 6.6
Change-Id: Id4f5ff8650ca4e4d3cab1d71d27041c6129bf4ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-07-16 20:28:06 +02:00
Marc Mutz
ecab68989e QCborValue: fix memleak on Array to Map coercion
When converting from an array to a map, we double the number of
elements, spread the old elements out to make one free slot of space
in front of each, and then place Integer values counting from 0 into
the free slots.

The old code contained a loop that would add a strong reference to the
original elements that happen to be containers and thus are
ref-counted in the first place. But this additional strong reference
is not needed: In both cases, detached or in-place, the detach() call
that ensured unique ownership of 'map/dst' will have either directly
or indirectly updated the ref-counts of the elements correctly, and
the following loops just reshuffle the elements in the QList, they
don't create new copies (QtCbor::Elements doesn't by itself manipulate
container->ref, but even if it did, the copy would have increased, and
the assignment of the Integers would have decreased, the ref-count
again). Adding the strong ref without a user then caused the container
members to be leaked.

Fix by removing the loop.

[ChangeLog][QtCore][QCborValue] Fixed a memory leak when an array was
coerced into a map.

Amends ccea344640.

Not picking to 6.4 as it's closed at this time.

Fixes: QTBUG-115249
Pick-to: 6.6 6.5
Change-Id: I369c372e91c3f0cfe3c65f9b0ea8507d08fdaf48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-15 16:02:04 +00:00
Axel Spoerl
a4ca9e8065 Implement virtual void QPlatformWindow::setBackingStore()
QWidget re-uses an existing backing store. Platform windows depend on
being associated to a backing store, in case they become toplevel
windows. If a platform window gets deleted and re-created each time it
is shown or hidden, it has to be manually associated to the re-used
backing store.

This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292.
It removes Android specific code from QWidgetPrivate::create(), which
has been added to suppress re-using backing stores in the absence of
the new API.

Fixes: QTBUG-97482
Pick-to: 6.6
Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-14 18:40:43 +02:00
Axel Spoerl
dbb072eb28 QWidget: Don't re-use backing store on Android
QWidget re-uses backing stores created in QWidgetPrivate::create().
The Android platform plugin creates a new platform window, when a
widget becomes a toplevel window. When it is hidden, the platform
window is deleted. The link between QAndroidPlatformWindow and its
backing store is made in the constructor of
QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is
constructed and the backing store is re-used, there is no more link
between platform window and platform backing store.
This has lead to screen assets not being painted, when shown more than
once.

This patch forces QWidgetPrivate::create() to construct a new backing
store on Android. This way, toplevel windows always have a backing
store associated with it. It adds an assertion to
QAndroidPlatformScreen::addWindow(). That will make e.g.
tst_QWidget::visible() crash without the fix.

Fixes: QTBUG-97482
Pick-to: 6.6 6.5 6.2
Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-14 18:40:43 +02:00
Dennis Oberst
08605f0d78 QNativeIpcKey: add implicit default ctor
Add an implicitly callable default ctor, to enable default returns,
but still disallow implicit conversion whilst assigning:

  QNativeIpcKey k = QNativeIpcKey::Type::~~      // not allowed
  auto fn = []() -> QNativeIpcKey { return {}; } // allowed

Pick-to: 6.6
Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-14 09:31:04 +02:00
Dennis Oberst
ba95594ea2 QNativeIpcKey: make isEmpty() and isValid() noexcept
They have no preconditions and cannot throw.

Pick-to: 6.6
Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-14 07:31:00 +00:00
Michael Weghorn
b8fb120384 a11y uia: Bridge newly added relations to UIA
Support UIA property IDs UIA_DescribedByPropertyId,
UIA_FlowsFromPropertyId and UIA_FlowsToPropertyId
by using the Qt relation types newly introduced in
f5358e5932.

As described in f5358e5932
and afbfe30093 for AT-SPI,
the relation type needs to be "inverted" for UIA just the
same, since Qt's semantics is the other way around.

Task-number: QTBUG-105864
Change-Id: Id557389af6609197f4c3b37741e4201028627004
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-13 19:30:35 +01:00
Marc Mutz
22b3eca55d tst_QThread: Unbreak UBSan build
tst_QThread peeks into QThreadPrivate, which means that a UBSan build
needs access to QThreadPrivate's type_info, for which we need to
export the class.

Amends 268ff00ef5.

Pick-to: 6.6 6.5
Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 17:47:26 +02:00
Marc Mutz
3fb0208d4b QBasicFutureWatcher: get rid of the Private
It's not needed anymore, because the class is no longer part of the ABI.

Pick-to: 6.6
Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-13 17:46:05 +02:00
Dennis Oberst
56a776da40 QNativeIpcKey: add missing noexcept to swap
Pick-to: 6.6
Change-Id: I57d5f22823597a56d93fc2f8f30b538684ce77ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-13 17:24:27 +02:00
Giuseppe D'Angelo
96d67da420 String-like containers: add implicit conversions towards std:: string views
In C++20 std::basic_string_view has gained a range constructor (like
QStringView always had), but that range constructor has been made
explicit. This means we can't just pass a QString(View) to a function
taking a u16string_view. The consensus seems to be that that types that
should implictly convert towards stdlib's string views should do that
via implicit conversion operators. This patch adds them for

* QByteArrayView => std::string_view
* QString(View) => std::u16string_view
* QUtf8StringView => std::string_view or std::u8string_view, depending
  on the storage_type

QLatin1StringView doesn't have a matching std:: view so I'm not enabling
its conversion.

QByteArray poses a challenge, in that it already defines a conversion
towards const char *. (One can disable that conversion with a macro.)
That conversion makes it impossible to support:

  QByteArray ba;
  std::string_view sv1(ba);  // 1
  std::string_view sv2 = ba; // 2

because:

* if only operator const char *() is defined, then (2) doesn't work
  (situation right now);

* if both conversions to const char * and string_view are defined, then
  (1) is ambiguous on certain compilers (MSVC, QCC). Interestingly
  enough, not on GCC/Clang, but only in C++17 and later modes.

I can't kill the conversion towards const char * (API break, and we use
it *everywhere* in Qt), hence, QByteArray does not get the implicit
conversion, at least not in this patch.

[ChangeLog][QtCore][QByteArrayView] Added an implicit conversion
operator towards std::string_view.

[ChangeLog][QtCore][QString] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QStringView] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion
operator towards std::string_view (QUtf8StringView is using char
as its storage type in Qt 6). Note that QUtf8StringView is planned to
use char8_t in Qt 7, therefore it is expected that the conversion will
change towards std::u8string_view in Qt 7.

Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 16:19:06 +02:00
Hatem ElKharashy
d5822981ee Static build fix for RenderDoc dependency
Modify configure.cmake to avoid breaking static builds
while using RenderDoc with QGraphicsFrameCapture.

Change-Id: Id0f39304b20ab3a98bfb0206cf5b52031d38f0ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 14:59:14 +03:00
Marc Mutz
d41db62154 Move QBasicFutureWatcher behind the ABI boundary
... and out of QtPrivate.

No inline API requires it anymore, so move it into the only TU using
it. Can't move it into the unnamed namespace because of the friend
declaration in QFutureInterfaceBase.

Pick-to: 6.6
Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-13 08:24:02 +00:00
Joerg Bornemann
7c82a49e6f CMake: Fix error in qt_generate_deploy_app_script
...when using a Qt cross-built for embedded Linux and
NO_UNSUPPORTED_PLATFORM_ERROR set.

Attempting to install such a project will now give the following output:

-- Skipping runtime deployment steps. Support for installing runtime
dependencies is not implemented for this target platform (Linux, shared
Qt libs, cross-compiled).

Pick-to: 6.5 6.6
Fixes: QTBUG-114069
Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 09:53:28 +02:00
Marc Mutz
dfd07205e5 QFuture: Extract Method watchContinuation() (DRY && SCARY)
The old code violated the following principles:

- DRY: the same code occurred 3× in the code-base

- SCARY: the vast majority doesn't actually depend on template
  arguments, causing template bloat

Solve both with a tiered Extract Method.

We cannot change the order of the operations performed on
QBasicFutureWatcher, in particular not the connect() to the
contination w.r.t. setFuture(), so we cannot leave the connect to the
continuation lambda outside the function, as it would mean to also
leave the setFuture() call outside.

Thanks to Volker's makeCallableObject(), we can, however, type-erase
the lambda using QSlotObjectBase, which is what connect() internally
creates, anyway, therefore bringing the whole function behind the ABI
boundary.

As a non-QObject, non-QMetaObject friend, we're lacking support for
actually doing something useful with a QSlotObjectBase, but that can
be fixed in the implementation now. The interface is stable, which is
what matters for 6.6 now.

This will allow a subsequent commit to drag QBasicFutureWatcher behind
the ABI boundary, unexporting it.

Saves a whopping 8KiB in tst_qfuture text size on optimized C++20
Linux AMD64 GCC9 builds.

Pick-to: 6.6
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-13 09:50:42 +02:00
Marc Mutz
0ecf8a2158 QVariant: make customConstructShared() SCARY¹
Extract Method non-template customConstructSharedImpl() to avoid
instantiating std::unique_ptr with a different per-F Deleter over and
over again.

Not picking to 6.5 because the function was confined to the
qvariant.cpp TU in those versions.

Cf. 11791e2a50 and
d783363f60 for similar issues.

¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf

Pick-to: 6.6
Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:50:25 +00:00
Mårten Nordheim
93fe8cb305 QRecursiveMutex: remove QDeadlineTimer::Forever leftover
Amends 5f531ae2ac
The overload taking QDeadlineTimer::ForeverConstant was required,
prior to making it an enum class, because the conversion preferred
'int'. It was made an enum class for 6.6 and most overloads were
removed, including the one for QMutex, but QRecursiveMutex was
missed.

Pick-to: 6.6
Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:49:47 +00:00
Marc Mutz
df96d39c04 ThreadPoolThreadReleaser: add Q_NODISCARD_CTOR
QUIP: 19
Pick-to: 6.6
Change-Id: I465a2ef8edc103f0655a7732f3aaaf18748854c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 00:15:33 +02:00
Ivan Solovev
f1ffc11e61 Revert "QUuid: use NSDMI to initialize the members"
This reverts commit c3c5d2cab0.
Reason for the revert - it breaks the purpose of the Qt::Uninitialized
ctor

The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor
to avoid the compiler errors:

 error: member ‘QUuid::data*’ must be initialized by mem-initializer
 in ‘constexpr’ constructor

Pick-to: 6.6
Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 19:58:26 +00:00
Alexey Edelev
4bc0a08bea Add the 'version' argument to 'qt_deprecates' pragma
syncqt uses qt_deprecates pragma to generate deprecated header files
that might live forever in Qt packages. This adds the version argument
to the pragma, that allows specifying the version when the respective
header file should be removed. The new pragma format is the following:
  pragma qt_deprecates(<header>[,<major.minor>])

If deprecation version of the deprecated header file is lower than
the current Qt version, syncqt will display the respective warning in
the log and skip generating the deprectated header file.

Also the user warning message now displays the exact version when the
header file will be removed.

Task-number: QTBUG-115029
Pick-to: 6.6
Change-Id: Ifd7464b8539b8be93b95690fd1ca70ef0b14e436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-07-12 21:58:26 +02:00
Alexandru Croitor
b9b5ed3aa6 CMake: Don't set QT_BUILDING_QT for single standalone tests
Standalone test projects have the following condition in the
beginning of their project:

 if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
     find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST)
 endif()

When configuring the project the first time, QT_BUILDING_QT is not
set, find_package is called, configuration succeeds.
But because standalone projects implicitly include QtSetup.cmake,
that file sets the QT_BUILDING_QT cache var to true, and upon test
reconfiguration, cmake errors out with:
 Unknown CMake command "qt_internal_add_test"
or similar.

This happens because QT_BUILDING_QT is true on the second
reconfiguration and the find_package mentioned above is not executed
anymore, leading to unknown internal command errors.

Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect
a standalone test and check for its value in QtSetup so we don't
set QT_BUILDING_QT to TRUE anymore.

Adjust a few code locations where QT_BUILDING_QT being false might
trigger different behavior for standalone tests.

Task-number: QTBUG-93020
Change-Id: I5413b9f37653225175a1006f7626e023045b5979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-12 18:38:31 +00:00
David Redondo
42fd8a8e8a Add support for setting the initial directory in portal file dialog
Change-Id: I2bceddb470e7870f19fc616e3dbae73cc057cb66
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-07-12 19:15:03 +02:00
Alexandru Croitor
3ba3f322b6 moc: Print sterror(errno) when moc can't write the output file
Also prepend a "Error:" label to all strrerror handling locations,
to make it clear where the error starts.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 17:48:48 +02:00
Alexandru Croitor
dd1b7b5539 moc: Store errno after fopen call
To avoid QFile::encodeName() potentially overriding the value.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: Ie751df877d6624238ded344474b5eccc324ec541
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 17:48:48 +02:00
Edward Welbourne
258e7ed9fd Doc fix: QDomDocument::ParseResult is false on error
The documentation claimed the exact opposite of what the
implementation did. Since callers use it the way it's implemented, fix
the doc.

Fixes: QTBUG-112895
Pick-to: 6.6 6.5
Change-Id: I74d6259727c7af7265224c6d79ba39265663704b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-12 15:48:48 +00:00
Laszlo Agocs
f88ac07029 rhi: metal: Remove out of date / unneeded comment
E.g. the view.layer thread checker problems are eliminated
for some time now. The other mentioned XCode warning is
likely not there anymore with newer XCode. Whereas the
rest (that we pass validation) should be obvious.

Pick-to: 6.6 6.5
Change-Id: I9754077aa6e178ee2b866b64538991412af5bb5a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-12 17:48:47 +02:00
Volker Hilsheimer
8f3f765dad Fix build with latest MSVC
Amend 813bbc515b. Unclear why this
passed CI, but we can't use implicit conversion of string or character
literals.

Pick-to: 6.6
Change-Id: I1b3515e42b09a5caae1e632320b8251c27177f52
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-12 14:56:03 +02:00
Laszlo Agocs
bcf14392df rhi doc: Make getShader in the snippets more compact
One line is better than three.

Pick-to: 6.6
Change-Id: Ib738ec18b51accead3897b450b26207b3fba87d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-12 11:42:00 +02:00
Volker Hilsheimer
84a33c67c6 Add porting documentation for QMacPasteboardMime/QWindowsMime
Task-number: QTBUG-93632
Pick-to: 6.6
Change-Id: I38294aef304adea86ecf5fbb118024037afedfe8
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-07-12 11:30:25 +02:00
Mårten Nordheim
42022f8b38 ipc common: move end-of-namespace into same scope as start
To avoid issues building with shared memory & system semaphore disabled.

Pick-to: 6.6
Change-Id: I525abe97f82266b8cca0e4f1847849054c016a4b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 11:29:53 +02:00
Timothée Keller
87bfd33082 Windeployqt: also add internal modules to module list
Not adding internal modules to the windeployqt module list makes it
give off nonsensical warnings, and can force the deployment of debug
libraries despite a --release tag. Add them in to prevent this, and
shave off the "Private" part of the module name if it exists to maintain
compatibility.

Fixes: QTBUG-114854
Pick-to: 6.6 6.5
Change-Id: I884fdc495f340ad20ba6257587da170d6c1a1415
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-07-12 11:24:30 +02:00
Marc Mutz
25f5983ea8 Normalize signal/slot signatures [1/2]: non-QPair
This is the result of running util/normalize, dropped some false
positives:

- it removed the space after "d, " in Q_PRIVATE_SLOT(d, foo())

- it removed spaces in moc text streaming of "SLOT(" << ... << ")"

In addition, the tool replaces QPair with std::pair. This is
surprising and therefore performed in a separate commit.

Pick-to: 6.6
Change-Id: If4e3815d7c0840defc1b82bcbf41a8265acda0d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 10:29:45 +02:00
Marc Mutz
97ec1d7d8e QAtomicScopedValueRollback: fix CTAD for Q(Basic)AtomicPointer
We need deduction guides to turn the AtomicPointer template argument
(the pointee) into a pointer:

    QAtomicPointer<int> → QAtomicScopedValueRollback<int*>

Extend a test to cover pointers, too.

Fixes: QTBUG-115105
Pick-to: 6.6 6.5
Change-Id: Ib416c6a43e4da480b707a0bf6a10d186bbaad163
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 10:29:44 +02:00
Yuhang Zhao
47ee4eae6a Windows style: use correct value for title bar height
The title bar height = caption bar height + resize border thickness.

This calculation is used by many open source repositories for quite
a long time, including Microsoft's own famous products such as
Windows Terminal. And if you use AdjustWindowRectEx() to get the
title bar height, the result is also exactly the same, so this should
be the correct calculation.

Normally, when DPI is 96, it should be 23 + (4 + 4) = 31px.

Pick-to: 6.6
Change-Id: I0a2de3b55d5b62327eacc7e2ff5dc23771b8efdb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-12 05:41:50 +00:00
Alexandru Croitor
c45c32af32 CMake: Expose metatypes internal functions for further use in qml
Extract the code that propagates metatypes files into separate
functions, so that they can be used in the qml api to propagate a qml
module backing library's metatype file to its associated plugin.

It's a bit messy due to the tech debt around installation, but the
behavior of the code in qtbase should not change.

Task-number: QTBUG-115152
Change-Id: I85dfcc4c76e9c41239dc0380920e68a3a6400815
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-07-12 00:53:58 +02:00
Bartlomiej Moskal
fdccb66a4e Android: Fix for checking clipboard text mime type
Different mime types are widely used on mobile devices. For example all
text copied from gmail is copied as text/html type.

After 2937cf91c7 commit there is a
regression that makes it impossible to paste any text different than
"text/plain".

To fix it, any "text/*" mime type should be treat as it contains a text
(not only "text/plain"). That will allow to paste different text mime
types.

During this work also tst_qclipboard testset was turned on for Android
and new test (getTextFromHTMLMimeType) was added.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-113461
Change-Id: I3ef9476b8facdc3b61f144bd55222898390127c9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-07-12 00:53:58 +02:00
Thiago Macieira
5bcacdbd1a QNetworkInterface/Linux: fix mismatch of pointer and pointee
It was hard to see the problem because of the lambda, combined with
reinterpret_cast on the output of non-typesafe C macro. NLMSG_DATA
returns a void*, so use static_cast to be sure not to do something
wrong.

This only affected the code that dealt with unexpected replies from the
Linux kernel, which it doesn't send. So I don't expect this fixes any
improper QNetworkInterface behavior.

Found by CodeChecker.

Pick-to: 6.5 6.6
Change-Id: I61b74deaf2514644a24efffd1770d75e5a4f2636
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-11 13:44:29 -07:00
Giuseppe D'Angelo
536a4299be Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBase
It's clean now, keep it as such.
Enabling it for QtCore is still OK, because it just hides a function
template declared in a header.

Change-Id: I8e7dfae179732ba04241a6a3258c2d722e8259df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-11 22:44:29 +02:00
Axel Spoerl
f67a497dbe QXmlStreamReader: Fix variable naming
Replace variable names referring to XML "location" with names referring
to XML context.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5
Change-Id: If00e92dce237d95fa1850f0b45192995724ba99f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-11 22:44:28 +02:00
John Chadwick
1079b53739 Fix transparency in 16 bit and 24 bit ico files
As a result of the fix for QTBUG-75214, Qt inadvertently no longer
reads the AND mask that specifies transparency for 16-bit and 24-bit
ico files. This is because it tries to detect 32-bit icons by checking
icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the
QImage, not the depth of the icon, and 32-bit QImage is used for all of
the non-indexed cases (16-bit, 24-bit and 32-bit.)

This commit instead uses icoAttrib.nbits, which should reliably
determine whether or not the icon is 32-bit. This makes the behavior
consistent with other ico reading software, including Windows.

Also, adds a unit test that verifies correct behavior of icon masks,
checking for both QTBUG-75214 and QTBUG-113319.

Amends 1d128ed1df.

Fixes: QTBUG-113319
Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385
Pick-to: 6.6 6.5 6.2 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-07-11 18:35:41 +00:00
Oliver Eftevaag
417878904b Move palette helper functions to QPalettePrivate
We want to use the bitPosition function in Qt Quick, in order to be able
to unset a bit in the resolve mask for a specific color group and role.

This patch, solves this by adding a new qpalette_p.h header, which
declares QPalettePrivate, allowing those helper functions to be accessed
anywhere internally in the qt framework.

Change-Id: Iecb28b48289d6bcabf0936274964a05d3c44efc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-11 17:42:38 +02:00
Axel Spoerl
4b43a329b7 QTabBarPrivate::setupMovableTab() - fix initialization of tab position
The method initialized the tab position with the enum value OnlyOneTab.
=> Change this to the correct initial enum value Moving.

Fixes: QTBUG-115147
Pick-to: 6.6
Change-Id: I4ce04f0a41dac6e93affd300eb424f4087eb7867
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-11 15:32:24 +00:00
Volker Hilsheimer
022657d7d0 Refactor QStyle: const'ify some local variables
Task-number: QTBUG-114473
Pick-to: 6.6
Change-Id: I49483dc9c000fac024c81a8210515c8dd5e35559
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-11 14:31:17 +02:00
Volker Hilsheimer
813bbc515b QStyle: don't use the QPixmapCache when a style sheet is set
If a style sheet is active, then the palette in the QStyleOption might
be a generated, short-lived, temporary QPalette instance. As QPalette's
cacheKey is based on instance-counters of the private data structures,
it will always be unique for such a QPalette, even if the brushes are
the same as in a previous instance.

(QPalette::cacheKey is just a 64bit integer, we cannot possibly encode
the entire QPalette data in it in a collision-free way, and since a
brush in the palette might contain a pixmap or a gradient we couldn't
even generate an efficient string representation for it. We could at
most cache and reuse QPalette instances based on the attributes in the
style sheet rule and in the base palette of the widget. However, this
seems fragile; it might be an opportunity for future optimization.)

Some styles use the QPixmapCache, with a key that includes the
palette's cache key. The key will always be unique if the palette is
based on style sheet rules, and then we fill pixmap cache with pixmaps
that can never be reused, making the cache both useless and wasteful.

To solve this, generate an empty key if we detect that it is for a style
object that is the target of a style sheet. Return an empty cache key
string from QStyleHelper::uniqueName, which will make QPixmapCache
return immediatey when trying to insert or find an object.

This is not pretty, but it makes the change minimal and low-risk.
Refactoring the respective code paths to e.g. consistently use the
BEGIN_STYLE_PIXMAPCACHE helper macro requires larger changes that
can only be verified visually, and so are out of scope for a bug fix.

This requires changes to code that uses QStyleHelper::uniqueName, as we
need to avoid that other key elements are appended to the generated (and
maybe empty) key. As a side effect, this ends up with code that makes
better use of QStringBuilder.

Pick-to: 6.6
Fixes: QTBUG-114473
Change-Id: I011aed0885f105cbf1e8c0bc6b94c46df47761a3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-11 14:31:12 +02:00
Hatem ElKharashy
a11ee31883 Add a private API to capture a graphics frame
This commit provides a minimal API for capturing a graphics
frame, save it and replay it later for debugging. The intention
here is to provide the basic need for future work to allow capturing
through tooling or programmatically from code. This API is
intended to be cross-platform by using Metal Capture Manager on
Apple devices and RenderDoc C++ API everywhere else.

Task-number: QTBUG-114067
Change-Id: If72d92bdef5e5985a0ec2e85e97fd1182da3c53c
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-07-11 15:24:26 +03:00
Keith Kyzivat
5698fcb023 Correct typo in QWidget::backgroundRole()
Correct the typo inherts to inherits in QWidget::backgroundRole() docs,
as it is incorrect english.

Fixes: QTBUG-115160
Change-Id: I03892753d6ec7d81c1f818fd9caa279ca11cc3ec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-10 21:07:59 -04:00
David Faure
056bdef045 Fix assert in qCleanupFuncInfo when using QDebug from a lambda with auto
ASSERT: "size_t(i) < size_t(size())" in file qbytearray.h, line 492
due to info being emptied out completely and then the code does
while ((info.at(0) == '*')

info was empty because the recent fix "that wasn't the function argument
list" would exit the loop with pos at end.

Incidentally, this change fixes the fact that qCleanupFuncInfo was
removing lambdas:
  main(int, char**)::<lambda()>
became
  main(int, char**)::
which was, well, shorted, but weird.

Pick-to: 6.6 6.5
Change-Id: Ic7e8f21ea0df7ef96a3f25c4136a727dc0def207
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-11 02:37:58 +02:00
Volker Hilsheimer
8c18a245b0 QAbstractScrollArea: Don't include size of invisible scrollbars
Amend 3e59a88e89, which incorrectly used
isHidden() to test whether the scrollbar is visible or not.
QWidget::isHidden() is only true for child widgets that are explicitly
hidden (or created for visible parents, which the scrollbars are not).
Since the scrollbars are children of a container that is hidden and
shown, isHidden always returns false.

Instead, use QWidget::isVisibleTo, passing the scroll area, as that
tells us if the scrollbar's visibility is relevant for the layout of the
scroll area.

Add a test case for QAbstractScrollArea, verifying that the scrollbar's
size is correctly taken into account when calculating the size hint.
This change revealed an instability in the tests introduced in the
earlier commit: the layout process is asynchronous, requiring event
processing to update the visibility of the scrollbars. Add a call to
processEvents before storing the reference size hint. Also, explicitly
set a style that doesn't use transient scrollbars as otherwise we cannot
control when the scrollbars are shown.

The chagne also revealed an inaccuracy in the QListView test, which
only passed because the width of the vertical scrollbar was included.
We cannot use font metrics results to compare expected width, as the
item delegate's text rendering uses text layouts.

Task-number: QTBUG-69120
Fixes: QTBUG-109326
Fixes: QTBUG-113552
Pick-to: 6.6 6.5
Change-Id: I1f06f9e88046a77722291ac17c56090f8dff7cf3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-11 01:34:19 +02:00
Axel Spoerl
c4301be7d5 QXmlStreamReader: Raise error on unexpected tokens
QXmlStreamReader accepted multiple DOCTYPE elements, containing DTD
fragments in the XML prolog, and in the XML body.
Well-formed but invalid XML files - with multiple DTD fragments in
prolog and body, combined with recursive entity expansions - have
caused infinite loops in QXmlStreamReader.

This patch implements a token check in QXmlStreamReader.
A stream is allowed to start with an XML prolog. StartDocument
and DOCTYPE elements are only allowed in this prolog, which
may also contain ProcessingInstruction and Comment elements.
As soon as anything else is seen, the prolog ends.
After that, the prolog-specific elements are treated as unexpected.
Furthermore, the prolog can contain at most one DOCTYPE element.

Update the documentation to reflect the new behavior.
Add an autotest that checks the new error cases are correctly detected,
and no error is raised for legitimate input.

The original OSS-Fuzz files (see bug reports) are not included in this
patch for file size reasons. They have been tested manually. Each of
them has more than one DOCTYPE element, causing infinite loops in
recursive entity expansions. The newly implemented functionality
detects those invalid DTD fragments. By raising an error, it aborts
stream reading before an infinite loop occurs.

Thanks to OSS-Fuzz for finding this.

Fixes: QTBUG-92113
Fixes: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I0a082b9188b2eee50b396c4d5b1c9e1fd237bbdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-10 22:44:06 +02:00
Amir Masoud Abdol
8b4dbce54e Introduce macro.qtpolicydeprecatedbehavior for Qt CMake Policy
Added a template that we can use instead of rewriting the message for
every policy.

Pick-to: 6.6
Change-Id: I13cc182244d5f092e3d5677664bc149c6b126da5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-10 21:47:08 +02:00
Thiago Macieira
1ca71cbff0 QLibrary: make isLoaded() report whether this object has load()ed
This reverts commit c2a92199b57b195176d2a0d68d140d72c1cbfb71
"QLibrary::setFileNameAndVersion: reset the tag after findOrCreate".
This restores the behavior of resolve() and compatibility with Qt 4 and
5, which is documented to imply a call to load().

Do note that if you call load() or resolve() and don't call unload(),
the library you've loaded can never be unloaded now. So don't leak!

[ChangeLog][Important Behavior Changes] QLibrary::isLoaded() now reports
whether this instance of QLibrary has succeeded in loading the library,
via direct or indirect call to load(). Previously, it used to reported
whether the actual library was loaded by any QLibrary instance.

The change to QLibrary::resolve() itself is effectively a no-op in this
patch, because isLoaded() would have returned false, but it ensures that
the implementation does what it says it will do.

Fixes: QTBUG-114977
Pick-to: 6.6
Change-Id: I907aa7aea8ef48469498fffd176d7a76ae73e04a
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-10 09:53:53 -07:00
Marc Mutz
568ab62185 QDebug: rewrite timeUnit() into putTimeUnit()
This avoids us committing to the QByteArray return value, which is
overkill for short strings. Instead, pull the streaming of the unit
behind the ABI boundary, so we're free to change the implementation to
either stream directly or use SSO'ed std::string.

Pick-to: 6.6
Change-Id: I10927acb9d64077d9018b667958ca16be218012a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-10 13:51:52 +00:00
Alexey Edelev
d4e3d008fe Make sure that exception flags are not overridden in syncqt tool
qt_internal_add_tool has the implicit logic that disregards the
previously installed flags and adds new flags that overrides the
exceptions behavior. Add the tool-specific option to make sure
that this won't happen.

Ammends 0f5fbe369b

Pick-to: 6.6 6.5
Change-Id: Id149d8d8002390581813475124ba37dd39d56b9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-10 14:53:34 +02:00
Ievgenii Meshcheriakov
3fa3e56e64 QDBusConnectionPrivate: Use enum for mode argument of sendWithReply
Change type of mode argument to QDBus::CallMode instead of int.

Also change the argument name in the implementation to much the
declaration.

Change-Id: Ice19bfff72f3bf1f4a5748f2caa16999e87a131f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-10 14:53:34 +02:00
Mårten Nordheim
babdeb7a10 http2: inline a couple static variables
It looks cleaner when it's declared where it's defined.

Change-Id: I5006fc086c73e6d4891bc64ff3a8c6b4b17623fe
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-10 14:53:34 +02:00
Mårten Nordheim
8f4e29cc85 http2: Use QByteArrayView in lambda where we only parse
Thinking back I'm 99% certain I deliberately used QBA because I was
going to cherry-pick it back and didn't feel like dealing with failing
builds. Coming up we will have a lot of other changes here so let's
change this as well.

Change-Id: Ifc60ad8ee2a1e5b75ac766b4a8b7e1559f80e942
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-07-10 14:53:33 +02:00
Mårten Nordheim
991053fdff http2: use qAddOverflow instead of local function
Change-Id: Ice7f0f026353f5668a437cc35d9b21cde0a69182
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-07-10 14:53:33 +02:00
Mårten Nordheim
f49e62e782 http2: perform clang-tidy suggestion to use emplace_back
Change-Id: I4148f94a7d9944eddccaba6dbc956abcd2ad9937
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-10 14:53:33 +02:00
Mårten Nordheim
35450cde05 http2: use find() instead of multiple lookups
Change-Id: Ibef8da7349d143433522bbb0fd2ee228f0d58135
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-10 14:53:33 +02:00
Doris Verria
00bdf56b83 iOS: Add version check when setting accent color
UIColor.tintColor is only available on iOS 15.0 or newer. Ammends
commit 69cc7f946a

Pick-to: 6.6
Change-Id: Id82006629ee3c3d2548ea39afde265cdccf2cdab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-10 14:11:30 +02:00
Volker Hilsheimer
ee956824db QPixmapCache: assert that the key is invalid if we failed to insert
QCache::insert on failure destroys the QPixmapCacheEntry, which calls
releaseKey(), which invalidates the key. That's hard to follow, so add
an assert to make it more explicit and prevent future errors.

Pick-to: 6.6
Change-Id: I9c062ef5a6e34c783c064330c914ce4f9a3f9984
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-10 14:11:30 +02:00
Joerg Bornemann
9f016e9656 CMake: Properly respect user setting of AUTOGEN_TARGETS_FOLDER
There was a typo in the code that reads the property.

Pick-to: 6.5 6.6
Change-Id: I6a26899ecc6de800fcfaff6da659a611939753ff
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-10 12:57:21 +02:00
Michael Weghorn
6ec35ff8c5 a11y: Report app as parent for top-level item views
As happens for other widgets
(s. QAccessibleWidget::parentObject), report the app
as accessible parent for item views that don't
have another parent set.

Otherwise, the accessible tree is broken when
there's a top-level item view:
The application has the item view as a child,
but the child does not have any parent set.

Extend a QListView autotest accordingly.

Fixes: QTBUG-115135
Pick-to: 6.6 6.5
Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-10 11:34:41 +02:00
Mitch Curtis
6b6678bc88 Doc: state blacklist condition requirement explicitly
Each line with a test function must be followed by a line describing
the conditions for ignoring that test function.

From what I can see, this wasn't explicitly stated anywhere.

Fixes: QTBUG-114825
Pick-to: 6.2 6.5 6.6
Change-Id: I1941d6c9a6d56a8374a0c5a99c538cf1eaebd544
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-10 13:42:00 +08:00
Morten Sørvig
a4d1c30a1b wasm: clarify qtloader onExit behavior
onExit is called whenever the application exits, i.e.
when the app canvas should no longer be displayed and
the loader/embedder code should take some action.

Emscripten provides two callbacks which can be used
here:
  - onExit, called when the app exits (but see EXIT_RUNTIME)
  - onAbort, called on abort errors.

These map to the two cases Qt's onExit supports. onExit
is not called when EXIT_RUNTIME is disabled, which means
we don't need the special case for exit code 0.

In addition call onExit on any exception. The second
call to showUi() in html_shell.html is then not needed
any more and we avoid duplicating the UI state handling
in user code.

Update the qtloader_integration test to handle changes in
behavior (we no longer set the error text on exit). Use
emscripten_force_exit() to simulate application exit -
using this function makes Emscripten call onExit even
when EXIT_RUNTIME is disabled.

Pick-to: 6.6
Change-Id: I72b5463c1836e8d5054e594abbd304fbc67032b7
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-07-10 05:13:56 +02:00
Morten Sørvig
20d17b1a3b wasm: Add qtloader compatibility API
Implement the main features of the pre Qt 6.6 loader
as adaption layer on top of the new loader.

Pick-to: 6.6
Task-id: QTBUG-115049
Change-Id: Iabe860d3fb0488fd003876508787da3688e0c87b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-07-10 05:13:46 +02:00
Marc Mutz
416e07e057 QEventLoopLocker: rewrite to hold public classes
... instead of Private ones, at the cost of having to befriend of all
the lockable classes, because we need access to their d_func()'s.

This simplifies the code, because we don't need the manual QClass to
QClassPrivate mapping (o2p) anymore, we can just use d_func(). This also
paves the way to make QEventLoopLocker almost completely inline and use
a 3-pointer form of QBiPointer, once available, to hide the bit
fiddling. We couldn't make such a change if the class continued to hold
pointers to QClassPrivate's.

Pick-to: 6.6
Task-number: QTBUG-114793
Change-Id: Id300e4d45d6cacabe090a46cd6433c5ead3c8b0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-09 21:23:17 +00:00
Ahmad Samir
536696196c QStorageInfo: split Linux specific code to a separate source file
Much less crowded.

Inline QStorageInfoPrivate::root() to ease the split; the Windows
specific code is one extra line.

Change-Id: Icec6822cf436e2b4aa1b3a04184fbfa40e508078
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-09 01:44:49 +03:00
Ahmad Samir
4fe704eff9 ipc.qdoc: fix typo in API docs
Change-Id: Ifb999b7b96583c7ffa42b91078535b4bfa91616f
Pick-to: 6.6
Task-number: QTBUG-2443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-09 01:44:49 +03:00
Thiago Macieira
80a431a2e6 QBasicAtomicXXX: remove the comment about them being "New atomics"
They were new... in commit 1f843ca39e
("Add the new QBasicAtomicXXX implementation - no backends yet") for Qt
5.0, which is what allowed us to use the C++11 atomics. That replaced
the even older implementation from Qt 4.4 where QBasicAtomicInt was a
full class and we didn't support any other integer types. That of course
replaced the even older QBasicAtomic from 4.0, first introduced in 2004
(7 years before C++11).

Change-Id: I53335f845a1345299031fffd176fa251b31bfeea
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-08 15:44:49 -07:00
Thiago Macieira
271901c5cf QProcess/Unix: add a simple way to reset the UID and GID for the child
This is done as one of the last steps inside QProcess itself, so the
child modifier and all other tasks still run with the parent process'
permissions. On Linux, setting the UID to non-zero will also
automatically clear the effective capabilities(7) set.

This feature is only useful for setuid or setgid applications, so this
commit updates the QCoreApplication::setSetuidAllowed() documentation to
mention the QProcess flag.

Change-Id: I3e3bfef633af4130a03afffd175e940c0668d244
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-08 15:03:23 -07:00
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
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
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
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
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