Commit Graph

47278 Commits

Author SHA1 Message Date
Laszlo Agocs
8a175f4ae2 rhi: d3d11: Revive non-flip swapchain model support
Make the QT_D3D_NO_FLIP env.var. have an effect again.

This env.var. has the following effects:

- SwapEffect is set to DXGI_SWAP_EFFECT_DISCARD

- Scaling is set to DXGI_SCALING_STRETCH (no other option with the
  blitting legacy model)

- Alpha works without having to deal with DirectComposition, the dcomp
  code path is therefore skipped completely in legacy mode

- Requesting a HDR mode behaves incorrectly (there's an unwanted
  conversion to SDR or something like that)

- Different window resizing artifacts. Instead of the big black/white
  bars, that is typical with the modern, efficient flip swapchains in
  non-Qt applications as well, there is a bit of shimmering on the
  right side esp. when resizing on the left side. The option of using
  the legacy is model provided mainly for users where this is
  important.

- Reduced performance due the using the old blitting model, although
  that probably won't be visible for many typical Qt applications on
  desktop PCs.

Only for D3D11, because D3D12 does not support non-flip swapchains.

Note: this is incompatible with QT_QPA_DISABLE_REDIRECTION_SURFACE.

The reason to reintroduce this option is to provide a way, even if
just as a developer-focused environment variable, to get a behavior
that is identical to other frameworks and non-Qt applications that
still use D3D11 with the legacy swapchain modes in their rendering
engines. This applies first and foremost to window resizing, where
the visual artifacts common with flip model swapchains may be
misunderstood to be caused by Qt. Having a way to opt-in to the
legacy model allows avoiding/clarifying Apples-to-Oranges
comparisons.

Pick-to: 6.6 6.5
Change-Id: I04e46f71a96fa56cace38703e0e9b93b43bfebc7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-10-16 18:43:16 +02:00
David Faure
d5c427c145 Add missing | operator for QRegularExpression::WildcardConversionOptions
Pick-to: 6.6
Change-Id: I76ed4ee5ef45a279c584e09fbd6d83f1b9127769
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-16 18:43:16 +02:00
Mårten Nordheim
f44e04b14c QNetworkInfo[NetworkManager]: Avoid creating temporary QStrings
Previously we had some inline c-string literals. But since the parameter
for those is const-ref QString it has to actually allocate the storage
and convert the string to UTF-16.

By putting it as a function that returns a QString constructed
with u""_s, we instead create a cheap non-owning QString that just
refers to the string somewhere in memory.

As a drive-by: move other string-literals into functions as well.

Change-Id: I2f2ca5b979cfa772665fa83689837f991b0c656d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-16 17:41:21 +02:00
Orkun Tokdemir
4b1d96ea1b Revert "CMake: Update timestamp file for Multi-Config and Cross-Config builds"
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8878 is
reverted, the related change in `qtbase` also should be reverted.

This reverts commit 8041bfba47 and 7a87149c25

Change-Id: Iae42755ffc7b2c97e9cda4c211319df767a421b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-16 17:41:21 +02:00
Thiago Macieira
cad7164ee2 QStorageInfo/Linux: include QDir::Hidden in the search for labels
There's nothing wrong with device labels starting with a dot. Whether
udev would encode those as \x2e is unknown, but we may as well not tempt
fate in case it has changed or changes in the future.

Also including QDir::System in case udev places the actual device nodes
in /dev/disks/by-label instead of a symlink.

As a nice and intentional side-effect, QDirIterator no longer performs a
stat() in each of the entries, removing the double stat'ing that started
happening with the previous commit.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787681b4cf2bb58
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-16 08:41:21 -07:00
Thiago Macieira
df8514a764 QStorageInfo/Linux: simplify the code to deal with skipped entries
In addition to what parseMountInfo() filtered, we also filter entries
with zero total bytes (other than the root filesystem). This avoids
creating yet another QStorageInfoPrivate that may not be used, but most
importantly it avoids calling root() for that check, which would call
parseMountInfo() again.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787538dd3f285d0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-16 08:41:21 -07:00
Thiago Macieira
c82ed8b279 QStorageInfo/Linux: avoid parsing /proc/self/mountinfo N+1 times
Mine has 41 lines, of which 22 are returned by parseMountInfo with
filtering. That meant the file was parsed once to get the listing, then
22 times more to create a QStorageInfo for each entry. Now
QStorageInfo::mountedVolumes() opens the file and parses it only once.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178752ef6c2122f2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-16 08:41:21 -07:00
Thiago Macieira
9aaf12ebaa Work around GCC 13's bogus "out of bounds" check to QByteArray::_empty
Nothing here is empty and even if anything were, QStringBuilder properly
handles empty strings.

In static member function ‘static void QConcatenable<QByteArrayView>::appendTo(QByteArrayView, char*&)’,
    inlined from ‘static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = char; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:398:37,
    inlined from ‘T QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> >::convertTo() const [with T = QByteArray; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:117:54,
    ...
qstringbuilder.h:178:19: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [1, 5] is out of the bounds [0, 1] of object ‘QByteArray::_empty’ with type ‘const char’ [-Werror=array-bounds=]

QStringBuilder::convertTo() creates the target as
        const qsizetype len = QConcatenable< QStringBuilder<A, B> >::size(*this);
        T s(len, Qt::Uninitialized);

We know len can't be zero because GCC is complaining about a memcpy()
when the offset has been changed from 0, meaning QByteArray was given a
non-zero size and therefore its data pointer is not &QByteArray::_empty.

Fixes: QTBUG-116763
Pick-to: 6.5 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178af437984080fb
Reviewed-by: Shawn Rutledge (away) <shawn.rutledge@qt.io>
2023-10-15 18:36:25 -07:00
Thiago Macieira
eedb715ece qTzName: suppress warning that tzname is deprecated with UCRT
Use the pre-existing MSVC code path, which uses UCRT.

warning: 'tzname' is deprecated: Only provided for source compatibility; this variable might not always be accurate when linking to UCRT. [-Wdeprecated-declarations]

Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178dc618f1a8f034
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2023-10-15 18:36:04 -07:00
Samuel Gaist
c7eac23d96 doc: improve property example slot
The current example shows a minimal implementation. However, neither
this example nor the documentation explains what happens without the
guard. Although it's not mandatory, the large majority of the time
it's a good practice to have it. This patch improves this part.

Change-Id: I411a9d66bd7d8ba16aac87e28b5cab219fd71a5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-14 20:19:56 +00:00
Pavel Dubsky
3373247873 Introduce QComObject base class
This base class implementation for COM objects provides IUnknown
interface implementation with reference counting which will allow to
keep all this functionality and implementation in the same place.

Pick-to 6.6 6.5

Change-Id: I8ec597b1040ac33295317e06338ffdcb61b78f85
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-13 21:29:48 +02:00
Kai Köhne
cb841b449a Doc: Improve documentation for qInstallMessageHandler()
Mention that QtMessageHandler needs to be reentrant,
as well as other caveats. Mention QLoggingCategory,
so people do know that they don't have to necessarily
implement their own handler to filter messages (and that
not all messages reach the handler). Also mention
qFormatLogMessage().

Finally, give a more useful example for a custom
message handler that logs to a file. Note that the example
leaks a file handle at exit, but that is arguably not that
bad.

Pick-to: 6.5 6.6
Change-Id: I5be44167b266c9bbdbb0e94806bb024c9b352a32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-13 20:39:55 +02:00
Orkun Tokdemir
7a87149c25 CMake: Update timestamp file for multi-Config builds
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8840 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `multi-config` builds too.

A possible error message before this commit when `qt6_extract_metatypes()` is called with a newer
or equal version than `3.28` `CMake` and `Ninja Multi-Config`.

```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```

Amends 8042bfba47305352627d910930e52da496904c17

Pick-to: 6.2 6.5 6.6
Change-Id: Ib404bd058d5f4c75501fb714c2ad9608d6852822
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-13 19:57:29 +02:00
Mikolaj Boc
1c8b4ac67b Fix problem with queued signals on main thread
Queued signals from main thread were not handled if enqueued on
a different thread. This is because qt_jspi_can_resume_js was
called on a thread (worker), where the Module object does not have
the property used for determining whether JSPI is suspended.

Change-Id: Icbc4dbfcf46c1091eb71b23c7de50760c8a339ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-13 19:36:34 +02:00
Christian Ehrlicher
262031d364 Fusion style/QProgressBar: fix High-DPI issues
Fix some issues for QProgressBar with fusion style:
 - no progress text was shown in vertical mode
 - the color change for the text was not correct in rtl mode
 - the two rounded rects were not drawn correctly in some modes
Also simplify the code by also using a QTransform for rtl mode and not
only for the vertical mode.

Fixes: QTBUG-117904
Change-Id: I1dd89daf34e8808417750f2ca714252afdab1416
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-10-13 18:23:44 +02:00
Mårten Nordheim
fe653b70ae QNetworkInfo[NetworkManager]: Mark invalid if unconnected
On some configs (e.g. using Snap) the NetworkManager service is not
available without some manifest or similar. In this case, the
_interface_ we have is still valid but we can't connect to the
service. So we need to mark the interface as invalid in this case, so
that we can avoid trying to use this plugin.

Pick-to: 6.6 6.5
Fixes: QTBUG-117490
Change-Id: I3c5ebb492f9ca4dfdf4353d77705ba993279eb69
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-13 18:00:37 +02:00
Alexandru Croitor
8170e9e85a CMake: Fix Gui package to auto look up IntegrityPlatformGraphics v2
The previous attempt to record a dependency on the
IntegrityPlatformGraphics target for the Gui target was insufficient.

Aside from a qt_find_package(PROVIDED_TARGETS) call, we also need to
use qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
to ensure the dependency is written into the Qt6GuiDependencies.cmake
file.

Replace the target_link_libraries call with qt_internal_extend_target,
and remove the qt_find_package all together. A qt_find_package call
in src/gui/configure.cmake already exists, so the one in
CMakeLists.txt is redundant and can be removed.

Finally the
  qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
call will also result in a
  target_link_libraries(Gui INTERFACE
  $<LINK_ONLY:IntegrityPlatformGraphics::IntegrityPlatformGraphics>)
because Gui is a static library when building on Integrity, so the
transitive requirement will still be passed along to user projects.

Amends c03eb94c8a
Amends 8116fdde1c

Pick-to: 6.6
Fixes: QTBUG-118051
Task-number: QTBUG-102883
Change-Id: Ic962df94a20071d3f2459e705dbafaca0319a638
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-13 18:00:37 +02:00
Luca Di Sera
31eb5e238b Doc: Add missing return type to QDBusReply::value
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.

Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.

For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.

The documentation for `QDBusReply::value` make
use of this possibility by not stating a return type.

Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.

On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.

To avoid the issue, a return type is now added to the relevant `\fn`
commands.

Task-number: QTBUG-111580
Change-Id: Ia70404c7ad548cb1e144bec99943cf72c990bb83
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-13 18:00:37 +02:00
Luca Di Sera
6e7f7f6f48 Doc: Add missing return type to QRgbaFloat::fromRgba*
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.

Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.

For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.

The documentation for the various `QRgbaFloat::fromRgba*` make use of
this possibility by not stating a return type.

Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.

On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.

To avoid the issue, a return type is now added to the relevant `\fn`
commands.

Task-number: QTBUG-111580
Change-Id: Id9d8a713caf7d6cbb4d2de1040ce5ea5092f7b14
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-13 18:00:37 +02:00
Anton Kudryavtsev
2dce499561 qtextformat: port while loops to range for
to improve readability

Change-Id: I11b44154d8db35b93a887bb4797af9a985749f24
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-13 18:24:01 +03:00
Mitch Curtis
b90b624ce0 QWindowsTheme: only set inactive accent color to Window if not set
Otherwise it incorrectly changes to a white-ish color when the window
becomes inactive, when native apps keep the accent color.

Fixes: QTBUG-116826
Change-Id: I3837e7ca93a494e60dbe5f1b7f8607b3dd16d29e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-13 20:12:27 +08:00
Luca Di Sera
11424b3f51 Doc: Add missing return type to QList/QVarLengthArray::assign
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.

Generally, `\fn` commands that do not represent correct C++ code with are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.

For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.

The documentation for the various overloads for QList::assign and
QVarLenghtArray::assign makes use of this possibility by not stating a
return type.

Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.

On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.

To avoid the issue, a return type is now added to the relevant `\fn`
commands.

Change-Id: Ic1434aaf71c39840c64ce04fbd503c4542dc4f42
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-13 14:12:27 +02:00
Mårten Nordheim
479c2add32 QNonContigByteDeviceThreadForwardImpl: NSDMI
Makes it clearer what members depend on arguments to the ctor. And
what the initial value of all the members are.

Change-Id: Ie1cd2361955053eaf4c4e6887d23ac245738288d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-10-13 11:58:51 +02:00
Mårten Nordheim
5c7c44cf83 Http: don't try to send request on a closed socket
We have code in the protocolHandlers that tries to handle this case, but
if we have an error before we create protocolHandler (read: proxy
complains about something) we will assert in debug, or
deref nullptr in release.

Pick-to: 6.6 6.5 6.2
Change-Id: I4bde9c8af0fa96dc11f77ca4d4b5cb84c31b54fa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-13 06:23:21 +00:00
Ahmad Samir
94a3914d3d QtWidgets: finally Q_FOREACH-free
These source files have been ported away from Q_FOREACH but weren't
blacklisted, so un-blacklist them by removing "#undef QT_NO_FOREACH",
and removing them from NO_PCH_SOURCES.

These are the last remnants of the Q_FOREACH blacklisting in QtWidgets.

Task-number: QTBUG-115803
Change-Id: Ib73d668687f64d39fa48397d75a0f342e525c1ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-13 00:54:57 +03:00
Ahmad Samir
8ce54407f2 QGestureManager: port Q_FOREACH to ranged-for [6/6]
These two QSetS are local to the function, the loop bodies don't modify
them but they can't be made const due to the way they're filled. So use
std::as_const and ranged-for.

Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing
the source file from NO_PCH_SOURCES.

Change-Id: I49b852aa865b0321d3e2f617466557d77143a32b
Task-number: QTBUG-115803
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-13 00:54:54 +03:00
Ahmad Samir
2309b38a64 QGestureManager: port Q_FOREACH to ranged-for [5/6]
getGestureTargets() first parameter is a QSet created locally at the
call site in deliverEvents(); and the loop body doesn't change it.

Change-Id: I3484f7ecc9d85b22b45a123ccf75316d5316e031
Task-number: QTBUG-115803
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-13 00:54:52 +03:00
Ahmad Samir
cce946b3aa QGestureManager: port FOREACH to ranged-for, local const QSets [4/6]
Those QSetS are local to the function, make them const, proving that the
loop bodies didn't change them, and the copy Q_FOREACH took wasn't
needed.

Task-number: QTBUG-115803
Change-Id: Iec2fc31fc060c59760a84dc45baf8fa16f62eb6d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-13 00:54:50 +03:00
Ahmad Samir
a7d9ad9617 QGestureManager: port Q_FOREACH to ranged-for [3/6]
The "conflictedGestures" QHash is local to the function, and the code in
the loop body doesn't change it. The "gestures" QList (the value in the
QHash key/value pair) isn't changed in the loop (both the enclosing
for-loop and the for-loop iterating over the QList itself):
- the QGestureEvent constructor takes by const& so it couldn't have
  changed the QList

So use a const QList& instead of a copy.

Task-number: QTBUG-115803
Change-Id: I4d7f2f833fe0119b9c1ffa91b0cdba9561025382
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-13 00:54:48 +03:00
Ahmad Samir
3f94513670 QGestureManager: port to ranged-for [2/6]
The enclosing iterator-based loop: the loop body doesn't modify the
`m_objectGestures` QMap (the original loop was using const_iterators),
so port to ranged-for by using asKeyValueRange().

The foreach loop: the loop body doesn't modify the `gestures` QList, so
a simple port to ranged-for.

Task-number: QTBUG-115803
Change-Id: I92ba7ff6ef878d7e4b7115a8fab87e95a6d93182
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-13 00:54:45 +03:00
Ahmad Samir
a3a53cdde4 QGestureManager: port Q_FOREACH to ranged-for [1/6]
The loop doesn't modify the QHash while iterating over it, so use
std::as_const.

Drive by change: Use asKeyValueRange() to get a key/value pair:
- No need to allocate a QStringList to hold the keys
- Prevent double lookup which happened when hash.value(key) was used
  inside the loop body

Task-number: QTBUG-115803
Change-Id: Ic0473c0971089f6ca75d3397209fe1c909e975a1
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-13 00:54:43 +03:00
Ahmad Samir
4bfe6ea251 QWidgetRepaintManager: port Q_FOREACH to ranged-for
The loop body doesn't change the QHash, so use asKeyValueRange() and
ranged-for.

Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing
the source file from NO_PCH_SOURCES.

Task-number: QTBUG-115803
Change-Id: I22924d2addeed75867edf9f6cac53f1c6f266dcc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-13 00:54:38 +03:00
Marc Mutz
368ea559eb QSpan: add C++23 c{,r}{begin,end}()
It was weird that they were missing. Now that C++23 added them to
std::span, add them to QSpan, too.

Pick-to: 6.6
Change-Id: I4a9b1fdeda66bc7b133c8f7b3b269656e5faffa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-12 21:38:54 +02:00
Marc Mutz
05888490db QSet: de-pessimize binary operators
Overload the binary QSet operators |, &, + and - for rvalue LHSs, so
chained operations like e.g. in qgesturemanager.cpp:

        QSet<QGesture *> endedGestures =
                finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;

become as efficient as chained op+= calls.

Make the operators hidden friends as a drive-by.

[ChangeLog][QtCore][QSet] The binary operators &, |, + and - are now
hidden friends, and chaining them has been made a lot more efficient.

Change-Id: I55d2247b11d088eb1ef88608f89d2bf9e1daeb58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-12 21:38:54 +02:00
Marc Mutz
4a7c76d4a5 Include what you need: <QPointer>
All these TUs relied on transitive includes of qpointer.h, maybe to a
large extent via qevent.h, though, given that qevent.h is more or less
the only public QtBase header that includes qpointer.h, something else
seems to be at play here.

Said qevent.h actually needs QPointer in-name-only, so a forward
declaration would suffice. Prepare for qevent.h dropping the include.

The algorithm I used was:

If the TU mentions 'passiveGrabbers', the name of the QEvent function
that returns QPointers, and the TU doesn't have qpointer.h included
explicitly, include it. That may produce False Positives, but better
safe than sorry. Otherwise, in src/, add an include to all source and
header files which mention QPointer. Exception: if foo.h of a foo.cpp
already includes it, don't include again.

Task-number: QTBUG-117670
Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-12 21:38:54 +02:00
Christian Ehrlicher
0b6d2d9187 Widgets/QColumnView: use pmf-style connect in QColumnView
Follow-up patch for 39d486171b - don't
create a temporary container for the connections but add them directly
into the final one.

Task-number: QTBUG-117698
Change-Id: I6ea3b1a5a834f2581f3929cca13c53f47b8c9805
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-12 21:01:09 +02:00
Luca Di Sera
42bc1f9d27 Doc: Add missing return type to QPromise::emplaceResult/emplaceResultAt
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.

Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.

For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.

The documentation for `QPromise::emplaceResult/emplaceResultAt` make
use of this possibility by not stating a return type.

Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.

On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.

To avoid the issue, a return type is now added to the relevant `\fn`
commands.

Task-number: QTBUG-111580
Change-Id: I7d41fc52720ff8762bf2cce229969b7250e44754
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-12 20:24:55 +02:00
Assam Boudjelthia
3b6d288e3b Android: Simplify Qt for Android hierarchy, less Java reflection!
This changes takes Qt for Android Java code away from the Delegate
classes that uses heavily Java reflection to invoke Activity/Service
calls and overrides. So instead of that, now, we have a QtActivityBase
and a QtServiceBase classes which handle the override logic needed for
Qt directly without reflection.

These Base classes extend Android's Activity and Service directly, and
are inside the internal Qt android package (under Qt6Android.jar).

