Commit Graph

64492 Commits

Author SHA1 Message Date
Tor Arne Vestbø
df834fde52 tst_QWindow::setVisibleThenCreate(): Fix unused argument warning
Use the arguments to call the parent class implementation.

Pick-to: 6.5 6.6
Change-Id: I602a66447fb8681b3ec9ef8e2e281828612d178c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 18:16:50 +00:00
Eskil Abrahamsen Blomfeldt
c22ff83b2a Fix memory leak when resolving named instances in fonts
We need to free the memory allocated when getting the
info about the variable font.

Change-Id: I25c5f070a6d02468c904428ea2ae71efce1e847c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-11-13 19:14:59 +01:00
André Klitzing
3bae65e7d6 Bump androix dependency to 1.12.0
This avoids linter warning like in 5dc9692e48:
       Obsolete Gradle Dependency

Pick-to: 6.6
Change-Id: I5850af3206f3eaf80850918a13705c59ac3fb4ea
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-13 19:14:59 +01:00
Tor Arne Vestbø
db33628452 Ensure foreign window can be reparented out of contained window again
A foreign window embedded into a Qt hierarchy must also support
being removed from that window hierarchy.

Pick-to: 6.6
Change-Id: Id4d08079ff19d67a8989937bc72602e8bd14b31b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-13 19:14:59 +01:00
Tor Arne Vestbø
93077dd1f2 iOS: Fix foreign window auto test
Pick-to: 6.6
Change-Id: Iae3a0f9805b02f935009d800dec00d9e2ceb008d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-13 19:14:59 +01:00
Matthias Rauter
619ec1a640 Refurbish the clock example
Fixes: QTBUG-118871
Pick-to: 6.6
Change-Id: I0a1a6444cb381d49adbc39e73d7862c9cfe61dce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 19:14:59 +01:00
Toni Saario
ea84c1a229 Add VxWorks specific instructions
Adds VxWorks conditions to match target instructions
and sets env prefix to wrenv.

Change-Id: If9a8ffcdf4b60cc4b45eb2a336737d77d2f8804a
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2023-11-13 18:14:59 +00:00
Marc Mutz
9bed675df8 De-inline qt_ignore_sigpipe()
It contains a static guard variable, so every user of the function
outside of QtCore (at least QtNetwork contains one) will create its
own copy of the guard variable. While mostly harmless, we'd be
executing too many sigaction() calls this way.

As a drive-by, remove the qatomic.h include and replace the C-style
struct initialization (memset()) with C++-style
(value-)initialization.

I also tried C++20/C99 designated initializers, but they cannot be
used here: some platforms #define sa_handler to some nested member
accessor because they hold the field in a union. While .a.b is allowed
in C99, it isn't in C++20, so we'd have to move this function's
definition into a .c file to compile `{ .sa_handler = SIG_IGN }`.
That'd be too much hassle.

Mark the function as noexcept, because it is (sigaction(2) is not a
Posix Cancellation Point), and, now that it's out-of-line, that
actually matters to codegen.

Change-Id: Iffab9e6b57822a4d1be8b81ed5948ce186df978e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-13 17:58:50 +01:00
Luca Di Sera
e795898cc4 Doc: Fix template information for QTypeRevision members
When QDoc parses a project, it parses the source code to extract the
user-provided documentation and perform sanity checkings based on the
code itself on it.

When QDoc parses an "\fn" command as part of this process, it tries to
understand, based on its intermediate representation built on the
information extracted from the code-base, which "documentable element"
the "\fn" refers to.

When QDoc performs this "matching" process, it takes into consideration
only a certain amount of information.
For example, no checking is performed over the template declaration of a
callable.

Due to some upcoming documentation, where two callables are
indistinguishable to the current process, as they differ only in their
template declaration, QDoc will start to take into consideration the
template declaration of a callable when matching.

This implies that an "\fn" command should now provide information
parity, with regards to template declaration for callables, with the
code-base so that QDoc can perform the match correctly.

The documentation for of the members of `QTypeRevision` is not in sync
with the intended target template declaration.

Hence, add the missing information to the relevant "\fn" commands.

