Commit Graph

46990 Commits

Author SHA1 Message Date
Christian Ehrlicher
490dc22ebd QListWidget: rename private functions (remove _q_ prefix)
Cleanup the private function names after the change to pmf-style
connections.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

With those gone, we can remove the entire class.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Extend the existing combobox a11y tests
accordingly.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This amends 4fe865ac7a.

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

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

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

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

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

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

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

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

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

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

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

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

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

Add a test that exercises this.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

For instance:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Amends 7fbc741d10 and
b018bc6e2d.

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

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

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

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

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

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

This avoids QDir overhead just to manipulate strings.

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

This code:

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

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

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

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

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

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

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

So calling disconnect() suffices in this case.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add assertions that check that watcherHelper is not overwritten.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Amends 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6(!).

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

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

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

Fix this by actually linking to the type.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

So use a somewhat more unique name as header guard.

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

Amends 9c706e2567.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter.

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

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

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

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

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

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

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

Introduce a named constructor for this use case instead.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix the documentation.

Amends 6da6a17de9.

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

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

Pick-to: 6.6 6.6.0 6.5 6.5.3
Task-number: QTBUG-116064
Task-number: QTBUG-116076
Change-Id: If8fa35fb8532cf0bbf2ba0438694d95fd9bd6991
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-19 15:03:46 +02:00
Eskil Abrahamsen Blomfeldt
08134e458d Upgrade Harfbuzz to version 8.2.0
Task-number: QTBUG-117136
Pick-to: 5.15 6.2 6.5 6.5.3 6.6 6.6.0
Change-Id: I910c8bff2fe521aa02929b9000fa7f38192d1a51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-19 12:52:48 +00:00
Antti Määttä
720bb62f5c CTF: Fix channel naming
This was erroniously removed in a previous change.

Pick-to: 6.6 6.5
Change-Id: Ia62327bea7e3d190503a0eb05217c0f780f4fe9a
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-09-19 15:45:05 +03:00
Samuli Piippo
15fb832b43 QStorageInfo/Linux: add missing include
Amend 543ae6e6a4 and add include
for dev_t. Needed with MUSL.

Change-Id: Ie7a2ac902af6d34307bf7856619eb9617bf3307f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-19 05:46:00 +00:00
Shawn Rutledge
300614a170 Fix gcc 13 fatal warning: emplace_back() rather than append()
Fixes: QTBUG-116763
Pick-to: 6.6
Change-Id: Ie7c897deb14fcd1ff27277892f0c5a151ff63b41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-19 01:06:12 +02:00
Anton Kudryavtsev
60d6051490 androidjnimain: use rvalue overloads more
Change-Id: Ib4f5bccbf4f384248e2651492337ff5e227adce1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Anton Kudryavtsev
fd7a7e2684 qcommonstyle: use rvalue overloads more
Change-Id: I39bd163ac8203095bbf93a0ada25a179d6bda48c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Anton Kudryavtsev
d1792b1bbe qdistancefiled: use rvalue overloads more
Change-Id: I8c665e6814967f3a0463cbad8686ca28d55ab124
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Anton Kudryavtsev
322ec07d0e qpaintengine: use rvalue overload more
Change-Id: I13c13f9cb043bb639160ac19fa88daefde0cbff1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Anton Kudryavtsev
81a41ac0a7 qpixmapfilter: use rvalue overloads more
Change-Id: I94f641b9d8405d607b54bfae0fe1b0bb914f31b4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Anton Kudryavtsev
2b50d01611 qplatformpixmap: use rvalue overloads more
Change-Id: Ie5b6f6d6ffbcc0bca7a1464ad2eadbf47a707abb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-19 01:29:25 +03:00
Eskil Abrahamsen Blomfeldt
5641a5e1e5 Upgrade to Freetype 2.13.2
Task-number: QTBUG-117135
Pick-to: 5.15 6.2 6.5 6.5.3 6.6 6.6.0
Change-Id: I2485cf286f590eccee9c4be4bb19559631288fd5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-18 20:26:55 +00:00
Laszlo Agocs
ffb857e9d0 Sync rhi backingstore prefer-software env.var with Quick
Behaving differently in QQuickWindow vs. a QRhi-based widget
window is not great for WebEngine. The env.var naming is not
the best (QSG prefix) but we already have some precedent for
this (recognizing QSG_INFO in QRhi), and there is no other
choice anyway.

Pick-to: 6.6 6.5 6.6.0 6.5.3
Task-number: QTBUG-116445
Change-Id: Ibfd495cbd1d42502441d6629325bdeb033e813f3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-18 20:26:22 +00:00
Ilya Fedin
12d6fc5229 xcb_egl: Prefer eglCreatePlatformWindowSurfaceEXT to eglCreateWindowSurface
Change-Id: I32de5b241cce786318434e7653ff979cf8e82f0e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-09-19 00:13:30 +04:00
Axel Spoerl
6f5136ef66 QMessageBox::about / aboutQt - use native modal dialog on iOS
The about / aboutQt statics in QMessageBox used a non-native, non-modal
dialog box on all operating systems. This creates a grid layout with
labels for heading, text and icon.

