Commit Graph

15251 Commits

Author SHA1 Message Date
Volker Hilsheimer
ccd3b28aab Rename QFunctorSlotObject to QCallableObject
After the recent changes we only have a single implementation of
QSlotObjectBase, which can handle free functions, member functions,
functors, and lambdas. Rename it to callable, and explicitly hide
the static implementation function so that it doesn't become a symbol
of static libraries using Qt.

Also rename makeSlotObject to makeCallableObject, and polish coding
style and comments in the qobjectdefs_impl header a bit.

Change-Id: Id19107cedfe9c624f807cd8089beb80e9eb99f50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-10 10:30:54 +02:00
Eskil Abrahamsen Blomfeldt
6160ea45b6 Implement API for enabling / disabling OpenType features
Similar to the font-features-settings in CSS, this is a low-level
API that allows you to pass the information to the shaper in order
to enable or disable specific font features by name.

[ChangeLog][QtGui][Text] Added an API to QFont which makes it
possible to enable and disable specific typographic features
in OpenType fonts.

Change-Id: Ib48c678f3b97a5a562b08ae34dc895800c8885c0
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-05-09 23:39:41 +02:00
Mårten Nordheim
1b736a815b Hsts: match header names case insensitively
Header field names are always considered to be case-insensitive.

Pick-to: 6.5 6.5.1 6.2 5.15
Fixes: QTBUG-113392
Change-Id: Ifb4def4bb7f2ac070416cdc76581a769f1e52b43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-08 20:28:46 +02:00
Ahmad Samir
9d9bbf687f QMimeDatabase: de-duplicate some code in the unittests
Change-Id: I7452a61b4c6e1f6b6b0f285aa3391fcd79a3e36d
Reviewed-by: David Faure <david.faure@kdab.com>
2023-05-07 14:29:28 +03:00
Ahmad Samir
9547ef58c7 QMimeDatabase: handle glob-deleteall tags
According to the Freedesktop spec[1], a mimetype that has glob-deleteall
overwrites other glob-pattern definitions for a mimetype if it is in a
higher precedence dir, the default order is (from high to low)
~/.local/share/mime, /usr/local/share/mime, /usr/share/mime. Or if the
XDG_DATA_DIRS env var is set, then it takes precedence. The
QMime*ProviderS in m_providers are constructed/stored in that same
order, high to low).

For QMimeXMLProvider, we can just clear the glob patterns associated
with those mimetypes from the lists/maps. For the QMimeBinaryProvider
however, we can't change the binary (mmap'ed) cache file, instead check
mimetype names against the exclusion list before modifying a
QMimeGlobMatchResult.

[1] https://specifications.freedesktop.org/shared-mime-info-spec/latest/ar01s02.html

This test uses XDG_DATA_DIRS so only viable when USE_XDG_DATA_DIRS is
defined.

Fixes: QTBUG-101755
Pick-to: 6.5
Change-Id: Icadbdf1027155296377c5a6ab3be8e41b6668325
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-05-07 14:29:17 +03:00
Thiago Macieira
a2551c45d4 Move the formatting of <chrono> durations to QDebug & QtTest
[ChangeLog][QtCore][QDebug] Added pretty formatting of C++ <chrono>
durations.

[ChangeLog][QtTest] Added pretty formatting of C++ <chrono> durations
for QCOMPARE expressions.

Change-Id: I3b169860d8bd41e9be6bfffd1757cc087ba957fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-06 17:54:23 +00:00
Thiago Macieira
25e13c9079 Q{Plugin,Factory}Loader: downgrade warnings to debug messages
Since we don't have different environment variables for the plugin paths,
users have to set QT_PLUGIN_PATH to where plugins for both Qt 5 and 6
(and future versions) are located. This causes Qt to print warnings that
those couldn't be loaded because the major version mismatches. So don't
print them any more.

QT_DEBUG_PLUGINS and the category logging filter can still be used to
enable them.

Fixes: QTBUG-107459
Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd175318ca1f8017bd
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-05-05 23:21:52 -07:00
Volker Hilsheimer
3bf5b5f894 Use QSlotObject helpers in functor-cases of QMetaObject::invoke
Add helper that allows us to determine the argument list and return type
of a functor. This triggers a compile time error if the functor has
operator()() overloads (we only support zero-argument call operators, but
there might be const/noexcept variations). Use that helper to declare a
ZeroArgFunctor type which also declares a ReturnType and Arguments alias.

Add a Callable alias that now combines FunctionPointer and ZeroArgFunctor
into a single type that we can then use to merge the specializations of
QMetaObject::invokeMethod.

[ChangeLog][Potentially source-incompatible changes] Using a functor
with several operator() overloads in QMetaObject::invokeMethod now causes
a compile time error. Qt would previously ignore const and noexcept
overloads and always call the mutable version on a copy of the functor.

Change-Id: I3eb62c1128014b729575540deab615469290daeb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-05 21:45:56 +02:00
Tor Arne Vestbø
760f99bfa8 test: Don't remove macdeployqt test directory when debugging test
Pick-to: 6.5
Change-Id: If0e6f836638d8ddb6b0d6c2be6ae4dd09b76eb7a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-05-05 19:05:08 +02:00
Tor Arne Vestbø
e36082dcdc test: Pass -use-debug-libs for macdeploy test when built as debug
As this is a strong indication that Qt was also built in debug.
Otherwise the test will fail locally for a debug build.

Pick-to: 6.5
Change-Id: I5f494017f1d89f4076ccaca89aaa67738ef405a9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-05 19:05:08 +02:00
Tor Arne Vestbø
da7b6cb83d Add debug logging to macdeployqt test
Preparation for debugging failures in the 6.2 branch

Pick-to: 6.5 6.2
Task-number: QTBUG-112892
Change-Id: Ib6428fb86be834c84be361a848c0f1306bfc2637
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-05 19:05:07 +02:00
Volker Hilsheimer
61e0671681 QSlotObject helpers: add testcoverage for std::function
Change-Id: I503c627c77eaab7d2e3456f23b55fdfcdc94c0ea
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-05-05 18:07:11 +02:00
Antti Määttä
fa67cd0334 Use boolean to indicate QTableWidgetItem is header item
QTableWidgetItem uses additional enum flag ItemIsHeaderItem which has
the same numerical value as ItemFlag ItemNeverHasChildren.
This causes conflict since the user can set the latter flag using
the setFlags, while the ItemIsHeaderItem is only used internally
to mark header items.

Remove the additional flag and use boolean instead to fix the conflict.

Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113209
Change-Id: Icff549c7e452d9f84575a524361719204817274e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-05 05:28:19 +00:00
Volker Hilsheimer
2434573f5e QTabBar: don't overshoot when scrolling right
Amends ca15f650a1, after which scrolling
right to fill any gap might have resulted in overshooting to a negative
scrollOffset.

When we scroll right to fit the current tab, then we never want to end
up with a negative scroll, so clamp the result accordingly.

Augment test case accordingly. Since some styles align the tab bar in
the center, replace the calculation of the scroll offset with access to
the private data member (which inverts the sign when compared to the
calculated value).

Task-number: QTBUG-113140
Fixes: QTBUG-113376
Pick-to: 6.5 6.5.1
Change-Id: Ibdc6686b9dbd41b1ae3560e2227fa121d9b20e18
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-04 19:58:50 +00:00
Mårten Nordheim
a443b5f2ec Update public suffix list
The removed testdata is no longer valid because their entries were
removed from the list.

Fixes: QTBUG-113339
Pick-to: 6.5 6.5.1
Change-Id: I34bd56394ab3c0ef2f930d5b21c3fe1089262dbd
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-04 17:40:33 +00:00
Marc Mutz
f7d1dc0eee tst_qthreadpool: expect a warning, cleaning up the test run
Change-Id: Ie9944d05e7afe5740ed10eef39c2df9281985002
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-05-04 19:40:32 +02:00
Volker Hilsheimer
a43ca591c1 Fix hiding in QComboBox when there is no selection
If there is an effect on the selected item we want to show it,
but if there is no item to highligh we just close the combo.

Fixes: QTBUG-113311
Pick-to: 6.5
Change-Id: I287af75d27e6f6ff969e4706e16cc8c4812129ea
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-04 19:40:32 +02:00
Mårten Nordheim
4bf82909f1 Make tst_QFont::italicOblique failures easier to debug
It fails locally for me on Lucida Calligraphy.
Lucida Calligraphy only has one style though: Italic.

Change-Id: I42442cb922132a00f09084cef9c739196a9a53c2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-05-04 15:05:18 +02:00
Allan Sandfeld Jensen
0e7e1c3396 Take move-only functions for the threadpool
We never copy the function so only need it to movable. Moves the
functions to templates using the new QRunnable create version.

[ChangeLog][QtCore][QThreadPool] Methods taking callable functions,
can now take move-only lambdas.

Fixes: QTBUG-112302
Change-Id: I2cb200f0abcf7e0fdbef0457fe2a6176764ad93d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 15:05:18 +02:00
Edward Welbourne
b1379d34dd Add a distant-future local-time-type to tst_QDateTime
It turns out glibc stops varying DST changes past where a 32-bit
signed day-count from 1970 reaches (which, all things considered, can
hardly be called a bug, for all that it's ...), at odds with QTZ's
extrapolations from the current IANA DB rules. As the last date QDT
can represent happens to be in the opposite side of everyone's DST
from the one that leaves zones in, this lead to the 2038
local-time-type not reliably being useful for predicting the max-date
behavior. So add a distant-future time-type that probes beyond glibc's
cut-off, and have relevant tests check that instead of the 2038 one.

Change-Id: If4e244d80fe2447da3bb9d5c406808c6c22c0a73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
89febde32f tst_QDateTime: rework initialization of local-time-types
There's no need to check the year or day-of-month (which involve
calendrical calculations) when we can perfectly well just check the
Julian Day number that's implied by the day-number parameters to
setType(), which could just as well return the LocalTimeType to be
assigned to the relevant parameter instead of doing the setting
itself. With that rearrangement, making it into a private static
method, the members it's used to initialize can then be const and
initialized during construction.

Change-Id: Ib7d295c3fbb9b90652952627456cdfb6176b8119
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
4c93b9c1d0 Refactor QGregorianCalendar::julianFromParts to return std::optional
It's a private static used to optimize internal use, so we can freely
get rid of its out parameter this way.

Change-Id: Id62612987f10ecbbd9702610fd172286adbfd442
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:07 +02:00
Ahmad Samir
5c71312ba3 Suppress a redundant GCC warning
The test is accessing an out of bounds index into an array on purpose.

Change-Id: I23cce4093fdfabd177eb34639f26fcd6752c8b34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 02:03:51 +03:00
Volker Hilsheimer
6e2bba71bb Pass functor through as references until stored
Amends 642f799fc6 to avoid unnecessary
copies in between the calls to the QFunctorSlotObject construcotr. We
can't use a univeral reference in the QFunctorSlotObject constructor
as the call is not deduced. So provide two overloads for lvalue and
rvalue references instead.

The compile check in the test now no longer fails as we delay the
storage until one level later, but that's acceptable.

Change-Id: Ide95b4a73c70f6f47698dd1e95138aa5d48ee95d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 14:02:28 +02:00
Volker Hilsheimer
02cac26ef5 Small improvements to QObject unit test
Remove duplicate test and outdated comment about move-only functors,
and include return value in move-only functor test.

Change-Id: I58dffe0ccf3ec12e7e05e2c9588303da4a7e75ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 22:06:18 +02:00
Edward Welbourne
51bcad8a61 Move some repeated constants from tests into tst_QDate
Making them static constexpr class constants is tidier than
duplicating them in diverse tests.