Task-number: QTBUG-118080
Change-Id: Id121fb926cdd1a7905be1693f8d9fb90834a99e0
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-13 16:35:55 +01:00
Luca Di Sera
848e312052 Doc: Fix template information for QVariant members
When QDoc parses a project, it parses the source code to extract the
user-provided documentation and perform sanity checkings based on the
code itself on it.

When QDoc parses an "\fn" command as part of this process, it tries to
understand, based on its intermediate representation built on the
information extracted from the code-base, which "documentable element"
the "\fn" refers to.

When QDoc performs this "matching" process, it takes into consideration
only a certain amount of information.
For example, no checking is performed over the template declaration of a
callable.

Due to some upcoming documentation, where two callables are
indistinguishable to the current process, as they differ only in their
template declaration, QDoc will start to take into consideration the
template declaration of a callable when matching.

This implies that an "\fn" command should now provide information
parity, with regards to template declaration for callables, with the
code-base so that QDoc can perform the match correctly.

The documentation for of the members of `QVariant` is not in sync
with the intended target template declaration.

Hence, add the missing information to the relevant "\fn" commands.

Task-number: QTBUG-118080
Change-Id: I9ec1a09091afbb17bc37bfc1dee8f738f01619e9
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-13 16:35:55 +01:00
Luca Di Sera
482d11fdbe Doc: Fix template information for QStringView members
When QDoc parses a project, it parses the source code to extract the
user-provided documentation and perform sanity checkings based on the
code itself on it.

When QDoc parses an "\fn" command as part of this process, it tries to
understand, based on its intermediate representation built on the
information extracted from the code-base, which "documentable element"
the "\fn" refers to.

When QDoc performs this "matching" process, it takes into consideration
only a certain amount of information.
For example, no checking is performed over the template declaration of a
callable.

Due to some upcoming documentation, where two callables are
indistinguishable to the current process, as they differ only in their
template declaration, QDoc will start to take into consideration the
template declaration of a callable when matching.

This implies that an "\fn" command should now provide information
parity, with regards to template declaration for callables, with the
code-base so that QDoc can perform the match correctly.

The documentation for of the members of `QStringView` is not in sync
with the intended target template declaration.

Hence, add the missing information to the relevant "\fn" commands.

Task-number: QTBUG-118080
Change-Id: Ia5c6f99d38b0080b150cbfca83ae605cc07d9b72
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-13 16:35:54 +01:00
Luca Di Sera
1fcfc8f94d Doc: Fix template information for a QSet constructor
When QDoc parses a project, it parses the source code to extract the
user-provided documentation and perform sanity checkings based on the
code itself on it.

When QDoc parses an "\fn" command as part of this process, it tries to
understand, based on its intermediate representation built on the
information extracted from the code-base, which "documentable element"
the "\fn" refers to.

When QDoc performs this "matching" process, it takes into consideration
only a certain amount of information.
For example, no checking is performed over the template declaration of a
callable.

Due to some upcoming documentation, where two callables are
indistinguishable to the current process, as they differ only in their
template declaration, QDoc will start to take into consideration the
template declaration of a callable when matching.

This implies that an "\fn" command should now provide information
parity, with regards to template declaration for callables, with the
code-base so that QDoc can perform the match correctly.

The documentation for `QSet::QSet(InputIterator, InputIterator)` is not
in sync with the intended target template declaration.

Hence, add the missing information to the relevant "\fn" command.

Task-number: QTBUG-118080
Change-Id: I7e20331af3ca0c8d09ffdb6acf3292b46ca79651
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-13 16:35:54 +01:00
Luca Di Sera
3ab35eeefa Doc: Fix template information for QRandomGenerator::fillRange
When QDoc parses a project, it parses the source code to extract the
user-provided documentation and perform sanity checkings based on the
code itself on it.

When QDoc parses an "\fn" command as part of this process, it tries to
understand, based on its intermediate representation built on the
information extracted from the code-base, which "documentable element"
the "\fn" refers to.

When QDoc performs this "matching" process, it takes into consideration
only a certain amount of information.
For example, no checking is performed over the template declaration of a
callable.

Due to some upcoming documentation, where two callables are
indistinguishable to the current process, as they differ only in their
template declaration, QDoc will start to take into consideration the
template declaration of a callable when matching.

