65539 Commits

Author SHA1 Message Date
Kai Köhne
901b61bb6a Remove year from generic Qt copyright information
While at it, also add the missing dot in Ltd. (as
it's an abbreviation). Also, prefer https:// over
http://.

Fixes: QTBUG-121906
Task-number: QTBUG-121928
Pick-to: 6.6
Change-Id: I4e1f1563376ae36b3c260359d830f00969ab9351
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6ea922b584a5f55cb73519aa81f074db59b96404)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-18 08:37:02 +00:00
Marc Mutz
1bba8b894a QLoggingRegistry: further defend against non-NUL-terminated strings
Various functions in QLoggingRegistry took QByteArrayView, but they
continued to assume that the data was NUL-terminated (converting back
to const char* by calling data()).

Make sure only NUL-terminated strings are passed by taking in the
tranditional way, as const char*. Keep QByteArrayView when storing in
the map as key, to avoid comparing just pointer values (as opposed to
the string content).

Amends 806545fcc8d6b3b96a5191a00a31e9a39837189c.

Pick-to: 6.6 6.5
Change-Id: I232167d4c91070369e770c41d3ea53bd2406a03f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6b59ff573028eabba42ca63ce50ce05fa160ecaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-18 08:36:48 +00:00
Ahmad Samir
27291b97b4 QTimer: make both defaultTypeFor() methods constexpr and noexcept
Also de-duplicate the code by using defaultTypeFor() in singleShot(),
this way the comment and the calculation are done in one central place.

Change-Id: Ib822cae0e9228e546b664fbac728a60d65c4bbc3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit adc0920c48d812fb1b3e2b7bfc76217a7126a41e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-18 08:36:43 +00:00
Marc Mutz
25649bcd3b Avoid double-lookup in QLibraryStore::findOrCreate()
The code is in a critical section, so don't waste time traversing the
QMap twice.

Now that two previous commits have re-arranged the code such that
lookup and insertion are symmetric, we can combine them into a single
lookup using operator[].

Pick-to: 6.6 6.5
Change-Id: I4a10cece65b8c35d05a9b80967bf15d2e15bd73f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7192b1184190982b6422196121821838d9fcbba6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-17 16:19:59 +00:00
Axel Spoerl
39e9b6b24c QXcbWindow::handleLeaveNotifyEvent(): Consume when leaving geometry
QXcbConnection::mousePressWindow() returns the XCB toplevel window,
which has consumed the window system's last mouse press. When the
function returns a valid pointer, QXcbWindow::handleLeaveNotifyEvent()
didn't propagate the leave event to QWSI::handleLeaveEvent(). Instead,
the leave event was ingored.

That behavior is correct, e.g. when a button on the main window is
pressed and the mouse hovers away from the button, with the mouse
button continuously being pressed. It is not correct, if the mouse
cursor leaves the main window.

=> Ignore the leave event only as long as the mouse cursor remains
within mousePressWindow()->geometry().
=> Deliver the leave event, when the mouse cursor leaves the window.

Fixes: QTBUG-119864
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I30a6ebedcd148285b9f17dfd87885ff67726b54c
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ec24b36d3db82c340d9386951ea48c26f77c2923)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-17 13:23:33 +00:00
Christian Ehrlicher
7874fc1ac8 Style icons: fix artifacts in media icons
The media svg icons had some unneeded transparent objects which lead to
artifacts during png export/pngcrush optimization. Fix it by removing
the unused objects and re-export the pngs again.

Fixes: QTBUG-122272
Change-Id: I7e63ef53e5a78ce3a06c0053dea98e13c6ba264b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a4b307210f2825f5f53b6d6f8537f27cc9659a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 22:57:30 +00:00
Ivan Solovev
62a8bb3477 Refactor tst_qcomparehelpers
Previously the test consisted of just one cpp file. An attempt to add
more test cases to the file resulted in the minGW compiler complaining
about a too large object file:

 Fatal error: tst_qcomparehelpers.cpp.obj: file too big

This patch splits the implementation into a header and a cpp file.
This itself does not fix the issues, but now we can add the new test
cases in a separate cpp file. This patch also adds some comments
that advocate doing so.

