Commit Graph

54814 Commits

Author SHA1 Message Date
Jungi Byun
574b625914 evdev: Prevent race condition in touch events processing
Unlike other input devices, touch devices are managed by corresponding
handler threads which are not the main thread. InputEvent that is
inherited by TouchEvent has a constant pointer member for device, but in
touch events case, handler threads may destroy the device which is
pointed by events while processing these events in main thread,
and this may cause critical potential issues such as crash. In order to
prevent this race condition, move device of QEvdevTouchScreenHandler
into main thread and delete this device later if QGuiApplication
instance exists when handler thread quits, and check event's device is
valid when processing touch events.

Change-Id: I02583238d97d768abcc544ee882160eda3178282
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-26 01:01:31 +00:00
Eskil Abrahamsen Blomfeldt
2e29a427ca Windows: Change default hinting preference for high-dpi
When high-dpi is enabled, we would previously default to
QFont::PreferVerticalHinting which maps to the asymmetric
antialiasing strategy, where only horizontal antialiasing is
enabled.

The idea behind this is that it provides crisper text,
especially for smaller font sizes, but for larger font sizes
the aliasing artifacts outweigh the added sharpness.

Inspecting native Windows applications, such as the system
settings, it looks like asymmetric antialiasing is used
up to a certain font size threshold. The documentation uses
a font size of 16 as the suggested threshold.

In accordance with the documentation, we use PreferNoHinting
for font sizes above this threshold.

[ChangeLog][Windows] When high-dpi scaling is active, the
default text antialiasing has been set to symmetric for
larger fonts (pixel size higher than 16 px). The old default
can be selected manually as QFont::PreferVerticalHinting.

Fixes: QTBUG-99066
Change-Id: Ibf53556f6e2cbbe1dc5d30c6c1743a499a99a90b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-25 17:20:26 +01:00
Edward Welbourne
78eac57f3d Check for null driver() before trying to exec()
QSqlQuery::exec() took for granted that it can dereference driver(),
which should be true for all sane usage; however, it should not crash
if used misguidedly. Added regression test, based on bug report's
reproducer, which crashes without the fix.

Fixes: QTBUG-100037
Pick-to: 6.3 6.2 5.15 5.12
Change-Id: I94600bc60f89e82a1121b418144006a683921a38
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-01-25 16:18:35 +01:00
Friedemann Kleint
f172b964f6 threadedqopenglwidget example: Split out class Renderer
This makes the code clearer and decouples it from the
GLWidget.

As a drive-by, add a global shortcut to close.

Pick-to: 6.3 6.2
Change-Id: I3469d29bc367acc17c5f8acf9d46219259b8315b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-25 15:54:05 +01:00
Giuseppe D'Angelo
2d95b75345 QByteArray: fix isUpper/isLower
577d698b8e changed QString::isUpper /
isLower behaviors to match Unicode semantics: a string is uppercase
if it's identical to its own toLower/toUpper folding. These semantics
come from Unicode so they're not up for debate.

That commit however left QByteArray untouched. Generally speaking, we
want to move away from QByteArray as "text storage" -- this has
partially happened between Qt 5 and Qt 6, where QByteArray went from
Latin-1 semantics to ASCII semantics. Still, QByteArray offers
toUpper/toLower and isUpper/isLower and all this family of functions
should be consistent in behavior.

Apply the same fix that was applied to QString.

[ChangeLog][Important Behavior Changes] The semantics of
QByteArray::isLower() and QByteArray::isUpper() have been changed. Now
lowercase (resp. uppercase) byte arrays are allowed to contain any
character; a byte array is considered lowercase (resp. uppercase) if
it's equal to its own toLower() (resp. toUpper()) folding. For instance,
the "abc123" byte array is now considered to be lowercase.
Previously, the isLower() (resp. isUpper()) functions checked whether
the byte array only contained ASCII lowercase (resp. uppercase)
characters, and was at least 1 character long. This had the side effect
that byte array containing ASCII non-letters (e.g. numbers, symbols,
etc.) were not lowercase nor uppercase.