This implies that an "\fn" command should now provide information
parity, with regards to template declaration for callables, with the
code-base so that QDoc can perform the match correctly.

The documentation for `QAbstractGrpcClient::fillRange` overload set is
not in sync with the intended target template declaration.

Hence, add the missing information to the relevant "\fn" commands.

Task-number: QTBUG-118080
Change-Id: I0b9c197019c0ba03d488d7b7c3351de75a0023f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-13 16:35:54 +01:00
Vladimir Belyavsky
b71aa3c661 QSystemTrayIcon: properly disconnect old menu in setContextMenu()
Amends 121a30ccef
Fix the unfortunate mistake where oldMenu was not properly disconnected
from the contextMenuRequested() signal. This could lead to a situation
when several menus are displayed at the same time.

Fixes: QTBUG-78737
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ice59841724207192eacd5a52b644f83159e09913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 15:35:54 +00:00
Marc Mutz
9bccfb56c2 Q(Persistent)ModelIndex: use new test framework for op==
All good, except missing noexcept.

Can't test ordered relational operators because the classes provide
only op<, not the full set, so this has to wait until we port
Q*ModelIndex to the new comparison framework.

Change-Id: I05e26c88f0bd8c035ef0461c7c50b218c513da08
Reviewed-by: David Faure <david.faure@kdab.com>
2023-11-13 17:35:54 +02:00
Ivan Solovev
bfb237d19a TestLib: provide helper functions to test relational operators
The patch provides two sets of functions:
* functions to perform compile-time check for all cv-ref combinations
* functions that actually verify the comparison results for all
  cv-ref combinations.

For now it does not test operator<=>(), even if compiled with C++20,
because Qt types do not yet implement it.

The patch uses the new helper functions to improve testing of date and
time classes, because they already provide a full set of relational
operators.

Change-Id: I8bd869c489543719ea856d6609cac53cbd4dc122
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-13 16:35:54 +01:00
Andreas Eliasson
e4bde15e14 Doc: Merge dangling text with \note paragraph
It's not possible to have empty lines inside a \note as this will cause
the text after the empty line to appear outside the note box. So, remove
the empty lines to make the note paragraph complete.
Also, revise the text.

Fixes: QTBUG-117111
Pick-to: 6.6 6.5
Change-Id: I50ad0cd559f684c5264898ef8bbac16910f96dea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-11-13 16:35:54 +01:00
Samuel Gaist
02f0510c54 doc: fix QScrollBar stylesheet code example
The horizontal parts were missing colons.

Change-Id: Ibc3657d87d38af76d0736f9880eb711f52723de1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-11-13 09:43:48 +01:00
Christian Ehrlicher
e4315204b1 QDial: don't crash when min==max and setting a value != min & max
QDial::bound() is crashing when min == max due to a division by zero.
Therefore check for this condition beforehand and return min.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-104641
Change-Id: I612625af1ad18333d59a7771abfdec602301b58e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-12 23:45:30 +01:00
Vladimir Belyavsky
c1d389a132 QSystemTrayIcon: Allow resetting context menu
Fix logic in QSystemTrayIconPrivate::updateMenu_sys() to allow resetting
the tray icon menu. Now we correctly handle `nullptr` menu, and update
the underlying QPlatformSystemTrayIcon instance accordingly.

Also we bail out from QSystemTrayIcon::setContextMenu() early if the
menu is the same.

Fixes: QTBUG-119068
Pick-to: 6.6 6.5
Change-Id: I704b40dfb1a3046331aef65417655411bf3a41a0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-12 18:45:16 +00:00
Tor Arne Vestbø
7a7aecae2a macOS: Clarify relation between occlusion state, hidden state, and expose
Pick-to: 6.5 6.6
Change-Id: I0e05332087fb3f876a9d2fadd9d7dcfd556d5734
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 18:40:03 +02:00
Tor Arne Vestbø
0366b554c9 macOS: Respect QPlatformDialogHelper::ButtonLayout in native alerts
The buttons in QMessageDialogOptions do not have any order that we
can rely on. The standard buttons is just a bit mask, so any ordering
done on the QMessageBox side is lost. The custom buttons are ordered
in the same order the user added them, but this is not really the
order we want them to appear in the dialog either, as we have a
well defined order between roles provided by QPlatformDialogHelper.

