Commit Graph

60754 Commits

Author SHA1 Message Date
Fabian Kosmale
e7cb3cb041 QMetaType: Provide underlyingType for enums
Currently, Qt assumes that enums always have int as their underlying
type (both in QMetaEnum::keyToValue and in the QML engine). This change
makes it possible to to retrieve the underlying type from an enum's
metaype - or rather, a metatype of an integral type with the same size
and signedness. The use cases aobve don't really rely on the exact same
type. In most cases, we wouldn't even need the signedness, however that
is already available anyway, and it will come in handy once QML supports
bigint, and we need to decide whether we should return

While it would be possible for individual users of this function to
manually query the size and signedness, having a function returning a
metatype offers additional convenience - especially in QML, where the
conversion APIs generally operate on metatypes.

Task-number: QTBUG-27451
Task-number: QTBUG-84055
Task-number: QTBUG-112180
Change-Id: Icf733b42df0ea64017d69f4d94cb7c855d9e3201
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-03-28 10:59:53 +02:00
Joerg Bornemann
454b1de22c CMake: build the shared plugin when building the plugandpaint target
People expect that building the "main target" of an example builds all
necessary subtargets as well. Add a dependency from plugandpaint to
pnp_extrafilters.

Pick-to: 6.5
Task-number: QTBUG-112300
Change-Id: I036beb961fe474ff060f93c98f5e2bda58e66f71
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-03-28 10:45:55 +02:00
Ivan Solovev
502a7706b9 QFutureInterface: add a warning when an existing continuation is overwritten
... and also extend the documentation to explain this case explicitly.

Fixes: QTBUG-107545
Pick-to: 6.5 6.2
Change-Id: I9414cc677b037989de60e97871485018e5c8a569
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-28 09:45:55 +01:00
Liang Qi
e8622fb204 git: ignore ._* files
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Idbf7dcd76f176f098bfbeb516c51933c2b7a08b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-28 10:44:57 +02:00
Thiago Macieira
5f23f7f416 QPluginLoader: modernize static plugin instance code
- don't create the QGlobalStatic if it doesn't exist yet
- remove int-based iteration in favor of range-based for

Pick-to: 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174fb99f4557defe
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-28 04:29:22 -04:00
Tor Arne Vestbø
90d7fd5822 macOS: Apply QWindow properties to NSWindow when setting content view
The main responsibility of QCocoaWindow::recreateWindowIfNeeded() is
to decide if the platform window is top level or not, and if so needs
an NSWindow or NSPanel accompanying it.

Once that decision has been made, and we've created an NSWindow or
NSPanel, and made the view the content view of this window, we need
to apply the QWindow properties to the newly created NSWindow or
NSPanel. But doing so in recreateWindowIfNeeded increases the
complexity and responsibilities of the function, so we move the
logic to [QNSWindow setContentView:] instead. This is analogous
to applying the properties during [QNSWindow init], but since we
are now the content view we can use the same code paths to apply
the initial properties as we use when they are updated later on.

Pick-to: 6.5
Change-Id: Idb4c812f4b22a029030bf4638357cf8628caea40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-28 04:33:05 +01:00
Ahmad Samir
41201f9d65 QStorageInfo/Unix: fix narrowing conversion warning
"blocksize" is assigned the value of statvfs::f_bsize, the latter is
unsigned long.

Change-Id: I55453b861d0c127d1e8d8a367347de926a7cbbca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-28 05:33:05 +02:00
Kai Köhne
5a182d35e2 Update license specification for PCRE2
PCRE2 is available under BSD-3-Clause, but with a relevant exception
that arguably applies to the way Qt uses it, too. So let's mention
this exception in the listed license.

Unfortunately, the exception is not part of the SPDX database, and
combining a standard license with a custom exception is not supported
yet. See [1] for a related discussion. Meanwhile, just defining a whole
license is a common workaround.

[1] https://github.com/spdx/spdx-spec/issues/153

[ChangeLog][Third-Party Code] Clarifying license of PCRE2 to be
BSD-3-Clause with advertisement exception for binary-like packages.

