Commit Graph

54654 Commits

Author SHA1 Message Date
Timur Pocheptsov
8c4dee6f97 QFusionStyle: don't draw an invalid outline for up/down buttons
When they are disabled ('NoButtons'). Otherwise, we end up with a tiny
dot (top left or right corner of a spinbox).

Pick-to: 6.2 6.3 5.15
Fixes: QTBUG-99486
Change-Id: Ic99f4bce2abd57c988254296a749b5d5b23cfb39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-17 18:23:50 +01:00
Mårten Nordheim
c0ca46de3e QAuthenticator: Use views for arguments in private functions
Some lines in tests had to be updated because they lost the implicit
conversion from char* to QString.

Change-Id: I95af5859ced95b9ca974205398e38c0bd4395652
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-17 18:11:43 +01:00
Kai Köhne
713967ae30 Doc: Make QListIterator snippets more robust
qDebug() << i.next();

can become a NOOP if the code is compiled with QT_NO_DEBUG_OUTPUT.

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-97535
Change-Id: I9085b40ac9b4de2bb06f16e03fd5100902b08d4f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-17 18:11:43 +01:00
Kai Köhne
bc3ac007d8 Doc: Remove mentioning of Fowler book
It is out of print since years, and probably quite dated by now (released
1997).

Pick-to: 6.3
Change-Id: I1653eb404713c15d70b8a15858e8c7d12b2e71cb
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-01-17 18:11:42 +01:00
Morten Johan Sørvig
a1c666b6e5 wasm: fix EXPORTED_RUNTIME_METHODS also for qmake
Emscripten has deprecated the “EXTRA_” prefix.

Pick-to: 6.3
Change-Id: I8cbfab933ba46e293f3bd6262cf0147c3c8978cf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-17 09:01:25 +00:00
Morten Johan Sørvig
f50dbdb38f wasm: don’t pass thread linker opts to compiler
Emscripten now warns against passing e.g. “ALLOW_MEMORY_GROWTH”
as a compile option.

Add EMCC_THREAD_CFLAGS, which gets compiler flags only.

Pick-to: 6.3
Change-Id: Ifcf40c45ca75cfdfc98a12e6b9d47f34158b3407
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-17 09:01:20 +00:00
Morten Johan Sørvig
bb8c73ab9e wasm: modernize pthreads option
Use “-pthreads” instead of “-s USE_PTHREADS=1”. This
is both a compile and linker option.

Pick-to: 6.3
Change-Id: Iaf7cb4ec41577fe596c3e81fda05c03fe0074c08
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-17 09:01:14 +00:00
Morten Johan Sørvig
cf390e48b1 wasm: remove emterpreter flags
The “emterpreter” was the precursor to the current
asyncify support, but is not in use any more.

Pick-to: 6.3
Change-Id: I07ca04b61747e90939444525641b5aa34f7087b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-17 09:01:08 +00:00
Jonas Kvinge
260294346b qmetatype: Fix incorrect more than one typedef warning
The names are the keys of a hash so they can come in any
order. That means the loop above, which stops before the end if
it finds a name that is not the official one, may not have seen
the official yet. If it has reached the end, then there is no
typedef alias.

Fixes: QTBUG-99620
Pick-to: 6.2 6.3
Change-Id: I3bd638766c494b32c665190d01db15c4cbc587b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-17 08:51:23 +00:00
Øystein Heskestad
74955f386d Replace QString::utf16 with QString::data where appropriate
QString::utf16() needlessly detaches fromRawData() to ensure a
terminating NUL. Use data() where we don't require said NUL, taking
care not call the mutable data() overload, which would detach,
too.

Task-number: QTBUG-98763
Change-Id: Ibd5e56798c0c666893c12c91ff0881842b8430c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-17 09:48:12 +01:00
Robert Löhning
88dda89329 Fuzzing: Add fuzzer for QJsonDocument::fromJson
Task-number: QTBUG-99799
Change-Id: If997b661da2fce04b84f94b9e66de19c9946a914
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-17 09:46:40 +01:00
Pino Toscano
5558eb4edb QStorageInfo: limit Linux-only code with Q_OS_LINUX
This fixes a build problem (use of PATH_MAX) by eliminating a
Linux-specific condition that can't happen on HURD anyway.