Change-Id: I451987370fa4e18b7ad81dfc064ea016f1d0da47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e26914fa0fe8b6bb2a045a8d37e1b73777a5e0ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 22:57:30 +00:00
Mårten Nordheim
4483e81440 QLocal8Bit::convert{To,From}Unicode[win]: use more of state
Like other backends we should increment the invalid character count
when we output a replacement character.
And we should also output the NULL character if requested!
The downside here is that convertFromUnicode doesn't even have the
ability to do so. So instead I added a comment explaining why it is not
handled there.

Task-number: QTBUG-118318
Pick-to: 6.6 6.5
Change-Id: I57ba631aa59454e77007ab353277b7e8c2b5526a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3c8d71796499a2ca641758dc1e9af4a778c8ef41)
2024-02-16 20:47:47 +01:00
Zoltan Gera
2a950ce36e Android: Do not double finger size for touch events
Fingers in touch events are modelled by rotated ellipses with their
major and minor axes stored respectively. The axis is the diameter of
the ellipse in one direction, not its radius. These values should be
converted to a rectangle correctly, without doubling their extents.
The pair of this fixed code is located in function
QWindowSystemInterfacePrivate::fromNativeTouchPoints().

Change-Id: I4fea7e8168a9c248a744964d4821b774b85a6cf4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9a0098f4b34e88f28d3d5d6d88948dcf8606e7b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 14:45:03 +00:00
Thorbjørn Lindeijer
2cfe7199a2 QGtk3Theme: Fix QGtk3Interface::fileIcon
By failing to set the G_FILE_ATTRIBUTE_STANDARD_ICON attribute, the
"icon" returned by g_file_info_get_icon was always null and a
GLib-GIO-CRITICAL warning was output to the console (at least since glib
2.76.0)[1].

After adding the necessary attribute, the code was crashing, because now
a valid icon was returned, however the icon should not be freed[2],
which is why I removed the "g_object_unref(icon)".

Now it was no longer crashing, but the size of the icons was off. It was
passing GTK_ICON_SIZE_BUTTON (4) to gtk_icon_theme_lookup_by_gicon where
a size in pixels was expected. I chose 16 because that's the pixel size
associated with GTK_ICON_SIZE_BUTTON[3].

Finally I noticed the returned icons had the wrong color. It seems that
a GdkPixbuf uses RGBA8888 format[4]. Adding an explicit conversion to
ARGB32 made the icons look correct for me.

[1] ed8e86a7d4
[2] https://docs.gtk.org/gio/method.FileInfo.get_icon.html
[3] https://docs.gtk.org/gtk3/enum.IconSize.html#button
[4] https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html#image-data

[ChangeLog][Platform Specific Changes][Linux] Fixed file icons provided by QFileIconProvider when using the gtk3 platform theme.

Pick-to: 6.6 6.5
Change-Id: I312ef76ac28bc28435b756d299998485db122906
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 277d77029d7fe8f46c6ee101869dcff389426cb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 14:45:03 +00:00
Christian Ehrlicher
c63ecb05ce QDockWidget: fix dock buttons size
The previous fix calculated an icon size of 12 instead 10 for the icon
size when SH_DockWidget_ButtonsHaveFrame is set. This lead to a too
large icon. It was also rendered blurry because there was no native png
with 12x12 pixels so it has to be scaled.

This amends 04f4b27774ba70ebba425394fa8a1ffdffb2483b

Fixes: QTBUG-122214
Task-number: QTBUG-118643
Change-Id: Iaf332a21681e5b84222299d79d4b28d0c26b0cda
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8eb599566ea983869298fe1f3362918bf0651f11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 14:45:03 +00:00
Tinja Paavoseppä
3d01456b10 Android: Request QtEditText focus when its window is touched
This allows switching focus between different Qt windows,
which combined with the previous changes enables keyboard
focus for child windows.

