Commit Graph

14016 Commits

Author SHA1 Message Date
Volker Hilsheimer
a2c7428e4d QGraphicsWidget: skip test if graphics view fails to show
We set Qt::X11BypassWindowManagerHint on the view, which regularly makes
the test fail on X11 systems in the

QVERIFY(QTest::qWaitForWindowActive(dummyView.data()))

check.

If the view fails to show, skip the test instead of failing, we are not
testing anything X11 specific here, running this test on other platforms
will be good enough.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-98921
Change-Id: I46dbcddf51ee1e92eb3bbb29bb57fcc314266bea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-14 15:55:30 +02:00
Volker Hilsheimer
a61bf508e3 QGraphicsProxyWidget: make tolerance for errors depend on DPI
The test already accepts an error margin for coordinate mapping. It is
still flaky, so make that margin larger if the DPI of the widget >1.

Pick-to: 6.4 6.3 6.2
Change-Id: I0a598e5e94ac82c551cbeb935e2fa08cad048f84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-14 15:24:43 +02:00
Eskil Abrahamsen Blomfeldt
ade2df4c4b Relayout QStaticText when dpi changes
If the cached font has a different DPI than the one used in
QPainter, we need to treat this the same as if other font
properties have changed and redo the layout.

This happened when running the QStaticText test on Wayland,
because the default dpi was 100 and the QPixmap we ended up
drawing to was 96. This caused the pixel size of the font to
be calculated differently when doing drawText() (using 96 dpi)
and drawStaticText() (using the cached 100 dpi).

Pick-to: 6.4
Fixes: QTBUG-100982
Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-14 14:09:33 +02:00
Eskil Abrahamsen Blomfeldt
9a45a01a2c Try re-enabling test on Wayland
Running this test on Wayland passes for me, so maybe something
has magically improved.

Change-Id: I161b697c5be96af48938228267cb405048c78852
Reviewed-by: Inho Lee <inho.lee@qt.io>
2022-07-14 07:35:33 +02:00
Morten Johan Sørvig
5548b940fb wasm: add echo_client_mainthread example
This example connects an echo server running behind
WebSockify, on localhost.

For example, start websockify with

    websockify 1515 localhost:1516

to accept a webscoket connection on 1515 and forward
to echo_server at 1516.

Pick-to: 6.4
Change-Id: Id71364e4ab8c46d3482b515fcd1b991b61d7404b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-14 01:10:56 +02:00
Volker Hilsheimer
d609b20842 QCompleter: make filesystem test robust against slow I/O
Use a signal spy to watch for the relevant signal from the file system
model and wait for that before checking whether the completer responded
to that signal by showing (or not showing) the popup.

If the file system model doesn't fire within the default timeout of 5
seconds, skip the rest of the test.

Fixes: QTBUG-46113
Pick-to: 6.4 6.3 6.2
Change-Id: I9becfe19a220bdb178ed8275c327d55ea19aa342
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-13 22:41:43 +02:00
Volker Hilsheimer
826a98cff1 QProcess: skip processesInMultipleThreads test on emulators
The test has timed out when run on ARM in qemu. We start more threads
than the ideal count, which is likely too much for the emulator when not
running the native architecture.

Pick-to: 6.4
Change-Id: I42e11945070646551e77c10618df762a4bffc8ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-13 21:02:01 +02:00
Ivan Solovev
12262adeba Do not use QExposedEvent::region() in internal code
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 16:45:00 +02:00
Volker Hilsheimer
92e696b4ba Use debug stream in QTest::toString's default fallback if possible
For built-in types, this is a compile-time assert - we should not have
any types in Qt for which we have neither debug streaming nor a
QTest::toString specialization implemented. A build of most of Qt
submodules passes with this change, after minor modifications to some
tests. We cannot declare QSizeHint::Policy as a metatype after the
QMetaType has already been instantiated for it, and the QDebug stream
operator for QElaspedTimer needs to be correctly declared within the
namespace.

