Commit Graph

13809 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Edward Welbourne
58f5ec35f1 Doc fix in QIntValidator::validate() and comment on a test
The doc said positive values for a negative range were intermediate
but the code actually rejects them if the value has an overt plus
sign, so make clear that intermediate is only for the case without a
sign. Incidentally comment on a test where it might not have been
obvious to the reader that a space is the locale's digit-grouping
chracter.

Pick-to: 6.5 6.5.0
Change-Id: I3edab74fe8c2cbe8448c0e523676f1fd0d0d8a9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 23:19:23 +00:00
Ahmad Samir
2a495c2596 QTestEventLoop: add enterLoop(std::chrono::milliseconds) overload
Task-number: QTBUG-110059
Change-Id: Ibf1d76afd313e390103be4a22e44af7fb41ace1b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 21:36:48 +02:00
Ahmad Samir
855a6cb676 Use utimensat instead of utimes
From the manual page:
Note: modern applications may prefer to use the interfaces
described in utimensat(2).

Change-Id: Ib20d8b9b50626233852ca351452ce90841a39603
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 21:36:01 +02:00
Marc Mutz
fd17eaca83 tst_QVariant: check fromValue() with a non-default-constructible type
... by just using fromValue() instead of the QVariant(QMetaType,
void*) ctor.

Code coverage isn't reduced, because fromValue() will, of course, call
that exact ctor itself.

Amends df0085d3a2.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-105140
Task-number: QTBUG-111598
Change-Id: I02464803090fa7078947625616e6fc20e623ef31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 20:05:27 +01:00
Liang Qi
cd0301a78e tests: skip tst_QScreen::grabWindow() on XWayland
Pick-to: 6.5
Task-number: QTBUG-104595
Change-Id: Icb56a587dfbad84533616160817a3d43411146f1
Reviewed-by: Kalle Viironen <kalle.viironen@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
2023-03-02 15:58:37 +01:00
Christian Ehrlicher
2adb22fba5 tst_QSqlDatabase: avoid some runtime warnings
Make sure to properly close the cloned database connections and allow
one test for sqlite

Change-Id: Ia4eb4a684a3c432844e4b2a77bff69655b53f9b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-02 15:02:02 +01:00
Marc Mutz
52c7f699ac QDebug: fix std::string/view stream operators; add u8 versions
Make them templates, for two reasons:

- so they can accept std::pmr types and, in general, any basic_string
  with custom allocators and char_traits

- to break overload ambiguities with the Qt string view types

Also, add the missing C++20 char8_t overloads.

Also, avoid creation of a QString in the sizeof(wchar_t) == 2 case
(Windows). Add a comment to optimize for the sizeof(wchar_t) != 2 case
later.

Found in API review.

Pick-to: 6.5
Change-Id: I30139520f582a38863a0936f8eca4b1ed33e37c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-02 06:33:35 +01:00
Jan Arve Sæther
a84b2e5973 Move Weather Anchor Layout example to manual tests
Pick-to: 6.5
Change-Id: I8782a83b5c12b4f57bf9ef9063818cb124bddd56
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-03-02 05:55:57 +01:00
Harald Sitter
5317ff74fd a11y: even checkable buttons are pressable
otherwise there is no way to synthesize a "click" through the a11y API.
toggleAction only leads to a toggled() signal but the user may be more
discerning and only listen to clicked() (or QAction::triggered) to react
to **user** events not all toggle events. as such pressAction is always
superior to toggleAction when user input is meant to be synthesized
through a11y tooling.

Change-Id: I7f024d57087b545d3cfd1805026ea538b0b3e166
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-03-01 22:05:23 +01:00
Marc Mutz
b8966021ff tst_QMutex: use constexpr variables instead of 'enum-trick'
C++20 doesn't like arithmetic with enums anymore. While this hasn't
caused immediate pain, yet, fix it pro-actively for an imminent patch.

As a drive-by, fix the missing space at start of comment.

Pick-to: 6.5 6.4 6.4.3 6.2
Change-Id: Id08bb227c587bc7b900c593a7b6d2655ca32eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-01 19:14:39 +01:00
Marc Mutz
e7c792ba71 tst_qvarlengtharray: add test for QVLA(n) ctor
Also add one for types that are neither copy- nor move-constructible.
In contrast to resize(n), the QVLA(n) ctor worked for such types, so
make sure it stays that way.

Pick-to: 6.5 6.4 6.4.3 6.2 5.15
Change-Id: If54fbc9dd6a4808175c4bcb0ffb492b33c879746
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-01 18:14:39 +00:00
Marc Mutz
6990f23813 Long live QMessageAuthenticationCode::resultView()!
Use it in a few places.

[ChangeLog][QtCore][QMessageAuthenticationCode] Added
QCryptographicHash-style resultView().

Change-Id: I745d71f86f9c19c9a9aabb2021c6617775dab1cf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-01 17:20:41 +01:00
Thiago Macieira
5f32c9edce tst_QTimer: suppress the cross-thread timer stopping warnings
Both QTimer's and QObjectPrivate's destructors print a warning if the
current object lives on another thread and has an active timer:

QWARN  : tst_QTimer::moveToThread() QObject::killTimer: Timers cannot be stopped from another thread
QWARN  : tst_QTimer::moveToThread() QObject::~QObject: Timers cannot be stopped from another thread

This timer is used to ask the thread to quit, which in turn allows us to
destroy this QObject without a cross-thread warning. Because it's
already fired once and done its duty, we can make sure it's not active
by simply making it single-shot.