For example, to handle onConfigurationChanged, instead of the current
way where we need this in QtActivityDelegate:

 public void onConfigurationChanged(Configuration configuration)
 {
     try {
         m_super_onConfigurationChanged.invoke(m_activity, configuration);
     } catch (Exception e) {
         e.printStackTrace();
     }
         handleUiModeChange(configuration.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
 }

And then this in QtActivity:

 @Override
 public void onConfigurationChanged(Configuration newConfig)
     {
         if (!QtLoader.invokeDelegate(newConfig).invoked)
             super.onConfigurationChanged(newConfig);
    }
    public void super_onConfigurationChanged(Configuration newConfig)
    {
        super.onConfigurationChanged(newConfig);
    }

And having to keep it's Method handles around and then use Java
reflection
to call the override behavior done by Qt and the superclass methods.

instead of that, we can do it now in QtActivityBase like:

 @Override
 public void onConfigurationChanged(Configuration newConfig)
 {
     super.onConfigurationChanged(newConfig);
     handleUiModeChange(newConfig.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
 }

Then, we would still have our user facing QtActivity class which extends
QtActivityBase and benefit from the same implementation of Qt logic done
in the base class.

An additional benefit to this approach is that now QtActivity will be
very lightweight and doesn't need to have all the boilerplate code as
before.

[ChangeLog][Android] Simplify Qt for Android public bindings
(QActivity, QtService and QtApplication) by implementing base
classes which use the delegate implementions directly and avoid
reflection.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Ie1eca74f989627be4468786a27e30b16209fc521
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 19:16:47 +03:00
Juha Vuolle
beac5a6d72 QJniObject minor doc typo fix
Change-Id: Ife7ec986fd8033f3fda4b1c53b23f4bc3d3ac97b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-12 17:12:04 +03:00
Juha Vuolle
6ac6c9452c Android: remove unnecessary static_cast
Change-Id: Id52b6ba74ee203118287745e52e90c5b36b66cc5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-12 17:12:04 +03:00
Juha Vuolle
c0bc0d0643 Android: fix double-freeing of a global references on app exit
The m_activityObject and m_serviceObjects are no longer plain
jobjects. Instead they are constructed with a jobject.
The constructor makes it a global ref, which the destructor
then frees. The destruction happens when the stdlib exit()
is called.

However, since the terminateQt() function already had released the
global ref, the destruction of the objects crashes the
application with a JNI APPLICATION ERROR in Android logs.

In addition since the the code only ever freed the reference to
a reference, the actual reference was leaked.

Change-Id: I6bb637dba2de59e89436685a9d63950d36438fa5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-12 17:12:04 +03:00
Assam Boudjelthia
4102db752e Android: extract various constants into one common class
Various constant keys were duplicated in QtActivityDelegate,
QtServiceDelegate and QtLoader classes, and this de-duplicates that.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: I3479fbb58293b26b7625f8653289c6b6d987a59f
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 12:00:01 +03:00
Assam Boudjelthia
d9845e2ac8 Android: Clean QtActivity and QtService from uneccessary overrides
Following the previous change in the chain, this removes override calls
that have no implementation under Qt Delegates, so they can be removed
and
the default behavior would persist.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Ia7c76e9b56c63cba935cb3d2ae3b6260d3462e51
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 11:59:55 +03:00
Assam Boudjelthia
1da7acd93d Android: remove overrides for uneccessary and deprecated methods
Those overrides are deprecated and will print a warning during Gradle
build, moreover, these calls don't have any implementation by Qt that's
being triggered by the Qt Delegates classes, so they don't need to be
kept in the Activity/Service main classes' implementations.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: If0c241206652c1a52e2396a24ec7ab63236e6308
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 11:59:47 +03:00
Assam Boudjelthia
90b3b17545 Android: remove uneccessary calls to QtNative from QtActivity
These forward calls to QtNative don't need to be present inside the
QtActivity implementation, all those calls are invoked by the Delegate
classes.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Id1bfa694687af3edc4e9b82b09cf13e1f8eba1de
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 11:59:38 +03:00
Assam Boudjelthia
d1760bc810 Android: Simplify the user facing Java bindings
Move QtLoader classes outside of the bindings package and into
the internal Android Java package (Qt6Android.jar that is), to simplify
Qt for Android project templates. This is because QtLoader classes are
used to trigger Qt libs loading and the users don't need to necessarily
know about it or find it in the project's source files.

The classes in question: QtLoader, QtActivityLoader, and
QtServiceLoader.

Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: I61f68abf6ee83fc45bc47ed9af7457db4f7deabc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-12 11:59:32 +03:00
Alexandru Croitor
c03eb94c8a CMake: Fix Gui package to auto look up IntegrityPlatformGraphics
When building non-qtbase tqtc repos in CI, we don't load a lot of
Plugin Config files in static builds due to project names having a
tqtc- prefix. This is similar to the issue and workaround that was
done in 4c6292686259e4e232f29cb6fd6c79065e9fa96d for qtserialport.

The specific issue here is the following error:

CMake Error at Qt6Gui/Qt6GuiTargets.cmake:61 (set_target_properties):
  The link interface of target "Qt6::Gui" contains:

    IntegrityPlatformGraphics::IntegrityPlatformGraphics

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /home/qt/work/install/target/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:52
   (include)
  /home/qt/work/install/target/lib/cmake/Qt6/Qt6Config.cmake:157
  (find_package)
  CMakeLists.txt:15 (find_package)

To work around the issue, explicitly record a dependency on the
IntegrityPlatformGraphics target for Gui when building on INTEGRITY.

The underlying issue is sadly still not fixed.

Change-Id: I9a9cff05d036f224aab8083ad6bc8b8e568abd8b
Pick-to: 6.6
Task-number: QTBUG-102883
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-10-12 10:55:28 +02:00
Mitch Curtis
303d991136 Allow QPalettePrivate to be used outside of qpalette.cpp
We need access to bitPosition in order to check if a role was set.

This fixes the following build error:

[...] qwindowstheme.cpp(1150): error C2220: the following warning is treated as an error
[...] qwindowstheme.cpp(1150): warning C4506: no definition for inline function 'QPalette::ResolveMask QPalettePrivate::bitPosition(QPalette::ColorGroup,QPalette::ColorRole)'

Amends 417878904b.

Task-number: QTBUG-116826
Change-Id: I815c7e961198ab93b6ed6132badc2ec693522472
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-12 15:31:32 +08:00
Christian Ehrlicher
d70b873c37 QSqlDatabase: check if QCoreApplication::instance() exists
Check if QCoreApplication::instance() and print a warning if not instead
creating and assertion later on.

Fixes: QTBUG-117621
Change-Id: Iffb4f7097edbbaf19cb584bff6e5ba1535bf88a0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-12 06:16:46 +02:00
Marc Mutz
9a0ae6c13b QSpan: remove a stale static constexpr extent from a base class
It's not needed, and might trigger -Wshadow on some compilers. Only
the public QSpan class has the `extent` static data member, everything
else uses the template argument, `E`, directly.

Amends f82cf6333e.

Pick-to: 6.6
Change-Id: If378119aff1e352d1e90854b570720444cd532a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2023-10-12 00:20:32 +02:00
Michael Weghorn
0699ef1301 a11y atspi: Update text-attribute links
The previous ones no longer lead to the
corresponding documentation.

Pick-to: 6.6 6.5
Change-Id: I3f56ad71fa3f936898a25f20f718c7f65a0385a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-11 22:20:25 +00:00
Anton Kudryavtsev
a83a818791 QTextDocumentPrivate::plainText: simplify code
Use QSV more to avoid manual memcpy
Also port loop to range-based for

Change-Id: I06f4b424853a4b3ee245c66ccc650d87740e2cb8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-12 00:44:56 +03:00
Thiago Macieira
0f0371c830 Remove Qt_6_PRIVATE_API ELF version from a symbol used by QFuture::then()
QFuture::then() uses QtPrivate::Continuation::create(), which in turn
uses private API from an inline function:

    f->d.setContinuation(ContinuationWrapper(std::move(continuation)), fi.d);

f->d is QFutureInterfaceBase (a public class), but its setContinuation()
takes QFutureInterfaceBasePrivate by pointer. Our ELF versioning scripts
mark everything that uses that class as private, resulting in:

 4806: 0000000000287d70    365 FUNC    GLOBAL PROTECTED     16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6_PRIVATE_API

This commit adds an exception for this symbol, causing it to go back to
the regular "Qt_6" ELF version:

 5629: 00000000003d6a16    366 FUNC    GLOBAL PROTECTED     16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6

This solution can probably be cleaned up a bit by moving the marker into
the header files parsed by syncqt, so they follow code motion without
having to remember to update the CMakeLists.txt. That requires some
surgery with syncqt, so not suitable for cherry-picking.

As a drive-by, fix the target_type check
for the _qt_extra_linker_script_content genex property

Fixes: QTBUG-117514
Pick-to: 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178b92e73dbe11de
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-11 22:06:20 +02:00
Edward Welbourne
29af4b1833 Sort out an anomaly in tst_QDateTime::springForward()
It noted that an unspecified function claimed the offset it was
checking should be +1, while testing it against that or -1. The
function turns out to be QDateTime::addDays(), whose doc did indeed,
misleadingly, say that it lands after a gap it would have hit. It in
fact overshoots the gap in the direction of its change. Amend its
docs, likewise those of addMonths() and addYears(), to reflect the
true behavior.

Amend the test to look at the direction of the step its taking and
anticipate that the adjustment will be in the same direction; then
compare the actual adjustment to that.

Change-Id: I9ab918fac0ab2195ef014983f37fccc435bf0498
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-11 22:06:20 +02:00
Edward Welbourne
c23d00078c Let QDateTime::offsetFromUtc() work for invalid date-times
The implementation previously worked for non-short date-times, where
the offset has been remembered since construction. This included the
case of zoned times (and local times more than 2^55 msec away from the
start of 1970) that hit a spring-forward's gap; but excluded local
times that did the same (within 2^55 msec of the epoch).

This precluded an offset check in a spring-forward test, now added.

We can in fact determine the offset whenever we got a valid date and
time (we do so in the course of initializing the object, and when
asked for toMSecsSinceEpoch(), even when invalid), and we should not
use the value of the recorded offset if we didn't get a valid date and
time, so amend to always return 0 if we didn't get valid date and time
and always report the correct offset otherwise.

In the process, amend offsetFromUtc()'s computation to directly
resolve the date-time, rather than doing so via toMSecsSinceEpoch(),
which has to repeat decision-making offsetFromUtc() has already done
by the time it calls it. Also amend toMSecsSinceEpoch() to return 0 if
we didn't have a valid date and time to begin with, so it only
attempts to produce a useful result in the case where construction
attempted to resolve the date-time.

Change-Id: I6574e362275ccc4fbd8de6f0fa875d2e50f3bffe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-11 22:06:19 +02:00
Edward Welbourne
4aba97e062 Adjust msecs instead of offset for spring-forward resolution times
The resolution selects a point in time outside the gap, which will be
represented by toMSecsSinceEpoch()'s return, despite the QDT object's
isValid() returning false. Previously we retained the
originally-calculated msecs, so as to keep date() and time() matching
what was asked for. However, this required adjusting offset, which was
not remembered for local times within 2^55 milliseconds of the start
of 1970. This lead to an inconsistency between the offset from UTC
reported for the resolution for a local time further from the epoch,
or for a time-zone, and the actual offset from UTC at the time
indicated by the return from toMSecsSinceEpoch().

Instead, retain the actually calculated offset (even if we aren't
going to remember it) and adjust the msecs to the value that ensures
toMSecsSinceEpoch() will get the selected resolution. This
incidentally means that, when toMSecsSinceEpoch() has to re-resolve
(for a local time within 2^55 msecs of the epoch), it avoids
revisiting the complications of hitting the gap.

In passing, change internal stateAtMillis() to take the QTimeZone it
is passed by const reference, to save a copy (noticed during debug).
Also tweak a comment in a test to be explicit about a default value.

[ChangeLog][QtCore][Possibly Significant Behavior Change] When
QDateTime is instantiated for a combination of date and time that was
skipped, by local time or a time-zone, for example during a
spring-forward DST transition, the invalid result's time() - and, in
rare cases, date() - no longer match what was asked for. Instead,
these values and offsetFromUtc() now match the point in time
identified by toMSecsSinceEpoch().

Change-Id: Id61c4274b365750f56442a4a598be5c14cfca689
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-11 22:06:19 +02:00
Christian Ehrlicher
217c607782 Widgets: pass QWidget pointer to standardIcon/Pixmap() if available
Pass the pointer to the QWidget the icon is painted on to
QStyle::standardIcon/Pixmap().

Change-Id: If9dbc3acb621fb60152f2e12fc0080f354397a99
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-11 21:53:26 +02:00
Christian Ehrlicher
60cff8e9aa Fusion style: misc fix painting vertical slider
The slider handle has a small bug not painting the underlying rectangle
with the correct direction which lead to a small visual glitch only
visible with a high-dpi screen.

Change-Id: Ie75e034b85542228ed7a8372dc7b9a419731630d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-11 21:53:26 +02:00
Santhosh Kumar
a608a7c298 Fix inactive palette in gtk3 theme
In gtk3 theme, the inactive color group had been set with incorrect
palette or not been set for some cases, which leads to glitch when
moving application window. This is because inactive group palettes were
applied during window movement and its expected to be set with correct
palettes.

This patch fixes this issue by setting correct palette for inactive
color group.

Fixes: QTBUG-112879
Pick-to: 6.6 6.5
Change-Id: I6658843626f322fee0ef99dfafb550956e3e0aee
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-11 21:53:25 +02:00
Mårten Nordheim
06ed67d05c QNonContigByteDevice: Use PMF-style connect
clang-format and the optimized SIGNAL/SLOT notation are not
good friends.

Change-Id: Id07936b4654e567b59af5a8b1d7baad000484931
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-10-11 20:58:13 +02:00
Tor Arne Vestbø
e44aee9848 Guard QAppleKeyMapper::fromNSString() with iOS define
It's only used from iOS.

Change-Id: I0d653cb76fc27085c74feb5d2628cb1a201ade05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-11 20:32:05 +02:00
Tor Arne Vestbø
cd4000a97d Use QtGui to match QWindow based shortcuts, even when QApplication is used
If a QShortcut is registered with a QWindow as its parent, but QApplication
is used, we end up in QApplicationPrivate::createShortcutPrivate(), and
create a QtWidgetsShortcutPrivate that implements shortcut context matching
via qWidgetShortcutContextMatcher.

The problem is that qWidgetShortcutContextMatcher expects the windows
to be QWidgetWindows, which meant that plain QWindow based shortcuts
would always fail.

This can happen for example if a QApplication is used in Qt Quick
to provide dialog fallbacks, but QShortcuts are otherwise used
with plain QWindows, or QQuickWindows e.g.

We now defer the check of whether there's an active (widget) window,
and fall back to QtGui's simpleContextMatcher in case we don't find
a QWidget, QAction, or QGraphicsWidget shortcut owner to handle
the matching for.

Note: We don't support shortcut matching for QAction in QtGui,
but this is left for another day. There is also a discrepancy
between how QtGui and QtWidgets handles Qt::ApplicationShortcut.
The former will treat it as a match even if there is no active
QWindow, while the latter requires that there's an active widget
window.

Fixes: QTBUG-116221
Change-Id: I487995f2e660a40f6556828b84a521d81a58f1b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-11 20:32:05 +02:00
Volker Hilsheimer
7d3417fbfc JNI: Warn if classes are resolved with wrong syntax
Amends 39294317e0, after which class names have to be slash-separated.

Change-Id: I5b8415b711f4deed9b6134eccd3232f299b1ef4d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-10-11 19:32:15 +02:00
Axel Spoerl
c52ada54c5 Export QPalettePrivate
Q_GUI_EXPORT the private header to access it from outside Gui.

Task-number: QTBUG-116826
Pick-to: 6.6
Change-Id: I6aaabe2df7ebebd7b53662f47a52c748344067bc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-10-11 17:54:45 +08:00
Thiago Macieira
964b9d7cd4 qC{Debug,Info,Warning,Critical}: add parentheses around macro argument
Amends ef9fe7a99a and fixes some rare
cases where the macro argument wasn't a single token, such as what was
found in PySide code:

      qCDebug(*category, "%s", %2);

Fixes: QTBUG-117153
Pick-to: 6.5 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178a51023648f244
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-11 02:01:29 -07:00
Thiago Macieira
a5a288feb3 QStorageInfo/Linux: remove const to enable moving from MountInfo
Amends da95ad91b3. Caught by CodeChecker:

std::move of the const expression has no effect; remove std::move()

I'll instead remove the const.

Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178ccec9fcc38e9c
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-11 08:39:43 +00:00
Thiago Macieira
25cc336700 QArrayData: remove contradicting const qualifier from needsDetach()
The documentation above says it's intentionally not const and that's how
I had designed it. It was added by accident on with the noexcept
qualifier on commit c129362b4d ("Add a
couple of noexcept").

Change-Id: I8f3ce163ccc5408cac39fffd178c7fd237c6e079
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-11 08:39:43 +00:00
Thiago Macieira
19f54b901f Fix the static_assert for 128-bit integer types
Testing for Standard Library features with compiler version macros was
incorrect. This commit fixes that to check the correct macros. That
fixes the use of Clang-cl / ICX because Microsoft STL doesn't have
support for 128-bit integers (because Microsoft's compiler doesn't) but
Clang does.

Amends 104a0a9ecd.

Fixes: QTBUG-117870
Pick-to: 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178b9688e7c1bf42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-11 08:39:43 +00:00
Tor Arne Vestbø
9ef757ed29 Add verbose debug logging for QKeyMapper::possibleKeys()
Generalized from the logging used in the Apple key mapper.

Change-Id: I61cc120e31b72995071756961d36f6a7fae14553
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-11 01:48:16 +02:00
Tor Arne Vestbø
f8f5e2c122 Make QKeyMapper::possibleKeys() return list of QKeyCombinations
Having the explicit type instead of the opaque int makes it clearer
what we're dealing with.

Task-number: QTBUG-116873
Change-Id: I19e42ed329e15ab25a958602ecfb99b1c9d52a99
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-11 01:48:13 +02:00
Liang Qi
8af35d27e8 xkb: fix build with libxkbcommon 1.6.0 and later
A few XKB_KEY_dead_* defines got removed from 1.6.0. See also
6073565903/NEWS (L9-L14)
https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/70/diffs?commit_id=cb44799b72f611eb4c9d7cc185bc3b09e070be08

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117950
Change-Id: I55861868f2bb29c553d68365fa9b9b6ed01c9aea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-10 19:29:27 +02:00
Edward Welbourne
c6c0a7bd01 Use actual ± instead of +/- or [+-] in QDateTime docs and comments
Several places already did, and it reads better, so be consistent.

Change-Id: Ic272b2d342cec06ec657c3d0995258b975e0bf87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-10 18:27:22 +02:00
Edward Welbourne
ffe8932ef3 Make systemTimeZone() and systemTimeZoneId() consistent
It's possible, as was (and still is) documented, at least on Windows,
for the backend to determine the system local time zone's properties
but not its IANA ID. (That involves an update to Windows introducing a
Windows zone ID unknown to the CLDR with whose data Qt was compiled.)
Formerly this lead to systemTimeZoneId() and systemTimeZone().id()
being inconsistent. Furthermore, either in this case or when the
system zone can't be determined, passing the return from
systemTimeZoneId() to the constructor got a valid QTimeZone that did
not faithfully represent the system's local time or the return from
systemTimeZone().

[ChangeLog][QtCore][QTimeZone] When unable to determine the IANA ID of
the system's local time zone, QTimeZone::systemTimeZoneId() now
returns empty instead of the "UTC" it formerly, and misleadingly,
returned. Passing the return to the QTimeZone constructor now
consistently produces the same as calling QTimeZone::systemTimeZone(),
whose id() now matches the return from QTimeZone::systemTimeZoneId().
This is independent of whether QTimeZone::systemTimeZone() is valid.

Change-Id: I55bbe3ea407ca38343a09da353d9336708747bf1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-10 18:27:22 +02:00
Shawn Rutledge
8ef7d2f68d androidjniinput.cpp: const and cleanup
Change-Id: I7af16e970d73a6d05671a78a094e583a9213c1fb
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-10-10 18:27:21 +02:00
Shawn Rutledge
05de22e5f9 Fix hi-dpi mouse and tablet events on Android
Windows are not always fullscreen: e.g. the widget gallery example main
window isn't maximized, and a popup window may open anywhere on the
screen. So we always needed to offset by the window position. But it's
better to use QPlatformWindow::mapFromGlobal() since we are working with
native coordinates here.

Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-109025
Change-Id: Id3d139fad610bbbc67a394599570a309196ae64c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-10 18:27:21 +02:00
Tor Arne Vestbø
097037d2a0 Implement QAppleKeyMapper in terms of QPlatformKeyMapper
Change-Id: Icef9cbe2cbb50c856496d7d9a20784d94d66a079
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-10 17:12:13 +02:00
Yuhang Zhao
09953c4332 cmake: use a more appropriate feature guard
The factory cache registration functionality should belong to the
cppwinrt feature, so guard it with appropriate QT_FEATURE_ guard.

Change-Id: Icbadaa7ffb32a4e47fe3bbab90c37303fd787344
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-10 21:02:43 +08:00
Arno Rehn
a1e052a291 windeployqt: Don't copy files from unneeded QML modules
Previously, windeployqt would recurse into subdirectories when copying
QML modules, even if those subdirectories were a nested QML module that
was not needed for deployment.
Since most QML modules are nested in the QtQuick and QtQml modules, the
old code effectively always copied *all* QML modules.

This patch adds guards that prevent recursing into subdirectories if
those subdirectories represent QML modules.
These nested modules will still be deployed, but only if referenced from
the QML application (as determined by qmlimportscanner).

Fixes: QTBUG-117459
Pick-to: 6.6
Change-Id: I4c0dfc15956ff40a0e8caec3fa334df10cc92ccd
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-10 13:19:34 +02:00
Juha Vuolle
3ee57b8387 Handle ACTION_POINTER_UP with tablet events
The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse
stylus, eraser) goes up. Without handling this action in these
cases, the table event remains in 'down' state (misses the
QEvent::TabletRelease) and as a consequence when it is next put on the
screen, eg. a line will be drawn to the new position (in case of a drawing
application).

In addition use getActionMasked() to get the action; non-masked
events would contain the index of the pointer too, and wouldn't
match with ACTION_POINTER_UP whose numeric value is 6. Rather the
actions would be in the lines of:
261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked()
517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked()
And so on.

Pick-to: 6.6 6.5
Fixes: QTBUG-86297
Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-10 12:54:02 +02:00
Timothée Keller
614e0f1daa Revert "Windows QPA: Move transient children with a window move"
This reverts commit 530d092eae.

Reason for revert: Moving transient children as a whole is too broad, and forces unrelated windows to have their position completely dependent on a transient parent.

Fixes: QTBUG-117779
Pick-to: 6.6 6.5
Change-Id: I01312e26e95c8144c392eca33aec41f54aaa40b0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-10 10:53:22 +00:00
Anton Kudryavtsev
89615c589a qdatetime: use qsizetype more
Change-Id: Ic44352fd3f64c50e67e743c54e65c0497ac607a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-10 12:03:02 +03:00
Thiago Macieira
6b363556b8 QByteArray: Remove unnecessary <stdarg.h> header
We don't use va_list and don't have variadic functions in this file.

[ChangeLog][Potentially Source-Incompatible Changes] The header
qbytearray.h no longer includes the header stdarg.h.

Change-Id: I8f3ce163ccc5408cac39fffd178c7fb49d12b739
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-10 04:25:42 +00:00
Eirik Aavitsland
888be431da Avoid generating corrupt pdf output for out of range coordinates
The local qreal to string conversion would fail and produce
unsyntactic output if the integer part exceeded the range of an
unsigned int. Introduce check for that, and fall back to just output a
0 value instead in such cases.

Testing indicates that there is no point in supporting values beyond
4G, as pdf readers do not seem to accept higher values anyway.

As a driveby, also extend the check to catch all non-finite real
values, not only nan.

As a second driveby, simplify the splitting of a qreal into integer
and fraction parts by just using the std library function for that.

Fixes: QTBUG-117740
Pick-to: 6.6 6.5
Change-Id: I247b0612bd565fb2e6f47a182e74f19b8bb0d683
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-10-10 00:57:11 +02:00
Anton Kudryavtsev
ebf1538fa6 Qt::mightBeRichText: port to QAnyStringView
[ChangeLog][QtGui] Ported Qt::mightBeRichText() to QAnyStringView
(was: QString).

Change-Id: Ib5633ed45cba5f4f1211438397624574f7431908
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-09 22:19:24 +00:00
Thiago Macieira
2b7c2c3a71 QString/QByteArray: avoid data() handling _empty in sliced()
.data() in both classes has a null pointer check so it will return non-
null even if the object is storing a null pointer, for compatibility
with Qt 5 (controlled by QT5_NULL_STRINGS). We don't need this in
first()/last()/sliced()/chopped(), so we can skip the test and pass
whatever pointer it is directly to the class constructor. Both of them
handle null pointers creating an isNull() object.

This is a minor performance optimization and interestingly makes these
functions now retain isNull() with the result. I'm not adding test for
that as I don't want to hardcode that they will do so.

Change-Id: Ifeb6206a9fa04424964bfffd17888d14ec8244ec
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-09 14:03:12 -07:00
Santhosh Kumar
4cffb3b5fb Fix disabled button color in Linux (X11/Wayland)
The palette mapping table (as read from gtk widget) maintained in
QGtk3Storage misses information of QPalette::Button and
QPalette::ButtonText role for QPalette::Disabled color group. This
cause disabled button widget to be rendered with incorrect palette
(such as in dark color scheme, light palette had been used).

This patch fixes this issue by extending palette mapping in
QGtk3Storage for disabled color group of button role.

Fixes: QTBUG-113486
Pick-to: 6.6.0 6.6 6.5
Change-Id: Ied4b2650c92cc1cda58be69257945991013b276f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-09 21:52:07 +02:00
Topi Reinio
dc33b0ca7a Doc: Fix warnings and linking issues
Remove or replace links to examples that were removed or moved under
manual tests.

Replace code snippets that were quoting the now-missing examples.

Fix documentation of QSet::removeIf().

Fix typo in documentation macro: Unknown command '\examplecateogry'.

Add qtopengl, qtshadertools dependencies to Qt Widgets documentation
project to enable correct linking to those topics.

Mark all documentation sets in qtbase as free of warnings.

Pick-to: 6.6 6.5
Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-09 17:24:07 +00:00
Tor Arne Vestbø
64e1744a57 Implement QWindowsKeyMapper in terms of QPlatformKeyMapper
Change-Id: I060ca9613d49bb85a2cf8d4f808b2b5b1c0bdcd5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-09 19:24:07 +02:00
Tor Arne Vestbø
d5c867ee29 Implement XCB key mapper in terms of QPlatformKeyMapper
Change-Id: I81af1200b7b1113062d66a76a185a6d15eab0ba9
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 19:24:07 +02:00
Friedemann Kleint
1ffe7fbff0 Fix documentation of QMetaClassInfo
Mention the modules using it instead of claiming it is not used
in Qt.

Pick-to: 6.6 6.5
Change-Id: I8c9490dfd89444509961c73eeff2f8584e0c5df4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-09 17:24:04 +02:00
Antti Määttä
0bbb2f6981 Fix CTF with namespace build
Include moc must be outside the namespace.

Pick-to: 6.6 6.5
Change-Id: Ibdd539b5fdd8ab4aeb0019bcbb62d5702c310065
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-09 18:24:04 +03:00
Mårten Nordheim
0fa4af060e QTemporaryFile: Add support for std::filesystem::path
Since it hides QFile's overloads this was not supported for
QTemporaryFile.

[ChangeLog][QtCore][QTemporaryFile] Added support for passing
std::filesystem::path to rename and createNativeFile.

Change-Id: I909ff1d5b9c586824c9901d7dad278dfad09ffc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-09 16:25:57 +02:00
Tor Arne Vestbø
7d663d2e08 Guard QWindowsContext::instance() during screen change on shutdown
Destructing the QWindowsScreenManager might result in a
WM_DISPLAYCHANGE, at which point our QWindowsContext instance
is likely gone. We need to guard against that.

Fixes: QTBUG-117473
Pick-to: 6.6 6.5
Change-Id: If32941c5c11231f7c27e9dde54f4315f18da1100
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
ab99cf6077 QKeySequence::toString(): Treat Modifier+Qt::Key_Unknown as empty string
We were already doing this for a key combination without modifiers,
but now we do the same for e.g. Control+Unknown. This matches the
behavior we have for QKeySequencePrivate::decodeString(), where
we return Qt::Key_Unknown if we can't resolve the key, even if
we have resolved some valid modifiers, e.g. "Meta+Trolls" as in
the tst_QKeySequence::parseString() test.

Change-Id: I238e29276e6ce356ae60c67585739587fa388f07
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
e4994ccfe0 Teach QKeySequencePrivate about QKeyCombination
Being explicit about whether we're dealing with QKeyCombination or
a plain Qt::Key helps understand the code.

Keys are still stored as ints though.

Change-Id: I2cb7bf2c5fabcecbd4dd3e99ba6240fb1910dcc7
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Tor Arne Vestbø
8850e86981 QKeySequence: Remove unused private helper methods
The functionality is available in QKeySequencepPrivate still, if needed.

Change-Id: Iefa2e5b31a550fd2a419d2aee028ce4c1ddfb7a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-09 15:25:54 +02:00
Kai Köhne
6e33e3e899 Doc: Highlight some examples for 'User Interface Components' category
Task-number: QTBUG-117243
Pick-to: 6.5 6.6 6.6.0
Change-Id: Ie8e7a07e7bbfd5037ccf6a6477f801ea9ed9e3c4
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-09 13:26:17 +02:00
Kai Köhne
bb781bdb2d Doc: Highlight some examples for the "Graphics & Multimedia" category
Task-number: QTBUG-117211
Pick-to: 6.5 6.6 6.6.0
Change-Id: I9ebe20719ad96b0d9ced40745eb6ee09d3e6fb40
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-09 11:26:17 +00:00
Kai Köhne
1b5402d229 Doc: Fix link to renamed setIncludesSubDomains() method
Fix capitalization of setIncludesSubDomains(). While a it,
make the links explicit, so that qdoc generates warnings if they fail.

Pick-to: 6.5 6.6
Change-Id: I74542c288083ec58f866a616da32bd40fcb3f40a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-09 12:32:59 +02:00
Yuhang Zhao
d9820b0207 cmake: un-special case clang-cl for runtimeobject
clang-cl can correctly handle runtimeobject.lib for quite some time
already, no need to special case for it anymore.

Change-Id: I87aa98134ad847808b3129c5629ccf8fa1dce253
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-09 13:48:01 +08:00
Ahmad Samir
5522e33128 QMenuBar: compile with QT_NO_FOREACH
The loop doesn't change the member container while iterating over it,
but handleReparent() is called from eventFilter() and changeEvent(), so
take a copy to iterate over.

Task-number: QTBUG-115803
Change-Id: I58ff5bddf99f07a46348b7802432e0899b3170df
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-08 17:55:01 +03:00
Ahmad Samir
641bccce2a QGraphicsAnchorLayout: compile with QT_NO_FOREACH
The m_edges container isn't changed after it's initialized in the
constructor (in a later commit I'll make this container const, so as to
keep this commit backport-able), and it isn't changed by the loop. Port
all loops over m_edges to ranged-for.

Remove "#undef QT_NO_FOREACH" from the source file, as that was the only
usage of foreach in it. And remove that source file from NO_PCH_SOURCES.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-08 17:54:54 +03:00
Anton Kudryavtsev
4f1bb8ee40 platform plugins: use string view types more
Change-Id: I793cfff1afca6b98a672615e33a19f8210e429dd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-08 11:38:41 +03:00
Ahmad Samir
b358672556 QLocalSocket: port to QDeadlineTimer
Easier logic for such use-cases.

Change-Id: I4ce14bbaeda5441294f33993195396d9f47710dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-07 21:07:06 +03:00
Ahmad Samir
6ecf43120f QHttpSocketEngine: de-duplicate some code
Change-Id: I4699e3ea0d4687a9772f6f90e6033f5582c1a346
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-07 21:07:06 +03:00
Ahmad Samir
738a5ad4f2 QDateTime: de-duplicate some code
Change-Id: I1c842029c2b597f97418b49c894127ab43dafbf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-07 17:59:17 +03:00
Volker Krause
d25438ebbd Search extra library paths for Android dependency XML files as well
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.

After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.

Pick-to: 6.5 6.6
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-07 09:44:00 +00:00
Thiago Macieira
61d99530c8 moveToTrash/Unix: avoid QFileInfo to get an absolute file name
We know what engine we're using, so don't go the long way around via
QFileInfo and QFSFileEngine to get back to QFileSystemEngine in order to
calculate an absolute and clean path.

Since we're doing that, we may as well use QFileSystemEntry's ability to
give us the file name portion of this absolute path without having to go
via QFileInfo and QDir again. We just need to make sure that a dir name
isn't ending in a slash: absoluteName() would remove that for us, but
only if the entry isn't already absolute and clean.

Change-Id: I9d43e5b91eb142d6945cfffd17871389d359e750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-06 18:43:30 -07:00
Thiago Macieira
fa97531952 moveToTrash/Unix: reorganize the #ifdef
Change-Id: I9d43e5b91eb142d6945cfffd178708f58b71e7ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-06 18:43:29 -07:00
Ahmad Samir
032ffb70a8 QAbstractSocketEngine: port to QDeadlineTimer
qnativesocketengine_win.cpp: don't check if timeout is < 0, because
remainingTimeAsDuration() doesn't return negative values.

All the changes done in one go, not function by function, as that causes
the least churn. You can think of them as a couple of very similar
changes repeated various times.

Drive-by change: replace `forever {` with `for (;;)`

Task-number: QTBUG-113518
Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-07 02:28:12 +03:00
Mårten Nordheim
51c812af07 QHttpThreadDelegate: use new(std::nothrow) instead of try..catch
We usually compile without exceptions, so the try..catch is a noop.
So, if the `new` fails we would crash (or get UB) anyway. Instead
of that, use the nothrow version of `new` and check the result.

Pick-to: 6.6 6.5
Change-Id: I1902b717c70afcc44c1f3237370aae346262452a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-07 00:10:32 +02:00
Marc Mutz
72d51f1c42 QUuid: de-pessimize QDataStream operator
Use a stack buffer instead of a QByteArray to hold the 16 bytes for
the QUuid serialisation, replacing toRfc4122() with toBytes() and a
memcpy().

As drive-bys, drop the needless cast from char* to uchar*
(qToLittleEndian() has void* arguments, so char* is fine) and drop {}
around single-line if body.

Pick-to: 6.6
Change-Id: I6ffabcf07fc9a730a782e20e113999a0dcf15067
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-06 22:10:31 +00:00
Marc Mutz
3321101d8f Move qpointer.cpp → qpointer.qdoc
It contains no implementation. Proof: it includes no headers.

Pick-to: 6.6 6.5
Change-Id: I64b42ce799eec05a0faff2021e2b60460695e192
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-07 00:10:31 +02:00
Liang Qi
42d9c1913a xcb: replace a warning with debug info in qxcbconnection_xi2.cpp
Fixes: QTBUG-117820
Pick-to: 6.6 6.5
Change-Id: I3b89305e1a8d92a02166efee7067108572f7a97a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-10-07 00:01:22 +02:00
Thiago Macieira
22029a76c3 qcompilerdetection: Add missing qtconfiginclude.h
The Q_DECL_{IMPORT,EXPORT} macros change with the configuration, so the
lack of our configuration this ended up producing inconsistent builds.

Amends 43ec3d8d01.

Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17892394d19e648f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-06 15:01:22 -07:00
Axel Spoerl
92d837e684 QDockWidget: Do not propagate title from a closed dock widget
When a dock widget is closed while floating, it still reports being
floating even though the QWidget::windowHandle()->isVisible() returns
false. This is documented behavior and will not be changed.

c153066baa relied on the isFloating() to
return false, if the dock widget is closed. When the window title was
changed by setWindowTitle(), the change was overridden by reading the
old value from the window handle.

=> Amend the patch and add a windowHandle()->isVisible() as a condition.

In c153066baa, an autotest for the title
propagation (QTBUG-113591) was added to floatingTabs().

=> Harden the setWindowTitle() test function. Move the tests related to
QTBUG-113591 and QTBUG-117764 to this function.

Fixes: QTBUG-117764
Pick-to: 6.6 6.5
Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-07 00:01:22 +02:00
Liang Qi
44894c579c cmake: remove xcb dependency for accessibility-atspi-bridge feature
Qt a11y(ATSPI) support only depends on DBus and ATSPI, it should
also work fine on Wayland when xcb was disabled.

Task-number: QTBUG-117535
Pick-to: 6.6 6.5
Change-Id: Ibd7ebb32b94de1888920f0fe2b85ae3bd4d2c77a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-06 21:51:12 +02:00
Liang Qi
7e14e6c2d3 a11y: add runtime checking for xcb only calls
This amends d23562da1c .

Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-06 21:51:12 +02:00
Liang Qi
2ad3da8fce a11y: fix the build without xcb headers
This amends 6802065da8 .

Pure Wayland runtime and build envs without X11/xcb are more common.

Need to find solution for ATSPI_MODIFIER_SHIFTLOCK on Wayland later.

Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I65d41546e3dbb86c3a939a496ed43ac1737cf539
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-06 21:51:11 +02:00
Ahmad Samir
9e5df4ae53 QStringConverter: clarify decode()/encode() API docs
These methods return a struct which is implicitly convertible to
QString/QByteArray respectively. Don't hide the return type from QDoc,
this simplifies telling users what those methods return exactly.

Fixes: QTBUG-117705
Pick-to: 6.6 6.5
Change-Id: Ibb22a1e54fffce8f5f20aaabe47983870ccfba1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-06 22:51:11 +03:00
Mårten Nordheim
23996976cf http: fix leakage of network cache qiodevice
The QIODevice is owned by the caller of data(), so we should have
freed it.

Amends a6776de0c7

Fixes: QTBUG-117787
Pick-to: 6.6 6.5 6.2
Change-Id: Ic5575649038480f52cc13ee229980ee1c7cee728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-10-06 19:40:23 +02:00
Anton Kudryavtsev
d9370d0962 QByteArray: use constexpr more
Change-Id: I89bfb51659df798bc4dfa37d764b56ea8a289fbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-06 19:18:54 +03:00
Christian Ehrlicher
076bf63a81 SQL/PostgreSQL: misc cleanup
Misc cleanup for the PostgreSQL driver:
 - use constexpr instead const for some constants
 - use new signal/slot syntax
 - unconditionally call PQfinish() - check is done inside the function

Change-Id: I47b83ef3436225f698fca24c68e5c9cde32c1163
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-10-06 15:48:46 +02:00
Tor Arne Vestbø
c74cfae7a3 Long live QPlatformKeyMapper!
The QKeyMapper class never got a platform integration companion.

As we might be adding more functionality here in the future, let's
fix that now, instead of adding more hooks directly to the platform
integration class.

The QKeyMapper will soon update its possibleKeys signature to
return QKeyCombination, but for now transform the result.

Change-Id: I88ef498180b2a8a7937a74627b7eb6b5156e872a
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-06 15:48:45 +02:00
Tor Arne Vestbø
d9bb8c0a17 Automatically reflect new input context input direction when locale changes
All platforms except Wayland fail to check for input direction change
when the locale changes, and only emitLocaleChanged.

We can simplify this for the platforms by checking if the new
locale caused a change in input direction, and if so emit
inputDirectionChanged on their behalf.

Change-Id: I84d8df9392db5e716f5c277d0cc9e17e5a21783f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-06 15:48:45 +02:00
Timothée Keller
84d0ebabaa Windeployqt: fix typo
Change "qpaths" to "qtpaths" since the former is not a valid option.

Fixes: QTBUG-117817
Pick-to: 6.6 6.5
Change-Id: Ib8c8c80f31c1c54747340442c6bf3185c7c69001
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-06 12:08:31 +00:00
Liang Qi
70d3c15e8e xcb: set _KDE_NET_WM_DESKTOP_FILE and _GTK_APPLICATION_ID for window
in top level, which are in used very common for KDE and GNOME.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117488
Change-Id: I88fe7b4afe44e4ac8f07e60e990cbe68498e98d9
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-06 09:42:46 +02:00
Christian Ehrlicher
4e8b54eb81 Preparations to deprecate QItemDelegate
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
 - remove unused includes / replace with qabstractitemdelegate.h
 - replace references in the documentation with QStyledItemDelegate
 - adjust the examples and tests to use QStyledItemDelegate

Pick-to: 6.5 6.6
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-05 21:08:45 +02:00
Anton Kudryavtsev
9187348505 qtextdocument::insertText: port to QSV
and add QChar overload to reduce allocations
Also port tests from char* literals to char16_t literals

Change-Id: I99381a2da08d9d35e6135c48bd92bd8d72533065
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:45 +03:00
Anton Kudryavtsev
0ccb8ab1db qtextdocument: replace fromLatin1 with L1 literal
to reduce allocations

Change-Id: Ie6f734269c9e880ff208629a625c88f4841e9533
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:45 +03:00
Anton Kudryavtsev
33d606412d qtextdocument: use qsizetype more
in Qt::mightBeRichText, Qt::convertFromPlainText
and emitFrameStyle to support large strings

Pick-to: 6.6 6.5 6.2
Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-05 22:08:44 +03:00
Anton Kudryavtsev
e9e076df55 QString: use qsizetype more
It's last legacy int

Pick-to: 6.6 6.5 6.2
Change-Id: I691f7b15dead91166831cdf6c33a9f4d2d58b62e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 22:08:44 +03:00
Anton Kudryavtsev
05737f831c QString::insert: micro optimization
Don't call resize on QVLA, just wrap pointers in QSV
As drive-by, fix typo in comment

Change-Id: Id90236cfb53d861b8bd57fa9452aba4b8d9b20bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 22:08:44 +03:00
Marc Mutz
1219dbcd12 QPointer: ensure construction from nullptr is constinit'able
Construction from nullptr wasn't, before, because it was using the
QPointer(T*) constructor, which cannot be constexpr. Add a constexpr
QPointer(std::nullptr_t) constructor to enable this use-case.

This requires to mark the (T*) constructor as Q_WEAK_OVERLOAD,
otherwise legacy construction from a literal 0 would be ambiguous.

No documentation changes needed, as the set of valid expressions
(apart from constinit'ing) has not changed. Mention the nullptr ctor,
though, without \since.

Add a test to confirm that contruction from derived still works.

Change-Id: If9d5281f6eca0c408a69f03fecba64a70a0c9cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 20:19:40 +02:00
Marc Mutz
c0ba4ad49d QtAndroidAccessibility: fix unneeded runtime initialization
Initializing QPointer with nullptr is currently still going through
the (T*) ctor, which is not constexpr, so is initialized at runtime.
This will change in Qt 6.7, but that doesn't help the older branches.

Use the default constructor, which is constexpr, and assert that no
runtime initialization happens by using Q_CONSTINIT.

Amends f929756578.

Not picking to 6.2, 5.15 because, while affected, they're in too
stable a mode for this, and they also lack Q_CONSTINIT.

Pick-to: 6.6 6.5
Change-Id: I41bb6f36d529effda008f166fd05a8896157edc9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 20:19:40 +02:00
Marc Mutz
a0d931e482 qfuture_impl.h: remove unused qpointer.h include
The last QPointer user was removed in commit
07d6d31a4c. Prune the include.

Change-Id: Id48ffd2f8f5c1790bbdc54d66ac0c404b0af9cd2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 20:19:39 +02:00
Mårten Nordheim
1bfdbe5c71 Inline Functor struct into FunctorCallable
It's currently its only user, so drop the extra code and inheritance.

Change-Id: I6e525a9629b7289cc770133936e089683b763289
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:50:33 +02:00
Marc Mutz
c3986032a8 QPointer: mark the dereference operator noexcept, too
The std types do that on their smart pointer types, so while it's not
100% correct (the function has the precondition !isNull()), follow
upstream and mark this operator noexcept, too.

Change-Id: Ie688598215afe2db4c0c26fcfa192fc7c8e22150
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-10-05 19:40:03 +02:00
Marc Mutz
4f191cf657 QPointer: plaster API with noexcept
Mark almost all public functions of the clas as noexcept.

Exceptions:

- assignment and construction from T*: allocates an ExtraData in
  QObjectPrivate

- dereference: the std types do that, but it's not 100% correct, so
  not proposed in this patch

As a drive-by, remove pointless inline keywords.

Change-Id: Ice91dfc429a4268546c0b8275da329be05f4edcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-10-05 19:40:02 +02:00
Tor Arne Vestbø
fc1549c014 macOS: Silence warning about supporting secure state restoration
We don't support or implement state restorations via the AppKit
state restoration APIs, but if we did, we would/should support
secure state restoration. This is the default for apps linked
against the macOS 14 SDK, but as we target versions below that
as well we need to return YES here explicitly to silence a runtime
warning.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117745
Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-05 19:40:02 +02:00
Marc Mutz
2b8e1a706e QPointer: mark converting assignment operators noexcept
All operations they perform (copy/move construction + swap()) are
noexcept, so these functions should be noexcept, too.

Amends 93019dc0dee3dd3d568775250e3fae8eda072850 and
(FIXME)93019dc0dee3dd3d568775250e3fae8eda072850(ONCE MERGED).

Change-Id: I9010f87f93ce3efcefd8b28d848a3eadd6e74542
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:40:02 +02:00
Marc Mutz
b6c7335635 QPointer: fix missing converting move-assignment operator
When 6c504f2519 added the conversion
copy-constructor to fix an ambiguity, its commit message argued at
length why a move-assignment conversion operator was not possible. But
we actually have the existing converting move and copy ctors, so we
can just use copy-and-swap and move-and-swap, so do that.

As a drive-by, make the copy-assignment operator use copy-and-swap.

[ChangeLog][QtCore][QPointer] Added missing converting move-assignment
operator. This is forwards-compatible with Qt 6.6.0: compiling against
6.6.0 will just use the lvalue overload.

This is BC and SC, forwards and backwards (inline code, and going back
in time will just use the lvalue overload), so picking to 6.6.

Pick-to: 6.6
Change-Id: Ibbefb0927c08d8c716a952c6c592a02df2a89008
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 19:40:02 +02:00
Rym Bouabid
9d32288a38 Revamp Bindable Properties exp: Revisit documentation
Remove "Example" from the title.
Add \examplecategory Data Processing & I/O

Fixes: QTBUG-114689
Pick-to: 6.6 6.5
Change-Id: I695df195819cc371d404c4c5f01a0c4830d9c438
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-05 15:44:32 +02:00
Giuseppe D'Angelo
7d18ad49a3 QStringView: simplify the constructor from QString
We have to single QString out because of the isNull/isEmpty distinction.
Still, we can avoid having a constructor template on it constrained on
the argument being precisely QString. This is a historic remnant; in Qt
5 the constructor also worked with QStringRef.

Change-Id: I5457a83d5b77887f57ea9910a826f729ec276d28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-05 02:40:02 +02:00
Mårten Nordheim
2c6b7ff501 QNetworkInfo[NetworkManager]: Make ctors explicit
Change-Id: I65a37bd108bd52b9ab754127e9f6c4929bf3eca1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-05 01:35:01 +02:00
Laszlo Agocs
1d019de6b7 rhi: Fix intro doc snippet with Vulkan
The QVulkanInstance must outlive the QRhi (if Vulkan is used).
Otherwise subtle problems may pop up upon application exit.

Pick-to: 6.6
Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-10-05 00:23:46 +02:00
Mårten Nordheim
b153181546 Mark potentially unused variable as maybe_unused
Fixes compile error with MinGW clang.

Amends de6f405313

Pick-to: 6.6 6.5
Change-Id: Idc1fac9d92369cfc79b5c770830bb43b3c5aae91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-04 21:16:29 +02:00
Assam Boudjelthia
29919f3dc9 Android: Add Android 14 to QOperatingSystemVersion
Fixes: QTBUG-116643
Change-Id: I014ada85deda44226e68d230aebc3c3d5a62df00
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 22:04:46 +03:00
Anton Kudryavtsev
c24572d2a4 QString: proper compare of iterators
Canonical way is compare result of std::find_if against end by != operator, not <

Change-Id: Ifffbaf11416ea0738a1ccbb2f2f8482193390070
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 22:04:46 +03:00
Rym Bouabid
b956fec7ee Remove Custom Type Example and Custom Type Sending Example
The whole Q_DECLARE_METATYPE part is superfluous in these two examples,
as QVariant works with any type as long as it is copy-constructible.
And QVariant will call the equivalent of qRegisterMetaType, so that
doesn't need to happen, either.
Showing how to integrate the type with qDebug is fine in theory, but
also a repetition of content that can be found in other places.

Given that there isn't much else being shown in these two examples, it's
better to remove them from examples and move them to manual tests.

Some parts of "Custom Type Example" were used as snippets in other
documentations under qtbase/src/corelib. So, they were added in
customtypeexample.cpp file in the snippets folder.

Fixes: QTBUG-117001
Pick-to: 6.6 6.5
Change-Id: I45b16338912e3f7394cbb5169642bd31af32d5e1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-04 21:04:45 +02:00
Rami Potinkara
adb7e2525e Android: fix display cut mode being short edges always
Fixed _SHORT_EDGES and _DEFAULT conflict.

Mapping from Qt API's to Android's is following:
-QWindow::FullScreen -> _DEFAULT
-Qt::MaximizeUsingFullscreenGeometryHint -> _TRANSLUCENT
-Others  -> _NEVER
-Not supported -> _SHORT_EDGES (Use Java as workaround)

For example in QML:
-visibility: Window.FullScreen
-flags: Qt.MaximizeUsingFullscreenGeometryHint

Fixes: QTBUG-114437
Task-number: QTBUG-96877
Pick-to: 6.6 6.5 6.2
Change-Id: I730b3e3f76401b52548ece05dee60526d0be8207
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-10-04 19:04:45 +00:00
Anton Kudryavtsev
694f4f3a3b write_pbm_image: use QBAV more
to reduce allocations

Change-Id: I99351a8042a315b4b0742567ba77082b576cbece
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-04 21:42:50 +03:00
Kai Köhne
ec7f06fa62 Remove 'SecurityCritical' attribute for psl-data
The list is used to prevent the setting of super-cookies for independent
domains, so in a way, the content is related to security.

Anyhow, having it always up to date is not super critical, as this is
used mostly as a band-aid. Also, the updates are fairly expensive in
file size, and as upstream doesn't do classic 'releases', we must define
how often we should update.

Let's remove the urgency to update it for every patch-level release by
removing the SecurityCritical attribute. Instead, we should aim for
updating it right before minor releases, so about twice a year. This is
btw what other projects are doing: Chromium updates the list
twice a year, Debian even less often.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I05790f28002190ab0caa5a2a75e3b87cd44462d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-04 18:36:53 +00:00
Tor Arne Vestbø
cf13e4c84c macOS: Activate Qt's platform a11y whenever the system queries us
Otherwise the cached information we store about e.g. table rows
and columns will not be updated, as QAccessible::isActive() is
false during QAbstractItemViewPrivate::rowsInserted(), and as a
result we'll be operating on stale information when the system
comes back later to query us about one of the cells.

This was observed when running a Qt Widgets table app with
the system's Keyboard Viewer open.

Pick-to: 6.6
Change-Id: I88efd46dbc3d35c8b1888d3e29ef3d001bb9eac7
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-10-04 14:54:33 +02:00
Harald Sitter
918fed3915 a11y: fix race condition on atspi startup on Wayland
This amends db346e711c .

Previously we could race between dbus connecting and our "manual"
enabled call since we didn't take into account whether dbus is
connected or not.

This lead to scenarios where opening an application (in particular under
Wayland) would result in the application not being able to register on
the a11y bus because registration was attempted too early.
By simply taking connectedness into account we'll make sure to not
run registration too early anymore.

Pick-to: 6.6 6.5
Change-Id: I46a3c0b57f8a0c83d3e5fae9e355c2061954031f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-04 12:54:33 +00:00
Christian Ehrlicher
8615884728 QMap/MultiMap/Hash/MultiHash: synchronize documentation
Synchronize the documentation of the four container classes:
 - document the return type of insert() and replace()
 - don't reference QMultiHash/Map from QHash/Map except in the details
   paragraph

Task-number: QTBUG-117757
Change-Id: I93ee7eec0c298854e05e83a43f1c7cffd0610d72
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-04 11:56:04 +02:00
Vladimir Belyavsky
2581bed66b QRhiD3D11: do not crash on endFrame() when IDXGISwapChain is null
There are reports on crashes in QRhiD3D11::endFrame() due to nullptr
access to swapChain (IDXGISwapChain). It's still not clear under what
conditions this might happen, but we can make a speculative fix (as a
last chance) by simply adding a check that the swapChain is not null.

Instead of crashing in such cases, we will warn now and return
QRhi::FrameOpError, similar to the case when IDXGISwapChain::Present()
failed.

Task-number: QTBUG-109708
Pick-to: 6.6 6.5
Change-Id: I2b0430347a229a618176a38ce3dc9c6e5a33a60c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-10-04 09:44:42 +00:00
Marc Mutz
1ba4f73692 QPointer: make swap(lhs, rhs) a hidden friend
This is how we like our free functions these days.

Task-number: QTBUG-87973
Change-Id: I55b5f2674d24c7b76b8dc425a4f1c5520b8c1ec4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-04 07:43:59 +02:00
Christian Ehrlicher
aeeb77650f Qt container documenation: Misc fix for std comparison
std::map/multimap/unordered_map/unordered:multimap also need a 'Key'.

Fixes: QTBUG-89904
Pick-to: 6.6 6.5 6.2
Change-Id: Ib653c941b671905762270c82218e50dfed8fc8c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-03 21:08:43 +02:00
Eskil Abrahamsen Blomfeldt
a890df0283 coretext: Support variable application fonts
Named instances of variable application fonts are exposed
automatically through CTFontManagerCreateFontDescriptorsFromData()
(and also for the URL equivalent).

The main change here is just to call this instead of the overload
which only returns the first font.

Note that this also updates the test: This is because the conversion
from CoreText normalized weight values to TTF values is not 100%.
In the CoreText code, we map Heavy (0.56) to ExtraBold, but ExtraBold
gets converted to 0.6, which is closer to the CoreText value for Black
(0.62).

To avoid hitting this inconsistency, the QtExtraBold has been changed
to Black weight instead, which resolves to the same on all platforms.

Task-number: QTBUG-108624
Change-Id: Ied6d42e9e3e1ba8b7102936c5be3d285b3d9e07f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-03 19:25:46 +02:00
Alex Bu
1aba24a2ed Egldevices: Use valid DRM handle to get platform display
Use a valid DRM handle as display attribute to get platform display.
This fix is used together with the default framebuffer fix for the
display issue of egldevices backend on Jetson AGX Orin devkit.

Pick-to: 6.6 6.5
Change-Id: Ia1975936653461c5a7e534c714a123837c62bc10
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2023-10-03 18:47:42 +03:00
Kurt Kiefer
17a68dae5e eglfs: add a default framebuffer to NVIDIA eglstreams
Newer versions of NVIDIA's DRM driver are rejecting the previously
accepted but non-standard use of framebuffer_id -1 in order to set
the output mode but not issue a page flip.

This change adds a default framebuffer to the egldevice driver for
use with the initial calls to set the CRTC mode and plane.

Pick-to: 6.6 6.5
Change-Id: I63dbb6b099250fcff7d995eec38fb75c675894cd
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2023-10-03 08:47:42 -07:00
Anton Kudryavtsev
8419b56097 qFindChar: pass char16_t by value
Cheaply-copied types should be passed by value
according to https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in

Change-Id: I341193c0a65931c1406fc7d711ef74d763178dee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-03 08:38:02 +03:00
David Faure
3d631da88b Fix copy/paste typo in qdom.cpp leading to wrong errorColumn
Detected by KDReports unittests ;-)

Pick-to: 6.5 6.6
Change-Id: I33ab4c16a0fa55d7feffccc807998213132676fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-02 23:23:01 +02:00
Topi Reinio
f0f0a5ccb6 Doc: QtCore: Fix documentation issues
* Fix references to Wait Conditions Example, Semaphores Example, and
  MIME Type Browser Example as they were renamed.

* Rename 'Shared Memory' example as its title clashes with
  the title of another page (sharedmemory.html).

src/corelib/global/qfloat16.cpp:
    * warning: Invalid '\relates' (already a member of 'qfloat16')

Pick-to: 6.5 6.6
Change-Id: Ia28be8e3882a7ad1fadcdbd50a657705d58526bd
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-10-02 21:10:59 +00:00
Topi Reinio
b5169b5c90 Doc: Fix QIcon documentation
* Move \externalpage topics to external-resources.qdoc, as that command
  cannot be embedded in other topics.

* Fix references to non-existent function fallbackIconTheme().

Pick-to: 6.6
Change-Id: I5d08206c53aea9c2d4c6fddf5d04df187b01ef53
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-02 21:10:59 +00:00
Ahmad Samir
42c4d6c249 String views: de-duplicate API docs
Will be reused in later commits.

Change-Id: I078ad7eb0aac6eb389453d8bc32c414c840bc22e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 23:28:13 +03:00
Tor Arne Vestbø
26b279eda1 Make QKeyMapper::possibleKeys's event argument const
To match the QPA layer (QPlatformIntegration, QPlatformKeyMapper).

Change-Id: If1b4817eb334c6cdf1ccd587794701245076bd2f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-02 22:13:36 +02:00
Ahmad Samir
9dfa0b5711 QStringList: de-duplicate API docs
Change-Id: I806634b859b8fed9b7a42aac55a056b0c6408fb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 22:12:35 +03:00
Anton Kudryavtsev
ab651c22ae QString::section: replace QList with QVLA
to reduce allocations

Change-Id: Ib996549a018b457d2ee4f073efb0d950268c7738
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 22:12:35 +03:00
Rym Bouabid
4aab2ef0ac Revamp Queued Custom Type Ex: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Data Processing & I/O}.

Task-number: QTBUG-117147
Pick-to: 6.6 6.5
Change-Id: Ieaab75dedb60329dcdcbbcfe6e2ad360df4d98df
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-02 19:08:42 +02:00
Tor Arne Vestbø
fa54471050 QCocoaInputContext: Don't emit locale update on startup
We're just resolving the initial locale, via the call site
in the constructor.

Change-Id: I186f4c491c013cce265a855963a8624ce5c6da97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-02 19:08:41 +02:00
Eskil Abrahamsen Blomfeldt
500be123f4 Support variable applications fonts with DirectWrite
For GDI, there doesn't seem to be any way to do this, so it depends
on selecting the DirectWrite font database explicitly.

This moves the supportsVariableApplicationFonts() check into the
QPlatformFontDatabase instead of the font engine, since that's
where it belongs.

[ChangeLog][Fonts] Added support for selecting named instances in
variable application fonts when using the DirectWrite backend.

Task-number: QTBUG-108624
Change-Id: I51e0fedd7a9616088a06453a1d17f48bd18fa5a7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-02 18:00:33 +02:00
Eskil Abrahamsen Blomfeldt
0138d910b2 DirectWrite: Fetch correct style name in font info
When getting the font info for a resolved QFont on DirectWrite,
the style name would not be set, so there would be no way to
check the style name of the actual resolved font.

Change-Id: I5ff27e95619a330b7d2a0252222fad8629837418
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-02 18:00:33 +02:00
Morten Sørvig
d4e5898ba0 wasm: Don't assert on empty getRelocatablePrefix()
Emscripten expects to find shared libraries at the root
of the in-memory file system; set prefixPath accordingly.

(Emscripten does not always use the file system though,
for example when linking the main wasm file).

Change-Id: Ia8053274e23f15fb9ea74a6bebf1ed607cc2c2fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 18:00:33 +02:00
Axel Spoerl
c10a50ac3c QHeaderView: Fix columsMoved/rowsMoved connection to item model
Amends f8fc93fdef and corrects wiring to
wrong slot.

Found-by: Marten Nordheim <marten.nordheim@qt.io>
Task-number: QTBUG-117698
Change-Id: I9833f7abc190e2f89b534ad5761db83ba5b895a3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 16:00:33 +00:00
Tor Arne Vestbø
d50bf18726 Support more verbose debug output for QKeyEvent
Sometimes it's useful to know the scan code and virtual key as well.

Change-Id: Ic120189470a9ff44a5cb7f6dcc1405654136424f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-02 18:00:33 +02:00
Jan Grulich
e25c773f2b QCryptographicHash: don't forget to unload OpenSSL providers
Automatically unload loaded crypto providers on cleanup. In most cases
we don't load them, but when we do (e.g. when MD4 is used), we would be
leaking memory.

Fixes: QTBUG-115233
Pick-to: 6.5 6.6
Change-Id: I91318d391ab35d00647d1e9e2408fc987811a2d3
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 16:34:31 +02:00
Antti Määttä
cd7c1037c2 Fix compiler error
Fix missing ';' before '}' error.

Change-Id: If377623b65c00b728c00db20a0d81e200150ae7d
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-02 16:54:46 +03:00
Axel Spoerl
975c0bdf73 QDockWidget: Don't use QWidgetResizeHandler on Windows
QWidgetResizeHandler sets its own mouse cursor, which can cause the
wrong icon being shown in corner cases (e.g. floating dock with custom
title bar and windows container).

Windows handles resizing of toplevel windows on platform level. A
QWidgetResizeHandler is not necessary.

=> Do not create one on Windows.

Resizing of floating dock widgets is tested in
tst_QDockWidget::dockPermissions(), floatingTabs(), hideAndShow().
=> No separate autotest needed.

Fixes: QTBUG-102196
Pick-to: 6.6 6.5 6.2
Change-Id: I20ab203e6b7ecc1dbda0524c7ff9bef271a7c04f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-02 14:50:57 +02:00
Morten Sørvig
5f1c29376c Add catch-all DPR update to expose event handling
The platform plugin should already DPR (or DPI) change
events, however if that does not happen we update in
the expose event as well as a last resort to make sure
the window's DPR value is in sync.

Also print a warning and ask for a bug report.

Pick-to: 6.6 6.0
Change-Id: Ibb144f163281a28216c2fa3353ed50237e91ce25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-02 12:50:57 +00:00
Morten Sørvig
628692a2f2 wasm: make haveAsyncify() return true for any asyncify
User code usually don't need to differentiate between asyncify
1 or 2 (JSPI), since the differences are abstracted over by
the wasm event dispatcher.

haveJspi() returns true for JSPI only as before, and can be
used to differentiate between the two.

Add canBlockCallingThread(), which returns true also for
secondary threads (which don't need asyncify to block).

Change-Id: Ia37513f2d4c56ef6351c950b5fc31ad15fa389d9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-02 09:41:50 +02:00
Christian Ehrlicher
4536ff2533 QDataWidgetMapper: use pmf-style connect
Use pmf-style connect, remove Q_PRIVATE_SLOT and remove the _q_ prefix
for the private slots.

Change-Id: I7e606e24f4f89183eb12fefcf53d0d8952a90516
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-02 09:28:03 +02:00
Øystein Heskestad
c73ee7353a Fix not emitting proxyAuthenticationRequired signal for NTLM
During NTLM http proxy authentication QHttpSocketEngine did
not emit the proxyAuthenticationRequired signal during
handling of HTTP 407 responses. As a consequence, the proxy
server was spammed with connection requests that never
worked.

Fixes: QTBUG-109718
Pick-to: 6.6 6.5
Change-Id: Icf0ccf58e3f2690d210652713155a303026ed3b1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-02 07:13:45 +00:00
Mitch Curtis
ccda336246 Doc: state that models are not thread-safe
Fixes: QTBUG-107598
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: I0e7ea8d4b2094d92b3cad5eec5b30e6e3ac64018
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-02 12:22:44 +08:00
Thiago Macieira
da0571d878 QtTest: block almost all Unix signals in the WatchDog thread
Signals delivered via kill(2) are delivered to any thread that is
running, so let's make sure the WatchDog thread doesn't get them.

This may be hiding bugs in the user's handler code, but in simple unit
tests the user may not be expecting there to be multiple threads in the
first place.

Pick-to: 6.6
Change-Id: I512648fd617741199e67fffd17822cdcdf30926c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-01 16:29:42 -07:00
Christian Ehrlicher
011d71664b QAbstractItem/Column/TreeView: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: Id15ef245cacca9c00bf65271bccf4da82fb7fd2f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:30 +02:00
Christian Ehrlicher
81e53db238 QTreeWidget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: Ib03acba5823101f05d695aa31fd0d7f131443c01
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:28 +02:00
Christian Ehrlicher
490dc22ebd QListWidget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I38f13fff8312ac1f3f9da6e034f3131de7bd6247
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:27 +02:00
Christian Ehrlicher
72a39ed3ed QHeaderView: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I9a5e178af997bfcfef78f7a3b9b84da6d653186d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:25 +02:00
Christian Ehrlicher
03b437bbad QTableView/Widget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I60275b7da6bf5e78562ccfd38a02719cc313eb49
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 19:33:24 +02:00
Christian Ehrlicher
3ad6bdcc62 Widgets/Itemviews: remove unused private slot macros
Remove the now unused Q_PRIVATE_SLOT() macros for all itemviews classes
after the conversion to the new style-connection syntax.

Task-number: QTBUG-117698
Change-Id: Id4b8077d9f07741cc418a2126843565940701125
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:31 +02:00
Christian Ehrlicher
f8fc93fdef Widgets/Itemviews: use pmf-style connect in QHeaderView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ia0745dc10a917f3af4b448b3156d66bdb5d6ce64
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:23 +02:00
Christian Ehrlicher
39d486171b Widgets/Itemviews: use pmf-style connect in QColumnView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I955bd088e24ada7aa87645d28dc9b201bc67e927
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:22 +02:00
Christian Ehrlicher
063e25e512 Widgets/Itemviews: use pmf-style connect in QListWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: If2c259c3f7737cec736c134c8bc83c4cb14906ba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:20 +02:00
Christian Ehrlicher
2666c773ba Widgets/Itemviews: use pmf-style connect in QTableWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I2b5bb99c77e6e783a4cd7b0065d2f52a0266d88b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:19 +02:00
Christian Ehrlicher
c55a7e4167 Widgets/Itemviews: use pmf-style connect in QTreeWidget
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: I652c8d6f27b23a7d4467dc39b7c12850f4d25f66
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:18 +02:00
Christian Ehrlicher
0bb35ee2f0 Widgets/Itemviews: use pmf-style connect in QTreeView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ic6617b3611a2ce156e9e568c1d07343f649562c4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:17 +02:00
Christian Ehrlicher
3e144bdc74 Widgets/Itemviews: use pmf-style connect in QTableView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Task-number: QTBUG-117698
Change-Id: Ifd6a55080a803b3aba2e35b9679a5194ff3f633c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-01 17:10:15 +02:00
Marc Mutz
64b07fc811 QAtomicScopedValueRollback: fix a typo
Pick-to: 6.6 6.5
Task-number: QTBUG-115107
Change-Id: I9ca5d143b5c89443fc40859c035be43cde3d73c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-01 10:48:49 +02:00
Marc Mutz
e054d9f558 QAtomicScopedValueRollback: make store_part() static
... because we can.

Pick-to: 6.6 6.5
Task-number: QTBUG-115107
Change-Id: I23b5edc6111615cbd0352847b2f1a1667948c40a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-01 10:48:45 +02:00
Albert Astals Cid
88c74240a8 FileChooser portal: Make sure filter.name is not empty
Xdg-desktop-portal will reject any OpenFile request if there is an empty
filter, so if we can't find the mimetype in the mimedatabase we just
use it's "raw name"

Pick-to: 6.6 6.5 5.15
Change-Id: I705ae7523445e5c2ec97a42ee334401bc90adb68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-01 08:23:32 +02:00
Ahmad Samir
00c1c04bd5 String classes: make first/last/chopped() delegate to sliced()
De-duplicates code.

Change-Id: Id29511e7e571ed14f9e3cfd4355b901d81ea2562
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-30 19:29:51 +03:00
Tor Arne Vestbø
fdd2fc2c71 Remove QKeyMapper::changeKeyboard()
As described in QTBUG-27681, we no longer send KeyboardLayoutChange
events in Qt 5 and up. We have QInputMethod::localeChanged, but that
doesn't cover the cases where the input language stays the same, but
the layout is changed.

None of our widgets react to KeyboardLayoutChange these days, but
ideally we should send KeyboardLayoutChange if we can plumb it from
the platforms.

However that plumbing wouldn't live in QKeyMapper, and having it
around as dead code doesn't help, so remove it for now, and track
the work to implement it in QTBUG-27681.

Task-number: QTBUG-27681
Change-Id: I480590550f3bc741b829fb30aa85393b07d5c16f
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-30 11:11:39 +00:00
Tor Arne Vestbø
eb4103e0b9 Remove QKeyMapperPrivate
There is no point in maintaining the keyboardInputLocale and
keyboardInputDirection in the QKeyMapperPrivate, as these
things are handled by QInputContext nowadays. The values
were never updated either, so the base class implementation
of QPlatformInputContext referring to them was confusing.

With those gone, we can remove the entire class.

Subclasses of QPlatformInputContext typically only override
locale(), so we now base the input language direction on the
current locale(), giving dynamic updates of the direction as
well (without the signal, but this will be fixed in a follow
up patch).

Change-Id: I16ae4097eadadd278e60edea3c1101ab90ed7444
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-30 13:11:36 +02:00
Marc Mutz
fdf7774bc6 QPersistentModelIndex: fix relational operators not being noexcept
They actually can be, so the implementation need not change. Just add
the noexcept tag (which is BC, it's not part of the name mangling on
any compiler).

Silences a bunch of XFAIL in the test (the test is automatically
picking up the change, no need, and no way, to manually remove the
QEXPECT_FAIL).

Change-Id: I24b6ba1248001056de64f341617943e7aea5ae93
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-30 13:02:05 +02:00
Marc Mutz
49f9271360 QPersistentModelIndex: fix UB (op< on unrelated pointers)
Pointers can only be legitimately compared with less-than (<) if they
point into the same array (or one past the end). This is decidedly not
the case for heap-allocated objects like
QPersistentModelIndexPrivates, so doing it is UB.

Fix by using std::less, which is guaranteed to be a total order, even
for unrelated pointer values.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If04341b4b55784e7732782f3ae829f53b0ceab9c
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-30 13:02:00 +02:00
Thiago Macieira
94df3f8d6b QStorageInfo/Unix: check the mount point length before isParentOf()
Execute the cheaper test first, so we loop over the entries more
quickly.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178749a12c966739
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 19:55:48 +00:00
Thiago Macieira
da95ad91b3 QStorageInfo/Linux: move from MountInfo's contents
Copying QStrings and QByteArrays is reasonably cheap, but moving is
cheaper.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787498ead687da2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
914b3bc985 QStorageInfo/Linux: don't copy the mount info's contents until the end
All these where somewhat cheap to copy (QStrings and QByteArrays), but
why copy multiple times at all? Just copy at the end.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787497434632dd4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
c8d31833f0 QStorageInfo/Linux: remove unnecessary isSymlink() call
symlinkTarget() suffices, because if the candidate is not a symlink, it
will return an empty string. Plus, /dev/disks/by-label is a udev-managed
directory, so everything should be a symlink.

This doesn't change the number of statx() calls because QDirIterator
needs some information on file types to decide how to filter and,
unfortunately, that information is missing for symlinks (we know it's a
symlink, but we don't know what it points to). Moreover, due to
QDirIterator's design, we always statx() one entry past the one we
wanted.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786ce1bd3398d1b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 12:55:47 -07:00
Thiago Macieira
a8e3eb6875 QStorageInfo: add qstorageinfo_linux_p.h to the file listing
Otherwise Qt Creator won't index it.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786cda60859226b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-29 12:55:47 -07:00
Allan Sandfeld Jensen
b1e6dc8d9c Compress QTimer events the same on all platforms
It was limited to only the most common platform, Windows.

Change-Id: I1821a5201f85b14f8f43469775af816519724f6b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-29 21:30:09 +02:00
Topi Reinio
7fdef80a6b Doc: Fix QRgbaFloat function signatures
Commit baac34de modified the set[Red|Green|Blue|Alpha] function
signatures. Amend the \fn commands to reflect those changes.

Pick-to: 6.6
Change-Id: I947995fc5c80baac111a04272cd848961c22eb73
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-29 19:30:09 +00:00
Tor Arne Vestbø
c0d1029e8e Rename QtWindows::KeyboardLayoutChangeEven -> InputLanguageChangeEvent
We react to WM_INPUTLANGCHANGE, and handle it by calling
handleInputLanguageChanged on the input context.

As input language is not the same as keyboard layout
(a keyboard layout might change without the input
language changing), let's be accurate about what's
happening.

Change-Id: I8914994a8d46485179741e010d0da5135b023668
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2023-09-29 20:22:34 +02:00
Christian Ehrlicher
a126d3627c Widgets/Itemviews: use pmf-style connect in QAbstractItemView
Replace all connect() calls with pmf-style connection syntax. This also
means that we have to properly disconnect everything in the ctor to not
trigger an assertion in QtPrivate::assertObjectType().

Change-Id: I8f2d64b77849bf5fea01b7f80bbd5d0c0a09c4fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-29 20:07:10 +02:00
Volker Hilsheimer
9b37762c55 JNI: Add promotion for signed char and extend test case
The jbyte type is a signed char, which also promotes to int in variadic
argument functions.

Extend the test case to make sure that we don't get any warnings for
the most relevant parameter types.

Change-Id: I7811e1eebdbc989ab5989eb1a2c502acd0540bc7
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-29 16:50:41 +02:00
Tor Arne Vestbø
9800c63533 revert "xkbcommon: make shortcuts persistent across layouts"
This reverts commit 5e76a9569e.

The change's stated goal was to make shortcuts "stable",
i.e. work the same, regardless of which keyboard layout
the user has selected.

In doing so, it changed the semantics of shortcut handling
to depend on the order of the keyboard layouts reflected
by XKB, picking the first Latin layout in the list, instead
of prioritizing the currently selected/active keyboard
layout.

This change in semantics is a major behavior change, and
breaks common and valid setups such as having [en,fr] or
[en,de] layouts.

For example, the French layout uses an AZERTY layout,
where the Q and A keys are switched compared to QWERTY.
With the change in place, pressing the physical A key
on a French keyboard, with Control pressed, no longer
selects all text, but instead quits the application,
as the shortcut is interpreted based on the English
layout, which just happens to be first in the list.

Similar issues exist for German layouts, which use
QWERTZ, or more complex layouts such as the Neo layout.

The semantics of prioritizing the order of declared
layouts instead of the active one is inconsistent with
both macOS and Windows, as well as other toolkits on
Linux, including GTK and earlier versions of Qt.

It's also not discoverable by the user that the order
now matters. For example, there is no UX in the Gnome
setting that tells the user to ensure the order matches
their expectations for shortcut handling. And if there
was, this would only apply to Qt apps built with 6.6.0,
creating inconsistent behavior for users.

Worse, the X server is limited to four concurrent keyboard
layouts (groups), so if the user adds more layouts than
that, Gnome will replace the X server's view of layouts
only when switching to a layout beyond the first four.
And in that case, the X server's view of the layouts is
actually starting with the fifth layout declared in the
Gnome preferences. The logic in the reverted patch does
not take this into account, making it confusing for the
user which layout actually takes precedence.

Note that reverting this change does not affect our
fallback logic for layouts that do not produce Latin
symbols for the given key press, such as Greek or Russian.
Those layouts will continue to fall back to a Latin
layout for their QKeyEvent::key().

[ChangeLog][QtGui][X11/Wayland] A change in 6.6.0 that
resulted in keyboard shortcuts not respecting the user's
active layout has been reverted.

Pick-to: 6.6
Task-number: QTBUG-108761
Change-Id: Iec2897cd1541c0c125cc5b1078d0beec12b501c0
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 13:11:39 +00:00
Ievgenii Meshcheriakov
65953e05d3 QCoreApplicationPrivate: Do checks for application instance as late as possible
`QCoreApplicationPrivate::self` is set to nullptr in `~QCoreApplication`
without any synchronization. So it is not safe to access it from
instances of `QDaemonThread` that may outlive the application instance,
but are using the Qt event system. This patch moves some usages of
`self` behind other checks, so that the QtDBus management thread can
continue workoing without race conditions detected by Thread Sanitizer
while running tst_qdbusconnection.

Change-Id: Iece65e4126a59e3a1a41dfb6a99c84527b8d389c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-29 13:25:42 +02:00
Michael Weghorn
5093e517b9 a11y: Keep current combobox entry in sync
When changing the selected index in a combo box,
also update the current index in the item view's
selection model right away, and don't delay this
until when the combobox popup gets shown in
QComboBox::showPopup.

This is needed to make sure that the selection
is properly exposed to the accessibility layer.

On the accessibility layer, QAccessibleComboBox,
the a11y implementation for the combobox, exposes
the entries in its list child
(s. QAccessibleComboBox::child) and Orca queries
the selected item when the combobox gets focus,
which didn't return the proper results earlier,
resulting in no or the wrong entry getting
announced.

Extend the existing combobox a11y tests
accordingly.

Pick-to: 6.6 6.5
Fixes: QTBUG-117644
Change-Id: Ia26de5eafd229f7686745a2fbe03fc1eb6a713f8
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 09:55:40 +00:00
Axel Spoerl
2b63d0ccf3 QComboBoxPrivateContainer: add missing keyEvent->accept()
Call QEvent::accept() when a key event has been acted on.
This prevents redundant event delivery and consumption.

Task-number: QTBUG-117644
Pick-to: 6.6 6.5
Change-Id: I069c61c14890577683894f165fd2585ba05c45ff
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 11:55:40 +02:00
Axel Spoerl
d8e1100548 QComboBox: Modernise connect statements
Replace string based syntax with PMF.
Use QObjectPrivate::connect.
Rename _q_ functions.
Fix dangling connections in QComboBox d'tor: Completely disconnect
model, instead of only disconnecting QObject::destroyed.

Task-number: QTBUG-117644
Pick-to: 6.6 6.5
Change-Id: Ie87ac4881029ed1ef2f5c627f631cc54ccb39706
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-29 08:37:00 +02:00
Ahmad Samir
2fd9735e7a Add a verify() method to all sequential containers
A helper method encasuplating the asserts related to index into the
container and length, modelled after the QVLA::verify().

`pos <= size` is OK because if pos == size, the e.g. sliced()'ed
container is just going to be empty.

Normalize how verify() is used, the first arg is an index and the second
a length.

This method is constexpr even in QString/QByteArray merely for
consistency with similar methods in other string classes (this
necessitates using `d.size` in verify() in QString/QBA because size()
isn't constexpr).

Change-Id: I90e3c56d76c802259297a06d11d46ee342a1daf2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 23:45:24 +03:00
Dennis Oberst
016addc201 QString: assign() [4/4]: (it,it) overload for UTF-8 data types
Implement the missing overload to handle UTF-8 specific data types,
including char8_t (C++20), char, uchar and signed char.

Introduce the helper function 'assign_helper_char8' which handles the
non-contiguous_iterator case. The contiguous_iterator case is already
handled by the QAnyStringView overload.

Include 'qstringconverter.h' at the end of the file, since it can't
be included at the top due to diamond dependency conflicts.
QStringDecoder is an implementation detail we don't want users to
depend on when using assign(it, it). It would be unnatural to not
be able to use a function just because we didn't include an
apparently unrelated header.

[ChangeLog][QtCore][QString] Enabled assign() for UTF-8 data types.

Fixes: QTBUG-114208
Change-Id: Ia39bbb70ca105a6bbf1a131b2533f29a919ff66d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-28 17:58:41 +00:00
Alexander Volkov
e68a0da0b9 Avoid crash when keysymToQtKey(keysym, Qt::ControlModifier) is called
For example when Ctrl+Home is sent by virtual keyboard on Wayland.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I41f1d2a28c9091efa621d5826a3b9e3e0e481ceb
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-28 17:34:26 +00:00
Kai Köhne
54b5ffb602 Doc: Don't mention setDefaultCiphers() (removed in Qt 6.0)
Pick-to: 6.5 6.6
Change-Id: I775da7679bf4ff398a22334103c3116befec7da9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-28 19:29:31 +02:00
Orkun Tokdemir
8041bfba47 CMake: Update timestamp file for Cross-Config builds
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8564 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `Cross-Config` builds.

The actual error message before this commit when CMake 3.28 is used:
```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```

Pick-to: 6.2 6.5 6.5.3 6.6 6.6.0
Change-Id: Ib544b18b67d2d4722f3801b1f46a0e0e18e59d48
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-28 16:23:59 +00:00
Edward Welbourne
02d8dc5f8c Rework getting normalized dates adjacent to a given one
I originally wrote dateNormalize() because I expected to need it more,
but it turns out to only be needed for two cases of getting the days
before and after a given one. So rename to adjacentDay(), pass the +1
or -1 step and simplify a little.

In the process, fix a mistake in the winding backwards across a year
boundary, where I'd incremented the year instead of decrementing it.

Change-Id: I1bb0a8323fec7c1caffa7f20879f08d3526ba7ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Edward Welbourne
44cbd4c315 Don't std::move() trivially-copyable types
CodeChecker tells me struct tm and even MkTimeResult are trivially
copyable, so std::move()ing them is fatuous.

Change-Id: Ic7328e588beabfd4a984b2b5e2ed17c065d00f01
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Ievgenii Meshcheriakov
ad692a1fbb Doc: update future direction of QCoreApplication::notify()
Change the Qt version for future directions of
QCoreApplication::notify() to 7. The required changes were not
done in Qt 6 as planned. Add the code that is implementing those
changes for Qt 7.0.0.

This amends 4fe865ac7a.

[ChangeLog][Future direction notices] In Qt 7,
QCoreApplication::notify() will not be called for events being delivered
to objects outside the main thread. The reason for that is that the main
application object may begin destruction while those threads are still
delivering events, which is undefined behavior. Applications that
currently override notify() and use that function outside the main
thread are advised to find other solutions in the mean time.

Change-Id: I4dd2193092542474962cdcde4921f38b173f2f00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-28 14:51:33 +02:00
Po-Hao Su
7c4aa794ca SQLite: Handle identifiers correctly
This change can be described in the following 2 categories:
1. Support 3 ways to escape identifiers mentioned in SQLite Keywords
   In SQLite Keywords (https://sqlite.org/lang_keywords.html), it shows
   that there are 3 ways to escape identifiers, i.e., "", [], ``. So, I
   have overridden "bool isIdentifierEscaped(const QString &,
   IdentifierType)" to support it. In addition, there was a bug of
   _q_escapeIdentifier. If there is a field name called length [cm],
   which uses square brackets to show units, _q_escapeIdentifier will
   not escape it to "length [cm]".
2. Identify identifiers correctly if identifiers have been escaped
   There is a bug of QSQLiteDriver::record and
   QSQLiteDriver::primaryIndex.
   If we input escaped identifiers with separator, let's say
   "databaseName"."tableName", both will change the input into
   databaseName"."tableName, which is incorrect and causes
   qGetTableInfo cannot get the right results. In addition, I overrode
   stripDelimiters to strip "databaseName"."tableName" correctly.

There are still some assumptions for isIdentifierEscaped,
escapeIdentifier, and stripDelimiters, but I think this change it better
than what we have now.
1. For isIdentifierEscaped, if identifiers have a dot and the dot is a
   separator, it is the users' responsibility to escape the pair of
   schema and table name correctly. For example,
   "aSchemaName"."aTableName", not "aSchemaName".a"TableName". That's
   because we don't know whether the dot is just a dot of the name or a
   separator.
2. For escapeIdentifier, if identifiers have a dot and the parts before
   and after the dot are not escaped, escapeIdentifier will treat the
   dot as part of the table name or field name. The same as the item
   above, it is users' responsibility to do it right.
3. For stripDelimiters, the same as above, it is users' responsibility
   to do escape if users want to use format schemaName.tableName or
   tableName.fieldName.

Change-Id: I9d036a2a96180f8542436188f75a220a0fe58257
Reviewed-by: Po-Hao Su <supohaosu@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-09-28 20:51:33 +08:00
Volker Hilsheimer
f791570b86 QTestPrivate property tests: don't try to create abstract types
Amends 5743837a26, after which Qt
Positioning and Qt SCXML failed to build as some properties operate on
abstract classes.

Check whether we can instantiate the tested class before trying to do so,
otherwise return a default-constructed unique_ptr.

Pick-to: 6.6 6.5
Change-Id: Ida9d4375197a93438062b1e1473b4a2a22cc7054
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-28 13:51:33 +02:00
Łukasz Matysiak
af3e139941 Remove obsolete code related to ioctl on vxworks
Previous implementation of qt_safe_ioctl mentioned that vxworks defines
ioctl in a non-standard way.
As of VxWorks 23.03 ioctl is now properly defined so the comment and
check in the code are obsolete.

Task-number: QTBUG-115777
Change-Id: I0fdf614e45063b031e2c998339d6987ba69167ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-27 23:56:27 +02:00
Mårten Nordheim
3b655bcda7 QNetworkInfo[NetworkManager]: Clean up some string macro usage
Change-Id: I7ee967b09aeafb8bfbedd509032dd1f45fd4956e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-27 21:48:25 +02:00
Marc Mutz
bb51f0d814 qSwap: try without -Wno-noexcept
The warning from the comment was probably caused by our noexcept
detection code. Now that we use std::is_nothrow_swappable, those
warnings should not longer happen.

Remove the warning suppression macros, and the #include that was
necessary for them.

Change-Id: Ib750cb1af4a8da3fb63b16d26ec51a9fb4a93ea1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-27 21:09:28 +02:00
Alexey Edelev
9349e463d4 Use the actual target name as base name for android deployment settings
QtC is unable to find the deployment settigns if target uses custom
OUTPUT_NAME. There is no particular reason for using the target
OUTPUT_NAME property as the base name for android deployment settings.

[ChangeLog][General][Android] The target name is used as a base name of
android deployment settings, but not the OUTPUT_NAME property.

Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-117509
Change-Id: I1ac3b0ad305dc55289bef39c6e946bcf684e772f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-27 17:44:59 +00:00
Liang Qi
fc556e3571 QAccessibleComboBox: Cleanup comboBox() calls
Handle comboBox() returning nullptr.
Avoid repeated qobject_cast by calling comboBox() once per function.

Fixes: QTBUG-115161
Pick-to: 6.6 6.5 6.2
Change-Id: I3d102cebe807da379fa4d9ee2aee1e72b8fdf004
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-27 19:44:59 +02:00
Volker Hilsheimer
185c3b080c JNI: Fix native functions that take a declared QtJniTypes class
Now that QtJniTypes::Objects are no longer primitive types that are the
same as a jobject, using those types in registered native functions
breaks. JNI will call those function with a jobject on the function
pointer, and lacking any type safety, the call to the registered
function will proceed with a wrong type of object on the stack.

To fix that, register the native function via a proxy that is a variadic
argument function, and unpack the variadic arguments into a list of
typed arguments, using the types we know the user-code function wants.
Then call the function with a tuple of those types using std::apply,
which gives us type safety and implicit conversion for free.

Add a test that exercises this.

Change-Id: I9f980e55d3d13f8fc16c410dc0d17dbdc200cb47
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Volker Hilsheimer
62cb5589b3 JNI: Make declared QtJniTypes classes proper QJniObjects
Instead of having a type that doesn't behave like a QJniObject, which
includes not holding a proper reference on the Java object, make the
QtJniTypes::Object type a QJniObject subclass that can be specialized
via CRTP to provide type-specific constructor and static functions.

QJniObject doesn't have a virtual destructor, but we subclass it only to
add a typed interface, without adding any additional data members.
Add versions of the static functions from QJniObjects to the
QtJniTypes::Object so that they can be called without explicitly
specifying the type or class name. This includes a constructor and named
constructors.

Constructing such objects means constructing a Java object of the class
the object type represents, as per the Q_DECLARE_JNI_CLASS declaration.
This is not without ambiguity, as constructing a type with a jobject
parameter can mean that a type wrapping an existing jobject should be
created, or that a Java object should be created with the provided
jobject as the parameter to the constructor (e.g. a copy constructor).
This ambiguity is for now inevitable; we need to be able to implicitly
convert jobject to such types. However, named constructors are provided
so that client code can avoid the ambiguity.

To prevent unnecessary default constructed QJniObjects that are then
replaced immediately with a properly constructed object, add a protected
QJniObject constructor that creates an uninitialized object (e.g. with
the d-pointer being nullptr), which we can then assign the constructed
jobject to using the available assignment operator. Add the special
copy and move constructor and assignment operators as explicit members
for clarity, even though the can all be defaulted.

Such QJniObject subclasses can then be transparently passed as arguments
into JNI call functions that expect a jobject representation, with the
QtJniTypes::Traits specialization from the type declaration providing the
correct signature.

QJniObject's API includes a lot of legacy overloads: with variadic
arguments, a explicit signature string, and jclass/jmethodID parameters
that are completely unused within Qt itself. In addition the explicit
"Object" member functions to explicitly call the version that returns a
jobject (and then a QJniObject). All this call-side complexity is taken
care of by the compile-time signature generation, implicit class type,
and template argument deduction. Overloads taking a jclass or jmethod
are not used anywhere in Qt, which is perhaps an indicator that they,
while nice to have, are too hard to use even for ourselves.

For the modern QtJniTypes class instantiations, remove all the overhead
and reduce the API to the small set of functions that are used all over
the place, and that don't require an explicit signature, or class/method
lookup.

This is a source incompatible change, as now QJniTypes::Object is no
longer a primitive type, and no longer binary equivalent to jobject.
However, this is acceptable as the API has so far been undocumented,
and is only used internally in Qt (and changes to adapt are largely
already merged).

Change-Id: I6d14c09c8165652095f30511f04dc17217245bf5
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Volker Hilsheimer
0bd3882acd JNI: reduce code duplication for QJniObject constructors
Move the shared code into a variadic template construct-function of
the private, which can do the rest.

Change-Id: I98a9a93b7c0452cc28769370e6a1499f1728a72d
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Volker Hilsheimer
b5dd6d98bf JNI: move private QJniObject helpers out of the public header
Functions that are not called by any of the inline code don't have to be
in the public header. Move them as static functions into the translation
unit. Remove some useless wrappers in the private, and move the code for
private and static functions together.

Some private helpers have to stay in the ABI as they used to be called
by at least one public inline function up to Qt 6.6. Remove them from
the API using QT_CORE_REMOVED_SINCE.

Change-Id: I7eb7b2ba994dfda9de11e2d090a70842dad17247
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Volker Hilsheimer
39294317e0 JNI: merge class loading implementations
QtAndroidPrivate::findClass first tried the cache, then JNIEnv::FindClass.
Failing that, it tried QJniObject::loadClass which also checked the
cache before falling back to the ClassLoader.

Merge the implementations into QtAndroidPrivate::findClass. Loading a
class now always first tries the cache, then FindClass, then the
ClassLoader. Reduce the overhead from temporary QJniObject creations by
explicitly creating the class string, and avoid printing the exception
in case of failure twice by clearing the exception explicitly after the
first try.

Assert that the function receives a JNIEnv pointer, as any call without
is a programming error (and all call-sites in Qt pass in a valid pointer
anyway, so no need to test otherwise).

With both implementations merged we can centralize the binary encoding
of the class name strings to the single place where it's needed, which
is when calling the ClassLoader::loadClass method. FindClass takes a
fully qualified, slash-separated class name string, so in most cases we
never have to pay any overhead for re-encoding the class name string.

Change-Id: I5a3648763052cebdec69d7d77c503aebdebf5bee
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Volker Hilsheimer
064b46779c JNI: Implement QJniObject::className to get the name of the class if not set
If we construct the QJniObject from a jobject, then we know the jclass,
but not the class's name. If className is called while the stored name
is empty, get the name of the jclass and updated the stored value.

Change-Id: Ic3332a6da2dac1eb6842f90da1b9264398a43155
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-27 19:44:58 +02:00
Ivan Solovev
5743837a26 Extend QTestPrivate property tests - update signatures [1/2]
Testing for the binding loops requires a second instance of the
TestedClass. In general case, we cannot guarantee that the TestedClass
is default-constructible, so we introduce a new parameter - a function
that returns an std::unique_ptr holding the properly-constructed
instance of TestedClass. The default implementation simply creates
a unique_ptr using a default constructor, which is good enough for
most cases. The user needs to provide a custom function when
TestedClass has no default constructor (for now such usecase exists
at least in QtScxml and QtPositioning).

This patch introduces new signatures for the helper functions, but does
not actually provide new implementation.

This is an attempt to simplify the CI integration process.
The new arguments have default values, so the existing code will not
be affected.
The idea is that the merge process goes as follows:
* this patch gets merged into qtbase. It should not break leaf modules,
  because the new parameters have default values -> existing tests are
  unaffected.
* it unblocks all patches to the leaf modules that require the new
  parameter for the test helper functions. These patches are also
  supposed to fix all the problems with the binding loops.
* once these patches are merged, a follow-up patch to qtbase that
  actually extends the test coverage can be merged. As it is supposed
  that all problems in the leaf modules are already fixed, merging
  this patch should not lead to new problems.

The actual implementation of the new tests is provided in a follow-up
patch.

Task-number: QTBUG-116345
Pick-to: 6.6 6.5
Change-Id: I0dd5c8c60de01aa960d63673b5d7de97950d9490
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-27 14:09:50 +02:00
Jonas Kvinge
c66dab56b2 macdeployqt: Also look for app libraries with .so extension
Fixes deploying glib-networking gio modules which uses .so file
extension.

Change-Id: I6b4c4e9c3bb5745ffa33d7e83c5853a9372f1ca6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-27 13:36:12 +02:00
Ulf Hermann
c4bfd32cca QProperty: Steal currentCompatProperty while evaluating a different one
currentCompatProperty should point to the compat property that's
currently being evaluated. As soon as we start evaluating a new compat
property, it's invalid by definition. Temporarily disable it then.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-109465
Change-Id: I7baba9350ebf488370a63a71f0f8dbd7516bf578
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-27 09:31:41 +00:00
Thiago Macieira
e95467bc6b QNativeSocketEngine: fix build with FreeBSD: sockaddr_dl wasn't declared
This partially reverts fcb548878b.

qnativesocketengine_unix.cpp:872:40: error: unknown type name
'sockaddr_dl'; did you mean 'sockaddr_in'?

Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd178844096ee7741b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-26 20:40:15 +00:00
Giuseppe D'Angelo
10324df60e QWeakPointer: optimize the converting constructor
The converting constructor of QWeakPointer<T> from a QWeakPointer<X>
needs to adjust the X* received by the "source" to a T*.

In case of non-virtual inheritance, this adjustment can be done
statically, by applying an offset to the pointer. In case of virtual
inheritance, we instead need to dereference the pointer (=access the
pointee), get its vtable, and from there find where (=the offset at
which) the T subobject is located.

This latter scenario requires the pointee to be alive throughout this
operation. Since QWeakPointer isn't an owning smart pointer, it's
perfectly possible that the pointee has already been deleted (the
"source" QWeakPointer<X> is dangling) or is being deleted (e.g. from
another thread that has just released the last QSharedPointer). For
this reason the converting constructor of QWeakPointer employs a
protection: it will lock() itself, and extract the raw pointer from the
QSharedPointer so obtained. This ensures that we won't access a dangling
pointer or a pointee about to be deleted.

We can however limit this (relatively expensive) protection only to the
case where there is virtual inheritance. In the other cases we don't
need it. This commit overloads the converting constructor for
QWeakPointer to deal with the two scenarios separately, and only lock()
in case of virtual inheritance.

Change-Id: I7194b90478cf35024e60cff542091308e4131ec2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-26 22:32:51 +02:00
Giuseppe D'Angelo
35878fa924 Long live qxp::is_virtual_base_of
To be used in QWeakPointer.

Change-Id: I5ee9dd0862a0b23d316aaadf5d68bef1ce609e8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 22:32:51 +02:00
Thiago Macieira
bf7732baca QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says
is getting shadowed shouldn't be in scope (`this` isn't being captured).

  qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow]
  qfuture_impl.h:327:26: note: previous declaration is here

Pick-to: 6.5 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-26 12:53:25 -07:00
Volker Hilsheimer
a948b12423 JNI: replace QString with QByteArray as the cache key type
The data combined into keys for the various caches is either QByteArray
or plain const char *, so don't blow them up to QString.
Standardize cache-key generation using a fold expression instead of
QString::arg, which then makes use of QStringBuilder.

Change-Id: I12bb104b0d57156358d93deec8ecd37e10b4f864
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
19ce55c3b1 JNI: merge QJniObject::toString implementation and helper
Both functions are short, and the helper is not reused by other code.
Merge them together so that we can (perhaps later) optimize the repeated
QJniEnvironment construction away.

Change-Id: I168a0620bc4ffbd259ddc3adc6472cfebd11fc5d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
f826d1615a JNI: Implicitly convert QString to jstring in API calls
Support this both for parameters and return types, in all template
functions for calling methods or accessing fields.

To manage the life-time of the temporary objects, create a local stack
frame in the JVM around the calling function. Popping that implicilty
releases all local refernces, so that we don't have to worry about
doing so explicilty. Adding a local reference to the temporary jstring
objects is then enough for the object to live as long as it's needed.

The LocalFrame RAII-like type needs a QJniEnvironment to push and pop
the frame in the JVM, so we don't need a local QJniEnvironment anymore.
Reduce code duplication a bit as a drive-by, and add test coverage.

Change-Id: I801a1b006eea5af02f57d8bb7cca089508dadd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
4702208b40 JNI: Remove unused private constructor overloads
Those are never used, and removing this causes no problems.

Change-Id: Icae334d2d80197c4a416018e435e588a9c76d843
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
980b86d09f JNI: remove compatibility template functions
With all submodules ported, we can remove the old template functions
that prevented us from partial specialization for containers.

Change-Id: I78467b6b343b779270e6f49d7db4ac5deb1a0b95
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
281f499b20 JNI: remove compatibility alias for CTString
Add compile-time testing to make sure that we can declare a JNI
class String that maps to java/lang/String.

Change-Id: I2b68b2b46112e56b279f3fcddc3d71847a005924
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Giuseppe D'Angelo
74b67c8f84 QPen: port to QESDP
Move from a manually managed d-pointer to QESDP. This is a long overdue
change (QPen is one of the few classes still with manual management).
At the same time: it's also one of the central classes, and in order
to keep the impact minimal (and binary compatible), I'm not switching to
something more sophisticated.

As a drive-by: drop QPenData, a remnant only used by QPen itself, which
nowadays is simply a typedef for QPenPrivate.

Change-Id: I38834116d7d383f29bb69ff20b0a46dfe951bb53
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-26 19:34:37 +02:00
Wladimir Leuschner
cf6bccbcf5 Ensure stable sort in QListWidget
QlistWidgets with sorting enabled do not sort stable. A re-sort is
triggered when any Qt::ItemDataRole is changed and not only when
Qt::DisplayRole is changed. Due to an unstable optimization, the changed
element gets inserted at the beginning of their respective "equivalence
group".

This patch disables the optimization and ensures stable sorting
with std::stable_sort. Sorting is only performed, if the subset of
changed items in the range [begin, end] is not already sorted in the
whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check.

Limits / side effect:
The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets.

Task-number: QTBUG-113123
Pick-to: 6.5 6.6
Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-26 16:45:11 +00:00
Mårten Nordheim
5863568c53 QNetworkInfo: Simplify flags check
Change-Id: I5e369b9cd2b3abc6c0ac1e632e495b05c506980b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 18:08:19 +02:00
Mårten Nordheim
af195c4463 QNetworkInfo[glib]: Fix implicit QString creation
Pick-to: 6.6
Change-Id: I906f80be9a6b902af2cb417ef2162f0c76ddbe5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 18:08:19 +02:00
Laszlo Agocs
9f6a2e357b rhi: vulkan: Print vma statistics on out of device memory
Following a vmaCreate* it makes sense to test for
VK_ERROR_OUT_OF_DEVICE_MEMORY and print the allocator statistics
in order to give an idea of the application's (video) memory
usage.

For instance when running on a Raspberry Pi 4, this helps to indicate
that the application is just too big for the device, and is more
informative then just a Failed to create image: -2 message.

Pick-to: 6.6 6.5
Change-Id: I666e2358303894efab9d12d2b3a3d98f0bd3a5b6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
2023-09-26 14:36:31 +02:00
Joerg Bornemann
266c2d23ae CMake: Store info about the debug build in QtDeploySupport.cmake
Application deployment must know whether the Qt installation is a
debug_and_release build - or more generally, a multi-config build with a
debug configuration. Store the following information in
QtDeploySupport.cmake that's read at installation time:
- whether Qt was built multi-config with a debug configuration
- the postfix for debug libraries

Task-number: QTBUG-109444
Pick-to: 6.5 6.6
Change-Id: I96a2120ba1a2b03125661cc829498653e37dfb0f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-26 12:12:51 +02:00
Tasuku Suzuki
4abd6172f5 QSignalMapper: Fix compile error in snippets
Change-Id: I676cf8e120aedddc2565d2b08dae3f5ec612c1ec
Pick-to: 6.6
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-09-26 05:40:06 +00:00
Paul Wicking
e2bdf3a535 Doc: Fix typo
Pick-to: 6.6 6.5
Fixes: QTBUG-117482
Change-Id: I033b5bda78482a7b43fac365d5a781bc3fa27fad
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-25 22:34:45 +02:00
Giuseppe D'Angelo
89b6ad3ab5 QWeakPointer: fix the converting constructor from rvalues
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>,
even if X* is convertible to T*, actually doing the conversion
requires access to the pointee's vtable in case of virtual inheritance.

For instance:

  class Base { virtual ~Base(); };
  class Derived : public virtual Base {};

Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is
implicit (it's a public base), but the compiler needs to dereference
`ptr` to find out where the Base sub-object is.

This access to the pointee requires protection, because by the time we
attempt the cast the pointee may have already been destroyed, or it's
being destroyed by another thread. Do that by going through a shared
pointer. (This matches the existing code for the converting assignment.)

This requires changing the private assign() method, used by QPointer, to
avoid going through a converting move assignment/construction, because
one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer.
Given it's the caller's responsibility to guard the lifetime of the
pointee passed into assign(), I can simply build a QWeakPointer<T> and
use ordinary (i.e. non-converting) move assignment instead.

Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1
Pick-to: 6.5 6.6
Fixes: QTBUG-117483
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-25 21:50:07 +02:00
Christian Ehrlicher
230ff021a1 ItemViews/css: Honor size for sort indicator only when there is one
When using css the size for the sort indicator is not honored correctly
and therefore the header view text overlaps the sort inidcator.
This patch reduces the available with for the text when (and only when)
there is a sort indicator shown), also for the size hint.

Fixes: QTBUG-115486
Pick-to: 6.6 6.5
Change-Id: Ic865bceaf98cd303490d821ecfb033abb8d6ba2a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-25 18:34:46 +00:00
Christian Ehrlicher
ab5d3a2958 QDataStream: Documentation fix
Fix the code snippets to match the Qt coding style.

Change-Id: Id65d2253e620d217fa3ada7b82e28f4939336543
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-25 19:20:42 +02:00
Ilya Fedin
7a8b403bd3 QNI: glib support for the isMetered API
Task-number: QTBUG-91024
Pick-to: 6.6
Change-Id: Ieb46b87dde58a65a108f215c9c30695c02a51982
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 21:20:41 +04:00
Anton Kudryavtsev
bbace99e94 QHttp2ProtocolHandler: reduce allocations
Don't use QMap for parsing. Indroduce local enum and use it with std::array

Change-Id: I60fed6991ac415e4ff3827ae621f2c9b5071dcbe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-25 20:06:39 +03:00
Liang Qi
58215288f4 xcb: replace a warning with debug info
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I850297ad34edaf5dd66f56f549325745f2f5a07f
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-25 18:27:07 +02:00
Ahmad Samir
357a07069d QConcatenateTablesProxyModel: store connections in a container
Reuse the existing QList container, but instead of holding
QAbstrictItemModel* now it holds a
struct{model,std::array<Connections>}.

Use std::array since the number of connections is known at compile time.

Drop the _q_ prefix from method names, it was used to mark them as being
used in Q_PRIVATE_SLOT().

This is similar to c609b8dba0, so a
similar performance improvement is expected.

Drive-by change, fix narrowing by using qsizetype instead of int in
a for-loop.

Change-Id: Iac70dcbff0a949c72daa6dae52e3f752c2ee0557
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-25 18:51:47 +03:00
Anton Kudryavtsev
b2dd879f0a qppmhandler: avoid implicit detach
by const method usage

Change-Id: If8e4d0c543837917d29361a116b955890b8a279f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
ea6c037435 qprintengine_mac: use const methods more
to avoid implicit detach

Change-Id: I033a5083e259c3c90b061c28b3e1b76e2f2cd33f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
b86b415337 qtexthtmlparser: use tokenize instead of split
to avoid needless tmp list

Change-Id: I5f6bc9c3edd17c04e5293feb0aad86cd5ed49695
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
7cccbae61f qnetworkreplyhttpimpl: use QBAV more
Change-Id: Ieee68c06962da7c12af2b4145495b3d5ba5a02fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 14:17:56 +00:00
Anton Kudryavtsev
0b512d7f41 QHttp2ProtocolHandler: extract method
for making url to improve readability

Change-Id: I743f183b64f2ed9c9363ea4fd2bdb8588fd84547
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:56 +03:00
Anton Kudryavtsev
cfa36a52ab qctflib: deduplicate literals and use SV more
Change-Id: I98676fab9033392fd30e8e4ab5c09af9525628b8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:56 +03:00
Anton Kudryavtsev
dcda1abf70 Tidy up qmimedata
- use range based for more
- replace QSL with _s

Change-Id: I81b41d674e5976a62a52955abdb55c1f208a90cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-25 17:17:56 +03:00
Doris Verria
faae3dc6b1 QAbstractItemDelegate: Update spinbox editor value before committing
QAbstractItemView installs the delegate as an event filter on the
editor, so the delegate will get the focusOut event (and other
events) before the editor does. QAbstractItemDelegate will then
emit commitData, signaling that the "updated" data should be
written back to the model.
In the case where the editor of a delegate (QAbstractItemDelegate)
is a QSpinBox with keyboardTracking set to false, the value of
the spinbox won't be updated while typing, but only when the
spinbox's text edit focus is lost. In this case, the delegate's
commitData will be emitted before the spinbox has had a chance
to update the value in its handling of the focusOut event.
To fix, make sure to update the value before the data is
committed to the model in the delegate's tryFixup method.

Fixes: QTBUG-116926
Pick-to: 6.5 6.6
Change-Id: I68540964342407d23387e4404a0fe3f00d80eb5f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
66be69139c vkkhrdisplay: Fix output selection
While this platform plugin does not have full multi-screen support,
it at least has the ability to choose the one to use via env.vars.

This currently does not work. What's more, it looks like it chooses
the last display by default, instead of the first.

Fix the display/display-mode logic. This now allows QT_VK_DISPLAY_INDEX
to work correctly, for example on a RPi4 with two screens connected.

Fixes: QTBUG-117416
Change-Id: Ia5ac8fde5827b3a2e1945e8e4f04fb8dd90704e2
Pick-to: 6.6 6.5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
9cad3fcc97 kms: Print the screen virtual position in the logs
It is impossible to see otherwise what is going on.
What's worse, it prints the screen geometry (that does not
include the virtual desktop adjustment), which is incredibly
confusing.

Change-Id: Ie67a4d8110a0b5c9cb75e6290f06c857a980d2c8
Pick-to: 6.6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
8a5a5f6c97 vulkan: Do not set the portability bit with old SDKs
Because it's a validation error with old ones, but required
in some cases from 1.3.216 on (MoltenVK). Ridiculous.

Amends 7fbc741d10 and
b018bc6e2d.

Fixes: QTBUG-117412
Pick-to: 6.6 6.5
Change-Id: I9b4cacbe611d4e557ee1c156527142eb919d6b77
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-25 09:15:37 +00:00
Volker Hilsheimer
6ca2008d6e QFile::moveToTrash: fix error reporting on Windows
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.

MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.

If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.

Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.

Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-24 14:10:56 -07:00
Thiago Macieira
36a169e31e moveToTrash/Unix: use lstat() to confirm $root/.Trash is suitable
We can't use QFileSystemEngine::fillMetaData() because there's no bit in
QFileSystemMetaData to indicate the sticky flag, so we must make a at
least one stat() or lstat() call ourselves. Given that we need to know
if $root/.Trash is a symlink, that system call must be lstat(). And it
turns out that system call provides everything we need to confirm its
suitability.

This avoids QDir overhead just to manipulate strings.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c5e54199ecb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 16:16:09 -07:00
Giuseppe D'Angelo
6c504f2519 QPointer: also provide a converting assignment operator
d026fad3d9 added converting constructors
for QPointer. This however made converting _assignments_ ambiguous,
introducing a regression for users coming from Qt < 6.6.

This code:

  QPointer<Base> base;
  QPointer<Derived> derived;
  base = derived;

used to convert `derived` to `Derived *` (using the implicit conversion
operator from `QPointer<Derived>` to `Derived *`), and then the
assignment operator for `QPointer<Base>` that took a `Base *`.

The introduction of the conversion constructor in 6.6 makes it possible
to convert `QPointer<Derived>` to `QPointer<Base>`, and then fall back
to the compiler-generated assignment operator for `QPointer<Base>`.

The result is that the code above is now ambiguous and stops compiling.

Fix this by adding a converting assignment operator for QPointer.
I'm only adding the const-lvalue overload because the implementation
requires going through the private QWeakPointer::assign helper. We
cannot copy-assign or move-assign the inner QWeakPointer, as those
assignments require lock()ing the QWeakPointer and that's not possible
on a QObject-tracking QWeakPointer (but cf. QTBUG-117483).

Assigning from a rvalue QPointer would mean calling assign() on
the internal QWeakPointer _and_ clear the incoming QPointer,
and that's strictly worse than the lvalue overload (where we just call
assign()).