This has two unwanted side-effects on iOS:
- When the screen size is not sufficient to display all text, the text
is not rendered. On an iPhone SE for example, only the Qt icon is visible.
- When the screen height exceeds the minimum requirement, the informative
text is bottom-aligned.

=> Show about(Qt) message boxes in a modal, native dialog.
=> Update documentation.

This partly reverts aafed07dee.

[ChangeLog][iOS] QMessageBox::about(Qt) now shows native, modal dialog.

Fixes: QTBUG-115832
Pick-to: 6.6 6.5 6.2
Change-Id: I4cfbce416e7d2717058bef9a050a85d424b8a03d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-18 18:24:37 +02:00
Ivan Solovev
ab9f5a9a0b QAbstractAnimation: avoid spurious dependencies on the state property
The state property is read-only, meaning that it can only be modified
from the class internals. At the same time, the public start(), stop(),
pause(), and resume() methods, as well as a private setState() method
can be called from other property setters, thus creating an unwanted
dependency on state.

Fix it by using valueBypassingBindings() when reading the state.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I404cd2141ea52b8ffed5edbb4261a535cd329ec2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-18 18:24:37 +02:00
Andy Shaw
4583d808ea SQLite: Update SQLite to v3.43.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.1

Pick-to: 5.15 6.2 6.5 6.6 6.6.0
Fixes: QTBUG-117139
Change-Id: Id4f7d55adb317f009613245510c4eb26678ddc7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-18 15:10:22 +00:00
Allan Sandfeld Jensen
cb42c94078 Compress UpdateLater events
Handle UpdateLater events in QApplication::compressEvents

Pick-to: 6.6
Change-Id: I0c63f88d8ed90fc56c093c534394461797d1336b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-18 15:50:43 +02:00
Ievgenii Meshcheriakov
178a5d15ef QDBusConnectionPrivate: Protect access to serverConnectionNames with mutex
This list is accessed by ~QDBusServerConnection in a user thead.

Task-number: QTBUG-116621
Change-Id: Ic115612b2a0f12fd9f69f38f4662dc36fffbf178
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-18 15:50:43 +02:00
Ievgenii Meshcheriakov
eacff46af4 QtDBus: Check if QDBusServer is destroyed before accessing it
Also lock before accessing serverObject member, it is cleared
by ~QDBusServer().

Task-number: QTBUG-116621
Change-Id: I14c96e34316a46fe43ecd929e44cd1800ba8b803
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-18 15:50:43 +02:00
Thiago Macieira
2156778184 QOperatingSystemVersion: Move the new OSes into a non-exported class
The solution from commit 3446313c7a didn't
work completely as expected. That commit the QOperatingSystemVersionBase
base class so we could add new static constexpr inline variables to
QOperatingSystemVersion in patch releases. We need a different base
class because you can't have constexpr variables of incomplete types and
the the type isn't complete inside its definition.

However, QOperatingSystemVersion is an exported class and there's an
unexpected interaction between __declspec(dllexport) / dllimport and
inline variables: they're imported from the DLL that exported them. For
Qt 7 we can remove this class's export, but not until then.

This commit adds to the fix by introducing a middle base class, so we
can add the static constexpr inline variables.

Pick-to: 6.6 6.6.0
Change-Id: Ifa1111900d6945ea8e05fffd177e0b696209c7af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-18 12:58:26 +00:00
Vladimir Belyavsky
6b4cc9bf73 QNetworkConnectionEvents: fix potential nullptr access
Fix potential nullptr access in
QNetworkConnectionEvents::getNetworkConnectionFromAdapterGuid().
This can happen if for some reason the NetworkListManager instance
failed to be instantiated in QNetworkConnectionEvents constructor.

Fixes: QTBUG-117097
Pick-to: 6.6 6.5
Change-Id: If51ea383e22461a6c3124576c4e1be3f30dde1f6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-18 12:21:44 +00:00
Anton Kudryavtsev
1e25bf5f4d platforms/windows: use qimage rvalue overloads more
Change-Id: If827f0daa5036dbc9855c0209ec0621a9e8bf78e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-18 10:14:33 +03:00
Anton Kudryavtsev
0ed8db7800 QString::toHtmlEscaped: avoid unconditional copy
Let's find replaceable chars and then do copy

Change-Id: I2d365626218b0daf2023144dee7e901e8e99adc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-18 10:14:22 +03:00
Anton Kudryavtsev
bd5d313197 QString::replace: replace QList with QVLA
to reduce allocations

Change-Id: Iacc34e3a8825ca6425e8716f2b5e7b5dde2a5df7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-18 10:14:16 +03:00
Anton Kudryavtsev
48a44cdf65 QString: use first and last more
It's safe here, precondition is earlier

Change-Id: Ib2192fc729cd012d0983843678c546283a655bfd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-18 10:13:59 +03:00
Thiago Macieira
9edb835904 IPC: Move the legacy key to the QNativeIpcKey
This is needed to support passing it to other processes so they can
enable legacy, compatibility mode. Right now, there's no such code, but
I am 90% certain we'll need it soon in 6.6.x, if not for compatibility
changes in the future.

