Commit Graph

47535 Commits

Author SHA1 Message Date
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
Allan Sandfeld Jensen
b637607789 Fix findNearestColor for semitransparent colors
The two destcolors and the buffer are all already premultiplied. This
would double premultiply them.

Pick-to: 6.6 6.5 6.2
Change-Id: I235bee616d8e0033b87c6f96464f0926af7bd29a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-11-09 18:17:33 +01:00
Eirik Aavitsland
2ac50bb0f5 QPrinter: allow any margins when setting a fullpage QPageLayout
By default, QPrinter::setPageLayout correctly rejects a layout that
specifies margins outside the printable area. However, when the layout
specifies fullpage mode, that check should be skipped, since then one
should be allowed to target the unprintable area, by definition.

Fixes: QTBUG-118580
Pick-to: 6.6 6.5
Change-Id: I8bd93d11aefee0344725ac51c2490d029657f483
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-11-09 16:52:45 +00:00
Allan Sandfeld Jensen
6532dc5d37 Fix multiple threads accessing same byte
We can not thread mono image formats as the bit access isn't atomic.

Pick-to: 6.6 6.5
Fixes: QTBUG-117494
Change-Id: Ica8e08fc3da73983f6b4da2a133f5e715fd0d787
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-11-09 16:52:44 +00:00
Friedemann Kleint
78512135c8 Windows QPA: Fix wheel events when using -platform windows:reverse
Wheel events in WM_POINTER messages use global coordinates.
Move the code doing the RTL correction into the local coordinates branch.

Fixes: QTBUG-117499
Task-number: QTBUG-28463
Pick-to: 6.6 6.5
Change-Id: I10e965da9e9660985eaa2681fcf780b5388299a2
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-11-09 15:59:41 +01:00
Axel Spoerl
c93ab8c2a0 QDockWidget: Remove "group" bool trap
The unplug() and startDrag() functions of QMainWindowLayout and
QDockWidget used a boolean argument specifying whether a single dock
widget or a group of dock widgets should be unplugged. The argument
defaulted to true.

That has lead to inconsistent unplug operations, broken item_lists and
crashes, especially when the methods were called without an argument.

To improve code readability, replace bool trap with a meaningful
enum. Remove default arguments, in order to force explicit calls.

This patch does not change behavior, it is just carved out to
facilitate reviews.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Pick-to: 6.6 6.5
Change-Id: I50341b055f0bb76c2797b2fb1126a10de1fee7dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-09 14:59:41 +00:00
Axel Spoerl
c02f8b9d4d Fully export QDockWidget debug operator
Amends bbeff2a335.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Found-by: Friedemann Kleint <friedemann.kleint@qt.io>
Pick-to: 6.6
Change-Id: I60d8d11a82ff5de8b9641c86b824969fc9a34b91
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-11-09 13:09:55 +01:00
Assam Boudjelthia
b5d615f964 Android: remove redundant manifest android:label tag for <activity>
This is also highlighted by Android Studio Manifest editor.

Change-Id: If159405b0fceeb955e26f3916dd0e96b6ca76003
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-09 12:09:55 +00:00
Christian Ehrlicher
c63a21ae5c SQLite: Update SQLite to v3.44.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.44.0

Pick-to: 5.15 6.2 6.5 6.6
Change-Id: Ibdf8a6e0baf3d2b1bf0f9ffb48e908e2691b6a8d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-11-09 13:09:55 +01:00
Lu YaNing
c524ca342b QXkbCommon: Use isKeypad() to replace duplicate logic
This amends 298c950912 .

Pick-to: 6.6 6.5
Change-Id: I44696464817d6d3f6b1b3a7d005334805fb1cc38
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-11-09 08:18:04 +00:00
Thiago Macieira
8739963c81 QBitArray: fix GCC 13 warnings by improving code
GCC 13 has been complaining that QBitArray could be accessing past the
end of an array (specifically, the 1-element array QByteArray::_empty).
That's caused by the 'QByteArray::data() const' being:

 #if QT5_NULL_STRINGS == 1
     return d.data() ? d.data() : &_empty;
 #else
     return d.data();
 #endif

A way to avoid this is to use operator[], which doesn't attempt to hide
null pointers (it has an assertion).

This is accomplished by writing nicer, more readable code, which is a
nice benefit.

Fixes: QTBUG-118631
Pick-to: 6.6
Change-Id: I85b3fc2dd45c4693be13fffd179579615a6ac98d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-11-08 12:48:13 -08:00
Assam Boudjelthia
5b5f4344da Android: move referral global field to local variable in QtActivityBase
Keep the variable where it belongs, it's not used anywhere else.

Task-number: QTBUG-115017
Change-Id: Ia421eb0cd3f57be3601754f1df11e64f0267fa5d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-08 19:40:18 +02:00
Assam Boudjelthia
4265245506 Android: fix a11y method name notifyLocationChange
Amends 0f3dbd6dc7.

JNI was calling notifyLocationChange(I)V method but it doesn't exist,
instead it was named notifyAccessibilityLocationChange(I)V.

Task-number: QTBUG-118077
Change-Id: Icc29d4aad97e730af7165d5e057d228bee9c8976
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-08 19:40:18 +02:00
Jan Grulich
63fa92f2ef QCryptographicHash: fallback to non-OpenSSL implementation for Keccak
Current versions of OpenSSL 3 don't support Keccak hashes as these are
going to be introduced with OpenSSL 3.2 so we should rather fallback to
the non-OpenSSL implementation instead of using SHA3.

Fixes: QTBUG-118814
Pick-to: 6.5 6.6
Change-Id: Iedeb81cd76d43d920fc10e1efdac261bc12a394c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-08 18:40:14 +01:00
Jøger Hansegård
70404a2773 Prevent oversized QToolButton menu from moving to primary screen
The QMenu pop-up used with a QToolButton could unexpectedly move to the
primary screen if it was too big to fit on the owning widget's screen.

The cause of the issue is that QMenu is a top-level window, and can not
infer its screen from any parents. Its positioning is therefore done
using heuristics in QToolButton. These heuristics attempt to calculate a
best guess point relative to the screen that contains the QToolButton.
If these heuristics result in a point that is outside all screens, the
QMenu's own screen takes precedence, and this is always the primary
screen. This way, the QMenu ends up at the calculated position, but
relative to the wrong screen.

This patch works around this issue by ensuring that the first estimate
for the pop-up position is always within the same screen as the
QToolButton. The danger with this workaround is that the menu may end up
in an inconvenient location. This does, however, seem to be handled by
subsequent adjustments in QMenuPrivate::popup.

Fixes: QTBUG-118695
Pick-to: 6.6 6.5
Change-Id: Ibb4a1c82e827c57bbb0798a6c6f5eecb6d639c62
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-08 18:24:18 +01:00
Jonas Karlsson
a8df174369 QHeaderView: relayout on resetDefaultSectionSize
We now call setDefaultSectionSize with the new default section size.
This clamps the value to min/max section size and it will resize
affected sections.

Pick-to: 6.5 6.6
Fixes: QTBUG-116013
Change-Id: I39849aca8d0672629ce0b3ca244038c27e045d4b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-08 18:24:17 +01:00
Wladimir Leuschner
7e8ae9cf12 Use Desktop Handle in case of no valid app HWND for QPrintDialog
The call Win32 API PrintDlgEx needs in the PRINTDLGEX struct a valid
window handle for hwndOwner to show up. In case there is no window
created, as seen in the example, the call to PrintDlgEx fails with
COM error code E_HANDLE. Using the Desktop HWND, in case of no valid
app HWND creates a valid call to PrintDlgEx with showing up the dialog.

Pick-to: 6.6
Fixes: QTBUG-118899
Change-Id: Ie7009c8e6e8285a0b6312e310b3d065c532f9e17
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-11-08 18:24:17 +01:00
Timur Pocheptsov
3159b337f0 Openssl V3: try to work around the lack of SHLIB_VERSION_NUMBER
It's no more defined in opensslv.h, try to use OPENSSL_SHLIB_VERSION
instead.

Pick-to: 6.6 6.5
Fixes: QTBUG-116295
Change-Id: Ie465f4147e0ec95897bd8d35f71241884bf64b4e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-08 18:24:17 +01:00
Friedemann Kleint
01d55f0203 Windows QPA: Emit QGuiApplication::primaryScreenChanged()
Patch as contributed.

Pick-to: 6.6 6.5
Fixes: QTBUG-93368
Change-Id: I8cc884e64e84128b125415e78e3a34245ae4e626
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2023-11-08 18:21:30 +01:00
Ivan Solovev
e85a3cde2f QSharedMemory: fix attach() -> create() for non-legacy SystemV mode
The problem with non-legacy mode is that the backend uses the same
filename for the system semaphore file and for the shared memory file.

What happens is that when we try to call attach(), a semaphore is
created. Later in attach() we set unix_key, because ftok() returns
a valid handle (it uses the file which was created for semaphore).
After that, an attempt to actually attach to a shared memory fails, but
no clean-up is done.
So, a later call to create() sees that unix_key is already valid, but
it cannot properly clean it, because it does not actually refer to
any shared memory.

Fix it by cleaning up unix_key and nativeKeyFile if shmget() call in
attach() fails.

Pick-to: 6.6
Change-Id: Ibccc3ac307d8b2e07e1b9b24b55f97a859a03131
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-08 15:56:54 +01:00
Laszlo Agocs
92167f0119 rhi: Add a flag to suppress D3D11 smoke test warnings
Applicable to D3D11 only, although the flag is general enough that
other backends could use it if it made sense for them.

This allows Qt Quick to state that warnings about QRhi::create()
failures that lead to retrying with a different set of flags
(PreferSoftwareRenderer to get to use the WARP software rasterizer)
should be suppressed and turned to regular categorized debug prints.

Other users, e.g. an application directly working with QRhi may not
want this. A create() failure must be complemented by an unconditional
qWarning since normally that is pretty serious error. Hence the opt-in
flag.

Task-number: QTBUG-117926
Change-Id: I808bd1670b631e2068b566ab08589e1783f62ca5
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-11-08 14:15:18 +00:00
Axel Spoerl
bbeff2a335 Extend qDebug functionality for QDockWidget
Add features and floating flag to QDockWidget debugging.
Debug dockwidget parents of a group window.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Pick-to: 6.6
Change-Id: If2a6caacf5d02f9018c2a3073fdbc1de39bce1ee
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
2023-11-08 15:15:18 +01:00
Samuli Piippo
f0b2c5f21c tslib: generate event with correct buttons and event type
Tslib doesn't give button and movements events separately, so send
the first event with pressure as MouseButtonPress, subsequent events
as MouseMove and event without pressure as MouseButtonRelease.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-111952
Fixes: QTBUG-113307
Change-Id: I7ed6e37936887e11affb254d2fca74c79b6a43b9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-11-08 13:40:44 +02:00
Christian Ehrlicher
5a5c96c65d Add QPixmapIconEngine::isNull()
Reimplement the virtual function QIconEngine::isNull() for
QPixmapIconEngine. This lets QIcon::isNull() return true when no pixmaps
are loaded during QIcon::addFile() e.g. due to a wrong filename.

Pick-to: 6.6 6.5
Fixes: QTBUG-118667
Change-Id: I29f2c492e55b60638507fa398ef7af76f4e9ff48
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-11-08 11:11:48 +01:00
Christian Ehrlicher
a5a925bf2e QWidgetWindow: pass QPointF to QMouseEvent
QWidgetWindow::handleMouseEvent() passed a QPoint to QMouseEvent which
might result in a wrong result on high-dpi displays. Since the incoming
event has a correct QPointF coordinate, use this for the QMouseEvent

Pick-to: 6.6
Fixes: QTBUG-106262
Change-Id: Idbfdab19220cb06aa0a28eef4e6ab4cab1035d97
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-08 11:11:48 +01:00
Christian Ehrlicher
90822833f3 QCheckBox: Don't emit checkStateChanged when nothing changed
QCheckBox::checkStateChanged() was emitted with msvc even though the
check state was not changed due to a faulty comparison.
Amends: 37b47ebf94

Pick-to: 6.6
Fixes: QTBUG-118716
Task-number: QTBUG-104688
Change-Id: Iafeabeb9214f6c7510ea4ed87fabb7dc0ba175a6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-11-08 11:11:48 +01:00
Alexey Edelev
c8c8299a63 Re-enable LTO for gcc versions >= 10
Assume the related GCC version is fixed.

Fixes: QTBUG-118851
Change-Id: I0160440c5e8a0341ec5bc2ab9ea6fed9a2325bba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-08 08:04:07 +01:00
Gleb Popov
295e56201d Implement QDBusAbstractInterface::setInteractiveAuthorizationAllowed
Task-number: QTBUG-100458
Change-Id: I48d6f17943a554c1173d16a2320eb460c3d5c387
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-07 19:49:34 +00:00
David Faure
889c3e2e5b QMimeDatabase: update freedesktop.org.xml to shared-mime-info 2.3
... and update the unittest accordingly.

Compared to the 2.3 release there 2 fixes in freedesktop.org.xml,
due to issues discovered when running tst_qmimedatabase:
* Give higher priority to the more specific image/apng magic
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/262
* Lower priority for text/x-mpsub's magic
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/263

Task-number: QTBUG-118616
Change-Id: I56053b343619a8a711af28e6490c160d13169734
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-07 16:04:03 +01:00
Ivan Solovev
fb1dcbfcba QSharedMemory: fix attach() -> create() for legacy SystemV mode
The attach() -> create() sequence was not covered by unit-tests in
qtbase, but this approach is used inside QSharedImageLoader.

It turns out that 02c42b26e1 broke this
usecase for legacy mode, and the create() triggered an assertion
in QSharedMemorySystemV::updateNativeKeyFile(). Fix it by clearing
the nativeKeyFile if ftok() call in QSharedMemorySystemV::handle()
fails().

Add unit-tests for the attach() -> create() scenario.
These tests revealed that this scenario fails also in non-legacy mode
for SystemV, so add QEXPECT_FAIL for these cases for now. This will
be addressed in a separate patch.

Pick-to: 6.6
Change-Id: If133fa56c82eba902374dc48d2757046b3d40baf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-07 15:43:05 +01:00
Ivan Solovev
aa8dfc5589 QDate: fix condition in conversion between chrono types and Julian Day
Surely, sizeof() returns the number of bytes, so we need to multiply
by CHAR_BIT if we want to compare with the number of bits.