Task-number: QTBUG-118139
Change-Id: I4b237166dee264a22b2e3dd1ca4d82e0cfce376b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e703feea40108cdd11f8f0270cc82c2aa0e691cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 16:45:03 +02:00
Petri Virkkunen
17e546ac7f Android: QtActivityDelegateBase listens to focus events from child views
In order to detect gaining/losing and moving focus between windows,
implement GlobalFocusChangeListener for the root View.

Add a surfaceFocusChanged native function in QAndroidPlatformWindow in
order to follow these focus changes.

Task-number: QTBUG-118139
Change-Id: Ia9bf6249c28a420f42793a9829aef31b12757630
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2c192c6f5fe08b014bfa90ea0452258e649d3183)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 16:45:02 +02:00
Tinja Paavoseppä
1712c4eeca Android: Move QtEditText to QtWindow
Every QtWindow has its own QtEditText. QtInputDelegate
uses QtEditText from the QtWindow which has the focus.

QtEditText is a View class which handles the creation
of the input connection, and encapsulates other various
keyboard input related functionalities. Previously
we have only had one, which requests focus when the
software keyboard is opened. However, with the
introduction of child windows, it does not make
sense for all the windows to operate through this
one instance.
Furthermore, since it always needs to have focus
to be able to open the software keyboard, this
leads to a bit surprising behavior in the focus
chain if we want to make each window focusable,
not just the top level one. Having each window
have its own QtEditText makes sure when a window
gets focus, the focus doesn't leave outside
of the matching view's own scope, making it easier
to handle.

This should also make it easier to clean up keyboard
input related events tied to a window when that window
is removed.

Task-number: QTBUG-118139
Change-Id: Idd1a9407bc0c48660f2885d3bda28e46d42c08a0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f4050cc5ea7490ba3b8b2bb0a174559d7e72a27e)
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-02-16 16:45:02 +02:00
Lucie Gérard
02ab923adf Change wasm files license
The other files in this directory are non-LGPL

Task-number: QTBUG-121787
Change-Id: I9c319f723dafd7205029d7632c456412d1a3010b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 76a7057bf544e3b35a3b1d6e3cb3fc7be3c2036c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 11:30:13 +00:00
Mårten Nordheim
d059d5c3cb QLocal8Bit::convertFromUnicode[win]: limit fprintf to !NDEBUG
Because there is no other way to stop it from printing the output.

Pick-to: 6.6 6.5
Change-Id: Ie6dcb393351f50691366849ba85d60e2e186f9fb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1dd89bfb04515bd2e431f8915256a417d622288f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 02:31:28 +00:00
Lucie Gérard
fc7157bbee Correct license in widget/kernel
According to QUIP-18 [1], all module files should be
LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
or
LicenseRef-Qt-Commercial OR GPL-3.0-only
LGPD and non-LGPL licenses should not be mixed in a
given directory.
The files in this patch now match the other files
in the same directory and QUIP-18 rule.

[1]: https://contribute.qt-project.org/quips/18

Task-number: QTBUG-121787
Change-Id: Ied60c775fbae38d6edeabc669f782b39d02c28f4
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 039d51835f4c2a3956e929f7ef7f525dccbd7fd5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 02:12:28 +00:00
Andreas Eliasson
cd664a7f39 Doc: Fix readString() and readByteArray() code snippets
Both of these functions return a StringResult, which has no
StringResult::code member. Instead, use the existing
StringResult::status member.

Fixes: QTBUG-122254
Pick-to: 6.6 6.5 6.2
Change-Id: I0b9bfa1fc9a30e9c542ab90f3d8f4243bdeda762
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 57388179a41a169d4f6d65a385f605af31722bf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 02:12:28 +00:00
Ahmad Samir
6816da00a9 QTimer: use QTest::ingoreMessage() for negative internvals tests
Pick-to: 6.6 6.5
Change-Id: I87d095b748a7488a71b22710ab7ed72d9451c769
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 026e1e3fdb8ab2116f7fae28455c7141c926bb88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 02:12:27 +00:00
Tor Arne Vestbø
1c8cb94e4a iOS: Propagate focus changes to VoiceOver
Changing the focus object should update the VoiceOver focused element,
the same way we do it on macOS.