There's a bug in passing a QNativeIpcKey to another process that causes
QSharedMemory to use the wrong QSystemSemaphore for control (a feature
that should never have existed in the first place, but we're 15 years
too late on that). I have not yet investigated a fix for this, but it
will likely involve knowing the original legacy key.

Pick-to: 6.6 6.6.0
Change-Id: Idd5e1bb52be047d7b4fffffd1750b547013cb336
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-17 18:10:18 -07:00
Thiago Macieira
18867845eb IPC: disallow unknown queries in QNativeIpcKey string form
So we can add them in the future but cause older versions of Qt to
reject them if they don't know what they are.

Pick-to: 6.6 6.6.0
Change-Id: I512648fd617741199e67fffd1782b85935bb832a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-17 18:10:18 -07:00
Thiago Macieira
eb5c5a76cf IPC: Remove the "small" object optimization in QNativeIpcKey
The original design was supposed to be small, at a single pointer, but
that never made it through, with the "QString key" member. So the
anonymous union for typeAndFlags overlapping with the extension pointer
was just unnecessary headache.

So separate the two. This means QNativeIpcKey's size increases from 4
pointers to 40 bytes on 64-bit systems and to 24 bytes on 32-bit systems
(so we have 6 unused bytes on both architectures).

Fixes: QTBUG-116821
Pick-to: 6.6 6.6.0
Change-Id: I512648fd617741199e67fffd1782b7d5ba5ddd12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-17 18:10:18 -07:00
Thiago Macieira
b5584ed224 IPC: make the two platformSafeKey functions return QNativeIpcKey
There's no need to return QString, only to create the QNativeIpcKey
elsewhere, when nothing uses this intermediary QString (those two
functions aren't used in unit tests any more, since the two "IPC: add
native key support" commits (2c286561bb
and 3ae052d3bb). Since they aren't used in
the tests, we can remove the Q_AUTOTEST_EXPORT macro too and the
unnecessary default argument.

I'll need the ability to return QNativeIpcKey to store the original,
legacy key inside of it.

Pick-to: 6.6 6.6.0
Change-Id: Idd5e1bb52be047d7b4fffffd17506c05e4f61f79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-17 18:10:18 -07:00
Nicolas Fella
b2e5f70490 QDBusConnection: Print error from prepareHook
When the operation fails we print a warning, but that warning does not
include the error message that prepareHook internally collects but
ignores.

Printing the error is useful for debugging.

Pick-to: 6.6
Change-Id: I946c4781942115a17ffd43a79bff7676b6674be1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-17 23:39:04 +02:00
Giuseppe D'Angelo
2fd4a86dc5 QDataStream: prevent accidental streaming of pointers
It doesn't make sense to stream a pointer, but it can happen by
accident because ds << ptr will select the operator<<(bool) overload.
Disable the out-stream operator for pointers by having a better match.

Reading a pointer from a QDataStream doesn't work, as a pointer
can't bind to e.g. a bool non-const reference.

[ChangeLog][QtCore][QDataStream] Streaming of arbitrary pointers
using QDataStream has been disabled. Note that such streaming happened
through the streaming operator for bool.

Change-Id: I4c98a33b52aae85e441f5a096efd404fbbf1e95f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-17 18:33:47 +00:00
Vladimir Belyavsky
b0ba5c78ee QWindow: bail out early on resize() if size has not changed
On some platforms, like Windows and Linux, calling resize() may
unexpectedly reset window state even when the actual size has not
changed. So, bail out early on QWindow::resize() if new size is the
same.

Task-number: QTBUG-115699
Change-Id: I64ad611044008964b5201951a50f3866e2108b49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-09-15 20:51:29 +00:00
Edward Welbourne
9c0def81e4 Warn on failure to construct valid system time zone object
Also move some docs from asBackendZone() to systemTimeZone(), making
clear that the system zone object is current at the time of creation
and won't be updated if the system is reconfigured. Adapt some tests
to fail and make clear that the system is misconfigured if no valid
system zone is found.

[ChangeLog][QtCore][QTimeZone] If systemTimeZone() is unable to
identify a valid system time zone, it now produces a warning the first
time it encounters the problem.

Task-number: QTBUG-116017
Change-Id: Ia437d8a03ff3cbf2b2cd98e8a8c3aebe50c1ee32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-15 21:53:36 +02:00
Edward Welbourne
59bf9160cc Fix warning on invalid time-zone lookup
Amends commit 569dc0de50 to still return
when no zone file is found with the given name, as the code did
before.  Attempting to continue past the error was provoking warnings
from QIODevice::read().

Pick-to: 6.6.0 6.6 6.5
Task-number: QTBUG-116017
Change-Id: I0e224a6b30a3f32cd925d87ffba4dcb24f9b8568
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-15 21:53:36 +02:00
Edward Welbourne
781042efcb Implement some TODOs: make use of GLibc's tm_gmtoff and tm_zone
Save some complicated computations using struct tm and (effectively)
time_t used in working out local-time's UTC offset and updating the
local time's representation in terms of seconds (since a nominal local
epoch). GLibc gives us the offset for free, making computation of the
seconds easy.

