Commit Graph

56680 Commits

Author SHA1 Message Date
Edward Welbourne
3dcf1779be tst_QUrlQuery: improve formatting of lists of pairs of strings
The compare() implementation made its actual and expected seem to have
different types (using a typedef name for one, when the other was of
the type that expands to) and the formatter it used was needlessly
clunky. Use modern string literals and package a repeated
null-or-quoted representation as a lambda, inline the resulting
simplified prettyElement() into prettyPair(), which can now just take
a pair rather than an iterator. Short-cut the empty list so that the
comma-joined accumulation could initialize with the first entry and
loop over the rest, always joining with a comma.

Undo commit f776595cc10aaafc7162f382a8fa11afffb0e708's mistaken update
to the copyright header and update correctly.

Change-Id: I99258dafa01e79f9ec384d9b375a59376eb7fb53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-03 21:53:14 +02:00
Doris Verria
259df3ca0b qiostheme: Don't determine the appearance mode from the keyWindow
We were querying the traitCollection property of the application's
keyWindow in order to determine the appearance mode (light/dark) of
the app.
However, the application may not have a keyWindow (visible window)
by the time the we set up the appearance mode, so get that information
from the last window in the application's windows array instead.

Change-Id: If7435d9f565b5c594a26027c971c16a1e3a9af26
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-03 19:43:20 +02:00
Marc Mutz
474792a751 QCOMPARE/QVERIFY: fix huge pessimisation in QTestResult
The old code allocated a stack buffer, but asked the runtime to
zero-initialize it. That's 1KiB of writes to the stack on every
QCOMPARE and QVERIFY before any actual work is done. Fixing this
little laissez-faire to just initialize the first character in the
buffer results in nice little speedups of up to or exceeding 2x.

Amends d946507727.

[ChangeLog][QtTestLib] Optimized successful QCOMPARE and QVERIFY for
an up to 2x speedup.

This has the potential to meaningfully reduce the load on the CI, so
picking all the way to 5.15.

Pick-to: 6.3 6.2 5.15
Change-Id: Ib93d69282ec87cbd26a60e4ac14413e8cef8ff78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 09:01:46 +00:00
Vladimir Belyavsky
66bcb66a51 Windows: fix crash on closing an app when native file dialog is opened
The crash was provoked by QThread::terminate() called
for QWindowsDialogThread from QWindowsDialogHelperBase destructor.
It's still not clear why terminating the thread here causes a crash,
but normally we should avoid terminating a thread anyway.

Current changes make several improvements to avoid terminating the
thread. The main problem was that QWindowsDialogThread::run() was never
returned. That's because QWindowsNativeFileDialogBase::close() was not
called on QWindowsDialogHelperBase destruction. The second problem
was that QWindowsNativeFileDialogBase::close() may still not close
native file dialog because it was not able to find HWND for IFileDialog
instance in some circumstances, so make this by more robust way.

Fixes: QTBUG-93298
Pick-to: 6.3
Change-Id: I55c8cf664ae2cf7c41c8cce43a6bb88a2680bf14
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-06-03 09:34:19 +03:00
Mårten Nordheim
4a8611a902 QRhi(d3d): add missing qcryptographichash include
Change-Id: I9e57c9dca3197c224aad9b6da32a2791fbb34d7c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-03 07:44:51 +02:00
Edward Welbourne
8375f33078 Simplify construction of two QTime instances
Rather than default-constructing and later setting its .mds, just pass
the number of millis to the constructor.

Change-Id: I5e259ee99b1ba53c48d8d71f2b479001c26ab7a0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-03 06:35:21 +02:00
Edward Welbourne
410b5bc238 Add MINS_PER_HOUR constant and avoid a Coverity overflow warning
Being able to distinguish which 60 is minutes-per-hour and which is
seconds-per-minute has some value in its own right, and doing it with
qint64 values (as usual for DateTimeConstants) takes care of two
Coverity warnings about multiplying before widening.