Pick-to: 6.3
Change-Id: I5dcaf104a60b7850b8af3964fc4cd02ab24acd7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-16 11:59:39 +00:00
Thiago Macieira
b387fbd122 QVersionNumber: change int to qsizetype for index and length
This class is not exported, so we can change the non-exported
methods. None of the exported methods required change; notably,
QVersionNumber::Segments::setVector didn't because it's only called with
values 1, 2, and 3.

[ChangeLog][Potentially source-incompatible changes] Updated the
QVersionNumber API to use qsizetype where length and index values were
used. This change retains binary compatibility and the vast majority of
users will not experience a source compatibility problem. It could occur
with ambiguous overloads when passing results from QVersionNumber to
other API not using either int or qsizetype. There could also be new
warnings from compilers about converting 64-bit types to 32-bit ones.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c9984b61c9b55b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-16 11:59:39 +00:00
Giuseppe D'Angelo
3976449c0e QTextStream: code tidies
Port the internals to qsizetype, and use QStringView instead of QString
as a function parameter.

The padding() function is changed to take a qsizetype to avoid warnings,
but the maximum padding that can be specified is still limited by the
range of an int (this is guarded via an assert).

Change-Id: I9dd98e5a534990a1758b080900a12dc793528d19
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-16 11:59:39 +00:00
Giuseppe D'Angelo
3f06d47e57 QAnyStringView: fix code point -> code unit in the docs
The docs are saying that QAnyStringView sizes are measured in terms
of code units of the underlying encoding, not code points.

Pick-to: 6.3 6.2
Change-Id: Ic72ffd122e45631e8626c9d57ec24ca348918424
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-16 09:57:07 +01:00
Yuya Nishihara
6ffc8d8eb6 QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock cases
This is heavily inspired by the patch written by Inho Lee
<inho.lee@qt.io>, which says "There is a precision problem in the
previous algorithm when checking pitch value. (In the case that the
rotation on the X-axis makes Gimbal lock.)"

In order to work around the precision problem, this patch does:

 1. switch to the algorithm described in the inline comment to make
    the story simple.
 2. forcibly normalize the {x, y, z, w} components to eliminate
    fractional errors.
 3. set threshold to avoid hidden division by cos(pitch) =~ 0.

From my testing which compares dot product of the original quaternion
and the one recreated from Euler angles, calculation within float range
seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999)

Many thanks to Inho Lee for the original patch and discussion about
rounding errors.

Fixes: QTBUG-72103
Pick-to: 6.3 6.2 5.15
Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10
Reviewed-by: Yuya Nishihara <yuya@tcha.org>
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-16 01:12:15 +01:00
Marc Mutz
6852c20502 QMutableEventPoint: turn into memberless struct
... as a befriendable namespace.

This breaks all remaining users of QMutableEventPoint, thus forcing
them to port to the new static-setter-only API that reliably avoids
the UB that the old QMutableEventPoint::from(), in particular,
depended on.

Fixes: QTBUG-99615
Pick-to: 6.3
Change-Id: Id162cd98f13b52c4f491749ee73826b1c5755453
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-15 22:02:27 +01:00
Volker Hilsheimer
cb27ed30f7 QCSS: Support Qt 5-style integer property selectors
In Qt 5 style sheets, objects could be selected by an enum-type property
using the integer value of the enum value, e.g

QToolButton[popupMode="1"] { ... }

In Qt 6, the the new meta type system and QVariant implementation enabled
QVariant::toString to return the string representation of the enum value
instead for a property containing an enum. Since QStyleSheetStyle's
attribute matching is string based, this breaks the Qt 5 style selector,
and QCSS code instead needs to use e.g.

QToolButton[popupMode=MenuButtonPopup] { ... }

While the new syntax is arguably preferable, this is an unintentional
change that silently breaks style sheet code (no error or warning at
compile- or run-time).

To support Qt 5-style selectors, we have to change the StyleSelector
interface of the QCssParser API so that we can pass through what type
of value the attribute extractor should return; if an integer string "1"
is provided, then we need to compare the enum integer value; if the
string provided does not represent a number, then we need to compare the
name of the enum value.