[ChangeLog][QtCore][QByteArray] QByteArray::isLower() and
QByteArray::isUpper() now work correctly with empty byte arrays. The
semantics of these functions have been changed.

Pick-to: 6.3 6.2
Fixes: QTBUG-100107
Change-Id: Id56a42f01b2d1af5387bf0e6ccff0f824f757155
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 15:29:20 +01:00
Oliver Wolff
32caaacee3 windows arm64: Use correct Q_PROCESSOR_ARM_64 define check
Inclusion of qt_windows.h is needed to avoid  "No Target Architecture"
in winnt.h.

Change-Id: Ic67ce8a306ef52c4ce3e6eaad0b7864632610737
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-25 14:22:27 +01:00
Kimmo Ollila
dac76bb442 INTEGRITY: Prevent deletion of virtual functions
In release builds -olink also enables deletion of (unused) virtual
functions. In some cases this can lead to application crashes when
using loaders combined with timers. Prevent this by adding
-no_uvfd option to release build flags.

Task-number: QTBUG-99506
Pick-to: 6.3 6.2 5.15
Change-Id: I5c669e1e987f1fe912c9aca52ff82000125eed53
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-01-25 14:02:59 +02:00
Marc Mutz
1f118a54f8 Revert "QLatin1String: Add overloads taking QLatin1Char"
This reverts commit 1c164ec7f2,
except for the test additions.

Reason for revert: We need to optimize the implementation, not
complicate the API.

Found during the 6.3 API review.

Pick-to: 6.3
Change-Id: I91c3f65ed6d1fc438deb0e028d578a07c0005362
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-25 11:59:02 +00:00
Yuhang Zhao
c532a57670 Fix build with clang-cl
1. Clang-CL can't recognize "/d2FH4" and it's causing
lots of warnings when compiling. So don't apply it
when building with clang-cl.
2. The definition of "FS_INFORMATION_CLASS" need to
be visible to clang as well. Don't know why it was
excluded originally.

Pick-to: 6.3
Change-Id: I7b6e14999eea0ba1f0d73962ff03a35548f88a5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 14:09:31 +08:00
Thiago Macieira
5e2ce03510 QEventDispatcherWin32: use SetCoalescableTimer for (Very)Coarse timers
The tolerance can be set per timer, unlike on Linux.

Fixes: QTBUG-98316
Change-Id: I5e52dc5b093c43a3b678fffd16b788a30bcb9574
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 19:28:48 -08:00
Marc Mutz
be0dc7fbb8 QMake: replace a Q_ASSERT() with a Q_UNREACHABLE()
In release mode, the Q_ASSERT() is a no-op, and Clang rightfully
pointed out that, in that case, the bool ok variable will be used
uninitialized.

Fix by using Q_UNREACHABLE(), which has an effect in both debug and
release builds.

Pick-to: 6.3 6.2 5.15
Change-Id: I33480aabe1c5233d1caddf9404f475ca9fcb8eaf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 03:48:46 +01:00
Tatiana Borisova
b5124d9719 Fix run time failure for UI autotests (INTEGRITY)
- Add WFD resources release:
  It provides possibility to re-create native window on run time.
  It allows to run several Qt UI applications (one by one) without device reboot.

- Fix crash that found during window re-creation: ~QOpenGLCompositorBacking() calls
  QOpenGLCompositor::instance(). But compositor is deleted for that moment.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I1e6dc9a012a166d1fd6cd1c24f9d2e9a8995fc00
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-25 02:59:36 +02:00
Laszlo Agocs
406bb6ae20 rhi: Make sure pixelSize() to a texture rt is always up to date
This is an issue for QQuickWindow in practice, although it is not hit
by our current tests.

Pick-to: 6.3
Change-Id: Ia73704c1af6a82b2689ce7b844d3b0eb9a17ec18
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-01-25 01:04:07 +01:00
Mårten Nordheim
4b6064aef4 QOperatingSystemVersion: fix #if check for macos version check
It would check the version regardless of OS, but this macro doesn't exist
on non-darwin platforms.

Amends 3446313c7a