Add a self-test function for a custom type, and update reference files
of the self-test.

Task-number: QTBUG-104867
Pick-to: 6.4
Change-Id: I2936db5933f4589fce45f47cf2f3224ed614d8c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-13 15:14:35 +02:00
Eskil Abrahamsen Blomfeldt
3fee97c4ab Skip test which depends on window activations on Wayland
Wayland does not support window activation, so rather than skipping
tests based on platform name, we can use the platform capability
(which will also cover future platforms with the same issue)

Pick-to: 6.4
Task-number: QTBUG-104241
Change-Id: Ibf5f8968f3979b789ef68f92768419bef4500fb3
Reviewed-by: Inho Lee <inho.lee@qt.io>
2022-07-13 14:35:03 +02:00
Shawn Rutledge
8d9301b413 Add QInputDevice::name() to output in device_information manual test
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104878
Change-Id: I4299228c90777d71f01c3e2607f8ad4af6e081ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 14:35:02 +02:00
Fabian Kosmale
268ff00ef5 QThread: Initialize bindingStatus for adopted threads
If we create a QThread from QThread::current(), we want it to have a
correct value for its bindingStatus. Thus, initialize bindingStatus in
the ctor of QAdoptedThread.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Pick-to: 6.4 6.3
Change-Id: I3ef27ed62c5dc25eed05d551c72743a1b8528318
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 12:51:59 +02:00
Morten Johan Sørvig
7e0711e0c0 wasm: secondary thread blocking sockets example
Connects to echo_server via websockify, like the async version.

Pick-to: 6.4
Change-Id: I9ed560cd388cfddbd0d284d8d40fb7ddf964ba96
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-13 09:29:28 +02:00
Volker Hilsheimer
0dadb951b5 qobjectrace test: Don't hardcode the number of threads
Use QThread::idealThreadCount instead. This requires that we use
QVarLengthArray, as MSVC doesn't allow us to allocate arrays with a
non-constexpr size on the stack.

By using as many threads as the system has cores, we are more likely
to detect race conditions reliably. On systems with fewer cores (in
particular on qemu platforms like QNX, where this test has been
failing a lot), we'll less likely end up with false negatives due
to timeouts.

Pick-to: 6.4 6.3 6.2
Change-Id: Ie8631aef544ca7b53c06a0729d05459016745486
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 17:16:37 +02:00
Laszlo Agocs
7de0f3e9cc rhi: Clean up some inconsistencies
Some of the offsets are already quint32 in the API (vertex input
attributes, dynamic offsets, offsets in draw calls), matching the
reality of the underlying 3D APIs, but many buffer-related functions
use int as of now, simply because that used to be the default choice,
and the same goes for sizes (such as buffer or range sizes). This is
not quite consistent and should be cleaned up if for nothing else then
just to make the classes consistent, but also because no 3D API use a
signed type for offsets, sizes, and strides. (except OpenGL for some)

When it comes to strides (for vertex inputs and raw image texture
uploads), those are already all quint32s. This is straightforward
because most of the 3D APIs use 32-bit uints for these regardless of
the architecture.

Sizes and offsets are often architecture-dependent (Vulkan, Metal),
but there is at least one API where they are always 32-bit even on
64-bit Windows (UINT == unsigned int, D3D11). In addition, we do not
really care about buffer or texture data larger than 4 GB, at least
not without realistic use cases and real world testing, which are
quite unlikely to materialize for now (esp. since we still have the
width/height of 2D textures limited to 16 or 32K in many cases even on
desktops, whereas 2GB+ buffers are not guaranteed in practice even
when an API seemingly allows it).

In any case, the important change here is the signed->unsigned
switch. A number of casts can now be removed here and there in the
backends, because the offsets and sizes are now unsigned as well,
matching the underlying API reality. The size can be potentially
increased later on with minimal effort, if that becomes necessary for
some reason.