We now follow the QPlatformDialogHelper::ButtonLayout order for
macOS, using the same heuristics for multiple Accept role buttons
as QDialogButtonBox.

For buttons with the same role, QMessageBox will respect the order
they were added in, but this is not something we can do for the
standard buttons, as long as they are flattened to a bit mask.

Pick-to: 6.6 6.5
Change-Id: I401f202a7c2d83dc253e988531ad145624c97580
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 18:40:03 +02:00
Tor Arne Vestbø
b49211c125 macOS: Activate all windows on launch, not just key/main windows
The default macOS behavior when an application is activated is to
bring key and main windows to the front. Any window shown after
that is order to the front as normal.

For Qt apps we show windows in main() instead of waiting for the
application to become active first, and the request to show
the window may reach the window server before or after Finder
has made the application active. If it arrives first, the window
may end up behind the currently frontmost application.

This is particularly noticeable when the application is not
activated by Finder, and we do our own activation workaround.
In this case all our windows are hidden, except for the key
window.

To ensure a consistent behavior here, we explicitly activate
all windows of the application on launch.

Pick-to: 6.5 6.6
Change-Id: Ice55f7d03e077c5a5ca843f75f1a7296ebb47aa7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 18:40:03 +02:00
Tor Arne Vestbø
6343caae25 macOS: Only bring application forward on launch if needed
We override the macOS default behavior of not activating applications
unless they are launched from Finder. To play a bit nicer, we now
try to detect if we're already the frontmost application, and skip
the explicit activateIgnoringOtherApps if so.

Pick-to: 6.5 6.6
Change-Id: Iff4ddc3dc50aeb9700c88882dd7a270cfea5b737
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 18:40:02 +02:00
Tor Arne Vestbø
b8879b4d2d macOS: Remove dead code for activating application on startup
We handle this in applicationDidFinishLaunching nowadays.

Pick-to: 6.5 6.6
Change-Id: I447e8923fba3eac4cb0a2727f369fff21054f9a1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 18:40:02 +02:00
Ws ShawnWoo
709d2848e1 macOS: Implement NSTextInputClient.windowLevel
Without this optional NSTextInputClient method the input methods
will assume it's safe to place the input panel somewhere above
NSFloatingWindowLevel.

But our NSWindow level can potentially be higher than that, if
set via QWindow::setFlags(), or directly on the NSWindow.

In practice this can be observed by setting a level higher
than kCGDockWindowLevel on the NSWindow.

Account for this by returning the true window level.

Pick-to: 6.6 6.5 6.2
Change-Id: I77d9ac3c59e2f6de9b768c7519b2bc0f1e5fda1d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-12 08:40:02 -08:00
Tor Arne Vestbø
cb94e360ec macOS: Work around key view loop crossing NSWindow boundaries
AppKit will in some cases set up the key view loop for child views, even
if we don't set autorecalculatesKeyViewLoop, nor call recalculateKeyViewLoop
ourselves.

When a child window is promoted to a top level, AppKit will maintain the key
view loop between the views, even if these views now cross NSWindows, even
after we explicitly call recalculateKeyViewLoop. When the top level is then
hidden, AppKit will complain when -[NSView _setHidden:setNeedsDisplay:] tries
to transfer first responder by reading the nextValidKeyView, and it turns out
to live in a different window.

  ERROR: Setting <View: 0x145e0cfd0> as the first responder for window
  <Window: 0x10f904de0>, but it is in a different window (<Window: 0x147104f00>)!
  This would eventually crash when the view is freed. The first responder will
  be set to nil.

We mitigate this by a last second reset of the first responder, which is
what AppKit also falls back to.

It's unclear if the original situation of views having their nextKeyView
pointing to views in other windows is kosher or not, but that's left for
further investigations.

Pick-to: 6.5 6.6
Change-Id: I63636afbba85abf73a38db9701f32656c42c59cc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-12 17:40:02 +01:00
Vladimir Belyavsky
5b451efe81 QCocoaSystemTrayIcon: fix updateMenu() logic
Amends da754d5b65
We should avoid registering an observer multiple times for the same
NSMenu object, because it results in multiple consecutive
emitActivated() calls.