This commit amends c4f7dba81e

Task-number: QTBUG-118221
Change-Id: I2cca75bfed7f0554f6cffd22cc06475ffc9c6e43
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-07 14:42:16 +00:00
Tasuku Suzuki
2db7a5ebfb Fix build with -no-feature-shortcut
Change-Id: I43b95991fcf37ac8b125b176a59518e6a81e11dc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-07 09:59:06 +09:00
Alexey Edelev
a8118caad6 Remove forward declared QHash
Fixes the complication issue since the typedef was used as class member.
Replace the typedef with using statement.

Fixes: QTBUG-118627
Pick-to: 6.6 6.5
Change-Id: Ie3d341fb8f18a7341d018f51947127ace941a620
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-06 22:44:35 +01:00
Edward Welbourne
be55fbede9 QTZ/Darwin: Make available-ID checks cheaper
Previously we've checked whether an ID is available by computing the
full list of all known available IDs (converting each from NSString to
QBA in the process) in order to compare the offered ID to each of
those in turn. This is a significant performance bottle-neck

Simply trying to construct the NSTimeZone instance should suffice to
determine whether there is such a zone; if the ID is not available, we
apparently get back a null pointer, which is easy enough to test for.

Pick-to: 6.6 6.5
Fixes: QTBUG-118759
Change-Id: Ib272c96e25db9640490299c638e2e9196a58712f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-06 20:50:44 +01:00
Wladimir Leuschner
c88211d1e4 Restore WindowState when changing SurfaceType
Restore the WindowState, when a Window has to be recreated due to
changed SurfaceType.

Fixes: QTBUG-118194
Pick-to: 6.6 6.5
Change-Id: I40ba552cda9dfc8ab543611595c068f80b8fa1d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-11-06 20:50:44 +01:00
Assam Boudjelthia
0f3dbd6dc7 Android: remove a11y methods from QtNative, call a11y delegate direct
Remove yet another two layers of delegation, QtNative calling
QtActivityDelegate and that in turn calls QtAccessibilityDelegate.
Now from c++ native code, acquire the a11y delegate and use it to
call a11y operations that live in QtAccessibilityDelegate.

Task-number: QTBUG-118077
Change-Id: I9e84520c2caa281a6f786a687b0106d702f92a67
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-06 19:59:51 +02:00
Jan Grulich
ddb1c75afe QCryptographicHash: Do not rely on auto-loading of the default provider
When using OpenSSL implementation, we were assuming the default provider
will be automatically loaded, but this is not going to happen after it
gets unloaded. Even the documentation says that automatic loading of the
default provider occurs max once and if it's explicitly unloaded, it
will not be automatically loaded again. In our case we are explicitly
loading and unloading the provider after MD4 hash is used so using it
afterwards we will always fail.

Fixes: QTBUG-118227
Pick-to: 6.5 6.6
Change-Id: I8107b9ab02321b57978c3d25a061672fd2a7aee8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-06 18:59:51 +01:00
Volker Hilsheimer
93a6cd8bdf JNI: allow QString as a parameter to native methods
Expect a jstring on the va_list, and implicitly construct a QString from
that.
As a drive-by, allow native methods to take parameters by reference, and
move implementation details into a Detail namespace.

Add test coverage.

Change-Id: I31214938ccaea3f4d539b432e29d12434dd98377
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-07 01:59:51 +08:00
Mårten Nordheim
e579cdceb8 QLocal8Bit::convertToUnicode[win]: Pre-2Gi changes
Prepare the code for the upcoming changes to support strings longer
than 2GiB.

We will have to loop from start to end, and increment the pointer
whenever we succeed, rather than assuming there is a single success
before we return.

This also means the error-handling code goes into an else-branch and
gets indented.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: Ibe49cc661f582fd54ce36ad466cf798a62b5c4c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
6f48233482 QLocal8Bit::convert*Unicode[win]: Converge logic
I ended up writing different logic for similar things.
And using points_into_range doesn't work if we, by coincidence,
point at end, though this shouldn't be possible yet, but it may happen
once we support input larger than 2Gi. So, let's instead check if the
destination buffer has been initialized.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I28c367eb965339ae84355c0cac27c5d0352d9271
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
10f5e4f809 QLocal8Bit::convertToUnicode[win]: Support stateless flag
By just setting state to nullptr.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I6b4f8fe39f1ba51dcfaf98ce7e42c2acd4c4cf98
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
127e6cc907 QNonContiguousByteDeviceThreadForwardImpl: reset m_atEnd during reset()
Because otherwise the atEnd() function will return true if we finished
an upload, and then we reset due to an error and try to upload again.
In a future patch we rely on atEnd() returning true only if the data
has actually been consumed, so re-uploads will not work correctly.

Pick-to: 6.6 6.5
Change-Id: Id914648f2509dd112b6bfc71231caa59cbe8ae68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
3ea46fa978 Schannel: Return if socket is invalid
In a couple places we already check if the socket is connected,
however we can be connected _and_ have the socket be closed.
The logic behind that I don't really understand, but there are
similar checks for validity in the OpenSSL backend.

This happens when calling close() on a still-connecting
socket. The QIODevice is marked as closed, but the connection
cannot yet be aborted. And when it finishes connecting we
handle the signal, start encryption, and then disconnect.

Pick-to: 6.6 6.5
Fixes: QTBUG-116550
Change-Id: I06c0a2db32bea0b573a99a971b8fb0b66a7a73d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
c31227a548 QNetworkInfo[win]: Advertise Metered feature
I forgot to add this to the features list when adding support for it.

Amends d2c5494c3d

Pick-to: 6.6 6.5
Fixes: QTBUG-118741
Change-Id: Ieabf086ef66777e6178476934b88448ad88bc738
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Mårten Nordheim
747dd2460b Http: simplify check for preconnect request
Change-Id: I132533b9bc1f2b4d66f94599efb04def571cd2ff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Laszlo Agocs
bd78047df3 QVulkanWindow: Add a way to control post-1.0 Vulkan features
So now instead of filling out a VkPhysicalDeviceFeatures and
sending it in via VkDeviceCreateInfo::pEnabledFeatures,
we rather create a VkPhysicalDeviceFeatures2, which contains
a VkPhysicalDeviceFeatures (for 1.0 stuff) and a pNext
chain, and chain it via pNext to the VkDeviceCreateInfo.

QVulkanWindow will not do anything with post-1.0 features
by default. (in this regard it deviates from the QRhi
Vulkan backend which already tackles 1.1, 1.2, and 1.3
features as well, but this is not going to change)

However, applications may want to enable some of those still.
To enable this, add a new callback. When set, the callback is
invoked and the alternative behavior described above is
activated.

Fixes: QTBUG-117966
Change-Id: I8560a6b23421f545ee760e714cbe2ec2f6078406
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-11-06 18:31:54 +02:00
Christian Ehrlicher
597de2b1dc QTextEdit/Browser: use pmf-style connects
Use pmf-style connections instead old string-based ones.

Change-Id: I80b36272e129589b735ec63d23c264b1e3e4bea2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-05 21:16:35 +01:00
Christian Ehrlicher
d759c5c5ac QTextEdit: remove unused member 'textFormat'
The member 'textFormat' is not used since Qt4 so remove it.

Change-Id: I019db92ede108fbce26d55ad4ae9a3f1a59e54b0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-05 21:16:33 +01:00
Christian Ehrlicher
c96ef6aee6 QFontCombobox: misc cleanup
Cleanup QFontCombobox:
 - use pmf-style connect
 - use range-based for loop

Change-Id: I9ec87fbca2b0e6d52f0a4cbae07cc0624dc0f6bc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-05 21:16:31 +01:00
Christian Ehrlicher
6780195d4e Widgets: use pmf-style connect
Use pmf-style connect for some easy-to-convert connections.

Change-Id: Id0a9d3465b2dfe5966374194a72980a67e978fe8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 19:01:23 +01:00
Christian Ehrlicher
05d69ad42b FusionStyle: use std::array instead QVarLengthArray
Replace QVarLengthArray with std::array since there is no reallocation
needed.

Change-Id: Ifd53763e230efd61683c08654f0741beae4b6df2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 19:01:22 +01:00
Christian Ehrlicher
4a32f8b806 QStyle: cleanup iconFromApplicationTheme()
Cleanup iconFromApplicationTheme() by merging the code paths for
SP_DirLinkIcon and SP_FileLinkIcon.

Change-Id: If4c8c850516971a80dffcc59cff7cabdace94585
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 19:01:20 +01:00
Christian Ehrlicher
fea9109b3b QWindowStyle: misc cleanup
Misc cleanup in QWindowsStyle:
 - use range-base for loop
 - use std::array instead raw c-array
 - use std::swap instead custom implementation

Change-Id: I479c014d4e19556e1c0a6ce3fbb8ddacd4e179ae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 19:01:18 +01:00
Christian Ehrlicher
acdef6669f FusionStyle: re-add icons for dockwidget titlebar
Re-add the icon for dockwidget titlebars as png images in different
resolutions to avoid a blurry icon on high-dpi displays. Also add the
source svg.

Task-number: QTBUG-118122
Task-number: QTBUG-118643
Change-Id: I24f710e3c7390762c7079c0e153f015475347591
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 17:55:17 +01:00
Ahmad Samir
9e1210752f QSingleShotTimer: port to chrono
Use std::chrono::ceil<milliseconds> to match what
QDeadlineTimer::remainingTime() did.

Drive-by change: make a method private instead of protected, nothing
inherits from this class anyway

Change-Id: I605b7c25ea7501ee92518ec9f0ff049ed810bfb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-04 18:22:24 +03:00
Ahmad Samir
b13c46d6ef QStorageInfoPrivate/Linux: de-duplicate some code
Change-Id: Ie0fe0c80a61c123c12242f24830ca622a726d7ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-04 16:46:05 +02:00
Ahmad Samir
e34c2429c8 q20chrono: remove a redundant comment
Change-Id: I6717f508c6b44878e5f9b0d8663f85d2a847fa5e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-04 17:46:05 +03:00
Ahmad Samir
4c6dfc05df QLatin1StringMatcher: handle from index < 0
indexIn() could hit UB if `from` < 0, so handle that case too. (This
also makes using noexcept for that method more correct wrt the Lakos
rule). While I think that passing valid indexes to a method is the
responsibility of the caller and that the existing API in Qt where a
negative index is interpretted as "search from the end" is
hard-to-use/bad API, not handling `from < 0` this way will most likely
not pass review (c.f. commit 81538c5219b92356c52233a80845847145795d6f on
gerrit). I'd rather get this over with so that an indexIn(QSV) overload
can be added...

Change-Id: Id85d18c901c82d9652804ecff7bfe7c71c10a63c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-04 17:46:05 +03:00
Christian Ehrlicher
04f4b27774 QDockWidget: fix dock buttons size
The size of the dock buttons did not account the
SH_DockWidget_ButtonsHaveFrame style hint and therefore was too large
when a full 16x16 icon was used (which was the case after the latest
style cleanups) and therefore appeared too large.
This also allows the remove of the hack for the windows style. The
windows vista/11 style is not even affected by this hack because there
the size comes from windows itself and can not be modified via
PM_SmallIconSize.

Fixes: QTBUG-118643
Task-number: QTBUG-118122
Change-Id: Ie09a6a4e89df66b5393c5a57735002da47415c0e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-04 11:00:04 +01:00
Tim Jenssen
91fe6fb2e1 Schannel: Avoid crashing for unparsed certificate
Crash reports imply the `certBackend` we extract in
QSslCertificate_from_CERT_CONTEXT is null, which means that
something went wrong when parsing the certificate data we get from
the certificate chain.
We assume the rest is okay since it must be inside the bounds of the
length of the chain.

It's not clear why the certificate would be invalid, but it's better
to avoid the crash for now.

Pick-to: 6.5 6.6
Task-number: QTBUG-118569
Change-Id: I76ce07fc38bf82ef5c93097d839724ddee1edeef
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-03 23:30:16 +01:00
Kai Köhne
ed7912dbe0 Doc: Replace wrongly spelled word
It's actually 'lexicographically'. But 'alphabetically' is a more common word.

This was brought up in https://forum.qt.io/topic/151834/what-s-lexographically/5

Pick-to: 6.5 6.6
Change-Id: Ibeb0e4463e12b54c1c10ac7df268e4d62b6ce49f
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
2023-11-03 18:02:18 +00:00
Edward Welbourne
8392e0ed94 QLocale/MS: extract function to save some repetition
With one exception in a kludge-around, substituteDigits() calls were
always subject to the same condition, so wrap that in a trivial method
and simplify the code calling it.

Change-Id: I6d8f3ca9179e32f03348cd718f9ee9de573221b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-03 18:27:14 +01:00
Edward Welbourne
a527ab6652 QLocale/MS: polish some arrays and their access
The arrays can be constexpr, and we can avoid some repetition by
making only the choice of which to look in conditional, when we do the
same thing thereafter.

Change-Id: I8c9f95b3967017cf67a76de9d2a7a8729ee430f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:14 +01:00
Edward Welbourne
385626d642 QLocale/MS: return null variant, not empty string, on failures
Likewise for the string list in uiLanguages(). Document the exception
(for grouping separator) and the other corner case (currency symbol).

In commit 089bbfc307 we changed the
system locale look-ups to rely on backends to return null QVariant on
failed look-up, but the MS backend has several places where it would
return an empty string for lookups that really shouldn't.

Pick-to: 6.6 6.5
Fixes: QTBUG-118703
Change-Id: I1a5622beebc4e5639d643250829937a829e23363
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:14 +01:00
Edward Welbourne
905fb43594 Include offset-zone's ID in the available IDs for an offset
While it would be perverse for availableTimeZoneIds() to list all
supported UTC-offset zone IDs, it makes reasonably good sense for its
offset-specific overload to include the ID QTimeZone would use for the
relevant UTC-offset, since passing this ID to the ID-based constructor
will indeed get a zone with this offset. In particular, it already
does include the offset-zone's ID if there is an IANA UTC-offset zone
with the given offset; and its list is apt to be empty otherwise.