Change-Id: I404dbc365ac397eaeeb3bd2da9ce7eb98916da5f
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-07-12 17:16:37 +02:00
Volker Hilsheimer
7b6350fa77 QJniObject: Add template overloads for get/setStaticField
Allow specifying the Java class on which to set/get the field via its
corresponding C++ type, removing the need to explicitly provide the
Java type string.

Those were missing from a085a14d76, which
was noticed when porting QtConnectivity over to the new template APIs.

Pick-to: 6.4
Change-Id: I8f324c9fcc486b4c6c2f2b9051f7eca0cbec0e91
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-07-12 13:25:04 +02:00
Øystein Heskestad
1c563035c7 Disable unit testing setting up QTcpServer on special Apple interfaces
The iBridge interface is used for the keyboard touch bar, and the Apple
Wireless Direct Link interfaces are used by Apple for various purposes.
Setting up a server on these interfaces does not work.
Only the tst_QTcpServer::linkLocal unit test on macOS is affected by
this change.

Fixes: QTBUG-103892
Change-Id: I29701ce51d5e40dff6c59547a8639c1fba330d36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 13:24:57 +02:00
Mikolaj Boc
fd45278eaa Specialize MetaObjectForType for non-pointer QObject-derived types
QMetaTypeInterfaceWrapper tries to find the metaObjectFunction using
the MetaObjectForType template. Using SFINAE, for a QObject, it should
resolve to a suitable specialization.

Such a specialization doesn't yet exist. It had to be created.

The following path returns nullptr for registered meta types:

  auto metatype = QMetaType(typeId);
  requestedTestType.metaObject() -> returns nullptr since a bad template
  argument is fed to MetaObjectForType<T> in
  QMetaTypeInterfaceWrapper<IneritingFromQObject>::metaType's static initializer.

Change-Id: I8b31c51e12cb19c333e00480b0177354b910ce1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 13:24:57 +02:00
Sona Kurazyan
5e8cc498a1 QDomDocument: add a missing full-stop to a warning message
Change-Id: I3c44afa466cbcb12fc0b44ad8bd1b52ded5f4ddd
Pick-to: 6.4 6.3 6.2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-12 13:24:57 +02:00
Sona Kurazyan
6bc227a06a Port QXmlStremReader to QAnyStringView
Port the constructor and addData() method to QAnyStringView, but keep
the overloads taking a QByteArray to avoid extra copies when actual
QByteArray is passed. These overlaods need to be Q_WEAK_OVERLOADs, to
avoid ambiguities (e.g. for const char * arguments).

Additionally, add a test to make sure the patch doesn't break parsing
from a QLatin1StringView input.

[ChangeLog][QtCore][QXmlStremReader] Added constructor and addData()
overloads taking QAnyStringView.

Change-Id: I0efaab82a2123271c88407e380f3c67d1099a4a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-12 13:24:56 +02:00
David Skoland
281d915ba4 Add wasm exception for tst_qchar
Since wasm doesn't like filesystems that well, we omit this test in
tst_qchar for wasm, this allows us to still run the test without the
case where it needs to read the normalization file.

Change-Id: I37e54d97e119f94e1a9ca53917d0b93183321899
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-11 17:21:27 +02:00
Shawn Rutledge
092ef06e00 Fix directory listing in manual filetest; add recursive find
- QFileInfo::fileName() is not the name of a directory, so we need
  absoluteFilePath() to construct a QDir
- QDir::entryList() returns only the name suffix, not the whole path
- stop at any arbitrary depth, and add a find command which does full
  recursion

Amends 04a5a74685

Change-Id: I9870db092125a797e8b654e98954ac611dde1ab2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-11 14:42:27 +02:00
Giuseppe D'Angelo
6f852935e0 QString: fix lifetime issues with QRegularExpression APIs
QString has several functions taking a QRegularExpression: indexOf(),
contains(), and so on. Some of those have an out-argument of type
QRegularExpressionMatch, to report the details of the match (if any).
For instance:

  QRegularExpression re(...);
  QRegularExpressionMatch match;

  if (string.contains(re, &match))
    use(match);