So,
- bail out early if menu is the same, i.e. we have nothing to do
- unregister an observer we added previously for the old menu

Fixes: QTBUG-119053
Pick-to: 6.6 6.5
Change-Id: I14fce693dba351b1d12f2140fa8e672227cc7a9e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-12 13:36:05 +00:00
Christian Ehrlicher
37048d0417 QStandardItemModel: don't leak in mimeData()
When an invalid index is given to QStandardItemModel::mimeData() the
function bails out with a warning and returns a nullptr. But the
allocated data from QAIM::modelData() was not freed.

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-116532
Change-Id: Ibce9d51ea09d45f1b0eb3ca980aaff141af5bf68
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-12 11:22:02 +01:00
Christian Ehrlicher
ab4bb5077c tst_qstandarditemmodel: fix memleaks
QStandardItemModel::takeItem/Row/Column() return items not owned by the
model anymore and therefore need to be cleaned up manually

Pick-to: 6.6
Fixes: QTBUG-116532
Change-Id: Ic8797f58184f56b9c4ef415ce8f2363c1b352388
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-12 11:21:50 +01:00
Christian Ehrlicher
0416e080cf QStandardItem: Fix reset parent in takeItem()
After the change for QTBUG-89145 the parent was not set to 0 when the
item was not attached to a model.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117900
Task-number: QTBUG-89145
Change-Id: I421e775130b03ce3eb2dd1dd05370e7391af087b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-12 10:21:46 +00:00
Sergio Martins
acfd2a4bb0 Make all QPainter operations warn if there's no engine
Otherwise, for example fillRect() will fail silently.

Most operations already had the warning, but some were missing it.

Pick-to: 6.6
Change-Id: I1ef6bf880d5b0722baadcf0ced68a968f0b1a070
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-11-11 21:31:35 +00:00
Thiago Macieira
6bd2358105 QBitArray: move a few methods more into the class body
This reduces the size of the header. I renamed the arguments for fill()
because "size" would shadow a member function.

Change-Id: I85b3fc2dd45c4693be13fffd1795b706b92e0965
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-11-10 18:21:56 -08:00
Axel Spoerl
b3958d26ca Beautify QGuiApplication::event()
Replace if/elseif with a switch.

Task-number: QTBUG-112479
Task-number: QTBUG-119032
Pick-to: 6.6 6.5
Change-Id: Iff29fde6a9b9a16357b26cf90009fec7c9826349
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-11-10 22:21:52 +01:00
Assam Boudjelthia
1957e850ed Android: get rid of the redundant ENVIRONMENT_VARIABLES QtActivity field
This variable supposedly holds a list of environment variables that will
be set by the Qt app, however, if a user needs to set an env variable,
it can be already done either in C++:
 qputenv(key, value);

Or in Java via (the same method that Qt plugin use):
 android.system.Os.setenv(key, value, override);

Thus, such field just makes things more confusing overall only.

Task-number: QTBUG-115017
Task-number: QTBUG-114593
Change-Id: I14856ed0720bfa2605da9c7d51173703df52bc58
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-10 21:57:12 +02:00
Assam Boudjelthia
f6ad69506a Android: add call QtActivity.appendApplicationParameters() to set args
Instead of having to set a field of the class QtActivity to set extra
app parameters (i.e. passed when calling main()), make it doable via
a new API call appendApplicationParameters(). Note that this is
equivalent to setting the manifest metadata "android.app.arguments".
Providing a dedicated method for this makes it cleaner and is the
expected way.

Task-number: QTBUG-115017
Task-number: QTBUG-114593
Change-Id: I407cb68e57fa9a1be24586e42cb947f9c7f4037e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-10 21:57:12 +02:00
Assam Boudjelthia
2f706df651 Android: set the default theme directly in QtActivity without reflection
Currently the default theme is looked for using reflection in the
android.R package to get an id and then it's set. This is not needed
if we set the theme directly in the user's QtActivity which would have
access to that id directly pre-deployment.