Pick-to: 6.3
Change-Id: I7bdc302c85626d410e77bea1eb7aac7fbf1cb679
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 00:31:10 +01:00
Mårten Nordheim
c781d5ed08 Move private QOperatingSystemVersion::compare to removed_api
From the API review.

Pick-to: 6.3
Change-Id: I9877990f75189b99a372ea6342d07a7031228ac7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 00:31:10 +01:00
Sona Kurazyan
4cd8eeaf8c Fix memory leak in QtConcurrent::run when called with a NULL QThreadPool
QThreadPool automatically deletes the runnable after it finishes running
the task. In case QThreadPool is nullptr, we should delete the runnable
manually. This amends 87b93c29be.

Pick-to: 6.3 6.2 5.15
Change-Id: Id7e4ed3d4d6de05990edf62e4099852983debc64
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 22:40:35 +01:00
Marc Mutz
df0f8e036c Replace cxx17_bm_searcher config check with feature test macro
This enables the code also for boostrap.

Amends b24e689cb5.

Pick-to: 6.3
Change-Id: I8efc76c20690282a2428f360d6b93896966b97ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 20:11:23 +00:00
Marc Mutz
a8f00bf0ad QByteArray benchmark: fix clang -Wmove-result
Take the argument by value instead of rvalue ref. In C++17, this is as
efficient, and enables the

   return big;

to use the QByteArray move constructor, avoiding the need for a manual
std::move(), which always looks suspicious on a return statement,
because more often than not, it's a pessimization that breaks NRVO.

This code doesn't seem to exist in Qt 6.2, so only

Pick-to: 6.3
Change-Id: I8bf678102f5df1870cfc61090d12f327478d74d1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-24 21:11:22 +01:00
Marc Mutz
6f1821dfa3 benchmarks: fix some (future) -Wunused-result warnings
Clang 10 warns about unused results of relational operators, which is
where this is coming from.

Fix by adding the usual prefix

  [[maybe_unused]] auto r = ~~~;

to silence the warning. Do this elsewhere, too, since [[nodiscard]] is
slowly being rolled out across all our APIs. This is not a complete
sweep, though.

Not picking to 5.15, because this pattern doesn't work there and I
don't want to introduce a new one.

Pick-to: 6.3 6.2
Change-Id: I40dd8ad07496b686979dce533e044cbb486e30f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-24 21:11:22 +01:00
Marc Mutz
c00e443dcc tst_bench_qlocalsocket: fix Clang 10 warnings about unneeded capture
The timeToTest constant doesn't need to be captured, claims Clang.

Since I don't recall seeing this warning on GCC, be pragmatic and fix
by letting the compiler choose what to capture: [&]. timeToTest is
const, so it doesn't matter whether we capture by reference or value,
the lambda cannot change it either way.

This code doesn't seem to exist in 5.15, so merely

Pick-to: 6.3 6.2
Change-Id: I48d42ab13ed22ac5eb512dc61235b72a19636ea3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 21:11:22 +01:00
Marc Mutz
b084c885db QTransform benchmark: measure what was promised
The function name suggests that the *= operator is to be benchmarked,
not simple multiplication.

Use the correct operator.

Pick-to: 6.3 6.2 5.15
Change-Id: I6718e8aea640a153083858b39963199e7bab26e9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 21:11:22 +01:00
Marc Mutz
af2d9bc3c4 Optimize finding UTF-16 needles in L1 haystacks
We were converting the full L1 haystack to UTF-16. But, even so, we
won't be able to find non-L1 UTF-16 needles in L1 haystacks!

Optimize by converting the needle (not the haystack) to L1, after
checking it's actually L1.

Pick-to: 6.3
Change-Id: I413d7a602d44ecb2d3149dc4fa87c690c40e6aaa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-24 21:11:22 +01:00
Sona Kurazyan
d1639da0d5 Mark ResultStoreBase as final
The class is not intended for inheriting from it (see also
e502906305), so we can mark it as final
to explicitly forbid this. The tests were still using it as a base
class to clean the results during destruction, so fix them accordingly.