The code used to route the implementation of these functions through
QStringView (which has the very same functions). This however opens
up a lifetime problem with temporary strings:

  if (getString().contains(re, &match))
    use(match); // match is dangling

Here `match` is dangling because it is referencing data into the
destroyed temporary -- nothing is keeping the string alive. This is
against the rules we've decided for Qt, and it's also asymmetric with
the corresponding code that uses QRegularExpression directly instead:

  match = re.match(getString());
  if (match.hasMatch())
    use(match); // not dangling

... although we've documented not to do this. (In light of the decision
we've made w.r.t. temporaries, the documentation is wrong anyways.)
Here QRE takes a copy of the string and stores it in the match object,
thus keeping it alive.

Hence, extend the implementation of the QString functions to keep a
(shallow) copy of the string. To keep the code shared as much as
possible with QStringView, in theory one could have a function taking a
std::variant<QString, QStringView> and that uses the currently active
member. However I've found that std::variant here creates some abysmal
codegen, so instead I went for a simpler approach -- pass a QStringView
and an optional pointer to a QString. Use the latter if it's loaded.

QStringView has some inline code that calls into exported functions, so
I can't change the signature of them without breaking BC; I'm instead
adding new unexported functions and a Qt 7 note to unify them.

Change-Id: I7c65885a84069d0fbb902dcc96ddff543ca84562
Fixes: QTBUG-103940
Pick-to: 6.2 6.3 6.4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-10 23:40:24 +02:00
Volker Hilsheimer
54b276be0b testlib: Don't print QCOMPARE values if they lack string representation
Before 0681a2dd5a, QCOMPARE'ing types
for which no QTest::toString specialization exists did not output
Actual and Expected lines on failure, as that would only print <null>
for both values (which then look like the same value, confusingly).

Commit 0681a2dd5a changed that behavior,
and started printing the confusing <null> values.

Take care of the logic in the formatFailMessage function: if both values
are nullptr, then print only the variable names, but not the confusing
<null> text representation of the values.

Remove dead and duplicated code related to the formatting logic, add a
self-test function, and update the expected_cmptest files.

Fixes: QTBUG-104867
Pick-to: 6.4
Change-Id: I4be98e79f91196b14690a2cc0a68ffd50b431a45
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-10 03:08:32 +00:00
Laszlo Papp
1ea0d399b3 QKeySequenceEdit: Add a finishing key combinations property
Different shortcut editors seem to have different preferences. By
default, QWidget seems to utilise Tab, Backtab, Return and Enter for
navigation purposes. However, some shortcut editors would like to be
able to record these keys as part of combinations to use in the
application.

Therefore, leave it with the application developers to decide what key
combinations they would like to use for finishing the key sequence edit.
This should provide enough flexibility for application developers to
customize their shortcut editor behavior.

[ChangeLog][QtWidgets][QKeySequenceEdit] Added a property to allow
defining the finishing key combinations.

Fixes: QTBUG-103844
Fixes: QTBUG-103843
Change-Id: Id84644086ca7a4f11618d510e59698a43735b99b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-09 11:23:49 +00:00
Marc Mutz
2cfabed1ff Long live QDebug op<< QMetaType!
It's needed in QtHttpServer.

[ChangeLog][QtCore][QDebug] Can now stream QMetaType.

[ChangeLog][QtCore][QMetaType] Can now be streamed through QDebug.

Change-Id: I974d77d678137715472a3907ab1e50ba2dbaa087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-09 06:40:08 +02:00
JiDe Zhang
1d961491d8 Always update QPalette resolve mask, regardless of QBrush change
56bd1b76d2 changed the update
resolve mask behavior in QPalette to avoid detaching brush data
when modifying the resolve mask if the brush value is not changed.