Only applies to IDs we would in fact accept, checked with
offsetFromUtcString() to match the QTZ constructor's check.

Change-Id: I77bb60b166c3d3af5824d84952e1e10a5d32a5ad
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:14 +01:00
Edward Welbourne
df73672f97 QTimeZone(qint32 offsetSeconds): use IANA ID when one is available
Principle of least surprise: prefer IANA IDs over synthesized ones.
This also aligns what id() returns more nearly with what
availableTimeZoneIds() reports. Amend some tests to match the new
behavior, extend one test to verify id-round-tripping (also for the
IANA zones) and another to verify single-digit offset IDs get
zero-padded.

Document the complications in how id() relates to what is passed to
the constructor. (It was already complicated; the present change just
aligns it better with IANA IDs, where possible.) Mention, in
availableTimeZoneIds(), that (and why) it only includes IANA's offset
IDs. Drive-by: fix a typo in another availableTimeZoneIds() overload's
doc.

[ChangeLog][QtCore][QTimeZone] When created from (only) a UTC offset,
or from (only) a non-IANA UTC-offset ID, a QTimeZone instance now uses
an IANA UTC-offset ID, where one is available with a matching offset.
Previously it used a synthesized UTC±hh[:mm[:ss]] one which would omit
trailing :00 for minutes or seconds, which the IANA ID may well
include.

Task-number: QTBUG-118586
Change-Id: Ifc4976f36361c830c88a8bef0e8b963fe5a2ab43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:14 +01:00
Edward Welbourne
e45d05dfc0 Convert UTC offset table look-ups to binary chop
The table was almost sorted by offset - its UTC entry, with offset 0,
was at the front rather than first among the offset 0 entries. The
lookups in it were being done as if the IDs were in space-joined lists
(as for the IANA IDs in the Windows table), splitting on space,
despite the fact that it had separate entries for different IDs at the
same offset (this only arose for offset 0). So actually massage the
input table in python to combine IDs with the same offset using space,
placing UTC first among the offset 0 entries, and ensure the C++ table
is sorted. Regenerated the CLDR data tables using the updated script.

In the process, fix an off-by-one error in the iteration over
space-joined IDs, where the search only advanced to the space, rather
than to just after it. That wasn't a problem before, but now would be.

Change-Id: Ib49c27bac269b557166fa10738c3e396d58456c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:13 +01:00
Wladimir Leuschner
5165a5802c Introduce dark mode to QWindows11Style
Introduce dark mode to QWindows11Style and increase frame contrast on
highcontrast themes.

Change-Id: I18d10a314fb11828b8c3a116396e2d3cd2247b65
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-11-03 18:27:13 +01:00
Assam Boudjelthia
510cc564c0 Android: add missing extras native methods impls and registration
This should have been done when the extras where moved to qtbase,
it went under the rug and was forgotten.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114971
Change-Id: Id7831a8bab8bedc1f869b9fc8bfc72acc3cca7a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-03 18:16:38 +02:00
Kalle Viironen
e51cd47ed3 Make checkBlackLists() return bool
Make checkBlackLists() return true if the test is blacklisted and false
otherwise.

Change-Id: Ief400a10a47ec7c21ea1d37fe75c7dc08739e06c
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-03 16:31:57 +03:00
Anton Kudryavtsev
90e1e1ee86 qhttpnetworkreply: remove unused findChallenge method
This method is part of private API, so it's safe.

Change-Id: Idc7464a825841db2fa9dddd47d6dbda82668601d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-03 14:44:54 +03:00
Shawn Rutledge
83b592346b Modify the MDI manual test to allow multiple views of same document
- editing same document in different views is possible? yes
- resizing one QTextEdit calls QTextDocument::setTextWidth(), which
  affects the width in the other view too. You can resize either one,
  but you can't have two views with different layouts, of course.

Added a categorized log message in QTextDocument::setTextWidth()
for a sanity check.

Task-nunber: QTBUG-35688
Change-Id: I59c4d10143fda3a66b946237832274d67f9d9d45
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-02 20:49:32 -07:00
Thiago Macieira
a0a29695ab QProcess/Unix: also ban vfork() under TSan
Complements 94ec17436c for the ASan logic
(52ed6af527 for the code change).

Fixes: QTBUG-117533
Pick-to: 6.6
Change-Id: I09c3950e719e4b259bc7fffd1793d59dbdbfe82a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-02 20:49:17 -07:00
Alexey Edelev
c861f9acef Mention QT_FORCE_FIND_TOOLS in QT_HOST_PATH
Document requirement of setting the QT_FORCE_FIND_TOOLS option to
ON to reuse the pre-installed Qt version when not cross-compiling.

Task-number: QTBUG-118211
Pick-to: 6.5 6.6
Change-Id: Ia02abeaede583ca01f10187158da0f4bc86f9d1a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-02 21:14:10 +01:00
Ivan Solovev
02c42b26e1 QSharedMemory: fix semaphore creation in legacy mode
The legacy mode was using the new nativeKey to create a semaphore.
As a result, on macOS the name of the semaphore key file was the same
as the name of the shared memory key file.
This lead to a situation when the file was mistakenly deleted when
destroying any instance of the shared memory, not only the one that
created it.
Fix it by using QSystemSemaphore::legacyNativeKey() in legacy mode.

Add a test to verify that we cannot re-create a shared memory with the
same key. The test was failing on macOS without the fix.

Fixes: QTBUG-111855
Pick-to: 6.6
Change-Id: Ib0bc41791e889b1888bbb8aa9044c6b053b63a5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-02 21:14:10 +01:00
Assam Boudjelthia
742f45f7cf JNI: pass same QJniEnvironment object to QAndroidPlatformClipboard
... registerNatives() call.

Change-Id: I42539846249880ed4a215522bdcafb3a2ffa4d14
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-02 21:46:32 +02:00
Assam Boudjelthia
bc8f0911a9 Android: make System.load() error logs use Log.e() instead of Log.i()
Make the logs visible as errors as they should be.

Task-number: QTBUG-115016
Change-Id: Idfaddbc3bdd3b218ae961b1a5cce9540a4710c39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-02 21:46:32 +02:00
Yuhang Zhao
8842391e5c windeployqt: improve MSVC runtime detection
MSVC runtime dlls also include vccorelibXXX.dll, concrtXXX.dll,
beside these traditional dlls, it's also possible to link against
the new UCRT runtime, the ucrtbase.dll (and possibly including
the API Set dlls), so we need to add some more checks to make
windeployqt more robust. I've tested a custom Qt build locally,
which I managed to make it link to ucrtbase.dll only, and this
code works fine.

Pick-to: 6.6
Change-Id: I00bc8666d8850aac279b8747465879e39348ba02
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-11-02 16:49:40 +00:00
Assam Boudjelthia
58c7249ee8 Android: move display and screen management to new QtDisplayManager
Have all or most of Android code dealing with displays in
QtDisplayManager. Also, simplify setApplicationDisplayMetrics()
call and avoid caching any uneccessary members.

Task-number: QTBUG-118077
Change-Id: I943069c24bb40ae3016db5896e553b501e700a6b
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-02 16:13:22 +02:00
Yuhang Zhao
7b77a1c2a6 QOSV: Add Win11 23H2
Windows 11 23H2 (10.0.22631) will be released publicly soon,
it's better add it to Qt now.

Pick-to: 6.6
Change-Id: I1bcec19d3a15e778f2c5e504d1e5cf678753f5a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-02 12:26:59 +00:00
Friedemann Kleint
d7ebe91781 uic: Port enumeration lookups to QLatin1StringView
This makes string operations on them easier.

Pick-to: 6.6 6.5
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: I92922b701fd72f5521eee7f6d3ef63492e03be9b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-02 11:50:43 +01:00
Anton Kudryavtsev
4fad57e750 QStringView: add isLower and isUpper
[ChangeLog][QtCore][QStringView] Added isLower() and isUpper()

Change-Id: Ie6cd20bd375d42cbdfb17953b2307d025c31ec77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-02 13:50:42 +03:00
Bartlomiej Moskal
d10d76f9f2 Android: Hide text handle when it is out or covered
The text handle should not be visible in case when it is out of
the text-object, or when it is hidden by other object. That is why we
should call updateSelectionHandles() method after touch only in case
when cursor position fits to clipped input item rectangle.

Fixes: QTBUG-115005
Pick-to: 6.6 6.5
Change-Id: I35c083acd8fd4d5240e3bb15afa1afbec4ea0b26
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-02 10:16:32 +01:00
Mike Chen
9161f66a49 xcb: unset states and set new ones as need
Should not unset all the old state and set the new ones.
Only unset the state that needs to be unset.

If states changes from maximized to minimized, there is no need to
unset the maximized state and set the maximized states again.
(minimized and maximized can exist simultaneously :)

This amends f61b140482 .

Pick-to: 6.6 6.5 6.2
Change-Id: Ic93122b92fafcdba973b885e299b282408da7a1c
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-11-02 05:59:49 +00:00
Liang Qi
78272c667f xcb: implement QXcbCursor::size()
A follow up of baed8534bc .

Fixes: QTBUG-118612
Pick-to: 6.6 6.5 6.2
Change-Id: I7b4a2276c6e6a14d5413f6cd64d801de11cc8c3e
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-01 23:52:23 +01:00
Anton Kudryavtsev
3c80e88924 qnetworkcookie: remove parseCookies
that takes QBA in favor of QBAV version

Change-Id: I56bbe5cc5c7fa3e31e6b6e71d97211de3eb1ab26
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-02 00:19:07 +03:00
Christian Ehrlicher
7b96f3934c QDockWidget: use pmf-style connect syntax
Use pmf-style connect syntax for the three connections within
QDockWidgetPrivate.

Change-Id: I091a210d6a822903f0cc183f9090e03b124875e6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-01 21:58:13 +01:00
Edward Welbourne
0de55973d3 Amend #if-ery to exclude MS QTZP backend declaration when not in use
Since 2017 we've been using the ICU backend in preference to the MS
one, so there's no point declaring the MS one when it's not being
compiled.

Pick-to: 6.6 6.5
Change-Id: Ia7b770ec27bb627caace814b972967c4f7d63330
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Anton Kudryavtsev
ec8e3e535d qurlidna: port some internal functions to QSV
Change-Id: If9c0090589cd58738165f2fe71701dba6958575c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
d0b90663a4 qarraydatapointer: use use std::exchange more
to simplify code

Change-Id: I7fc6dd92922eb30a16260544223c1dbfc3162188
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
f331171dd7 QString::fill: port to char16_t
Change-Id: If91ea7b7ceedbf9ed109b064ea5ea5572e7c9b14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
ebbd9ddf88 qhttpnetworkreply: use QBAV more
to reduce allocations

Change-Id: I89879a68626631970d34bbc0357528dcbb8b1c17
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
d3ec9fd359 qhttpnetworkreply_p: port parseStatus and parseHeader to QBAV
Change-Id: Ib3bb2d29460827f9dfceb51975ce822d8a41aba0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
8f6b30ec8d QNetworkReplyHttpImplPrivate: de-duplicate literals
While touching code, use CaseInsensitive compare more to avoid needless tmp allocation

Change-Id: I4fe8496133925887df6879b48c730c36f486fa9c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 20:05:38 +00:00
Anton Kudryavtsev
0bd9265867 network: use CIS compare more
to reduce allocations

Change-Id: I648518fd152a834bbdc6afcedb693f02c1b13af1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:38 +03:00
Friedemann Kleint
fcab2b88af QtDBus: Fix unity build on Windows
Exclude qdbusconnectionmanager.cpp which includes qt_windows.h,
clashing with the "interface" parameter name in qdbusinterface.h.

Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: Id41910857cb203ec5a1b784fa171eeb189ca4eca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-01 21:05:38 +01:00
Ivan Solovev
f5a5c59918 Extend QTestPrivate property tests - actual implementation [2/2]
This patch provides the actual implementation to detect binding loops
in property setters.

These test will help to catch all the existing binding loops that were
introduced when migrating to new bindable properties.

The logic of the new tests is taken from
tst_QObject::objectNameBinding(), but generalized to be applicable to
all bindable properties.

The original code from tst_QObject can now be removed.

The patch effectively reverts f791570b86
because a lambda returning a nullptr now means that the binding loop
test should be skipped, which is not a good default behavior.
Now when all the existing bindable properties are fixed, it's fine to
give a compilation error when adding new tests, if the class is not
default-constructible.

Task-number: QTBUG-116345
Pick-to: 6.6 6.5
Change-Id: I059d444d4bb023c050a22e5b1974565e4f581b5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-11-01 22:05:38 +02:00
Anton Kudryavtsev
457309c9fa QHttp2ProtocolHandler: optimize updateStream
Use QBAV more to reduce allocations

Change-Id: I009144156fafa64dd241c446bd4081fe197aa2bf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 22:28:24 +03:00
Michal Klocek
567e9b2026 Doc: Fix QTest::createTouchDevice docs
After the introduction of QInputDevice class the returned
QPointingDevice object from QTest::createTouchDevice()
call is no longer automatically deleted when the
QCoreApplication is deleted. Moreover, this function does
not really go thorough qpa but simply registers the device with
QWindowSystemInterface::registerInputDevice() (which is
actually also used from qpa plugins when new device is plugged)

Pick-to: 6.6 6.5
Change-Id: I3a0400288d76b7c95659d6b6ea260eff3233ebf1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-11-01 20:28:24 +01:00
Eskil Abrahamsen Blomfeldt
38ce08aa8e Update Harfbuzz to version 8.2.2
Pick-to: 5.15 6.2 6.5 6.6
Task-number: QTBUG-118615
Change-Id: Ifdf6023781c7202bc07f7cfb821c8cfefd2720a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-01 15:00:13 +01:00
Volker Hilsheimer
a20d9a5700 Fix warning for 32bit builds
When building for 32bit platforms (e.g. Android armv7a), then printing
qsizetype value using printf's %lld format generates a warning because
qsizetype is just an int. This breaks the build, and can't be fixed
by using another placeholder without producing a warning on 64bit
builds. So fix it by casting the qsizetype always to 64bit signed int.