Change-Id: I33fb2a22b3d5110284d78e3d7c6cc79a5b73b67b
Pick-to: 6.6 6.6.0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-23 22:10:10 +00:00
Ahmad Samir
3bac473364 QItemSelectionModel: remove some redundant code
QObject::disconnect(connection) already sets connection.d_ptr to
nullptr, and the default constructor only does that:
QMetaObject::Connection::Connection() : d_ptr(nullptr) {}

So calling disconnect() suffices in this case.

Pick-to: 6.6 6.5 6.2
Change-Id: Icd5f9a15c83939eeecd9efb474ac3b38c0f2dfe4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-23 23:52:28 +03:00
Assam Boudjelthia
b74f180ac0 Android: bump Android target API level to 33
To follow latest Play Store requirement.

Pick-to: 6.6.0 6.6 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-09-23 17:38:23 +00:00
Thiago Macieira
3d027f8d95 moveToTrash/Unix: remove unnecessary targetPath variable
It was used twice, in both cases to create a QFileSystemEntry, so the
two results were equal. Therefore, just use the first result to create
the second.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d45d20485f40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:31 -07:00
Thiago Macieira
6434b6ea48 moveToTrash/Unix: rename 'infoPath' variable to 'pathForInfo'
We have other variables whose name start with 'info' in this function,
so infoPath is misleading: it's not the path to infoFile and it isn't
related to the infoFileName. Instead, it's the path to the file being
trashed which will be saved in the info file.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d358a0e02dfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:30 -07:00
Thiago Macieira
6e4d9ff74d moveToTrash/Unix: use Qt::ISODate to format the current date
Instead of forcing QDateTime to parse our pattern.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d094a123826a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:23 -07:00
Thiago Macieira
a71f556830 moveToTrash/Unix: avoid mkdir/chmod race condition for the trash dir
QDir::mkdir() followed by QFile::setPermissions() is a race condition
because an attacker could enter the directory before we set the
permissions. QDir::mkdir() got an overload with the permissions in 6.3,
but I decided to go a level lower and use QFileSystemEngine directly
here.