Pick-to: 6.5
Change-Id: Ib6d46806dc5a00ff2f795054ad9bf0ae62920501
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-27 10:55:28 +00:00
Hamish Moffatt
ce58c66ae8 QTaggedPointer: fix warning due to integer type conversion
Fixes: QTBUG-112222
Pick-to: 6.5
Change-Id: I4815d83c23e7616548ea84779d1c3d0774e77f69
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-27 15:55:24 +11:00
Andreas Bacher
5af5738980 SQL/IBASE: Time Zone support (firebird 4.x)
Add support for time zones in the IBASE driver, which was introduced in
firebird 4.x. TIMESTAMP WITH TIME ZONE data type is supported in order
to store and retrieve a QDateTime with the time zone.

Task-number: QTBUG-111879
Change-Id: I631b4262d17796a17630379b7d659f88244a23ad
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-03-24 23:43:54 +01:00
Ievgenii Meshcheriakov
8faf2511da dbus examples: Remove "Example" from example names
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: Ia34c60ed4c0ffe5b01cc507dd5e45521c096b0bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-24 19:29:11 +01:00
Liang Qi
0a37f944bf tests: blacklist tst_QImageReader::setClipRect() and
setScaledClipRect() svg tests on Wayland

Task-number: QTBUG-112275
Pick-to: 6.5
Change-Id: Iaae1781df09b8402b349fd41111ea16ca26215f8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-03-24 10:49:16 +01:00
Timothée Keller
4e5ced054d Windeployqt: prevent directory creation for dryruns
Added a check for dryruns when creating directories, to properly
reflect expected behavior.

Pick-to: 6.5
Change-Id: I72063e4d32302d304f8174701e38e275b404706b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-03-24 10:09:56 +01:00
Yuhang Zhao
8902bc6356 windeployqt: allow user set translation directory
Add the "translationdir" option, which allows the user to choose
a different directory to deploy the translation files.

Pick-to: 6.5 6.4
Change-Id: Iacf2031abb6d992e6765c02f232f81317b784720
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-03-24 17:07:06 +08:00
Marc Mutz
690761a4ad tst_QVariant: add a test contrasting Qt 5/6 isNull behavior
A null QString used to make a QVariant containing it null in Qt 5, but
this is no longer the case. Add a test that get_if works as expected.

Task-number: QTBUG-111598
Change-Id: I0f3511e1b33f4a9d67755269455680feda22ddca
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-24 06:40:27 +01:00
Marc Mutz
a9e8034e8c Implement [variant.get] for QVariant [2/2]: get()
This second patch of the series implements get().

Unlike other get() implementations in Qt, don't use my trick with the
constrained friend free function here. Instead, provide the four
overloads manually, like mandated by the standard library for
std::variant (and, indeed, tuple), such that these functions can also
be used on subclasses of QVariant.

[ChangeLog][QtCore][QVariant] Implemented the type-based std::variant
access protocol (get<T>()/get_if<T>()) to allow easier access to the
contained element than the previous solution of casting data(), as
well as to allow generic code to treat QVariant and std::variant the
same. The holds_alternative<T>() function is not provided, since it's
the same as get_if<T> != nullptr. The index-based variant access
functions (get<I>()/get_if<I>()) are also not provided, because,
unlike std::variant, QVariant does not have a bounded number of
alternative types, and QMetaType IDs are not (all) compile-time
constants.

Fixes: QTBUG-111598
Change-Id: Id7bc41f7d91761b3483ec5604f1a4685c8079844
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-24 06:40:19 +01:00
Marc Mutz
de3e970889 Implement [variant.get] for QVariant [1/2]: get_if()
QVariant supports non-default-constructible payloads, in principle
(QTBUG-105140). And fromValue() works with such types, but value()
insists on providing a wide contract and therefore accidentally
requires default-constructible.

We can now invent other "Qt-ish" API like optional::value_or() or a
value() that returns optional<T>, but we should first get the
interface in that generic code must use, and which at the same time is
the most versatile, because it gives write access to the element
stored in the variant: [variant.get], consisting of get_if(), get(),
and holds_alternative(). The latter is the same as get_if() !=
nullptr, so we won't provide it.

This first patch implements get_if(), adds test for it.

As a Hidden Friend supposed to be called with explicit template
arguments, we run into the problem that wg21.link/P0846 solved for
C++20. Add the usual work-around, and check it works.

The ChangeLog will be on the last patch.