Change-Id: Ie7c0fa8b3a0fe6366ce6fd5b2947f42a3e67c381
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-01 15:58:47 +08:00
Volker Hilsheimer
daf15a4aaf Android: clean up error handling and native methods registration
Emit log output and return false immediately if we fail to get both the
Activity and the Service objects. Standardize the registerNative methods
to return bool and take a QJniEnvironment, and adjust the macros
accordingly.

Simplify the startup routine to use QJniEnvironment.

Change-Id: I11be35426520dc803f5a07bbb495e908592f254e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-01 15:58:45 +08:00
Volker Hilsheimer
6735aa868f JNI: add a static getter for a JNIEnv pointer to QJniEnvironment
This further helps reduce the creation of temporary QJniEnivronment
instances (with allocated d-pointer) for cases where we simply need to
get the JNIEnv for the current thread.

Change-Id: I2eda238124be51c755d8910de9dbc9ca8eb92288
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2023-11-01 15:58:42 +08:00
Volker Hilsheimer
e21d35b9f7 JNI: don't implement a signature for 'long' C++ type
On Android, `long` has the width of the system, while `jlong` is always
64 bit. If we support `long` as a signature type equivalent to `jlong`,
then it becomes possible to write code that fails to compile, or in the
worst case crashes at runtime, on a 32bit system.

Instead, support quint64, which is always the same size as jlong.

Change-Id: I60432ec7411e697b5f6e1f153216ceee0af7e0f1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-01 15:58:40 +08:00
Andreas Eliasson
45c6ef02e7 Doc: Revise QWidget docs
Reviewing and improving the docs for QWidget is part of the objectives
for the 2023 Q4 OKRs.

Most of the work in this patch is fixing grammatical errors and typos.
It is tempting to move much, if not all, of the Detailed Description content from the QWidget class reference page (qwidget.cpp) into its own overview/explanation page, which would be more in line with the diátaxis framework. But I think that should be a different patch.

Fixes: QTBUG-117758
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibb3f367c4677f7e6615bc0cd39d0ffe921862cb9
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-01 07:58:02 +00:00
Safiyyah Moosa
48c6f7250a Doc: Improve the QCombobox Documentation
The purpose of this commit is to improve the QCombobox documentation.

The following updates were made:
- The Combobox image was udated with a better quality image.
- The brief was updated to make it more understandable.
- The detailed description was updated with subsection titles.
- Full stops were added to the sentences that were missing them.

Fixes: QTBUG-117748
Pick-to: 6.5 6.6
Change-Id: I417a720299ac0eb2be3f080f2fc0f76a27242423
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-31 19:20:12 +01:00
Anton Kudryavtsev
5e158ee177 qvulkanwindow: use qimage rvalue overalods more
Pick-to: 6.6
Change-Id: I71bb0df5dbf1993284ec907f637a8696898dddb1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-31 21:20:12 +03:00
Anton Kudryavtsev
9548118443 qpixmap_win: use qimage rvalue overalods more
Change-Id: I363b40ad8c797e0e554eca249347b5764d7dcfe8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-31 21:20:12 +03:00
Laszlo Agocs
aa4fe3286d Fix alpha channel logic in QRhiBackingStore
Mirror what other platforms such as Windows or xcb do.

Those all unconditionally upgrade a non-alpha format such as RGB32 to
something like ARGB32_Premultiplied (or whatever
qt_maybeAlphaVersionWithSameDepth returns).

Without this, there is a discrepancy between macOS and the other
platforms when using QOpenGLWidget or QQuickWidget (which trigger
the usage of QRhiBackingStore).

For example, attempting to have semi-transparent raster widget content
over the RHI-based widgets will render incorrectly. This is visible in
6.7 (dev) with the cuberhiwidget example as well: the red
semi-transparent overlay is rendered incorrectly on macOS since
QRhiBackingStore sticking with a QImage of RGB32 has far-reaching
consequences.

Upgrading to an alpha format is also required by the "hole punching"
mechanism the texture-based widget system relies on, although there is
a suspicion that that just happens to look correct with RGB32 as well
since there is an alpha channel technically with that format, and alpha
writes may not be masked out, depending on painting internals, ending
up with RGBA content in practice.
But in other cases, like in the report and the one mentioned above
this clearly breaks down.

Fixes: QTBUG-118553
Pick-to: 6.6 6.5
Change-Id: I4b5b7a4f720377d64903e948b866f8d1c443a2d2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 20:20:11 +02:00
Laszlo Agocs
522d9fcfe4 QRasterBackingStore: check format alpha presence in a more generic way
...instead of hardcoding a format such as ARGB32_Pre. A subclass may
override format() after all.

A few lines below there is the same check in fact, but this time
with hasAlphaChannel(). To be consistent, switch over to
hasAlphaChannel() in the first case as well.

Pick-to: 6.6 6.5
Change-Id: I7a5653863a72f8a0df98da66290f6d17e548b0a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 20:20:11 +02:00
Timothée Keller
d53c0d721f Windeployqt: add options to deploy/block plugins
Some plugin types are pulled in by default by certain modules.
Give users the option to add/skip plugins and/or their types.

[ChangeLog][Tools][Windeployqt] Windeployqt now has options that allow for custom plugin deployment. Users can include or exclude them, either individually, or by type.

Fixes: QTBUG-117910
Pick-to: 6.6
Change-Id: I85235783dcd814396f184912269cd5976717b2dd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-31 18:10:14 +00:00
Ahmad Samir
e90705687f QMetaEnum: refactor keysToValue
- Show warning messages for malformed keys string
- Use QBAV instead of QL1SV, some methods in the public API may get
  QU8SV overloads in later commits
- Extend unittests; also rename the unittest, it's really testing
  key(s)ToValue()

Change-Id: Iec944ef4c2c5d18ab038cb933e954cf50c912523
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-31 19:36:00 +02:00
Ahmad Samir
7c41f31efa QMetaProperty: simplify code
By using QBAV instead of dealing with const char*; now it's clearer it's
doing the equivalent of parse_scope() does (albeit without explicit malloc()
and strrchr() calls).

Change parse_scope() to take a QBAV to keep the code consistent (new
public method overloads will take a QUtf8String in later commits).

Change-Id: I9cb0d7d45fd5f7689010c0684a094e6e98be1d74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-10-31 19:36:00 +02:00
Kai Köhne
e45937c22d Highlight some examples for 'Data Processing & IO' category
Pick-to: 6.5 6.6
Task-number: QTBUG-117220
Change-Id: I1bf8d36ae93b96da55d18c9545c942707834c114
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-31 19:35:59 +02:00
Kai Köhne
675f380c4d Doc: Fix name of example to highlight
Since commit  d3526c16, the example is just named 'Secure Socket Client'.

Change-Id: Iba15a04aa8c6ab3cd7e933903154575c15a5a81b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-31 19:35:59 +02:00
Mårten Nordheim
ce4531a490 QNetworkInfo: if no builtin defaults are found, load anything
As a fallback before picking the dummy backend.

[ChangeLog][QtNetwork][QNetworkInformation]
QNetworkInformation::defaultBackend() will now load any available
backend with Reachability support if the default ones are not available.
If none are available it will create a backend that always returns the
default values for each property.

Change-Id: I40889eeb51929e81f77ec2d84999932b095baf0b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-31 11:37:38 +02:00
Tor Arne Vestbø
bafeffff9d QMessageBox: Detect modifications to standard button text
The addButton(StandardButton) and button(StandardButton) APIs return
a QAbstractButton, that the user can in theory modify to their heart's
content. This causes problems when the native dialog backend is not
aware of these modifications.

We documented this limitation in e9a1c5321, but it turns out to be
more common than we first though. In particular, a typical case is
modifying the text of the button.

We now try to detect if the button has a non-standard text, and if
so turn it into a custom button when passing it on to the native
backend. From the point of view of QMessageBox it's still a standard
button, and will be reported as such in the result of exec().

To make this work the QMessageDialogOptions::CustomButton needs to
learn about custom button identifiers, so we can pass the original
standard button though.

This moves us closer to a world where the QMessageDialogOptions
represent both standard buttons and custom buttons using the same
structure, which is what we want anyways, so that we e.g. respect
the added order of standard buttons with the same role.

Pick-to: 6.5 6.6
Change-Id: Ifb7f7bd537fe71293f14ef6a006999e350bd0b52
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-10-31 11:28:10 +02:00
Morten Sørvig
13bb9fcdae no-thread: add QProcess config check
Disable QGraphicsFrameCapture for the no-thread (and
no-process) configuration.

Change-Id: I7767098efff78338a763ff192512d484cd300c1d

Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 11:21:53 +02:00
Morten Sørvig
3fc1951f41 no-thread: don't build macdeployqt
macdeployqt requires multithrading support.

Change-Id: Ie561434d68f46bc82ec603aee2c36cd43597073a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 11:21:52 +02:00
Morten Sørvig
73feb5184e wasm: fix null-argument warning
That's "null passed to a callee that requires a non-null argument".

Pass EMSCRIPTEN_EVENT_TARGET_WINDOW instead of NULL to
emscripten_set_wheel_callback. The function is never called
here, so it does not matter which non-null value it
gets.

Pick-to: 6.6
Change-Id: I10187a222513820158a938bf05cde60f489956f1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 10:21:52 +01:00
Santhosh Kumar
58a6a92f68 Fix margin issue in wizard for windows
The patch set 8dbc482489 extends support in calculating margins when ExtendsContentIntoTitleBar() is used. But this affects existing QWizard that sets custom margins through Aero style. This is because, the custom margins set by Aero style excludes top margin (titleBarSizeDp()) and excluding it once again cause slicing in the client window area.

This patch set fixes it by considering top margin only when system margins is used in windows.

Fixes: QTBUG-117428
Pick-to: 6.6 6.5
Change-Id: I6d6eefc691f26474257b58304dac169fba20b5e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 09:21:52 +00:00
Morten Sørvig
63fc3175b4 wasm: Add QLocale backend
This is a simple backend based on navigator.languages,
which gives us a prioritized list of languages in the
form '["en-US", "zh-CN", "ja-JP"]'.

Use this to implement QSystemLocale::query() for UILanguages
and QSystemLocale::fallbackLocale().

Register an event handler for the native QWindow:languagechange
event in the QSystemLocale constructor. This event handler
stays active for the lifetime of the QSystemLocale object.

Task-number: QTBUG-116613
Change-Id: Ibd176748377e891b63a3f1d57605af0c2a49edb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 08:09:23 +02:00
Anton Kudryavtsev
11a68f13e9 qnetworkcookiejar: optimize validateCookie
Use string view more to reduce allocations

Change-Id: Ib73fb9607438c7da115406f61653641163370122
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:33:15 +03:00
Anton Kudryavtsev
0774a9c556 qnetworkcookiejar::deleteCookie: port raw loop to algorithm
Use std::find_if with const iterators to avoid unconditional detach

Change-Id: Ibc9d05586a1926fefba5c6fd73c5b15ee815cd6d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:32:44 +03:00
Anton Kudryavtsev
08fff11232 qnetworkcookiejar: optimize cookiesForUrl
Check cheap conditions first.
Use string view types more
Don't insert in the middle of list, just append and then sort

Change-Id: I1ad7c3459eab45b2289bfe044314eec7130d8153
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:32:28 +03:00
Mårten Nordheim
d8d5922f16 QLocal8Bit::convertFromUnicode[win]: handle trailing high surrogate
The win32 API doesn't give us much choice. _Some_ code pages have
support for returning some error if we pass a specific flag, but not
all of them.

Anyway, since the code pages might not support all that UTF-16 provides,
we can't reasonably make it error out on characters that cannot be
converted.

So, the most reasonable thing we can handle is a unpaired high surrogate
at the end of a string, assume that the rest of the string was fine, and
that the low surrogate will be provided in the next call.

Pick-to: 6.6 6.5
Fixes: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I1f193c9d8e04bec769d885d32440c759d9dff0c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
e34ee8e88a QLocal8Bit::convertFromUnicode[win] use local array for buffer
To match convertToUnicode, we use a local array as a temporary
buffer, then if any growth is needed we work directly with a QBA.

As a drive-by: explicitly cast to int where we pass int

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Task-number: QTBUG-118185
Change-Id: I1efff318eea41d87d558599d737b64107af4ae17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
36a6522b48 QLocal8Bit::convertFromUnicode[win]: Drop UsedDefaultChar argument
We don't use the value, and the docs[0] say that we get the best
performance if we don't pass the argument.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#remarks
See table

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I3eb5e023a936fe3def5169e3fb492a62708bbf44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
ab009f2f03 QLocal8Bit::convertFromUnicode[win] move cast earlier
So we don't have to do this multiple times when calling the function.

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ifa72eedd5f71365618ec6b67fa3047f90f4eb541
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
94214fe100 QLocal8Bit::convertToUnicode[win]: handle more than one octet state
Both to store and to restore.

Without this a 3 or more octet sequence would cause errors or wrong
output. This can be seen with GB 18030.

Pick-to: 6.6 6.5
Fixes: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: Id1f7f5f2fba4633b9f888add2186f4d8d21b7293
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
ef24784f88 QLocal8Bit::convertToUnicode[win]: Drop MB_PRECOMPOSED flag
A few code pages do not support this flag[0]. It's also deprecated[1]
and is what Windows prefers to generate by default. So let's drop it.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
See note at the end for the dwFlags parameter.

[1] It's mentioned in the header files, but not online...

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I798c387170c73a953be874de139868543b2d775e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
2e9bb2ee5d QLocal8Bit::convertToUnicode[win]: Simplify state-handling
Instead of having separate variables for the state, that we then
store back at the end, let's just make state-handing explicit, making
the logic around it easier to follow.

We now output Replacement Characters, if we try to decode stateless and
have an invalid sequence at the end. Otherwise we fall back to
convertToUnicodeCharByChar as before.

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: Ifea64bc241113f468b69cad16fc3cc97a6ebe646
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00
Anton Kudryavtsev
33fec53e55 QHttpNetworkConnection: use QSB more
to avoid needless tmp allocation

Change-Id: I582f86adbe274b67ddbc7255caea63a39137edcc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:25:35 +03:00
Ivan Solovev
c4f7dba81e QDate: make conversion from/to chrono types constexpr and noexcept
Add method stdSysDaysToJulianDay(), which implements the conversion
from std::chrono::sys_days to Julian Day in a constexpr and noexcept
manner. Use it in the fromStdSysDays() method instead of addDays(),
and also in all constructors from std::chrono types.
This allows all constructors to be constexpr and noexcept.