But this behavior broke compatibility, it introduced unknown risks, and
we cannot ensure that other code in Qt does not depend on the old
behavior.

We both need to ensure that we don't detach when the value is not
changed, and ensure that the resolveMask is always updated regardless
of whether the value changes, so we need to split them up and
independently share the brush data.

QFont will update its corresponding resolveMask even if the value has
not changed, so it is better to correct this behavior so that QPalette
and QFont are consistent.

[ChangeLog][QtGui][QPalette] Always update resolve mask in
QPalette::setBrush, even if the value of brush has not changed.

Fixes: QTBUG-98762
Pick-to: 6.4 6.3 6.2
Change-Id: Ib845361b30f21c3d78c16ced923c1678b12e05ac
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-08 17:09:04 +00:00
Richard Moe Gustavsen
e44edaac2c QWidget: use WA_InputMethodEnabled when ImEnabled is not implemented
In Qt 6.3, a check for WA_InputMethodEnabled was removed
in QWidget, to support IM queries also for read-only
widgets (7c6e4af48). This caused a regression on iOS, which
made the input panel open for widgets that didn't support
IM at all.

A patch was merged that solved the regression (3b12305575),
but it didn't take the widget attribute into account.
Since not doing so has the potential to cause regressions,
this patch will modify the affected code once more, so that
we instead fall back to test WA_InputMethodEnabled when
ImEnabled is not implemented. This will match closely
to the way ImEnabled was implemented in Qt 6.2.

Since we, with this change, now require that either ImEnabled
or WA_InputMethodEnabled is set, our own input widgets will
fail to support IM text selection when they're read-only, since
they actually don't implement ImEnabled.
This patch will therefore also make sure that we do so.

Task-number: QTBUG-104527
Pick-to: 6.4 6.3
Change-Id: I70ad910aec38d0a74f4dd7d3115d3c45c16d2b3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-08 09:41:29 +02:00
Ulf Hermann
66a30b9a33 moc: Allow writing properties through bindables
BINDABLE should generally behave the same as MEMBER if "WRITE default",
except where it cannot. In particular we cannot know if any NOTIFY
signal should be sent from the synthetic WRITE accessor.

[ChangeLog][QtCore] moc will now synthesize WRITE accessors for
properties with BINDABLE if you specify "WRITE default".

Task-number: QTBUG-97249
Change-Id: I883c40ba0dda7989c840971860addaeaa75a8c83
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-08 09:38:27 +02:00
hjk
6619c94087 rcc: Suppress clang's -Wexit-time-destructors
It's an opt-in warning that some people like to use. It was introduced
to clang 3.0.0 in 2011 by

   98766db785

However, the feature is intentionally used here and the generated code is legit.

Make both sides happy.

Change-Id: I79335cd3a6a6cc128fa65f77d201a12f67424260
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-07 17:53:23 +02:00
Laszlo Agocs
c9d1d4c33c rhi: Fix a manual test
...that uses the old name after a recent change in the
name of a function.

Change-Id: Ife36fbb0c5d28b350cb1cfc48625528a205af8f9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-07-07 16:07:18 +02:00
Morten Sørvig
4cc84dc31c Revert "Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS"
Unblock the qtdeclarative dependency update.

This behavior change is causing a regression for QQmlPreviewHandler's
zoom feature. Back out of the change for now, until we can find a way
to make both use cases work.

This reverts commit 1c0a56a2f3.

Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-07 14:47:14 +02:00
Juha Vuolle
c5caab1f15 Add support for scoped JNI callbacks
This commit adds macros for declaring scoped native callbacks which are
in namespace or for example defined as static class member variables.

The existing macros don't allow this as they use QtJniMethods namespace
and the introduced callbacks' namespaces are not enclosed in that
namespace, yielding a compilation error.

Pick-to: 6.4
Change-Id: I754560bea7e9a1b57c2661d1ee7236e78db39ba1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-07 13:35:08 +03:00
Mate Barany
cc70757964 qdbusxml2cpp: allow choosing <> over ""
qdbusxml2cpp's -i option uses "" for the includes.
However, an option to include with <> would be also
desirable, since some compilers may use a different
search strategy for <> than for "".