Pick-to: 6.4 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17465067b27c044b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-02-28 20:19:52 +00:00
Volker Hilsheimer
3f2d02e2f4 QAbtractItemView: deselect before click opens editor
A click on the selected item should deselect all other items before
editing starts.

Remove the part of the test case that assumes that we can have multiple
items selected in ExtendedSelection mode, and click on an item to start
editing while maintaining selection. That can never happen.

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-111131
Change-Id: I0312eed4614502cfb77eca26d3f7615427493d7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-02-28 17:19:24 +00:00
Jan Arve Sæther
afbfe30093 a11y: Test and document relations better
The documentation for the RelationFlag enum was not very clear on what
was the "first" and "second" object.
And the fact that the AT-SPI backend (which these enum values originates
from) inverses "first" and "second" makes it harder to understand what
how it all fits together.

So when (with this change) Qt documents 'QAccessible::Labelled' as
    "The returned object is labelled by the origin object"

AT-SPI documents ATSPI_RELATION_LABELLED_BY as:
    "The origin object is labelled by the returned object"
(Documentation for AT-SPI is rewritten so that it shares the same
terminology)

Notice that the two objects are exchanged, which means that even if they
use the same 'Labelled' relation, the semantic gets 'inversed'.

This is already the case today, so we cannot change it. Therefore, to be
clear, the relation mapping will remain to be like this:

Qt Relation     | Maps to AT-SPI                | Qt explanation
----------------+-------------------------------+--------------------------------------------------------------------------------
Label           | ATSPI_RELATION_LABELLED_BY    | The returned object is a Label for the origin object
Labelled        | ATSPI_RELATION_LABEL_FOR      | The returned object is Labelled by the origin object

Controller      | ATSPI_RELATION_CONTROLLED_BY  | The returned object is the Controller for the origin object
Controlled      | ATSPI_RELATION_CONTROLLER_FOR | The returned object is Controlled by the origin object

This mapping can already be seen in qAccessibleRelationToAtSpiRelation()

For the record, these future relations should then be mapped to like
this:

Qt Relation     | Maps to AT-SPI                | Qt explanation
----------------+-------------------------------+--------------------------------------------------------------------------------
Described       | ATSPI_RELATION_DESCRIPTION_FOR| The returned object is described by the origin object
DescriptionFor  | ATSPI_RELATION_DESCRIBED_BY   | The returned object provides a description for the origin object

FlowsTo         | ATSPI_RELATION_FLOWS_FROM     | The returned object has content which flows logically to the origin object
FlowsFrom       | ATSPI_RELATION_FLOWS_TO       | The returned object has content which flows logically from the origin object

Change-Id: Ib245ec95564e4886dc6dbbb68abec2b23cd0e534
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-28 17:53:10 +01:00
Ben Fletcher
9ffa16baf0 rhi: Add support for half precision vertex atttributes
Runtime support is indicated via QRhi::Feature::HalfAttributes.

OpenGL support is available in OpenGL 3.0+, OpenGL ES 3.0+, and in
implementations that support the extension GL_ARB_half_float_vertex.

Other RHI backends (Vulkan, Metal, D3D11, and D3D12) all support this
feature.

Note that D3D does not support the half3 type.  D3D backends pass half3
as half4.

tst_qrhi auto unit test included.

Change-Id: Ide05d7f62f6102ad5cae1b3681fdda98d52bca31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-02-27 09:23:05 -08:00
Volker Hilsheimer
f75b29fbbd QListView: Reset style after using a temporary proxy
Amends 0242be9060, and removes unwanted
side effect of having a modified style behavior for later functions.

Pick-to: 6.5 6.4 6.2
Change-Id: If3dff0d7ab9e6c6c10e7a92d0a3eaff98fa1457f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-02-27 10:10:04 +01:00
Marc Mutz
a62aa18178 tst_QMessageAuthenticationCode: check that setKey() reset()s
It's documented as such.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I7299d289117e52dcefe3c4ab917d7ecad6dd02be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-26 07:51:29 +01:00
Ahmad Samir
caa21ffc65 tst_benchlibcallgrind: silence a compiler warning
Change-Id: I68cc530fa8eaf941a6ddb7e6987ff37ec270bc4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-26 03:14:46 +02:00
Marc Mutz
0411d98192 QCryptographicHash: auto-calculate MaxHashLength
Add Algorithm::NumAlgorithms and use it to iterate over all
statically-available algorithms, querying their hashLengthInternal().

This avoids having to statically_assert(<= MaxHashLength) everywhere,
and auto-adjusts the buffer size in SHA1_ONLY builds.

Yes, the extra case labels for NumAlgorithms are a nuisance, but at
least the compiler will remind us when we forget, unlike a missing
static_cast(<= MaxHashLength) that might easily be forgotten.

Adjust the test (which iterates over the QMetaEnum for
QCryptographicHash::Algorithm, so finds NumAlgorithms and tries to
pass it to the hash() function which responds with a
Q_UNREACHABLE(). Only test hashLength() == 0 for that enum value.

Pick-to: 6.5
Change-Id: I70155d2460464f0b2094e136eb6bea185effc9d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-25 16:50:03 +01:00
Edward Welbourne
cb54da2366 Support Cyrillic's equivalent of 'E' as exponent separator
Only Ukrainian is actually recorded in CLDR as using U+0415 as
exponent separator; all other Cyrillic-using locales officially use
plain ASCII 'E'. However, it seems reasonable, in all Cyrillic
locales, to recognize both (given that they look very similar).

Task-number: QTBUG-107801
Change-Id: I70a1e60a2d9fe7e254e01d32c5bad909ea4b8c76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-02-24 13:37:07 +01:00