Since the pure virtual attribute() method that needs to be implemented
to extract the attribute value of the node is implemented in modules
outside qtbase, add a second virtual method that takes the entire
QCss::AttributeSelector, which includes the value to match. Extractor
implementations can use it to evaluate which type of data to return for
an exact match. The default implementation calls the old attribute()
method so that existing StyleSelector implementations continue to work.

Make the respective change in the QStyleSheetStyleSelector, and simplify
the surrounding code. Adjust other StyleSelector implemnentations in
qtbase. As a drive-by, remove the superfluous virtual declaration from
those overrides.

Once submodules are adjusted to override this virtual function instead
of the (now no longer pure) virtual attribute() method, that method can
be removed.

Pick-to: 6.3 6.2
Fixes: QTBUG-99642
Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-15 19:21:57 +01:00
Fawzi Mohamed
da6c8b2fc6 Fix Pick Screen Color with multiple monitors
QScreen::grabWindow expects screen coordinates, not global ones, use
QScreen::geometry() to compute them.

Fixes: QTBUG-99472
Pick-to: 6.2 6.3
Change-Id: Ic4b99577b8cb394e6cd0a2d3f554bb3ec8250afa
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Zhang Hao <zhanghao@uniontech.com>
2022-01-15 16:16:13 +01:00
Marc Mutz
cfca4188f9 tests: port to new QMutableEventPoint static API
This code didn't actually use QMutableEventPoint::from(), so didn't
run into the UB that from() depended on, but it's in the way of making
QMutableEventPoint a befriendable namespace instead of a public
subclass of QEventPoint.

Replaced the QMutableEventPoint ctor that takes a timestamp, and
therefore isn't compatible with the ctors on QEventPoint, with a
static function that returns QEventPoint instead.

Port QList initialization to braced-initialization as a drive-by.

Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-15 12:29:27 +01:00
Marc Mutz
7d63efc16f Prevent repeated instantiations of qRegisterNormalizedMetaType<QList<QModelIndex>>()
This, finally, shows some expected results:

Clang -ftime-trace:

  $ ClangBuildAnalyzer --analyze qtgui-spec-before.trace | head -n6
  Analyzing build trace from 'qtgui-spec-before.trace'...
  **** Time summary:
  Compilation (523 times):
    Parsing (frontend):          665.7 s
    Codegen & opts (backend):    298.9 s

  $ ClangBuildAnalyzer --analyze qtgui-spec-after.trace | head -n6
  Analyzing build trace from 'qtgui-spec-after.trace'...
  **** Time summary:
  Compilation (525 times):
    Parsing (frontend):          628.3 s
    Codegen & opts (backend):    301.0 s

