Commit Graph

55545 Commits

Author SHA1 Message Date
Ivan Solovev
5133ed072a Android: skip crashing tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow
The test crashed for some reason, so other testcases are also not
executed. Skip the test for now to enable more tests in the CI

Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I5ad38645d1b8f86c64da7208c0ae4f66d126c7d9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Ivan Solovev
79dcb2657c Android: unblacklist tst_QPlainTextEdit tests
Most of the blacklisted tests were already fixed earlier.

The tst_QPlainTextEdit::adjustScrollbars() test needed a small fix
to show the window non-fullscreen, so that the scrollbar could appear.

Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3
Change-Id: I849f411a5798053742323fc4db3fe30f2b690a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Pasi Petäjäjärvi
e0023ae353 Revert "Workaround MinGW not handling error suppression macro correctly"
This reverts commit 293b7fab55.

Reason for revert: Since Qt 6.2 MinGW 8.1 is not anymore supported

Pick-to: 6.2 6.3
Change-Id: I9b2e5e08bee663d5289a69218493911544671e79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-04 20:16:06 +00:00
Tor Arne Vestbø
b5144d2722 Update QFileInfo docs to mention macOS aliases
The LegacyLinkType reflected by isSymLink() includes
QFileSystemMetaData::AliasType.

Pick-to: 6.3 6.2 5.15
Change-Id: I98c84573f7f05d6d183b6ce1e22fc7424ed8e730
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-04 20:13:09 +01:00
Marc Mutz
1775029c9b Prepare for QByteArrayView number parsing modernization
Remove the unholy bool out parameter and make QtPrivate::to{Double,
Float,{Signed,Unsigned}Integer}() return a struct instead.

The struct contains what we'll most likely need for a full
QParsedNumber in the future: the value, an error code (always zero
atm), and a pointer to the first character that wasn't parsed (always
nullptr atm), so we don't need to change the ABI when QParsedNumber
eventually lands.

As an immediate positive contribution, even without the backend ported
away from bool out parameters, the functions can now be marked as PURE
and, in case of the FP versions, also noexcept (the int versions have
a narrow contract d/t the base argument, which, unlike the return
value, can be fixed later, by overloading).

Pick-to: 6.3
Change-Id: I67945af80a9b53d6f170502a6df3384895e82d3e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 19:49:15 +01:00
Marc Mutz
1931689c7d tst_qstringapisymmetry: check QString/QAnyStringView overloads w/Q_WEAK_OVERLOAD flipped
This overload set may come in handy to cushion some of the concerns
regarding replacing QString functions with QAnyStringView ones.

Overloading with a Q_WEAK_OVERLOAD QAnyStringView function requires
users to jump through hoops in order to avoid the QString overload,
but with the Q_WEAK_OVERLOAD roles reversed, the QAnyStringView
overload becomes the preferred version, relegating the QString
overload to a fall-back to facilitate sharing where it makes sense
(e.g. for QObject::setObjectName()).

Pick-to: 6.3
Change-Id: Ic65ead505beee627976a306e2d430e800540a600
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-04 08:39:07 +01:00
Giuseppe D'Angelo
400867693b QCryptographicHash: code tidies
Rename the resize() function of its internal buffer into the possibly
better resizeForOverwrite(). The point is that unlike an ordinary resize
the data in the buffer is NOT initialized, and therefore must be
overwritten by the caller, "or else".

Change-Id: I7d82821e92f59f7eeab18c51d98003826ffe164b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2022-03-04 04:46:47 +01:00
Sona Kurazyan
ebfe4318b8 Fix tst_qstringapisymmetry::count* to test all argument combinations
Use two template parameters for the haystack and needle types, to test
all possible combinations of all argument types.

Note that the tests for QByteArray::count() are removed: it doesn't
make sense to have them in tst_qstringapisymmetry, and we already have
the symmetry tests for QByteArray in tst_qbytearrayapisymmetry.