Add a new command line option -I/--global-include
to include the given argument using <>.

The new option will be used in qtconnectivity.

[ChangeLog][qdbusxml2cpp] Added command line option
-I/--global-include to include header files with <> in
the generated files.

Fixes: QTBUG-103362
Change-Id: If8e7f8b86440bdec53f2517db1ad460912664b20
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-07-07 07:44:16 +00:00
Mikolaj Boc
fb8832de9c Make the promises js-less using a newly introduced thunk pool
Since we cannot rely on the clients specifying a suitable CSP that will
not forbid execution of js injections, we have to refrain from using
any explicit <script> elements. To keep the promise system working, a
thunk pool was introduced which keeps track of a limited pool of promise
callback exports. In case the resources are busy, pending calls are
enqueued. This works since the JS Promise.then/catch/finally always fire,
even on ready/failed promises.
As the situation of full thunk pool allocation is unlikely to happen
en masse IRL, the solution should not adversely affect the performance.
Heavy unit tests were created to confirm the solution works as expected.

Task-number: QTBUG-99611
Change-Id: I0e6982d4ee76a4263b59e72b004b3ff2f167e4df
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-07 06:28:13 +02:00
Sona Kurazyan
6ad481c31f Revert "QFutureCallOutEvent: de-export again"
QFutureCallOutEvent is used externally, so it needs to be exported.

This reverts commit 3141a13b2a.

Fixes: QTBUG-104732
Pick-to: 6.4
Change-Id: I82c9e7414192ee948f78259bd74a404691a7805a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-07-06 18:41:31 +02:00
Morten Sørvig
1c0a56a2f3 Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS
QT_SCREEN_SCALE_FACTORS in many cases set on behalf of the user,
instead of by the user, so we should make it less sharp and more
in line with standard high-dpi configuration.

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.

Pick-to: 6.4
Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: Ibb0aa5cb9d3a356d33429d0efe69d984b2530728
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-06 15:56:58 +00:00
Morten Sørvig
bc6dea891e High-dpi: Add test for setting the scale factor rounding policy
Test setting both via QGuiApplication property and environment.

Change-Id: Iaccc920adb6294d610b02d4c844aa5b15eb7eecd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-06 17:56:58 +02:00
Morten Sørvig
9be0f2945d wasm: begin work on accessibility backend
Implement a11y support by adding html elements of the
appropriate type and/or with the appropriate ARIA attribute
behind the canvas.

Also add a simple manual-test.

Change-Id: I2898fb038c1d326135a1341cdee323bc964420bb
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-06 17:56:58 +02:00
Marc Mutz
0587d4752d Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTED
It's always true these days, assert so in qatomic.cpp and
tst_QAtomicInteger.

Update the docs.

Pick-to: 6.4
Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-06 17:56:58 +02:00
Marc Mutz
0231971b3e tst_QGraphicsScene: fix -Wsuggest-override
Add the override keyword.

Amends 2e12479e06.

Pick-to: 6.4 6.3 6.2
Change-Id: Ic62dd33b1ee52983481e39e862b9bd87695f5044
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-06 17:56:57 +02:00
Mikolaj Boc
3c07f12415 Port promise tests to qtwasmtestlib
The promise tests have been ported to qtwasmtestlib so that they do not
have to use asyncify anymore.

Task-number: QTBUG-99611
Change-Id: Id1b5742c90e36a89540e7a2387cb4110c21ace9b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-06 17:56:57 +02:00
Mikolaj Boc
a50590370f Create the Qt File Filter => showOpen/SaveFilePicker options mapper
As a preparatory measure for using showXFilePicker, the Qt file
filter has to be transformed to the format used by the showXFilePicker
(sXFP) options. A class structure reflecting the options was created. Based on
an input in the form of a qt file filter, it will parse the filter to
the sXFP options format. Unit tests were added and the code is not yet
used in non-test env, next change will use it.