Change-Id: I5a24c10d6db6f946581fa0523d28bdc80358e95e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 17:03:27 +02:00
Edward Welbourne
79340518d7 tst_QDateTime::springForward(): adapt tests for midnight transitions
The second pass through each test case, going via UTC, applied an
adjustment to the time; however QTime wraps around modulo the day, so
applying a negative adjustment to a time too near the start of the day
could produce a time at the end of the day. I'm preparing to add some
test-case variants for which the transition's UTC date differs from
the date in the zone doing it, which trigger this. Combine the time
with the date before applying the adjustment, so that the date gets
decremented to match the time's wrap-around and conversion from UTC
duly gets back to the correct place, not a day later. The new test
cases (in an imminent commit) thus pass.

Change-Id: I1bd5f191c7673a56ac3fbfc69eab0bc03c9e40b3
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-02 17:03:27 +02:00
Edward Welbourne
c888153655 Fix problem with Australasian zones in fromSecsSinceEpoch() test
It seems glibc's extrapolation of existing DST-rules cuts off at some
point in the distant future, where the IANA DB gives no end-time for
such rules, leading QTimeZone to keep applying them.  This lead to
tst_QDateTime::fromSecsSinceEpoch() not getting an invalid date in one
of its bounds-probing tests, due to a within-bounds datetime getting
glibc's offset and then the out-of-bounds one falling back to the IANA
rule's offset that put it back within the bounds.

This directly affected Australasian zones (which glibc locks into
daylight-saving time in this distant future) which were fixed by using
the IANA DB's offset; but the relevant date is in August so other
zones, north of the equator, that glibc locks into standard time, then
had the reverse problem, so we have to take the minimum of the two
sources' offsets to get all zones on board.

Change-Id: I0c94af2ba108dea31bee46aafa4a8cca8d373a5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-02 17:03:27 +02:00
Ievgenii Meshcheriakov
90d3c5b951 QDBusServer: Fix potential crash when private pointer is null
Check that the private pointer is not null before attempting
to dereference it. This can happen, for example, when
a QDBusServer instance was constructed with an empty string
as address. Attempting to destroy an object constructed
this way was causing a segmentation fault on Linux.

Add a test case that attempts to construct a QDBusServer
object with an empty string as address to check that this
does not cause a segmentation fault anymore.

Pick-to: 6.5 6.2
Change-Id: I5fe63134026e2a9f509b61d452285891b1ec624d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 14:54:19 +02:00
Thorbjørn Lund Martsum
29b2506e8c Allow disable native messagebox dialog
The native style may not match the program style and it
makes sense to give an option rather than forcing native style.

Before it could only be done with setting AA_DontUseNativeDialogs
on the app, but it is reasonable to use native file dialogs and
Qt styled messageboxes - and it is extremely cumbersome - especially
since messageboxes often can start save dialogs.

It can look a bit strange that these introduced options has just one
option (DontUseNativeDialog) and four functions, but this way it works
similar to QColorDialog, QFileDialog and QFontDialog.

[ChangeLog][QWidgets][QMessageBox] Added options functionality to
QMessagebox. The currently only option available is DontUseNativeDialog.

Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-02 10:37:17 +02:00
Volker Hilsheimer
8c085c5722 Fix test for move-only functor objects
Amend 3c6e9dcc623c9d7281a81174bb3a696e030f30a7 by making sure that
we explicitly move move-only functors into the slot object in the
respective tests, and that failing to do so doesn't compile.

Also add test coverage for mutable lambdas, which work as they do
with connected functors: the connection stores a copy, and calls
don't modify the original functor.

Change-Id: I637e6f407133e2f8f72109b3fe5369a11d19da93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-01 22:50:58 +02:00
Volker Hilsheimer
1ed8c80ee3 Revert "Support move-only functors in invokeMethod and async APIs"
This reverts commit 9958edba41, which
incorrectly tested a move-only functor without actually moving the
functor.

Change-Id: I3707f9f8e5055102f7edfb3e1cb9750978356dd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-01 22:50:58 +02:00
Ahmad Samir
b2a95f9eee qc14n.h: general cleanup
- Add missing includes
- Use std::all_of, that also fixes a narrowing conversion warning
  (qsizetype).

Change-Id: I0f7f4b91bda4c187b8f8094e3039079c43fbf478
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-01 22:52:22 +03:00
Ivan Solovev
959800f6de Short live Q_NODISCARD_CTOR
[ChangeLog][QtCore] Introduced Q_NODISCARD_CTOR which resolves to
[[nodiscard]] attribute for constructors on compilers that support
it, and does nothing on other compilers.

Using [[nodiscard]] attribute on a constructor is a C++20 feature,
however in practice it is supported on most of the compilers that
we use in Qt 6. Clang generates a [-Wunused-value] warning, GCC
and MinGW generate a [-Wunused-result] warnings, and MSVC
generates a C4834 warning.
However, there are some exceptions.

The Integrity compiler provides the following warning:
 "tst_qglobal.cpp", line 699: warning #3435-D:
           the "nodiscard" attribute doesn't apply to constructors,
           destructors, or routines with void return type
           [[nodiscard]] explicit Test(int val) : m_val(val) {}

The QNX compiler (QCC 8.3.0) and GCC 9.3.1 on OpenSUSE generate
the [-Wattributes] warning:
 tst_qglobal.cpp: In member function
   'void tst_QGlobal::nodiscardConstructor()':
 tst_qglobal.cpp:699:44: warning: 'nodiscard' attribute applied to
   'tst_QGlobal::nodiscardConstructor()::Test::Test(int)' with void
    return type [-Wattributes]
          [[nodiscard]] explicit Test(int val) : m_val(val) {}

These warnings will lead to build failures when compiled with
-warnings-are-errors flag, so for these compilers the macro
does not do anything.

An attempt to use __attribute__((__warn_unused_result__)) was
also unsuccessful on these compilers, so this patch goes for
an easy solution, and simply checks
 __has_cpp_attribute(nodiscard) >= 201907L
to decide if the attribute is supported or not.

This commit also introduces a syntax-only test, and also applies
the new macro to QMutexLocker, because not all platforms in the
CI build and run unit tests.

Fixes: QTBUG-104161
Change-Id: Ib4230661a5ad5e8af0d67b21b034486ebcd67562
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-30 19:42:29 +02:00
Marc Mutz
5f28d367d9 Make QPointer<T> constructible from QPointer<X>
QWeakPointer can do the same, so there's no reason to not allow it for
QPointer.

[ChangeLog][QtCore][QPointer] QPointer<T> can now be (move- and
copy-)constructed from QPointer<X>.

Fixes: QTBUG-112464
Change-Id: I77cf5d39974bf2b3ec849b4afc33e286e864821e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-29 20:22:39 +00:00
Ahmad Samir
7564583d36 QString: add a tst_QString variant with QT_NO_CAST_FROM_ASCII
Now the tst_qstring is compiled three times:
- with QT_NO_CAST_FROM_ASCII defined
- with QT_RESTRICTED_CAST_FROM_ASCII defined
- with neither of the above defined

so as to cover more code paths.

Pick-to: 6.5
Task-number: QTBUG-109228
Change-Id: I65eca0f6f6aea66fed6eeda1eb77a50a97210807
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-29 18:15:23 +02:00
Thiago Macieira
80c6f378e7 IPC: tst_QNativeIpcKey: rename duplicate row in test
Change-Id: Idd5e1bb52be047d7b4fffffd1750b949e7b94b26
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-28 22:30:13 -05:00
Edward Welbourne
5fc53f58e9 Correct Julian Day numbers in 1800
This follows up on commit b906796af6.
Fix an off-by-one error - I was testing the last days of December 1799
and June 1800.

Change-Id: I79ab622978d35f91e3e1b1b8d00d93b0d4b31c07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 16:13:32 +02:00
Edward Welbourne
5dabac2c9c Change QTimeZone's offset range into constants, not an enum
Use static constexpr int values instead of abusing enum.

[ChangeLog][QtCore][QTimeZone] The MinUtcOffsetSecs and
MaxUtcOffsetSecs constants are now static constexpr members of
QTimeZone, rather than members of an anonymous enum. Their values are
now 16 hours either side of zero, to allow for some historical zones.

Change-Id: I1c3a0f85a2b83b5010f021ca0f5ca5baefbf32e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-04-28 16:13:25 +02:00
Fabian Kosmale
c2f01d4cfb QVariant: Fix support for metatypes created by Qt < 6.5
In Qt >= 6.1, < 6.5, a trivially constructible type would have the
NeedsDestruction flag set, but it's dtor pointer would have been null.

In Qt 6.5, the meaning of the NeedsDestruction flag was changed to be
more aligned with what the name suggests, and thus would only be set for
non-trivially destructible types. For QMetaType this was fine, but
QVariant has a check for acceptable metatypes which attempts to verify
whether a QMetaType is usable for QVariant. The check assumes the
semantics of Qt 6.5, and thus fails for metatypes created by older Qt
versions.

To fix this issue, we increment the QMetaType revision field, and only
check the metatype's destruction support if the revision is high enough.

