Commit Graph

61471 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
313bb32364 QRegularExpression: match newlines when converting wildcards
A * or a ? in a wildcard pattern is allowed to match any character,
including newlines. When converting a wildcard pattern to a PCRE,
* and ? were converted to ., which by default does _not_ match over
newlines (/s is necessary).

There isn't a metacharacter that matches everything, so either we modify
the returned pattern to enable dot-matches-all (for instance, by
wrapping the returned expression in (?s:...)), or use a character class
that includes everything. Picking this last approach for simplicity.

Change-Id: I86703f654e3414783427c4c8e0bb018885b42e54
Fixes: QTBUG-113676
Pick-to: 6.5
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-23 00:03:37 +02:00
Thiago Macieira
c5221f6be0 QProcess/Linux: add a flag to re-enable the vfork()-like semantics
Commit 29b2fe40dc disabled it by reverting
commit d6bf71123d. We now add the promised
flag to opt-in. The flag is added to all Unix systems, but it really
only applies to Linux right now.

No ChangeLog because the whole UnixProcessParameters structure is new
and has its own changelog.

Task-number: QTBUG-104493
Task-number: QTBUG-111243
Task-number: QTBUG-111964
Change-Id: Icfe44ecf285a480fafe4fffd174d4effd3382495
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2023-05-22 10:43:53 -07:00
Thiago Macieira
f9c87cfd44 QProcess/Unix: add setUnixProcessParameters()
This commit adds those three flags that are either frequent enough or
difficult to do: close all file descriptors above stderr and reset the
signal handlers. Setting SIGPIPE to be ignored isn't critical, but is
required when the ResetSignalHandlers flag is used, as this is run
after the user child process modifier.

[ChangeLog][QtCore][QProcess] Added setUnixProcessParameters() function
that can be used to modify certain settings of the child process,
without the need to provide a callback using setChildProcessModifier().

Change-Id: Icfe44ecf285a480fafe4fffd174d0d1d63840403
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-22 10:43:50 -07:00
Volker Hilsheimer
6a4afebc5c macOS: Fix assertion in accessibility implementation for treeviews
In QAccessible's widget implementations, trees are treated as tables,
with a rowCount implementation that is based on the view's current
item content. That item content is the view's content, not the model's,
and it changes when tree branches are expanded.

The Cocoa bridge for accessibility allocates arrays of row data
structures based on the rowCount implementation. Those data structures
need to be invalidated and recreated when the view's content changes.
To do that, emit an accessibility event for a model reset when laying
out items changes the size of the view's item array. We don't know what
changed during that layout process to makes this any more granular.

Amends 11ae55e918, but the problem
with the data structure being stale and incorrect would have been there
before that chain of changes optimizing. It didn't trigger an assert,
but probably resulted in incorrect data being reported.

To make trees testable, we need to actually expose them as AXOutline
to the macOS accessibility framework. Until now, they have been treated
like plain QWidget, e.g. AXGroup. This made them in practice in-
accessible. With this change, VoiceOver works much better (although not
perfeclty yet).

Also remove an assert that could be triggered by an accessibility
client asking for a cell for an invalid index (which can be reproduced
by navigating around in a tree, following debug warnings from
QAccessibleTree::indexFromLogical: invalid index).

Pick-to: 6.5
Change-Id: I7650342aa0dcd7925a94ae6a36de5a0b344c467d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-05-22 16:45:28 +02:00
Volker Hilsheimer
b60c31de52 macOS: show the test function in the title of the test window
This makes it a bit easier to know what's going on when debugging.

Pick-to: 6.5
Change-Id: I5955b9b590c7aea584748f36e4fe15d41fd05ac1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-05-22 16:45:27 +02:00
Volker Hilsheimer
e4e186771e Fix warning, remove unused variable
Change-Id: I77167919a2382f38d10694ce14ccd209cc7c2377
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-05-22 16:45:27 +02:00
Axel Spoerl
980a499ad0 Implement color role AccentColor in QStyleSheetStyle and QCssParser
The color role AccentColor has been added to QPalette.

This patch implements the new color role in QCssParser and subsequently
in QStyleSheetStyle.
The QBrush variable names used to populate brushes, have been changed
into speaking names for better code readability.

tst_QCssParser has been adapted accordingly.
The test function accentColor() has been added in tst_QStyleSheetStyle.

Documentation has been updated.

Change-Id: Ib09ddc1b61868f2bb8f70f654e83ea1c35276d30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-22 14:45:26 +00:00
Axel Spoerl
227b639499 Make Gnome theme react to color theme changes without GTK
Qt doesn't react to color theme changes on systems running Gnome
without GTK.

This patch adds support for such in QGnomeTheme, following
https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Pick-to: 6.5
Change-Id: I1f6252d4f394b810b9e4aebe00f2715c8fec3b56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-22 16:43:02 +02:00
Morten Sørvig
486a89f7bb wasm: add INSTALL_LIBDIR as library search path
Fixes error where Emscripten fails to find Qt library
dependencies at application link time.