To make setting a theme more in line with Android, retreat to using
setTheme() call directly for user projects instead of having to maintain
some internal field to store the theme name and have the user set that
if they want a different theme for their app.

Also, the Android plugin seems to set an env var for QT_ANDROID_THEME
with that default theme's name and that's used in QAndroidPlatformTheme
to check a theme specific extracted theme style.json, however, the Java
side doesn't seem to ever write to such a path, making this approach
totally redundant. For that reason, this code path is now removed.

Fixes: QTBUG-114075
Task-number: QTBUG-115017
Task-number: QTBUG-114593
Change-Id: I9ab3c025626aac2c09bc19eb7d846eca14a45070
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-10 21:57:11 +02:00
Assam Boudjelthia
f5e2302851 Android: don't call delegates outside of the Activity
The delegate classes shouldn't be used outside of the Activity/Service
classes, since they're practically private implementation, so don't use
them anywhere outside Activity/Service.

Since Qt Android apps still mainly support having one QtActivity/
QtService, QtNative heavily uses those objects to do various operations.
For that reason, we still need to use the delegate there. The aim is
to change that in future patches and do the operations where they make
more sense for example directly under QtActivityBase/QtActivityDelegate
or Service counterpart.

The QtServiceDelegate is used no where and have no special
implementation, so it's removed here.

Task-number: QTBUG-118077
Change-Id: I5e106318169be19fec8163e8e500ee573af0e1bc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-10 21:57:11 +02:00
Assam Boudjelthia
19baa077d9 Android: don't call setApplicationDisplayMetrics() from QtNative
It's not immediately clear why setApplicationDisplayMetrics()
is called from within QtNative.startApplication() while it's also
called by QtLayout.onSizeChanged(), it seems to be a redundant call
when starting the native Qt app because QtLayout takes care of it
already.

Task-number: QTBUG-115016
Task-number: QTBUG-118077
Change-Id: I54e8af6356226ca5f1b849ef323be9659b9db663
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-10 21:57:11 +02:00
Assam Boudjelthia
23499e7841 Android: fix setting of system UI visibility flags
The flags were not set to the system UI with Android APIs.

Amends 58c7249ee8.

Task-number: QTBUG-118077
Change-Id: I30fb5272bdb5d7a3a3a82708b9a1604753fc4e6c
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-10 19:57:11 +00:00
Liang Qi
f84e654a62 xcb: fix deprecated QBitmap::operator=(const QPixmap&) warnings
Pick-to: 6.6 6.5 6.2
Change-Id: I2caa64d92ece20d5c8d650a3898926e8f0fa7b24
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-10 19:02:14 +00:00
Matthias Rauter
304eca394a Draw ItemViewItem icon after the background in QStyleSheetStyle
Fixes: QTBUG-118870
Pick-to: 6.5 6.6
Change-Id: I8aad9aa3b4e7e92e96039313bda3e80281523594
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-10 20:02:14 +01:00
Mårten Nordheim
52b6258ec8 Fix compilation with MSVC 17.8
stdext is deprecated, slated for removal.

The macros were used to work around a compiler warning generated
when using the 3-arg overload of certain STL algorithms even when
the 4-arg version (added in C++14) was not available.

These deprecation warnings seem to have been discontinued as of
  MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
so making the macros no-ops from VS 2022 17.8 onward is not expected
to trigger these warnings again.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-118993
Change-Id: I2c3b69d46d13f6fcccf0ffce186b984b7758f287
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-10 18:29:41 +00:00
Marc Mutz
b113b01a71 QStringConverter: harden encodingForName() against nullptr
The nameMatch() function has an implicit precondition that neither
argument is nullptr: it immediately dereferences both arguments.

Prevent the crash by checking for name == nullptr early, before
passing to nameMatch().

Add tests for null and empty.

As a drive-by, make variables in the test const (needed for the
QByteArray to avoid detaching, peer pressure for the others).

Amends a639bcda1e.

Pick-to: 6.6 6.5 6.2
Change-Id: I4a30f6c130310eb701ba7c7251168294489c34db
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-10 19:24:33 +02:00
Volker Hilsheimer
8753bb3045 Cocoa MessageBox: don't use native message box if detailed text is set
As per the documentation: A message box displays a primary
text to alert the user to a situation, an informative text to
further explain the situation, and an optional detailed text to provide
even more data if the user requests it.