Pick-to: 6.5 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c338e21c129e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:22 -07:00
Tor Arne Vestbø
201045a1fd Remove remnants of Qt for Native Client (NACL)
The project has been superseded by Qt for WebAssembly and was
never supported in Qt 6.

Pick-to: 6.6 6.5
Change-Id: I36682cfe3ce6adac76a307b0faba97dcb7c655cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-23 13:40:44 +02:00
Volker Hilsheimer
941f49b018 JNI: treat enums as their underlying types
Android APIs use integer constants like enum values, so they are mapped
to one of the integeral types (jint, jshort, jlong etc) on the C++ side.
Enable C++ code to declare an equivalent enum (scoped or unscoped), and
to use that enum as a type in JNI calls by treating it as the underlying
type in the signature() generator.

Add a helper type trait that maps enums to their underlying type and
other integral types to themselves (we can't use std::underlying_type_t
on a non-enum type). Add tests.

Note: Java Enums are special classes with fields; this change does not
add any special support for those.

Change-Id: Iec430a1553152dcf7a24209aaebbeceb1c6e38a8
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-23 07:24:26 +02:00
Tor Arne Vestbø
9965630aaf lldb: Look up Qt Creator version via Info.plist instead of mdls
For some reason mdls fails to resolve the kMDItemVersion for Qt
Creator in some cases, even if the Info.plist has the required
version keys, and the version shows up fine in Finder.