There's no NSAccessibilityFocusedUIElementChangedNotification on iOS,
but we can pass the focused element as an argument when posting the
UIAccessibilityLayoutChangedNotification.

The class method on QMacAccessibilityElement to get an element for
an QAccessible::Id was not used by any callers, and has been modified
to resolve the container from the QAccessibleInterface, so that we
don't need to plumb that all the way from the focus change event.

Inspired-by: Jan Möller <jan.moeller@governikus.de>
Fixes: QTBUG-114608
Pick-to: 6.6 6.5
Change-Id: I2e43ae649bc7e3a44c1e1200e8de66bf420b1949
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a512d1267442e646bb7942291197b2b03f4d1cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-16 02:12:27 +00:00
Shawn Rutledge
82cc779ee6 tst_QTextMarkdownWriter: test both ways of setting font characteristics
We have explicit QFont properties, and QTextFormat::setProperty().
Setting FontFixedPitch doesn't necessarily affect the view (QTextEdit or
Qt Quick Text/TextEdit); and setting the font to the one we get from
QFontDatabase::systemFont(QFontDatabase::FixedFont) is also unreliable,
because the "monospace" fallback might actually be proportional.
QTextMarkdownWriter checks for both to decide whether to use backticks;
so markdown writing works if an editor UI makes the format monospace
both ways to be safe. But in the opposite case that the main font is
actually a monospace font, it's always been broken.

The rest of the QTextCharFormat properties are generally working, to
the extent that they are applicable to Markdown. But we lacked explicit
test coverage: so far we were just reading Markdown or HTML and writing
Markdown to test the writer.

Also amend an old comment about writing underlines: writing was always
possible, and since f5c7799f59ba53c634906b11e2135190093bf87b reading is
supported too. So the underline support is symmetric (except that we
don't heed the QTextDocument::MarkdownFeatures argument to the writer
ctor: we probably should do that some day).

Task-number: QTBUG-54623
Task-number: QTBUG-75648
Task-number: QTBUG-75649
Task-number: QTBUG-79900
Task-number: QTBUG-99676
Task-number: QTBUG-103484
Change-Id: Iacb4ed0ea59030570702d4eadfdadfad872065c6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bf8167c5fc513861ba9ecadf491db256de65eafd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:27 +00:00
Eirik Aavitsland
7fb362ab59 Baseline tests: avoid rendering items that are blacklisted on the server
Blacklisting items on the baseline server would avoid any mismatch
failures for such items. However, they would still be rendered. That
is undesirable if the rendering itself has unwanted side effects for
such items, e.g. crashing the test executable.

Fix by adding new functionality in the baseline testing framework to
allow checking blacklisting status ahead of time, and add a new macro
QBASELINE_SKIP_IF_BLACKLISTED to do just that.

Add usage of that macro to the QPainter baseline test.

Pick-to: 6.5 6.2
Change-Id: I35f6df8cff2c6cb985c25ab5470cd42b53d44940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 4449dbe73704e328c4645f1e9ae7455622b8968f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:27 +00:00
Rami Potinkara
4b5e899114 Android: QtEditText support for full-screen soft keyboard
Full-screen soft keyboard support added. Including functionality
for copy-cut-paste and line change.

Future TODO QTBUG-121522

Task-number: QTBUG-109367
Pick-to: 6.6 6.5 6.2
Change-Id: Ia5632cacc910c7ebde0e40608c2abd027b8f953a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 1f6d7cbb341bd79826d3f6d69e1f1a427ebb8f1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:26 +00:00
Marc Mutz
0fe424a9ae Add fast-path in QLibraryStore::findOrCreate() for !instance()
If there's no QLibraryStore::instance(), then there's no LibraryMap,
so no need to construct a mapName we know we'll just throw away.

We must keep locking the qt_library_mutex to check instance(), but we
can drop it immediately if we find there isn't, and construct the
QLibraryPrivate object outside the critical section (the hope is that
the compiler sees this as an opportunity to tail-call).

The final goal of this exercise is to get rid of the double-lookup in
LibraryMap.