The AppKit NSAlert doesn't provide such a "detailed" section, and our
code just added this "even more data" detailed text to the primary text.

This breaks the UI when the detailed text is very long, perhaps a
complete log output with dozens or even hundreds of lines of text.

Since NSAlert doesn't provide a "details" space, fall-back to the non-
native message box if detailed text is provided.

[ChangeLog][QtWidgets][QMessageBox] On Apple platforms, the native
message box is no longer used when detailed text is set.

Pick-to: 6.6 6.5
Fixes: QTBUG-118992
Change-Id: I6f4764ceb8f8e57d641c0b0660223a9c26f5bd26
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-10 11:20:56 +02:00
Shawn Rutledge
68369237bf iOS: Make nextTouchId static, unsigned and let it overflow
If an application has two windows, and the user tries to do multi-touch
gestures with different fingers in each window at the same time, we want
the touchpoint IDs to be unique. m_nextTouchId was a per-window variable
before; the result was that the QEventPoint delivered to the second
window was replacing values (including QEventPointPrivate::window)
in the persistent QEventPoint that was still being held in the first
window; then when the release of the first point occurred,
QGuiApplicationPrivate::processTouchEvent() saw its destination window
pointer as null because the second touchpoint had already been released.

QEventPoint::id is of type int, with negative values being invalid.
nextTouchId is of type quint16 so that it will always be positive, and
we can let it eventually overflow (wrap back to 0) rather than resetting
it to 0 after each touch gesture. The only requirement is that the IDs
need to be unique and positive (and typically they are sequential: that
makes debug output easier to understand).

Task-number: QTBUG-118909
Change-Id: Ia0f1edc9a5e2b362028bed4418fed228814cddb6
Pick-to: 6.5 6.6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-09 12:10:52 -08:00
Alexandru Croitor
f639c04f84 CMake: Document Android per-abi limitation of QT_ANDROID_EXTRA_LIBS
When the per-abi external projects are built, specifying a dynamic
path in QT_ANDROID_EXTRA_LIBS based on CMAKE_ANDROID_ARCH_ABI would
not propagate that value back to the main project's deployment json
file.
While the actual library files would be copied into the apk, they
would not be loaded because the generated libs.xml file would be
missing per-abi entries in the 'bundled_libs' array (except for the
main abi).

Document that project developers should explicitly specify all the
libraries in the property.
androiddeployqt then takes care to filter out unsupported architecture
libraries in each abi build dir, but it will still copy all of them
into the final apk, as well as list all the architectures in libs.xml.

A proper fix would be to generate additional files with information
from each per-abi external project, that would then be read by
androiddeployqt (basically merge specific target property info from
each sub-project).
Hopefully this can be done without introducing new API.

Pick-to: 6.5 6.6
Fixes: QTBUG-117206
Task-number: QTBUG-118838
Change-Id: I181a170cffdb49b0b0d455d997cfae90ada312f0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-11-09 20:57:44 +01:00
Christian Ehrlicher
e0b09e86d8 QAbstractSpinBox: use pmf-style connects
Use pmf-style connections instead old string-based ones.

Change-Id: Idab3a9d60e7cddcd2076476a21dbb1b5d2e4189c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-09 20:57:44 +01:00
Christian Ehrlicher
83e92e2557 QTabWidget/Bar: ignore hidden tabs for key events
Even a tab was hidden it could be accessed with the key navigation or
a scroll event which lead to painting artifacts.

Pick-to: 6.6 6.5 5.15
Fixes: QTBUG-101219
Task-number: QTBUG-63038
Change-Id: I58be694eef5f86cccecbe528891a39a4acdda15f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-09 20:57:43 +01:00
Mårten Nordheim
96e3d06b6f Revert "QTextDocumentPrivate::plainText: simplify code"
This reverts commit a83a818791.

Reason for revert: It's causing asserts, solution to fix is unclear

Change-Id: I33ef760a9402c096d3d7487e777c3ccdbb626d39
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-09 18:18:27 +00:00