Use the same extension to catch an opportunity for a seldom-needed
early return in one more case.

When determining a zone's abbreviation, we can use tm_zone as a
short-cut to save some mutex-locking.

Change-Id: Id2958f75c1d49ad4aed8f9c483ec13f4fe3a86c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-15 21:53:36 +02:00
Edward Welbourne
b6761d098b Don't assume time-zone offsets at epoch were multiples of five minutes
Africa/Monrovia violates that assumption. We can replace the tests
that relied on it with another, but only when we know the offset from
UTC (to come in later commits).

Change-Id: Iccc4f03f4e0e4087530cb5ca0c7d26ee4177d01e
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-15 21:53:35 +02:00
Edward Welbourne
644ad1fa1a Rework resolution of local time
Ensure we do know about - and handle - transitions whenever one is
implicated. Make their handling more consistent between platforms
instead of depending on (and in some cases kludging around) quirks of
the underlying time_t functions.

Change-Id: Iefa8dda0d8da78b860e06cee895c9dd268d7a4e5
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-09-15 21:53:35 +02:00
Friedemann Kleint
98e0600c5a Add Python-specific note to QOpenGLContext::aboutToBeDestroyed() documentation
The signal is not received when emitted from the destructor.

Pick-to: 6.6 6.5
Fixes: PYSIDE-2460
Change-Id: Ic2273c5b9ef1f53bd58615b6982016e646aee326
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-09-15 21:47:44 +02:00
Giuseppe D'Angelo
1399b3ccce Apple event dispatcher: "clarify" copy semantics of ProcessEventsState
QEDCF::processEvents makes copies of ProcessEventsState, which contains
atomics. The memory ordering semantics when those atomics are used
are not clear at all -- given the lack of comments in the code around
them, and the lack of named operations (e.g. loadAcquire).
In principle, it looks like relaxed ordering could even suffice.

However, I'm not confident in making such a change. For now, avoid a
direct copy (assignment) of the atomics themselves (those operations
are meaningless), and use very conservative semantics when copying
ProcessEventsState.

Change-Id: I8584ff3fe9fef52385bd438235ee823bdbab8a42
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-15 21:47:44 +02:00
Santhosh Kumar
25c9f59546 Show command link button in respective color for windowsvista style
The command link button was shown in active color even when its disabled
while using windows vista style and the patch
e9cf618a9d further cause regression when
hovered over it.

This patch fixes it by setting color for corresponding color group in
windows vista style.

Pick-to: 6.6 6.5
Change-Id: I9a8f62f8c5895592571978ec7c9abccfc69e64a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-15 21:47:44 +02:00
Giuseppe D'Angelo
cadae8b6e6 QWindowsFontDatabase: drop an usage of an atomic type
UniqueFontData has an atomic refcount internally. I guess this was
deemed necessary because font engines living in different threads may
call refUniqueFont / derefUniqueFont and the refcount has to be thread
safe. Those functions now are mutex protected (as they access the same
map), so we don't also need atomicity for the refcounter.

Change-Id: Ic223a12f4a61b7dcc567b3a5dcbe367eaa916004
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-15 19:44:33 +02:00
Bartlomiej Moskal
0f0ab90cf6 Android: Handle ImhNoTextHandles flag from InputMethodHints
[0]Qt::InputMethodHints has a flag ImhNoTextHandles that was not
handled. This flag should be considered when QAndroidInputContext is
updating Text handles position.
What is more, this flag can be used to fix the problem with visible
text cursor out of the text object.

[0]https://doc.qt.io/qt-6/qt.html#InputMethodHint-enum

Task-number: QTBUG-115005
Pick-to: 6.6 6.5
Change-Id: Ie50b77d7afbadfebe73f10137f09da9560aea1ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-09-15 13:36:15 +00:00
Volker Hilsheimer
fca11e0112 Doc: fix name of return argument in prototype
The documentation refers to it as \a ret, so call it ret rather than
just r.

Pick-to: 6.6 6.5
Fixes: QTBUG-116890
Change-Id: I12d8c3cfd33d5718d88794ca87bff996a27423ee
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-15 15:36:15 +02:00
Arno Rehn
ba2ebc24a1 QtFuture: Prevent whenAll()/whenAny() from creating reference cycles
whenAll() and whenAny() create a shared context object which is
referenced by the continuation lambda. The refcount of context is only
correctly managed when it is copied non-const to the lambda's
capture list.

Fixes: QTBUG-116731
Pick-to: 6.6 6.6.0
Change-Id: I8e79e1a0dc867f69bbacf1ed873f353a18f6ad38
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-15 13:36:15 +00:00
Joerg Bornemann
828770c60c CMake: Fix condition of the ipc_posix feature
The ipc_posix feature was OFF despite the following test values:
    TEST_posix_shm ON
    TEST_posix_sem ON
    TEST_sysv_shm OFF
    TEST_sysv_sem OFF