Pick-to: 6.6 6.5
Change-Id: I181dd2657e831a37e2d6f1c5d4df7e2a25ac48cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c9b967437df344b5fc95121a3560a34bf352c696)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:26 +00:00
Edward Welbourne
219fbe7b21 Implement QTZP::isTimeZoneIdAvailable() on Android
The QTZP base implementation of the availability check was to
construct the list of all available IDs, then see whether the given ID
appears in it. This can be very inefficient. The ICU backend has
recently grown a more efficient solution than that, matching the TZ
and Darwin backends. For Android this was still very inefficient, but
its instantiation is cheaper, so simply instantiate and see if the
result is valid. For MS, the backend caches the list of available
zones, so searching the list is a reasonable solution, given the
complexity of its constructor.

Add an implementation for Android and document, in the base-class,
that the fall-back is only suitable for use if the list is cached.

Pick-to: 6.6 6.5
Change-Id: I9dc2ba4be1492ec811c8db6cff9490ac0303115d
Reviewed-by: Volker Krause <vkrause@kde.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7c502391cf73e3fa5bc02ea0b46261f0b5be0b84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:26 +00:00
Laszlo Agocs
be149bfd82 vulkan: Make setEnabledFeatures2Modifier an overload
Change-Id: I74087324e4ea54af0165f3e30b73b2df61104a41
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 38de2c9532d1ae2fa57ad25b088a88dc6eb27769)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:25 +00:00
André Klitzing
eac0a67e82 Fix documentation of used digest and signature algorithm
SHA-256 is used since 2019.
This amends c9f8893000249bd5701674c53d18a823b4a1c629.

Pick-to: 6.6 6.5
Change-Id: I005aa3414e4606045c8c3b01d71547efcf4122ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ad8047daf1eee0263a3749974ed2f33faae6609f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:25 +00:00
Alexandru Croitor
b404d8e361 CMake: Fix AUTORCC_OPTIONS INTERFACE_LIBRARY error with CMake 3.16
Make sure not to set the AUTORCC_OPTIONS property on INTERFACE_LIBRARY
targets, because it's not allowed with CMake versions lower than 3.18.

Amends 329dbfcc78d067d26b5a4dd99f4284900fd68f2c

Pick-to: 6.6 6.5
Fixes: QTBUG-122266
Task-number: QTBUG-106466
Task-number: QTBUG-101353
Task-number: QTBUG-121948
Change-Id: I9ab606c0b11e2b4f8689e0bde9c001f59c81fa42
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b3cc89e81c149533e279df2442a79cc1dfce9ec5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 19:47:25 +00:00
Tor Arne Vestbø
2832ad2f9d macOS: Expand and tighten plumbing of QWindow's requested color space
A QWindow can have a requested target color space via its QSurfaceFormat.
This allows users who know what color space their source material is in,
or who do their own color matching, to ensure a consistent target color
space.

In the past we plumbed this to NSWindow's colorSpace property. This meant
that you could only have one color space per top level, even if child
windows were in play, and we could only set the color space if we were
the ones creating the NSWindow, failing the color space request in cases
where the window was embedded in a non-Qt window hierarchy.

We now store the requested color space in our QNSView, and propagate it
to both the IOSurfaces we use in QCALayerBackingStore, and to the view's
layer, in case it's a CAMetalLayer. We also pick up any changes to the
backing properties of the view, and ensure we update the color space
accordingly.

We still propagate the color space to NSWindow, as for OpenGL we don't
use CAOpenGLLayer (which has a colorSpace property), but instead use
NSOpenGLContext. This is not something we're going to change, so as
a workaround we set the NSWindow color space, which does affect GL
drawing via NSOpenGLContext. The granular color spaces we set on
the IOSurfaces and CAMetalLayer will override the NSWindow state.

Change-Id: I5d9765d95140b8523ee09f70ff09a8c9400ffdc7
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit ef378898454964ce4d66d2656d2d5e4c7ac69b22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 15:27:30 +00:00
Mårten Nordheim
268cc19dc6 tst_QNetworkReply: Try to stabilize qtbug68821proxyError
The test is a bit silly, it was originally written to make sure that
we produce meaningful errors when trying to connect to a proxy server
where the connection is refused or the server doesn't respond at all.