Simplify toStdSysDays() so that it could also be constexpr and
noexcept.

Add compile-time roundtrip tests between QDate and std::chrono types.

Fixes: QTBUG-118221
Change-Id: Id35a669430162f1932ad8d28b553af2fd7f5c6de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:34 +02:00
Anton Kudryavtsev
bf42be723f QHttpNetworkConnection: mark some methods as const
These get methods (sslContext and connectionType)
are part of private API, so it's safe

Change-Id: I6c2e14d5dbcbefc051d69985d1e9b490274ba7ef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:25:34 +03:00
Anton Kudryavtsev
981804752a qnetworkcookiejar: port internal functions to QSV
Change-Id: I2f377ca63b2d376736fa8adff88c47616939dd23
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:25:34 +03:00
Anton Kudryavtsev
8db967a860 qhttpmultipart: use range-for more
to improve readability

Change-Id: I9b7cad485c354b58b1acee7cea159988bf37c9df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:25:34 +03:00
Anton Kudryavtsev
56bb4ac484 qnetworkrequest, qnetworkreply: port some methods to QBAV
[ChangeLog][QtNetwork] Ported hasRawHeader and rawHeader of
QNetworkReply and QNetworkRequest to QByteArrayView.

Change-Id: Ife71ba11b1ee8907c104dba3210d7a033568edf4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:28:57 +03:00
Tor Arne Vestbø
be7e5f94a1 macOS: Check NSWindow as well when determining if setVisible can bail out
In be268ae197 we made QCocoaWindow::setVisible
idempotent by checking if NSView.hidden needed update.

This failed to take into account the case when a window is moved from
being a child window to a top level, where the window is still visible
and the NSView's hidden state doesn't change, but we need to order in
the NSWindow that we're now managing.

We now check NSWindow.visible as well, if we're a top level window.

Pick-to: 6.5 6.6
Change-Id: I94434d6ebfe2c9ece6eac7f83f17ead250ccc07a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-30 18:28:57 +00:00
Edward Welbourne
a9c47dde50 Rename Convert Example to Serialization Converter
The old name didn't say what sort of thing it was converting; and our
guidelines for examples discourage using the word Example in the
title. Also reword the description of the tool in the command-line
parser and an assertion.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I6f52f5227362b4b807c8aabfd2103287af42bca0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-30 18:19:57 +02:00
Antti Määttä
33b714c64a Fix CTF with Integrity
Do not use filesystem functions with Integrity.

Change-Id: I992f560bead00df7d2783359fcb9f38326a0072b
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-30 18:59:21 +03:00
Antti Määttä
0f2558470d Fix CTF with static build
- Do not require feature library
- Load static plugin

Change-Id: I6c3ec72e20b9f2800c1d350dac795fccbb8c381e
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-10-30 18:59:21 +03:00
Assam Boudjelthia
457566c96f Android: Move clipboard management to own class
Move all clipboard management logic outside of QtNative and
to own QtClipboardManager class. Also, don't keep any keep
Activity objects under it to avoid memory leaks, the native
c++ clipboard manager should be responsible of passing a
context when needed instead.

As a pass-by, use newer JNI APIs for C++ QtAndroidClipboard
code.

Task-number: QTBUG-118077
Change-Id: I61726e84a75918d80329f753e9e1c6ebde179bf4
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-30 16:59:14 +02:00
Paul Wicking
cc921ad104 Doc: Specify correct include for QWaylandApplication
QDoc automatically generates include statements for types, by a set of
rules used to determine Qt's convenience header. For the
`QWaylandApplication` struct, no such convenience header is generated.

Use QDoc's `\inheaderfile` command to specify the correct header for
access to `QWaylandApplication`.

Fixes: QTBUG-118315
Pick-to: 6.6 6.5
Change-Id: Ib3b120e3ce6b5d4df74078a21bb137adaaffa2ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-30 15:40:49 +01:00
Edward Welbourne
4389b0c429 Report as available every QTimeZone(qint32).id() result
The QTimeZone(id) constructor accepts these IDs, but
isTimeZoneIdAvailable() did not admit to this. Although we cannot
sensibly list all 183,047 of them in availableTimeZoneIds(), we should
not claim they are unavailable. The custom QTZ constructor needs to
know when the ID it's been given is an IANA one (to refuse to use it),
so it has to be able ask the backends for "is this IANA", so the UTC
backend still has to report these IDs as invalid, leaving the QDT
frontend to include the check for these offset zones.

Extend isTimeZoneIdAvailable() test to include every offset-zone's ID
within QTZ's recognized range of offsets. Although the actual range
accepted by offsetFromUtcString() is wider, bounded by ±24:59:59, the
constructor from offset seconds (rather than offset string) is bounded
by ±16 hours.

Pick-to: 6.6 6.5
Fixes: QTBUG-118586
Change-Id: Id9b378aee122ec841635584367022fcb47041fdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 12:43:14 +02:00
Edward Welbourne
4e3518bf63 Align doc of custom QTimeZone constructor with declaration
The ID of the custom zone *must not* be an IANA ID, so naming the
variable ianaId was misleading. The declaration in qtimezone.h uses
zoneId, which is more appropriate, so change the docs and definition
to use that name instead. Also add emphasis where the doc says it must
not be an IANA ID.

Pick-to: 6.6 6.5
Change-Id: I55fbb748173b540741453db3f1e2492272635f9a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 12:43:14 +02:00
Assam Boudjelthia
4f33c4a368 Android: properly parse colon separated local libs in QtLoader
The 'load_local_libs' array  might contain lib names separated by
a colon that the new loader code didn't account for, that led to
attempting to load an invalid library path and thus crashing if
anthing depends on that library (in this case the Android plugin).

Amends 3a505a859a.

Task-number: QTBUG-115016
Change-Id: I864c7af7da7016721530c18a412befc5c6a5caa3
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-30 12:43:14 +02:00
Viktor Arvidsson
efb06499a7 Add missing timestamp to tablet events
When copying the event for notify, timestamp was not set as it is for
other input events.

Pick-to: 6.5 6.6
Change-Id: I81bb89993027c902db2d1113605d6e6a0faf98f1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-10-30 10:43:14 +00:00
Laszlo Agocs
7a3261c196 Do automatic r-b swap in QVulkanWindow's grab for BGRA8
While it would also be acceptable to leave this conversion to the user,
the returned image's format (that it's QImage::Format_RGBA8888) is not
documented. That needs to be corrected in any case. Then, we may just as
well add and document that for the most commonly used swapchain color
buffer format the r-b swap is performed automatically.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-118244
Change-Id: I7ec8324ec3a0f5c1f2a7a592501d5ff59e3e8cc5
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-10-30 12:43:14 +02:00
Volker Hilsheimer
69b3109435 Include what you need: QIODevice
The qstdweb_p.h header declares subclasses of QIODevice and uses enum
types declared in QIODeviceBase, so make sure we include the QIODevice
header.

Change-Id: Id23da64105f998d52b114b529ce8493c74ed2364
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
2023-10-30 09:17:38 +01:00
Christian Ehrlicher
910f884593 QCommonStyle: add missing standard icons
Even though there are png files for SP_DirOpen/Closed/LinkIcon,
SP_DriveFD/HD/NetIcon, SP_CommandLink and SP_Desktop/ComputerIcon they
were not used within QCommonStyle::standardIcon() so the fallback from
standardPixmap() with 16x16 pixels were used.
As a drive-by use addIconFiles() for the creation of other standard
icons.

Task-number: QTBUG-118122
Change-Id: Ib651cefd31d1de84721fe11712e51980220ee9e2
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2023-10-29 15:07:49 +01:00
Christian Ehrlicher
37b6f941ee QCommonStyle: add 128px icons for standardbutton-closetab
Add 128px version of standardbutton-closetab/-down/-hover and the source
svg file.

Task-number: QTBUG-118122
Change-Id: I8146f022cf440fc43d8c72aa08bd778ffdc64a78
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-29 12:07:15 +02:00
Christian Ehrlicher
4acbfd47be QCommonStyle: add 128px icons for toolbar-ext
Add 128px version of toolbar-ext-h/toolbar-ext-h-rtl and toolbar-ext-v -
created from the available svg.

Task-number: QTBUG-118122
Change-Id: I238333242995d6a93ce2cf08ef1b01af02ae2093
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-29 12:07:07 +02:00
Christian Ehrlicher
6d374897ba QCommonStyle: add 128px icon for cleartext
There was no 128px icon for cleartext - therefore add it including the
svg source file.

Task-number: QTBUG-118122
Change-Id: I405de9474406efcc43ffe319952f0b596bcfc623
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-29 12:06:59 +02:00
Christian Ehrlicher
4ee702e2ad QCommonStyle: add 128px versions of media icons
Add 128px versions of (nearly) all media icons and including the svg
source.

Task-number: QTBUG-118122
Change-Id: Iac03f2bb8c0f5fe5d873a996b16eac5808475a19
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-29 12:06:47 +02:00
Christian Ehrlicher
06c9f4b55e QCommonStyle: add missing png icons derived from svg ones
There are svg icons for information/warning/critical/question/
filedialog_start and filedialog_end but no corresponding png icons.
Therefore create those from the svg files and add them.

Task-number: QTBUG-118122
Change-Id: I2b0eb6450319ba64c41593a1f7705d995187f6b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-29 12:06:42 +02:00
Christian Ehrlicher
8eaf01ef81 QCommonStyle: cleanup standardIcon()/standardPixmap() [2/2]
Factor out the four code paths for standardIcon() (windows, mac,
application and resource theme) and use those functions also for
standardPixmap() so the returned pixmap is correctly scaled with the
current devicePixelRatio.
Part 2: move functionality into own functions

Task-number: QTBUG-118122
Change-Id: I0763c4db9e7aecf4c52bf0f5770bd3dd87c4a8a4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2023-10-29 12:06:24 +02:00
Wladimir Leuschner
d0f79c073d Introduce TabWidget to Windows11 style
Introduce a TabWidget with rounded corners.

Change-Id: Ie6eb7a3e05b2240a0ecce2604ca87cc3db549dd1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
a0cbecf70c Introduce Spinbox into QWindows11Style
Introduce WinUI3 inline NumberBox styled QSpinBox.

Task-number: QTBUG-113617
Change-Id: Id10776f4004e502d7855e0671e58d0f39639ff81
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
51499e7a17 Introduce rounded plain frames, group boxes in QWindows11Style
Plain frames and group boxes are now drawn with rounded edges. In
QWindows11Style.

Change-Id: I576873d31c2252b7a22d84e8e86c64e09e2e5023
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 18:32:56 +02:00
Wladimir Leuschner
6723515e5b Introduce progressbar in QWindows11Style
Introduces Windows 11 styled progressbar to QWindows11Style drawn by QPainter.
The progress is indicated by a thicker line in accent color on a grey track.
Animation for indetermined progress is changed to follow the animation of Windows 11
progress bars.

Change-Id: Icac79fdbe40b82b10e1fd0e59b389890a7de6683
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
c0b5c1567b Introduce Windows 11 style sliders in QWindows11Style
Introduces Windows 11 styled sliders to QWindows11Style drawn by
QPainter. The appearance of the slider control element consist now of a
circular handle, a rounded slider track and divides the slider track
into an accented part left of the handle and a gray part right of the
handle. The inner circle of the slider handle is drawn in accented
color. The inner circle grows when hovered over and shrinks when
pressed.

Task-number: QTBUG-113511
Change-Id: I6ca1d27b8b0f69c2cfa07359a7153d38a2f3795e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
045726818c Introduce accent colored Buttons, Radio-/Checkbuttons in QWindows11Style
Introduce Windows 11 styled Buttons, Radiobuttons and Checkbuttons into
QWindows11Style. The default button, selected radio option and accepted
checkbox are drawn with accent color. The checkmark when accepting a
checkbox is now animated to replicate a hand written checking. Flat buttons are subtle
highlighted when hovered and pressed.

Change-Id: I37c0c21a25ffad427cff361f1b28d3138ff52b09
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
c27baa6aac Update menu behavior to mimick Windows 11 style on QWindows11Style
Updated the highlight of hovered menus and menu items to mimick the
behavior of native Windows 11 applications.

[ChangeLog][Windows] Updated default System colors to use according to
guidelines for Windows 10 upwards.
[ChangeLog][Windows] On Windows 11, hovered menu and menuitems are now
highlighted with darker rounded rect.

Task-number: QTBUG-95217
Change-Id: Ibc786aab115650401b054f028da58d69bcbc3462
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:56 +00:00
Wladimir Leuschner
9da8d67b3b Introduce Windows 11 styled ComboBox in QWindows11Style
QComboBox is adapted to use the WinUI3 style.

Task-number: QTBUG-113513
Change-Id: I300157a7ce9162be73ccd4acfc50b12f7166dc2d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
64db4042d4 Introduce ListView hover and select behavior to QWindows11Style
Introduce a vertical left line in accent color for the current selected
element in a listview and show hovered line slightly darker.
Introduce rounded ItemView Headers.

Change-Id: I203e14db4ef3a3daf8635d79f227780024177b70
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
e4b7ccee53 Introduce TextEdit to QWindows11Stlye
Introduce a TextEdit that is accent colored highlighted when selected.

Change-Id: I84813a85a570d37a178c605ec88dab1ad2f04d4e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
07d524aad7 Introduce Rounded ScrollAreas in QWindows11Style
Introduce a rounded frame around the viewport of a QAbstractScrollArea.
This change affects the appearance of QTextEdit, QTreeView, QListView,
QTableView and QColumnView.

Change-Id: I5fc94ea17415903d74c469f9777a932ca62742d0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
5ececa66d5 Introduce AccentColored LineEdit to QWindows11Style
Introduce a rounded LineEdit, which is highlighted in AccentColor when
active.

Change-Id: Ia836ce8646ec0f8519ac8816d8231440a630b610
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
2ec4da62b2 Introduce scrollbars to QWindows11Style
Introduces Windows 11 styled scrollbars to QWindows11Style.