Work around it by manually reading the version from the Info.plist

Fixes: QTBUG-117204
Change-Id: I60d57fb728608e139a4540fabf1006fc2681d0a7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-23 03:38:53 +02:00
Tor Arne Vestbø
fe3e0fc657 lldb: Improve reporting when loading summary providers
If loading the lldbbrige fails, we'll continue on to the next
Qt Creator version if we find one. It makes more sense to report
that we're about to load from a given version, so that any error
messages from lldbbridge are output with that context in place.

Change-Id: Icbab6f7d39333ce76d729fd0769cfdb44f05a2f0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-23 03:38:52 +02:00
Tor Arne Vestbø
e0eb2818fa Avoid extending dirty region in beginPaint
When the raster window is resized, we need to resize the backingstore,
and make sure we repaint the entire window. We defer the backingstore
resize to beginPaint, in case multiple resize events come in before
we have a chance to paint, but we can't defer the invalidation of the
paint device window, because QPaintDeviceWindowPrivate::paint() has
already subtracted the paint region from its dirty region at this
point. Invalidating yet again will result in the dirty region of
window not clearing fully until after the final resize, and when
that happens we will also repaint the window with the wrong dirty
region, based on the window's original size.

My moving the window invalidation to the resize event, while keeping
the deferred backingstore resize we avoid this problem.