Use the new constant, and SECS_PER_MIN, in a few other places where
the result isn't an int (we don't want to provoke narrowing warnings).

Change-Id: Iadcb6956ac22a53029bf7b7518369520d2b1fd8b
Coverity-Id: CID 393112
Coverity-Id: CID 393113
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-03 06:35:20 +02:00
David Skoland
fd4f218c1e Expose the qtloader object globally
When testing, we need to query the state of the Qt application,
so change the scope of qtloader from inside the init function
to global scope.

Additionally, adjust the test script accordingly to query and use this
state to make good decisions on how to terminate.

Change-Id: I6264ba20843716eb87340b160680617b718f6bd9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-03 05:30:46 +02:00
David Skoland
2c66a8a850 Streamline error handling in qtloader.js
Added new function handleError which does the usual work whenever there
there is an error, including logging the error to console. Also make
the app exit when the emscripten module fails to load.

Additionally, make sure we correctly report it as crash
if the module fails to load.

Change-Id: I9d723373a34ccbb146959a2207ebded8bcbd4f18
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-03 05:30:46 +02:00
Morten Johan Sørvig
18f0793f9c wasm: add support for blocking sockets
Add support for blocking sockets on secondary threads and on the main
thread with asyncify. This extends the support for websockify tunneled
TCP sockets, which was previously limited to async sockets on the main
thread.

Blocking sockets support is implemented by emulating select() on top
of emscripten's socket notification support. This is requires synchronization
between the blockee threads and the main thread, since we get socket
notification callbacks on the main thread. The synchronized state is held
in g_socketState where the main thread registers socket readiness state and
blocking threads register themselves.

Blocking using asyncify on the main thread is similar to blocking on
a secondary thread, with the exception that the main thread suspends
with qt_asyncify_suspend() instead of waiting on a wait condition.