Task-number: QTBUG-111598
Change-Id: I23f57ea2de3946944810c5552c68a7a3060a44f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-24 06:40:11 +01:00
Thiago Macieira
8570e86fff QVariant: ensure the type custom is registered on construction
I must have broken this in the 6.5 work I did for QMetaType and
QVariant, but I haven't searched which commit exactly did it. Our
QVariant tests are old and thus only checked the type ID, which meant
that they caused the registration by the act of asking for the ID in the
first place; this commit adds a couple of explicit checks for the type
registered by name before the ID.

Fixes: QTBUG-112205
Pick-to: 6.5 6.5.0
Change-Id: Idd5e1bb52be047d7b4fffffd174f1b14d90fd7a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-23 13:40:15 -10:00
Thiago Macieira
4d90c4e74a QTimer: fix new-style slot invocation for receiver in another thread
For single-shot timers, at least. QSingleShotTimer had either an
optimization or the only way to make new-style slot invocations by
storing the QSlotObject pointer and calling it directly. Instead of
doing that, let's just actually connect and let QObject handle the
actual delivery.

[ChangeLog][QtCore][QTimer] Fixed a bug that caused slots connected to
single-slot timers using the new-style connection mechanism to be
delivered in the wrong thread.

Fixes: QTBUG-112162
Pick-to: 5.15 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174eadb227ab65ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-03-23 13:22:23 -10:00
Ievgenii Meshcheriakov
f7167ae82f remotecontrolledcar example: Modernize the code
Also remove unused crashed() signal.

Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: Ia23552a6396c324c7591643afaa634879a2c185e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-23 20:14:46 +01:00
Laszlo Agocs
fa3bfa72da macOS: Skip DisplayLink updates when in live resize
...and the view is using a CAMetalLayer and a non-default contents
placement. (the default would be scaling/stretching of the content,
that hides a lot of out-of-sync size problems during resize, but
is not great for UIs so we never use that in practice)

This achieves two things:

- when presenting from the main thread with transactions (i.e. with
  parent patch in place), resizing the window will be even nicer,
  basically flicker free on the M1 Mini as well,

- when presenting from outside the main thread, resizing becomes
  a lot smoother, even if the window background is still visible
  from time to time due to the size not catching up and due to
  Qt having to use NSViewLayerContentsPlacementTopLeft.

Thus resizing Qt Quick-based windows, which use the threaded render
loop by default and cannot use presentsWithTransaction, becomes a
nicer experience than before, even if not always perfect.

This comes at the expense of not animating during the live resize
operation whenever the size is not changed (because only a resize
triggers updates then, the CVDisplayLink-based updates are skipped
in order to reduce flicker due to out of sync sizes)

To force the old behavior, set QT_MAC_DISPLAY_LINK_UPDATE_IN_RESIZE.

Task-number: QTBUG-107198
Change-Id: I796c3a74119510c62f7245b0ebbe78797d2df03e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-23 16:44:10 +00:00
Marc Mutz
25c5452c26 tst_bench_QCryptographicHash: swallow result() return values
As usual, assign them to a [[maybe_unused]] variable, to avoid
potential future [[nodiscard]] problems, and to indicate to
readers of the code that there's a result that's being returned,
we're just not interested in it.

Pick-to: 6.5 6.2
Change-Id: I2bd47ca98418092ca885d50a1a6417a21a612a85
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-23 16:14:12 +00:00
Marc Mutz
d0149e2404 tst_bench_QCryptographicHash: use QMetaEnum trick
... conveniently wrapped in a generator, to not have to keep an
algoname() function in sync with QCryptographicHash::Algorithm.

The MaxCryptoAlgorithm constant was already stale following the
addition of BLAKE2b/s algorithms in
5d69aa3ee1.

Also make the data-driven tests have an actual Algorithm column
(was: int) to minimize casting.

Pick-to: 6.5 6.2 5.15
Change-Id: I89a6098e512a72f623fd50a6f88fc351c7bb1418
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-23 16:14:12 +00:00
Marc Mutz
f68b9e432b tst_bench_QCryptographicHash: port to QTest::addRow()
Allows using printf-style tag formatting.