Change-Id: I03b154f60ab5dc3a4c8d0d21d47551c9584029a2
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-22 16:43:01 +02:00
Ievgenii Meshcheriakov
8d13a9e387 QtDBus: Move dispatch enabling code into a single function
Remove the helper class.

Change-Id: I82edd7fa1ce1d8b9044938a1378f992a40a0bbdf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-22 11:49:30 +02:00
Samuli Piippo
f99e518327 QDnsLookup/Windows: add missing typedefs for older mingw
Amend 9a73bc5f3d with more typedefs
missing from older mingw headers:

| src/network/kernel/qdnslookup_win.cpp:40:3: error: 'PDNS_QUERY_COMPLETION_ROUTINE' does not name a type; did you mean 'LPOVERLAPPED_COMPLETION_ROUTINE'?
|    40 |   PDNS_QUERY_COMPLETION_ROUTINE pQueryCompletionCallback;
|       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| src/network/kernel/qdnslookup_win.cpp:47:9: error: 'PDNS_QUERY_RESULT' has not been declared
|    47 |         PDNS_QUERY_RESULT   pQueryResults,
|       |         ^~~~~~~~~~~~~~~~~
| src/network/kernel/qdnslookup_win.cpp:77:5: error: 'DNS_QUERY_RESULT' was not declared in this scope; did you mean 'DNS_QUERY_REQUEST'?
|    77 |     DNS_QUERY_RESULT results = {};
|       |     ^~~~~~~~~~~~~~~~

Change-Id: I812525aaa938764d337923820d0eb8b3e24a0004
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-22 05:27:33 +00:00
Axel Spoerl
17c589df94 Shoehorn AccentColor into QPalette and keep existing 64bit resolve mask
It is necessary to add an AccentColor role to QPalette.
QPalette currently has 21 color roles and 3 color groups, which
require 63 bits to resolve. The resolve mask is implemented with a
qint64, which doesn't provide spare bits for another color role.

The color role NoRole is used as a default value, marking that a role
has not (yet) been defined. The enum value does not represent a valid
brush, even though it can theoretically be stored in QPalette's shared
data.

This patch adds the enum value AccentColor to QPalette::ColorRole,
increasing the available color roles to 22.
To keep the resolve mask at 63 bits, AccentColor is mapped to NoRole
in static constexpr bitPosition.

As the enum range would exceed 64 bits without this tweak, 3 additional
bits are substracted in the respective static assertion.

With NoRole having no bit in the resolve mask, the following adaptions
have been implemented:
- QPalette::resolve() is adapted to explicitly ignore NoRole.
- QPalette::isBrushSet() always returns false for NoRole.
- tst_QPalette::setAllPossibleBrushes() to verify the latter
- operator== ignores NoRole (documentation updated)

AccentColor is added in tst_QPalette::roleValues and enum documentation
is adapted.

In QPalette's default constructor, the AccentColor brush is defaulting
to the Highlight brush, it this is available. Otherwise it is made 30%
darker or lighter than the Base brush, depending on dark/light mode
heuristics.

QPalette's data stram functions have been extended from QDataStream
Version Qt_6_6. If earlier versions are de-serialised, the AccentColor
defaults to Highlight. An autotest function dataStream() has been added
to tst_QPalette.

The QDataStream Version Qt_6_6 has been bumped to 21.
tst_QDataStream has been adapted to the new version and the new
color Role.

Change-Id: I98bbf9de95fb83bda921e9614a0db3a3c0ebdf75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-21 18:36:37 +02:00
Axel Spoerl
0328e4297e QGenericUnixThemes: Make DBus listener configurable
The DBus locations and signals QGenericUnixThemesDBusListener has
listened to, were hard coded.
While these hard codings were in line with the signals emitted by the
Linux systems officially supported by Qt, this approach has made it
impossible for Qt to react to (color) theme changes when they are
announced by other DBus signals.

This patch replaces hard coded signals with a QFlatMap member.
The member is populated with the DBus locations/signals currently
supported.

If the environment variable QT_QPA_DBUS_SIGNALS_SAVE contains a valid
file name, the default configuration is stored in a JSON file.
If the environment variable QT_QPA_DBUS_SIGNALS contains a valid file
name, the default configuration is replaced with its content.

While the patch doesn't change existing behavior, it adds the
possibility to customize alternative DBus signals to listen to.

Task-number: QTBUG-103093
Pick-to: 6.5
Change-Id: I37e085c74bf53eed5cda7ec0dd7105562df0ed21
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-21 18:18:20 +02:00
Laszlo Agocs
1dd8b5ceec rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from
shadertools; done separately) become "RHI APIs", following the concept
of QPA APIs.

Mirror completely what is done for QPA headers, but using the "rhi"
prefix for the headers. This involves updating syncqt to handle the
new category of headers. (a note on the regex: matching everything
starting with "qrhi" is not acceptable due to incorrectly matching
existing and future headers, hence specifying the four header names
explicitly)