Task-number: QTBUG-99883
Pick-to: 6.3
Change-Id: I4a7ee3e2b462bd704e4b5a95ed733144805d6e5b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-24 20:54:36 +01:00
Kai Köhne
57402ffb9b Examples: Remove unneeded CMake options
CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since
CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes

CMAKE_AUTORCC should not be used anymore. Instead, we now use
qt_add_resources() or similar

Enable CMAKE_AUTOUIC only if .ui files are present.

Pick-to: 6.3
Task-number: QTBUG-87643
Change-Id: I835e2994cd5dba9918136999499b9077961b616c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-01-24 14:00:00 +01:00
Kai Köhne
dfc1728e7b Fix gcc warning in tests
Fixes

/home/qt/work/qt/qtbase/tests/auto/corelib/tools/qcache/tst_qcache.cpp: In function ‘TestNamespace::quint64 qHash(TrivialHashType, size_t)’:
/home/qt/work/qt/qtbase/tests/auto/corelib/tools/qcache/tst_qcache.cpp:491:41: warning: unused parameter ‘seed’ [-Wunused-parameter]
  491 | quint64 qHash(TrivialHashType t, size_t seed = 0)
      |                                  ~~~~~~~^~~~~~~~

Change-Id: I70446d3f53770162ec0b99f53695c11c7aac103f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-24 12:59:37 +00:00
Alessandro Portale
edf1c3b001 Unify indentation in help information of androiddeployqt
Some of the parameters in the help information were indented by 3
characters instead of by 4.

Pick-to: 6.3
Change-Id: Id11cda79d61c4eab82ee09e33034db55730123c5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-01-24 12:57:23 +00:00
Sona Kurazyan
1daaf613dc QFuture: add a missing include for qpromise.h
QPromise is now used in qfuture_impl.h, so we need to include it. Remove
qfuture.h include from qpromise.h, to avoid circular dependency.

As a drive-by, simplify a type-trait: is_convertible_v<T, S> is true
whenever is_same_v<T, S> is, so we don't need to instantiate both.

Fixes: QTBUG-100144
Pick-to: 6.3 6.2
Change-Id: Ic6df43d96d9d168cc44c2949e41c5e490f4c50ce
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-24 09:37:54 +00:00
Axel Spoerl
5fa35c4f14 Add layout in QRadioButton baseline test for better visualization
Task-number: QTBUG-99749
Pick-to: 6.3
Change-Id: Iafd097d42b312cc24a60107c00e9c52fc0f3cdff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-24 05:57:37 +00:00
Fabian Kosmale
0842b01f02 QProperty: Work around constexpr issues on MSVC
MSVC complains about illegal uses of void, even though the code should
be guarded by an if constexpr statement.
 qproperty.h(85): error C2182: 'val': illegal use of type 'void'
 qproperty.h(92): error C2182: 'abstract declarator': illegal use of type 'void'

Avoid the issue by using a dedicated dummy type instead of void.

Fixes: QTBUG-100072
Task-number: QTQAINFRA-4242
Pick-to: 6.3 6.2
Change-Id: Idc4886c26c3794e709eb762ba836139f720f8133
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-23 23:11:50 +01:00
Marc Mutz
228b5dd074 QStaticByteArrayMatcherBase: make dtor protected
Base class dtors should either be public and virtual or else protected
and non-virtual.

We don't want to model polymorphy, so protected and non-virtual it is.

Pick-to: 6.3
Change-Id: I3c545b01c3ec831ee8b4a0c522501222a69923e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-23 09:48:34 +01:00
Marc Mutz
cce7e35253 Q(Static)ByteArrayMatcher: manage indexIn() overloads
Unlike QString and QStringView, QByteArrayView and QByteArray don't
overload well.

Solve the overload issue the usual way: by making the QByteArray one a
Q_WEAK_OVERLOAD. This is trivial for QStaticByteArrayMatcher, which
isn't exported, but require QT_REMOVED_SINCE magic for
QByteArrayMatcher, which is.

The additional const char* overload has shielded us from the worst
fall-out so far, it seems, but it makes for a truly horrible overload
set:

    matcher.indexIn(str, 3);

Q: Is the 3 here the length of the haystack or the value of the from
parameter?