Change-Id: I33901fd135eb7433f0d45300a7248aef4d40324a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 04:05:12 +01:00
Sona Kurazyan
b8755e2a4d Fix an error in tst_QStringApiSymmetry::count_impl()
Don't use the haystack as needle when testing count() for QLatin1String.
This wasn't caught earlier, since QLatin1String has no count() yet, and
the codepath was never tested.

Pick-to: 6.3 6.2
Change-Id: I2764070894ddce047eceaea52456e5a521252dab
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-04 04:05:12 +01:00
Thiago Macieira
0c3ac95899 Logging: use GCC #pragma to suppress the frame pointer
We have a few lambdas now. However, GCC probably inlines everything
anyway in release mode, so this is likely moot.

Change-Id: Ic15405335d804bdea761fffd16d50573621446ab
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:12 -08:00
Thiago Macieira
bd728d1149 Logging: cache the last library file name in a backtrace
They usually come in groups, so this avoids extra work.

Change-Id: Ic15405335d804bdea761fffd16d4fb5c41e122f0
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
ff2535de5c Logging: add support for decoding backtraces using dladdr()
I'm pretty sure that's what backtrace_symbols() uses internally anyway,
so skip the middle-man.

Change-Id: Ic15405335d804bdea761fffd16d4fb2a1b0c2171
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
1cad4ed6a1 Logging: reorganize the backtrace code for simplicity and readability
Also removed the Qt::CaseInsensitive searching, which was slow.

Change-Id: Ic15405335d804bdea761fffd16d4f863847c360b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
ee7166e176 Logging: remove magic constant from backtrace code
Explain what that number 8 is by way of a comment and a constant.

Pick-to: 6.2 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f7567089c575
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
6358bc9331 Logging: rejiggle the way we detect the availability of backtrace() API
We had proper CMake tests for all we needed, so we can drop the old
detection we were forced to use way back when. Said test (CMake's own
FindBacktrace.cmake) even found QNX's offering, which we reported as
"yes" in our configure output, but never actually used because it was a
different API. Now we'll report "no" for QNX.

Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f73cfe4cf38a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
50132fb54b Logging: fix encoding of backtrace lines
File and function names are UTF-8 on Unix.

Pick-to: 6.2 6.3
Change-Id: Ic15405335d804bdea761fffd16d4fb71ec2b0d71
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Ivan Solovev
d589f3eefe Android: unblacklist tst_toolsupport::offsets
The test is no longer failing on Android in dev and 6.3, but still
failing in 6.2.
I think it's fixed by 63a35898f4
which is integrated into dev and 6.3

Task-number: QTBUG-87396
Pick-to: 6.3
Change-Id: I82e0aac1547f8e43353f0948cd3f91b4b8f9720e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:11 +01:00
Ivan Solovev
79fb80152f Android: make sure that orientationChange is reported after resize
On Android orientation changes are reported from the
DisplayListener.onDisplayChanged() method, while the screen size
changes are reported from QtLayout.onSizeChanged().
In practice these callbacks come in random order, so rotating the
screen multiple times might result in inconsistent order of signals
and events.

This patch makes sure that size change events always happen before
orientation changes. This is done by caching the new orientation
values and reporting them only when needed. At this point we also
need to use QMetaObject::invokeMethod() for orientation change,
like it is done for geometry change. Otherwise the orientation
update can still be processed earlier than the geometry change.

Also note that at some point we might get an orientation change
without a size change (for example Qt::LandscapeOrientation ->
Qt::InvertedLandscapeOrientation). That is the reason for
isSimilarRotation() helper function.

As a drive-by: ignore size changes with inconsistent values when window
size is reported to have old orientation, while the screen has already
been rotated. In such cases a new size change will be triggered shortly
with normal value.

Task-number: QTBUG-94459
Pick-to: 6.3 6.2 5.15
Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:11 +01:00
Ivan Solovev
285ea13286 Android: set all QScreen's geometry-related parameters together
Screen has 3 parameters:
- physical size
- screen size (or screen geometry)
- available geometry