To test that, it creates a local QTcpServer and starts listening to any
free port (by specifying port 0) and then it closed the server and
uses the address-port of localhost:serverPort as the proxy to use, since
we know it _was_ unused, since we were able to bind to it.

However, just calling close() doesn't immediately tear down the internal
socket descriptor, so the OS may still have the port reserved for
some time.

By moving the QTcpServer to a narrower scope we will quickly destroy it
and the internal socket engine, which is parented to the server, and
this in turn releases the socket descriptor.

Pick-to: 6.6 6.5
Change-Id: If12128fc21d1f545df152f08f0d52c1b14ac6037
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 775a57f26682867e183d26863d85eb22a563cdbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 15:27:29 +00:00
Eskil Abrahamsen Blomfeldt
90963387e4 Fix kerning errors when using DirectWrite backend
There were a couple of errors when calculating advances
in the DirectWrite font engine: First of all, we would
apply the CLEARTYPE_NATURAL glyph metrics when using
GDI_CLASSIC rendering, causing text to look compressed
in some places, because we always passed TRUE for the
useGdiNatural parameter to GetGdiCompatibleGlyphMetrics().

In addition, we would pick the GDI-compatible metrics even
when design metrics had explicitly been requested on the
layout. This is the case for distance field rendered text,
which always operates with design metrics and scalable
layouts, so it was visible as kerning errors on some text
there.