Task-number: QTBUG-99611
Change-Id: I277286467a7b5ce6f323c19bdd31740a41b6a6be
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-05 22:22:54 +02:00
Mikolaj Boc
3ca167a30e Enhance the qtwasmtestlib with comparison functions and status reporting
Added the functionality to report text statuses from tests, reporting
file and line of assertion failures. Refactored the qtwasmtestlib.js
for improved stability.

Task-number: QTBUG-99611
Change-Id: I717e0cc38ac7f155fe870710f6b5e4bfb81b9317
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-05 21:18:30 +02:00
Timur Pocheptsov
7949dab8ab tst_QSslKey: prepare for the migration to OpenSSL v3
Many algorithms (ciphers etc.) had become 'legacy' in OpenSSL v3,
meaning they are not available by default. Since we don't mess with
loading providers and don't load the 'legacy' one, we have to
skip tests involving such algorithms.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-104232
Change-Id: Ieceabeb080e531aeb24f733cb8c83ad08a25049c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-05 17:36:03 +02:00
Tang Haixiang
551127209e QListview: PageDown/Up infinite loop
When item.height > viewport.height, the next item is not found
correctly, resulting in an infinite loop.

In this case, move directly to the next item.

Pick-to: 6.4 6.3 6.2
Change-Id: I67a40a079ca9dd9189bf84ae550758c685b83d75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-05 11:55:19 +00:00
Tang Haixiang
c2a63b4014 tst_qwindow: modify some abnormal touch tests
Under normal circumstances, when the second point is touched, the
first point has not been released, and the message at this time
should contain two touch points. We are simulating the case where
the message is lost when the popup is closed by touch. Amends
efc02f9cc3

Pick-to: 6.4 6.3 6.2
Change-Id: Ic722e3dbd615c46076ede26611d0107501c5e274
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-05 13:55:19 +02:00
Laszlo Agocs
6ec339c484 rhi: Keep track of pipeline creation times
Make our QRhiMemAllocStats struct a bit more generic, drop the memory
allocation part in the naming, and use the same getter and struct for
reporting some important timings. (we are free to rename for now, there
are no users in other modules yet)

The time spent in graphics (or compute) pipeline creation has a special
relevance in particular with the modern APIs (as it is the single
biggest potentially time consuming blocking operation), but also highly
interesting with others like D3D11 simply because that's where we do the
expensive source-to-intermediate compilation is HLSL source is provided.
In order to see the effects of the various caching mechanisms (of which
there can be confusingly many, on multiple levels), the ability to see
how much time we spent on pipeline creation e.g. until we render the
first view of an application can be pretty essential.

Task-number: QTBUG-103802
Change-Id: I85dd056a39db7e6b25fb1f9d02e4c94298d22b41
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-07-05 13:04:09 +02:00
Laszlo Agocs
a09e518f65 rhi: Make it possible to query the backend name beforehand
The goal is to make it possible to implement QSGRhiSupport::backendName()
in Qt Quick with just a single line:

return QString::fromUtf8(QRhi::backendName(m_rhiBackend));

instead of duplicating the strings and the logic.

Similarly, QBackingStoreRhiSupport can now drop its apiName() helper
entirely.

Change-Id: Ia8cbb1f1243539ed4d7a98e71dcc2ed56b017e40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-07-05 13:04:09 +02:00
Juha Vuolle
58fd12a487 Add support for naming JNI functions with the unstringify macro
The manually defined native JNI function tables allow defining a name
that may be different from the actual function name; this name is then
used from the Java-side.

This can be useful to provide also as an option with the new
"unstringifying" macros which can help for example in porting code
to these new macros.

Pick-to: 6.4
Change-Id: Icfebfb351cb8dfb122795d20b37e2eac167a41bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-05 11:50:25 +03:00