Before this patch, they were reported in 3 different methods. Screen
size update and available geometry update both were generating the
"screen geometry changed" event, that updated the user-visible
parameters. As a result, at some point we could end up in an
intermediate state, when screen size was already updated, but
available geometry was not yet updated.
This was specially visible while changing the screen orientation:
at some point screen geometry could be reported for the new
orientation, while the available geometry - still for old orientation.

This patch introduces a new method to set all geometry-related
parameters together and generate only one "screen geometry changed"
event. This allows to maintain consistency between 'geometry' and
'availableGeometry' properties of QScreen.

Task-number: QTBUG-94459
Pick-to: 6.3 6.2 5.15
Change-Id: I844f6d0db87df8d5e6e9bcce5d27126384a5a0de
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:10 +01:00
Alexandru Croitor
eec317a138 CMake: Generate wrapper shell scripts for all hosts when requested
This is useful for Qt for Android builds, where we want to build Qt on
a single host, but make the Qt installation usable on any host
(Windows, Linux, macOS).

There are only two flavors of shell scripts, unix ones that use sh and
Windows batch files.

If Qt is configured with
-DQT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS=ON
then we generate both of them regardless of the current host platform.

Note that the target_qt.conf file still needs to be patched to specify
a correct HostSpec value so that qmake operates correctly.

Other target_qt.conf values might also need path adjustments depending
on use case (like HostPrefix and HostData).

Pick-to: 6.2 6.3
Task-number: QTBUG-101357
Change-Id: Ic86caaa8b318467528cc82dc7fbfecde998cdb71
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-04 01:58:10 +01:00
Sona Kurazyan
e440fec7fc Add literal operators for QLatin1String and QLatin1Char
The operators are declared in the Qt::Literals::StringLiterals
namespace, to avoid collisions in the global namespace.

[ChangeLog][QtCore][QLatin1String] Added literal operator""_L1 that
converts string literals and chars to QLatin1String and QLatin1Char.

Fixes: QTBUG-98434
Change-Id: Ia945a6acf4b8d4fbbb5f803264e4d79d7b17a8da
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-03-04 01:58:10 +01:00
Giuseppe D'Angelo
d45d62f09d QBitmap::fromPixmap: document \since
Change-Id: Ia8b4e20dc98e3b184b6e2ba9844907f813dbc1ab
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-04 01:58:10 +01:00
Magnus Groß
3c6b61a6e1 xdgdesktopportal theme: Implement appearance()
We can use the new org.freedesktop.appearance color-scheme setting in
the XDG Desktop Portal Settings to implement this in a DE-independent
way.

In the future we can also use the related "SettingChanged" signal in the
Desktop portal to support changing the theme during runtime.

Useful links:
Spec: d7a304a006/data/org.freedesktop.impl.portal.Settings.xml (L33-L45)
Blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Task-number: QTBUG-93955
Pick-to: 6.2 6.3
Change-Id: Ia5df22fb215ee94d68d2787da97a1c9f8f2c6b0c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-03-04 00:58:10 +00:00
Giuseppe D'Angelo
742ffd0f47 QDebug: streamline (private) formatQFlags
The implementation for extracting a QMetaEnum from an enumeration
type was duplicated from QMetaType::fromEnum, just use that one.
Also add an explicit cast for the valueToKeys call.

Change-Id: I51b1a214dbab2101ae704954727acf0219eb1604
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-04 01:26:53 +01:00
Marc Mutz
e93bf391fa Fix QTest::toString() over QT_TYPESAFE_FLAGS QFlags
QT_TYPESAFE_FLAGS allows explicit casts only to QFlags<T>::Int, which
is either int or unsigned int. The cast to the resp. other type fails.

To fix, first convert to QFlags<T>::Int with toInt(), and only then
cast to int or unsigned int.

Fixes: QTBUG-101399
Pick-to: 6.3
Change-Id: Ie74d53adc601cdf19708265b040092780676058f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-04 01:26:53 +01:00
Thiago Macieira
8e56a7bc6b qsimd.cpp: don't disable SSE FP math
Lowering the architecture all the way to the i386 baseline without SSE2
was causing warnings about disabling SSE FP math. We don't need to go
that low for 32-bit.