A: It depends on decltype(str)!

If the (const char*, qsizetype, qsizetype=0) overload is the better
match, then 3 limits the haystack's length.

If, otoh, the (QByteArray(View), qsizetype) overload is the better
match, then it's the value of the from parameter.

As if this wasn't bad enough, QByteArray implcitly converts to const
char* by default!

A follow-up patch will therefore deprecate the (ptr, size) overloads,
so we de-inline the QByteArrayView ones to avoid having to touch the
implementation once more.

Found during 6.3 API review.

Pick-to: 6.3
Change-Id: I9640e0bdd298d651511adebcc85f314db9221d34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-23 09:48:28 +01:00
Marc Mutz
3d3558dc8f QStaticByteArrayMatcher: fix searching in 2+GiB haystacks
Add a test (same techniques as for the 4+GiB check in
tst_qcryptographichash).

Takes ~1s to build the 4GiB test data here, and skips
when RAM is too low:

  $ qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork
  [...]
  QDEBUG : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() created dataset in 891 ms
  [...]

  $ (ulimit -v 2000000; qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork)
  ********* Start testing of tst_QByteArrayMatcher *********
  [...]
  SKIP   : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() Could not allocate 4GiB plus a couple hundred bytes of RAM.
     Loc: [/home/marc/Qt/qt5/qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp(242)]
  [...]

Found during 6.3 API review.

[ChangeLog][QtCore][QStaticByteArrayMatcher] Fixed searching in
strings with size > 2GiB (on 64-bit platforms).

Fixes: QTBUG-100118
Pick-to: 6.3
Change-Id: I1df420965673b5555fef2b75e785954cc50b654f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-23 01:06:57 +00:00
Marc Mutz
3ec587666f QByteArrayList: optimize 32-bit builds of legacy join() helper
On 32-bit machines, qsizetype is int, so we don't actually need to
QT_REMOVE_SINCE the QByteArrayList_join() helper, because it didn't
change.

Thanks to Thiago for showing me the QT_POINTER_SIZE trick in a similar
change to QVersionNumber.

Pick-to: 6.3
Change-Id: Iae6e315107e42da51fcb4e7325b6d40b9c3fe0bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-22 13:08:05 +01:00
Volker Hilsheimer
902087a090 Revert "Offscreen: Implement QPlatformBackingStore::toImage"
This reverts commit 77895514d5419b77535de093b544aee30686cd22, which
is in principle correct, but results in XPASS'ing tests in qtdeclarative
that we need to adapt first.

Originally reverted only for 6.3, but now also in dev given the amount of
tests that have a QEXPECT_FAIL for the offscreen platform in qtdeclarative.

Change-Id: Ic914655c737c3b279c14a66220775f3c7a6cdab8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8498d1a14b5a8392ee6b50a87b82f9d85d13193e)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-22 11:30:13 +00:00
Marc Mutz
dd798220a0 QByteArrayList: micro-optimize join(QByteArray)
Null- vs. emptiness of the separator is not significant for join(), so
skip the isNull() check in the conversion ctor of QByteArrayView from
QByteArray by using the named conversion function that exists for this
purpose instead.

Pick-to: 6.3
Change-Id: I6ef07cc9bcc0bc8b87ecadc5cfaac9793cfb1b77
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-22 08:36:50 +01:00
Marc Mutz
31a39bd55d QByteArrayList: simplify the join() overload set already now
... instead of waiting for Qt 7.

Found in API review.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes]
[QByteArrayList] The join() overload set has changed. Code such as
qOverload<>(&QByteArrayList::join) will have to be rewritten,
e.g. using lambdas. We advise against taking addresses of library
functions other than signals and slots.

Pick-to: 6.3
Change-Id: I67449df9adc2efea7f1163034caa135f31f39e7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-22 04:12:48 +01:00
Patrick Stewart
806ba27419 qopengl.h: Move C header #include(s) out of the QT_NAMESPACE
The Clang backend of MSVC declares nullptr_t in namespace std there,
then expects to find it under ::std::nullptr_t to define a ::nullptr_t.
That breaks with a namespaced build, of course.