Pick-to: 6.5 6.6
Change-Id: I44662778f5b1bcd259b20ca86124e6487561ef4f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-09-22 23:47:41 +02:00
Tor Arne Vestbø
953e7eece8 QKeyMapper: Remove indirection via QKeyMapperPrivate for possibleKeys
Change-Id: I1988ac60689b3e6f4b29e38d1167d2b998702c09
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-22 23:47:39 +02:00
Tor Arne Vestbø
96e762e5a4 QKeyMapper: Merge default implementation of possibleKeys into call site
Task-number: QTBUG-116873
Change-Id: I9091f4a9d465fb928afcabce0536fcd2d03b7f82
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-09-22 23:47:39 +02:00
Ahmad Samir
f58df04196 QConcatenateTablesProxyModel: simplify code
If there is a reason to static_cast to `const QAIM*` then cast away the
const, I failed to see it. QObject::sender() returns a non-co.

Change-Id: Ibf8c8613c3de1584b426269c1ffba94db75d26d6
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-22 22:49:35 +03:00
Ievgenii Meshcheriakov
24e504d9df QDBusConnectionPrivate: Fix race in sendWithReply()
The message processing may finish before watcherHelper is
setup. Use locking and an additional check for message
processing completion to avoid the race condition.

Move the code to new function inside QDBusPendingCallPrivate,
close to where the waiting without GUI is done.