Change-Id: Idb5a493644e1e6634057dc2f64f2e99e82e3c01e
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-02 23:54:46 +02:00
Marc Mutz
6376b1c5a7 QBrush: port from array of char[24] to qOffsetStringArray()
QOffsetStringArray has a more compact representation and silences
warnings from GCC 12 builds with asan and ubsan sanitizers enabled:

    qbrush.cpp: In function ‘QDebug operator<<(QDebug, const QBrush&)’:
    qbrush.cpp:978:77: error: array subscript [0, 31] is outside array bounds of ‘const char [25][24]’ [-Werror=array-bounds]
      978 |     dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
          |                                                       ~~~~~~~~~~~~~~~~~~~~~~^
    qbrush.cpp:954:23: note: while referencing ‘BRUSH_STYLES’
      954 |     static const char BRUSH_STYLES[][24] = {
          |                       ^~~~~~~~~~~~
    cc1plus: all warnings being treated as errors

Task-number: QTBUG-103923
Pick-to: 6.3 6.2
Change-Id: I5f81f516894e57b47783e2d89489a676b657fdb7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-02 15:14:00 +02:00
Ulf Hermann
a248d8daf5 Endian: Allow special bitfield union fields to cover the whole storage
This requires a different computation of the mask since we can't shift
out of the storage type.

Change-Id: Ife85ca3e0c5ca47f06988a397cc2f8a7e28ad0fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-02 14:02:44 +02:00
Marc Mutz
b9cce12e76 qxp::function_ref: drop use of q23::invoke_r
Since P0792r8, pointers to members are no longer supported, which
means we don't need to use std::invoke anymore.

Remove std::invoke in favor of traditional function call syntax, which
should be faster to compile, too.

Change-Id: I2ec3888795471f345ded36bb564d35ac0de29068
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-02 12:54:55 +02:00
Marc Mutz
29b65c98e7 Short live qxp::function_ref!
This is an implementation of function_ref, which has been proposed for
inclusion into C++23, but has not been accepted, yet, which is why we
place it in namespace qxp (for eXPerimental) instead of q23.

The implementation is based on wg21.link/P0792r9, which, at the time
of writing, is the latest revision of the paper. It will be used in
both QTestLib and qmldom.

Fixes: QTBUG-103739
Change-Id: I52723eca28f7ac02ce7ce51928361d81ae5c92b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-02 12:54:55 +02:00
Marc Mutz
4042596b72 Short live q23::invoke_r!
Add an implementation of C++23's std::invoke_r. Will need it in our
implementation of function_ref.

Differences to std::invoke_r:

- only constexpr in C++20, not in C++17 (to fix, we'd need to
  implement our own q20::invoke just to add the constexpr keyword;
  let's first see whether we need this).

Task-number: QTBUG-103739
Change-Id: Id864f83f27ed499849b6bde0c34353127e37e7ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-06-02 12:54:55 +02:00
Lorn Potter
acfcd1e61f wasm: Replace depreciated --embind compiler argument
As of Emscripten 3.1.3, the --embind compiler argment has been
depreciated for -lembind

Change-Id: Iac5bc21602f27fda7c1ea6814a1c9525b9a5afab
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-02 19:11:58 +10:00
Iikka Eklund
003538a4f3 Conan: Don't add 'qt_host_path' automatically when cross-building
We tried to "help" the user by passing the value from -o 'qt_host_path'
into CMake '-DQT_HOST_PATH=...' automatically. This involved updating
the 'cmake_args_qtbase' option by the recipe.

This did not work well with Conan lock files as the alteration of any
option caused:

  ERROR: qtbase/6.3.1@qt/everywhere: qtserialport/6.3.1@qt/everywhere
    tried to change qtbase/6.3.1@qt/everywhere option cmake_args_qtbase
    to '...' but it was already assigned to '...'.

Remove the part where the 'cmake_args_qtbase' value is being altered
but keep it where it is being utilized when aggregating the virtualenv
attributes.

Pick-to: 6.3
Change-Id: Ib7fb1b7cf1b77ee4b5db5646d3be829bc3d1113f
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-06-02 08:33:21 +03:00
Allan Sandfeld Jensen
0806d9799a Fix misuses of 0.9999 constant
Replace it with floor and round. It appears the old behavior
was to work around combining ceil with inaccurate FP, but
it doesn't appear this hacky ceil is needed.

Change-Id: I5c16ec0fa4916e17198a733c46937fde53f2ddb5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-02 07:29:39 +02:00
Marc Mutz
bc922223cf QKeySequence: constinit ALL the things
C++20 constinit acts as a static_assertion that the initialiation of
the object doesn't incur runtime initialization overhead.

Task-number: QTBUG-100486
Change-Id: I818f5ca9703273cd41e44e5ce7085cb5c643ca8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-02 07:24:22 +02:00
Thiago Macieira
dface58142 QtTest: move the disabling of core dumps from load-time to qInit()
There's no reason it has to be done THAT early. It was added in commit
aec85a53df to have the selftests (which do
crash) not leave lots of core files around. I could replace it with a
QProcess::setChildProcessModifier() function, but the variable is now
documented in the QtTest manual, so it would be no gain.

Function renamed to reflect its implementation.

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc25df97a98e3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-01 22:12:17 -07:00
Alexandru Croitor
cfd5485d41 CMake: Change QT_RESOURCE_TARGET_DEPENDENCY property to be internal
Rename the property to _qt_resource_target_dependency and make sure we
also consider which scope we are getting the source file property from
if the CMake version is recent enough.

Pick-to: 6.3
Task-number: QTBUG-103470
Change-Id: I755413c91bc0bc9033760a888927b60c470c562b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-02 05:37:40 +02:00
Thiago Macieira
612f5cf9a1 QTemporaryFile: document rename() differences from QFile
We will not do a copy+delete if the destination is on another mount
point (in fact, QFile uses QTemporaryFile for the latter). In my
opinion, that's a misfeature in QFile, because such an operation may
need to display a progress bar to the user so they won't think the
application has frozen. But it's too late to change now.

I don't know why QTemporaryFile is different. It might be because it was
used for the atomic materialization of a file before QSaveFile existed
(5.1) but I didn't research to confirm. It's still useful even in the
presence of that class if the file is really temporary (meant to be
removed when the QTemporaryFile is destroyed).

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-103740
Change-Id: Iba16e8ea451b444ab213fffd16f4461f3f972d8c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-01 19:20:45 -07:00
Marc Mutz
97269ab294 QKeySequence: statically assert the sortedness of the MacSpecialKey array
This array has, in the past, silently failed this test
(cf. 5d8f815e10). Make sure it doesn't
happen again.

Change-Id: I26192749d43de4a7add9d14c7ca04391c1799525
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-06-01 21:55:07 +02:00
Marc Mutz
c0bb5b2aa1 Short live q20::is_sorted{,_until}!
This is just the C++11 version with constexpr added, very useful to,
e.g., statically check sorted-ness of static arrays.

Task-number: QTBUG-103721
Change-Id: I60164e49db1cc3892280a19851e01193e3c1fb2a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-06-01 19:55:01 +00:00
Alexey Edelev
b7fcaa41a1 Remove redundant deprecation of Gui headers
The QGenericPlugin and QGenericPluginFactory header files are mentioned
as the deprecated in sync.profile. The deprecation looks incorrect,
since the generated headers deprecate them selves. Also syncqt.pl
rewrites this deprecation because files are generated as aliases for
the existing kernel/qgenericplugin.h and kernel/qgenericpluginfactory.h
header files.

Change-Id: I469df56a7cd118dfb82cec0f347d5f2fb75cd9bb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-01 16:01:42 +02:00
Eirik Aavitsland
88c5ccc45a Avoid uninitialized data after getRgbF() even for invalid colors
The other getXxxF() functions will fill in values in the out
parameters even in case of Invalid cspec. So make getRgbF() behave
consistently, and return the same values as getRedF() etc. do in that
case.

Change-Id: Ibb8b0c9526b43ce61118c04b479328dbe88d0419
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-01 15:54:50 +02:00
Allan Sandfeld Jensen
f9df8512c2 Do metadata detach simpler than full detach
Avoid a full data detach when only metadata changes. This paradigm was
already used one place, and made generic.

Fixes: QTBUG-81674
Change-Id: I605253babc6ad9fc130e19e8cef3812690933ac5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-01 15:54:50 +02:00
Morten Sørvig
8c5b1f39f7 wasm: refactor event dispatcher wait logic
We support blocking the event dispatcher thread in two cases:
 - secondary threads: wait on a wait condition
 - main thread: asyncify suspend

Create abstraction which implements both cases under a common API:
  bool QEventDispatcherWasm::wait(int timeout)
  void QEventDispatcherWasm::wakeUpDispatcherThread()

Make QEventDispatcherWasm::wakeUp() use the new API.

Also refactor the runOnMainThread functionality to provide several variants
  - runAsync(fn): makes an async call on the main thread, from the main thread.
  - runOnMainThread(fn): runs fn on the main thread, synchronously if
      called from the main thread.
  - runOnMainThreadAsync(fn): runs a fn on the main thread, always asynchronously

Change-Id: Ia6ac21a162e6b8ea2d71bacf6085beb9567588b5
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-01 13:52:47 +02:00
Morten Sørvig
86103f3af5 wasm: don't enable specialHTMLTargets by default
Adding specialHTMLTargets to EXPORTED_RUNTIME_METHODS carries the
obligation to actually use it as well; failing to do so makes Emscripten
stop with a reference error on startup.

However, we can't guarantee that Qt will use it in all cases. The
current usage depends on QGuiApplication being used. Application code
could be using QCoreApplication, or no application object at all.

Detect if specialHTMLTargets is present instead, and then enable the code
paths which uses it if that's the case. This means that apps which want
to use e.g. multiple browser windows can opt into support by making sure
EXPORTED_RUNTIME_METHODS contains specialHTMLTargets.

Change-Id: I81105aa01946602fcf593f170e305d7dc9bad3be
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-01 13:52:47 +02:00
Lorn Potter
cfa44787de wasm: export a few symbols
These are needed for dynamic linking/ shared library

Change-Id: Ibd01d2b70ecf4afca273d07fafb2a5bd0650cf94
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-06-01 19:18:40 +10:00
Elias Rudberg
0c59723e58 Initialize m_exclusive in QGtk3MenuItem constructor
Problem detected while investigating a crash of a program using
QT, valgrind was used to detect errors and valgrind reported
"Conditional jump or move depends on uninitialised value(s)"
due to m_exclusive being uninitialized.

Not sure to what extent this fix matters in practice, the crash
turned out to be caused by something else outside QT. But anyway
it seems good to initialize m_exclusive like other things, in the
constructor, and it helps avoiding such warnings from valgrind,
that will make it easier to detect other problems using valgrind
or similar tools.

Amends ac8a1787eb where it looks
like initialization of this member was simply forgotten.

Pick-to: 6.3 6.2 5.15
Change-Id: I3d1637a00b7899eded61c2e4f5f9a1c5041e4f45
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Elias Rudberg <mail@eliasrudberg.se>
2022-06-01 05:58:49 +00:00
Marc Mutz
70575264bd QRasterPaintEngine: fix GCC 12 -Werror=array-bounds
An enum variable can legally have values larger than the largest
enumerator, so GCC isn't wrong in warning about accesses out of
bounds. But we know that we don't OR enumerators of this enum
together, so tell GCC, too, by using a Q_ASSUME().

Pick-to: 6.3 6.2
Task-number: QTBUG-103923
Change-Id: I3472fdb19a73a22f04df53a13f809d899613adf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-01 02:36:28 +02:00
Laszlo Agocs
663b375373 rhi: d3d11: Make the "pipeline" cache save/load functional
There are no pipelines here of course. That's only for Vulkan.
But the QRhi APIs provide a common interface for retrieving the
serialized blob and pre-seeding the cache with a blob. The OpenGL
backend already implements that interface via GL program binaries.

We can do something similar with D3D, but it's a lot simpler: we
just need to include the bytecode from HLSL->DXBC compilation (i.e.
the result of D3DCompile() calls) and pick up the already present
bytecode and skip the D3DCompile() call when applicable.

Thus the mechanism is now available for Vulkan, OpenGL, and D3D11
as well.

Has no effect whatsoever if EnablePipelineCacheLoadSave is not set at
QRhi create() time.

Also update the related docs.

Task-number: QTBUG-103802
Change-Id: I91f1fb1f471bc7c654e26886a37c283066e842a8
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-06-01 01:43:32 +02:00
Marc Mutz
7908b0cea6 QFontEngine: fix GCC 12 -Werror=array-bounds
Says GCC 12 with -sanitize address -sanitize undefined:

    qfontengine.cpp: In member function ‘bool QFontEngine::processHheaTable() const’:
    qfontengine.cpp:386:65: error: array subscript 4 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds]
      386 |         qint16 ascent = qFromBigEndian<qint16>(hhea.constData() + 4);
          |                                                ~~~~~~~~~~~~~~~~~^~~
    qbytearray.h:56:23: note: at offset 4 into object ‘QByteArray::_empty’ of size 1
       56 |     static const char _empty;
          |                       ^~~~~~

(repeats several times)

The compiler apparently assumes that data() and size() are independent
of each other, and so finds that that constData() may return &_empty,
which is a const char[1].

For some reason, storing the result of constData() in a temporary and
indexing off of that fixes the issue.

Potentially adding Q_ASSUME(d.data()[d.size] == '\0'); in some
strategic place would fix it, too, but would incur runtime overhead.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105348

Task-number: QTBUG-103923
Pick-to: 6.3 6.2
Change-Id: Ia6e24e01d1c2a6bd9d91d4d082df9fba0d5c668f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2022-05-31 23:43:32 +00:00
Eirik Aavitsland
b539dc118e Avoid menu separators disappearing under fractional dpr scaling
An aliased line painted directly on top of the top edge of the clip
rect will work fine when there is no scaling, since the coordinates
will snap downwards. When a fractional scaling is applied however, the
main part of the line width will sometimes fall outside the clip rect,
and so the coordinates will snap it outside, and hence it will not be
painted.
Fix by shifting the y coordinate by .5, to place the center coordinate
of the line to the center of the intended pixel.

Fixes: QTBUG-88934
Task-number: QTBUG-96223
Pick-to: 6.3 6.2
Change-Id: I3ab042bc964eac6ce359d40428c4d79cde9cb78c
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-31 22:30:22 +02:00
Allan Sandfeld Jensen
567ffafe7f Add new map methods for QColorTransform
Change-Id: I520fc4f4bd958472c6d6359bf671835796c677fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-31 22:23:40 +02:00
Allan Sandfeld Jensen
5ea6da55e0 Test prepared qcolortransform
Add test of explicitly prepared qcolortransform, this is a state
a transform can get into if used for an image transform.

Also cleans up the test code.

Change-Id: I9445ed114bed0edc790e14024aaae6a42989220b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-31 22:23:40 +02:00
Volker Hilsheimer
fb8a88b05c Use a precise timer in QTestEventLoop if timeout is sub-second
QTestEventLoop is used by QSignalSpy::wait. If tests want to verify
that a signal gets emitted within a second or less, we should use
a precise timer to reduce the chance of timer imprecision breaking
the test.

Change-Id: I2a2ca3bbdcaf032288f1fdc2aecc6afd05a6c76c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-31 21:20:41 +02:00
Eirik Aavitsland
5adaa8d868 Add painter render hint for brush pattern transformation
[ChangeLog][QtGui][QPainter] In Qt 5, the predefined brush patterns
would always be transformed along with the object being painted. In Qt
6.0 onwards, they would or would not, depending on the
SmoothPixmapTransformation render hint. Instead of this somewhat
surprising behavior, make the default be untransformed
(i.e. cosmetic), which makes sense when it comes to dpr scaling. For
the cases where one wants scaling, a new render hint is introduced to
enable that: NonCosmeticPatternBrushes.

Change-Id: I2208c7a28af9056d7ab97a529b66bf2d502c3c4f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-31 21:20:41 +02:00
Marc Mutz
5e48a51608 Long live QAtomicScopedValueRollback (private API)!
QScopedValueRollback has a few users that apply it on QAtomicInt,
which happens to work as QAtomicInt is copy-constructible and its
ctors are implicit.

But that's of course nonsense. We don't need to store the oldValue in
an atomic, nor do we need to pass the new value into the ctor as an
atomic.

So, add a QAtomicScopedValueRollback which works on std::atomic as
well as the Qt atomics, but distinguishes between the reference (which
is atomic) and the value (which isn't), and use it in one of the
users, tst_QList.

Keep it private until we know whether there's an actual need for this.

The test is a copy of tst_qscopedvaluefallback, so the occasional
oddity (like atomic op*=) should be ignored.

Task-number: QTBUG-103835
Change-Id: I3c05b3e51f465698657a02ca5521ed465386e9a6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-31 19:25:52 +02:00
Edward Welbourne
4fc66d7603 Convert Since ... comments on \value lines to [since ...] parameters
The \value command supports a [since ...] parameter. We might as well
use it, to standardize how we document when enum members were added.

Change-Id: I68a101e8101f780d0e6607a63723aa1bd837bb56
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-05-31 14:09:28 +02:00
Topi Reinio
11ccd2a68e Doc: Fix typo in the online documentation template
Pick-to: 5.15 6.2 6.3
Change-Id: I15e6db96722f5139f35dcffe70f796c4d7c17327
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-05-31 10:41:36 +02:00
Thiago Macieira
92046dde55 FatalSignalHandler: handle SIGABRT too
Pick-to: 6.3
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb77e9c77d10ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-30 21:27:03 -07:00
Thiago Macieira
7ad8a2e8fe FatalSignalHandler: expand to more Unix OSes than just Linux and macOS
At least for my FreeBSD this makes sense. The default debugger search is
gdb first then lldb on Linux-not-Android and for QNX (qcc is GCC after
all), but lldb first everywhere else.

With LLVM14 from Ports, I get:

$ tests/auto/corelib/tools/qhashseed/tst_qhashseed | head -1
********* Start testing of tst_QHashSeed *********
Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by Clang 14.0.0), freebsd 13.0
=== Received signal at function time: 1ms, total time: 3ms, dumping stack ===
(lldb) process attach --pid 1782
Process 1782 stopped

Executable module set to "/usr/home/tjmaciei/obj/qt/qt6/qtbase/tests/auto/corelib/tools/qhashseed/tst_qhashseed".
Architecture set to: x86_64--freebsd13.0.
(lldb) bt all
* thread #1, name = 'tst_qhashseed'
  * frame #0: 0x0000000800f227c8 libc.so.7`_wait4 at _wait4.S:4
    frame #1: 0x00000008003243bc libthr.so.3`__thr_wait4(pid=<unavailable>, status=<unavailable>, options=<unavailable>, rusage=<unavailable>) at thr_syscalls.c:581:8
    frame #2: 0x00000008002b9c73 libQt6Test.t.so.6`(anonymous namespace)::StackTraceHandler::generate() at qtestcase.cpp:393:9
[...]
=== End of stack trace ===
Received signal 13
         Function time: 1ms Total time: 3ms

Support for Windows left as an exercise for later. The
WindowsFaultHandler code doesn't even call generateStackTrace().

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eba471f58ff3cb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-30 15:56:38 -07:00
Thiago Macieira
d5f4f91c3c FatalSignalHandler: use mmap() to create the alternate stack
So we can mark the bottom page as inaccessible, thus be able to catch a
stack overflow in the handler itself. Our code shouldn't cause
overflows, but it's possible that a chained handler does more work than
expected.

Pick-to: 6.3
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb83a294ab7958
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-30 15:56:26 -07:00
Thiago Macieira
e390ff050a QFileSystemEngine/Win: simplify code
We don't need two or even three buffers for the current directory. In
the worst case, we had a 260-byte buffer on the stack, a larger one on
the heap (new[]/delete[]) and then a copy of it in QString.

Now, we shall have only one and it could be "gifted" to QFileSystemEntry
via std::move() (requires separate patch to take the QString by rvalue-
ref).

Pick-to: 6.3
Change-Id: Ibcde9b9795ad42ac9978fffd16f2bb2a443697d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-05-30 15:55:35 -07:00
Thiago Macieira
e21522b8bf QFileSystemEngine/Win: fix incorrect buffer size in currentPath()
We've just allocated a buffer of 'size' size, which is bigger than
PATH_MAX, but told GetCurrentDirectory() that its size is PATH_MAX.

Fixes: QTBUG-103852
Pick-to: 5.15 6.2 6.3
Change-Id: Ibcde9b9795ad42ac9978fffd16f2ba2cd8712cb7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-30 15:55:33 -07:00
Laszlo Papp
51ac14a4f7 Drag and Drop: Fix the broken XDND protocol link
Change-Id: I74b985d9198223891bb977e367f1265bfc148f95
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-30 20:57:51 +01:00
Topi Reinio
7ecbac21ff Doc: Link to page documenting Qt trademarks in the copyright footer
Use an unversioned link to the online documentation, ensuring we
link to the latest version of this page.

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-102787
Change-Id: I285356687a3873fb861a54d003185f2b751c1b72
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-05-30 21:33:07 +02:00
Kai Köhne
d9b9cded92 Doc: Fix documentation for vulkan licenses
[ChangeLog][Third-Party Code] Vulkan API Registry is available not only
under MIT License, but also Apache License 2.0. Make this explicit in
the license documentation.

Pick-to: 6.2 6.3
Change-Id: I6f07a7970319aef0a26f291de1eff7c316195802
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-05-30 21:20:19 +02:00