Commit Graph

14898 Commits

Author SHA1 Message Date
Volker Hilsheimer
fc319a8f8b Fix QTimer::crossThreadSingleShotToFunctor test
Amends 4d90c4e74a, after which the test
became flaky. We need to wait for the functor to be called before
quitting the thread, otherwise we have no guarnatee that any of the
queued metacall events have been processed by the thread. Since
QThread::quit is thread-safe, we can just call it from within the
functor. This guarantees that at least one of the single-shot timers
is processed before we quit.

And since QTimer::singleShot has special code paths for 0-ms timers
(going through an explicitly queued QMetaObject::invokeMethod call
rather than through an actual QSingleShotTimer object), we need to run
the test logic with different timeouts to cover both code paths.

Task-number: QTBUG-112162
Pick-to: 6.5 6.2 5.15
Change-Id: Ide1e7b4b74dcbda72144a0d73ef5f64b0694ddbc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-30 19:17:25 +02:00
Edward Welbourne
496ebd8677 tst_QDateTimeEdit::stepModifierPressAndHold(): tweak start date
The test can collide with a 1960-01-01 transition in some zones, so
move it to Jan 2nd to avoid that.

Pick-to: 6.5
Change-Id: I5286cadc0de0b66283253b0ac736f23a2add0c8f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-03-28 21:40:53 +02:00
Tor Arne Vestbø
f3e27d3688 Pick up initial state of foreign windows instead of reflecting QWindow
A foreign window can be used both for embedding a Qt window into a
native window hierarchy, or for embedding a native window into a Qt
window hierarchy. In the former case, we should not modify the foreign
window in any way. Since the platform does not know anything about the
intended use case at the time of the foreign window creation, it should
avoid modifying the foreign window in any way, and should instead pick
up the foreign window state and reflect that through QWindow.

Pick-to: 6.5
Change-Id: Id2e39d101277ecebd656d615cea3e7f734a4b0a6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-28 16:31:17 +01:00
Tor Arne Vestbø
aab71c7bb8 Ensure QHighDpiScaling::set(Screen/Global)Factor() results in QScreen signals
Change-Id: I328b288b3fd83df0cc81c62bce1d946f90f1cd0d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-03-28 17:31:17 +02:00
Axel Spoerl
c4b62ee501 QComboBox: reset indexBeforeChange to -1 if index is invalidated
The member variable indexBeforeChange is member-initialized with -1 and
changed to the current row, if a valid index is set.
It is used to check, if the model has been reset to an empty model
and/or the index has been invalidated. The result is used to decide, if
the currentIndexChanged signal is emitted or not.

If a combo box had a valid index and it is invalidated afterwards
(e.g. because the combobox has no more entries), indexBeforeChange is
not reset to -1. The redundant signal emission is therefore prevented
only the first time.

This patch resets indexBeforeChange if the index is invalidated or the
last item is removed from the combo box.

It also adds a no-op check to tst_QComboBox::currentIndex.
The test data sets "check that setting the index to -1 works" and
"check that current index is invalid when removing the only item" check
the respective use cases.

As a drive-by, variable names and QObect::connect syntax have been
cleaned up in tst_QComboBox::currentIndex.

Fixes: QTBUG-108614
Pick-to: 6.5 6.2
Change-Id: Ib6dfa887d9247f2c47df065039d69ba57c32fa24
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-03-28 14:45:24 +01:00
Morten Sørvig
9a39b3c796 Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS
QT_SCREEN_SCALE_FACTORS is in many cases set on behalf of the user,
instead of by the user, so we should apply the standard app
scale factor policies to it, instead of interpreting it
as a user override.

Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.

Users who want to override can set

  QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough

to restore the default Qt rounding behavior.