Fix by moving the QT_BEGIN_NAMESPACE to just before the first typedef
that declares a Qt-owned name.

Done-with: Marc Mutz <marc.mutz@qt.io>
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-95309
Change-Id: I56f2709c4664a7d0de84918f43b6d53cb3710612
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-22 01:57:49 +00:00
Marc Mutz
dc6453694e [doc] QStaticByteArrayMatcher: remove references to C++ < 17
This class is universally supported by all Qt6-capable compilers.

Pick-to: 6.3 6.2
Change-Id: Ib03ed8f73fe656e47f4d0f8f50c3a8ff95b6d8d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-21 23:43:17 +01:00
Thiago Macieira
2549f18995 QHash: rewrite the x86 aeshash function for len >= 16
The loop for 32 bytes is left unchanged, but the tail operation for 16
to 31 bytes is replaced with an overlapped load-and-scramble. This
should make the operation even faster.

Also updated the key creation back to something similar to what Go does.

This massively improves performance as well as the bit spread. Histogram
for the bits in the hash value for the testcase from QTBUG-91739:

|| Bit || Before ||     After ||
| 0 | 35.0300%   |   50.4800% |
| 1 | 42.5250%   |   50.2400% |
| 2 | 46.0100%   |   50.0000% |
| 3 | 67.5150%   |   49.9400% |
| 4 | 56.5150%   |   50.0000% |
| 5 | 51.9950%   |   50.0000% |
| 6 | 58.9800%   |   50.1400% |
| 7 | 55.9550%   |   50.0000% |
| 8 | 41.9850%   |   49.9200% |
| 9 | 69.9700%   |   49.6400% |
| 10 | 68.4950%  |   50.0000% |
| 11 | 37.4950%  |   50.3000% |
| 12 | 61.9950%  |   49.8200% |
| 13 | 53.4900%  |   50.0000% |
| 14 | 63.0200%  |   49.9800% |
| 15 | 54.9700%  |   50.1000% |

Task-number: QTBUG-91739
Pick-to: 6.2.3 6.2 6.3
Change-Id: Icad7c1bad46a449c8e8afffd16cb7fe7ffd3584f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-01-21 14:08:01 -08:00
Thiago Macieira
b5d480d01d QHash: fix iteration of x86 AES hash code for len >= 32
[ChangeLog][QtCore][QHash] Fixed a bug in the qHashBits() function,
which affected the hashing of QByteArray, QString (and their View
classes), QLatin1String and QBitArray, which caused the hash to not
include the final 32 bytes of the data source. As a result, QHash
containers where the initial string was the same had a serious
performance degradation on x86 CPUs with AES support.

Fixes: QTBUG-91739
Pick-to: 6.2.3 6.2 6.3
Change-Id: Icad7c1bad46a449c8e8afffd16cb74dd43440f6c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-21 14:08:01 -08:00
Thiago Macieira
517821b173 QHash: improve aeshash's page detection code
We don't need to test for actually crossing a page boundary. It suffices
to check if we're in the upper half or the lower half of the page. In
the upper half, we load ending at the end; in the lower half, we load
starting at the current position. This way, it can never crash.

Pick-to: 6.2.3 6.2 6.3
Change-Id: Icad7c1bad46a449c8e8afffd16cb743e622b3405
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-21 14:08:01 -08:00
Marc Mutz
e1654aeb2e QStaticByteArrayMatcher: add a useful comment
Took me a few seconds to figure this out, and I'm the author of the
class, so leave a comment for my future self (and anyone else).

Pick-to: 6.3 6.2 5.15
Change-Id: I65a7aa6f8abf9d671f7d9ba45400f19e0f46728f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-21 20:45:11 +00:00
Edward Welbourne
6db1284de9 Use Q_INT64_C() to express qint64 constants
When int is 32-bit, 0x80000000L is int-min, and (consequently)
negating it makes no difference, so MSVC warns about this. Instead of
using an L suffix, wrap the constant in Q_INT64_C(). Do the same for
similar large constants in the same block.