Add assertions that check that watcherHelper is not overwritten.

Change-Id: I24e54598135edf293c41b3a80369b0a3b46f775c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-22 21:02:45 +02:00
Leena Miettinen
406f676843 Doc: Edit docs for QtCore QT_I18N_ CMake variables added in Qt 6.7
- Fix punctuation and link errors.
- Make wording more consistent.

Change-Id: I5954a5c3129fdaf524918b2f1c60cc510374c505
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-22 21:02:45 +02:00
Tor Arne Vestbø
a0792da126 xcb: Work around GCC ABI issue causing warning on ARM
In member function ‘virtual QDpi QXcbScreen::logicalBaseDpi() const’:
 qxcbscreen.h:139:42: note: parameter passing for argument of type
 ‘std::pair<double, double>’ when C++17 is enabled changed to match C++14 in GCC 10.1
     QDpi logicalBaseDpi() const override { return QDpi(96, 96); }

It's not possible to silence this warning/note using pragmas.

Pick-to: 6.6 6.5 6.2
Change-Id: I913a1753ce0c82ac17951faa58b0a88bf1daa4db
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-22 20:08:05 +02:00
Morten Sørvig
0e23865c9e wasm: Improve screen cleanup
Fix the use case where the application recreates the
QApplication object while reusing the html container
element. This would cause an error:

  Uncaught DOMException: Failed to execute 'attachShadow' on
  'Element': Shadow root cannot be created on a host which
  already hosts a shadow tree

It looks like there is no way to remove a previously
attached shadow root, which means we can't return the
container element to its initial state if we attach
to the user-provided container element.

Fix this by introducing an intermediate element which
we can remove() in the QWasmScreen destructor.

Pick-to: 6.6 6.5
Change-Id: I929393a498b0440390a3e2c1774a3cac3a5a7e79
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-09-22 16:51:43 +00:00
Leena Miettinen
201c30986b Doc: Edit CMake Qt6 Core variable docs
Edit the docs for style and consistency.

Pick-to: 6.6.0 6.6 6.5
Change-Id: I24fb7f8b833ae7e5adaca31811bd171d892c5907
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-22 17:44:27 +02:00
Kai Köhne
868b721246 Remove unused snippets/rsslisting files
The snippets from the files were used in the QXmlDefaultHandler
documentation that got moved to qt5compat in Qt 6 (commit
79e0374143).

Change-Id: I11f19c8b2c5f693e203925bd2b19cff8d3380580
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-22 15:44:27 +00:00
Alexey Edelev
bfe62b0224 Remove framework-related functionality from syncqt
The files generated by syncqt should land not only in module include
directory, but also in framework directory. Before syncqt made two
copies of the generated files one in staging directory and the second
one in module framework directory. This commit moves all logic related
to framework header files to cmake scripts. This is done for both
consistency and simlifying the logic. The whole module .syncqt_staging
directory is copying to the framework library in cmake.

[ChangeLog][Tools][syncqt] '-framework' and '-frameworkIncludeDir'
arguments were removed. The related logic is moved to cmake scripts.

Task-number: QTBUG-116483
Pick-to: 6.6 6.5
Change-Id: If79c5470d2ab51eb7fc083bce6fb01858bed76ba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-22 17:44:27 +02:00
Marc Mutz
aa19704bbc Un-deprecate qSwap()
It seems to have fallen prey to the mass-deprecation of <QtAlgorithms>
in Qt 5.2. Since it didn't actually duplicate STL functionality, that
was uncalled-for: Unlike std::swap(), it's ADL-enabled, so the docs
were wrong to suggest replacing it with std::swap instead.

In fact, the tony-table that 5957f245c6
added to qalgorithms.qdoc didn't include qSwap(), yet, qSwap() was
marked as deprecated.

Un-deprecate and expand the discussion to more faithfully represent
its value, without going into the depths of teaching how to swap
correctly in C++ (link to boost.org and cppreference.com for that
instead).

Remove the example that used qSwap() on doubles, which is precisely
_not_ how you should use it.

Amends 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6(!).

[ChangeLog][QtCore] Un-deprecated qSwap().

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I4981005ba71b0d1824f2a46897145255fa66a7ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-09-22 15:54:31 +02:00
Kai Köhne
ec32748b1e Doc: Fix location of QT_REQUIRE_VERSION documentation
<QMessageBox> is not a (separately documented) header. QDoc
therefore puts the documentation on a separate proxy page:

https://doc.qt.io/qt-6/qmessagebox-proxy.html

Fix this by actually linking to the type.

This amends  95a3f85a2f, which moved the macro from
QtGlobal to QMessageBox.

Pick-to: 6.5 6.6
Change-Id: Ia2ed3d9fd786732c85d731634ff79afefe42333b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-22 09:24:16 +00:00
Volker Hilsheimer
cf0bd543d6 QJniObject: add callStaticMethod overload that takes class as type
Equivalent to get/setStaticField.