Pick-to: 6.5 6.2 5.15
Change-Id: Icb8014dd476a32791c662a15b209dbb3bd7d6c96
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-23 17:14:11 +01:00
Tor Arne Vestbø
080b11b039 mainwindow example: Fix implicit conversion from qsizetype warnings
Pick-to: 6.5
Change-Id: Ifaeeb620420f43529bb9e3d533b4e1a2e20c68ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-23 16:39:19 +01:00
Laszlo Agocs
fbb26c2b88 rhi manual tests: allow having some gui controls
Having a simple Dear ImGui bridge is not just useful for the manual
tests, which do not have any other means to displays GUIs, but is
in itself an important exercise for the QRhi machinery.

Have a new manual test that exercises the built-in ImGui demo window.
Then use it in the displacement test for real, to replace the myriads
of key presses with on-screen sliders and checkboxes (with less code).

Change-Id: I296bafae2a5cce6fc7a447d97e68e5bcec15f451
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-23 16:39:19 +01:00
Laszlo Agocs
401edea982 rhi: metal: macOS: Set presentsWithTransaction during resize
...when presenting from the main thread.

Make resizing nice and smooth in application that render and present
on the main thread. This includes Qt Quick applications when ran
with QSG_RENDER_LOOP=basic, as well as QQuickWidget-based widget apps
and anything using the QRhi-based backingstore flushing, and plain
QWindow apps that use QRhi on the main thread.

Allow opting out with an environment variable (QT_MTL_NO_TRANSACTION),
following the existing patterns of some of the other backends (such as
QT_D3D_NO_xxxx). This can be handy in case it turns out setting
presentsWithTransaction is not desired in some very specific case.

Task-number: QTBUG-107198
Change-Id: Id0f4e5a509076dd24c03d243c4f098ddb139d7af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-23 16:39:18 +01:00
Tor Arne Vestbø
fb70893dd5 Don't accept QWSI::CloseEvent when the window is blocked by a modal window
If a window is blocked by another modal window, and we decide that as
a result we should not propagate the close event, we need to also
report this back to the platform plugin, so that it can tell the
operating system to not close the window.

This is a problem on macOS, where the system doesn't natively support
transient parents being blocked by a window-modal window, so the OS
will still allow interaction with the title bar close button, resulting
in a QWSI close event being delivered.

Fixes: QTBUG-104905
Pick-to: 6.5 6.2
Change-Id: I09ff15b0fbb1002a8f9d83d932ca766ed510f0a0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-23 15:39:18 +00:00
Mårten Nordheim
826b606a5d Remove loopback network example
It doesn't showcase anything interesting that other examples
don't already show off.

Pick-to: 6.5
Change-Id: Ie95c3ddb3ff52b3beab54bd6fa75fb75ae5c7ba5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-03-23 16:02:28 +01:00
Mårten Nordheim
a156b667ce QNetworkDiskCache: Update doc snippets
We should encourage users to use the system cache directory.
We should also encourage users to not use the char* QString-ctors.

QStandardPaths::CacheLocation is documented to never be empty, so use it
in this manner.

Pick-to: 6.5
Change-Id: I1f050feda5b0a8e7c23fbed5db904bb0180b45f0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-23 16:02:28 +01:00
Mårten Nordheim
58dfb10781 Clean up multicast examples
They're small, not much to polish.

Pick-to: 6.5
Change-Id: Iada573504de557ab18381370bb9760b1f60cc2e4
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-23 16:02:28 +01:00
Laszlo Agocs
7c23aa6bc5 Move hellogles3 docs to where the rest of these files live
And expand the note in the openglwindow example to point to
hellogles3 as well.

Pick-to: 6.5
Change-Id: I2c0ee9b83fa59752d937c57eaf0194f0d0a8a7d9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:03 +01:00
Laszlo Agocs
d0dc0477b9 Remove erroneous widget dependency for hellogles3
Pick-to: 6.5
Change-Id: I42b476be28acd5b5c68f115bd98cf5c43cd8d97b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:03 +01:00
Laszlo Agocs
9daf2744b2 Change paintedwindow example to be a manual test
Pick-to: 6.5
Change-Id: I25a0f491f824c43fc75ba6358518133ede09adcd
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:02 +01:00
Laszlo Agocs
3b015718b0 Move hellowindow and qopenglwindow to be a manual tests
Pick-to: 6.5
Change-Id: I8d1517ee57df9b2dee0486f47562b0754e9dcbad
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-23 15:13:02 +01:00
Fabian Kosmale
a956b7a9b7 QArrayDataPointer: skip deallocate detour
We never made use of it since its introduction in 5.0, and calling free
directly reduces the size of libQtCore by roughly ~100kb.