Pick-to: 6.2 6.3
Change-Id: Ib371b932792f170ab7db2e472a4283df3a205af3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 21:45:11 +01:00
Marc Mutz
e7115b7530 QStringConverter: use QStaticByteArrayMatcher
The Boyer-Moore tables can be calculated at compile-time, and the
needles are long enough to make skipping worthwhile, even for small
haystacks.

Pick-to: 6.3
Change-Id: I3237812490367ed0491eb8d1667c6da67f38c517
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-21 21:45:11 +01:00
Marc Mutz
f091f371c4 QByteArrayMatcher users: use the new QByteArrayView overloads
The new overloads mean that when passing QByteArrayView or
QLatin1String objects, we don't expand them into .data() and
.size() anymore.

Pick-to: 6.3
Change-Id: I0c898e0463d0bf81ce1f7d57e10e64f23bd84587
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-01-21 20:11:32 +00:00
Alexandru Croitor
a585ce7056 qmake: Allow using Windows 10 API in MinGW qmake internal projects
When trying to build qt3d examples with qmake and MinGW in the CI,
compilation would fail with errors like

 In file included from
 C:/MINGW1120/mingw64/x86_64-w64-mingw32/include/windows.h:72,
 from C:\Users\qt\work\qt\qt3d\examples\qt3d\simple-cpp\main.cpp:63
 include/winuser.h:2965:72: error: 'POINTER_INPUT_TYPE' was not
 declared in this scope

What happens is that calling qmake on examples.pro loads
qt3d/.qmake.conf, which then loads qt_build_config.prf which then
defines the following definitions:

 mingw: DEFINES += WINVER=0x0601 _WIN32_WINNT=0x0601

This limits usage of Windows API up to Windows 7, with later APIs
being unavailable.

Most .qmake.conf files were removed in qt repos, but We didn't remove
the .qmake.conf file (fb656c036d) for
qt3d because it's supposed to be buildable with CMake + Qt 6 as
well as qmake + Qt 5.

Bump the defines to the same Windows 10 version we use everywhere else
when building with CMake.

Amends 6652bf2353
Relates to d57a7c4171
Relates to fb656c036d

Pick-to: 6.2 6.3
Task-number: COIN-762
Task-number: QTBUG-92271
Change-Id: I833dfb6b0832d90a76d05ea14cd3807cb0d67ca9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-21 19:55:27 +01:00
Joerg Bornemann
eced23b6a8 Don't set CMAKE_AUTORCC in pro2cmake.py
To tool generates calls to qt6_add_resources instead, and we don't want
to promote the usage of CMAKE_AUTORCC.

Task-number: QTBUG-87643
Change-Id: I58458416514949a6ffc9b93c7eb6d24bc2ed01ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-21 19:54:13 +01:00
Joerg Bornemann
dc2c590b1a pro2cmake: Fix exception with newer pyparsing module
The pyparsing module's debug action properties have been renamed.
Check the existence of the attributes before assigning.

Change-Id: I8fff652304a0af215c56f54b63d613a1f6a5207a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-21 19:54:13 +01:00
Volker Hilsheimer
dd3ea45c23 Remove flaky and duplicate animateClick tests
The animateClick method is a QAbstractButton member, and neither
QCommandLinkButton nor QPushButton override it. The method is tested in
the QAbstractButton test, and 3a9b7d1f18648d7236664d3adfc65c009b01e668
made that test more robust. The previous, flaky version of the test was
almost duplicated here. They add no additional code coverage, so remove
them.

Pick-to: 6.2 6.3
Change-Id: I1fa988c1eabd5054193acb1f5fa1c81d29b3878d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-01-21 18:53:34 +01:00
Sona Kurazyan
e502906305 Add a note for making ResultStoreBase's internal members private
There's no class inheriting from ResultStoreBase (and likely won't be),
so the destructor was marked to be made non-virtual in Qt 7. For the
same reason, the internal members don't need to be protected, and the
class shouldn't have "Base" in its name. Add a note about it.

Task-number: QTBUG-99883
Change-Id: I00d7a96d99d2c326d29bd421235a15d68b4d4e5c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-21 16:38:24 +01:00