[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.

Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: I936e96671fe2a0a43c3e8129f0768875cb011103
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-28 09:14:09 +00:00
Marc Mutz
f8dba0395f QPromise: add support for addResult(braced-initializer)
The usual problem, the usual fix: default the addResult() template
argument to the class template argument, cf. e.g. wg21.link/p2218.

[ChangeLog][QtCore][QPromise] Added support for calls to addResult()
with braced initializers.

Fixes: QTBUG-111826
Change-Id: I9ad7294dbcefbc5d2609ca3d9e7304dbeb8b3f41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-28 09:09:14 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Volker Hilsheimer
643b6e5b29 Silence warnings from unused variables
Use them, or replace them with existing constants.

Pick-to: 6.5
Change-Id: I808028296305e15b68aecb1f961ba6a85b8e9cc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-21 07:46:27 +01:00
Edward Welbourne
db5279825c Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definition
I got tired of being told off by the inanity 'bot for faithfully
reflecting existing #if-ery in new #if-ery. Retain only the
documentation and definition of the deprecated define.

Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-20 19:18:52 +01:00
Edward Welbourne
9896ebf93d Testlib: fix the last few s/Q_OS_MAC/Q_OS_DARWIN/w
Change-Id: I6fe6a865aea37c6a2d153bd2c3aace5242362c88
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-03-20 19:18:52 +01:00
Mårten Nordheim
6a66554d3b Revert "Skip socket and server tests on Ubuntu 22.04 and QEMU"
This reverts commit 9286d46ee2.

Reason for revert: Should be fixed by 5c6814fb18760f65bab0f8b9cd623ee5c874a58d

Change-Id: I3a161df445af8dcbb61138d57e931a093a319027
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-03-20 17:39:18 +01:00
Marc Mutz
f4f49523ad tst_QMessageAuthenticationCode: avoid setKey() calls
We test setKey() in repeated_setKey() these days, so speed up the test
of the test suite ever so slightly by passing the key to the ctor
instead of an explicit setKey() call.

Pick-to: 6.5
Change-Id: Ia2378c0f59cbfa9d95a0f3665b06655332247e2c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-20 14:42:11 +01:00
Christian Ehrlicher
d184c66ad5 SQL/Tests: Cleanup of tst_databases.h
Cleanup tst_databases.h: fix identation, replace qGetHostName() with
QSysInfo::machineHostName(), use QSqlTableModel::EditStrategy instead
int for submitpolicy data to avoid casts.

Change-Id: I4917ca23c4b39ab15bc0e006e6111baefb82d278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 23:08:44 +01:00
Christian Ehrlicher
acb6131a4d SQL/IBASE: fix tests
Fix some tests so they will correctly work with Interbase (Firebird 3.x)

Change-Id: Ib3c8ceaf31fa01af3a00a9772350b49cee8b2342
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 20:33:16 +01:00
Christian Ehrlicher
1981ebe8ad SQL/OCI: add maximumIdentifierLength()
A table name or identifier must not be longer than 30 (< Oracle 12.2) or
128 bytes (sadly not characters).

Change-Id: I49192afaf908e12f5cfd20c754640b6117b03a71
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 20:33:16 +01:00
Christian Ehrlicher
f49f3f2f94 SQL/Tests: Cleanup tst_QSqlDatabase
Remove driverQuotedCaseSensitive() as it's no longer needed, fix view
creation for PostgreSQL.

Change-Id: I72437252cfad762a5a245475d6652de3c7b5ef46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 20:33:15 +01:00
Axel Spoerl
b04f9388ac QColorDialog: Support hex rgb values with and without leading #
QColorDialog supports entering hex rgb values only with a leading #.
That makes copy/paste impossible whenever the copy source has plain
hex, without the leading #.

This patch automatically adds a leading # character, when missing.
As a drive-by, QObject::connect statements are altered to PTMF syntax,
amending 9eb1b9e86ce3d1004e39e8ab7c7ecb6796d6df1a.

The patch also adds an autotest for the new functionality.

Fixes: QTBUG-111742
Pick-to: 6.5
Change-Id: I4ced29dc8b543457f411a3fa0ac756b550cdb09f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-17 18:06:28 +01:00
Santhosh Kumar
f50b853bed Adjust window rectangle for menu baseline test case
Capturing complete window for menu test cases makes it fail as there can
be different window shapes (such as rectangular or rounded corners). To
avoid this, its better to capture only minimal visual portion that can
be compared against.

Change-Id: I30e85589fce8c17115f511a7a345d46949e6c9e8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 15:50:30 +01:00
Santhosh Kumar
ee3611ce91 Remove window frame for combo-box widget baseline test case
The window frame differs across ms-windows version and this makes
combobox test case either fail or more fuzzy. To avoid this provide
only window geometry for screen capture instead of complete window
rectangle.

Change-Id: I0f1a1a95c45218ccc69fc92f589baee0135db943
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-17 15:03:13 +01:00
David Redondo
141d626029 Handle device loss for texture widgets
Previously the widget stayed black and we printed
"QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly,
this should not happen".
To make it work the compositor is recreated in addition to the rhi
and the  widgets are informed with the internal events.

Change-Id: I982d08bd3530478fe0f827080154c008a92a812e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-17 14:45:21 +01:00
Piotr Wierciński
d8e483170e Wasm testing: Refactor test framework and update tests
Update tests so they take into account minimum QWasmWindow size
constraints.
Refactor test framework and make it easier to read and write new tests.

Change-Id: I621c5eee6577f1569eef93e883d1cf0828e3946f
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-03-17 12:16:41 +00:00
Marc Mutz
96dc4acb23 QCryptographicHash: check addData() with null QByteArrayView
When this code was using QByteArray, whose data() is never nullptr,
the strings presented to the underlying C APIs were always valid NTSs
(nullptr is not a valid NTS).

With QByteArrayView, or with QT5_NULL_STRINGS != 1, this is no longer
the case. Check that all implementations are fine with that.

Pick-to: 6.5 6.4
Change-Id: I78251288a4784440af4a2daf095aed7c53867287
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-17 00:41:33 +01:00
Marc Mutz
c5d4dde678 QMessageAuthenticationCode: add move SMFs and swap()
QCryptographicHash is move-only these days, so
QMessageAuthenticationCode should not be left behind.

[ChangeLog][QtCore][QMessageAuthenticationCode] Added move
constructor, move assignment operator and swap() function.

Fixes: QTBUG-111677
Change-Id: I420f24c04828e8ad7043a9e8c9e7e2d47dd183e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-16 17:27:29 +01:00
Ahmad Samir
41fea4f5fa QDate: add epochDate() helper to unittests
Drive-by change: add an assert for JULIAN_DAY_FOR_EPOCH.

Change-Id: I891ef253f1f16b1efb8354d1b179f319b3553feb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-16 17:52:20 +02:00
Tor Arne Vestbø
13951b44cd Add basic test for QWindow foreign windows
Only implemented on macOS and Windows for now.

Change-Id: Ib6330bc7024453d23675c1770367e8da6c4c9a34
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-03-16 14:17:24 +01:00
Ulf Hermann
566e5e1acf moc: Allow anonymous properties
This is private for now. It's very handy to have anonymous properties
for the QML model/delegate adaptors. There are models with only
"singular" model data that doesn't have any sub-properties. Such model
data should be available from the model object via an empty string as
role. This way we can get rid of a lot of special casing.

Task-number: QTBUG-104752
Change-Id: I229e355a7cab064ee1c9f89557bc0244a5d0c90a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-16 14:17:24 +01:00
Axel Spoerl
09c3cd8503 QPlainTextEdit: Don't block signals on page step
Signals of the vertical scroll bar were blocked when scrolling with
pageUp/pageDown keys or clicking on the scroll range outside the
scroll bar. This has lead to inconsistent signal emissions:

The vertical scroll bar's valueChanged signal was emitted only on
single steps and when the scroll bar was moved with the mouse.
When it was moved in page steps by clicking on the scroll range or
pressing pageUp/pageDown, it was not emitted.

This patch removes the signal blocker for page step movements, which
was added in 94fd108ea4 to replace
explicit calls to blockSignals(), which were added in
c14d442b08ac81327b173b0a220c7b1840667899.

The patch also adds test function to tst_QPlainTextEdit to check if
the valueChanged signal is emitted correctly.

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-8682
Fixes: QTBUG-25365
Change-Id: I4385a5387c91497f623978e35bbbe3e06f473afe
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-15 23:45:00 +01:00
Ahmad Samir
9d05fd9fa2 QString: change test data to compile with QT_NO_CAST_FROM_ASCII [10/13]
Drive-by changes:
- Cleanup creating a QChar[], by creating a char16_t[] and
  reinterpret_cast'ing it
- Use human-readable Unicode characters where possible

Pick-to: 6.5
Change-Id: Ice2c36ff3ea4b6a5562cf907a7809166a51abd28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-15 22:25:57 +02:00