Commit Graph

64934 Commits (f355f4fe7ea36c6d2d3a67332a183c9fa7e61b7e)

Author SHA1 Message Date
Joerg Bornemann f355f4fe7e CMake: Add LIBEXEC_DIR argument to qt_deploy_runtime_dependencies
[ChangeLog][CMake] The qt_deploy_runtime_dependencies function gained
the LIBEXEC_DIR argument to set the directory for deploying helper
executables on Unix derivatives.

Pick-to: 6.7
Change-Id: Icf2b0b439a0e635caa4d9bd2f6950bec74f97c3b
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2023-12-18 21:55:14 +01:00
Joerg Bornemann 12b4085f45 CMake: Add QT_DEPLOY_LIBEXEC_DIR
[ChangeLog][CMake] Added the deployment variable QT_DEPLOY_LIBEXEC_DIR.

This variable can be used in CMake deployment scripts to install helper
binaries of a project. In particular, this directory is going to be used
for deploying the QtWebEngineProcess executable.

Pick-to: 6.7
Task-number: QTBUG-119077
Change-Id: Ia2502af696c53943ad13e3944c8debf2dfd8daee
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2023-12-18 21:55:14 +01:00
Joerg Bornemann 32940a8ea4 CMake: Prepare deployment of projects using QtWebEngine
Store the locations of INSTALL_DATA and INSTALL_LIBEXECS in
.qt/QtDeploySupport.cmake which is generated for every project.

This information will be used to locate the helper binary and resources
of QtWebEngine.

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-119077
Change-Id: I2fb6f9b31fd1dcd872365d020c8ac71db426fdec
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2023-12-18 21:55:14 +01:00
Alexander Volkov e0c435cbfe Don't search more generic icons in Applications and MimeTypes contexts
According to the specification
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#guidelines
1) "the dash “-” character is used to separate levels of specificity in
   icon names, for all contexts other than MimeTypes"
2) "the “Applications” context should not use this method of falling
   back to more generic icons"