Change-Id: I7dbdac83c82fa38d1833a4677fc83ebe809a11ef
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-23 11:59:17 +01:00
Lorn Potter
49ddb4b28a wasm: add support for input languages win32 mobile
on Windows virtual keyboard sends characters through the textInput handler,
we can use the same mechanism as Android to create an offscreen
input element and send the characters from there.

Fixes: QTBUG-107139
Pick-to: 6.5
Change-Id: I84a143aedf93d22521fcfa368532eed8c0e7d002
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-23 11:59:38 +10:00
Mikolaj Boc
cb8f62660e Close popups on WASM window non-client area interactions
This mimics the behavior displayed by the Cocoa window

Fixes: QTBUG-111436
Change-Id: I800fd15e870e54cf2c22ba5bd7f0c8b3f7f85bbf
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-03-23 02:59:38 +01:00
Laszlo Agocs
5a36f4cd9c Change computegles31 example to a manual test
Pick-to: 6.5
Change-Id: I652daf3ccbb921c5eb73b48586ee9616c7704b97
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:18:04 +01:00
Laszlo Agocs
0e8d347c6a Remove hellovulkanwindow example
The idea being that hellovulkantriangle demonstrates the same things.
As a getting started tutorial hellovulkanwindow is the ideal example,
but then again QVulkanWindow is not something we want to promote much
in Qt 6.

Some of the docs are moved to hellovulkantriangle.

Pick-to: 6.5
Change-Id: Icbfff70b4a4c7e4c0863a937f3c16038c0b03fbe
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:17:55 +01:00
Laszlo Agocs
b5b954fac1 Move hellovulkantexture example to manual test
Because it is the least documented one, and compared to the other
Vulkan examples it does not add anything new, it just dives deeper
into Vulkan.

Pick-to: 6.5
Change-Id: Iecf3e04625fba256ea8134da57f54498ee2010db
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-03-22 23:17:48 +01:00
Christian Ehrlicher
580fc133a6 Doc/QButtonGroup: Do not mention deprecated/removed signal
QButtonGroup::buttonClicked(int) was deprecated in Qt5 and removed in
Qt6 so don't mention it in the documentation. Use the correct
replacement idClicked(int) instead.

Fixes: QTBUG-102131
Change-Id: I3d3cd90a2f1ed4a6484827bd882142a9a845d1c5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-03-22 16:28:23 +00:00
Marc Mutz
a1889b2a67 Verify fix for manual get<I> calls for QVector<N>D
The necessary QT_ENABLE_P0846_SEMANTICS_FOR is already provided by
qpoint.h) here. Add a test to confirm it works.

Amends 0e22001a3b.

[ChangeLog][QtGui][QVector2/3/4D] Fixed manual get<I>() calls
(Tuple Protocol) in C++17 mode.

Task-number: QTBUG-111598
Change-Id: Id4a118b6439c2d1471b921f8d92ee558f9902eab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-22 15:59:10 +00:00
Marc Mutz
eb9c8042cf Short live QT_ENABLE_P0846_SEMANTICS_FOR!
In C++17, unqualified lookup doesn't find function templates that
require ADL from a call with explicit template arguments, unless
another function template of that name is in scope (otherwise, the <
is parsed as operator less-than instead).

P0846, merged for C++20, fixes this to repeat the name lookup, parsing
the < as indicating a template.

We have API in Qt (Tuple Protocol for some types, e.g. QPoint) that
work for the purpose of Structured Bindings, but don't work for manual
unqualified calls when P0846 semantics are missing, and we're adding
more, to QVariant, so add a macro to handle the issue.

The macro simply declares a function template overload of the given
name for a throw-away struct, thereby bringing, for that one name,
P0846 semantics into C++17.

When we require C++20, we can drop this again.

Amends:
- fb6b7869e8 for QPoint(F)
- 8ae9431c79 for QMargins(F)
- 0e22001a3b for the rest