Pick-to: 6.6 6.5
Fixes: QTBUG-122139
Fixes: QTBUG-122167
Change-Id: Ic28da6b3235d7af0452bdcb836e037594f8a20ba
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
(cherry picked from commit de3d5dd73b748bc1591447fe81dff6427a86f77b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 13:51:47 +00:00
Marc Mutz
aea4e9788a QVarLengthArray: give the default Prealloc a name
... and use that in QVarLengthFlatMap's definition in lieu of a magic
constant.

Amends d4611ba3a5b46ee790e6c790ef6c3d771d3507ee.

Pick-to: 6.6 6.5 6.2
Change-Id: I369f31b643789075ef6c14669b8b794ed0b3bbb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c30195a95e751552a39f99dd5833ebf722d11bc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 13:24:48 +00:00
Alexey Edelev
c3aa052942 Add configure mappings for QT_BUILD_<TESTS|EXAMPLES>_PROJECT
Change-Id: I1e9f877c4c9b6257f4f90e3361d5a0226e62e841
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7c9efdf40c9d9f7f89f7a9be0c06e0d3ec54ec2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 07:32:38 +00:00
Volker Hilsheimer
72cc294156 AppleIconEngine: fix aspect ratio adjustment
The requested icon might not be square, so fit the image
we have correctly into the requested size.

Fixes: QTBUG-121764
Change-Id: I877dedf5aa779cd82a75a1a49b26c08e3cea6163
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5b993fa8ede67871a8b2434505bc3c3d8bb906c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 07:19:24 +00:00
Volker Hilsheimer
04ecd7d090 Iconbrowser: render theme icons as list with large icons
In icon mode, the name of the icon gets truncated.

Change-Id: I8e2081a68006907ae916c8e8fa1aeb6006acbc6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 477381993a3899c73e240e0fb2dc2b9f67f8cb63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 07:19:14 +00:00
Paul Wicking
ea0814fb7f Doc: Resolve qdoc link warnings
- Drop link to non-existing documentation.
- Reorder links such that the target becomes the text and vice versa.
- Use correct link target names.
- Add missing qttestlib doc project dependency to qtwidgets.

Change-Id: Iaa0ea7b22326c82271b14b17c4b78c3a25a834f1
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit f157422c58475b3b818b0dddc31289e7105967c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-15 07:15:20 +00:00
Tor Arne Vestbø
7cb459ea7e QRhiWidget: Register cleanup callback also on first RHI init
The first time ensureRhi() is called we don't have an RHI yet, and will
adopt the top level's repaint manager's RHI. We need to register a
cleanup callback for this RHI, so that if it goes away, we will
reset our RHI pointer to null, just like when we switch from one top
level to another (and get a new potential RHI).

Without the reset, we would be working with a stale QRhi pointer,
which we in most cases updated via a call to ensureRhi(), that
picked up the new QRhi, but for good measure we should reset it
if we can.

Change-Id: Iac6d8787b636675bbcb4358e8f0baad26187b0e2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 986f8b361ce9d6163f6ef691cad7b2955dcfe5cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:31 +00:00
Tor Arne Vestbø
2d41c622b2 QRhiWidget: Tear down resources before window has changed
We were handling QEvent::WindowChangeInternal, but based on what the
code is doing, what the comments say, and what QQuickWidget does,
the right event should be WindowAboutToChangeInternal.

This fixes a crash when reparenting a QRhiWidget into another widget,
where we could call removeCleanupCallback() on an RHI that was already
gone.

The fact that we have a stale RHI pointer at WindowChangeInternal time
is still problematic, and caused by our call to addCleanupCallback not
happening as it should for the first call to ensureRhi(), but this will
be fixed in a follow up.

Change-Id: I054120e97a24a1f74af44b2d251470792f03f7f3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 6fbbbef260cf71fee05d9e816c069964c6f0b92c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:31 +00:00
Joerg Bornemann
498f5791f6 CMake: Fix custom QT_DEPLOY_TRANSLATIONS_DIR on Windows
Pick-to: 6.6 6.5
Fixes: QTBUG-121880
Change-Id: I7747253ae2671b2d417b25f0a98bc13871a661e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit dd970940baccc08c458bd0e2eea13a54bd2d4d30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:31 +00:00
Joerg Bornemann
f224891038 CMake: Fix custom QT_DEPLOY_QML_DIR on Windows
The value of QT_DEPLOY_QML_DIR was never passed to windeployqt.

Pick-to: 6.6 6.5
Fixes: QTBUG-121881
Change-Id: I993793f74d84ccb0e7c2deb72b1e33e81692ecbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 527b9da5388a3cccb81706becbd8e40977d5db11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:31 +00:00
Mårten Nordheim
b04fe2de61 QLocal8Bit::convertFromUnicode[win]: support more than 2Gi input
As we did for convertToUnicode. To support more than 2Gi input, we
need to handle the input in chunks because of the `int` parameter in the
Windows API. Testing also revealed some corner cases we also need to
handle, which is mostly happening when there is an incomplete surrogate
pair at the end of the current input window.

The test takes between 3 (plain MinGW) and 8 (MSVC with ASAN) seconds
to run on my machine.

Pick-to: 6.6 6.5
Fixes: QTBUG-105105
Change-Id: I4fb0420b88ca41dfa8b561a35c6d96659bd81468
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 496340f33ad48738d1595c5c4048e4a05819786c)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-02-14 20:02:31 +01:00
Mårten Nordheim
5e882b5de9 QLocal8Bit::convertFromUnicode[win]: Pre 2Gi changes
As we did for convertToUnicode, we do some smaller changes, like
increasing indentation, and switching to using pointers and calculating
the input-size in this commit, so that the real changes in the next
commit are (hopefully) easier to read.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I3bf1a487f63a3e24efd7a945152647dd8fc0aca8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit cba0efc2705af1ef027603f7ee4cb60f184412d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 20:02:31 +01:00
Mårten Nordheim
22f2fcd354 QLocal8Bit::convertToUnicode[win]: support more than 2Gi input
To properly support more than 2Gi input we have to support being asked
to resize more than once. Previously we would only have to resize the
one time because we went from our 4K stack buffer to the final size
heap buffer. But now, since our input size can only be specified in
int, we have to deal with looping over the input and resizing the buffer
as needed.

We also have to deal with trailing data at the end of our sliding window
potentially causing issues for the encoding. So we try to shrink our
window when it causes issues, or store the trailing data for the next
call.

The >2Gi test takes about 6-8 seconds on my machine.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I9a44b8f379bf2c2c58183f961544ed2f4c8c7215
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit a7171c62569ac2005560131a17515bb6841e9b98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 20:02:30 +01:00
Mårten Nordheim
0c944d361a QLocal8Bit::convertToUnicode[win]: split out buffer growing
We will need to potentially grow the buffer before appending anything
to it, because if we pass in 0 as a size then the MultiByteToWideChar
just returns the size we would need. If we didn't intend to do so then
we would increment our output buffers even though nothing is written.