GCC 11 time (bash builtin):

  $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so

  real    4m10,918s
  user    49m10,099s
  sys     3m11,719s
  $ git revert --no-commit HEAD
  $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so
  [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so

  real    4m18,630s
  user    51m11,491s
  sys     3m16,479s

The technique in the comment in qmetatype.h doesn't work on Clang - it
runs into -Winstantiation-after-specialization. The whole extern
template stuff so miserably fails to meet the goals set out in N1448,
not only for MSVC and class templates, but, it seems, on all
compilers, and for function templates, too, that I'm giving up on it
for now.

Unfortunately, I'm not really seeing a way to hide this stuff behind a
macro, yet.

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: I500fd04555e0bd76ac021f75582bd8d8cf339378
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-15 10:46:38 +01:00
Volker Hilsheimer
b749163bb8 Add test case for style sheet selectors for enum properties
In Qt 5, such selectors have to use the integer value of the enum
value. Using the enum value name does not work.

In Qt 6, such selectors must use the enum value by name, using
the integer does not work.

It's not clear yet what changed, possible a side effect of the
changes and improvements in the meta object system and QVariant in
Qt 6. So for now, document the difference in behavior in a test.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99642
Change-Id: I96e0280b191b8ca06b16a97ab3ed367e9a8f43a0
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-01-15 07:38:15 +01:00
Mårten Nordheim
02c2a80865 QtNetwork: Include moc files
Change-Id: I227a9541bf76c1c048a694f022b8fc419c0c2544
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-15 01:10:21 +01:00
Marc Mutz
47fab016df Don't include qeventpoint_p.h from qevent_p.h
The header no longer uses QMutableEventPoint.

Fix TUs that relied on the transitive include.

Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-14 20:00:54 +00:00
Marc Mutz
afdcb64ccd QFlatMap: don't sort already ordered data
Pick-to: 6.3 6.2
Change-Id: Id7ab2fe09c01500ca5bd23751ba29ed1394bb9b6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-14 21:00:28 +01:00
Eskil Abrahamsen Blomfeldt
413cd06c88 Fix crash when text shaping fails
If text shaping failed for some reason (for example if the
string passed to Harfbuzz contains ignorables only), we
would return a single glyph for the whole string. But we
forgot to initialize the log clusters array, which could
cause crashes later when this was read. We initialize a
single cluster consisting of the "missing glyph" glyph to
be consistent.

Amends fccd419dd6.

[ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts
when shaping strings consisting only of control characters.

Pick-to: 5.15 6.2 6.3
Task-number: QTBUG-89155
Fixes: QTBUG-92358
Change-Id: I1ec0237d99b48be2a8bb340f0feb056bca4fdffe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-14 18:57:41 +01:00
Volker Hilsheimer
3ed7a5a963 QWindow: Remove unnecessary cast
We already have a QMouseEvent, don't static_cast the QEvent again to the
parent-class of QMouseEvent.

Pick-to: 6.3 6.2
Change-Id: Ifd8a5a82d0a8ded564a68ec4f3ae877886c6e1c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-14 18:57:41 +01:00
Marc Mutz
efe4863f83 QWindow: fix UB (invalid static_cast)
Do the cast to QMouseEvent only after we determined that it's actually
a QMouseEvent. Says ubsan:

  src/gui/kernel/qwindow.cpp:2558:27: runtime error: downcast of address 0x7fffca0e5af0 which does not point to an object of type 'QMouseEvent'
   0x7fffca0e5af0: note: object is of type 'QShowEvent'
    ff 7f 00 00  b0 09 01 b8 61 7f 00 00  11 00 00 00 00 00 00 00  b3 8a b5 41 00 00 00 00  80 50 5a cc
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QShowEvent'

Only cast _after_ determining that `ev` is-a mouse event.

Amends 3d71c4b740.

Pick-to: 6.3 6.2
Change-Id: I8455c998e2f4390a1483c1a097eb095358963ace
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-14 18:57:41 +01:00
Volker Hilsheimer
7955dceec1 Fix warning on macOS builds, unbreak -developer-build
The mix of signed (qsizetype) and unsigned long when comparing breaks
local -Werror,-Wsign-compare builds.

Amends d83dbc3db2.

Change-Id: I7910b7e2dfaaa01d8069ce52e97c0166e6d3fa30
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-14 18:57:41 +01:00
Thiago Macieira
1ee875dcac convertDoubleTo: invert the condition so we catch NaNs early
This is floating point, so De Morgan doesn't always apply.

Change-Id: I89446ea06b5742efb194fffd16bb9e36025cb387
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-14 09:57:41 -08:00
Thiago Macieira
0ca6ad8cfc convertDoubleTo: move the precision upgrade test up
Hopefully, the compiler will realize that the suprema calculated below
are actually bigger than these limits and make the appropriate dead code
eliminations.

Change-Id: I89446ea06b5742efb194fffd16bb99f78b26eb0e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-01-14 09:57:40 -08:00
Volker Hilsheimer
dd3c4cb9bf Stabilize tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad
The test is impacted by the position of the mouse cursor, and fails if
the mouse enters the test window when it gets shown. Try to move the
cursor away from the window.

As a drive-by, const'ify some of the local variables.

Revert 7b4b5115dd by removing the
blacklisting of the test on macOS in CI.

Pick-to: 6.3 6.2
Change-Id: Ia0c554fdf161fd4eb4aa3965e937c7db8ceeef8f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-14 18:57:40 +01:00
Kai Köhne
98237fe16c Doc: Mark QSP::PublicShare, Templates for 6.4
The commit missed the 6.3 branching / feature freeze.

Task-number: QTBUG-86106
Task-number: QTBUG-78092
Change-Id: I1d6b1efe0d482b6fc1ff3cfbbb440856b8cf1856
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-14 17:42:49 +01:00
Kai Köhne
197b5de0d8 qtpaths: Expose new PublicShareLocation, TemplatesLocation
These were added to QStandardPaths in commit 68c4669ce4

[ChangeLog][QtCore] PublicShareLocation, TemplatesLocation got added as
known locations to QStandardPaths.

Task-number: QTBUG-86106
Task-number: QTBUG-78092
Change-Id: I453b6a07dd7775f81f81a1b18fa95f5c1230cb1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-14 17:42:49 +01:00
Axel Spoerl
bf44ca3224 Add QProgressBar test in tst_baseline_widgets
Task-number: QTBUG-99678
Pick-to: 6.3
Change-Id: Ib56f7bdcc1e61d0354a7a381b8089f35e80b931c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-14 13:33:24 +01:00
Marc Mutz
31669722d9 QGuiApplication: port the last user of QMutableEventPoint::from()
... to the new static setter API, preventing the undefined behavior
that from() depended on.

Remove from() and constFrom().

Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: I69c52aa286eaf51303734e42184af36815cf828a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-14 12:32:30 +00:00
Ivan Tkachenko
3215416e3c QPathEdge: Fix array initialization
We had a copy-paste error there: not all array members were initialized.

Pointed out by PVS-Studio static analysis tool:
https://habr.com/ru/company/pvs-studio/blog/542760

Co-Authored-By: Marc Mutz <marc.mutz@qt.io>
Pick-to: 6.3 6.2 5.15
Change-Id: I06a4f2cd928846eab6330af014981fd0a3170ba0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-14 01:38:14 +00:00
Marc Mutz
fc738e3f51 Port the last user of QMutableSinglePointEvent::mutableEvent()
... to the static setters of QMutableEventPoint.

Remove the mutableEvent() function.

Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: If4d3decae67baff41e23e7e9eaed3f3035fab595
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-14 02:02:26 +01:00
Mike Achtelik
c3c57cb968 QTlsBackend: Fix living QObjects after QCoreApplication shutdown
Since switching to the plugin bases system for the tls backends,
Qt again retains some QObjects after QCoreApplication shutdown.
This was previously fixed in QTBUG-84234, so make sure we destroy the
newly introduced QObjects as well.

Task-number: QTBUG-84234
Pick-to: 6.3
Change-Id: I1aaea2c90f7d55793c19259be4f9173b4befb246
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-13 22:12:32 +01:00
Sona Kurazyan
4cc1d81d79 Add porting instructions for using binary JSON
Also move the instructions for using the Qt5Compat module to a separate
section, since they repeat in a few places.

Pick-to: 6.3 6.2
Fixes: QTBUG-99771
Change-Id: Ib9a45043bd9aa462a767780c0986ebfb9a7b948d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-13 22:00:35 +01:00
Volker Hilsheimer
87a62e46e4 Don't return an associated screen for embedded widgets
Widgets embedded in a graphics view via QGraphicsProxyWidget don't have
an associated screen, even though they are top level windows in the
widget hierarchy.

Their screen has to be based on the screen of the toplevel widget they
are embedded in. This fallback is taken care of by QWidget::screen
already.

Task-number: QTBUG-20531
Pick-to: 6.3
Change-Id: I77af092b2f8e6322662499be464eec40cfd9ac1c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-13 22:00:22 +01:00
Volker Hilsheimer
55928821d1 Improve QShortcut test
The test uses a static MainWindow so that we can execute a series of key
simulations on the same window. The window is then destroyed when we
reach the final test row.

If some of the tests fail, then the window is left in an unknown state,
resulting in cascading failures for the other tests. Fix this by always
trying to show and activate the window, and always destroying the static
window if we have reached the last test data row.

Fixes: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I466669f387e8b199e9e719a7ebbe3ae670658b7e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-13 21:00:22 +00:00
Giuseppe D'Angelo
b1cf7285f9 Properly detect and declare contiguous iterators
The recommended way to detect a contiguous iterator isn't to check
the iterator_category; it's to use the iterator concepts.

Similarly, the recommendation set in place by P2259 (for being
backwards-compatible) is to declare a iterator_concept member,
not to change iterator_category to a C++20 category, (also)
because legacy code may be checking for equality against a specific
category, rather than for convertibility. This is erroneous, but
such code exists, alas.

This is enshrined in C++20's stdlib: for instance, iterator_traits<Foo*>
has random_access_category_tag as iterator_category, but
contiguous_iterator_tag as its iterator_concept.

Hence:

1) in QArrayDataOps use the concept, and not the category, to do
the check

2) when declaring iterators, keep the category as random access,
and introduce the concept alias (if supported).