The 'NOT (TEST_sysv_shm AND TEST_sysv_sem)' part of the condition is not
correctly evaluated. Resolve the parentheses to work around this issue.

Pick-to: 6.6.0 6.6
Fixes: QTBUG-117052
Change-Id: Idac23d207f8dd644d059977ca41b6e32b17b3a49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-15 15:26:06 +02:00
Anton Kudryavtsev
b629bdc085 qmimedata: reduce allocations
use QBAV more

Change-Id: Id7fdf5dcb19cd4011317adf5c635a9d974d7d98a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-15 16:26:05 +03:00
Alexey Edelev
630d3328dd Iterate over all extraPrefixDirs when collecting "directories"
When collecting plugins required for the android application according
to linked targets we should take into account all prefix directories.
But not only the first one. Otherwise the order we use when adding
paths to extraPrefixDirs will affect collecting of the plugins. This
specifically leads to the issue if the user project builds custom Qt
plugins. The plugin directory from user project build tree will be
found first and all plugins from Qt installation directory are
discarded.

Pick-to: 6.6 6.5
Fixes: QTBUG-116920
Change-Id: Id94ebaf5ccd1a279a74b38b59ff535f45230e1b4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-15 12:48:57 +02:00
Eskil Abrahamsen Blomfeldt
9fe47cf2e1 Fix crash when reading corrupt font data
When loading the font data, we had some unprotected reads. To harden
this, we check everything against the length of the font data
before reading.

[ChangeLog][QtGui][Windows] Fixed a possible crash that could happen
when loading corrupted font data.

Fixes: QTBUG-116773
Pick-to: 5.15 6.2 6.5 6.6 6.6.0
Change-Id: I156df3b8833c9ed785fcc690821a7a74d9a51126
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-15 07:36:39 +02:00
Giuseppe D'Angelo
a1b55b1360 QWindowsFontDatabase: fix a data race
QRawFont::loadFromData can be called from any thread. It calls into
QPlatformFontDatabase::fontEngine. The code path may end up creating a
UniqueFontData and storing it a QWindowsFontDatabase member (a QMap).

Two threads calling loadFromData (on different QRawFont objects)
will therefore race on the mutation of the map.

Add the missing mutex protection.

Change-Id: Ib38c2b3539679c820d997a6548e4b397cbc2bb73
Pick-to: 6.2 6.5 6.6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-14 23:57:33 +02:00
Giuseppe D'Angelo
2bc475f94e QWindowsFontDatabase: avoid multiple map lookups
Use the iterator-based API, and avoid a quadruple (!) lookup into a
QMap.

I'm aggressively cherry-picking to avoid merge clashes with an upcoming
fix.

Pick-to: 6.2 6.5 6.6
Change-Id: I05968f4aec9e42f84f909a1103e43ba323a9544f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-14 23:57:33 +02:00
Giuseppe D'Angelo
284b1a5661 QUpdateLaterEvent: code tidies
Remove the empty destructor. Compiler-generated one is fine.

Change-Id: I1599b84a876ebd7ba22f63c545506feffc7b18bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 23:57:33 +02:00
Liang Qi
f7519a89d2 GUI: give more warning when can't load xcb since 6.5.0
normally because new depedency of xcb-cursor0 or libxcb-cursor0 is
missing.

Pick-to: 6.6 6.5
Task-number: QTBUG-108796
Change-Id: I040e9c0932bbf1f9026b365ded462c7373b219b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-14 19:41:42 +02:00
Laszlo Agocs
737dd95950 rhi: Map DXGI_ADAPTER_FLAG_SOFTWARE onto the driverInfo's CpuDevice
Fixes: QTBUG-116756
Change-Id: I6218ea3f59716873853b8bf83b18e0a799eedcc3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-09-14 19:13:50 +02:00
Tor Arne Vestbø
5994e94fd1 macOS: Reset NSApp main menu temporarily when re-using top level menu
AppKit's built in logic for customizing menu entries, such as adding
text input (emoji, dictation) entries to the Edit menu, happens via
[NSApplication _customizeMainMenu], which is triggered either from
[NSApplication finishedLaunching], or [NSApplication setMainMenu:],
but in the latter case, only if the menu is different.

In our case, we might be re-using the same menu as before, but the
menu now has additional sub menus such as an Edit menu. In that case
we still want AppKit to do its magic, so we need to reset the main
menu temporarily to nil so that AppKit sees the menu as a "new" menu.

Pick-to: 6.6 6.5 6.6.0
Fixes: QTBUG-116903
Change-Id: Ibd9da72fb81b7cd1d707bd350a62d0c93356dbd4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-14 17:13:50 +00:00
Marc Mutz
16433a4a6e Long live Q_(U)INT128_C()!
Compilers that support 128-bit integer types usually don't have
support for 128-bit literals, so provide Q_(U)INT128_C macros and back
them with UDLs. This, of course, only works in C++, so until compilers
provide built-in literals that support C, too, that's all we get.