Change-Id: I720f7d68f94c867a9fdd7142ea60fe46a8b7485c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 16:32:55 +00:00
Wladimir Leuschner
65d58e6c41 Introduce new empty Windows 11 style
A new empty Windows 11 style plugin is introduced and QWindowsVistaStyle
module is renamed to QModernWindowsStylePlugin containing styles for
Windows Vista and Windows 11. The color palette is adjusted according to
the Windows 11 guidelines.

[ChangeLog][Windows] Introduction of Windows 11 specific style.
[ChangeLog][Windows] Renaming of QWindowsVistaStylePlugin to
QModernWindowsStylePlugin

Change-Id: I5f67d7e8c9a3033ffe57ecbaebbf0e3fb10c60ab
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-27 18:32:54 +02:00
Volker Hilsheimer
8ac49acca6 Android: Modernize the QAndroidSystemLocale implementation
Declare the Java classes we use, and use the modern template API to
call methods and access fields. Make use of the implicit conversion to
QString.

As a drive-by, limit the write-locking of the mutex that protects the
data to the write access to that data. The rest of the function operates
on objects on the stack.

Change-Id: I3991c3804339f005aaf8e81a697363ab39306a2f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-27 17:44:35 +02:00
Volker Hilsheimer
180c7698e2 JNI: remove implicit conversion of declared QtJniTypes to jobject
It's dangerous, as it results in implicit conversion to void * or bool,
while hiding the object life time implications.
Such objects are QJniObject subclasses, so make sure we don't end up
in the catch-all assignment operator when assigning. Constrain that
operator to types that are convertible to jobject.

Change-Id: If31761c00a678490eeb0b2b038e89e78d8a51747
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-27 17:44:35 +02:00
Volker Hilsheimer
8c9f5fba03 Android: don't rely on implicit cast of declared QtJniTypes to jobject
The operator jobject() should be removed from declared QtJniTypes in
qtbase, as it's dangerous. Prepare for that by calling object(), which
returns the wrapped jobject as well, or isValid() where previously the
implicit conversion to jobject also enabled implicit conversion to bool.

Change-Id: I00cf6f1463dd5ab5cbaf03d9e77bfff3bced9b15
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-27 17:44:35 +02:00
Volker Hilsheimer
703614f03b Android: replace QtAndroid::activity/service with QtAndroidPrivate
There's no need for both, and QtAndroidPrivate is a documented namespace.
Replace all calls to QtAndroid::activity/service with QtAndroidPrivate
equivalents, and drop the QtAndroid version. Since we no longer store a
global copy of the activity and service, we can drop the reference right
away.

This comes with a bit of overhead - QtAndroid::activity returned a copy
of a global static QJniObject (62cb5589b3,
after which declared QtJniTypes became QJniObjects), while
QtAndroidPrivate::activity returns a newly created QtJniTypes::Activity
on each call.

This however makes it also safer, as the QJniObject is then associated
with the calling thread's JNI environment, and we can optimize critical
code paths where it's safe to do so later. Also, QtAndroid's activity
object was never updated, while QtAndroidPrivate's activity is updated
in the updateNativeActivity native method.

Change-Id: I36c5b504eac52d9e28b4c6b265daab8fedc877e2
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-27 17:44:35 +02:00
Mårten Nordheim
d44aae1358 QLocal8Bit::convertToUnicode[win]: Drop QVLA in favor of array
We now, instead, resize and copy the data directly into a QString if
we run out of space in the pre-allocated array.

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I1eed5e75f0bd067b4e7d6bff97c4186f3f6ee0ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 17:44:35 +02:00
Mårten Nordheim
3a5339b418 QLocal8Bit::convertToUnicode[win]: Fix indentation
To make future changes easier to read

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I431c83b956c179b1d04c2bf51b744227f8b136be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-27 17:44:34 +02:00
Ahmad Samir
6c234ec1dd QMetaEnum: de-duplicate some code
By using parse_code static helper.

Use views instead of const char*.

Change-Id: I9ccd54d72b831fd963ff3a0092f4829708904659
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
336f6340fd QMetaObject: change typeNameFromTypeInfo() to return a QBAV
typeNameFromTypeInfo() returned a QByteArray, the first if branch used
stringData() which uses QByteArray::fromRawData() so not too bad, but
the second if branch allocated a new QByteArray. Making it return a QBAV
is less confusing and avoids a potential QByteArray allocation.

Also remove rawTypeNameFromTypeInfo(), and use typeNameFromTypeInfo()
instead.

Change-Id: I0c51a093aa47d2691a8f1ac45421ede7bce0a871
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
4ecbe42ff4 QMetaObject: add indexOfEnumerator(QBAV) overload
And remove the indexOfEnumerator(const char *) overload.

Taking by view so that it works with string data that isn't necessarily
null-terminated (e.g. a sliced() or chopped() view).

QMetaObjectPrivate::indexOfEnumerator needs to be a member function
because it usess a private QMetaEnum constructor (QMetaObjectPrivate is
a friend of QMetaEnum).

[ChangeLog][QtCore][QMetaObject] Added indexOfEnumerator(QByteArrayView)
overload. And deprecated indexOfEnumerator(const char *) overload.

Change-Id: Ie2f4f1a9af69373c19a5d7bd92499544e95e9289
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
56b8048ab9 QMetaObject: change static objectClassName() to return a QBAV
QBAV has an operator==(), among other things.

Internally QMetaObject only supports Latin-1, however that is an
implementation detail that shouldn't be exposed in public API. Since
some public methods will be changed to take a view, a QBAV, use QBAV
internally too to keep the code consistent.

Also change QMetaObject_findMetaObject() to take a view, this is more
robust as it can work with other string data that isn't necessarlify
null-terminated (e.g. a sliced() view, which will happen in later
commits).

Change-Id: I346d7910ad8fa30951a7168e9b257f039f016298
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
e0573e7364 QTimer: split QSingleShotTimer to a private header
So that it can be used in QTimer and soon-to-added QChronoTimer, this is
less code duplication.

Change-Id: Icc5f2028d776a34c06ba20fe41f571cd3821c64c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Assam Boudjelthia
6f1449c7ae Android: fix ClassLoader warning
The Dex value provided is an empty string which leads
to this system warning when initiating an instance of
the ClassLoader

 W System  : ClassLoader referenced unknown path:

This patch fixes it by providing a valid path.

Task-number: QTBUG-115016
Change-Id: I6dcd396a07337278224e07b0271f49bb829ea0ce
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Assam Boudjelthia
db91947eb0 Android: remove redundant QtNativeLibrariesDir class
This class is now not used anywhere after QtLoader refactoring.

Task-number: QTBUG-115016
Change-Id: I3399ba68fe85396f88766e9547cdfefc30baf6ed
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Assam Boudjelthia
3a505a859a Android: modularize and simplify QtLoader classes
The Qt loader is now expected to work in the following way:

QtActivity.onCreate()
--| QtActivityBase.onCreate()
----| Initiaze the delegate
----| Creates QtActivityLoader()
------| Creates QtLoader()
--------| Initialize the class loader
--------| Initialize static classes context
--------| Initialize Context Info
------| Sets common environment variables and parameters from metadata
------| Setup style extraction
------| Sets Activity specific metadata
--| Handles Activity themes
--| Call QtLoader.loadQtLibraries()
----| Fetch and load Qt native libraries
----| Fetch and load the app's main library
--| Start the Qt Native C++ app via the delegate

Few things are done in patch to simplify the Qt loader mechanism:

1)
Get rid of some unused methods, and move the loader instances
to be local instead of global.

2)
Split the awfully long methods in QtLoader into smaller methods for
readability and as preparation for next simplifications.

3)
Refactor Qt libraries loading code from the Delegate classes to
the Loader classes where it makes more sense to be at. At the same
time simplify some code into smaller logical blocks.

4)
The same boilerplate code for loading (with System.load()) Qt libs
and the main library was done twice between the Activity and Service
loaders, that is now done directly under the QtLoader. Same story
for initializing static Java classes with activity/service/context.

With this change All relevant Qt library loading logic is now under
QtLoader classes, and the latter have clear loader responsibilities
reflected in the code.

Task-number: QTBUG-115016
Change-Id: Ib76621d8beff4917c932456c5401ea4586942213
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Cajus Pollmeier
ac039776a6 Avoid ${...} to be replaced by configure_file
When running configure_file without @ONLY, the exit code details get
stripped out by CMake. This leads to an empty application exit status
shown on the boiler plate HTML.

Fixes: QTBUG-117997
Pick-to: 6.6
Change-Id: I4ab25960412da17c9509a66c1019c3b2b71ed108
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-27 13:48:53 +02:00
Edward Welbourne
58fd829cdf Use localized time-zone abbreviations or offset
The actual formatting of date-time strings is handled by the calendar
backend, but the code's in qlocale.cpp as it uses some of its tools.
When feature timezone is unavailable, we're stuck (as before) with
using QDateTime::timeZoneAbbreviation(), but when it's available we
can use QTimeZone::displayName() to get the localized form of the
abbreviation and offset string.

Make matching changes in QDTP so that it recognizes these localized
abbreviations. We now have another candidate for what local time might
be called, to add to those that must be checked.

This naturally implied some changes to tests. It turns out ICU
believes en_US uses GMT+1/GMT+2 for CET/CEST. Replace some MS
QEXPECT_FAIL()s by including the non-abbreviations we do in fact use
on MS in the lists of "abbreviations" to accept.

[ChangeLog][QtCore][QLocale] When a datetime format includes the
timezone (or offset), the appropriately localised form is (to the
extent the timezone backend in use supports this) used where,
previously, a haphazard choice of system and C locale was used. This
applies to both serialization and parsing.

Task-number: QTBUG-115158
Change-Id: I04f9c1055c3b9008320bb8b758490287fd8be5cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 10:52:48 +02:00
Edward Welbourne
4756062828 Have QDTP match longest form it can for local zone name
Previously, three candidates were tried (there shall soon be more) and
the length of the first to match was returned. This could go wrong if
tzname[] = { "GMT", "GMT+1" } and our text starts with the latter; we
would have only matched it to the former.

Change-Id: I8e7b9e6a382bdd527bb98be7c86ea67b11cdc13a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 10:52:44 +02:00
Volker Hilsheimer
ae39b16345 Convert tooltips example to snippets
The important bits from the example are ~10 lines of code, no need
for building a poor-man's version of a graphics or item view.

Pick-to: 6.6
Change-Id: I7874c66765c5b46230c92846ee3de1ee83f47e45
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-27 07:55:34 +02:00
Ahmed Kerimov
70df82a919 Prefer using override instead of virtual in qdbusxml2cpp
In C++ 11 override keyword was introduced to allow overridden functions
to be marked appropriately. Its presence allows compilers to verify that
an overridden function correctly overrides a base class implementation.
This can be useful as compilers can generate a compile time error when:
- The base class implementation function signature changes.
- The user has not created the override with the correct signature.

This commit improves the D-Bus interface code generation.

Change-Id: I0353575c3f70277d04e41b8fa0096c1b2b28058a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 00:48:26 +03:00
Christian Ehrlicher
23370ace68 QCommonStyle: cleanup standardIcon()/standardPixmap() [1/2]
Factor out the four code paths for standardIcon() (windows, mac,
application and resource theme) and use those functions also for
standardPixmap() so the returned pixmap is correctly scaled with the
current devicePixelRatio.
Part1: Add QStyle:: scope to switch statements

Task-number: QTBUG-118122
Change-Id: I39c01612c23a0da61c256c682642ae4e75ed8c43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 23:03:45 +02:00
Christian Ehrlicher
a553d00179 SQL: fix doc
Fix the link to QIBase.
This amends 3cb5408e9e

Pick-to: 6.6 6.5 6.2
Change-Id: I99820971e4136b2cbbc6ee37d80394e0e016f444
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-26 23:03:45 +02:00
Thiago Macieira
d5393a936d moveToTrash/Unix: use linkat() to check early for cross-device renames
This ensures that we will succeed in renaming files, because we already
have created a link to it in the right directory. With this, we can
remove the home filesystem check that was using QStorageInfo. The
majority of file deletions we expect applications to perform will use
this code path.

An additional benefit is that we ensure we can't get an ENOSPC when
renaming any more, because we already have the entry in the directory.

This needs a fallback to the existing mechanism for two cases:
* trashing full directories, because you can't hardlink them
* when operating on a volume that isn't a Unix filesystem (e.g., a FAT
  filesystem on a removable device)

QTemporaryFileName required a small change to allow non-absolute paths.

openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
newfstatat(5, "", {st_mode=S_IFDIR|0700, st_size=18, ...}, AT_EMPTY_PATH) = 0
getuid()                                = 1000
openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 6
linkat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.MuahmK", 6, ".eRPdPI", 0) = 0
openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
close(5)                                = 0
openat(7, "tst_qfile.moveToTrashOpenFile.MuahmK.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
[../etc/localtime..]
write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
renameat(6, ".eRPdPI", 6, "tst_qfile.moveToTrashOpenFile.MuahmK") = 0
unlink("/home/tjmaciei/tst_qfile.moveToTrashOpenFile.MuahmK") = 0
close(5)                                = 0
close(6)                                = 0
close(7)                                = 0

Change-Id: I9d43e5b91eb142d6945cfffd1786d714fc24f161
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 11:36:46 -07:00
Thiago Macieira
935562a77b QTemporaryFile(Name): don't make the path absolute on generation
I need to use QTemporaryFileName in a context where absolute paths are
not allowed because they change the behavior of the system call (the
-at() POSIX system calls); see next commit. This required a fix to a
seemingly unrelated test, which depended on the absolute path, because
QPluginLoader and QLibrary assume a file name with no path components
imply "search the standard places".

[ChangeLog][Important Behavior Changes][QTemporaryFile] This class will
now return relative file paths in fileName() if the file template was
also a relative path (it used to always return an absolute path). The
temporary files are still created in the same directory; this change
only affects the length of the path the function returns.

Change-Id: I79e700614d034281bf55fffd178f65f2b3d602d8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-26 11:36:46 -07:00
Volker Hilsheimer
84e70976f3 JNI: Tolerate threading mismatches and improve diagnostics
Amend 944200b5a9. We have code paths
in Qt that result in a global QJniObject being called from multiple
threads (QtActivity instance, possibly the QAndroidSystemLocale),
so we need to tolerate that until we understand better under which
circumstances this should be allowed, and what tools we can use to
control this better.

Don't instantiate QJniEnvironment to check the JNIEnv, but use raw
JNI calls so that we don't implicitly attach a thread to the JVM
when checking. Use categorized logging to emit log output if we
have an environment/threading mismatch, including the name of the
class we are trying to call, and fall-back to the thread-local JNI
environment pointer instead of the one stored in the QJniObject's
private.

Also, give the threads that we attach to the JVM the name of the
QThread instances if we can, resulting in better logcat output on
the device.

This still results in less overhead than the code had prior to
944200b5a9, as we don't instantiate
multiple temporary QJniEnvironment objects on the stack for each
call.

Change-Id: I98b92edd29162dccfc5c34e6261d4de219b59531
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-10-26 20:04:51 +02:00
Jarkko Koivikko
beeb531c32 print: Use transient parent for native print dialog if provided
Pick-to: 6.6
Change-Id: I6703784d57dab732e5d501cec0d1231b564a065e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-26 21:04:51 +03:00
Edward Welbourne
1e74f67e54 Work round ICU disagreeing with TZDB about zone transitions
Since the TZ backend resorts to ICU for display names, we got
inconsistent results if they disagree about when transitions happened.
Also, ICU uses the current (or only recent history) names for the
zone, so one currently not doing DST (Africa/Tripoli) doesn't get a
report of its DST name at a historical time when it did DST (but ICU
doesn't know about it). Since the ICU backend, in any case, doesn't
override the displayName(qint64, ...), we can simply use the QTZP base
version instead of overloading in the TZ back-end, so we only delegate
to ICU when it might actually help. This also saves duplicating some
locking and lazy-initialization code.

In the process, turn a unique lock into a scoped lock within a
suitable scope. Also, make a comment more grammatical and less
verbose.

Change-Id: Iaaed1fb6a380be8b4258c43cbc4bacd5784345fb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-26 19:56:07 +02:00
Giuseppe D'Angelo
358745d7de QSP/QWP: introduce owner_before, owner_equal, owner_hash
While at the moment we don't have aliasing support in QSharedPointer,
introduce owner-based comparisons and hashing. This also fulfills some
use cases in lieu of operator== for QWeakPointer (which got deprecated
by bb23a05905).

I'm using C++26/P1901's spelling of owner_equal, instead of
Boost.SmartPtr's spelling (owner_equal*s*). Given the niche use case,
the lack of interoperability with Qt's own containers, as well as the
Standard comparison objects' semantics (std::owner_less,
std::owner_equal), I don't think we should be giving these a Qt-ish name
as it would be pretty useless.

[ChangeLog][QtCore][QSharedPointer] Added owner_before, owner_equal,
owner_hash.
[ChangeLog][QtCore][QWeakPointer] Added owner_before, owner_equal,
owner_hash.

Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I8b792ae79f14cd518ba4a006edaa17786a8352a0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-26 19:24:40 +02:00
Edward Welbourne
31dc17c13a Rework massaging of time zone offsets in formatted date-times
Add a missing std::move() and rearrange comments.

Change-Id: I2d93e88f7b9b6f62e7d1cca5cacf794d2fef53b5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 16:57:01 +02:00
Kai Köhne
b7b2375751 Doc: Highlight some Widgets examples for Desktop category
Pick-to: 6.5 6.6
Task-number: QTBUG-117208
Change-Id: I499b5141cc930c1f61a608bd734ef4982bd2ee0f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-26 13:22:55 +00:00
Piotr Wierciński
4f168621d2 wasm: Fix test runner for asynchronous tests
Test runner was not properly handling tests which
return the control back to browser event loop.
It was treating such tests as if they exited with
code 0, marking them as succesfull even if they were
eventually failing or hanging.
This commit adds a callback to TestCase so the runner
is notified when a test truly has finished.
As a side effect, two tests need to be disabled for now
as they are failing for wasm, which was not properly
detected previously.

Change-Id: I0eb9383e5bb9cd660431c18747b9e94413629d1e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-26 13:43:39 +02:00
Anton Kudryavtsev
d1f40ea087 QString: remove isSimpleText method
It's legacy method marked as internal.
There are zero occurrences of "isSimpleText"
anywhere in Qt or Qt Creator other than qstring.*

Change-Id: I4961b7b2539fb6552484e77fbea58ba0e6656921
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 13:40:51 +03:00
Axel Spoerl
e3d34d2fdb qsystemdetection.h: Update WASM in comments
WASM has been added as a definition.
Add it in the comment section as well.

Pick-to: 6.6 6.5
Change-Id: Id86520cad4c12d83234cc71a00cd3e484e2895dc
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-26 12:40:51 +02:00
Michał Łoś
3f8de9d327 Define PN_XNUM if not defined in elf.h
VxWorks elf.h (nor any other header in its SDK) doesn't contain
definition of PN_XNUM, which meaning is the limit of program headers in
ELF structure, related to `e_phnum` field of `Elf{32,64}_Ehdr`
structures. Since these fields have identical type and seemingly
identical meaning, we can safely assume that its maximum value will be
the same on both systems.

Define PN_XNUM if it's not defined with `0xffff` value taken from
Linux and Solaris related headers.

Fixes: QTBUG-118135
Change-Id: I5a0dab1d1d18e165d01e80823a02f7df644fc7e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 10:57:31 +02:00
Joni Poikelin
799bfe94e8 Fix smooth scaling of Format_Mono and Format_MonoLSB
Fixes: QTBUG-117713
Pick-to: 6.6 6.5 6.2
Change-Id: I2fb071a4d2229da50dfacb0a92c51c3e4ea57a74
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-10-26 07:48:02 +03:00
Tor Arne Vestbø
c5d9e4a7a7 Teach QMessageDialogOptions about default and escape buttons
There's logic in QMessageBox to resolve the default and escape button
if not set by the user. And the user may of course override these.

We now propagate the resulting buttons via the dialog helper, and
pick them up in the macOS native dialog backend. The only common
information we have between the standard buttons and custom buttons
is the button identifier, which for standard buttons is the enum
value, and for custom buttons is an auto generated identifier.
The same identifier is used when reporting the clicked button
from the native dialog helper.

Fixes: QTBUG-118308
Pick-to: 6.6 6.5
Change-Id: I5ca45604b51f0bbf74e56134d7b55bb8911f3563
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 01:20:44 +02:00
Tor Arne Vestbø
d44413d526 Explicitly focus automatic default button in QDialogButtonBox inside dialog
QDialogButtonBox has logic to automatically resolve a default button,
in case one is not already set via QPushButton directly, or via e.g.
QMessageBox::setDefaultButton().

Unfortunately, this default button can in some cases be overridden by
the first button in the dialog button box. The reason this happens
is that the first button is the focus proxy of the button box, so
when the button box gains focus, it will transfer it to the first
button. And since QPushButtons inside a QDialog have their autoDefault
property set to true by default, this focus transfer will also reset
the default button to the focused button.

This arbitrarily happens for any role that happens to be earlier in
the QDialogButtonBox::ButtonLayout than the AcceptRole, and can be
very confusing for the user, so we try to avoid the situation by
explicitly setting the automatic default button as the focus
widget of the button box, unless one is set already.

This is also what QMessageBox::setDefaultButton() does internally.

The only case we're not covering is when the user sets a push button
as default via QPushButton::setDefault(), but we conservatively
assume that the user then also calls setFocus() on the button.

Pick-to: 6.5 6.6
Change-Id: Ibdac0a51ba9439321d4fd7a1dac1ed695e11d693
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
b0ddca18d7 QMessageBox: Do last minute setup in setVisible instead of showEvent
The native message dialogs are shown in QMessageBox::setVisible,
instead of plumbed via e.g. QWidgetPrivate::show_sys (which is not
virtual). And we try to show the native dialog before we call the
base class QDialog::setVisible(), where we end up sending the show
event.

As the native dialogs might rely on the last minute setup of adding
an OK button or detecting the escape button, we need to do it in
setVisible instead.

We can not switch the order of showing the native dialogs after
calling the base class setVisible (and getting showEvent), as
we need to know whether the native dialog could be shown or not
to decide whether to show the fallback widget dialog.

The part from showEvent that added the detailsButton has been
removed, as we're already doing that in setDetailsText().

Pick-to: 6.5 6.6
Change-Id: I23f1d87d542d9dadfd71924f8119c22720f4b276
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-26 00:14:33 +02:00
Michael Weghorn
1b0e76f514 a11y atspi: Don't restrict top-level window to 2 a11y roles
So far, only accessible interfaces of roles QAccessible::Dialog
and QAccessible::Window were taken into account when trying to
find the top-level window in order to calculate the window-relative
coordinates relative to that one.

However, an app doesn't necessarily need to have any such widget/
window as it's top-level object, but can have any widget there.
Therefore, consider any a11y object that is a direct child of the
application's a11y object a top-level window as well.

For example, in the spinboxes example
(qtbase/examples/widgets/widgets/spinboxes/spinboxes), the top-level
widget is a QGroupBox, which has an accessible role of QAccessible::Client,
which maps to ATSPI_ROLE_FILLER for AT-SPI on Linux.

Since that's the top-level widget, window-relative coordinates
should be calculated relative to it.
(Without this change in place, screen coordinates would be
used for the window-relative coordinates as well, as found by
the script attached to QTBUG-106527.)

Also deduplicate a bit and just have a single loop instead
of the extra check on the interface itself at the beginning.

Fixes: QTBUG-106527
Pick-to: 6.6 6.5
Change-Id: I8d2a00bcc22c71d696e4f48233afddc80e93bc1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
78cb91c5ca macOS: Avoid adding modal session for window that's already added
Investigating QCocoaWindow::setVisible idempotence revealed that our
QCocoaEventDispatcherPrivate::beginModalSession() implementation would
happily add the same window multiple times, resulting in trying to
re-start a modal session for the same window when the window was
closed, confusing AppKit's logic for choosing the next key window
when a modal window is closed.

We now bail out if we detect this scenario, even if setVisible has
been fixed. Additional logging has also been added.

Pick-to: 6.6 6.5
Change-Id: I07418c12b421fb0b4ebf875050e32f56fdad6197
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Fredrik Ålund
00ed8d7822 Fix datatype mappings for the Mimer SQL QtSql plugin
Some of the datatype mappings for Mimer SQL are wrong and some are
missing. Also, fix the datatype documentation for Mimer SQL.

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 23:01:56 +02:00
Marc Mutz
fbb1cc234b qmainindowlayout_p.h: make header guard match file name
Pick-to: 6.6 6.5
Change-Id: I922e54f93897ffd82931419afcbba4d148ca5e8d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:56 +00:00
Christian Ehrlicher
bd7c409b9c QCommonStyle: use addIconFiles() to avoid copy'n'paste
Use addIconFiles() instead repeating the addIcon() function with every
size to avoid copy'n'paste errors and make the whole stuff more
readable.

Task-number: QTBUG-118122
Change-Id: I71ab5ca0526024c6f96e20871018b4af43dac3bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:58 +02:00
Thiago Macieira
2fefc8c63c QString/QByteArray: add lvalue and rvalue overloads of left/mid/right
The first/last/sliced API may be what we suggest users use, but the vast
majority of the installed codebase uses left/mid/right because they've
been available since time immemorial.

An additional benefit of this is to make left() and right() available as
inline methods.

Change-Id: Ifeb6206a9fa04424964bfffd1788383817ed906c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
1cce2cceff QString/QByteArray: make the sliced(pos) overload call the other sliced
Complements 00c1c04bd5.

Change-Id: I8f3ce163ccc5408cac39fffd178c543d594cf64f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-25 12:01:58 -07:00
Thiago Macieira
f4101f9953 QString/QBA: add lvalue and rvalue overloads to first/last/sliced/chopped
Those ought to have been the original implementation, when they were
added in commit 38096a3d70, for Qt 6.0.

Because these classes are exported, we need to provide the previous only
implementations for MSVC. All other compilers would provide inline or
emit local, out-of-line copies.

Change-Id: Ifeb6206a9fa04424964bfffd178836a2ae56157d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
2fd0996324 QArrayDataPointer: add an allocating constructor
It's by far the most common use, so having to call two things is just
cumbersome.

Change-Id: I79e700614d034281bf55fffd178f454c4e31929e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Anton Kudryavtsev
793cfec941 qtextengine: use const methods more
to avoid implicit detach

Change-Id: I2fd36fef138eee23c12d413dfec3232ad1fa01df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Anton Kudryavtsev
621f7c8735 qtextengine: replace qlist with qvla
CoW is not required here

Change-Id: Ia0d55dd1e82a225e089ca50f0d3c72bfb52d44f4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Anton Kudryavtsev
1427aa6711 Tidy up qtextlayout
- remove unused variable
- port index-based loop to range-based for
- use const method more to avoid implicit detach

Change-Id: I223f6c221d0c6277e94efd2e7b7be0f8d8456c60
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Morten Sørvig
fde6bdfc5a wasm: add QIODevices for accessing JS data
BlobIoDevice: Supports reading data from a JS Blob,
which can be a File (on disk) or some other object
which can provide data. The native access functions
are async and using this class requires that asyncify
is available.

Uint8ArrayIODevice: Supports reading and writing to
a Uint8Array / ArrayBuffer. Similar to the existing
QByteArray::fromEcmaUint8Array() API, except that it
supports incremental accesss.

Change-Id: Ic5de3534ff75eb6c745287b73b15ccd92d74ac2c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-25 17:56:55 +02:00
Tor Arne Vestbø
cd3a409589 macOS: Include StandardButton::RestoreDefaults when adding native alert buttons
The loop was breaking one button too early.

Pick-to: 6.5 6.6
Change-Id: Ic5027a2e4e35fbd54bf25b310768fd3278d4874b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Tor Arne Vestbø
4a16e51bc3 macOS: Don't refuse key window for direct transient parent of modal window
As explain in detail in 1bde203605, AppKit
doesn't treat non-direct transient parents of a window modal window as
being blocked by that modal window, but Qt does. To align with Qt, we
worked around it by returning NO from canBecomeKeyWindow for windows
that were blocked by a modal window.

This however had an unintended side effect for native dialogs, due
to the way we hide these dialogs. When a native dialog is closed,
AppKit will look for another window to make key, and as part of that
it checks canBecomeKeyWindow. The problem is that the modal blocked
status has not been updated in QGuiApplicationPrivate at that point,
so we tell AppKit it can't make the transient parent key.

The modal blocked status is only updated once we hit QWidget::setVisible,
at which point dialogs like QMessageBox and QColorDialog has already
called setNativeDialogVisible(false) in its setVisible() override,
triggering the close logic described above.

To fix this properly we need to have the dialogs call the base class
first when hiding, and then setNativeDialogVisible(), and also have
the macOS native dialog helpers react to hide() by ordering out the
window in case it didn't work at an earlier point. This kind of
change is risky for Qt 6.5/6.6 however, so we opt for a simpler
solution for now.

By limiting the original workaround for non-direct transient parents
not being blocked to just those transient parents, and only for window
modal dialogs, we avoid the issue with failing to transfer key status.

Task-number: QTBUG-104905
Fixes: QTBUG-118320
Pick-to: 6.6 6.5
Change-Id: Iabbca0b74a7db4e9821a9b60730d01fbad1425db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Tor Arne Vestbø
be268ae197 macOS: Make QCocoaWindow::setVisible idempotent
The implementation of QCocoaWindow::setVisible is not idempotent,
as for modal windows it calls beginSheet/endSheet or starts/ends modal
sessions, which will confuse the AppKit modal session stack.

Once a window has been shown QWindowPrivate::setVisible hides/masks this
issue, by returning early if the visibility has not changed, but during
first show QWindowPrivate::setVisible will update the QWindow state,
before creating the platform window. If the platform window then picks
up the QWindow's visible state during creation, it will result in one
QPlatformWindow::setVisible() call during creation, and another one
via QWindowPrivate::setVisible after the platform window has been
created.

To fix this we can check the existing NSView.hidden state and skip
the setVisible call if it's already up to date. But one complication
is that our QCocoaWindow::setVisible has different behaviors depending
on whether the window has been initialized yet or not, due to how
handleGeometryChange skips sending geometry changes for uninitialized
windows. So we need to also bail out if we're still initializing the
window. This is fine, as we know we'll get a follow up setVisible
call via QWindow, both when QWindow itself creates the platform window
as part of setVisible, as well as when the user does a two step create
and then show.

For good measure we throw in a recursion check as well, in case some
of the logic in QCocoaWindow::setVisible before we update NSView.hidden
recurses back into QCocoaWindow::setVisible.

Pick-to: 6.5 6.6
Change-Id: Ibdcf4859e58d6684aac4490126d35eb12fdd5943
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Volker Hilsheimer
342b37f388 Revert "QAtomic: remove the copy ctor and assignment operator"
This reverts commit 6a93ec2435.

Reason for revert: Breaks qtdeclarative build, submodules need
to be clean before we deprecate or remove APIs.

Change-Id: Id0726b9bfad6072065b380b44b6ff6dffda79e45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-10-25 15:56:54 +00:00
Tor Arne Vestbø
7fb0c2bbf9 QMessageBox: Opt out of native dialog if standard buttons have menu
Amends 2d59f2e8ca, which only checked
this for custom buttons, but standard buttons can also be customized.

Pick-to: 6.5 6.6
Change-Id: Ie8bafcf5007a0b4789b2d0ee1ddbc660a952fee4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-10-25 17:41:32 +02:00
André Klitzing
fd9c567156 Use SSL_CTX_set_dh_auto if DHparam is empty
[ChangeLog][QtNetwork][QSslDiffieHellmanParameters] An empty
Diffie-Hellmann parameter enables auto selection of openssl
backend.

Fixes: QTBUG-117666
Change-Id: Ic2e0529d48542752ca801bcb4d609988e5ddff25
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 17:23:13 +02:00
Volker Hilsheimer
5628600a07 Revert "QWeakPointer: deprecate its relational operators"
This reverts commit bb23a05905.

Reason for revert: this change resulted in a flood of build-breaking
warnings in submodules that need to be cleaned up before we try again.
Also, the discussion following this change shows that this needs more
clarification of the implications and options. Until that is concluded,
the status quo is acceptable.

Change-Id: Id8f67ed585517935c31e29d48099b1c84b787b74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-10-25 11:24:24 +00:00
Huang Rui
993db5a122 forkfd_linux: change childStack size from 4096 to SIGSTKSZ
Starting from qt-6.6.0, the childStack size has been too small to run
qmake or qsb in the sandbox, which will cause segfault.
This problem can be fixed by changing the childStack size to SIGSTKSZ.
For security reasons, some Linux distributions, such as gentoo, will
use the sandbox when building applications. Previously, qt-6.5.0 could
be successfully built in the sandbox. The problem started with qt-6.6.0.
See also: https://bugs.gentoo.org/915695

Pick-to: 6.6
Change-Id: I229c25397f557dd2fec3e0ec53ac68fda28bab13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 14:15:56 +08:00
Zhao Yuhang
fd300f143f Win: minor improvement of the console debug trick
If the application has already attached to the console, the
AttachConsole() API will fail but we can still redirect our
output to the console. The previous code doesn't take this
case into consideration, now it's covered by this patch.

Please refer to the "Remarks" section:
https://learn.microsoft.com/en-us/windows/console/attachconsole

Pick-to: 6.6
Change-Id: I1c5033cc962dcd5a757ff15cc677a51e21330e0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:15:19 +00:00
Giuseppe D'Angelo
6a93ec2435 QAtomic: remove the copy ctor and assignment operator
These special member functions have no purpose.

We never *documented* their semantics. Any code using them is
unconditionally wrong (which semantics was it assuming?), so we can
accept the SIC (type A). If a user needs such a copy, they would have to
reason on the intended semantics (relaxed? acquire/release?) and be
explicit in their code. Especially for assignment, they would need
understand the consequences of the memory ordering that apply on _each_
atomic object involved and not on the assignment operation as a whole
(there are no such semantics).

Testing this change on qtbase has already found bugs.

From a purely technical point of view: we don't guarantee lock-free
atomics nor we require them from the underlying platform. An atomic is
therefore allowed to be implemented as a mutex protecting a value, and
mutexes are not copiable. std::atomic follows the exactly same pattern
(not copiable nor copy-assignable) for exactly the same reasons, and Qt
atomics are implemented on top of std:: ones.

[ChangeLog][QtCore] The copy constructor and assignment operators of
Qt atomic classes (QAtomicInteger, QAtomicPointer) have been removed.
Their usage in user code should be considered a programming error, as no
memory ordering semantics were ever documented for these operations (and
therefore relying on any specific semantic would be relying on
undocumented, unportable behavior). This matches the API of the
std::atomic class in C++. Note that you can still use explicit
load/store operations to transfer a value across two Qt atomic objects,
and therefore use the memory ordering specified for the load/store
operations.

Change-Id: Iab653bad761afb8b3e3b6a967ece7b28713aa944
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:47:47 +02:00
Ahmad Samir
6f9271ce7c QStaticLatin1StringMatcher: touch up API docs
- Fix method name, it starts with a small letter
- Improve grammar in one sentence
- Use "INTEGRITY", less ambiguous and that's how their web site spells
  it

Change-Id: Icfca9d7ebe64cd2f012456507ebf65c1e62f9e9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:14:35 +03:00
Tasuku Suzuki
a86fda6423 Fix build with -no-feature-library
Change-Id: Ief76068a37d32759666e3aa2a24f126f18eca88b
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-10-25 08:37:23 +09:00
Tor Arne Vestbø
ea0b99c006 macOS: Explicitly mark NSView as needing display when unhiding it
AppKit doesn't do this automatically for us, and since we may have
decided to not draw anything when the view was not exposed, we need
to inform clients that its time to draw something now.

Pick-to: 6.5 6.6
Change-Id: Ib2dd969632898ba5640d6848356acd1b97da652d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2023-10-24 23:56:43 +02:00
Mårten Nordheim
13fbedd162 QStringConverter[win]: expose+test control of code-page
Then we can easily test how fromLocal8Bit() and toLocal8Bit() behave
with different code-pages.

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ib1cd3bccd27d598f4c80915557e332befcd96354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-24 22:30:03 +02:00
Timur Pocheptsov
2d59f2e8ca QMessageBox: Fall back to non-native dialog if button has menu
There's no plumbing in QMessageDialogOptions for supporting
native dialog buttons with menus, and even if there was such
plumbing, we don't know if our native dialogs could support
them.

As a workaround, detect the situation and automatically fall
back to the non-native dialog, so the user doesn't need to
set Qt::AA_DontUseNativeDialogs explicitly.

Fixes: QTBUG-118419
Change-Id: Iece7012909261b8869ce0ca23e45e8daaf4babc7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-24 22:10:43 +02:00
Bartlomiej Moskal
9c8651478b Android: Fix for hiding cursor handles
After c80f262258 commit (which fixed
selection for read-only texts), checking if m_handleMode is Hidden was
removed. Because of that hidding cursor handle stopped work correctly.

This commit brings back check if m_handleMode is Hidden.

Also when only one handle is visible, it should be hidden within the
next 5 seconds regardless for keyboard visibility. That is how it is
handled in pure Android apps.

Pick-to: 6.6 6.5
Fixes: QTBUG-117367
Change-Id: I0400f9604234bfad7fe17d74673ae9a93088bab4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-10-24 17:52:06 +00:00
Ahmad Samir
ceee7acf43 qcore_unix: port qt_safe_poll to QDeadlineTimer
Remove qt_poll_msecs() since the "forever" state can be simply expressed
with a QDeadlineTimer::Forever arg, instead of passing a nullptr
timespec, and the negative timeouts treated as "run forever" is also
encapsulated by QDealineTimer.

Use the QDealineTimer(qint64) constructor in the call sites where
the timeout could be negative, so that it creates a Forever timer (the
QDeadlineTimer(chrono::duration) constructor uses
setRemainingTime(duration) which handles negative timeouts by creating
expired timers).

Remove qt_gettime() (and do_gettime()).

Drive-by changes:
- Fix a narrowing conversion warning, qt_make_pollfd() takes an int
- Remove an unused include

Change-Id: I096319af5e191e28c3d39295fb1aafe9d69841e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-24 18:29:45 +03:00
Thiago Macieira
df2e07549e QLogging: disable the message pattern functionality for bootstrap
We only have two tools that use the Bootstrap lib and neither of them
need nor want the message pattern functionality.

Change-Id: Ifa1111900d6945ea8e05fffd177e191ebb6afc4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
36805fc3c4 QLogging: call a non-exported message-formatting function
Instead of the exported qFormatLogMessage() that users can use. Because
it's a local symbol (static function), neither dladdr() nor
backtrace_symbols() functions should be able to see them, making their
exclusion from the list a simpler check.

This doesn't apply when the user calls qFormatLogMessage() in their own
handler, unless the compiler either inlines or tail-calls the new,
internal function. The latter case is very likely.

Change-Id: Ifa1111900d6945ea8e05fffd177e187f55512725
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
232f4f14be QMessagePattern: use the system message sinks for parsing errors
Instead of only printing to stderr or the Windows debug buffer. I guess
this wasn't done before because the code could recurse back and cause
stack overflows. We can do it now without recursion problems.

Change-Id: Ifa1111900d6945ea8e05fffd177e14e2f86ae482
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
e85c64bb6d QLogging: use stderr_message_handler() if we fail to grab the handler
Instead of duplicating its stderr handling.

Change-Id: Ifa1111900d6945ea8e05fffd177e149dfa9afff9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
d614067ea0 QLogging: deduplicate the calls to qFormatLogMessage()
Lift it up from inside of each of the message sinks and instead perform
the formatting in qDefaultMessageHandler(). This necessitated having a
trait indicating whether the sink takes formatted output or not
(currently, only the Apple backend is unformatted).

Change-Id: Ifa1111900d6945ea8e05fffd177e155db9a599cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
039ea9b40f QLogging: simplify qDefaultMessageHandler() with a global constant
Namely, a function pointer to the actual sink function.

This doesn't remove the future ability to iterate over multiple sinks,
but I removed the comment anyway because it doesn't look like we'll ever
implement that.

Change-Id: Ifa1111900d6945ea8e05fffd177de7fa46230259
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-10-24 04:04:19 -07:00
Kai Uwe Broulik
a668ed44dc QtDBus: Use explicitly meta type name instead of method type
In Qt 6, QMetaType sees the underlying type the compiler knows,
so a "using VariantMapMap = QMap<QString, QVariantMap>" typedef
will fail to match a signature of VariantMapMap to QMap<...>
because qDBusParametersForMethod looks for the method type name
whose QMetaType::fromName lookup will fail later.

Pick-to: 6.6 6.5
Change-Id: I142dc42ca86aa8a96f73424ec5da5780f2c1e6a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-23 21:58:23 +02:00
Tor Arne Vestbø
92194ac571 Unify QDialog WA_WState_ExplicitShowHide handling
Instead of checking it inside QDialogPrivate::setVisible and its
overrides, we can check it in QDialog::setVisible, up front.

The logic in QDialogPrivate::setVisible related to modality that
was executed prior to the WA_WState_ExplicitShowHide is now skipped
in the case the WA_WState_ExplicitShowHide condition hits, but this
makes sense as the modality logic has a second part at the end
of the function, restoring the modality, and this part was never
executed as the code was prior to this change.

Change-Id: I9580e91dbc5a981c83538d765b86138afee44f14
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-23 19:42:46 +02:00
Lucie Gérard
c0f13eeb99 Modify copyright format in qt_attribution.json
Multiline copyright entries are entered via string array.

Task-number: QTBUG-111873
Pick-to: 6.5 6.6
Change-Id: Ib8203163db8d5d579117f402b7a89b59ae1a5169
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-23 17:42:45 +00:00
Edward Welbourne
51cfc973b3 Add a QDateTimeEdit::timeZone property
This shall ultimately replace its timeSpec property, which had already
been turned into a derived property of an internal timezone.

[ChangeLog][QWidget][QDateTimeEdit] Added timeZone property to enable
a datetime edit widget to control the timezone used. This makes the
timeSpec property redundant; this old property shall be deprecated
from 6.10.

Fixes: QTBUG-80417
Change-Id: I3cdb686bd2dada0e5067f5b4c1828b73892e424a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-10-23 18:00:52 +02:00