When debugging a spurious failure it's extremely useful to
run the test repeadtly into a debugger until a failure appears.
When that happens, one wants to immediately start debugging.
In so far, this has only been possible by placing breakpoints
inside Qt itself (when a failure is logged). Add another way:
an env variable, similar to QT_FATAL_WARNINGS, that makes
any failure fatal (terminate() gets called. Bonus: you can
control the termination handler!)
[ChangeLog][QtTestLib][QtTest] When the QTEST_FATAL_FAIL
environment variable is set to a non-zero value, a test
immediately aborts its execution. This is useful to debug
intermittent failures.
Change-Id: If2395f964ea482c30b8c8feab98db7fdee701cd3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
With this we can avoid leaking the QInputDevice which is created when
the platform plugin does not provide any. The onwership is solved in a
similar way as in the plugins, except that here we have no parent which
really fits, so we use QCoreApplication::instance instead.
Pick-to: 6.0
Change-Id: I77a212fb592ba3d5a42b2ecd486763e3b4d3410e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The AES and SHA features were checking for the wrong TEST_subarch_foo
variables.
Pick-to: 6.0
Task-number: QTBUG-87376
Change-Id: I46cd14d98832529aebac22cfcb01180330c5e091
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The source permissions are transferred when using configure_file for
non-prefix builds. This allows running qt-cmake-standalone-test in
both non-prefix and prefix builds.
Change-Id: I38829901d0bd4dfc4b89c665169798052b218fb0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Just like it was done in the .pro file.
Pick-to: 6.0
Change-Id: I7def52127f4bab6f0ef490ac7eee2de2da479352
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Following a41c61fb2d QIODevice may try to
copy the QByteArray itself (rather than the data it points to). This can
lead referencing dangling data when the QByteArray is initialized with
raw data.
Pick-to: 6.0
Change-Id: I481695b33f251f750ef482d72b81636f0d4bf462
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If a QBindable is created from a computed property, it is not possible
to actually set a value or a binding. If we try to do it anyway, we'd
get a crash. Thus we now check whether the function pointer is null
before invoking it.
Pick-to: 6.0
Task-number: QTBUG-87153
Change-Id: I5bedb9080ccf79d9b8166b80d5733d095ed76f8d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Since API 29 functions:
- getExternalStoragePublicDirectory
- getExternalStorageDirectory
are deprecated and no longer return directly accessible path.
This patch replaces calls to those with suggested call to
Context.getExternalFilesDir(String)
Task-number: QTBUG-87803
Pick-to: 5.15 5.12 6.0
Change-Id: I36bc5d5b72a80017996445af0d577aacf5e112d3
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Since Q_COMPILER_ATOMICS is defined for every supportied MSVC compiler
in qcompilerdetection.h, qatomic_msvc.h is not included anymore in
qbasicatomic.h and can be removed.
Change-Id: I6505da5d5e9f1c3f9a060ad30cabb4b652634aa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The conversion operator from QPMI to QModelIndex should return by
value, to hide implementation details and so that we don't have to
rely on a static empty QModelIndex.
Change-Id: I92b3f8451422f2b69bf31f28b387a124fd24ec46
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 0cd2935ed9d772f0eb06d03201baabd60764ec80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The hash and equality operators used need to be consistent with
each other. Unfortunately, QPMI::operator==() is not suitable to do
this. So specialize qHashEquals() for QPMI.
Fixes: QTBUG-88966
Change-Id: If5f19a722ae9fc4e78e93537e7ea15726f148768
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 83e95956ed58e88b11e2cc3cb61c5beacb7985db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
In some cases, the default equality operator for a class is not suitable
for using in hashing (for example because it uses fuzzy comparisons).
Add a qHashEquals() method that by default uses the equality operator, but
allows to tailor the operations that should be used when using the class
as a key in QHash.
Task-number: QTBUG-88966
Change-Id: I346cf0e6e923277a8b42a79e50342a1c2511fd80
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5d8b586e73e37070b0303bee24372550854637eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The qmake build system defines _CRT_SECURE_NO_WARNINGS in
mkspecs/features/qt_module.prf, the cmake build system should do the
same thing in qt_internal_add_module().
Adding this definition can avoid warnings like:
warning C4996: 'strncpy': This function or variable may be unsafe.
As a special case, Bootstrap uses add_library() instead of
qt_internal_add_module(), so _CRT_SECURE_NO_WARNINGS should also be
defined in src/tools/bootstrap/CMakeLists.txt.
Pick-to: 6.0
Change-Id: Ic82193d177f82785fd84948efa78c49ca8d8db46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
I'll preface by saying, it's not clear to me why the behavior is
different.
Our qt_run_config_test_architecture function builds a target
executable, and then uses file(STRINGS) to try and parse out some
magic strings that we expect the executable to have (architecture,
abi, etc).
In qmake this was done by matching with a regular expression ending on
a \\0 null byte character.
In CMake, we do a string(FIND) and string(SUBSTRING until the end of
the line) on a *line* returned from file(STRINGS). Notably, I did not
find any regexp syntax provided by CMake to try and match a null byte
character.
Note the docs for file(STRINGS) implies to me that *lines* are
detected by looking for newline characters '\n'. The docs also
mention that binary data in the file is ignored. What's binary
data though?
If you open the executable with a hex editor, at least on macOS, the
strings we are interested in are indeed separated by null byte chars,
not newline chars.
On most platforms file(STRINGS) did end a line on the null byte
character.
Except, for some reason not when building Qt for the oss-fuzz project
with clang under Docker.
Calling message() on one of the lines prints a very long string with
null characters seemingly replaced with semicolons, and of course the
matched architecture string is wrong and fails configuration.
For *some reason*, if I add a "REGEX ==Qt=magic=Qt==" option to the
file(STRINGS) command, the captured output lines don't contain
semicolons even when building for oss-fuzz.
The extracted strings are then correct, and configuration succeeds.
Use the REGEX option workaround, with the aim to quickly fix Qt
building for oss-fuzz for 6.0.1 release.
Pick-to: 6.0
Fixes: QTBUG-89047
Change-Id: Iad11c1090c1187aadd39082f196050bf3290df95
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Amend 53b7cb1bd7, match() is only used
to provoke data races.
Change-Id: Id20b11fedf7f20e74baab15bbb60c995c1a0c794
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The usual behavior for env variables is that any nonzero
value means "enable", so do the same for a couple of QTestLib
env vars. While at it: document them.
Change-Id: I854285df5d7af5be771f9d6532ddec5d8a6f8987
Pick-to: 6.0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
It was previously untested
Task-number: QTBUG-88183
Pick-to: 6.0
Change-Id: Icc59fc632957a75cac8c7f5e2a1aed88a1c9ff9d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The test in general is fine, but it was making an assumption that the
first 5 readyRead emissions would never result in the whole message
being received. In certain scenarios with slowdown however it was still
possible that we would receive the whole message after just a few
readyReady emissions. While I didn't check it's most likely due to a
mechanic in the QNetworkReply machinery where we suppress some
emissions if we know there's more data just about to be available.
Task-number: QTBUG-88943
Change-Id: I0cf06edb34d4e86cc8a42c0f1cd7e8c35765f6ee
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It's not _wrong_ to time out when connecting to something unreachable
(it's just a different way of handling it) so we shouldn't fail when
this happens either.
In local testing (windows) it times out after 8 seconds, so bump
the timer to 10 seconds. On systems where it's faster there'll be
no difference as long as things don't go wrong.
Pick-to: 6.0
Fixes: QTBUG-89089
Change-Id: I8437cf8e4fbecedea2391ed87fdce1213085b964
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Use number-based naming of object libraries produced for generated
resources. This reduces path length of subdirectories for object
library targets.
Amends 08eb485a006dc2baca42eb280ae60e9f0fc00dff
Pick-to: 6.0
Change-Id: I1a449290e8a9b969601a1cc1abc6fdcfc0cd9454
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Documentation of QStringTokenizer was broken, mainly because most
parts of the interface were defined in base classes. This patch
gets those members into QStringTokenizer itself in order to document
them.
Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: Id00a79db4b293958a9c5ed53a518a97721d228c0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The method QApplication::desktop() was removed. This patch removes
a line mentioning it in the documentation.
Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: I123e41c342d64da347b9bd59378e52a8e0301c1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation of ignorePunctuation in QCollator did not strictly
follow conventions, leading to warnings in building the documentation.
This patch fixes this.
Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: Ia1273ec8e440099afe729b54423760ad5ac26290
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QMake libraries that contain dashes are referenced by QMAKE_USE as is,
but the corresponding QMAKE_LIB_<NAME> variable must be normalized to
contain underscores.
Example from the qmake build:
./mkspecs/modules/qt_lib_waylandclient.pri
11:QT.waylandclient.uses = wayland-client xkbcommon wayland-cursor
./mkspecs/modules/qt_lib_waylandclient_private.pri
12:QMAKE_DEPENDS_WAYLAND_CURSOR_CC = WAYLAND_CLIENT
13:QMAKE_DEPENDS_WAYLAND_CURSOR_LD = WAYLAND_CLIENT
15:QMAKE_LIBS_WAYLAND_CURSOR = -lwayland-cursor
Pick-to: 6.0
Change-Id: If31bd45764d52f97d80d6388503008dc1ffb16ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The enumeration value was deprecated by
qtbase/f15aa1fd84e46dfc4d9a78b3a7ba482e42abd9c1 and removed in Qt 6.
Pick-to: 6.0
Task-number: QTBUG-89093
Change-Id: Iaf46adc1e1bd79e4aaab066c9fa4bf84a8ee34d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
moc's preprocessor needs to implement certain math operation to
correctly handle #if conditions. Unfortunately, its implementation is
not overflow safe. However, those are rare enough in practice that we
in general do not need to care about them.
This patch adds a workaround for one case where UBSAN run into an
overflow related issue.
A complete fix would require to make moc spec compliant (do math with
std::max_(u)int_t operands; always wrap on overflow) in all operations.
Pick-to: 6.0 5.15
Fixes: QTBUG-88825
Change-Id: Ic4d2cb097db2fa2f9d4681bbaab3068eaa2745aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We should return the result of the call of the base implementation for
all events that we did not handle. Also, QObject::event() does not
actually activate any filters, so the comment was inaccurate as well.
Change-Id: I9eb2f9a93a6b53a1afd035433615bcc0ee8cbf2c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Merge the exact and and fuzzy search loop. This way we prioritize
translations which match a more preferred language loosely over ones
which match a less preferred language exactly. This is likely what
most users want.
Pick-to: 5.15 6.0
Fixes: QTBUG-86179
Change-Id: Id1610c82a2e77edf9a5d4417968dcc4c307810d5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Just to be consistent with everything else.
Change-Id: I48ceb4bbc1cbf65b03caee77b7405cb585793248
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The codepath using unordered_set forced the usage of std::hash,
which isn't provided by many Qt types. Instead, use the
brand new helpers in QHash that dispatch to qHash with a fallback
on std::hash.
Change-Id: I9185fe9c52de05c470afe7466007591977e65bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When matching over a QString we store a (shallow) copy of it.
That has always been an implementation detail and people should've
never relied on it, but Hyrum's law, we don't want to actually
exploit this by NOT taking the copy.
Converesely, matching over QStringView already requires that
the string data is kept alive as long as QRE(Match) objects
are alive.
Add a doc note to give us the freedom to do the change in Qt 7.
[ChangeLog][QtCore][QRegularExpression] QRegularExpression takes
a shallow copy of a QString subject when matching over it. This
means that users can destroy or modify the string data while
still having match results over it. This behavior is deprecated;
in a future version of Qt, QRegularExpression will no longer
take a copy. Note that behavior has always been undocumented and
users were never supposed to modify a subject string while
match objects were alive on it. In practice, it's very unlikely
that your code is relying on the existing behavior.
Change-Id: Ibc5f900c09a007139fb12fc4d7f11e4a8f31bf38
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The situation was quite inconsistent. Use the attribute more.
Change-Id: If21817b4c2ea1148ad4ad80e7a50fab721a58b65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unlike QWidget-based application, a dialog displayed in QML app doesn't
have QWidget parent, so it would be centered in the current screen.
Let's fall back to transient parent window if widgetParent() is missing.
It's tempting to rewrite adjustPosition() to not depend on QWidget at all,
but that seems not easy. Lookup path of window() and transientParentWindow()
is slightly different for example, and QWidget::pos() is used instead of
mapToGlobal({0, 0}) if the widget is embedded into a native window.
Fixes: QTBUG-63406
Change-Id: If72d90aee8d972240243184de4d3c09d77f704ff
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Add test for qRound that covers some edge cases for rounding. Note that
as of right now, this test fails and the docs have been updated to warn
that it should not be depended on for strict correctness.
Change-Id: I1a61bca47abd77855fe7c13ded44e913cc7e8722
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Documentation for QSet::insert was wrong, leading the warning
qset.qdoc:510: (qdoc) warning: clang couldn't find function when parsing
\fn iterator QSet::insert(const_iterator it, const T &value)
This patch fixes it.
Task-number: QTBUG-88533
Change-Id: I587cbae5674b9f38e37753a20c3c3f0d770980d6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When QMultiHash derived from QHash, it inherited the clear function
and no separate documentation was necessary. Now, QMultiHash::clear
needs its own documentation. This patch adds it.
Task-number: 88533
Pick-to: 6.0
Change-Id: I93c59b66aa3d8ccf1888b6e24a4cc47004318e37
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Which contains a lot of 'macos'/'osx' black-listed auto-tests. They
mostly fail with SecureTransport (on BigSur) because SecTrustEvaluate()
does not like our old certificate. Instead, since SecureTransport
is deprecated anyway and we are not planning to develop it in future,
skip the related auto-test depending on QT_CONFIG(securetransport).
Task-number: QTBUG-88943
Change-Id: I5f6cb7b2d0ea15c445603c1ff3e1700f123c28d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It was blacklisted due to the issue there. The issue is resolved, but
the blacklist stayed.
Task-number: QTBUG-88943
Change-Id: I7d9a660a17c1463dd8b654752ed5787fe5f5af24
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Which is probably the direct port of -nomake XXX, as qmake
always offered the way to build tests/examples/etc. after
configuring without, while cmake doesn't.
Pick-to: 6.0
Change-Id: I85b039e56cde3ddfaf661385100d3c3a8cc2ac16
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If the first font in the families list happens to have been
disambiguated because of duplicates, two things went wrong:
1. hasFamily() would return false for the font family, because
it does not disambiguate when checking for the family name and
only checks if the families list contains the exact string.
2. Adding aliases to the full disambiguated string is not supported,
only the family name.
The first issue has been reported separately as QTBUG-89068.
The test failure is fixed by just avoiding the fonts that
are ambiguous in the test, as it really doesn't matter which
font we pick.
Fixes: QTBUG-89008
Pick-to: 5.15 6.0
Change-Id: I829778c2e7bb6090475c34dcf9cdce58862729d6
Reviewed-by: Liang Qi <liang.qi@qt.io>
Use a trick similar to the one we use for their ranged
constructors: support predicates that either take a
container's iterator, or that take a std::pair (for STL
compatibility).
[ChangeLog][QtCore][QMap] Added removeIf() and erase_if().
[ChangeLog][QtCore][QMultiMap] Added removeIf() and erase_if().
[ChangeLog][QtCore][QHash] Added removeIf() and erase_if().
[ChangeLog][QtCore][QMultiHash] Added removeIf() and erase_if().
Change-Id: Ie40aadf6217d7a4126a626c390d530812ebcf020
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The scope of the variable 'frm' can be reduced if the variable
'd->formatExplicitlySet' is true. So declare the variable when
the variable 'd->formatExplicitlySet' is false.
Change-Id: I27cea412af827d30ad9188106b7f14025e5ddb68
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>