And when appending single characters (like the replacement character
for an invalid sequence) we need to grow the buffer as well.

We'll need this all in the next commit.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I94b9a0f7d18a725da01a47398163e6d0f704eefc
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1090d5dd4ae5be898d4566314eda43b0283709d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 20:02:30 +01:00
Shawn Rutledge
a7367e6a3c QTextMarkdownWriter: Don't word-wrap headings
If it wraps, the text on the next line is no longer part of the heading.

Fixes: QTBUG-106526
Change-Id: I8015c948d875c6944422ef3439e3128af5b2a2e2
Pick-to: 6.6 6.5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 65c40290b488395ee7c1fdfabc4d274889d9afab)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-02-14 12:02:27 -07:00
Shawn Rutledge
183ee5c177 QTextMarkdownWriter: Avoid omitting or misplacing ending indicators
If we need to word-wrap a paragraph after a long formatted span,
write any ending markers before the newline (amends
280d679c556ab8ead4748a627d7cd4c1950027fb ).

Break before a fragment if the whole thing is past the column limit;
in that case, write out any ending format markers before the newline.

And now we have test coverage: prepend characters one-at-a-time to a
line that already has a two-word formatted span at the end, and watch
it successively break after the span, in the middle, and then before,
while never putting a newline before the ending markers or failing to
write them.

Fixes: QTBUG-116927
Change-Id: I140e10d19a491cb599bf7ecf8514af866b5383f3
Pick-to: 6.6 6.5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 908fc2e72b34073dc42ce0f2d6f7cc5adc9651d9)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-02-14 12:02:27 -07:00
Ivan Solovev
09236abe2d QVulkanWindow::setEnabledFeatures2Modifier(): pass parameter by value
The method takes an std::function as a parameter, so it makes sense to
pass it by value to avoid copying when passing lambdas.

Amends bd78047df34fda3a56b8db069fc97280831ac696

Found in 6.7 API review

Change-Id: Ic0608a176bfd26b5b44fae48f29d84737e81a413
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit c5d0345c3d6177105c2a6cbb2f99ab6c64d333a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:26 +00:00
Ivan Solovev
40e56294f1 QTimer: do not set active state when setting a negative interval
QObject::startTimer() returns 0 in case of failure, for example when
someone tries to register a timer with a negative interval.

However, QTimer internally uses -1 as an invalid timer id.
This could lead to a situation when the timer was not really started,
but QTimer::isActive() returned true.

This patch fixes it in two ways:
- check the return value of QObject::startTimer() and treat 0 as an
  error.
- do not treat 0 as a valid timer id when calculating the active state.

As a drive-by: move the `using namespace std::chrono_literals;`
declaration to the top of tst_qtimer.cpp, so that we do not need to
repeat it in each test case.

Fixes: QTBUG-122087
Pick-to: 6.6 6.5
Change-Id: I0e21152b2173ebb5fb0dada1b99a903a321ca9c4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 612b67cf13cedb832e082308b620f948377ddf21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:26 +00:00
Philip Schuchardt
86cdd53a6d Synchronize read buffers on non-Apple Silicon in RHI
Read buffers are not automatically synchronized when the
buffer uses MTLResourceStorageModeManaged. This commit adds
GPU to CPU synchronization for managed buffers, ensuring
proper data transfer for reading operations on non-Apple
Silicon devices.

Fixes: QTBUG-119447
Pick-to: 6.6
Change-Id: I6398f4f27d00950c7dceae918b04e0054d4b5647
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f21af7f88b2184a420293967d07bf6552541ddc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 19:02:26 +00:00
Lucie Gérard
233f1de47f Change license in test file
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Task-number: QTBUG-121787
Change-Id: I701e707447ca68977bdd80662200eb0c36545dbe
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ee8822168ce15764693cb4600f445e0605ce0e9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-14 14:23:15 +00:00