[ChangeLog][QtCore][QSize/F, QMargins/F, QPoint/F] Fixed manual
get<I>() calls (Tuple Protocol) in C++17 mode.

Task-number: QTBUG-111598
Change-Id: I2ffaef12c5bb6d82f75ce78a7c03c6789dfa0691
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-03-22 15:59:10 +00:00
Timothée Keller
eafe577041 Windows QPA: Change handling of maximised frame/title-less windows
So far, the framele/tite-less window maximising has been done by
adjusting the MINMAXINFO to prevent them from covering the taskbar.
It does not work when moving the windows from one screen to another
using keyboard shortcuts, since the MINMAXINFO is that of the old
monitor. This moves the adjustment to the WM_SIZE message that occurs
after the window has been resized.

Pick-to: 6.5 6.4 6.2
Change-Id: I0d36fe5d2e8eaa0739414835b8d99a0b2ed44cf6
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-03-22 15:50:52 +01:00
Nicolas Werner
3f40a8b5b1 Add QTextListFormat::start: html and markdown ordered list index offset
This is useful for a lot of applications that render text coming from
sources which already support arbitrarily numbered lists (like chat
applications for example). Application-side workarounds usually have
significant overhead; and this feature has been requested multiple times.

It should be possible to both read and write HTML with the <ol start="x">
attribute, and read and write Markdown with arbitrary numbers for the
first item in a list.

[ChangeLog][QtGui] QTextList now supports specifying a start index using
the new QTextList::{setStart, start} functions. The HTML start attribute
on ordered lists in rich text documents is now parsed and used when
rendering a text list. Non-negative indices in markdown lists are now
also parsed and written properly. This allows starting a list with a
different number than 1.

Fixes: QTBUG-30407
Fixes: QTBUG-65384
Task-number: QTBUG-107562
Change-Id: Ib35b9378d9134ffedaa2d92f728b0984793aa7c1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-22 10:50:58 +01:00
Fabian Kosmale
b05540bd00 QMetaType::convert: Avoid some copies in ranged-for
Found by static analysis.

Change-Id: I416eb31736c8c5002fb4906aae4272e645f1916d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-21 22:41:37 +01:00
Shawn Rutledge
dc7f4f7b4e Add a manual test to show a QTreeView with QInputDevice::devices()
At least on X11 this is a real hierarchy: slave devices come and go
as children of the master devices. The goal is to verify that this tree
and the output of `xinput list` are in sync. The model calls
[begin|end]InsertRows() and [begin|end]RemoveRows() as necessary to
attempt to keep the view updated.

Task-number: QTBUG-46412
Task-number: QTBUG-98720
Task-number: QTBUG-104878
Task-number: QTBUG-112141
Change-Id: I8a2252f041cd1de777eef225d0e7f0db5c90a706
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-03-21 22:00:50 +01:00
Shawn Rutledge
2a9d93efc6 xcb: Delete QInputDevice instances that X11 no longer finds
QXcbConnection::xi2HandleHierarchyEvent() calls xi2SetupDevices()
whenever the event tells us that a device was added or removed; but
until now, those instances were not getting deleted until application
exit. That was a memory leak, and also tended to get us confused when a
newly-attached device happened to reuse the same device ID of something
that was there before but had been removed in the meantime. Now, we hope
that QInputDevice::devices() will be in sync with reality as X11
presents it to us.

Amends da5dea807f
6589f2ed0c etc.

Task-number: QTBUG-46412
Fixes: QTBUG-56214
Fixes: QTBUG-98720
Fixes: QTBUG-99331
Task-number: QTBUG-104878
Fixes: QTBUG-112141
Pick-to: 6.2 6.5 6.5.0
Change-Id: I573805a41a12850f94561a030071f1437c4dc37e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-03-21 22:00:50 +01:00
Christian Ehrlicher
37b47ebf94 Widgets/QCheckBox: change signature of stateChanged() for Qt7
Change the signature of stateChanged(int) to emit Qt::CheckState
instead. This was forgotten during Qt6 porting so we have to wait for
Qt7.

Task-number: QTBUG-104688
Change-Id: Ica2504e5b9ae68612de81524faed0f31c9b10402
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-03-21 20:33:10 +01:00