Task-number: QTBUG-101198
Change-Id: Ibf4acec0f166495998f7fffd16d682d0f5beec11
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-03 15:44:54 -08:00
Thiago Macieira
e8d3cf0909 qsimd.cpp: fix _FORTIFY_SOURCE=2 builds
That option makes printf() and some other functions become always_inline
functions with extent checking. Unfortunately, that also means GCC fails
to inline them when we're not compiling for the same target as
X86_BASELINE.

Fixes: QTBUG-101198
Change-Id: Ibf4acec0f166495998f7fffd16d682c7a7be94d8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-03 15:44:54 -08:00
Alexandru Croitor
7b94f87689 coin: Ensure we configure repos with CMake verbosity set to STATUS
We set the default verbosity of configure output to NOTICE in
regular Qt builds.
To preserve the STATUS verbosity in CI runs, we now pass it
explicitly when configuring all repos / tests.

Pick-to: 6.2 6.3
Change-Id: Ib63739c05855cfd5951d38ce3f8a7fc8d1218cd3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-03-04 00:21:44 +01:00
Alexandru Croitor
e2a0ddbb69 CMake: Make configure less verbose by default
Only show the more verbose configure output when configuring
with -developer-build (which matches --log-level=STATUS)

Otherwise in a non-developer build, restrict the output
to NOTICE+ message (includes WARNINGs and ERRORs).

Developers can still pass a custom log level when configuring.
For example -DCMAKE_MESSAGE_LOG_LEVEL=STATUS or
--log-level=STATUS.
The former method will be cached, while the latter is only applied
to the current configure invocation.

Also show the build instructions hint message only when configuring
for the first time.

[ChangeLog][CMake][configure] The configure output verbosity of
non developer-builds of Qt is now reduced by default. Pass
"-- --log-level=STATUS" to configure to make it verbose again.

Pick-to: 6.2 6.3
Change-Id: I7583a9c92142e0b1d7c5411b06403f40d8ebaf20
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-03-04 00:21:44 +01:00
Giuseppe D'Angelo
0deff80eab Associative containers: add a way to obtain a key/value range
Our associative containers' iterator's value_type isn't a destructurable
type (yielding key/value). This means that something like

  for (auto [k, v] : map)

doesn't even compile -- one can only "directly" iterate on the
values. For quite some time we've had QKeyValueIterator to allow
key/value iteration, but then one had to resort to a "traditional" for
loop:

  for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i)

This can be easily packaged in an adaptor class, which is what this
commmit does, thereby offering a C++17-compatible way to obtain
key/value iteration over associative containers.

Something possibly peculiar is the fact that the range so obtained is
a range of pairs of references -- not a range of references to pairs.
But that's easily explained by the fact that we have no pairs to build
references to; hence,

 for (auto &[k, v] : map.asKeyValueRange())

doesn't compile (lvalue reference doesn't bind to prvalue pair).
Instead, both of these compile:

  for (auto [k, v] : map.asKeyValueRange())
  for (auto &&[k, v] : map.asKeyValueRange())

and in *both* cases one gets references to the keys/values in the map.
If the map is non-const, the reference to the value is mutable.

Last but not least, implement pinning for rvalue containers.

[ChangeLog][QtCore][QMap] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiMap] Added asKeyValueRange().
[ChangeLog][QtCore][QHash] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiHash] Added asKeyValueRange().

Task-number: QTBUG-4615
Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 00:21:44 +01:00
Edward Welbourne
dd5fc20e90 Minor clean-ups noticed during string-parsing improvements
Simplify a conditional to save some repetition, purge some spurious
parentheses.

Change-Id: I727d22ce81733e765c4ee951475ccdb599063399
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 18:50:59 +01:00
Edward Welbourne
9c58870423 Correct some typos and flat-out falsehoods in QTimeZone docs
Apparently the class docs didn't get an update when systemTimeZone()
was added (at 5.5). Also add QCalendar to the \sa.
Prompted by Jaishree pointing out a typo ...