There is going to be one difference to QPA: the documentation for
everything RHI is going to be public and part of the regular docs, not
hidden with \internal.

In addition to the header renaming and adding the comments and
documentation notes and warnings, there is one significant change
here: there is no longer a need to do API-specific includes, such as
qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a
single header that is then included from qrhi.h. This means that users
within Qt, and any future applications can just do #include
<rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no
other headers are needed.

There are no changes to functionality in this patch. Only the
documentation is expanded, quite a lot, to eliminate all qdoc warnings
and make the generated API docs complete. An example, with a quite
extensive doc page is added as well.

Task-number: QTBUG-113331
Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-21 15:42:58 +02:00
Thiago Macieira
30a8e79243 QCallableObject: work around VS2022 compiler bug
Address Sanitizer in Visual Studio reported:

 ==17744==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x11ffe2ba0760 at ...
 WRITE of size 1 at 0x11ffe2ba0760 thread T0
 0x11ffe2ba0760 is located 0 bytes to the right of 16-byte region [0x11ffe2ba0750,0x11ffe2ba0760) allocated ...

Disassembly of QCallableObject's constructor shows that the compiler did
emit that 1-byte store of a null byte, 16 bytes after the object start,
of an object whose size is 16 bytes. The location of this code implies
it was the initialization of the StorageEmptyBaseClassOptimization
sub-object. Without an explicit constructor, this was an aggregate
initialization.

This seems to be the same issue as [1]. The workaround is to give it an
explicit constructor, the same workaround as [2].

I suppose other people using Empty Base Optimization haven't run into
this issue because that empty base usually overlaps something inside the
object. So an alternative workaround would be to invert the order of
derivation such that StorageEmptyBaseClassOptimization was the first
base.

[1] https://developercommunity.visualstudio.com/t/address-of-empty-base-class-is-wrong-c-bad-code-ge/322444
[2] https://developercommunity.visualstudio.com/t/empty-class-derived-from-empty-base-class-causes-r/451088

Change-Id: I5f7f427ded124479baa6fffd17609adca0f8e235
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-20 20:18:23 +02:00
Thiago Macieira
8566c2db85 QUuid: add support for 128-bit integers
[ChangeLog][QtCore][QUuid] Added support for converting between QUuid and
quint128, on platforms that offer 128-bit integer types (all 64-bit ones
supported by Qt, except MSVC).

Change-Id: Id8e48e8f498c4a029619fffd1728c9553e871df5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-20 04:59:43 +00:00
Thiago Macieira
befda1acca QTypes: add q{u,}int128 as a first-class, integer type
This is supported on all 64-bit platforms by Clang and GCC and will be
used by QUuid, with support in QDataStream and partial support in
QTextStream. CBOR also has a reserved "additional information" field for
128-bit quantities, but it's not allowable right now.

This conflicts with the quint128 type in QtBluetooth, which was not an
integral type. It has been removed in 1e903be81f43da4e31385bb7866bb4d3f07e5eba.

Change-Id: Id8e48e8f498c4a029619fffd172893c81aed3481
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-19 20:09:42 +00:00
Christian Ehrlicher
b40ab2f8a6 SQLite: Update SQLite to v3.42.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.42.0

Pick-to: 5.15 6.2 6.5
Change-Id: Ie4eca58cfe94f19252279412c2f5a2515f1bee4c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-19 13:53:10 +02:00
Amir Masoud Abdol
3431aeafc0 Resolve symbol conflict between qmutex_unix and qwaitcondition_unix.cpp
In `qmutex_unix.cpp`, renamed `report_error` to `qt_report_error`; and
in `qwaitcondition_unix.cpp` renamed `report_error` to
`qt_report_pthread_error`. In addition, I removed the temporary
exclusion of the qwaitcondition_unix.cpp from unity build.

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

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

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

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

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

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

Pick-to: 6.5
Change-Id: If81465194d92d04af637b0032d9504d6524893aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-18 22:39:20 +03:00
Ahmad Samir
a2abca317a Moc: silence a GCC warning
It's already silenced for Clang, extend it to cover GCC too.

Change-Id: I212ca78d7a203d69d490c46e7ef4b78a60cabd80
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-18 22:39:16 +03:00
Thiago Macieira
5b6f59d6e7 IPC: QNativeIpcKey: enable the slow path
I had designed this to be fast for the common, new case of using
QNativeIpcKey objects with a key, a type and maybe in the future we'd
need a flag or two. Turns out that the very first thing I'll need is a
QString, so enable this code path.

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

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

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

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

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

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

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

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

    labels          63 octets or less

    names           255 octets or less

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

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

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

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

This can't be fixed in Qt 6.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Guard the flag using genex.

Amends e3cc2487ce63cae42d8054b38fdb54abe8545007

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

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

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

Change-Id: I49f182463ca307aaf6370adfa43bae14b4ce0df8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-16 17:55:49 +02:00