In theory, that allows passing unsuitable metatypes from older Qt
versions to QVariant; however, such code would have been broken in prior
Qt releases already (which didn't attempt the check), and no code that
used to work in any released Qt version will break (as we simply skip a
check that was passing before).

Fixes: QTBUG-113227
Pick-to: 6.5
Change-Id: I12e02bd97d2c410ea1a36efb0ce2389f21d50a30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-28 12:37:03 +02:00
Volker Hilsheimer
1c5c1df43e Add a helper for better error messages when functor is incompatible
Amends 207aae5560 to make it easy to
create human-friendly error messages. Since the functor-accepting member
functions are not removed from the API, the first compile error will be
that there is no suitable overload of the makeSlotObject helper, which.
With the assert helper, the first error message is easier to understand.

Change-Id: I4878ec35a44ddfa5dc9d9e358d81c3fd40389c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Volker Hilsheimer
9958edba41 Support move-only functors in invokeMethod and async APIs
Move-only functors must never be passed by value, so fix the
QFunctorSlotObject constructor accordingly.

This then requires adjustments to the various QMetaMethod::invokeMethod
overloads, as those must also perfectly forwad the functor type.

Enable the previously failing test case for move-only functors.

Change-Id: I9c544fd3ddbc5e1da3ca193236291a9f83d86211
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Volker Hilsheimer
bd69821074 Support free functions and const functors as callbacks
Amend 207aae5560, as code checker
complained that we std::move'd a potential lvalue. This warning was
valid if the public API did not accept the functor parameter by value.

Fix this by consistently std::forward'ing the parameters through the
call stack, and add a compile-time test. Writing that test revealed that
the helper API didn't work with free functions, so fix that as well. It
also revealed that QFunctorSlotObject couldn't work with a const
functor, which is also fixed by this change.

We cannot support move-only functors with that change, as it requires
a change to QFunctorSlotObject that breaks the QMetaObject test.

Change-Id: Iafd747baf4cb0213ecedb391ed46b4595388182b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Laszlo Agocs
a3d3aaeee0 rhi: Add another resource update batch autotest
Exercise the validity of update batches, i.e. that one can
safely commit it in later frames as well, as long as all
related buffers and textures stay valid.

Change-Id: Ia943e4b37141fe17253eeae32010e0f8d92c1583
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-27 16:21:36 +02:00
Fabian Kosmale
c81e8f8ff2 QVariant: Add support for in-place construction
This avoids constructing an object just to copy (later: move) it into a
QVariant.
ChangeLog will be in a follow-up change adding emplace support.

Task-number: QTBUG-112187
Change-Id: I444e580c7d8927d41b3d21d5a521e7c475119e4c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-27 13:54:59 +02:00
Volker Hilsheimer
207aae5560 Simplify the creation of APIs that take a callback
Functions in Qt that take a callback need to support callables with or
without context objects, and member functions of an object. The
implementation of those overloads follows a pattern that ultimately
results in a QSlotObjectBase implementation being created and
passed to an implementation helper that takes care of the logic.

Factor that common pattern into a new helper template in QtPrivate
that returns a suitable QSlotObjectBase after checking that the
functor is compatible with the specified argument types.

Use that new helper template in the implementation of
QCoreApplication::requestPermission and QHostInfo::lookupHost.

The only disadvantage of centralizing this logic is that we cannot print
a more detailed error message indicating which argument types the
caller expects. However, that information is visible from the detailed
compiler errors anyway.

Change-Id: I24cf0b2442217857b96ffc4d2d6c997c4fae34e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 22:06:31 +02:00
Christian Ehrlicher
1f27dc6871 QSqlField: add move ctor & move operator
Add the move ctor and move operator for QSqlField

Task-number: QTBUG-109938
Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 19:56:07 +00:00
Volker Hilsheimer
ca15f650a1 QTabBar: don't scroll when laying out the tabs
QTabBar lays out the tabs when the bar's size or content changes,
often lazily. This should not change the scroll offset of the tabbar,
which is controlled by the user, or at most when a tab needs to be made
visible (e.g. when it becomes the current tab).

Move the logic of updating the scoll offset into the makeVisible
function, so that the scroll is only adjusted to either leave no gap
between the last tab and the right edge of the widget of there is still
a scroll; or to reset it to 0 if there is enough space for the entire
tab bar. Since layoutTabs does show and hide the scroll buttons, we
cannot skip this when the buttons are invisible. However, the
normalizedScrollRect helper now needs to return the entire widget rect
if there are no visible scroll buttons.

Add a test case that simulates the previously broken behavior where
the scroll got unnecessarily reset to 0 when resizing.

Fixes: QTBUG-113140
Pick-to: 6.5
Change-Id: Ic19fbb82821ea09cc5e7646dcbce3aa7607909c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-04-26 12:50:49 +02:00
Marc Mutz
b85a9d0ee1 Move QZipReader/Writer from QtGui to QtCore
These classes depend only on Core, not Gui.

This allows dropping the dependency of tst_qxmlstream and tst_qzip on
QtGui, and prevents a tst_qxmlstream FTBFS when building with
QT_NO_TEXTODFWRITER.

Symbols move from QtGui to QtCore, but the classes are private API, so
not under BC constraints.

The classes are not used outside qtbase, so no other in-tree users
need porting.

Task-number: QTBUG-3897
Change-Id: Ifa148f43ec139d7f9ac1f3893e2fcf4640e3c60c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-26 12:01:05 +02:00
Thiago Macieira
b9394b48c1 tst_QCoreApplication: ensure that theMainThread has expected states
The expected states are:
- nothing sets theMainThread before main()
- theMainThread is reset when the last QObject (the QCoreApplication in
  the test) is destroyed

The GUI version of this test appears to leak a lot of QObjects. By the
time this function runs, theMainThread's QThreadData still has a
refcount of 66 on Linux/XCB. The Windows non-GUI version also
failed. Neither situation was investigated to see why objects are
getting leaked.

Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17507d9e6ef08743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-26 04:55:47 -03:00
Thiago Macieira
6e99922234 tst_QProcess: don't link non-Qt helpers to QtCore
Change-Id: Icfe44ecf285a480fafe4fffd174d481f5e548c7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-25 18:53:30 -07:00
Mårten Nordheim
825a37da66 tst_QSslCertificate: Make it easier to check which backend is used
Instead of having one member signaling !openssl
let's just add booleans for openssl, schannel and securetransport.
The latter two of which are not currently used but may be in the future.

As a drive-by, make a compile-time check into a runtime one.

Change-Id: Id2f51f5396383a3f5836ac708996bfce8ae35c91
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-25 23:39:24 +02:00
Marc Mutz
efd9e3a02b tst_qxmlstream: remove dependency on QtXml
QtXml is only DOM and SAX, not QXmlStreamReader/Writer (those are in
QtCore).

Pick-to: 6.5 6.2
Change-Id: I8454d7db90303d347d5b4be94c9f21401d1e273f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2023-04-25 16:53:34 +02:00
Marc Mutz
e1818d9e9c QXmlStreamAttributes: port value()/hasAttribute() to QAnyStringView
[ChangeLog][QtCore][QXmlStreamAttributes] Ported value() and
hasAttribute() to QAnyStringView.

Change-Id: I771b9cede1d581d3f1142246e7a25c36bcc850d6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-25 15:03:03 +02:00
Axel Spoerl
72d6768ec1 Add missing nullptr check in QWidget::setFocusProxy
b1802a164b added handling for a parent to
become focus proxy of a child. The respective 'else if' branch didn't
check whether setFocusProxy() was called with a nullptr argument.

This patch adds the missing nullptr check.
It also adds functionality to tst_QWidget::tabOrderComboBox() to test
the removal of a focus proxy, as well as the complete removal of an
element from the focus chain.

Change-Id: I4cb865b9ac4497fc5e2595910738fb77694f5837
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-25 04:26:10 +02:00
Axel Spoerl
11f14c3b0d QDomDocument: no longer drop a provided 'standalone' attribute if 'no'
- Definition of 'standalone' attribute:
An XML declaration containing the attribute 'standalone' with its
value set to 'yes', tells the parser to ignore markup declarations
in the DTD and to use them only for validation.
The declaration attribute is optional and defaults to 'no'.

- Behavior Qt5
In qt5, DOM documents contained the standalone attribute,
regardless of whether or not it was explicitly specified.

- Behavior Qt6
In Qt6, the standalone attribute was only contained in a DOM document,
if its value was 'yes'. If it was explicitly declared with the value
being 'no', it was dropped in the DOM document.

- Expected behavior
If the source specified it overtly, then the generated XML should
contain the attribute, even when it takes its default value.

- Code base
QXmlStreamReader provides a public bool getter isStandaloneDocument().
This says whether the document is standalone or not.
The information whether the attribute was actually specified gets lost.
In consequence, the attribute was always dropped on non-standalone
documents.

- Fix
This patch makes hasStandalone a member of QXmlStreamReaderPrivate, to
record whether the attribute has been explicitly specified.

QDomParser is modified to retain the standalone attribute, if
QXmlStreamReaderPrivate::hasStandalone is true.

- Test
The patch adds a test function in tst_QDom.

Fixes: QTBUG-111200
Pick-to: 6.5 6.2
Change-Id: I06a0f230a2d69597dd6453f8fd3b036943d08735
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-24 21:49:29 +02:00
Alexey Edelev
f3c10280f5 Introduce the qt_internal_project_setup macro
The macro sets the required CMake variables and policies and
should be called right after the
find_package(Qt6 COMPONENTS BuildInternals... call to make sure that
the subsequent code adopt all the required policies.

Pick-to: 6.5
Task-number: QTBUG-112685
Change-Id: I9f93f728ee4d8ae7743db9fffafa26025c76dcf2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-24 14:20:25 +02:00
Ahmad Samir
18f5dc3746 QStandardPaths: de-duplicate some unittests code
Shorter lines, easier to read.

Pick-to: 6.5
Change-Id: Ifd83974cce2dd03bf05bcf032da2e459f1d3f798
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-22 20:04:31 +02:00
Ahmad Samir
a7555c3306 QStandardPaths/Unix: fix writableLocation() when test mode is enabled
In commit 482a75fef9 the code was changed to return early, but that
missed appending the organization and app names while test mode is
enabled.

Issue spotted by Edward.

Pick-to: 6.5
Change-Id: Ifd220f8990874a173413dcf71d105c04b605c800
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-22 20:04:31 +02:00
Ahmad Samir
e320280f61 QStandardPaths/Unix: restore org and app names in unittests
Some unittests set a custom Organization and Application names and then
clears them. Instead used init() method to "reset" those two names to
the original values before each unittest is run.

Pick-to: 6.5
Change-Id: I359f3911dd50a2aecfd8dde22e2d591adc6e224e
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-22 20:04:31 +02:00
Ahmad Samir
fa9244700e QDate: use more constexpr vars instead of plain numbers
Change-Id: I95580c199f868d632324f7f1fcbd56fa4dc85958
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-04-22 20:04:30 +02:00
Axel Spoerl
b1802a164b Handle parent being a child's focus procy in QWidget::setFocusProxy
When a parent became a new child's focus proxy in an existing focus
chain, the child was appended at the end of the chain.
That leads to broken tab order, e.g. with a QComboBox which became
editable after a focus chain has been set.

This patch captures the case and insertes the new child after its
parent in the focus chain.

A corresponding test function is added in tst_QWidget.

Fixes: QTBUG-111978
Pick-to: 6.5
Change-Id: I3a426c0560fa830b7b7ffead54f26dd0adef499f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-22 14:57:46 +02:00
Volker Hilsheimer
87535e4e43 QTimer: optimize single shot timers that cross thread
Amend 4d90c4e74a by clarifying why
moving the QSingleShotObject to the receiver's thread is a good
idea. Move that logic into a separate function and use that also
for the string-based connection.

Optimize the implementation by delaying the timer creation until
after we have moved the QSingleShotTimer object to the target
thread, using a queued metacall if needed to create the timer.
This avoids the creation of the timer in the wrong thread and
then the recreation of the timer in the new thread when QObject
handles QEvent::ThreadChange.

To avoid that the timer is created when it has already expired in
real time, use a deadline timer and fire timeout immediately when
it has expired by the time we get the metacall.

Since the timerId might now not be initialized in the constructor,
initialize it to -1.

Augment the crossThreadSingleShotToFunctor test function by
deliberately not starting the thread until the deadline expired.

[ChangeLog][Core][QTimer] Single-shot timers with a string-based
connection are now started in the receiver's thread, not in the
thread that creates the timer.

Task-number: QTBUG-112162
Change-Id: I3fc94c34c21d9f644da41a2e4c2da479980b8580
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 20:23:37 +02:00
Mårten Nordheim
34d82aab78 Network tests: drop testing ftp proxy server
It's quite flaky, and since we currently don't have FTP support
there's no point in making sure it works

Pick-to: 6.5 6.2
Change-Id: Ice01e8d36f2b7830813119da3513cc01ec005c46
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-20 16:10:03 +02:00
Mårten Nordheim
f19147d164 tst_qnetworkreply: Don't try using ftp servers while ftp is missing
Pick-to: 6.5 6.2
Change-Id: I979e2bbb51f7bf8ec2247a4dd8975663fc80e1cf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-20 15:51:42 +02:00
Edward Welbourne
fac6567208 tst_QDateTime: cope with MET masquerading as CET
MET is an alias for CET, so the test's attempts to detect whether it's
in CET can't distinguish them other than by checking the abbreviation.

Change-Id: Ibb467d9bb2d983ca16302111b54f664a614057c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 15:17:27 +02:00
Edward Welbourne
cb54fa634a Expand range of allowed UTC offsets to 16 hours
It turns out that Alaska and The Philippines had historical offsets
exceeding 15 hours, prior to day-transitions to bring their dates in
sync with their respective sides of the international date line.

Change-Id: I48fdf3aa6d8c0bacb368d08316733a10ee11a281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 15:17:26 +02:00
Volker Hilsheimer
b3424c7027 Baseline tests: wait longer before taking a screen snapshot
The recorded images frequently show traces of a fading-out command
prompt window that is opened by the test execution. We evidently have
to wait longer for all window-level effects are finished.

Pick-to: 6.5
Change-Id: I50db54ff33bf4bb1ef7c480a4aede1d5de1618c3
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-20 15:17:25 +02:00
Liang Qi
fed79b873e QWidgetTextControl: emit cursorPositionChanged() when select all
Fixes: QTBUG-91643
Pick-to: 6.5
Change-Id: I31745a3106321da0be4074a33768da8b84a8ae3f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-20 15:17:25 +02:00
Laszlo Agocs
c8c92933eb rhi: update manual test shaders
...so we have core profile compatible GLSL code
in them. Just so one can run e.g. triquadcube with
-g -c (OpenGL with a core profile context).

Pick-to: 6.5
Change-Id: I585d3b4f0c7cd71ce7fae1fff4bf9a84cb7410da
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-20 11:34:41 +02:00
Friedemann Kleint
936fe007ee Fix setting combo data with QSortFilterProxyModel
qtbase/c27d2a57a441f9a1ce760e71635bd4c96882249d caused the code
to go through QStandardItemPrivate::setItemData() which does
not handle the special treatment of Qt::EditRole completely.

In the constructor of QStandardItemData; map Qt::EditRole to
Qt::DisplayRole to fix this as is done in setData().

Adapt the existing tst_QStandardItemModel::getSetItemData() to check
whether both roles are received in the dataChanged() signal.

Pick-to: 6.5
Fixes: QTBUG-112326
Change-Id: I133d058bacc3388c612c5b4fb18b54f5ef5cb56f
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-19 20:26:24 +02:00
Milla Pohjanheimo
8c0aafc237 Add binary compatibility file built against 6.5.0
Using modules qt=QtConcurrent,QtCore,QtDBus,QtDesigner,QtGui,QtHelp,
QtNetwork,QtOpenGL,QtPrintSupport,QtQml,QtQuick,QtQuickTest,QtSql,
QtSvg,QtTest,QtWidgets,QtXml

Task-number: QTBUG-112072
Pick-to: 6.5
Change-Id: I97eadfda3de2b3e8358ff29a750dc8968fa46cc6
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-04-19 15:40:36 +00:00
Amir Masoud Abdol
a4168bd5e5 Remove unused variables
Removing a few unused variables in auto tests that were triggering
`-Wunused-but-set-variable`.

Pick-to: 6.5
Change-Id: I74bd0d7335d8bddeb18687b18c8a8be965f9fa20
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-19 12:55:02 +02:00
Thiago Macieira
39be743e5c QDeadlineTimer: remove internal TimeReference class
This removes all uses of QDeadlineTimer::t2 member in the .cpp (so it
gets marked [[maybe_unused]]) and greatly simplifies the code.

Change-Id: Ieec322d73c1e40ad95c8fffd17465bd50c1113ea
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:45 -03:00
Thiago Macieira
7ba76731ef QDeadlineTimer: use if constexpr instead of function specializations
You can't partially specialize a template function, so these
specializations for steady_clock only worked if the Duration parameter
was nanoseconds. This could have been solved with function overloads
instead, but I find the if constexpr code simpler to read.

Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468bd73fc2fe24
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-18 19:23:44 -03:00
Thiago Macieira
b498e1ae3a QDeadlineTimer: use std::chrono::steady_clock everywhere
This matches the work that was done for QElapsedTimer. The
QDeadlineTimer::t2 member is now always 0.

This also removes the last distinction of timer types. Originally I had
intended to use CLOCK_MONOTONIC_COARSE on Linux[1], but that created
more problems than was worth, so I abandoned the idea in 2016.

[1] https://codereview.qt-project.org/c/qt/qtbase/+/159933

Change-Id: Ieec322d73c1e40ad95c8fffd17468b313798ef79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-04-18 19:23:44 -03:00
Thiago Macieira
5c95cb8722 tst_QDeadlineTimer: use std::chrono_literals
For greater readability.

Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468e0c737bec0e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:43 -03:00
Thiago Macieira
13c3558fe9 tst_QDeadlineTimer: use the new QCOMPARE_xx() macros
Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468cb805546aea
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:43 -03:00
Thiago Macieira
c9f4c0d45e QElapsedTimer: rewrite using std::chrono::steady_clock everywhere
This commit deletes the direct, low-level functionality that
QElapsedTimer has carried since it was introduced. Everything now uses
only std::chrono::steady_clock and std::chrono::nanoseconds.

QDeadlineTimer temporarily still uses qt_gettime(), which is moved to
qcore_unix.cpp.

Task-number: QTBUG-110059
Change-Id: Ieec322d73c1e40ad95c8fffd174641a469b1eee5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-18 19:23:42 -03:00
Laszlo Agocs
e539e9a7af rhi: Replace the temporary GPU time query API with a saner one
Modeled after Metal's cb.GPUStart/EndTime. Implemented with timestamp
queries for other APIs.

Implemented for Metal, D3D11, Vulkan for now. No more callback, just
a getter on the command buffer which returns the latest known value,
referring to some previous frame. This makes it a lot more usable
than the original solution that is not really used anywhere at
the moment.

Now works for offscreen "frames" as well, this was not implemented
before.

Opt in with a new QRhi::create() flag because we cannot tell in
advance if the getter will be called or not, and this way we can
skip recording the timestamps by default. The cost is probably
minimal, though. Qt Quick will set this automatically when running
with QSG_RHI_PROFILE=1.

Change-Id: I903779984a4e0bbf1d03806d04bf61571ce23d72
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-18 15:35:28 +02:00
Laszlo Agocs
62a4ca773a rhi: Make it safe to always call deleteLater on a resource
...even when the QRhi is already gone. This should not happen in
well-written applications and libraries, but we handle this
gracefully in the regular dtor and destroy() for resources that
register themselves to their creator QRhi, so by registering
everything we can offer this to all QRhiResource subclasses.

We still want to differentiate between native resource owning
QRhiResources and others (that do not create native graphics
objects), so do this via a flag passed to registerResource().
This way the behavior with QT_RHI_LEAK_CHECK=1 does not change.

Pick-to: 6.5
Fixes: QTBUG-112914
Change-Id: I9bafc81ef7a4ae76f356fc5f6248628d1f8791e0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-18 14:42:45 +02:00
Fabian Kosmale
cb30e45b9a Avoid capturing same property twice
Avoid capturing the same property multiple times in a binding by
storing them in the BindingEvaluationState. We store them in a
QVarLengthArray array, as the number of properties involved in a binding
is expected to be rather low, so a linear scan is fine.

Avoiding double capture is a good idea in general, as we would otherwise
needlessly reevaluate bindings multiple times, and also needlessly
allocate memory for further observers, instead of using a binding's
inline observer array.

Even more importantantly, our notification code makes assumptions that
notify will visit bindings only exactly once. Not upholding that
invariant leads to memory corruption and subsequent crashes, as
observers allocated by the binding would get freed, even though we would
still access them later.

Fixes: QTBUG-112822
Pick-to: 6.5 6.2
Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
1645ce9a4a rhi: Fix offscreen manual test's Vulkan init
Pick-to: 6.5
Change-Id: Iaf7da78fd0c1c1265b05bfd4c7ced5d94ae963fe
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-18 13:23:48 +02:00
Volker Hilsheimer
fd879a38cc Fix another warning when comparing size_t and qsizetype
Amends 07f7ed2bad.

Change-Id: I0644e47e8e9ccd0bcaf074adf99e7481c692b5c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 00:10:56 +02:00
Liang Qi
14feb6792e tests: blacklist tst_QGraphicsEffect::draw() on Wayland
Task-number: QTBUG-109779
Pick-to: 6.5
Change-Id: I21ecd4910ba3d699e44d9ea922093e98e0b8a335
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-04-17 16:05:24 +02:00
Ahmad Samir
c1e1d133c4 mimetypes/: port to qsizetype
Fixes compiler warnings about narrowing conversions.

Found by compiling with clang and -Wshorten-64-to-32.

Drive-by changes:
- use range-for instead of an iterator based loop
- use strlen("*.") instead of magic number 2

Pick-to: 6.5
Task-number: QTBUG-102461
Change-Id: I0bf2299049c0411ed496468238ca30b69946ffc2
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-15 17:21:10 +02:00
Christian Ehrlicher
d9bd46b2b8 SQL/Tests: make sure created procedures are cleaned up on exit
Similar to TableScope - create a helper class to make sure the
procedures are cleaned up on exit so they don't affect the result during
the next test run.

Change-Id: Ic5b02ca63e03f330392797ed22313767557fc548
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 13:56:21 +02:00
Volker Hilsheimer
79ac430537 Test for QWindow getting enter/leave events when secondary window shows/hides
Equivalent to the test added to the QWidget test case, but since QtWidgets
code contains logic to both synthesize and compress/filter enter/leave
events, we can only verify that the QWindow does get the events.

The test is very flaky on Windows, so blacklisting it right away.

Change-Id: Ic1da9439f60f619a76a3653a23fef8e9ebc0e75d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-14 20:13:41 +02:00
Edward Welbourne
b906796af6 Fix QDateTime tests in zones whose side of UTC varies
The classification of local time as ahead of UTC, behind it or equal
to it gets complicated by zones near the prime meridian - some of
which have varied which side of it they nominally are - or the
international date line, which a few zones have crossed.

So, instead of having one classifying variable, split to having three,
one for the distant past (when using local solar mean time), one for
the epoch and one for the distant future.

Change-Id: I7c0da376e1625372086dc51afa815756f0bde442
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:23:09 +02:00
Edward Welbourne
462d3547f7 Add a manual test helper script, foreachzone
This makes it possible, on a system with /usr/{lib,share}/zoneinfo/,
to systematically run a command with TZ set to each system-supported
zone. For example, it can be used to verify that a corelib/time/ test
passes regardless of the valid setting of TZ.

Change-Id: I6ea9a64d8bcb745aea80ab9ae431602d3e3265a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:22:27 +02:00
Edward Welbourne
9f11574a7d Explain the cases where we must exclude some QDTE test cases
The stepIntoDSTGap() hour cases were already conditioned on hour > 0,
explain why. The month and year tests need similar checks for kindred
reasons; add and document those checks.

Pick-to: 6.5
Change-Id: Ibcb69449fcd572ee94306a805fd680e9b5155322
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:22:16 +02:00
Edward Welbourne
ee46c645a6 Skip some tests that fail in the Indian/Cocos timezone
The zone had a transition at the start of 1900, so QDTP's default date
ends up being 1900-01-01 at 00:02:20 instead of at 00:00:00; and any
parsing of date-time strings that doesn't set the minutes and seconds
consequently ends up "wrong" (about a field that wasn't specified).

Change-Id: If4b9864616fa08bc023a6974dae255f96ca90f83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:50 +02:00
Edward Welbourne
90d4957c12 tst_QDateTimeParser::intermediateYear(): adapt for Indian/Cocos zone
The zone had a transition at the start of 1900, used as default date
by the parser. This leads to the default minutes and seconds being 2
and 20, rather than 0. Since this test is parsing a date-only string,
only check the date of the result, to avoid failing in Cocos.

Pick-to: 6.5
Change-Id: Ifb307eadb747097988bcf0afc6f307835ff2c8ec
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:39 +02:00
Edward Welbourne
b81515c58a Correct a test's precondition on the system zone
America/Sao_Paulo was not alone in starting 2008-10-19 with a spring
forward. Include the other affected zones in the check to tune the
expected start-of-day time. See [0] for details.

[0] https://github.com/eggert/tz/blob/main/southamerica

Pick-to: 6.5
Change-Id: If251d8b715090319441790696983273637765d2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:21:22 +02:00
Edward Welbourne
bab9af5891 Fix where possible, else avoid, failures in western Mexico
Some QDateTime tests get tripped up by a transition at the epoch in
Baja Mexico. For the operator_eq() and time-difference test, simply
using startOfDay() instead of QTime(0, 0) - which was skipped - solves
the problem. For addDays() and fromStringDateFormat(), skip the
affected tests.

Change-Id: I3620f0d1e4b05d9f799662eea96a40c8284de331
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:08 +02:00
Edward Welbourne
ca4aa06523 Add new test-case for startOfDay_endOfDay() for Baja Mexico
The zones in Baja Mexico had a transition at the epoch.

Change-Id: Ic70e23bcc980bf371e925fcb8fb83ca5ef000c9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:03 +02:00
Edward Welbourne
919d2e0c5a Correct time zone in tst_QDateTimeEdit::stepIntoDSTGap()
Given that QDTE only supports local time and UTC, using Europe/Oslo as
zone was disconnected from reality, especially as various QDateTime()s
were constructed using local time. Use the system zone.

Pick-to: 6.5 6.2
Change-Id: I95b3a6a6acf9ffc2b8c7f05d3dd9440ff173abfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 13:19:03 +00:00
Edward Welbourne
d43391422a Correct the start of a QDTE::stepIntoDSTGap() test
The test wants to start shortly after the transition, then step an
hour backwards, into it, to check we land safely on the other side.
However, it assumed the gap witdh was an hour, which is not reliable.
Use the gapWidth already used in computing springGap instead.

The -3590 seconds in the result time is correct, as it's the ten extra
seconds we started beyond the gap, minus the hour we step backwards.

Pick-to: 6.5
Change-Id: I4399af7e54a60bd55ea51d054d3cd2ecfcb0e354
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:03 +02:00
Edward Welbourne
5432a8040f tst_QDateTimeEdit::springForward(): use u'0' instead of QLatin1Char('0')
Pick-to: 6.5
Change-Id: I0c13c6b658cac3472d21b8d92b1e5eb73c094a7c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
4e69b6de4b Correct row names in tst_QDateTimeEdit::springForward_data()
The "{forward,back} to %s, correct to nearest" tests were reporting
the time of the transition as %s but, like the jump test, were using
the middle of the gap as the time to set. So compute that mid-time's
string once and use it in all three test names. Also renamed some
local variables to accommodate the new one for this text.

Pick-to: 6.5
Change-Id: Ic6c40c470fc74ae8bcfc0dc9d1596af06318a883
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
28c6868611 tst_QDateTimeEdit: correct computation of width of gap
Although the zone's daylight time offset is usually the width of the
gap, it's possible the transition is (or includes) a change to
standard time; so determine the actual gap width by comparing the
difference between time a day earlier and later to the usual duration
of two days. Also skip the test if the transition isn't really a gap.

Pick-to: 6.5
Change-Id: I56e381c9f74cfa1806d43b3ed5e4637436ebdf57
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
f06cc22509 tst_QDateTimeEdit: Use correct zone for findSpring()'s transition
The function is passed a zone to work in, so setting the transition to
local time made no sense; set to the given zone's time, instead.

Pick-to: 6.5
Change-Id: Icaa0955fe5fcd5bc257322afcb7e25e932dedd1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-04-14 15:19:02 +02:00
Edward Welbourne
a076fdfec6 tst_QDateTime: Remove two duplicate test cases
Pick-to: 6.5 6.2
Change-Id: I36541b5c6f7c35deee9678e2f736e1db9f36039f
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-04-14 15:19:02 +02:00
Edward Welbourne
91fedd50f0 tst_QDateTime constructor: adapt the year check to vary year
We check three sample dates, in different years, so don't compare
their year() to 1970, but to their respective actual years. In the
process, package the arrays iterated for these checks into a constexpr
struct array and reverse them so that, instead of reverse-iterating
and indexing, we can use a ranged-for loop.

Change-Id: I214685346c637875a4ea31125c324851eb4308db
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:02 +02:00
Edward Welbourne
9aa87643d7 tst_QDate::startOfDay_endOfDay(): rename variables, add comments
The name final is suboptimal, given that it's also a keyword.
Rename initial at the same time.

The local-time parts of the test are apt to fail if local time
coincides with the zone being tested, as previously noted. Document
known cases of such coincidences, to help someone studying a failure
to know why it happened.

Change-Id: I1f1f302f161373a154066df210e03725b9a5f9ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:02 +02:00
Edward Welbourne
c8c5b8ac1a tst_QDateTime::addMSecs(): check for failure after calling helper
When the test failed, it did so in triplicate.

Pick-to: 6.5
Change-Id: Ia871aed0a5960120a2659a6778c10dccd4b2953a
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-14 15:19:01 +02:00
Edward Welbourne
ac653abc41 Name a numeric_limits locally to save verbose repetition
Change-Id: I443eb1f5a38e79a28827ac3e664100e6a23a9ef2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-04-14 15:19:01 +02:00
Tatiana Borisova
42d3e242fa Put timezone related code under ifdef
In case FEATURE_timezone=OFF auto-tests should still be built successfully

Change-Id: I0226a7d7781a412bf9e9935c2cf1a48b1ce427b5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-04-14 10:34:45 +00:00
Amir Masoud Abdol
8c4d81484c Replace PUBLIC_LIBRARIES with LIBRARIES in qt_internal_add_manual_test
Noticed the warnings when building the manual tests.

Pick-to: 6.5
Change-Id: I7f927f42f11d234ec3c980f36d8e12c0c49be712
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-13 20:16:08 +02:00
Alexey Edelev
4fb7eebc70 Rid of 'special case' markers
It's unlikely we will ever use pro2cmake at this project stage,
so it doesn't make any sense to keep the 'special case' markers
in the CMake scripts. Remove them and replace with TODO where
needed.

Change-Id: I84290c20679dabbfdec3c5937ce0428fecb3e5a7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-13 18:30:58 +02:00
Tor Arne Vestbø
06499383ca Use LANGUAGE OBJCXX rather than COMPILE_FLAGS "-x objective-c++"
We sometimes use Objective-C++ code in files with a .cpp extension,
to avoid the churn of adding a foo_mac.mm file. Instead of manually
telling the compiler to build these files in Objective-C++ mode, we
use CMake's intended mechanism, which means genex constructs such as
$<$<COMPILE_LANGUAGE:OBJCXX> will work for these files as well.

Pick-to: 6.5 6.2
Change-Id: If295c3f34f6bee9f4d9f877f519c9c7770665fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-13 14:36:26 +02:00
Volker Hilsheimer
bbd6cbd71c windows: Re-apply mask when DPI changes, to account for new scale factor
When the DPI of a window changes due to being moved to another screen,
or the current screen reconfiguring, the mask we've set earlier is no
longer correct, as the mask was set based on the original screen's
scale factor and in relation to the former platform geometry of the
window, which now has changed.

Like the geometry of a QWindow, the mask is expressed by the user in
the QtGui coordinate system, so it's the platform's job to transform
this into the platform coordinate system and update it when needed.

Add a manual test that users a QWidget and a Q(Raster)Window side by
side.

There's still an issue with the screen change being triggered to
early, via QWindow::setGeometry, instead of when the window has
actually moved to the new screen, resulting in the paint event
flushing to a window and backingstore that is in the wrong state,
but this requires further research to fix.

Task-number: QTBUG-97642
Pick-to: 6.5 6.2
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I7ab2d267fbaf6ac32b507d05a418eb025b354a0b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-12 15:41:23 +00:00
Laszlo Agocs
9e0ebc36d6 rhi: Remove unused init flag
Change-Id: I289452f39fd161da0e0d7bf329e0922df6bbde8a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-12 11:23:37 +00:00
Marc Mutz
2f95cd8f8b Long live QPromise::emplaceResult/At()!
And implement the rvalue overload of addResult() using it.

[ChangeLog][QtCore][QPromise] Added emplaceResult() and
emplaceResultAt() member functions.

Fixes: QTBUG-112270
Change-Id: Id369542215a60c0818f1afa8d564498be84732e8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-12 01:57:15 +02:00
Laszlo Agocs
82112db29d rhi: Remove readback result type alias
Change-Id: I1b14d3230ab4011506892c64ea03d5431d82a90d
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-12 01:11:12 +02:00
Volker Hilsheimer
f334a22eae QAccessible test: skip focusChild on wayland
The test implicitly relies on window activation as QWidget only emits
accessibility events for focus changes in the active window. So skip it
on platforms that don't support WindowActivation and remove it from
the blacklist.

Fixes: QTBUG-109763
Pick-to: 6.5
Change-Id: I67d9a95f4f36b5271fe53ae90140a28770566c83
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-11 19:03:52 +02:00
Volker Hilsheimer
7199498fb9 QPushButton: use QMenu::popup instead of exec to show menu
QMenu::exec opens a blocking loop, which is problematic for webassembly.
Replace with QMenu::popup, and reset the down-state of the button when
the menu is about to hide. QMenu emits aboutToHide immediately before
existing the event loop in the hideEvent override, so the timing is the
same.

Change-Id: Iccb418d10fcb25f6ad1f73f9cdce6ea6581bd73b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-04-11 12:58:58 +02:00
Volker Hilsheimer
cf5d9e9eb5 QWidget: add overload to set tab order as a list of widgets
The "two widgets at a time" API to set the tab order is awkward and
easily misused (as the documentation explicitly explains). Add an inline
overload that takes an initializer_list, and call the existing function
for each consecutive pair of widgets in the list.

Add documentation with snippet, and a test.

Change-Id: I8e6f14a242866e3ee7cfb8ecade4697d6bdfb4d4
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-04-11 12:58:58 +02:00
Ahmad Samir
94a01cd6ec QDate: remove an old comment
QDateTime::addMsecs does check for overflow. I don't know when this
 has changed, but it doesn't matter.

Change-Id: I44c6ba5e88cce544c0d1ef33fa38a528a96b0b7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:23:22 +02:00
Ahmad Samir
3202ab1eb1 QXmlStream: run the test suite from a method other than initTestCase()
Only unzip the test suite in initTestCase(), but run the tests from
runTestSuite(). This is mainly useful when running specific a unittest
locally, no need to wait for the whole zipped test suite to run.

Change-Id: I518a2de716d3d07fb5a78298f1bd3ab2759e744b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:23:06 +02:00
Ahmad Samir
d1140235e2 QDate: reformat a unittest
Change-Id: I323975db23f40fe2e7fc5062fbc8102dedbaaf5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:21:51 +02:00
Ahmad Samir
b58606ed85 tst_qstringapisymmetry: silence a GCC warning
GCC complains:
inlined from ‘constexpr QAnyStringView::QAnyStringView(const Container&) [with Container = QVarLengthArray<QChar, 1023>; typename std::enable_if<disjunction_v<QtPrivate::IsContainerCompatibleWithQStringView<T, void>, QtPrivate::IsContainerCompatibleWithQUtf8StringView<T, void> >, bool>::type <anonymous> = true]’ at src/corelib/text/qanystringview.h:215:64,
    inlined from ‘void tst_QStringApiSymmetry::overload() [with T = QVarLengthArray<QChar, 1023>]’ at /home/ahmad/devo/qt6-git/qtbase-qglobal/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp:1178:17:
src/corelib/text/qanystringview.h:187:47: warning: ‘t’ may be used uninitialized [-Wmaybe-uninitialized]
  187 |         : m_data{str}, m_size{encodeType<Char>(str, len)}
      |                               ~~~~~~~~~~~~~~~~^~~~~~~~~~

Clang doesn't warn about this.

Change-Id: I3476236630e886b087856acd22054bfb35deb451
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:21:24 +02:00
Christian Ehrlicher
40045aeec8 SQL/Tests: use TableScope where possible
Use TableScope helper class to make sure the table used for the test is
really cleaned up before usage.

Change-Id: I45fffcd13acae6032636ae07097b14af174ede21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-07 20:38:13 +02:00
Volker Hilsheimer
b40df32ea3 QtSql: don't use deprecated QSqlDatabase::exec in test
Change-Id: Id9e88eb874ce70c3dea6ddb0a324e589965ff9d9
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-04-07 19:53:59 +02:00
Christian Ehrlicher
ca7e3bcf91 SQL/IBASE: Always escape the table names when creating the SQL statement
Sync the IBASE driver behavior for primaryIndex() and record() with the
rest by assuming that the given table name has the correct casing.
Change the tests for these two function to pass an unescaped table name.

Change-Id: I6d96359f97e1acc6970b9a22fdf0e968a616b7bc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-07 15:48:57 +01:00
Christian Ehrlicher
3983babd71 QSqlQuery: add boundValueName()/boundValueNames()
[ChangeLog][SQL][SqlQuery] Added two new functions
boundValueName()/boundValueNames() to return the names of the bound
values.

Fixes: QTBUG-97847
Change-Id: I8df5f15e8df13141a34d38b0a2e13b37f4e7829c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-07 14:25:28 +02:00
Morten Sørvig
a215e6650a Add DPI change tests
We can expand the testing a bit bit verifying that also
created windows work as expected, and that QWindow DPR
is updated when Screen DPI is changed.

Change-Id: I082aac18b6b086c69c16681977b7eaa6c3e54ee0
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
2023-04-06 14:28:24 +00:00
Christian Ehrlicher
be8b3efae6 SQL/QSqlRelationalTableModel escape the auto-generated alias
The alias created by QSqlRelationTableModel to avoid duplicated field
names was not escaped which lead to an inconsistency in the returned
alias name from the database (e.g. postgres lowers all unescaped column
names).
Also adjust the test for QSqlRelationTableModel to use escaped table
names for it's tests and fix it for QIBASE.

Change-Id: I01426320c0c1a70cb9bf8e6dfa2f8b07dbb1c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-06 05:41:16 +01:00
Volker Hilsheimer
27867de8ca Permissions: respect context object's thread and life time
When a context object is provided, then callers expect that the functor
or slot is executed in the thread of the context object. And if the
context object has been destroyed by the time the permission response
is received, the functor shouldn't be called at all.

To implement this, we either have to plumb the call back through a
signal/slot connection and benefit from QObject's infrastructure. This
is not practical here, as we don't have an "engine QObject" that would
emit a signal.

Instead, we can create a QMetaCallEvent explicitly, following what we do
in e.g. QHostInfo, and using a temporary QObject that handles the event
to then call the functor.

Add test coverage.

Pick-to: 6.5
Change-Id: Id878e45b304857304165ab4a7c6aae76fbee46ce
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-06 00:21:50 +02:00
Ivan Solovev
028c367f75 Deprecate QtFuture::makeReadyFuture()
[ChangeLog][Deprecation Notice][QtCore] The QtFuture::makeReadyFuture()
method and all its specializations are deprecated since Qt 6.10.
The reason for the deprecation is that the method has a
makeReadyFuture(const QList<T> &) overload, which behaves differently
from all other overloads (including other non-const ref QList
overloads).
Use QtFuture::makeReadyVoidFuture() when you need a ready void QFuture,
or QtFuture::makeReadyValueFuture() when you need to propagate the
input type to the returned QFuture, or QtFuture::makeReadyRangeFuture()
when you need to create a multi-value future based on an input
container.

Fixes: QTBUG-109677
Change-Id: I55125269989df0a02840d5ddd5763ef5f1070df5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:15 +02:00
Ivan Solovev
9b4b32ec98 Long live QtFuture::makeReadyVoidFuture() and QtFuture::makeReadyValueFuture()
[ChangeLog][QtCore][QFuture] Added QtFuture::makeReadyVoidFuture()
and QtFuture::makeReadyValueFuture().

Basically, these methods behave like QtFuture::makeReadyFuture(), but
QtFuture::makeReadyValueFuture() does not have a "const QList<T> &"
specialization returning QFuture<T> instead of QFuture<QList<T>>,
which allows it to always behave consistently.

This patch also introduces usage of the new methods around qtbase.

Task-number: QTBUG-109677
Change-Id: I89df8b26d82c192baad69efb5df517a8b182995f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:15 +02:00
Ivan Solovev
7f38f9f394 Long live QtFuture::makeReadyRangeFuture()
[ChangeLog][QtCore][QFuture] Introduce
QtFuture::makeReadyRangeFuture(). This method takes a container
which has input iterators and returns a multi-value
QFuture<ValueType>, where ValueType is the underlying type of
the input container.

This commit also replaces the usage of buggy
QtFuture::makeReadyFuture(const QList<T> &) overload with the new
method.

Task-number: QTBUG-109677
Change-Id: I019e62eac74c643d88a65b3cc0085bc7c33bc712
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:14 +02:00
Thiago Macieira
2f226336a2 QPluginLoader: don't instantiante multiple, identical instances
This can happen if the same project has two or more Q_IMPORT_PLUGIN
macros in their source. And that can happen when converting from qmake-
based builds to CMake, as qmake didn't generate a source file with the
macro but CMake does.

[ChangeLog][QtCore][QPluginLoader] staticInstances() will not call
duplicated registrations of the same instantiation function, which can
only happen as a result of duplicated Q_IMPORT_PLUGIN for the same
plugin name.

Fixes: QTBUG-102745
Pick-to: 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174fb9dd62d8583d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-05 00:29:16 -07:00
Christian Ehrlicher
dbcad6392b SQL/Benchmarks: cleanup
The benchmarks were only copied from the tests without a proper cleanup
- therefore clean them up now.

Change-Id: I0285de3fd2b67c21e732d7f3f9d1f4937965be81
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-05 05:37:32 +01:00
Thiago Macieira
87103e04e9 QMultiHash: fix missing update to m_size
QMultiHash has access to two sizes: one of them is shared with QHash,
stored in QHashPrivate::Data::size, which counts keys; the other, which
is what our public size() function returns, is stored in
QMultiHash::m_size and counts plain (key,value) entries. We forgot to
update it in the non-const operator[] that created a node.

I've reviewed the rest of the code and can't find any more places where
the item count may be changed and m_size isn't updated.

[ChangeLog][QtCore][QMultiHash] Fixed a bug that caused an element that
was created by operator[] to not be counted, resulting in a hash map
with an incorrect element count and which could cause an assertion
failure depending on how the hash was later mutated.

Fixes: QTBUG-112534
Pick-to: 6.2 6.4 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17527ec274e1d99e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-04-04 08:59:32 -03:00
Allan Sandfeld Jensen
c080d1e64d Create any callable using QRunnable::create
The overhead of making new custom classes appears to be less than
constructing a generic std::function.

[ChangeLog][QtCore][QRunnable] QRunnable::create can now take
non-copyable functions as argument.

Task-number: QTBUG-112302
Change-Id: Ied870f13ca6c7eaa14ed6eff9c4e676c7b73881c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-04 01:05:47 +02:00
Christian Ehrlicher
5a334b3d2b SQL/tests: Add testcase for QODBC toSQLTCHAR()
Add a testcase for toSQLTCHAR() to make sure to pass the correct number
of encoded characters to the odbc functions.

Pick-to: 6.5
Task-number: QTBUG-112375
Change-Id: Ib67fab678fc3d0b098aedfc6fa9ec2139f2e75c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-03 17:52:32 +02:00
Christian Ehrlicher
2f709952cf QSqlError: also compare nativeErrorCode() in operator==() / operator!=()
A QSqlError is not equal when the native error code differs. The
database and driver text should not be considered during the
comparison because they might differ due to e.g. different locales.

[ChangeLog][QtSql][QSqlError] The comparison operators have been fixed to
take both error type and error code into account.

Change-Id: Ie7511f183f88dd454eb165c6ff237e51b79d1c08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-03 15:52:03 +00:00
Volker Hilsheimer
07f7ed2bad Fix warning when comparing size_t with qsizetype
Change-Id: Id8e7ae20aea99f2acb03b665484615bf7f932873
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-03 17:12:18 +02:00
Marc Mutz
e848dd14f5 tst_qxmlstream: add non-US-ASCII hasAttribute() checks
One each of L1 and non-L1.

Will help porting that API to QAnyStringView.

Pick-to: 6.5
Change-Id: I51afc07c5b2384409c2627164e95265265fbb544
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-01 06:26:42 +02:00
Mårten Nordheim
7822b89aef Http2: Don't skip checking flag for trailing HEADERS frame if PRIORITY
If the trailing frame just had PRIORITY we would early-return, though
this meant we didn't check if the frame had the END_STREAM flag set,
leading some requests to certain servers to hang.

Fixes: QTBUG-111417
Pick-to: 6.5 6.4 6.2
Change-Id: Iac174dc5aeca30d5d19fae35f303983de9841847
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-04-01 00:36:58 +02:00
Marc Mutz
a81ea3d114 tst_Q(Any)StringView: check conversion from winrt::hstring
Instead of adding more QString::fromMyFavoriteStringImpl(), just check
that

   QStringView{myFavoriteStringImpl}.toString()

works.

It does.

Pick-to: 6.5
Task-number: QTBUG-111886
Change-Id: I337282611360b4a56a10c8acfd2d7d53ea196d5b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 21:41:35 +00:00
Christian Ehrlicher
46e909a37a QSqlIndex: add move ctor & move operator
Add the move ctor and move operator for QSqlIndex, also add an explicit
testcase for QSqlIndex

Task-number: QTBUG-109938
Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-31 18:36:29 +02:00
Ulf Hermann
b83de5f9a4 moc: Record types of enumerations
This will be helpful in a number of places, in particular in order to
support enums of different sizes in QML. We record the type as string in
the JSON output and as QMetaTypeInterface in the generated C++.

Task-number: QTBUG-112180
Change-Id: I943fac67f8b25b013d3860301416cdd293c0c69e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 17:42:58 +02:00
Marc Mutz
e2b2bb7ff1 Short live q20::to_address!
An implementation of C++20 std::to_address, a prerequesite for
QSpan<>.

The test cases are inspired by libstdc++'s test suite, just to avoid
missing some cases, but the to_address implementation is white-room.

Fixes: QTBUG-108430
Change-Id: I4c092fdd7a56c0b279068e341bbf91a725ca3b1f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-31 13:10:12 +01:00
Axel Spoerl
a815c40e73 QListView: No-op, when a list item is dropped directly behind itself
QListView generates a move, when an item is dropped directly behind
itself. This causes unexpected behavior, e.g. item widgets getting
discarded.

This patch prevents a move from being generated in that case.

It adds an autotest to tst_QWidget, to verify item widgets and item
data do not get discarded in case of a no-op drag&drop.

Fixes: QTBUG-100128
Pick-to: 6.5 6.2
Change-Id: I02a755320a7b71dad218293c9c94c88da6507423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-31 13:09:39 +02:00
Marc Mutz
b1b0f42c97 tst_qtconcurrentrun: fix UB (uninit'ed values)
While doubleFunction's body is empty, it takes its argument by value,
which means copying. Copying an uninitialized double is a gray zone
(if you follow the partially-formed paradigma, it's UB; though the std
may allow it some types, most notably std::byte and uchar; probably
not double, though). Converting an uninitialized int into double is
most certainly UB.

Fix by initializing both d and i.

Found by GCC 11's -Wmaybe-uninitialized.

Pick-to: 6.5 6.2 5.15
Change-Id: I103fb72bf4b8792a292346007f498dc6349e9c68
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 11:32:46 +02:00
Marc Mutz
1cc1d39f3e tst_QThreadPool: reduce the number of infinite timeouts
... by supplying a TestThreadPool that waitsForDone() with a defined
timeout in the dtor.

When tests hang, this will now print an intelligible message instead
of just the generic watchdog-killed-process one.

Also replace all QVERIFY(waitForDone()) with the same code used in
TestThreadPool's dtor and add a comment in a place we'd rather not use
these tools.

Pick-to: 6.5 6.2
Change-Id: Ifd2b3372eb7c7337a3ba77d003e45dcd77e23545
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 11:32:45 +02:00
Marc Mutz
eb260c132a tst_bench_QCryptographicHash: use resultView()
Don't benchmark the creation of the QByteArray from the internal
buffer, that's not interesting.

Call resultView() instead of result().

On the one hand, this skews comparisons with older benchmark data.

OTOH, result() used to be the fastest way to get the result out of
QCryptographicHash or QMessageAuthenticationCode, and now it's
resultView(), so in a way, it still is a fair comparison.

Pick-to: 6.5
Change-Id: I864b2f88f01e426c5d0967f57199e13dd7cb29f8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 10:32:45 +01:00
Marc Mutz
0eccfe5e39 tst_bench_QCryptographicHash: port from std::function to qxp::function_ref
Because we can, and because function_ref is never null.

Pick-to: 6.5
Change-Id: If71f98860d72eaa8cf8a93bb3c59a0260d3c7660
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 10:32:45 +01:00
Marc Mutz
f1b264f9ac tst_bench_QCryptographicHash: QSKIP unsupported algorithms
With the OpenSSL 3 backend, some algorithms may not be available. Skip
benchmarking them.

Pick-to: 6.5
Change-Id: I1275332993fe15c007410e25acf59f5e3ec27894
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 10:32:45 +01:00
Marc Mutz
3aaae083f7 tst_bench_QCryptographicHash: add benchmarks for QMessageAuthenticationCode
We could add a tst_QMessageAuthenticationCode, but it would have to
duplicate a lot of the tst_QCryptographicHash machinery, so just add
it here.

Pick-to: 6.5 6.2 5.15
Change-Id: Icc60de865c72c5e423cb3be57f58297c522791f7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 10:32:45 +01:00
Axel Spoerl
7350088ab7 tst_QSslSocket_onDemandCertificates_member: Blacklist Windows & debug
The test function occasionally can fail on CI/Windows, when a
certificate update on www.qt.io requires installing a new root
certificate on the test VM.

This patch blacklists the test class (which has only one test function)
on Windows. It adds diagnostic output, so future failure reasons can
be established from CI artifacts.

Pick-to: 6.5
Task-number: QTBUG-63481
Change-Id: If686d006f379fe6dbfb0d11d80b8455f72fdbb09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-30 17:17:26 +00:00
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
Ahmad Samir
f325bdacb6 Replace ushort*/uint* with char16_t*/char32_t* in private API [1]
Task-number: QTBUG-110403
Pick-to: 6.5
Change-Id: Ie20a831f22212d56659cf3c6940d17134ab5f2c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-15 20:25:57 +00:00
Amir Masoud Abdol
11ae4b70a1 Fix tst_qfilesystementry in unity build
Previous setup of the test was failing in minimal static build if built
using  the unity build because of the explicit inclusion of the qtcore
source files. By removing them, it surfaced that QFileSystemEntry
doesn't export all its necessary symbols for testing. So this patch does
that, as well as removing the qtcore sources from the test. It also
makes sense to make the test private.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Icdabe32485b7ce4ed6049bcc24918f531406b4bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-15 18:18:01 +01:00
Axel Spoerl
8b84374892 emit QAbstractSlider::valueChanged() only on value change
The signal has been emitted also, when the slider position has changed
without a value change (e.g. on QWidget::show() or on resizing).

This patch stops emitting the signal without a value change.
It adds a verification to tst_QAbstractSlider::setValue(), that
valueChanged is not emitted on a no-op value change.

As a drive-by, the patch removes an unnecessary assignment and
changes signal spy constructions to PTMF syntax.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-25365
Change-Id: I9932e45d4e680aa53422ca75aa42a16306213a38
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-15 14:32:35 +01:00
Ahmad Samir
5cea5fc80b QLockFile: tryLock(): use chrono first
I.e. tryLock(chrono::milliseconds) shouldn't call the int overload as
that truncates the timeout (milliseconds is typically int64_t).

Add a note to the tryLock(millisecons) docs that passing
milliseconds::max() will make it wait forever to obtain the lock.

Task-number: QTBUG-110059
Change-Id: Ib48d9b1b117ce816348625331543d6ba8a788973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-14 22:15:35 +02:00
Axel Spoerl
425e635ecd QCompleter::setPopup() - refactor and cleanup
QCompleter::setPopup() sets window flags, focus policy, parent, focus
proxy, item delate and installs an event filter, before the popup
argument is assigned to d->popup.

In the QCompleter::eventFilter override, QObject::eventFilter is called
(under more) if d->popup is nullptr.

If a custom class is inherited from QCompleter and it overrides
QObject::eventFilter(), this causes an infinite loop.

This patch re-factors the method.
- early return is added if the new popup != d->popup
- remembering the existing widget's focus policy is constified and
  moved ahead of the delete secion.
- assignment of d->popup to popup argument is moved after the delete
  section.
- after assignment, the argument variable is no longer used.

The refactoring eliminates two issues:
- potential risk of double-installing event filter due to missing
  early return.
- inifite loop if inherited class installs another event filter.

The patch adds a test function to tst_QCompleter, which implements an
inherited class, installs an event filter on a popup and checks if a
ChildAdded event hass been recorded.

Fixes: QTBUG-111869
Pick-to: 6.5 6.2
Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-03-14 21:15:31 +01:00
Amir Masoud Abdol
d203f82916 Fix for CMake tests when build with unity
Some of the mockplugin tests needed to be excluded from the unity build
manually. In addition, MSVC's complain about include <QtCore/QString>
instead of <QString> was addressed here since it was breaking the unity
build as well.

Some other independent executable and libraries have to be excluded
manually as well.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I1f21f8484b4d3b1c399e2118ab3a71e682a3006a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 17:28:43 +01:00
Amir Masoud Abdol
608c2501e5 Fix tst_qfreelist when build with unity
Previous setup of the test was failing in minimal static build if built
using the unity build because of the explicit inclusion of the qtcore
source files. In order to resolve this, I removed the inclusion of
qtcore's headers and made the test private.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id1c7b3b65ca2078354c235a718ff3e93a65362e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-14 17:28:43 +01:00
Amir Masoud Abdol
e512734278 Use qt_internal_add_executable in auto tests
When possible, I replaced add_executable with
qt_internal_add_executable.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I643d2e27f0d880fe9b6cec7af790e4c99227fb0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-14 17:28:43 +01:00
Ahmad Samir
0d29a406f7 QThread: add sleep(std::chrono::nanoseconds) overload
All the other overloads are implemented using the new one.

Windows change relies on the pre-check in the code review making sure it
compiles.

[ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds)
overload.

Task-number: QTBUG-110059
Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-13 23:26:28 +02:00
Assam Boudjelthia
f314e821c1 Android: skip two qrhi tests to enable Android 12 in CI
This is expected to be temporary and to be investigated afterwards.

Task-number: QTBUG-108844
Pick-to: 6.5
Change-Id: I0a571dad2b99ceaa0fd48e5cdd81057e49e55ddf
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-03-13 21:12:38 +00:00
Christian Ehrlicher
30de1f74de SQL/MySQL: Add support for Bit-Value Type - BIT
Add support for MYSQL_TYPE_BIT. Since the bitfield can be max 64bits,
store it in a uint64_t. Writing such a value as MYSQL_TYPE_LONGLONG
works as expected but receiving it needs a special handling.

[ChangeLog][SQL][MySQL] Added handling for Bit-Value Type - BIT.

Fixes: QTBUG-21326
Change-Id: Id20e3316caf6703b3bec8a828144494a20693fd8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 16:21:17 +00:00
Christian Ehrlicher
18bd15a9ea SQL/Tests: remove safeDropTable() / add helper class
Add a helper class which makes sure that the used table does not exist
before usage (e.g. due to leftovers from previous tests) and is properly
cleaned up on exit. This also allows to remove all usages of
safeDropTable().

Change-Id: Iefeffbd10e2f2f67985183ea822d7b6dd2b80be7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-12 17:21:17 +01:00
Ahmad Samir
46b483ace0 Make sure helper executables used by unittests are built
E.g. tst_qprocess_and_guieventloop uses write-read-write.

This is useful e.g. when not building all of qtbase, but only a specific
unittest while hacking code.

Change-Id: Id97c6c09c180ba35554d75877a434cb258a6243d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-11 12:40:14 +02:00
Ahmad Samir
957ed5e71e QMimeDatabase: cleanup unittest
Use QLatin1StringView directly, instead of const char[].

Change-Id: Iae15b9f92d959efc6414ec8549b86560604dfb01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-11 12:39:56 +02:00
YAMAMOTO Atsushi
f80b0aee60 Add test function for private network
Add a function QHostAddress::isPrivateUse to test
for IPv4 private networks and IPv6 unique local unicast addresses.

Task-number: QTBUG-111211
Change-Id: Ic8abefa7aa974fa83118aeb9f2506a5713f79f0d
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-11 09:43:10 +09:00
Giuseppe D'Angelo
a25644aecf QVariant: fix comparisons between strings and integer 0
250ca8d5f8 changed the qConvertToNumber
to have a std::optional return instead of a boolean out-argument.

In doing so a code path that was supposed to report a failure (string
could not be converted to an integer) accidentally starting reporting
success (and converting the string to 0).

The problem is that the `ok` check from QString::toLongLong was
accidentally dropped in the refactoring; previously the function set
`ok` to false and returned 0, now the function just returns 0.

Instead, amend that return to return nullopt (because the conversion has
failed).

Change-Id: Iaedef5463f3ec500a97bd4c9bbddf977f66df61a
Pick-to: 6.5 6.5.0
Fixes: QTBUG-111867
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-10 21:55:17 +01:00
Ben Fletcher
d50f2fc1cc rhi: displacement / tessellation manual test Metal memory alignment
This test was created with a work around for a Metal tessellation
pipeline memory alignment issue.  The workaround was to specify shader
stage in / out variable uv as vec3 rather than vec2.  A recent patch to
correct Metal tessellation pipeline memory alignment has now allowed
this test to use vec2 for variable uv as originally intended.

Change-Id: I6772c0e824e1e4b7e749dafa218f3fd8eba0e541
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-10 12:21:56 -08:00
Amir Masoud Abdol
8bf46d7a21 Silence some conversion warnings
Change-Id: I3087bff60e77c0eaa5818a5405c97628ce7f6b79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-10 17:36:13 +01:00
Mårten Nordheim
fa4b7495b7 Fix overflow in SHA-3/Keccak
state->rate is always larger than or equal to state->bitsInQueue;
when bitsInQueue == rate the queue is consumed and bitsInQueue is set to
0 again.

Done-with: Marc Mutz <marc.mutz@qt.io>
Pick-to: 6.5.0 6.5 6.4.3 6.4 6.2 5.15
Change-Id: I56d268a19fb3cd542cc027edc962253f09d97a14
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-10 14:39:37 +00:00
Volker Hilsheimer
4f02973e2f Make it possible to use QObjectPrivate::connect in private code
In most QObjectPrivate-subclasses, the Q_DECLARE_PUBLIC macro is used in
the private segment of the class declaration. In that case, the q_ptr
becomes a private member of the private class, and then the
QObjectPrivate::connect function can no longer be used, as it needs to
access the d_ptr.

Fix this by declaring QObjectPrivate, and the static-assert-helper, as
friends of the class using the Q_DECLARE_PUBLIC macro.

Adapt the QObject test by moving the Q_DECLARE_PUBLIC macro into
the private section of the test-private, and add a compile test.

Pick-to: 6.5 6.5.0
Change-Id: Ifc04be3b305221e138b1e08bb3a3838d871f4fcb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-10 15:39:37 +01:00
Christian Ehrlicher
0bcb0062ba SQL/Tests: remove usage of 'foreach'
And fix coding style a little bit around the change.

Change-Id: Idfc232a751ccc08d0680351d48d4a68f09f18c1f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-09 19:57:42 +01:00
Volker Hilsheimer
5bd93821e5 Cleanup QPushButton auto test code
Fix coding style, replace QVERIFY(a == b) with QCOMPARE, use nullptr,
use a lambda for a local slot, and wait for the test widget to go away
so that it doesn't break following tests.

Change-Id: I1a4f790084b92301444a96a1449c84bf3317b88a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-03-09 19:57:42 +01:00
Marc Mutz
f7ea9b36b7 tst_QCryptographicHash: Extract Method ensureLargeData()
... to make large data usable from other test functions.

Pick-to: 6.5 6.5.0 6.4 6.4.3 6.2
Change-Id: I302070121a8bb49f373c7711bc3ab9e6418874ef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-09 18:27:00 +01:00
Laszlo Agocs
6626578036 rhi manual test: Bump Vulkan instance API version request
Do what Qt Quick would do.

Change-Id: I82743a39808601752f4ecbdb74b87f3a757a9310
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-09 18:27:00 +01:00
Giuseppe D'Angelo
7261a22987 QAbstractItemModel: fix match() with Qt::MatchWildcard
QAIM::match() supports different matching modes. The wildcard match mode
was never meant to be specifically a filepath globbing wildcard, but
rather a generic one -- something like "*" should match into a
string like "a/b/c". This is a regression from Qt 5, where
QRegExp::Wildcard was ported to only allow for path globbing
rather than generic matching.

[ChangeLog][QtCore][QAbstractItemModel] QAbstractItemModel::match()
now uses more generic wildcard matches rather than file path globbing.
Please refer to the documentation of
QRegularExpression::wildcardToRegularExpression() for more information
about the differences.

Change-Id: I28b8a76b01fdd9c5dd8f99528fac1c7b704564bc
Fixes: QTBUG-104585
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-09 18:26:59 +01:00
Giuseppe D'Angelo
057a3ddc17 QRegularExpression: extend wildcard tests
Test for non-anchored wildcards too.

Change-Id: I98cb47d76861d145bc409112981f52e246beb0a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-09 18:26:59 +01:00
Volker Hilsheimer
054fb061d7 Fix warnings from deprecating QFileOpenEvent::openFile, update snippet
Amends 76c63936d3 by adjusting the test case.
We still just test that we can open a file based on a filename that we came
up with ourselves.

Also, update usage documentation and make the snippet a bit more relevant.

Change-Id: I5bf00210d74e2a73d5a71a09a5beb1b3f6f8e225
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-09 17:15:53 +01:00
Mårten Nordheim
e5f295c8a4 QNetworkDiskCache: use QSaveFile
QTemporaryFile is not designed to promote temporary files
to non-temporary files. So, it, quite importantly, does not
care if the content of the files are flushed to disk before
renaming it into its 'final' destination. This is what
QSaveFile is for.

This was much more time-consuming than intended since I had to debug
this quirk about calling size().

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-111397
Change-Id: I15b300f6a5748ad3a0be983545ea621269a12ecd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-09 16:24:45 +01:00
Ben Fletcher
4201cdab18 rhi: Metal tessellation shader input output interface blocks
Add support for shader input output interface blocks in Metal
tessellation pipelines.  This feature is builtin to other rhi supported
tessellation backends (OpenGL/Vulkan).

Metal tessellation is implemented as compute pipelines for vert and
tesc, and a render pipeline for tese and frag.  The shader conversion
from GLSL is handled by SPIRV-Cross, which has a particular way of doing
things.  Rhi must setup the vertex inputs for the tese - frag render
pipeline to read from buffers written by the tesc compute pipeline,
following SPIRV-Cross conventions.  This includes ensuring correct
memory alignment per MSL Specification.

In order to enable input output interface blocks, reflection of struct
members of QShaderDescription::InOutVariable is required.  Reflection of
QShaderDescription::BuiltinVariable array dimensions is also required to
support variable size tese builtin input gl_ClipDistance.

An acompanying patch to QtShaderTools is required.

Change-Id: Id94e86caef211485afc187bb79fe3d0619d02cf0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-09 15:24:45 +00:00
Fabian Kosmale
17c9001a53 Fix QPropertyAlias::addNotifier
QPropertyAlias might be deprecated, but using it should still not fail
to compile.

Pick-to: 6.5
Fixes: QTBUG-111735
Change-Id: I486cddb424b60cd3e5c539e26afca3726e29bb09
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-03-09 16:24:45 +01:00
Volker Hilsheimer
9255820ad5 Handle tab order inception
If a composite widget is put behind one of it's contained children via
QWidget::setTabOrder, then our logic might replace the composite widget
with the contained child. In that case, we'd end up with a broken tab
chain, possibly resulting in incomplete clean-ups and triggering asserts
when shutting down the UI.

Handle this by stopping the last-child searching logic at the respective
other widget, and by not allowing both widgets to be the same.

Augment test case, and apply some minor refactoring to the code.

Pick-to: 6.5 6.2
Change-Id: I7d97dfa85315b6c01daa283253025d94a1727048
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-03-09 09:41:33 +01:00
Tor Arne Vestbø
f2fc2013de QErrorMessage: Reset 'again' check box between each error message
The choice of whether to show a message again is per message,
so when showing a new message we need to reset the check box
back to its default checked state, otherwise the user might
mistakenly dismiss more than the indented message.

[ChangeLog][Widgets] QErrorMessage will now reset the check
box for showing a message again for each new message shown,
as each individual message has its own suppression state.

Pick-to: 6.5 6.5.0
Change-Id: I86d4bb5eabdb5b7a478c03516108a5edf87fcbe3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-09 06:12:05 +01:00
Mårten Nordheim
1352e294d2 QTest: Rename QCOMPARE_XX parameters to add meaning
The parameter names were previously "lhs" and "rhs", which is incredibly
abstract for a testing framework. One of the parameters will tend to be
a baseline value to compare against while the other is the result of
some action we want to test. Thus I suggest they be renamed "computed"
and "baseline".

This way we can, hopefully, retain the semantic that the 'left'/first
argument is the computed ('actual' in QCOMPARE) value while the
'right'/second argument is the baseline ('expected' in QCOMPARE.)

Change-Id: I3e0fdce2a3f1faca06fdf7184ef6e0eb9724d990
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-03-08 15:10:21 +01:00
Giuseppe D'Angelo
4b197c3f52 QRegularExpression: add support for non-filepath wildcards/globbing
A glob pattern has different semantics depending on whether
it's used in "filepath mode" (FNM_PATHNAME) or not.
QRegularExpression only implemented the former, but the latter
is also useful, and possibly more "intuitive" for certain use
cases (e.g. offering users a simplified version of regexps that
however still need "*" to match a "/").

Add this support. The problems highlighted by QTBUG-111234 have
not been addressed, I've just amended a bit of documentation
relating backslashes.

[ChangeLog][QtCore][QRegularExpression] Support for non-filepath
wildcards has been added to wildcardToRegularExpression().

Fixes: QTBUG-110901
Task-number: QTBUG-104585
Task-number: QTBUG-111234
Change-Id: If9850616267980fa843bda996fcb4552b5375938
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-07 20:57:43 +01:00
Alexandru Croitor
b3a60e49cd CMake: Fix xmlstreamlint to use the manual test api
Amends e13b57d06a

Pick-to: 6.5.0 6.5
Fixes: QTBUG-111774
Task-number: QTBUG-110647
Change-Id: I585cdf20e2e60d4e11170a6e2131b7abc2b7eaf3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-07 17:39:00 +01:00
Laszlo Agocs
8e27e31649 Add workaround for threeDimTexture case failing with some drivers
Not relevant for the CI as that does not run with any real Vulkan
implementation. (and Lavapipe works if that's used)

As the investigation in the Jira issue shows, there is no proper
conclusion yet on why rendering to a slice of a 3D texture breaks
the content of other slices that have image data written to them
before that render pass targeting the slice. It would seem that
transitioning to COLOR_ATTACHMENT_OPTIMAL has some unexpected
consequences for slices that are not targeted by the render pass
with Mesa on Intel.

(NB rendering to a given 3D texture slice works via
VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; and how often this is needed
in practice is unclear, typical volume rendering cases will anyway
likely just upload data to the slices of a 3D texture, not rendering
to them)

The problem is still clearly visible in the tex3d manual test (when run
on affected Linux machines), this we keep unchanged for the time being
so that the issue can be examined further. However, the autotest is
changed to prevent the issue from occurring (render to slice first,
then upload to other slices) since it causes confusion when the test
is run locally on various developer machines.

Pick-to: 6.5
Task-number: QTBUG-111772
Change-Id: I4dc4c2413f8c518f377a33065992ad786a5ff44f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-03-07 16:48:32 +01:00
Laszlo Agocs
9c84036d4f rhi: Clean up 1D and 3D texture feature flags
Separate 1D mipmap generation support from rendering into an 1D texture.
Those are two independent features, so have a separate feature flag for
both instead of using just one.

This will then be symmetric with the 3D texture features, where now we
have a new flag to report support for generating mipmap for 3D textures.
(whereas 3D texture as a render target is already covered by
RenderTo3DTextureSlice)

Change-Id: Ie5e1f056a7d1c341d90cd7fc522877a3f2da3290
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-03-07 16:48:32 +01:00
Mikolaj Boc
79cc3ae201 Support filter list for file input when opening a file on WASM
The polyfill for file input on WASM now makes use of the supplied
filter list.
Some changes were introduced in the abstraction for filters so that
they are usable both for the new file API and the legacy file input.

Change-Id: Id6341be4d6a1647e17382d13da7be42491cfaf80
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-03-07 12:50:41 +01:00
Eirik Aavitsland
9273bcac7f Lancelot: fix a copy-paste error in the new drawPixmapFragment command
Caused crashes because of uninitialized variable

Pick-to: 6.5
Change-Id: I18f96e47b766415ad49e6a8515bbaa372b122cd3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-07 08:13:55 +01:00
Christian Ehrlicher
12909d7c3d QSqlDatabase: deprecate QSqlDatabase::exec()
The note that QSqlDatabase::exec() is deprecated was added more than 12
years ago so it's time to also mark the function as such.

Change-Id: Ic5e7c31b3ff5b21e16e2640548cba1a4baaeeb1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-06 23:14:49 +01:00
Volker Hilsheimer
386dcbf6b9 Silence warning about unsafe sprintf, use snprintf instead
Apple lets us know that:
  warning: 'sprintf' is deprecated: This function is provided for
  compatibility reasons only.  Due to security concerns inherent
  in the design of sprintf(3), it is highly recommended that you
  use snprintf(3) instead.

Pick-to: 6.5
Change-Id: I3130b3c7b636466b5e77adc5cb05ad4ce1faee11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-06 23:14:08 +01:00
Volker Hilsheimer
cacc53e427 Silence warning, initialize variables before using
Pick-to: 6.5
Change-Id: I0e7db95bac48b5d79897402f23157d00c4abbdff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-06 22:34:39 +01:00
Volker Hilsheimer
73f04faa07 Silence warning about deliberately using deprecated API
We test moc's support for [[deprecated]], so don't warn about it.

Pick-to: 6.5
Change-Id: Ifda2b81c14cb9802db4bb1d0a1eb17d978ad492a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-06 22:34:39 +01:00
Amir Masoud Abdol
93a378b295 Silence a few unused-but-set-parameter warnings in some of the tests
Change-Id: I8cf3e4764ae50011d691dec6f52a355ddfb0ce7b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-03-06 17:16:14 +01:00
Christian Ehrlicher
28d5da386f SQL/Tests: remove some unused functions
remove toHex() as it's not used at all and qTableName() with two params.
Also remove some SQLite 2 specific stuff

Change-Id: If285febdfbee5833f7174d70f386bd54674bd539
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-06 15:06:07 +01:00
Volker Hilsheimer
9e31631557 Doc: fix link to QTest::failOnWarning
Also fix incorrect failOnWarning*s* elsewhere in comments.

Pick-to: 6.5 6.5.0
Change-Id: I0bbc5e71060348153876f3d9a7c77c67f3c2e00d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-03-05 06:00:39 +01:00
Volker Hilsheimer
9ec61d4460 Port QPathClipper test away from home-grown QCOMPARE
Use a scope guard to print debug info in case of an early return.
Silences clang warning about sprintf being unsafe and deprecated.

Change-Id: Idcbfde1a6f2eb1143f51c1e5ecedbf3fe90d8ec8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-03-05 06:00:18 +01:00