Pick-to: 6.3
Change-Id: If6d38040fff4badc3c0bb765889c1289c560c2b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-03 16:53:25 +01:00
Ievgenii Meshcheriakov
16b614f2e1 Network: Use system publicsuffix database copy when available
[ChangeLog][Network][QNetworkCookieJar] It is possible to use
system's copy of publicsuffix database when it is available.
This behavior is enabled by default on Linux and can be
controlled using new command line switches -system-publicsuffix,
-qt-publicsuffix, -no-publicsuffix, and -publicsuffix=all.

Fixes: QTBUG-95889
Change-Id: I911e1a13c1422cdc35851953309fff064e7c5f26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 15:56:09 +01:00
Joerg Bornemann
f56c068ee0 pro2cmake: Fix indentation of INSTALL_EXAMPLESDIR assignment
Change-Id: If1f5d8b5afc76fac62fdf9836a17c4ab87ddc1b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-03 15:56:08 +01:00
Joerg Bornemann
3d6c86ec57 pro2cmake: Fix static type errors in condition_simplifier_cache.py
Mypy reported the following:

condition_simplifier_cache.py:111: error: Argument 1 has incompatible type "*List[str]"; expected
"Optional[float]"
            file_handle = file_open_func(*file_open_args, **file_open_kwargs)
                                          ^
condition_simplifier_cache.py:111: error: Argument 2 has incompatible type "**Dict[str, object]";
expected "Union[str, Path]"
            file_handle = file_open_func(*file_open_args, **file_open_kwargs)

Fix by calling portalocker.Lock directly.

Change-Id: I538319791b1a4a1b6dffac0544d87c705e8809a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-03 15:56:08 +01:00
Clemens Werther
5495eb9ec2 Fix off-by-one for "typically" lowest value INT_MIN
Pick-to: 6.3 6.2 5.15
Change-Id: I0e1115dc21e700dc79fb54be953573c75b41e70f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-03 09:54:07 +01:00
Lorn Potter
66a76a5def wasm: enable mobile native keyboarding
This works on iOS and Android, and Windows with touchscreen.

On Android, we need to listen to the input event
of a hidden text element and synthesize Qt keyboard
events from that in order to get input events into Qt.

On Windows, we need to be more creative about bringing the native
virtual keyboard up.

Because the entire canvas is contenteditable, we need to specify the
inputmode is set to 'none', otherwise the v keyboard pops up
when user clicks anywhere on the canvas. Therefore we set a hidden
element as contenteditable, which pops up keyboard when Qt
needs it for editable widgets. On Android, this is the same
element that is used to proxy the keyboard input.

[ChangeLog][wasm] Add support for native mobile keyboard

Done-with: Morten Johan Sørvig <morten.sorvig@qt.io>
Fixes: QTBUG-83064
Fixes: QTBUG-88803
Change-Id: I769fe344fc10c17971bd1c0a603501040fe82653
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-03-03 12:30:59 +10:00
Marc Mutz
6f5c78fe3d QFlatMap: add remove_if
The existing API of QFlatMap did not allow efficient removal of
elements:

- std::remove_if does not apply, because it works by moving elements
  back in the range onto those that need to be removed, which doesn't
  work in flat_map's case, because, like for all associative
  containers, the key in value_type is const.

- The node-based erase-loop (over it = cond ? c.erase(it) :
  std::next(it)) works, but, unlike in traditional associative
  containers, is quadratic, because flat_map::erase is a linear
  operation.

According to Stepanov's principle of Efficient Computational Basis
(Elements of Programming, Section 1.4), we're therefore missing API.

Add it.

I couldn't make up my mind about the calling convention for the
predicate and, despite having authored a merged paper about erase_if,
can never remember what the predicate is supposed to take, so be fancy
and accept all: (*it), (it.key(), it.value()), (it.key()). This means
that unary predicates can either not be generic or must be properly
constrained to distinguish between pair<const K, V> and K, but that's
not necessarily a bad thing.

There's no reason to supply a Qt-ified removeIf on top of the standard
name, because this is private API and doubling the names would do
nothing except double the testing overhead.