Add a test, and tighten up the surrounding test code a bit.

Change-Id: Ic0993c5d6223f4de271cb01baf727459b5167f94
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-22 07:18:21 +02:00
Volker Hilsheimer
e1a349983c JNI: move signature/className template functions into a template class
Template functions don't permit partial specialization, e.g. we cannot
specialize typeSignature() to return an array signature for any
std::vector or QList type. We need to do that for better array support,
so move those functions as static members into a template class, which
then can be specialized.

Since submodules are both calling and specializing typeSignature and
className as template functions, keep and use those until the porting is
complete.

Change-Id: I74ec957fc41f78046cd9d0f803d8cc9d1e56672b
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-22 07:18:16 +02:00
Volker Hilsheimer
0022b05a9a JNI: rename our compile-time String type to CTString
The type lives in the QtJniTypes namespace, which is where types end up
that are declared through the Q_DECLARE_JNI_CLASS/TYPE macros. Having a
String type in that namespace prevents us from declaring the Java String
class as a QtJniTypes type, which is silly.

Perhaps this type becomes obsolete at some point with std::string being
a constexpr type in C++23, but until then we need it. It has no ABI, so
renaming it us safe.

Until submodules are ported, leave a compatibility alias String type,
which also prevents us from declaring a String JNI class in tests until
the alias is removed in a later commit.

Change-Id: I489a40a9b9e94e6495cf54548238438e9220d5c1
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2023-09-22 07:18:10 +02:00
Volker Hilsheimer
dc126de22e QItemSelectionModel: don't warn when destroying the model
Amends 4f4a8e75ab, after which
QItemSelectionModel printed a warning when destroying the model.
We reset the selection model in response to the model getting destroyed,
and since the model is already set to be nullptr at this point the
select() function complains about changing the selection with no model
set being a no-op.

Fix this by not calling reset() when the model gets destroyed - the
stored selection and currentIndex are already reset at this point -
and instead only call reset() when a new model is set in initModel.

Fixes: QTBUG-117200
Pick-to: 6.6.0 6.6 6.5 6.2
Change-Id: I12fc6b3fb2f2ff2a34b46988d5f58151123f9976
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-09-22 01:42:45 +02:00
Aleix Pol
52a5a89ea4 QCommandLineParser: Warn invalid value calls
If the QCommandLineOption doesn't have a valueName, the parser won't
read the argument, therefore returning an empty value. If the developers
are calling ::value on the option, they clearly think it's expected to
get a value but won't ever be getting one, so we better warn them about
it.

Change-Id: I434b94c0b817b5d9d137c17f32b92af363f93eb8
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-21 22:05:06 +02:00
Marc Mutz
64c50224b9 Port qSwap()'s exception detection to C++17 std::is_nothrow_swappable
It's been available since C++17, and since we compile the trait
anyway, using it will probably speed up instantiation of qSwap()
(didn't test, just guesstimating).

Change-Id: If77ca71a8021a73edf4864bdd9e5fce517dcabb1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-09-21 22:05:06 +02:00
Marc Mutz
9d70118c66 qswap.h: include what you need
The qSwap() function needs std::swap, so include <utility> manually
instead of relying on transitive includes.

Pick-to: 6.6 6.5
Change-Id: If1331e1eabb55542eac7477522a8e906efb5379f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-09-21 22:05:05 +02:00
Marc Mutz
0bd3e28b17 qswap.h: use a more robust include guard
Just "QSWAP_H" is a bit meager to be unique. We don't really have a
monopoly on q-prefixed function and header names, there's the C std
function qsort(), e.g...

So use a somewhat more unique name as header guard.

Pick-to: 6.6 6.5
Change-Id: I554fa224afcb6858b752e8044ef3c03dfc69c084
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-09-21 22:05:05 +02:00
Marc Mutz
88a109bede qswap.h: remove stale comment
It's now documented in qswap.qdoc.

Amends 9c706e2567.

Pick-to: 6.6 6.5
Change-Id: If6138df419dee165e9f1de4c0a0d68af1dcfaa42
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-09-21 22:05:05 +02:00
Kai Köhne
5bfac5358a Doc: Improve documentation for QMetaEnum::metaType()
Rephrase hard-to-read sentence.

Replace 'integral type;  with 'numeric type', as this seems
to be the terminology in the standard:

  The type-specifier-seq of an enum-base shall name an integral type

Finally, no need to use \sa for a method that is mentioned right before.

Pick-to: 6.6
Change-Id: I543041e78cc09ccd58182db454880941592c74ae
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-09-21 21:29:21 +02:00
Alexandru Croitor
db17465d37 Fix reported QtCore copyright year
Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-101162
Change-Id: I09df1e19d353ab93fb0042b2fa9a68c89d8a5399
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-21 19:28:43 +02:00
Tatiana Borisova
b856790d67 Add Q_ENUM macros for registering QSsl/QSslSocket in Meta-system
- Macros provide possibility to use enums in QML via QtNetwork QML module

Task-number: QTBUG-115056
Change-Id: I1ed96a7eb4b12681d16137528307fec6db5b016c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-21 19:28:43 +02:00
Morten Sørvig
8bfdfd613e wasm: include qunixnativeinterface.cpp in build
Fix shared libraries build error:
  undefined symbol: _ZN16QNativeInterface7Private14QWaylandWindowD0Ev

We are declaring QWaylandWindow for all Q_OS_UNIX in
qplatformwindow_p.h, and must include the definition
as well.

Change-Id: I630538af475524659e9a476171994e600f2ec668
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-21 19:28:42 +02:00
Volker Hilsheimer
6c90aa029b QDockWidget: ignore close event if DockWidgetClosable is not set
[ChangeLog][QtWidgets][QDockWidget] A floating dockwidget that doesn't
have the DockWidgetClosable feature flag set can no longer be closed by
a call to QWidget::close or a corresponding keyboard shortcut (such as
Alt+F4).

Fixes: QTBUG-116752
Pick-to: 6.6 6.5
Change-Id: I7859a2eed11f0e4ee013f7f56611e282e9bcae9a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-21 18:36:06 +02:00
Joerg Bornemann
ff6eca0087 CMake: Add I18N_NATIVE_LANGUAGE keyword to qt_standard_project_setup
[ChangeLog][CMake] Added variable QT_I18N_NATIVE_LANGUAGE to specify the
native language that is used in the source code for translatable
strings.

[ChangeLog][CMake] Added keyword I18N_NATIVE_LANGUAGE to
qt_standard_project_setup to conveniently set QT_I18N_NATIVE_LANGUAGE.

Task-number: QTBUG-115845
Change-Id: I079256507685afe5eccda78beffff819292494bf
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-21 17:00:22 +02:00
Andreas Holzammer
86eb1f4413 eglfs: Extend GBM surface creation probing
Some graphics drivers do only create a surface with the help of
gbm_surface_create_with_modifiers and others do require to use
gbm_surface_create. So it is needed to probe these.

Change-Id: I9ea657f12f2ea23ec426a378cfd67e297cb2d310
Pick-to: 6.5 6.6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-09-21 08:58:09 +02:00
Tor Arne Vestbø
0bfb25d178 Remove QShortcutMap::matches() and use QKeySequence::matches() instead
The custom matching function was added in 4d4857027db3 with the rationale
that people were mixing up Key_hyphen and Key_Minus all the time, and
tried to solve it by treating the two as one and the same in the match
function.

Unfortunately this doesn't work in practice, as when a keyboard event
comes in we resolve a set of possible key sequences from that, and then
look those up in the list of sorted shortcut sequences. That lookup
is just a binary search, and does not take into account the added
logic of the custom matching function. So the binary search will fail
to find the matching key sequence, and as a result we never get a chance
to call matches() with a potentially malleable key sequence (for example
Qt::Key_Minus when the shortcut is Qt::Key_hyphen or vice versa).

The only case we do hit the matches function is if we by chance happen
to land the binary search iterator on the "unmatched" shortcut, e.g.
Qt::Key_hyphen, but this relies on there not being any other shortcuts
that sort between Qt::Key_Minus and Qt::Key_hyphen.

Task-number: QTBUG-116873
Change-Id: Iaa90991911f32276e29e37e8c7ae87643898bfc9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-21 00:46:24 +02:00
Tor Arne Vestbø
709c93083e QShortcutMap: Rename variables to clarify their use
The state machinery of QShortcutMap is complicated enough as it is,
so let's use better variable names. In particular, let's distinguish
the registered shortcuts (QShortcutEntries), from the candidate
QKeySequence sequences that we compute based on the incoming events.

Task-number: QTBUG-116873
Change-Id: I9bd59097e786ecfb9d241c2eb7b871a4bba9b44f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-21 00:46:24 +02:00
Michael Weghorn
2496882ea7 a11y: No longer mark QAccessibleSelectionInterface as preliminary
Since the interface was introduced as \preliminary in commit
9d16d5e224, everything mentioned
as required to make it a publicly documented interface has been
implemented:

1. An a11y bridge for macOS/VoiceOver was implemented in
   98e4e992fe
2. An a11y bridge for Windows/UI Automation was implemented in
   4f9c66131d
3. An a11y bridge for linux/AT-SPI was implemented in
   ece2feee03
4. QAccessibletable implements the interface
   (see 092bbc9ad3) and
   an implementation in QAccessibleTabBar is pending in
   Gerrit

[ChangeLog][QtGui][QAccessibleSelectionInterface] The
QAccessibleSelectionInterface that was added as preliminary in Qt 6.5
is no longer preliminary. Exposing selection to assistive technology
can be achieved by implementing this interface.

Change-Id: Ic6fbc67ada32122da58ce94fa0581a27ecb2ac48
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-20 23:18:31 +02:00
Marc Mutz
dee68587d5 Update public suffix list
Version 1a4824549b093abc3077205ae5386ed57f73806d, fetched on
2023-09-20.

Pick-to: 6.6 6.6.0 6.5 6.5.3 6.2 5.15
Fixes: QTBUG-117138
Change-Id: If288d7fce714384a0132261303de31ad2299c239
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-09-20 22:33:18 +02:00
Eskil Abrahamsen Blomfeldt
5469d6a6cc Support loading variable fonts as application fonts in Freetype
When loading the fonts, we go through all the named instances
and register these as subfamilies. In addition to exposing these
variants by style name, we also register them with the according
weights, italic style and stretch. This adds a field to FontFile
to allow piping the instance index through to when we instantiate
the face.

[ChangeLog][Fonts] Added support for selecting named instances in
variable application fonts when using the Freetype backend.

Task-number: QTBUG-108624
Change-Id: I57ef6b4802756dd408c3aae1f8a6c792a89bee6a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-20 21:37:50 +02:00
Tor Arne Vestbø
3aff1e1678 QShortcutMap::find: Use plain for-loop instead of do-while
The logic was a bit convoluted, using a do-while loop when the
base premise still was that we needed a valid iterator, and
hiding the check of a QKeySequence::NoMatch to break out of
the loop far from the match() that produced it.

The tempRes (now match) variable no longer has to live outside
the loop, and the oneKSResult variable has been renamed to
clarify its use.

Task-number: QTBUG-116873
Change-Id: I730e768eae2e9a653bf4e28ceece2fe7277ef45d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2023-09-20 21:20:14 +02:00
Tor Arne Vestbø
e2738ca949 Improve QShortcutMap debug logging
Task-number: QTBUG-116873
Change-Id: I6a2b8c25d3da8c9cbcaeb0979b4be85267ba7856
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2023-09-20 21:20:13 +02:00
Allan Sandfeld Jensen
baac34de6f Switch QRgbaFloat api to hardcoded float parameter and return values
This makes it source compatible with Qt 6.5 by allowing us to change
FastType to something other than float, which we have done for Qt 6.6 on
systems with AVX float16 instructions.

Pick-to: 6.6 6.6.0
Change-Id: I7ebf0c178ba0ff7f04f6788d182a1a000fe31c0c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-20 19:20:13 +00:00
Marc Mutz
5c8910adfd moc: make qHash(SubArray) accept a seed
This prevents the use of the one-arg-to-two-arg adapter template which
we'd remove rather sooner than later, because it's causing all sorts of
problems, but probably can't, until Qt 7.

Pick-to: 6.6
Task-number: QTBUG-116074
Change-Id: I5907da0dc8c01b636d16dcc01e9c808ab9a85081
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-20 20:36:32 +02:00
Topi Reinio
fedb1f5b76 Doc: Document QtTypeTraits header
There were multiple documented functions with \relates <QtTypeTraits>,
but the header file itself was not documented. QDoc still created a
proxy page for the header, but the information on it was incomplete;
for example, deprecated functions were omitted.

Pick-to: 6.5 6.6
Fixes: QTBUG-116349
Change-Id: Ic4334a43f72bb8a358cee7537a282495e4a046c6
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-20 15:53:15 +00:00
Øystein Heskestad
13f673939d Fix renamed and duplicated namespaces in QXmlStreamWriter
The XML stream writer previously added namespace declarations with the
same URL as existing ones, but new names, and renamed the XML elements
to use the new namespaces instead of the existing ones.

[ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter.

Pick-to: 6.5 6.6
Fixes: QTBUG-75456
Change-Id: I90706e067ac9991e9e6cd79ccb2373e4c6210b7b
Done-With: Philip Allgaier <philip.allgaier@bpcompass.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-20 17:16:29 +02:00
Giuseppe D'Angelo
9d029939fb qobject_cast: add a couple of static_asserts
... for better error reporting.

Change-Id: I11afdef41f729b4357b743a3238c1f055a1d35d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-20 17:16:29 +02:00
Volker Hilsheimer
1d89f6602a JNI: Don't explicitly specify deducible template arguments
Minor cleanup that enables us to change the actual type in some of the
wrapper functions, so that we can implicitly convert a QString to a
jstring.

Change-Id: I2acc99c656231b302269fae439cf3dd49278f09a
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-20 17:16:28 +02:00
Volker Hilsheimer
d2f950e88f JNI: fix isObjectType trait function
Java arrays are always objects, also if they don't contain objects.

Pick-to: 6.6
Change-Id: I376c9cc39445d7d9aaac093e4cd6995c8322ed0d
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-20 17:16:28 +02:00
Volker Hilsheimer
1de8cb8f91 JNI: move JNI type macros into separate header
This removes the dependency from QJniObject to QtJniTypes, and allows us
to add more useful helpers to types declared through the macros, as we
can rely on QJniObject being fully declared.

Note: this is all undocumented API, so fine to change even though it
currently lives in a public header.

Change-Id: I07478ecb80ae166d619a09aed6820f680afed31b
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-20 17:16:28 +02:00
Volker Hilsheimer
7a27609d73 JNI: replace static_assert mandates with enable_if constraints
A function not being available if the parameter list doesn't meet the
requirements results in much better error messages than a function not
compiling (somewhere deep in the call tree, potentially) because of it.

Change-Id: If2c320736083a385232cc72f608bc4d61025627c
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-20 17:16:28 +02:00
Giuseppe D'Angelo
4a6cbfbe5c QVariant: add fromMetaType
The QVariant(QMetaType) constructor is a major anti-pattern: unlike
*every* other QVariant's constructor, it doesn't build a QVariant
holding the QMetaType object, but a QVariant of the specified type.

Introduce a named constructor for this use case instead.

In principle, this should lead to a deprecation of the QMetaType
constructor... except that it's used everywhere, so I can't do it at
this time.

Drive-by, improve the documentation of the QVariant(QMetaType)
constructor (since it's basically c&p for the new fromMetaType
function).

[ChangeLog][QtCore][QVariant] Added the QVariant::fromMetaType named
constructor, that builds a QVariant of a given QMetaType.

Change-Id: I4a499526bd0fe98eed0c1a3e91bcfc21efa9e352
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-20 00:05:53 +02:00
Marc Mutz
41824a02cb QStaticLatin1StringMatcher: fix typo in static_assert
The class name was wrong.

Task-number: QTBUG-100236
Change-Id: I0ffd163bf59682d8326feefb76a4cd8b7e106105
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-20 00:05:53 +02:00
Volker Hilsheimer
7f4cdb9941 JNI: replace TYPE declarations with CLASS declarations
That we have two macros to declare a C++ type to represent a Java class
is confusing. The TYPE macro as of now allows us to declare array types,
but with QJniArray we won't need that anymore, and can just use Class[]
as the type instead. Changing that will be a follow-up commit; for now,
get rid of TYPE-usages to declare regular classes.

Change-Id: Iea0a9548772ca701148442412cf6ad567583213f
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-09-20 00:05:39 +02:00
Volker Hilsheimer
ece7b9430d JNI: Explicitly convert QtJniType instances to jobject for variadic arguments
When calling the (old and outdated) variadic argument overloads of
callMethod (as opposed to the variadic template overloads), then we
cannot pass complex types.

That types declared via the Q_DECLARE_JNI_CLASS macro are trivial was an
implementation detail that we shouldn't rely on as long as those types
are not part of the public API. Cast explicitly to jobject so that we
can make those types proper QJniObjects.

Updating this code to use the new variadic template overloads is for a
follow-up commit.

Change-Id: Ia9d610c84de6f989ef957c23401b1cbc64d2d1ef
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-09-20 00:05:39 +02:00
Volker Hilsheimer
9250481384 JNI: refactor code to use _v and _t helpers
As a drive-by, fix style by adding a whitespace after flow-control
keywords `if constexpr`.

Change-Id: I4e1153edc6f9ee903c7620772c12c411c33e90c6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2023-09-20 00:05:39 +02:00
Joerg Bornemann
fe182c1541 CMake: Add I18N_LANGUAGES keyword to qt_standard_project_setup
[ChangeLog][CMake] Added variable QT_I18N_LANGUAGES to specify the
languages that are used for i18n in the project.

[ChangeLog][CMake] Added keyword I18N_LANGUAGES to
qt_standard_project_setup to conveniently set QT_I18N_LANGUAGES.

The call
  qt_standard_project_setup(I18N_LANGUAGES hi ho)
sets the variable QT_I18N_LANGUAGES.

The target finalizers use this variable to set up CFBundleLocalizations
on Apple platforms.

qt_add_translations will be extended to read QT_I18N_LANGUAGES as well
to determine the names of .ts files if TS_FILES is not given.

Fixes: QTBUG-116716
Change-Id: I76f0753d10efb9c32947d9239e43382c9d85eb51
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-09-19 18:53:29 +02:00
Wladimir Leuschner
e5c136c179 Use correct parameters to query highcontrastmode on Windows
Task-number: QTBUG-113645
Change-Id: Ib400253a5589345648025c22c1487598cbefbd23
Pick-to: 6.6 6.5
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-09-19 18:24:56 +02:00
Laszlo Agocs
d656f7405e Backing store compositor: Use smart pointers for some QRhi resources
Pick-to: 6.6 6.5
Change-Id: I005b2efe23c7dda0b15d2156708055f3b96681fc
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-19 17:16:25 +02:00
Laszlo Agocs
54816a8f9a Sync rhi backingstore d3d12 behavior with Quick
When adding the D3D12 code path in widgets it seems it was ignored that
the retry-with-WARP logic was present both for D3D11 and 12 in Qt Quick.

For consistency, the same logic must be used. Right now widgets only has
the retry logic for D3D11.

Pick-to: 6.6
Change-Id: I08d5728acfb9a68db7e0a4b0477050f08546ffac
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-19 17:16:25 +02:00
Marc Mutz
0f19cafc3c [docs] Fix \since for qHash(qfloat16)
The patch adding the function unexpectedly made it into 6.5 before
6.5.3 was forked off. That's nice, as it reduces the number of
releases with a broken implementation, but the documentation and
ChangeLog were written assuming a merge for 6.5.4.

Fix the documentation.

Amends 6da6a17de9.

[ChangeLog][Editorial][QtCore] Delete the old entry for
qHash(qfloat16), keep the one from this commit.

[ChangeLog][QtCore] Fixed qHash(qfloat16) which was broken from 6.5.0
to 6.5.2, inclusive. If you compiled against one of the affected Qt
versions, you need to recompile against either Qt 6.4 or earlier or
6.5.3 or later, because the problematic code is inline.

Pick-to: 6.6 6.6.0 6.5 6.5.3
Task-number: QTBUG-116064
Task-number: QTBUG-116076
Change-Id: If8fa35fb8532cf0bbf2ba0438694d95fd9bd6991
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-19 15:03:46 +02:00