Pick-to: 6.2 6.3
Change-Id: Ib600da7331d687a15082becaa6be06aefc24bb9c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-13 21:19:24 +01:00
Allan Sandfeld Jensen
552c4a9655 Read QThreadPool::objectName thread-safe
QThreadPool allows method calls from any thread, but QObject does not
so copy objectName so we may use it locally under our own lock.

Pick-to: 6.3 6.2
Task-number: QTBUG-99775
Change-Id: Ib28910649f5d0f9ce698c7da495069635d608d03
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-13 19:47:23 +01:00
Allan Sandfeld Jensen
3f32dcd1dd Allow reading QObject::objectName from other threads again
The new binding system made it impossible to read from non-owning threads,
but we have code that did so with external locking. This patch makes it
safe again, assuming all reads and writes are locked. This is left
intentionally undocumented.

Pick-to: 6.3 6.2
Task-number: QTBUG-99775
Change-Id: I845afa5d545ca0ac762ac369181b1497dac52195
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-13 18:47:23 +00:00
Edward Welbourne
d83dbc3db2 Tidy up macOS collation and add some assertions
Change-Id: I7af21ce38f2f23498d7c8a7e027bfffb149a43e3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-01-13 19:47:22 +01:00
Edward Welbourne
5d228beb52 Fix an assertion failure in massageAdjustedDateTime()
The QDateTimeData &d it's passed is a copy that's about to be
modified; before we do so, we haven't detached so its internals have a
ref-count of two, contradicting an assertion in the non-const
Data::operator->(); so just directly access d.d->m_timezone, since we
know that spec == TimeZone implies !isShort().
Added test that triggered the assertion and now doesn't.