Fixes: QTBUG-100983
Change-Id: I12545058958fc5d620baa770f92193c8de8b2d26
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-03 00:25:14 +01:00
Marc Mutz
b2c7f17b94 tst_qflags: don't suppress deprecation warnings
... if there aren't any.

Pick-to: 6.3
Change-Id: I8531e0c1c3ca41d1b1a9d55c9d11782bd63b6f76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 00:18:39 +01:00
Sona Kurazyan
e4aa4d4f3d Add compile-time checks for QLatin1String
Change-Id: If1b10a857275fb53c5d0b230bf6d11ce3e1ff2ca
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-02 22:22:36 +01:00
Sona Kurazyan
62c7145390 Fix QLatin1String(const char *) constructor to be constexpr
strlen() is not constexpr, use the QByteArrayView's
lengthHelperPointer() instead.

Change-Id: Ie49236edba3306e951402e6b776c15068cac0332
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-02 22:22:36 +01:00
Sona Kurazyan
736213bf66 QLatin1String: add missing APIs for compatibility with Qt string views
As a drive-by, fixed misleading wording used in docs.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes][QLatin1String]
Added QLatin1String(std::nullptr_t) constructor, which makes
QLatin1String(0) call ambiguous. To fix the ambiguity, nullptr
must be passed instead of 0.

Task-number: QTBUG-98433
Change-Id: I2b888aa23469343d78aa640dc39a6028b77165dd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-02 22:22:36 +01:00
David Skoland
0e64165c2e Close WASM popups on non-accepted clicks
Generally, all clicks that weren't in a window or weren't handled
should trigger a closing of all popups.

Fixes: QTBUG-90990
Pick-to: 6.3 6.2
Change-Id: I40e6351b265e95e0570e7c5d42f3d5b222538453
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-03-02 22:22:36 +01:00
Giuseppe D'Angelo
44eff8f39f Fix Q_FLAG declaration over enumerations
One should use Q_ENUM, not Q_FLAG, to mark an enumeration.
Q_FLAG should go on the respective flag type.

Change-Id: I16cd5c0d405c3db1951569b72805fdae18898c45
Pick-to: 5.15 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-02 19:45:12 +01:00
Giuseppe D'Angelo
52e523c33f Qt namespace: fix Q_FLAG_NS declaration for Qt::MouseEventFlags
The declaration was accidentally declaring the enumeration as
a flag type, not the actual flag type.

Change-Id: I515478b1628a6d72626da6d7e0061f1ea3d10c89
Pick-to: 6.3 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-02 19:45:11 +01:00
Alexey Edelev
8b5eb6cd09 Add the missing --no-zstd option to the manual rcc calls
Add the missing --no-zstd argument when generating resource artifacts
using binary or big resources or an existing .qrc file.

Task-number: QTBUG-101353
Change-Id: If930f0cb7ba3c89b21b01552aefd6c0e33fe5cb3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-02 17:58:07 +01:00
Eirik Aavitsland
03b9304703 Update bundled libjpeg-turbo to version 2.1.3
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.3

Pick-to: 6.3 6.2 5.15
Change-Id: I69ebd10641b07af324f6ae056cddb65cc0b5ce82
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-02 17:58:07 +01:00
Marc Mutz
ea3a7aaf2b QTest: fix QCOMPARE with QT_TYPESAFE_FLAGS
Amends 631a0cc45c.

Pick-to: 6.3
Fixes: QTBUG-101299
Change-Id: Ib17e405de4db9fb592aba4ea842d3768a95cad74
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-02 15:38:27 +00:00
Liang Qi
586fd9e034 tests: XFAIL a few in tst_QStaticText on Wayland
Task-number: QTBUG-100982
Pick-to: 6.3 6.2
Change-Id: I18cdb79d9261bac40cc619f9d327d0ef7ed722c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-02 15:37:33 +01:00
Liang Qi
e49d2daf19 tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland
Task-number: QTBUG-100918
Pick-to: 6.3 6.2
Change-Id: I1b892a80bcb44e0e4f658ed7073c54900d8a358c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-02 15:37:33 +01:00