[ChangeLog][QtCore] Added Q_INT128_C() and Q_UINT128_C() macros to
create qint128 and quint128 literals in a platform-independent way.

Pick-to: 6.6 6.6.0
Fixes: QTBUG-116822
Change-Id: I4be645baf2e007ee1aa1a27f9b5166671806dc49
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 18:39:24 +02:00
Giuseppe D'Angelo
5ac97a38e8 QObject: do not copy a ConnectionList object
The semantics of copying a ConnectionList are not defined; the type
is copiable by accident. Use a reference to the list instead (like done
in other places in the code).

Change-Id: Ifbc5d3baca992f3eb13e3781378e79ed1feb4e1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:58:17 +02:00
Ievgenii Meshcheriakov
e49d8444dc QDBusArgumentPrivate: Disable copy and move, make constructor protected
Disable copy and move for the class because it is polymorphic.

Make the constructor protected because instances of this
class are not supposed to be created directly.

Mark drived classes final.

Change-Id: Ia6f2d640f3642ad4a6ecb3830fba152155e237b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:46 +02:00
Ievgenii Meshcheriakov
37af09adf0 QtDBus: Resolve libdbus functions in a thread-safe way
Use atomic pointers.

While at it, declare the function type with `using` instead
of a typedef for better readability, do the declaration
locally so that less preprocessor concatenation is needed,
use reinterpret_cast instead of C-style cast.

Change-Id: I5ed0d35b7ddfdd62ef6c12403fe7052019453f34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:28 +02:00
Ievgenii Meshcheriakov
bfdefa81f8 QDBusArgumentPrivate: Specify direction as argument to constructor
This avoids having direction member uninitialized by mistake. Make the
member variable const as it is never modified.

While at it, make Direction and enum class.

Change-Id: I53814ae9e1d6bcf786433674619145a1ee61e063
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:24 +02:00
Ievgenii Meshcheriakov
946992b9b0 QDBusArgumentPrivate: Use type-safe enum for flags
Declare flags as QDBusConnection::ConnectionCapabilities
instead of bare int. Do the same for derived classes
QDBusMarshaller and QDBusDemarshaller. Make the constructors
explicit, replacing useless `inline` where it was used.
Make flags argument default to empty flags.

Change-Id: I6caedde06b2ef41d725f15348ee780d1cc20b355
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:22 +02:00
Ievgenii Meshcheriakov
e4eabbf3e4 QDBusArgumentPrivate: Initialize member variables inline
For better readability and ease of modification.
Do the same for derived classes.

Change-Id: I9601f0b280feb5e3d0e71ed4a3405fdd9cca8dd2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:18 +02:00
Viktor Arvidsson
b2aeac9891 QTextFormat: Allow merging unset properties
There was no way to merge removal of properties which is required in
case you want to unset some property on the current selected text in a
text document. For example in case your text has font size set in pixels
and you want to change it to point size, that would be impossible before
this change. With this change you can set the font point size to what
you want and then set font pixel size to QVariant().

This is maybe not the most obvious way to do it but any other way I
could think of would require new api and quite some code duplication.

[ChangeLog][QtGui][Text] QTextFormat now allows setting properties to an
invalid QVariant to allow clearing properties via a merge. This changes
behavior slightly where code iterating over a QTextFormats properties
would never encounter invalid variants, which is now possible if
setProperty with an invalid variant was used instead of using the
clearProperty function to remove properties.

Change-Id: Ie8290088d457bf19d9c4785cfe91ae6a1de572c4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-14 00:44:49 +02:00
Albert Astals Cid
ae83f327cd ios: Fix crash when closing app while showing a native screen
Fixes: QTBUG-117021
Pick-to: 6.6 6.5
Change-Id: Icebae0e815b42c6e0bf39e727fd1a16db5752d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 22:09:54 +00:00
David Faure
549ed4fb24 QMimeType: simplify implementation of filterString
As suggested by Ahmad Samir

Change-Id: I7f3ef29436a7725b6dceab72bd0f8b01756bf930
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
David Faure
071a9c9061 QMimeDatabase: introduce QMimeMagicResult to accumulate magic results
Better than two pointer parameters. However it can't be a return
value as we initially thought, it's an in/out parameter, in order to
compare the results in the current directory with those found in earlier
directories.

Change-Id: Ic6137f2627703f8d6930c3f7dd1a1102187eef30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
David Faure
1f0bc1ade3 QMimeDatabase: fix glob-deleteall support for the binary providers
This fixes the recently added QEXPECT_FAIL about glob-deleteall
in a local directory (with a binary cache). Before adding a glob match
we ask the more-local (higher-precedence) directories if they have
a glob-deleteall for that mimetype, and skip it then. This "asking"
is a virtual method, implemented for both XML and binary providers.

Change-Id: I6e4baf0120749f3331fd2d9254bea750a322b72d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
Santhosh Kumar
42e164f5ad Update version for QPalette::accent API in documentation
Follow up patch to 3c391c159ce0e29a9a654edee45bd64bcde6ccd2.