Fixes: QTBUG-99668
Pick-to: 6.3 6.2 6.2.3 5.15
Change-Id: I07321ad91be5adce524be18e4ab82eee7110dc6a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-13 19:47:22 +01:00
Janne Juntunen
b84f4a350d tst_QImageWriter: skip writing unsupported image formats
Do not try to test writing of image formats which are not supported on
the platform under testing. This test was failing for .ico files on
webOS.

Fixes: QTQAINFRA-4722
Pick-to: 6.3
Change-Id: Ic7d40d9751e0f921d9721c01492cca28d798e141
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-01-13 20:47:22 +02:00
Edward Welbourne
13d2e13290 Make counts of various types of test result add up correctly
Added tests for repeated skips and failures (from within void lambdas,
to simulate skips and failures from within event handlers). These
exhibit yet more ways to count more than one outcome for a test.  The
new QTest::failOnWarning() can also provoke more than one failure from
a single test, and several existing selftests exhibited various ways
for the Totals line's counts to add up to more than the number of
actual tests run.

Fixed counting so that only the first decisive incident is counted.
Tests can still report later failure or skipping, but only the first
is counted.

Added a currentTestState in qtestlog.cpp, by which it keeps track of
whether the test has resolved to a result, and clearCurrentTestState()
by which other code can reset that at the end of each test. This
brought to light various places where test-end clean-up was not being
handled - due to failure or skipping in a *_data() method or init, or
a skip in cleanup.

Fixes: QTBUG-95661
Change-Id: I5d24a37a53d3db225fa602649d8aad8f5ed6c1ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-13 19:47:22 +01:00
Edward Welbourne
95e4996688 Revise the explanation for leaving QTest::qWait() as it is
The recently aborted attempt to act on the comment's recommendation
revealed a major performance regression, so mention that instead of
the now historical compiler problem that used to be our reason for not
simply calling qWaitFor().

Change-Id: I81714b556998217a833c21b4208118b7292b7a96
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-01-13 14:47:46 +00:00