Pick-to: 6.7 6.6
Change-Id: Ia3536141158a4b6c1c4f85db8ad890514cf19e84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-18 18:29:20 +00:00
Tero Heikkinen 8dffb3c5e3 Coin: Add native MSVC ARM64 instructions
Task-number: QTQAINFRA-5855
Pick-to: 6.7 6.6
Change-Id: I95a3b5f44c2513becb0bdbd5f56c0a5e36e889d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-12-18 20:00:44 +02:00
Kai Köhne 0bf7d64ebd Doc: Do not translate company and product names in footer
Pick-to: 6.6 6.7
Change-Id: Iccd4ca02f5474763591bf11a3887ccf4e38a32be
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-12-18 13:14:53 +00:00
Matthias Rauter 0da459ec5b Update icons in the torrent example
Fixes: QTBUG-118876
Change-Id: I7b3c24db220a0501bc2b99341589211bdf217c05
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-18 13:56:04 +01:00
Kai Köhne a659dcf031 Doc: Remove references to Qt 4 in Qt 5.0 in Qt Core documentation
Pick-to: 6.6 6.7
Change-Id: Ide0c1ed441c923753f1e81141460719161662c15
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-12-18 13:56:04 +01:00
Michael Weghorn 7120859fdb a11y: QComboBox: Reset all model connections when setting model
When setting the model either directly for the combobox
itself or for the combobox's view, disconnect from the model
signals and connect to them anew. Always set the model for the
view first before connecting the combobox's own slots to the model's
signals. Since slots are activated in the order in which they are
connected [1] and both of them are connected to the
QAbstractItemModel::rowsInserted signal, this ensures that the
QAbstractItemViewPrivate::rowsInserted/QListView::rowsInserted
slot will get activated before the QComboBoxPrivate::rowsInserted one.
(QAbstractItemView::setModel connects its slots to the model's signals.)

Activating these slots the other way around is problematic
as described in more detail in
ecef704624 and QTBUG-120121.
(macOS accessibility bridge depends on
QAbstractItemViewPrivate::rowsInserted to
update its table representation, which may be necessary
before activating other slots; ATs or platform a11y caches
may depend on correct event order.)

In a quick test, this commit fixes the QTBUG-119526 crash reliably
reproducible after 5093e517b9
even without the previous fix ecef704624
in place. However, leave that one in place, too, as
relying on the order in which the connected slots are called
is quite fragile (s. the discussion in the Gerrit change
for ecef704624).

[1] https://doc.qt.io/qt-6/qobject.html#connect

Fixes: QTBUG-120121
Task-number: QTBUG-119526
Pick-to: 6.7 6.6 6.5
Change-Id: If75fef661f7fcfc1e30e90ec851a2555cf25a65d
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-12-18 12:12:30 +01:00
Christian Ehrlicher 87f7d2c6b0 QPA/Windows: misc cleanup of QShGetFileInfoThread
Misc cleanup of QShGetFileInfoThread:
 - use QThread's interruption abilities instead custom one
 - use QMutexLocker instead manual lock/unlock

Task-number: QTBUG-90876
Change-Id: If0566e56ab765fb95e837cdfa09639c1622b6d4e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-12-18 11:15:22 +01:00
Timothée Keller 03a4164206 Windows QPA: don't override user-removed margins
When calculating margins, added a check to see if the window rect and
the client rect are the same size. If they are, we return early, to
avoid overwriting user-defined specific margins.

Fixes: QTBUG-117704
Pick-to: 6.7 6.6 6.5
Change-Id: I9947feab4cb900293fb6be6cf09c56268f38d64a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-12-18 06:51:42 +01:00
Alexandru Croitor 571201603a CMake: Deploy correct arch files when cross-compiling to arm Windows
When cross-compiling a user project from x86_64 to arm64 MSVC Windows
target, during deployment we need to deploy arm libraries.

By default because we use an x86_64 windeployqt, it always deploys
x86_64 libraries.

Make sure to pass the path to the target WoA qtpaths.bat file to
windeployqt, so it deploys arm libraries.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-119619
Change-Id: Ib3b5498ae906726d1f9e0919333c102898b48ea9
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-12-17 20:31:48 +01:00
Mårten Nordheim 7596476366 Fix FindWrapResolv on systems that complaing about uninit vars
The compile test would fail on certain systems due to usage of
uninitialized variable.

Amends 4a46ba1209

Fixes: QTBUG-120141
Pick-to: 6.7 6.6
Change-Id: I4ebbd9dcc820a26c4f8cec0460c5dacbd85c4d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-17 16:24:38 +01:00
Christian Ehrlicher 64a283a988 QHeaderView: fix calculating dragPosition
The dragPosition was calculated without taking the scroll offset into
account as it's done within QAIV.
Amends 787b4c1506

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-120055
Task-number: QTBUG-113573
Change-Id: I0e20065f797a1a3f7df07583fccfa029b636fead
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-16 19:45:21 +01:00
Christian Ehrlicher 15884aba8f QHeaderView: rename private 'offset' to avoid clash with QAIVP::offset()
QAIVP has a function named 'offset()' which is hidden by QHVP::offset
variable. Therefore rename the QHVP::offset to headerOffset

Pick-to: 6.7 6.6 6.5
Change-Id: Iadb18b8f18197925daa72af243483a044c1d94e7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-16 19:45:19 +01:00
Christian Ehrlicher 19c701d370 QFileDialog/win: pass only filename to IFileDialog::SetFileName()
When calling QFileDialog::selectFile(), the file is passed as QUrl to
the underlying functions. Then this url was converted back to a local
file and the full path (with wrong path separators on windows) was shown
in the filename edit box in the native dialog. There was already a
comment to use QUrl::fileName() but it did not exist when the code was
written and later it was forgotten.

Pick-to: 6.7 6.6
Fixes: QTBUG-47159
Change-Id: I478dfd0e4943277c0ac78ebf4e138257e7ea8662
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-16 19:45:16 +01:00
Volker Hilsheimer 0786c17bbc Try harder to clean up the file info gatherer without blocking
QFileSystemModel uses a QFileInfoGatherer, which is a QThread, to
populate itself with the data from the file system. Some of the system
calls we make for that might block, e.g. on Windows a disconnected
network can easily result in 10 minutes of timeout.

Destroying the QFileSystemModel destroyed the QFileInfoGatherer class
member instance, and the QFileInfoGatherer destructor, being a QThread,
had to wait on itself to avoid QThread asserting when being destroyed
while still running. This means that shutting down a Qt application that
was using a QFileSystemModel, e.g. through the non-native QFileDialog,
would hang practically indefinitely instead of shutting down.

To fix this, explicitly manage the life-time of the QFileInfoGatherer.
Manage it in QFileSystemModel through a std::unique_ptr instead of as a
direct class member so that we can control its destruction. In the
QFileSystemModel destructor, signal the gather to terminate and wait
one it for one second. If that fails, schedule the gatherer for later
deletion through deleteLater(), and release it from the unique_ptr.

The QFileInfoGatherer instance might then be alive with the
QFileSystemModel destroyed. When it receives the DeferredDelete event,
try again to abort the process and wait on the thread, this time for
5 seconds.

If that also fails, then we have to make a choice. We cannot destroy
the QThread object while it's still running, so we have to either
wait indefinitely, terminate the thread, or accept a memory leak by
ignoring the deferred delete event.

If the QCoreApplication is shutting down, then we terminate the thread.
To make this safe, explicitly control when termination is allowed in the
thread - disallow it while the thread is holding a mutex, allow it while
the thread is performing I/O operations.

If the QCoreApplication is not shutting down, then we connect to the
QThread::finished signal, and delete the object in response to that.
This might or might not happen, in which case we have to accept that
there's a memory leak.

Pick-to: 6.7 6.6
Fixes: QTBUG-120062
Change-Id: I1e4243265879d61cf406b4eeb0b11b9d59b006ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-16 14:49:21 +01:00
Volker Hilsheimer c81e31461f macOS a11y: rebuild table model if out-of-bounds cell is requested
While it is the itemview's responsibility to keep the accessibility
bridge updated about changes in the view's structure and size, we
have experienced a number of assertions getting triggered when that
wasn't done correctly.
Instead of an assert (or hard crash in release builds), recreate the
table representation in the accessibility bridge when a cell that is
out-of-bounds for the current representation is requested. Emit a
warning message to inform widget authors, and improve the debug
message with information about the column count as well.

Amends 52c2b82082.

Pick-to: 6.7 6.6
Change-Id: I19c20a932153268a5176d7378c485277088f10bf
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-16 13:15:56 +01:00
Marc Mutz 4271114dc6 tst_qxp_function_ref: check that function_ref's are trivially copyable
Mandated by P0792R9 already, but we never checked and P0792R14 has
user-defaulted assignment operators showing up in the synopsis now,
so make sure we don't accidentally break this going forward.

Amends 29b65c98e7.

Pick-to: 6.7 6.6 6.5
Change-Id: Ief9c5ff30895f8bfccec1c24d1777d3dab76c95a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-16 09:43:58 +01:00
Marc Mutz 41c41b4ba5 qxp::function_ref: reuse a constraint for the deduction guide
No functional change, just using the already-existing named constraint
instead of more enable_if fiddling.

Amends 29b65c98e7.

Pick-to: 6.7 6.6 6.5
Change-Id: Idae4962834f14e2a5273099b5611ebcbb2a54447
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-16 09:43:50 +01:00
Marc Mutz 0d0cd1fe2c qxp::function_ref: simplify the constraint on op=(T) = delete
Drop the remove_cvref_t (T is already decayed by way of take-by-value)
and apply De Morgan's Law.

No functional change, just fewer templates to instantiate.

Amends 29b65c98e7.

Pick-to: 6.7 6.6 6.5
Change-Id: I0c0f8c4a288145d05636fb053cc260a917fcc4c5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-16 09:43:40 +01:00
shjiu b404930e12 Fix build error with lambda on GCC 9.2
This patch is specific to the return type of updatePtrSimd function as boolean to avoid the bug of GCC 9.2.

Fixes: QTBUG-112920
Pick-to: 6.7 6.6 6.5
Change-Id: I21cb1f6dda34448b2290ab72ec280b6b2a3732c9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-16 01:52:24 +00:00
Orkun Tokdemir 9465de9041 Doc: Fix Typo
Change-Id: I2fd0e00358cfacb86f0d40109e7bac31354c86a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-12-16 02:35:19 +01:00
Christian Ehrlicher 531aeeefb5 QCommonStyle: make sure QPainter::save/restore() is called balanced
tst_qstylesheetstyle revealed an unbalanced call to save/restore within
drawPrimitive(PE_IndicatorSpinUp/Down) due to an early exit. Therefore
add a RAII-helper class to make sure QPainter::restore() is always
called after a QPainter::save().

Pick-to: 6.7
Change-Id: I1b3851836b36d75357ed8c4532f7d2e44136159e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-16 01:48:26 +01:00
Santhosh Kumar e977a62927 Set correct content size for tool tip label
The tool tip content size uses an incorrect content margin, when it's
constructed. This content margin has been reset to correct value when
tool tip is positioned using placeTip(). But after that, the content
size not been recalculated.

This patch triggers updatesSize() to calculate content size with
updated content margin values.

Fixes: QTBUG-119752
Pick-to: 6.7 6.6 6.5
Change-Id: I454c8528505686f2724b897e4002f78f3049149a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-15 19:42:19 +01:00
Ed Cooke 1878556f25 Update the icons in the system tray example
Update the icons for bad, heart and trash in the system tray example.

Fixes: QTBUG-119127
Change-Id: I0b6d4600397a0cb2a5474da04297ab92689358cd
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-12-15 19:42:16 +01:00
Tor Arne Vestbø 13074a967f Debounce QDeferredDeleteEvents in QObject::deleteLater()
We used to look through the event queue in QCoreApplication::postEvent,
and if we found an existing DeferredDelete event for the receiver we
would compress the two events into one.

This was changed in 99b89d30fa, as the
logic was causing O(n^2) for deleteLater, by using one of the bits
in QObjectData to track whether the object had already been deleted.

But it kept the logic for tracking this in QCoreApplication::postEvent,
and QCoreApplication::compressEvent would still do the work of deleting
the additional QDeferredDeleteEvents.

To avoid the unnecessary heap allocation of the QDeferredDeleteEvents
we can move the debouncing/compression to QObject::deleteLater().
We use the same mutex as in QCoreApplication::postEvent to guard
concurrent access to deleteLaterCalled.

A note has been added about the (preexisting) issue that the mutex
is not sufficient to prevent data races, as the deleteLaterCalled
flag is part of a bit-field, and we're not guarding any of our
other accesses to other bits.

As QDeferredDeleteEvents is private API, we can rely on no-one else
posting it than QObject::deleteLater(), which should be the case now
that tst_QApplication::sendPostedEvents() was fixed.

The documentation has been clarified as well. It's safe to call
deleteLater() more than once, but that's not _because_ other
pending events for the object are cleared. The latter behavior
is normal ~QObject() behavior. The documentation was probably
written at a point we didn't do any event compression at all
for QDeferredDeleteEvents.

Task-number: QTBUG-120124
Task-number: QTBUG-119918
Change-Id: I2a733095b7cb066ba494b1335aa40200c749cb0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-15 18:21:22 +01:00
Volker Hilsheimer bddf27cd5a Move the settingseditor example into tests/manual
The example uses QTreeWidget when it should use a QTreeView with a
dedicated item model, primarily shows how to use item views (and very
little about QSettings), and is generally not useful to show how an
application could or should use QSettings to store settings.

Turn it into a manual test instead; it's useful for that as it supports
ini and plist files, and settings in different scopes.

Pick-to: 6.7
Fixes: QTBUG-119978
Change-Id: I7ce039f6391c41c679d126d90a251eee60327c39
Reviewed-by: Ed Cooke <ed.cooke@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-15 18:21:22 +01:00
Krzysztof Sommerfeld 38fa1d55ee Enable IPv6 tests for VxWorks
Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: I1ec9cda2f9fc72bf539e75fa7144d9b4b97d7369
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-15 17:12:38 +00:00
Krzysztof Sommerfeld 03ef30d975 Recreate posix QSystemSemaphore on release for VxWorks
`QSystemSemaphore` used by `QSharedMemory` class, when failed to acquire
native sem by calling `sem_wait`, will check the reason of failure and
if it is because the semaphore is no longer valid (destroyed by some
other `QSharedMemory` object accessing the same data) will recreate it
and repeat.  However, the same is not done when `QSystemSemaphore` is
calling release.

Add this functionality also for release.

Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: Ic5d2438c93db318b993becff930b480fd3177532
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-15 17:12:38 +00:00
Volker Hilsheimer 9d8473cdf6 Examples: fix touch handling in painting examples
On macOS, we don't deliver a press event for the first press on the
track pad (Qt::WA_TouchPadAcceptSingleTouchEvents is not set by default,
so Qt doesn't deliver a single-press on the track pad as a touch event -
that makes some sense or at least maintains compatibility). Because of
that, point 0 is never added to the finger-mapping hash.

When point 0 is then released, we didn't check if we found a valid
iterator for that point ID, and the example crashed.

Fix this by checking that we have a valid iterator before dereferencing,
and by handling Stationary events in the same way as pressed (add the
point to the mapping if it's not already there).

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-110266
Change-Id: I32337b801aaabf9b821a97ddc15ad78747b5e6a2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-12-15 17:30:36 +01:00
Esa Törmänen f6566dd4c6 Doc: Improve QLineEdit documentation
Edited the text based on MS Style Guide, added a few new sections
under Detailed Desccription and a link to the Line Edits Example
topic.

Task-number: QTBUG-119552
Pick-to: 6.6 6.7
Change-Id: Iecaa142628019118e271e392a3e332841a7b5af2
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-15 18:30:36 +02:00
Ahmad Samir 675b4f63fe QIdentityProxyModel: add setHandleSourceLayoutChanges(bool)
Some sub-classes have special handling of source model layout changes
(abbreviated as SMLC from here on out), they relied on disconnecting the
connections to the _q_*layout* slots in the private class using the SLOT
macro. This isn't possible any more after recent changes (and the method
were renamed to remove _q_ prefix).

Sub-classes resorting to using private API is a clear sign some
functionality is missing from the public API, so a cleaner solution for
this issue is adding this setter which enables sub-classes to tell
QIdentityProxyModel to leave handling of the SMLC to them. Thanks to
David Faure for the idea/solution.

[ChangeLog][QtCore][QIdentityProxyModel] Added
setHandleSourceLayoutChanges(bool) method to allow sub-classes to
indicate to QIdentityProxyModel that they will handle source model
layout changes on their own. Also added a getter,
isHandleSourceLayoutChanges().

Change-Id: I1de79dd693ce32a6e2df9a7c81dd4abdc5f00248
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-15 16:52:10 +03:00
Ahmad Samir 1648d2d93a QIdentityProxyModel: store connection handles in a container
Port to PMF signal/slot syntax: compile-time type checking vs. run-time
string-based search. Given how many connections are made, this is both
safer and more readable.

Drop the _q_ prefix from method names, it was needed since
Q_PRIVATE_SLOT() was used for those methods.

Use QVLA since we know the size at compile time, (not a std::array like
other changes because some elements in the std::initializer_list are
going to be split out, so using a container with a push_back() is
simpler than fiddling with indexes to use operator[], see next commit in
this chain for details).

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

Change-Id: Ia7e7d0b1f3c1a95bc399bd06de3b5c96e845b34d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-15 16:52:09 +03:00
Michael Weghorn d91d53c951 a11y atspi: Add null checks in table iface methods
Add null checks to cover the cases where
QAccessibleTableInterface::cellAt returns
nullptr (which happens e.g. when called with
invalid indices via AT-SPI) or where the
cell object doesn't implement the
QAccessibleTableCellInterface, which
would previously result in crashes.

Fixes: QTBUG-119167
Pick-to: 6.7 6.6
Change-Id: Ieb42617b32ca829af09ae1d54f5de9ec029e3ab2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-12-15 14:52:09 +01:00
Alexandru Croitor cab76abc61 CMake: Fix non-prefix debug exclusion check for additional info props
The condition was checking if excluded_genex variables is not an empty
string.
But when the EXCLUDE_FROM_ALL property was unset, the value of
excluded_genex would be "excluded_genex-NOTFOUND" which would fail the
condition, and would end up always adding the generated code block.

Instead of checking for an empty string, check if it's a truth-y value.
This ensures not to add the code block when the property is unset.

Amends 7540b4bd56

Change-Id: I126c745e2e6eccad34171456c052a14cad9d887d
Pick-to: 6.7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
2023-12-15 14:52:09 +01:00
Alexandru Croitor 3b71f9dc29 CMake: Export additional target info props for object libraries
For some reason when building a user project in Release mode, when Qt
was built with -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug on
MSVC, will result in linking of Debug object libraries into the user
project.
This does not happen in the same configuration on macOS.
My guess is there is a difference in the logic on which configuration
to choose between the platforms, perhaps based on package lookup order
or something else.

This was observed with qtgrpc's
ProtobufWellKnownTypes_type_registration object library (which is only
built on Windows as an object library).

The issue can be fixed if we explicitly generate per-config imported
location information for object libraries, just like we do for regular
libraries.
That way we'll have uniform build type information for all target
types.

Pick-to: 6.6 6.7
Fixes: QTBUG-119708
Change-Id: I9020b7743cea65bbd92cadd5f570b7e38e999bd4
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
2023-12-15 14:52:09 +01:00
Volker Hilsheimer 85c36ef1ac JNI API review: refactor repeated if constexpr-chain
Provide class template specializations for each supported JNI type (and
also covering the equivalent C++ types), and implement generic call-
helpers using the type-specific JNI function.

Remove the now unused static-assert helpers for unsupported types.
We'll get compile time errors when the functions are used with
unknown types.

Pick-to: 6.7
Change-Id: I8ae848bb9de60b536df64318c8a65560d8f70acb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-15 12:17:17 +01:00
Volker Hilsheimer a936b86ec8 JNI API review: minor API and implementation cleanups
- prefix ValidField/SignatureTypes predicates with "If"
- make QJniArray SMF constexpr and noexcept
- remove const from return-by-value QJniArray functions
- rename QJniArray::asContainer to toContainer
- constrain QJniEnvironment::registerNativeMethods to valid class types
- don't home-grow std::forward
- make default QtJniTypes::Object constructor implicit
- don't include copy/move constructors in QtJniTypes::Object variadic
  constructor

Pick-to: 6.7
Change-Id: Ied02993d32d8b0f3ef1e571b75ada15ede1f8389
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-12-15 12:17:17 +01:00
Christian Ehrlicher cd081991b1 Doc: fix links in QString::toLocal8Bit()
\l must not be preceded by \c - qdoc will ignore \l otherwise.
This amends 349bd4db22

Pick-to: 6.7 6.6
Task-number: QTBUG-111443
Change-Id: Ia1ab7c6bfe88c288ea14ee307c6a39c1c304ee6f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-12-15 07:28:46 +01:00
Thiago Macieira 948fa2a427 QBitArray: add mutation operators taking rvalue QBitArrays
Because we may be able to use the other side's storage and apply the
operation in-place. We reuse the storage of the one that can be
detached: even if we have to grow the buffer, QBitArrays are usually
small so there's a good chance it's just to the extra space QArrayData
usually overallocates or a simple, non-moving realloc().

Disassembly with GCC 13 and Clang 17 show the vectorisers did kick in
for all four functions (inverted_inplace included). I think a
hand-rolled version could squeeze a few more cycles, especially in the
tail section, but I don't consider its maintenance cost to be worth it.

Pick-to: 6.7
Change-Id: I85b3fc2dd45c4693be13fffd1795bfb1b296caa6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-14 17:46:12 -08:00
Christian Ehrlicher 8f539ac85a QStyleSheetStyle: pass dpr to QIcon::pixmap()
Pass the correct device pixel ratio to QIcon::pixmap() to make sure the
correct pixmap is returned on high-dpi displays.

Pick-to: 6.7
Fixes: QTBUG-92016
Fixes: QTBUG-94203
Change-Id: I6809ae63b2c99bb60c705f6d78caa2b48f2c7473
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-15 01:35:28 +01:00
Johannes Grunenberg d53e42d974 Windows QPA: Omit native virtual key in WM_CHAR
WM_CHAR doesn't send the native virtual key in wParam,
but it sends the generated UTF-16 code unit, so no assumptions
can be made about the pressed key.
lParam still contains the scancode.

Fixes: QTBUG-117903
Pick-to: 6.5 6.6 6.7
Change-Id: Iedc5936118936009db8f6b0c1ce6147db2739422
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-12-15 00:06:07 +01:00
Eskil Abrahamsen Blomfeldt 05de036a88 Fix synthesized bold on Windows
There were a couple of problems with synthesizing boldness on
Windows: For the DirectWrite font database, this was not implemented
at all, so this change adds support for it.

For the default GDI font database, the font engine is correctly created
for a font with synthetic bold, but the function that retrieves the
contours from the font does not apply the transformation. So when
generating the distance fields for Qt Quick, we would get the
unemboldened contours. The fix for this is simply to fall back to
using DirectWrite for fonts that require any synthetization. This will
later become the default anyway.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-119995
Change-Id: I5b4e3b19d0d71c6599746172da0bee41e8fb3940
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-15 00:06:06 +01:00
Allan Sandfeld Jensen 15051e205f Copy color table in QImage::transform paint path
A copy without pixel ratio was made, but color table not set.

Pick-to: 6.7 6.6 6.5 6.2
Fixes: QTBUG-119902
Change-Id: I328f3faa70d7a1263061cbe51921999393e30801
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-12-14 23:35:14 +01:00
Alexandru Croitor 04a327f00a CMake: Don't recurse with qt-cmake-standalone-test in-source dirs
When the qt-cmake-standalone-test root project is configured in-source
in the source directory of a test A, where test A ends up being added
via add_subdirectory(A), this causes the SUBDIRECTORIES property of A
to contain itself for some reason.
Recursively iterating over the root project's subdirectories thus
causes an endless recursion.

Make sure to remove the currently processed directory from the
retrieved SUBDIRECTORIES property when the function is called
during qt-cmake-standalone-test configuration.

We limit it just for that script, so that we don't accidentally
increase the configure time when building all standalone tests, and
call list(REMOVE_ITEM) too many times.

Upstream issue filed at
https://gitlab.kitware.com/cmake/cmake/-/issues/25489

In a way, amends d08fa86e63 because it
exposed the issue.
Amends 1c82e92202

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-119998
Change-Id: I6f92a07be105cde74ac4946523967791db7bf301
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-12-14 22:59:33 +01:00
Volker Hilsheimer 0441526448 QAIV: reset state if removing index while editing or committing
If the commit of data to a model index result in that index getting
filtered out, then the editor will be removed as part of committing the
data, and the index that the editor is associated with becomes invalid.
The subsequent call to closeEditor() will find that the index for the
editor is no longer valid.

This should not warn, and it should also not abort the clean-up process
early. Instead, identify that the editor that we want to closed is
already hidden. In that case, skip the warning and most of the cleanup
process, and proceed directly to the EndEditHint handling further down.

Add a test that simulates the two scenarios where this can happen:
either the committing of data results in the index being filtered out
by the existing filter; or the filter changes while editing, and the
index being edited gets removed. In both cases, we don't want to see a
warning, and the state of the item view should be reset correctly.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-115765
Change-Id: If247172fdac9a1a9279dae96c078d32553d4ee5d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
2023-12-14 22:59:33 +01:00
Volker Hilsheimer 1b71e2d894 QMessageBox: don't use a native dialog if a style sheet is active
With 6.5 we try to use the native message dialog if we can, but we
didn't account for the style sheet. This restores pre-6.5 behavior for
QMessageBox.

Other dialogs will continue to be native, even if a style sheet is in
use. While this is inconsistent, the other dialogs are substantially
more functional, so switching to the Qt version because of a style sheet
being active would be a significant change of behavior.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-120054
Change-Id: I07eae609bc360140e096c5eb7ad004ffa4422123
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-14 20:49:48 +01:00
Thiago Macieira f894f04c9d QObject: remove the operator comma hack
It was the easiest way to implement this back in the day without an
explosion of combinatorics.

Change-Id: Ia930b1a2ed1e465a826ffffd179c5bb4657d0562
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-14 20:49:47 +01:00
Thiago Macieira a337b8360f Suppress clang-tidy mem leak warning on QMetaObject::invokeMethod
We don't leak, but clang-tidy is printing this warning. Possibly because
it sees a new with no matched delete in the same context, ignoring the
fact that the pointer was gifted to the called function.

Fixes: QTBUG-119972
Pick-to: 6.7 6.6 6.5
Change-Id: I6e2677aad2ab45759db2fffd17a06c57c3a463ba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-14 19:49:47 +00:00