Pick-to: 6.6
Change-Id: I23235ae8516a53cf09c00b0daedc054df2f0cfa8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-13 21:41:22 +02:00
Rym Bouabid
dcc0844056 Revamp Wait Conditions Example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108860
Pick-to: 6.6 6.5
Change-Id: I1dec2ad107e3f9ff9b4203960ba54ae6d0d8c7b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
2023-09-13 20:45:18 +02:00
Rym Bouabid
70815d31fe Revamp Semaphores example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108859
Pick-to: 6.6 6.5
Change-Id: I8b0370c9a85179e172918231ae48a3c52845bf21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
73a1ae6ea9 Revamp Mandelbrot example: Revisit the documentaton
Remove "Example" from the title.

Edit the link (title) to the documentation of Mandelbrot in QThread
documentation.

Delete the foreach related sentence as we are trying to port away from
this Qt pseudo-keyword.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5 6.6.0
Change-Id: I6d04f24ac9c1fa1efe30a947c2da2ec7475edc80
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:16 +02:00
Orkun Tokdemir
32e2a910f1 CMake: Enable depfile for Makefiles generators
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8570 introduces AUTOMOC to use depfile with the Makefile generators, the depfile usage can be enabled for them in qtbase.

Change-Id: Ie18460fd2c4703ad75eb88662445ebe961d4e895
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-13 20:45:16 +02:00
Edward Welbourne
569dc0de50 Support the TZDIR environment variable
On Linux / glibc, this overrides the default system location for the
zone info. So check for files there first. Break out a function to
manage the trying of (now three) zoneinfo directories when opening a
file by name relative to there.

Pick-to: 6.6 6.5
Task-number: QTBUG-116017
Change-Id: I1f97107aabd9015c0a5543639870f1d70654ca67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 19:51:47 +02:00
Morten Sørvig
bd79ebb6d0 wasm: simplify calling runOnMainThread()
Add a static runOnMainThread() function to QEventDispatcherWasm
which looks at QT_CONFIG(thread) and calls the correct
qstdweb overload. Then, we don't have to use a #define to
enable or disable the proxyingQueue argument.

Use the <void> version of qstweb::runTaskOnMainThread,
like before the 141f0ca33 change.

Change-Id: Id8324a17c27ffce8db7acf235ad4c9e465790e0b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-09-13 17:51:47 +00:00
Morten Sørvig
37dde96e5f wasm: fix "'QString' is deprecated" warnings
Use the _L1 operator from Qt::Literals::StringLiterals

Pick-to: 6.6
Change-Id: I3d8dc0b7219879a1907e67b539e047ae7f7aae87
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 19:51:47 +02:00
Timothée Keller
8dbc482489 Windows QPA: Adjust margins for Windows App SDK compatibility
If using the ExtendsContentIntoTitleBar() method from the Windows App
SDK, the top margin becomes zero. The current approach does not account
for this, since it relies on the AdjustWindowRectExForDpi function.
Do a manual check after and correct if necessary, by comparing the
window and client sizes.

Fixes: QTBUG-113736
Pick-to: 6.6 6.5
Change-Id: I62e0338b3ff7af47f5525dcccd0f9acfe9691819
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 18:24:47 +02:00
Axel Spoerl
4bc8f54822 QOpenGLCompositorBackingStore: ensure backing store on flushed windows
When the first QEglFSWindow got created for a QWindow, a backing store
was created with it and associated to the new QEglFSWindow. When the
window was hidden on the platform screen, the QEglFSWindow got deleted
and re-created when it was supposed to be shown.
The re-created QEglFSWindow was no longer associated to the backing
store. It was therefore not rendered on the screen.

=> ensure that the backing store is re-associated to the QEglFSWindow,
corrsponding to the QWindow argument passed to flush().

No autotest is added, because the fix is purely visual.
The widgets/menus example can be used to test the functionality
manually (see bug reports).

Fixes: QTBUG-115196
Fixes: QTBUG-116769
Pick-to: 6.6 6.5 6.2
Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-09-13 16:06:33 +02:00
Anton Kudryavtsev
e26e6d6725 qtextlist::itemText: reduce allocations
Don't create tmp QBA, just append to QString directly

Change-Id: Ib7c469ef7b9b459fbc2df662adbe613c8d74d88a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-13 17:06:32 +03:00
Artem Dyomin
60113056bc Optimize cond var notification
Notification of a conditional variable shouldn't be under the locked
mutex, as it may affect extra mutex contentions.

Pick-to: 6.5 6.6
Change-Id: Ie8429eca3f36e9a6e8e5ad2e0337bbf508f5b326
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
David Faure
4e9944e6c8 QMimeDatabase: collect glob patterns from all locations
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d648, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).

The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.

Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
Eskil Abrahamsen Blomfeldt
6ab362a7ea Mark feature API in QFont as preliminary
Using ints for the tags is not ideal. There is no type safe
way to do conversions from strings, and how the int corresponds
to the four-byte tag is not clear from the API, so user code
can end up being less readable due to this.

Especially since this type of tag is a data type used several
places in fonts, and we will need them again for implementing
support for variable axes, it's worth giving this an extra
round of polish.

Since it was not addressed in a timely manner and we don't want
this to delay the upcoming release, we mark the API as
preliminary for now, to give ourselves the option of changing it
to something.

Pick-to: 6.6
Fixes: QTBUG-116929
Change-Id: I498478785dcd5ece954151f01f1a017828d6b8b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-13 11:58:35 +02:00
Kaj Grönholm
743c1cf96b Round the image scaling when not antialiased
When painting an image with antialiasing not turned on, round the
target area to closest integers (pixels).

Task-number: QTBUG-116297
Pick-to: 6.6
Change-Id: I64e78a9087ee042aef0ea297c48b5ead36697d10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-09-13 12:05:59 +03:00
Marc Mutz
104a0a9ecd Long live Q_(U)INT128_MIN/MAX!
Since compilers don't provide such macros, do it ourselves.

In order to test these macros, add ad-hoc specializations of
QTest::toString() for qint128 and quint128 locally to the test. Turns
out it's not too hard to write them, so we might move them to a public
header, yet.

Pick-to: 6.6
Change-Id: I1483f3af2ccec6038e1c780649f9ffe413bb59ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 09:18:40 +02:00
Marc Mutz
454636afec Document q(u)int128 and QT_SUPPORTS_INT128
[ChangeLog][QtCore] Added qint128 and quint128 typedefs on platforms
that support them.

Pick-to: 6.6
Fixes: QTBUG-116925
Change-Id: Ibd55cb0b1931b48a91598d3165e5911e3a4079f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-13 09:18:40 +02:00
Marc Mutz
32f66f7008 Add some tests for q(u)int128
Check that QIntegerForSize<16> and std::numeric_limits<quint128> work
and that q(u)int128 are available in C mode, too.

Pick-to: 6.6
Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 09:18:40 +02:00
Thiago Macieira
39d3af0c29 qsimd_p.h: rework the check for x86-64-v3 features
Instead of checking that all the features be present if any of them are
-- which is not an acceptable proposition, because each of them were
productized in at least one processor before -- let's simply insist that
they all be present if AVX2 is. That's what we can guarantee: all AVX2-
capable processors are capable of:

- AVX and earlier SSE (architecturally implied, so not checked)
- BMI1
- BMI2
- F16C
- FMA
- LZCNT
- POPCNT

This restores the original set of features that were checked in commit
ad65bbe4c0 when this was introduced, but
only if AVX2 is set. It also POPCNT, which was introduced with the
Nehalem architecture (which matches x86-64-v2) but aren't implied by
AVX.

GCC's -march=x86-64-v3 implies CRC32, but -march=haswell does not
because there were SKUs lacking CRC32, AES and PCLMULQDQ. This is
probably a bug in GCC.

Fixes: QTBUG-116357
Task-number: QTBUG-111698
Task-number: QTBUG-107072
Pick-to: 6.5 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177e113eaa506dde
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 19:05:47 -07:00
Marc Mutz
6da6a17de9 Fix qHash(qfloat16) to match Qt 6.4 behavior
There were two problems:

- On platforms where QFLOAT16_IS_NATIVE == true, a qHash(qfloat16{})
  call has become ambiguous between the three FP qHash() overloads
  (float, double, long double), where it was unambiguously calling the
  float one in Qt 6.4. This SiC was caused by the replacement of
  operator float() by operator __fp16() in
  99c7f0419e, which is in Qt 6.5.

- On platforms where QFLOAT16_IS_NATIVE == false, qHash(qfloat16{})
  would produce a different value from qHash(float{}), and therefore
  Qt 6.4, when the seed was != 0, because the former would go via the
  one-arg-to-two-arg qHash adapter while the latter one would
  not. Since participating functions are inline, this causes old and
  new code to produce different hash values for the same qfloat16,
  leading to a BiC possibly corrupting QHash etc.

Fix both by adding an explicit qHash(qfloat16). This function is
inline, so it doesn't add a new symbol to 6.5.x.

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

Pick-to: 6.6 6.5
Fixes: QTBUG-116064
Fixes: QTBUG-116076
Change-Id: Id02bc29a6c3ec463352f4bef314c040369081e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 21:12:50 +00:00
Marc Mutz
5503b47893 Qt UDLs: avoid the deprecated form of UDL definitions
cppreference.com says¹ that the space after the "" is deprecated now,
so remove the space. Let's just hope all our compilers support this,
otherwise it will get ugly².

¹ https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators
² https://github.com/yhirose/cpp-httplib/issues/953

Pick-to: 6.6 6.5 6.2
Change-Id: Ic8e4939e3ba713023c5a5c020305c96b521dbda9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 23:12:13 +02:00
Anton Kudryavtsev
83c2c50554 QBA::replace: avoid unconditional detach
Let's find needle and then do detach
While touching code, replace raw loop with algorithm
and add early out: compare before and after args

Change-Id: I22403fd3d6920d941b65e79f44b46e49a9777dc5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 22:53:57 +03:00