- QNetworkRequestFactoryPrivate::requestUrl() constructs the url,
based on provided path and query arguments.
Let's imagine the argument 'const QString *path' was set fully
encoded by the user by rules that user wants to follow.
For example, openapi specification recommends
to ENCODE :/?#[]@!$&'()*+,;= symbols of path
parameter values.
So, if path parameter value = 'File Name!.xml', then
the we pass it encoded like
requestUrl('/v2/to/path/File%20Name%21.xml').
But the following line fully decodes the user's encoded string:
```
const QString requestPath{providedPath.path()};
```
See QUrl::path() function declaration here:
QString QUrl::path(QUrl::ComponentFormattingOptions options =
FullyDecoded)
And '/v2/to/path/File%20Name%21.xml' turns back to
'/v2/to/path/File Name!.xml'.
After that we call:
```
resultUrl.setPath(basePath.append(requestPath));
```
See declaration
QUrl::setUrl(const QString &url, QUrl::ParsingMode
parsingMode = TolerantMode)
The 'TolerantMode' will automatically percent encode all characters
that are not allowed in a URL and + spaces + single '%' symbols.
See https://doc.qt.io/qt-6/qurl.html#ParsingMode-enum
But TolerantMode does not encode sub-delims,like:
/ "*" / "+" / "," / ";" / "=" "!" / "$" / "&" / "'" / "(" / ")"
In result, they stay incorrectly decoded.
And the value from our example is being transformed to:
'/v2/to/path/File%20Name!.xml'
Which is not what we had before or planned to have.
The fix allows to prevent data-loss mentioned here:
https://doc.qt.io/qt-6/qurl.html#path
The path stays 'FullyEncoded'.
- also use a QUrl::StrictMode as a parameter of
QUrl::setPath(..., QUrl::StrictMode) to prevent double encoding of
'%' symbol, because default QUrl::TolerantMode mode will try to
encode it again.
[ChangeLog][QtNetwork][Important Behavior Changes][QNetworkRequestFactory] QNetworkRequestFactory::createRequest() doesn't decode the provided `path` anymore. If the path string was passed encoded by the user, it stays encoded in the particular way.
Task-number: QTBUG-138878
Pick-to: 6.10 6.9 6.8
Change-Id: Ic06b3b59562cbfd53c2033fb8a30237f9c8c5d3c
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
There's no reason to duplicate the logic and specialization for QObject,
we do all of that in the helpers already. The helpers also fall-back to
Qt::DisplayRole when a property-lookup for Qt::EditRole fails, which we
also want for itemRole - if roleNames() includes that role, then it
should be part of the map of values returned.
This requires a small adjustment to the test, which already takes into
account that Qt::EditRole is faked in our implementation anyway.
Pick-to: 6.10
Change-Id: Id3d77cf7e83b4220ab2ac8aae7bba2a9de7d16d8
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
In Qt Quick, models support a "modelData" property. Depending on the
underlying data structure, that property holds the data stored. For a
QObjectList, it is the QObject, allowing QML code to access properties
of individual QObject instances in that list.
As of now, this is the only way for QML code to respond to changes of
properties in such a backend data structure, as nothing connects the
propertyChanged-signals of all QObject entries to the dataChanged()
signal of an internal QAIM proxy. And even if we can find a way to do
this in QRangeModel, it will be rather expensive if only a few
properties are actually interesting. So we can assume that there is code
out there doing exactly this.
For QRangeModel to fully replace this use case, we have to provide
access to the QObject that represents a multi-role item. We can fake the
modelData role to return the QObject (or gadget) instance that backs the
item and a given index. For QML to see the role, we include it in the
automatically generated roleNames() mapping, using a new, undocumented
value in Qt::ItemDataRole. We skip that role for itemData.
We do not allow setting the data for that role, as it would make object
ownership very messy, so return early from such calls of setData(), and
ignore an entry for that role in setItemData.
Pick-to: 6.10
Change-Id: Iaf7dee5d6be18cf8b99ce796b9314459dffcfcb8
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
When sections contains '\' or '/' we should return a parse error as the
documentation states we should not use them in sections.
Fixes: QTBUG-138648
Change-Id: I273f22104f7e7e7d33ad45b1218d7816d38ff0c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QCOMPARE() can handle enums gracefully, so don't cast to int just for
that. Remove some surplus blank lines while I'm here.
Pick-to: 6.10
Change-Id: I0797631dc4f7631e8621ad45ac09f68e9295bca6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The transaction implementation in setItemData tries to make a copy of
the original item, then writes to that copy, and swaps the original item
with the modified copy only if all changes were written successfully.
The write-operation happens on a pointer to that item via QMetaProperty
APIs. So for non-copyable items, we return a pointer to the origin.
If the item is owned by a unique_ptr, then we cannot make copies, so
we write to the pointer to the original item. Use our pointerTo helper
to get that pointer in all cases to unwrap unique_ptr. Otherwise, we'd
pass the address of the unique_ptr to the QMetaProperty API and crash.
Add test coverage, and enable SetItemData tests for listOfObjects as
well.
Pick-to: 6.10
Change-Id: Ia23c22f60171aacea64259a97b64ec7278db35a0
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Right now only Q_NO_SYMLINKS is defined on VXWorks, whereas
Q_NO_SYMLINKS_TO_DIRS isn't defined anywhere that I can see. I think
it's a left-over from 95cebd34eb (which
removed Symbian-specific code from qtbase tests).
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6a30aaefc1c04f6c6033961703e24070abfb4542
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Most commonly this would be a file, by way of the network disk cache.
The switch to use QSaveFile in the network disk cache in
e5f295c8a4 exposed the issue because
the leftover file objects were no longer deleted during
the cache trimming, so the handles were left open even if we
deleted the file.
The real issue, however, is that we did not notify the cache
that we were not going to complete the cache object, thus closing
the file object and deleting the uncommitted file.
That issue was probably introduced as part of
6f25051536.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-135641
Change-Id: I4c185e4d6e44029e221e69e2ef7135b3710f1069
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
a318e331f1 accidentally divided when it
should have been multiplication. E.g the old code would actually
slow animations down instead of speeding them up:
delta (16) / speedModifier (5) = 3.2
What we want is:
16 * 5 = 80
Add an auto test for the behavior in
tst_QPropertyAnimation::speedModifier. So that we can restore
speedModifier's previous value, add a getter for it.
Task-number: QTBUG-137919
Change-Id: Ie873a5c90e36bb9906aadad45fa2c53f50066c1e
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove DPI scaling from touch points:
Window fills Android screen even if window is resized.
QHighDpi::toNativePixels() returned global screen space coordinate
of a point in the window with size 200x200 (local coordinate).
This caused touch point to land out side of the child widget.
Fixes: QTQAINFRA-6892
Pick-to: 6.9 6.10
Change-Id: Ib03838bfbbf8282bf3bccbc44c7e326373f37e9a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Coverity complained that the default ctor didn't initialize the
iterator's data members, and it's correct, of course.
What makes matters worse: by implementing the default constructor like
that, we break the C++ guarantee that value-initialized iterators must
compare equal.
Fix by = default'ing the constructor. That leaves default-construction
to establish only the partially-formed state, as before, but
value-initialization now creates a well-formed object, ready for
equality comparison.
Add a test.
Amends the start of the public history.
Coverity-Id: 87769
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I4d7af36937946dd58d52aaafae4dd48a60c00cf0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends 7d0017cda8 for QListWidget,
QTableWidget, and QTreeWidget tests.
QWidget tests were added much earlier, but picking only to 6.10, as
we do not officially support this configuration.
Pick-to: 6.10
Change-Id: Idd8449bb4b7ddeb1b0ec7b85b01f50f286e8acd6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of waiting 250ms between each snapshot, to account for
animations in the styles, let's use the new hook in QUnifiedTimer
to speed up animations.
Brings the tst_Widgets baseline test down from ~200s to ~30s.
The window delay in takeScreenSnapshot has been left alone for now.
Change-Id: I83d4f25d8d6f198c2f00f31af1dbde0f3de5ded0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And separate it from the background by making the background a
checkerboard pattern.
Avoids issues with rounded window frames contributing to the
results. Also, by making the window frameless we will not get
a default window background color on macOS, which means that
any issues with transparent rendering will be visible when
running the tests locally, as the checkerboard background
will shine though.
Change-Id: Icd501eeb149d2dbfb184c91e8eac3a531d09408d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The drop shadow may overlap with the test window, if the activation
stealing window is too close, depending on the shadow size.
Change-Id: I39bf271d0f1852febd1920e2e7a9fe615ff6594e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Going via QWidget::grab() will render to a QPixmap, which on most
platforms is going to be QRasterPlatformPixmap. The format of the
underlying QImage in that case is resolved from the primary screen,
which most platforms report as QImage::Format_RGB32.
This means we will not be able to detect the difference between
black and fully transparent areas in the rendered result, which
has been observed to be a problem for widget styles that wrongly
render their controls using source composition.
To solve this we render via QWidget::render() instead, to an image
with an alpha format.
Change-Id: I078f062b662590598c3597797abc2bfa78eaf86a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of manually taking a single snapshot. The latter does not
automatically show the window, which means the size might be wrong.
Plus we should test all states, as they are slightly different.
Change-Id: Icaf0d8829cf4fed28cefc6f4a3e258f4d8e60e43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
So bump the version number.
Pick-to: 6.10
Change-Id: I0414d5222d3a0f1863ea68c582e68bb456a05349
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
clang warns that itemFromText is defined, but not used. Moving it into
the ifdef QT_BUILD_INTERNAL to silence the warning.
Pick-to: 6.10
Change-Id: I5aa65c3f366912a180ec9067c8950cb81e4b68be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of setlocale(LC_COLLATE, nullptr), which doesn't reflect the
system locale on all platforms, e.g. on Darwin.
This is important as we will end up in platform code later on when
doing string comparisons, and that code does reflect the system locale.
A mismatch here would end up failing localeAwareCompare_QString_QString
for C@auml.lt.aring as we would think we had a C locale, when the
system locale was actually en_NO.
Pick-to: 6.10 6.9 6.8 6.5
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I24ed25b355772817d467c1585662d6abc25ff20c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This reverts commit d90dfe0560.
Reason for revert: Fix flakiness on Opensuse, but create flakiness and
failing on Windows. The patch ensures that the window is positioned
in the top left corner of the screen. However, two tests from
tst_QWidget-taskQTBUG_27643_enterEvents and underMouse- which run
before synthMouseDoubleClick, place the cursor in the top left corner.
As a result, an unexpected mouseEvent is triggered when
synthMouseDoubleClick is executed, causing the test to fail due to
the altered cursor position.
Change-Id: Ic73ad7ca86f9ec42588b31ab067195e1d17e2bd5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Fix flaky tst_QMenuBar::check_menuPosition on Ubuntu by replacing the
hardcoded 0 in w.move() by availRect.x() to ensure that the menu
position is valid.
Unblacklist tst_QMenuBar::check_menuPosition on Ubuntu 24 and on
Ubuntu 22 as it is no longer flaky.
Fixes: QTBUG-126498
Fixes: QTBUG-68865
Pick-to: 6.10 6.9 6.8
Change-Id: I7fc55afc8e9ba7bc9dfbc7e903ca58408e6c8faa
Reviewed-by: Liang Qi <liang.qi@qt.io>
Declaring the window functions as extern "C" disabled all name mangling
and namespacing. This may have been done with the intention to use C
function pointers instead of C++ function pointers as they are passed as
WNDPROC.
Drop the extern "C" and thereby implicitly declare the functions as C++.
Task-number: QTBUG-138543
Pick-to: 6.10
Change-Id: Ia20782a82f94eb3133b972dead7cdac623cfa626
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reading out data of type REAL was broken since
b211148e4b due to the fact that
QMetaType::Float was not handled within QODBCResult::data().
It was also not possible to read out the correct data with the help of
QSql::HighPrecision due to a wrong length given to qGetStringData().
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138642
Task-number: QTBUG-8963
Change-Id: I90a003a0b1625f37931468c3994418a1dc3a03c4
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
These are views on the `signature` QByteArray data member, so should be
safe to use.
Pick-to: 6.10
Change-Id: I92f490585944f367cb776881094ce98c64e1a20d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise comparisons of current > QOperatingSystemVersion::MacOSSonoma
will trigger for 14.1 and above, instead of 15 and up. The expectation
is that the constant represents the major version.
[ChangeLog][macOS] QOperatingSystemVersion constants for macOS 11
and up are now represented with their major version only, and minor
and patch versions unspecified, as documented.
Task-number: QTBUG-107907
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I62dbac54f6b37b5797459c30c326706341b403a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make it possible to have a QColumnView without a preview widget.
Fixes: QTBUG-1826
Change-Id: Id169540224150a2fe804f61f90ee9bf2aabeb9ff
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Some Qt models use role values below Qt::UserRole for special purposes.
To avoid that we keep reusing the same value for different models and
potentially cause conflicts across modules (which might already be a
problem when Qt RemoteObject's QAIM wrapper is used on a
QStandardItemModel or QFileSystemModel, as both use
Qt::UserRole - 1), add those values to the Qt::ItemDataRole enum, but
omit them from the documentation.
Not included in this change are the Qt::UserRole + 1/2/3 values we use
in QFileSystemModel for FilePath/Name/Permissions roles. We won't use
role values above Qt::UserRole in Qt in the future.
Use these enum values then internally where we currently hardcode the
values. Pick this back to 6.10 to avoid conflicts. This is not an API
addition.
Amends, at least, 6e8563fb2d.
Pick-to: 6.10
Change-Id: I6cd93c32b5c6709355b6f048f9d6d574421d6fbb
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends 68562d9b2e. Right now the code
appears to work as all configure events cause a wl_surface.commit,
but we should use the same path as typical rendering in order to also
submit a frame callback and handle future updates.
The backing store test is changed to behave more like a real client.
Pick-to: 6.10
Change-Id: I72d167072620c2684a130ca69a548088392e0bfd
Reviewed-by: David Redondo <qt@david-redondo.de>
Fix flaky tst_QStatusBar::QTBUG4334_hiddenOnMazimizedWindow on Ubuntu
by replacing a single check with QTRY_VERIFY to allow multiple
verification attempts.
Unblacklist the test on Ubuntu 24 xcb as it is no longer flaky.
Fixes: QTBUG-129027
Pick-to: 6.10 6.9 6.8
Change-Id: I7399b86957271055fb9e6e471968e5e3ac04a518
Reviewed-by: Liang Qi <liang.qi@qt.io>
In Greek script, there are two versions of lower-case sigma: ς (GREEK
SMALL LETTER FINAL SIGMA) ("\varsigma") and σ (GREEK SMALL LETTER
SIGMA), but only one upper-case form: Σ (GREEK CAPITAL LETTER
SIGMA). The first one is used at the end of words, the middle one
everywhere else¹. So when going from upper-case to lower-case, the
algorithm needs to take into account whether the character is at the
end of the word or not.
The QLocale platform-specific implementations (ICU, Mac) get this
right, while Windows, and Qt's own implementation, which acs as
fall-back for QLocale::toUpper(), do not.
This acts as a reproducer for QTBUG-2163 and QTBUG-138705.
¹ https://en.wikipedia.org/wiki/Sigma
Task-number: QTBUG-2163
Task-number: QTBUG-138705
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I4aa44ee077de572925304c1cd957a35db19a6b2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This stops the shotgun surgery necessary when the condition changes,
by centralizing the condition and assigning a symbolic name to the
feature is represents. The more so as this list has evolved over the
lifetime of the still-active branches: First it was only ICU, then
Windows was added, and then Mac.
Task-number: QTBUG-2163
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0fa604f9726a9fcf12b90655a5621b4169a7199b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt Creator loads QMovies in a different thread, to be moved into the
gui thread for display. Because of the way QMovie allocates its QTimer
(by value, no parent), this doesn't work, because the timer, created
in the worker thread, never gets moved to the gui thread.
Fix by giving the QTimer the QMovie as parent. Because QMovie doesn't
exist as an object at the time the QTimer object is created in
QMoviePrivate, we can't just pass qq to its ctor. So delay the
creation until init() time, turning the member variable into a
pointer. We could have used optional<> instead, but the difference
would be minimal (same code churn), and a bit more risky (object lives
longer), so don't do that for the cherry-picked version. If we do it,
it will be in a follow-up.
A more comprehensive change would override QObject::timerEvent(), but
QMovie is missing the event() override that would make this BC, so
that's a Qt 7 solution.
Add tests.
TODO: While the movie now shows up, and mostly plays, it doesn't
_always_ play. Every now and then, esp. in first runs, it will not
animate in the QLabel.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-131448
Change-Id: I9a0ae894fe26254be0da0c04749289877462e564
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_QWidget::cleanup() makes the function fail, if
QApplication::topLevelWidgets() isn't empty after processing events.
Subsequently, it reported a (soft) leak, if
QApplication::allWidgets() isn't empty.
Process events for 50ms before reporting a leak, in order to make sure
that QObject::deleteLater() is processed.
Task-number: QTBUG-135138
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Id7bb9b63faeb4d5c05946a6e2b7db6c0ee52f3b7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This makes the QDBusContext functionality available inside property
implementation functions.
Fixes: QTBUG-99277
Change-Id: I0c4691ab5edf88506f7195c704dd1cc75270cdac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
allocArgs leaves the args_ array to be nullptr if nargs is 0. While that
should never be the case in practice, clang correctly points out the
possibility that we are dereferencing nullptr, e.g. when constructing a
QQueuedMetaCallEvent like this:
QQueuedMetaCallEvent event(0, nullptr, 0, 0, nullptr, nullptr);
Don't initialize the storage if the argument count is 0. Access to the
storage elsewhere doesn't explicitly handle index 0.
Amends f6211c079f.
Change-Id: If42403c1fc862b8ba7456709af2456cfbec8086b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Namespaced qt should be protected against duplicate symbols in the same
process/dso. The static plugin factory had a flat name, so we should
name-mangle it.
[ChangeLog] In namespaced builds the entry function for static plugins
now appends the namespace via QT_MANGLE_NAMESPACE.
Task-number: QTBUG-138543
Pick-to: 6.10
Change-Id: Ic656a4fd27d5a3d2b2209ef553c34e75024acc3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move Java calls that might throw exceptions and handle them
with a try/catch by printing the appropriate error messages
where relevant and ignore the ones we don't necessarily need.
For certain operations like query we should check if we have
read permission for the URI first, and only then do the query,
because otherwise it's guaranteed to fail if there's no read
permission.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138013
Fixes: QTBUG-126531
Fixes: QTBUG-123319
Fixes: QTBUG-134912
Fixes: QTBUG-110240
Fixes: QTBUG-132403
Fixes: QTBUG-129324
Change-Id: I8457b6bfd9381bf1a62077520cf9a222311ded7a
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reimplemented copyDir using QDirListing and an iterative approach,
replacing the previous recursive version based on QDirIterator.
The new implementation is significantly faster on large directory trees
and more robust on VxWorks/QEMU, where the old version occasionally
failed.
Also added logging of execution time for diagnostics.
Task-number: QTBUG-137562
Change-Id: Icf689bf0e4f09377376e18401ec352449e74ed2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
ICO images lack animation metadata, so QMoviePrivate::infoForFrame()
assigns a default nextFrameDelay of 1000 ms. QMoviePrivate::next()
scales this value according to playback speed (100 ms), and subtracts
the time spent processing the frame.
The test previously asserted that nextFrameDelay is exactly 100 ms,
which is only true if processing time is zero. On real hardware this
usually holds, but under QEMU (especially for VxWorks Intel), processing
may take 0–40 ms, reducing the effective delay and causing test
failures.
This commit relaxes the strict check, allowing a range of 50–100 ms to
accommodate minor variation in processing overhead.
Task-number: QTBUG-137564
Change-Id: I859612bd2c684df830c5ea8665be1a1763b4f2e0
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Use gradle based signing mechanism for the modern Android bundles.
From the interface perspective signing remains unchanged:
QT_ANDROID_SIGN_<AAB|APK> flags control if the package should be
signed. The credentials are taken from the QT_ANDROID_KEYSTORE_*
environment variables.
Signing is done in separate CMake script to avoid storing passwords
inside build scripts. Scripts reads passwords from the environment
when the respective signing rule is running.
Change-Id: Id1097b2b6d011a63c58e5a441c5360a1a5d97e8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Forward the values of QT_USE_ANDROID_MODERN_BUNDLE and
QT_USE_TARGET_ANDROID_BUILD_DIR to Android CMake tests.
Drive-by make the keytool command error more verbose.
Change-Id: I8313d04ed89f545548a29463f39b5aa755f015e3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extend the 'test_android_signing' test so it now supports checking both
AAB and APK outputs.
Change-Id: Ia0dfd09a240691f65c78658a572527cd4ab94119
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Those should be rejected, but the one with an embedded NUL is not.
Task-number: QTBUG-138562
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6a0103307fb868afba997334a37b31b637cd7473
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... as public API for QTemporaryFileEngine::renameOverwrite().
This operation (to atomically rename a temp file to the final file) is
a building block in various safe I/O patterns and QTemporaryFile
should therefore have public API for it, not just a private one.
Adding similar functionality to QFile is orthogonal to this change, and
a lot more elaborate, since its rename() already overwrites, always,
even if non-atomic.
QTemporaryFile, OTOH, already guarantees atomicity. But its rename()
never overwrites (except when it does (QTBUG-132646)). So it's the
natural place to add this functionality, and helps write platform-
independent code in the face of QTBUG-132646.
[ChangeLog][QtCore][QTemporaryFile] Added renameOverwrite().
Fixes: QTBUG-132617
Fixes: QTBUG-132646
Task-number: QTBUG-132646
Task-number: QTBUG-2082
Change-Id: I405f554335005ec8c6f1762385a19ed3fac51217
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tst_QWidget::synthMouseDoubleClick is flaky on Opensuse. The touchEvent
is not received when the test fails. The window's
position/framePosition taken is the un-updated one as it is offset
by the frame height.
Verify that the window's position/framePosition have been updated
before sending the touchEvent.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I32ccea55131d32f21288cfa64dbabf43deb8a8d3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Instead of passing the Qt6_DIR variable to the RunCMake tests one by
one, we can now pass them in the wrapper qt_internal_add_RunCMake_test
function.
Pick-to: 6.8 6.9 6.10
Change-Id: I5f48e185a28a866763152e2ffeb7b8663aec7772
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This allows us to decouple some of the Qt specific setup from the
upstream files, reducing the maintenance burden when updating
the upstream CMake files.
Repos that haven't been ported to the new
qt_internal_add_RunCMake_test and include(QtRunCMake) will continue
to work using the old QtRunCMakeTestHelpers and RunCMake files.
Pick-to: 6.8 6.9 6.10
Change-Id: I4c3cfb7179b8cb34e5e55b380fd27733c582d0dd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The RowOptions template gives us a better mechanism of declaring a type
with metaobject as a multi-role item in a list. The SingleColumn alias
of a single-element tuple is not as transparent as it should be, and
operating on a list of types wrapped this way becomes quite cumbersome
(using std::get<0>, extra braces for initialization).
Adjust the documentation to focus on the RowOptions mechanism, and
replace relevant test cases with a single-element tuple, which can still
be used for situations where specializing RowOptions is not applicable,
such as for row types that don't have a meta object.
If we see a clearer use case for a wrapper-based solution, then we can
try to add a transparent SingleColumn wrapper type for which we
specialize row_traits explicitly, without the complexity of the tuple
protocol.
Pick-to: 6.10
Change-Id: I515d9cb5c5129bd639fa9b20004be9a4101469eb
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Verify that the RowOptions detection reaches into a wrapped type.
Amends 4d88d39417.
Pick-to: 6.10
Change-Id: I9e1614cb3566151dc491cda3449878025c620806
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
... where the target of the rename already exists.
There is a similar test, autoRemoveAfterFailedRename(), but that tests
an "invalid" target name (in a dir that doesn't exist), so it will not
lend itself to checking a future overwrite mode of rename(). This test
function, however, does, so accept the slight but-not-quite overlap in
tested functionality.
Turns out Android already overwrites an existing target file. Filed
QTBUG-138610 to keep track of the issue.
Amends the start of the public history.
Task-number: QTBUG-138610
Task-number: QTBUG-132617
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Iaa8f833fd9b1b760dd8546d827b742d7d3fb9bbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Extract Method the codeToLanguage() parts of tst_QLocale::codeToLcs()
into a separate codeToLang(), convert it to data-driven, and add more
tests.
Some of these newly-added tests stopped working in 6.6, when
AlphaCode's ctor's contract was implicitly narrowed¹, but the new
contract not taken into account by QLocale(Private)::codeToLanguage(),
leading to the public function running into UB for such inputs.
¹ by 3dcd6b7ec9, and only recently made
explicit by a prequel patch
A follow-up patch will fix the UB in QLocalePrivate::codeToLanguage()
and then enable all tests.
Task-number: QTBUG-138562
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I58fac2bb2d0958bfb7d39f31a776c3a4fad02558
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QLocale::LastScript, as the name suggests, is still a valid script,
but the old code let the loop run only while i < LastScript, so it
never checks the last entry, which therefore can't be found by string
lookup (both in codeToString() and in qt_splitLocaleName()
(ie. QLocale(QString/View))).
Fix by letting the loop run while i < NumScripts, which is a new local
constant for LastScript + 1. Also add a static_assert that the size of
script_code_list matches the cardinality of QLocale::Script, which is
actually how this bug was found...
Amends the start of the public history(!).
[ChangeLog][QtCore][QLocale] Fixed a bug where QLocale could not find
the QLocale::Script with the highest value when looked up by string
(codeToString() or QLocale(string) constructor).
Fixes: QTBUG-138566
Task-number: QTBUG-17105
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie938588e2f6ff711a0c097803f05360104162d85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The specified protocol produces rows, and it can destroy them,
so we should explicitly delegate ownership back to the protocol.
The change doesn't affect pointers case as pointers are passed by
value anyway.
Pick-to: 6.10
Change-Id: I631b77fed3ca5238b0c1937b3f231e923f7958b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
That way we can reuse them in unit tests for the future adapter type.
Pick-to: 6.10
Change-Id: I52cd5742b80a314372ebf54e2939f0a559d0004f
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
If the item type for all columns is identical, and has a meta object,
then we can use the property names and map them to Qt::UserRole values.
Add the necessary traits to detect whether the types of all columns are
identical, and what the type is. They are identical for rows that are
ranges or single values (including MultiRole gadgets). For tuples, we
test if all elements have the same type.
Adapt the test, and improve the diagnostic output for failing calls to
setItemData.
Discussed during API review.
Pick-to: 6.10
Change-Id: Idd806e85f9eeec636aedf381ca69611afd9dbb29
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Given use cases of QRangeModel with Qt Quick, it makes little sense to
require users to subclass QRangeModel just to get the roleNames
implementation to match the property names of gadgets used in the model.
Override roleNames and add a setter, making it a property. We can cache
the hash table at first return, avoiding the (common) mistake of
constructing a new (but generally static) has table in each call of the
getter.
Add a test and documentation.
Pick-to: 6.10
Change-Id: Ib584ae4dc227000968d49654942b71510ff4c78a
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
For Quick, gadgets in a list should be represented as single-column/
multi-role items. Wrapping the gadget type into a SingleColumn is
possible, but messy, as it changes how the underlying data structure
works.
We can in addition allow the gadget type to declare itself directly as
a multi-role item: by specializing a QRangeModel::RowOptions template,
and giving it specific member types or constexpr values, types can
modify how QRangeModel interprets them. This gives us a very flexible
and extensible mechanism for future behaviors and compile-time
optimizations.
For now, check for a rowCategory member value, which can be set to
MultiRoleItem to override the default interpretation as a multi-column
row.
Adjust test and documentation.
Pick-to: 6.10
Change-Id: Icd2542ac2a9fb4abe7698bb4341b67053e01aa93
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
So far, the row_traits specialization has been ambiguous for types that
have both a meta object, and are tuple-like. That doesn't have to be so:
we can explicitly specialize the traits for each combination, and when
both are present, select one of them.
Implementing tuple-protocol for a gadget or QObject type is a rather
explicit choice, so we interpret such types as tuples.
This also gets rid of the make_void helper.
Adjust test and documentation. The way that we used pointers to stack-
allocated objects in the test was fishy anyway, and we are now always
using the table protocol for those models, which deletes the row
instances for us.
SingleColumns can also be used to represent a range as a value instead
of a multi-column item, and to explicitly request a type with meta type
to be interpreted as a multi-role item. So we leave it, at least for
now, even though it's clumsy to use. Might be best to get rid of it as
well and just document that a single-element tuple can be used instead.
Pick-to: 6.10
Change-Id: If5abd20e2dd44e793f4de52d778e8d723f1fa584
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
It can't...
Filed QTBUG-138566 to track the issue.
Amends the start of the public history.
Task-number: QTBUG-138566
Task-number: QTBUG-17105
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I84444044b6f82dcec620e9a0e7f803870b7a3ed5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
We send the event from the accessible cache. This is the only
place we have access to both the interface and the object.
Change-Id: I078d6e082b0c3205bfcb544e94b9736360fea4a3
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Add QSKIPs for the no-thread config and one for TCP
sockets.
Pick-to: 6.10
Change-Id: I4f11af06ff9735f67984d50fdd6071c802b0314a
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
We only report the action if we have any actions to present.
For the other context menu policies we don't know if the user has
overridden contextMenuEvent or connected to customContextMenuRequested,
so we opt to not report the menu action in these cases. A user that
wants to present the menu action will have to subclass QAccessibleWidget,
override actionNames(), and install an accessible interface factory
that returns the specialized QAccessibleWidget.
As of now we do not report QAccessible::ActionChanged anywhere in Qt
when the conditions for actionNames() change, and this includes this
newly added behavior. Initial attempts at plumbing ActionChanged to
the macOS a11y system failed as there is seemingly no way to trigger
an update of this specific state, so this rabbit-hole has been left
for further investigations.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-137126
Change-Id: I538df87603fbcae9ed2d9bcbb16f1de85a08f200
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Constructing a QDBusPendingReply from a QDBusPendingCall involves some
extra steps on the d_ptr. Specifically, it populates the expected reply
signature based on the provided types.
Add tests that make sure that these extra steps are actually executed,
and also check that copy/move of QDBusPedningReply does not invalidate
this reply signature.
These tests are prerequisites for the QDBusPendingReply SMF refactoring.
The tests access the internals of QDBusPendingCallPrivate, so we have
to link to QtDBusPrivate and add tst_QDBusPendingReply as a friend to
QDBusPendigCall.
Pick-to: 6.10
Change-Id: I8a2cae603321a5faa0dd1caf9401b84018617c9f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Specifically, move-constructor and move-assignment operator.
Commit 98710e210f added missing SMFs to
QDBusPendingCall, so we now need to provide the operators for its
derived class as well.
Extend the getResultFromAnotherInstance() test to check for move
operations.
The test for the move operations simply needs to check that the
objects share the same Private, so add the test class as a friend
to both the general QDBusPendingReply and its specialization for
the void type.
The 6.10 API review revealed that it makes sense to pick the SMF
changes there, so do it.
[ChangeLog][QtDBus][QDBusPendingReply] Added move constructor.
[ChangeLog][QtDBus][QDBusPendingReply] Added move-assignment operator.
Pick-to: 6.10
Change-Id: Iebe24a0c24fa6b833a31748447c382a47612e619
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check that it is possible to wait for the result and retrieve a correct
value from a copied QDBusPendingReply.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I4e2d6c54feddc4869bd3e6114da71ccbe5bb86d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The accessible role for QAccessibleDockWidget
depends on whether it is floating or not, see
QAccessibleDockWidget::role.
Therefore, notify about the role change when
the QDockWidget::floating property changes.
This e.g. makes Accerciser (git master, in particular
containing merged merge request [1]) display the new role when
a dock widget gets (un)docked.
Extend tst_QAccessibility::dockWidgetTest to verify
a corresponding event is sent.
[1] https://gitlab.gnome.org/GNOME/accerciser/-/merge_requests/98
Task-number: QTBUG-138206
Change-Id: If3aa872e30d69f4750d1a2da1e17c7ab1b10cdb6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The QAccessible::Window role is for toplevel windows
only, and using it for non-toplevels e.g. breaks
window-relative coordinates in AT-SPI for non-floating
dock widgets and their content.
A QDockWidget is only a top-level if it is floating,
so only report the QAccessible::Window role in that
case, otherwise use QAccessible::Pane ("A generic container.")
because it's a container containing the QDockWidget::widget().
Adjust tst_QAccessibility::dockWidgetTest accordingly.
Notifying about the role change when (un)docking
a dock widget depends on introducing a new QAccessible::Event
and will be implemented separately in an upcoming commit.
Fixes: QTBUG-138206
Pick-to: 6.10 6.9 6.8
Change-Id: I9eb1bdc2a60260f169910671ebc82d9735e5ba13
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Update the code that generates <module>-android-dependencies.xml.
Use the correct qt_internal_add_android_permission instead of
setting permissions property manually.
Amends f430c5ae81
Change-Id: Icc46a54f6915bc344afe5507b3244225d750cb7c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use Expression SFINAE / The Detection Idiom to check that certain
arg() calls do _not_ compile.
The selection is just something I came up on short notice. The fix for
QTBUG-138471 will be the real user of this test function.
Task-number: QTBUG-138471
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I7c641cf951b114c45070dacc5e3763a416ba0ea0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows users of Qt Test to have control over the default
timeout value without having to explicitly pass it via the
*_WITH_TIMEOUT variants of the macros.
Continues on the work done in 55f163382d.
[ChangeLog][QtTest] Added QTest::defaultTryTimeout to allow
configuring the default timeout used by the QTRY_* functions.
Task-number: QTBUG-81979
Task-number: QTBUG-138160
Change-Id: I04873fd3cc51e9be19850aa5a7de78f9444a11ee
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QTextStreamPrivate::putString(), in numeric mode, and with
accounting-style alignment, parses the string to check whether it
starts with the current locale's negativeSign() or positiveSign(),
which, since Qt 6.0, are QStrings, when in Qt 5 they were mere
QChars (which was wrong).
The old code still assumed Qt 5 times and merely compared the front()
of the string (the first character) with the locale's QString. This
works for locales where the plus/minus signs are just one UTF-16 code
point, but not for those that require surrogate pairs or are just
plain more than one Unicode code point long, like ar_EG (Arabic as
written in Egypt).
Fix by using startsWith() instead of front() ==.
[ChangeLog][QtCore][QTextStream] Fixed
QTextStream::FieldAlignment::AlignAccountingStyle for locales that
have negativeSign/positiveSign (-/+) that take more than one UTF-16
code point (e.g. ar (Arabic)).
Fixes: QTBUG-138484
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6120460cb2ea8ce201bca5ba404cdaea442b0cb6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The API changed from using int to std::chrono::milliseconds,
update test.
Pick-to: 6.10
Change-Id: I4bd4079e5b262859bae293909008cacc824248ac
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
QTextStream doesn't deal with QLocale::negativeSign() and
positiveSign() when they are longer than one UTF-16 code point.
Add a test with such a locale (ar_EG), sufficiently-large field
width and accounting alignment mode enabled, to trigger this
code path, reproducing QTBUG-138484.
Task-number: QTBUG-138484
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia7c58189c43b0383b4ee54d957a9f18f62bd26a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test function took an inordinate amount of time to execute, due to
QTBUG-138435, but didn't actually test the result of all the pos()
calls.
An earlier commit reduced the test file size by a factor of 10 to make
the runtime manageable. This patch adds actual testing of pos() by
calculating a running tally of where the expected position is, in the
file, and comparing that with QTextStream::pos().
As a drive-by, port a QString(const char*) call to a _L1 string
literal.
Amends the start of the public history.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-138435
Change-Id: Ib9d4b79b68847f52a3f49ffc458098b5cabc441b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
After the first patch already reliably removes the temp files left by
the test in most cases, this patch plugs the remaining hole, namely
that the insert() hasn't happened, yet, when the contains() QVERIFY()
fails, and we therefore don't QFile::remove() the youngest temp
file.
Use QDuplicateTracker, whose raison d'etre is that it has API that
does lookup and insert in one go, so that a failed QVERIFY will have
already added the file name to the container. We recently added
iteration support to QDuplicateTracker, making it possible to use it
here as a drop-in replacement for QSet.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia6d1cfa50e452cf583935d5f76aa1cb6794d6eeb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends commit 6fb39ca2cb, which removed
the qApp check because the comment above the check didn't say it was
needed. In fact, that made the code match the comment. But if qApp is
null, we'd post an event to nullptr to reenable delivery, which meant it
was never re-enabled, resulting in stalled applications. The sequence
implied it was necessary:
if (suspendedDelivery && result && result->connection)
result->enableDispatchDelayed(qApp); // qApp was checked in the caller
Ideally we would make the comment true and re-enable without requiring a
QCoreApplication object, but qAddPreRoutine() takes a parameter-less
function and I'm not going to spend time adding more complexity to that.
Instead, let's just restore behavior.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-135928
Change-Id: I40c54d1343e7d0c0f5f3fffdd05e84d01d5df025
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends commit f8b5142e30. I must have used
raw Unix process things before deciding on QProcess instead.
Pick-to: 6.10
Change-Id: I5d20792cfcb4b93227bffffde145c971274878c8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Code in QTextStream assumes this, so we need to make sure it holds for
all locales.
The test is modelled after testNames(), which is from 2012, so should
be available in all active branches, incl. 5.15 ESM.
Task-number: QTBUG-138475
Pick-to: 6.10 6.9 6.8 6.5 5.15
Change-Id: Ib1552bb0e75a35676e1fd2b3901784654dd76998
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Simplify the code by using QScopeGuard. In particular, this makes
clear what "reset()" was supposed to do: dismiss.
Every Qt developer knows the semantics of QScopeGuard, but this custom
class has to be learned by every reader anew.
As a drive-by, fix the spacing inside parentheses.
Amends the start of the public history.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I20b80fe551951a5aba01a8996c4934b574d34fac
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This test is now extended to have QtAbstractItemModel benchmarks for
native QAbstractItemModel and Java-based QtAbstractItemMode. Bench-
marks supports now testing of rowCount() columnCount() data() index()
Task-number: QTBUG-133444
Pick-to: 6.10 6.9
Change-Id: I6ac4fe10b5a1091f524cbe0f359bdcd50dd5cfa3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Avoids the need to do appendTo() just to iterate over all the
elements.
To be used in tst_QTemporaryFile in a subsequent commit.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I8bcfcb326dd6e5c26b91327b155ee0971776be05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Use a QScopeGuard to remove all the temp files created, so as to also
remove them if a QVERIFY should fail.
There's still a hole in the test: When the contains() QVERIFY fails,
we won't delete that temp file, but that will be solved by porting to
QDuplicateTracker in a subsequent commit.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ib3c4082c4ad11b271b29491e1be0b62b291684fa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Also replace a magic number with the size of the array.
Amends the start of the public history.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I417ff9f71001bf45354cc1b095af41852b13008c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move the declaration of 'value' to just after the first use, in the
loop, and give it an initial value that doesn't appear in the file.
This improves test coverage by checking that the variable was indeed
overwritten by the failed op>> call, and doesn't just accidentally
have the value zero.
Amends the start of the public history.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-138435
Change-Id: I4591d105dd2d991f75f0086c9706ebe9be832251
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This test function exhibits quadratic behavior in the size of the test
file, and takes 5min on my laptop to execute for the 50KiB file,
pointlessly spinning the CPU while not testing anything (the pos()
result is not even checked).
Save some CO2 by reducing the test file size to 5KiB. This reduces the
run time on my machine to 1s (from 5min!) and should make the test run
fast enough for emulated platforms, too, so remove the QSKIP.
As a drive-by, fix grammar in the code comment, and spacing around
operators.
Amends the start of the public history for the problem itself and
71bd06d516 for the QSKIP.
Pick-to: 6.10 6.9 6.8 6.5 5.15
Fixes: QTBUG-138428
Task-number: QTBUG-138435
Change-Id: Iea49f5ba41aea1c372a9dd9b5472d7205f492b99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts part of commit 3f61f73626.
The renaming of the member caused Qt Creator to break. Since that was a
gratuitous change and was backported, it's hard to fix.
src/libs/utils/stringtable.cpp:97:44: error: ‘QArrayDataPointer<char16_t>::Data’ {aka ‘struct QTypedArrayData<char16_t>’} has no member named ‘ref_’; did you mean ‘ref’?
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I5d0b1a0c9b42adc38c7bfffd1a86e7abb08d952b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
The tests check that the output android apk is signed correctly if
QT_ANDROID_SIGN_APK is set to ON and the related environment variables
are set.
Change-Id: I4b8ff241c47f3d990a37c36ccf12bfdfb48ed283
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
If we build test in Qt build tree we still need to point to the current
Qt exports when configuring tests, prepending CMAKE_PREFIX_PATH in the
qt_internal_set_up_build_dir_package_paths seems right thing to do.
Amends 2f9795aba2
Change-Id: I25086fb50d5298c378375caf5c1059c68e841534
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This version is known to be broken too.
Pick-to: 6.10 6.9
Change-Id: I4276bdf1da2d8a51a41730d909b17e9d392705b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of run_opengl_tests Qt config flag. We need the runtime check
anyways, so we can simplify things by having the Windows platform
return false for the capability if the run_opengl_tests configure
feature is not enabled.
Change-Id: Ie14dbf2c6d8a1fee552bac004b0bb144ccf46d27
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Qt handles ICONDIRENTRY having a wBitCount of zero by using
BITMAPINFOHEADER.biBitCount. However, it does not report that
value through _q_icoOrigDepth. This makes the QIcon unable
to pick the highest quality image for some ICO files.
Pick-to: 6.10 6.9 6.8
Change-Id: Id73a1e480214c9d782e6122101728c2bc5dbf9e7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
There was a copy&paste error, which wasn't caught because the test
wasn't precise enough, and the actual use case in qtdeclarative doesn't
need to query the builder.
Fix that, and adjust the test to verify that setting and querying all
flags does report everything as set.
Amends 2b41b6fede
Change-Id: Iab5186d4f8aff91afc406587cc4eb11c969c4c84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Ensure that BroadcastSocketOption is only set for IPv4 UDP sockets,
as IPv6 does not support broadcasting. According to RFC 4291,
broadcasting is replaced by multicasting in IPv6.
Pick-to: 6.5 6.8 6.9 6.10
Task-number: QTBUG-130070
Change-Id: Ia3a98d276f659e8f2676743404370b8a15a0f179
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tst_qMenuBar::taskQTBUG11823_crashwithInvisibleActions is flaky on
openSUSE where setActiveAction is called before the resize events had
time to finish processing.
Wait for 2 resize events to have been processed while on openSUSE
calling setActiveAction. The resize events caused the active action
to be removed. Their asynchronicity randomized their handling
before or after the active action was verified.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6be81781bf9be0ed522af3ba3f1aee9a665af97d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
tst_QWindow::testInputEvents() is flaky where the simulated click is
sometimes not received by the window. This is caused by an incorrect
framePosition, where the position of the window is taken instead.
Remove the frame of the window and verify that the window's
position has been updated by using the ensurePositionTopLeft()
helper function.
Include QtTest/private/qtesthelpers_p.h to use the helper function.
Fix flaky tst_QWindow::testInputEvents on Opensuse
Change-Id: Ie65a70e7a478ff2db60a11f6ef6419dac3489ee6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The tst_Mouse::doubleClick case in tst_selftest is flaky on openSuSE
15.6. The issue arises because the mousePress event is occurs before
the MouseWindow position has been updated.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic29f6fb8360f89e9f0396d9dbff323b15a2b3298
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The cases fantasy and cursive from tst_QFont::defaultFamily are no
longer flaky on RHEL.
Change-Id: I22efc73d6a63d5b1b3c07dd16b61737821a2828c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Move the comment closer to the line that actually disables compression.
Pick-to: 6.8 6.9 6.10
Change-Id: Ib65d5ddffa9b3e3cf97a2ce0e04219c651017653
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Introduce the qt6_add_android_dynamic_features function. The function
marks the targets specified in the FEATURE_TARGETS argument as dynamic
features, assigned to the specific Android application target.
The dynamic feature target must be the SHARED_LIBRARY and not the
Android target of type different from the DYNAMIC_FEATURE type.
The design allows many-to-many component linking, so multiple Android
applications may use same dynamic feature, and single Android
application may use many dynamic features.
Dynamic features are deployed as part of the main Android application
aab and use the QT_ANDROID_MODERN_BUNDLE as the required pre-requisite.
Limitations:
- Dynamic features only implemented for the single ABI builds.
- Dynamic features are not tested and proved in multi-config builds.
- Qt disallowed to provide the store API to load dynamic features.
Users need to follow Qt guidelines and documentation to implement
own feature delivery.
Task-number: QTBUG-116683
Task-number: QTBUG-124600
Change-Id: Idf10d481cedfe1cb5bd08c86e57a844e502bd6ff
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Current QT_ANDROID_PERMISSIONS property format is inconvenient for
use in the CMake generator expressions and mixes attribute syntax
with CMake list syntax.
This suggests the new format for the QT_ANDROID_PERMISSIONS property.
Each element is encoded the following way:
<android:name>\;<permission>\\\;<extra1>\;<value>\\\;<extra2>\;<value>
Elements are separated using standard CMake semicolons.
QT_ANDROID_PERMISSIONS is now transitive LINK property. This feature
deprecates the '<permission' records in the
Qt6<Module>-android-dependencies.xml files. If application links
Qt Module that requires specific permissions, these permissions will
be written to the application deployment-settings.json file.
The 'permissions' record in the application deployment-settings.json
file is changed too, the new format is following:
"permissions": [{
"name": "permission",
"extra1": "value",
"extra2": "value"
}]
Comparing to the previous format each extra attribute is stored under
a separate key in permission object.
IMPORTANT: androiddeployqt has no backward compatibility with the
old format.
With QT_USE_ANDROID_MODERN_BUNDLE enabled permissions are written
directly to the AndroidManifest.xml without androiddeployqt involved.
Supply tests for the Android permissions, that reads the
manifest-declared permissions in test using the Android PackageManager
API.
Change-Id: I691df33c70acc6c7139302b119edc791fef8d5ef
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Copy contents of QT_ANDROID_PACKAGE_SOURCE_DIR to the target android
build directory. Comparing to the non-modern bundle deployment, this
also support the partial template deployment. This means that known
template files in QT_ANDROID_PACKAGE_SOURCE_DIR are evaluated first
and only then copied.
Cover QT_ANDROID_PACKAGE_SOURCE_DIR with tests.
Change-Id: Iae1517f0b5bb359a815c7bec576a12f6232649f2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This approach is more flexible and modernizes the gradle project
structure for Qt apps. We now try to reproduce the CMake Android project
structure of user applications, in the modern Android project
structure described here: https://developer.android.com/build
The new structure using the module based application build and unlocks
the support for the use of dynamic features and Android libraries(aar).
All gradle-related rules are generated by CMake and androiddeployqt is
used in the auxiliary mode only(--aux-mode option). Update gradle
templates.
To opt-in the modern deployment use the QT_ANDROID_MODERN_BUNDLE
variable.
Task-number: QTBUG-116683
Task-number: QTBUG-124600
Change-Id: I343b884dea77a7b3b9059cf876a81c3693d0294b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_QWindow::enterLeaveOnWindowShowHide is no longer flaky on redhat.
Change-Id: Idf0514fba34f4becdad7c41378419d32dc4c7312
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The useGlobalMode and globalResizeMode testing was not correct.
We just want to look at the input resize parameter and
switch to normal memory mode if that can cause a section resize.
Fixes: QTBUG-138130
Pick-to: 6.9 6.10
Change-Id: If0829e54ec82b68a138a64a770df95ea85ac2e2b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
As the comment says, the flag can only come from a prior call that used
fstat() on the file descriptor, so don't remove it when we couldn't have
added it in the first place.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137438
Change-Id: Ia75e29d28665c334dea6fffdb498a99c416bc3ac
Reviewed-by: Lars Schmertmann <SmallLars@t-online.de>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We were only using the seed for hashing the port number, which is the
weakest of all the uses of the seed, resulting in a weak hash for the
QUrl itself. This commit changes it so QString components of the URL are
themselves also hashed using the seed. As a side benefit, the aeshash()
implementation in qhash.cpp where supported (ARM and x86) is faster than
the siphash() one because it's vectorized.
We're retaining the qHash(QUrl(), seed) == hashing of -1, but it's not
qHash(-1, seed) because QHashCombine adds a constant.
Pick-to: 6.10
Change-Id: If6466d054fd5a4f05205fffdfbc7b655eae5aefb
Reviewed-by: David Faure <david.faure@kdab.com>
[ChangeLog][QtCore][QAtomicScopedValueRollback] Added support for
class template argument deduction (CTAD) when the type of the atomic
and the type of the new value differ, e.g. as in
`atomic<chrono::milliseconds> a; `QAtomicScopedValueRollback rb(a,
10s)`.
Reported-by: Mitch Curtis <mitch.curtis@qt.io>
Pick-to: 6.10
Change-Id: I0472f0852f9fe8ad4c2ca41e14cc64e3aba7da74
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is needed to properly represent QML defined properties in the
QMetaObject.
As a drive-by, do the sanity check in tst_metaobjectbuilder not only for
required, but also for the bindable flag.
Task-number: QTBUG-98846
Change-Id: I8ea894a589ec91a67fcbdb90ae35a4a0faedc662
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Compilers hate out parameters, so provide a replacement for getAxes(),
toAxes(), that returns the result in a struct Axes { x, y, z } instead.
Then make getAxes() an inline wrapper around a toAxes() call, porting
from Q_ASSERT(x && y && z) to Q_PRE(x); Q_PRE(y); Q_PRE(z); as a
drive-by. The separation gives a more detailed error when triggered,
and produces a shorter assertion string.
Add tests, naturally, and port getAxes() calls that don't test
getAxes() to the new function.
There appear to be no other in-tree users that could be ported.
For symmetry reasons, also add a fromAxes(Axes) overload. Take the
argument by value, to avoid the compiler having to deal with aliasing
analysis. At worst, pass-by-value is like pass-by-cref, and whether
or not the extra copy is added or, since C++17, elided, depends on the
specific call. Suppress Clazy's schizophrenic warning, which complains
that we don't take (QVector3D, QVector3D, QVector3D) by value, but
also if we take struct {QVector x,y,z} by value.
[ChangeLog][QtGui][QQuaternion] Added toAxes(), a getAxes()
replacement.
Task-number: QTBUG-138199
Change-Id: Ie26e16528dc06806e59e54eff2d656a33c322bad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: Ia00cc5139f1fb06ff3abcfcb11a0cd570266e7c3
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Information property lists (Info.plist) files are part of application
bundles on Apple platforms and contain basic information about the
application, such as the name of the application's executable.
The Info.plist file can have multiple formats, such as binary or XML.
Makefiles generated by qmake convert Info.plist files to XML by default,
so that variables in the Info.plist can be substituted with values
defined by qmake, such as the name of the application's executable. This
is important if users use external tools such as Xcode for modifying the
Info.plist file, which may save it in binary format. To convert the
formats, the plutil tool shipped with macOS (or the Xcode command-line
tools) is used. The Unix tool sed is then used to actually substitute
variables.
If the Info.plist file is invalid, e.g., due to an invalid tag name, the
plutil invocation fails. However, the converted plist is piped into sed
for variable substitution. The plutil command will simply write an error
message to standard out and return with a non-zero exit code. Due to the
pipe chain, make will not fail and the error message will end up in the
Info.plist in the built application bundle. The application bundle is
then invalid as well, as vital information such as the name of the
executable of the application is missing.
The change ensures that the pipe chain fails, if plutil exits with a
non-zero exit code.
The issue was introduced with my solution for QTBUG-45357. Beforehand,
Info.plists and mistakes therein were simply copied into the application
bundle.
[ChangeLog][qmake] Fail builds on Apple platforms if the Info.plist is
invalid instead of generating corrupt application bundles.
Pick-to: 6.5 6.9 6.10
Change-Id: Ibdb2a18e9bbf35a654af8534aa61188f8389c55a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
tst_QWindow::windowExposedAfterReparent is flaky on Ubuntu 24.04. The
child qwindow being reparented is not correctly converted to a toplevel
window by the window manager.
Close the child qwindow before reparenting it.
Fixes: QTBUG-129023
Change-Id: I9152e4cc3acd3ac757cb5e3b18669a07acd82e33
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
tst_QApplication::touchEventPropagation is no longer flaky on openSuSe
Change-Id: I4064c70700a7569b007d3384db310f792a6c5e0d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Commit 395d23fbb3 changed how the TestLib
represents FP numbers, but didn't update the expected output for the
threewaycompare test. Do it now.
As a drive-by, explicitly use UTC timezone when generating QDateTime
in tst_ThreeWayCompare::checkWeakComparison() to avoid the dependency
on the server's local time zone.
Pick-to: 6.10
Change-Id: I0da52285ee90a1b54c3ff586e276f69f88b19b3b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Until C++17 (inclusive), a default-constructed std::atomic object can,
officially, only be initialized with a call to std::atomic_init, for
which QBasicAtomic doesn't have API. It is even unclear whether
zero-initialization of static and thread-local objects will cause the
object to be initialized.
Seeing as we can't rely on malloc's zero-initialization to properly
initialize std::atomic objects (and therefore QBasicAtomic ones), and
because it's the right thing to do, from a [basic.life] POV, anyway,
port to placement new instead.
The realloc() feels fishy, seeing as it reallocs a struct that
contains an atomic variable (which we don't mark as Q_RELOCATABLE_TYPE
even for our own types), but assume that part it ok, and in-place
construct only if realloc() was passed nullptr (so is equivalen to
malloc()). A final solution for this can probably only be implemented
when we can depend on C++20's atomic_ref, which decouples the
underlying object from the atomic operations performed on it.
Rename the ref_ member to m_ref to catch any uses of the variable,
incl. since removed ones in older branches.
Amends 812a611dc0 (which ported from
QtPrivate::RefCount to QBasicAtomicInt; I didn't check whether
QtPrivate::RefCount had a similar problem, because that commit is
already much older than what I can pick back to at this point).
Task-number: QTBUG-137465
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I188e05d09e20e0820af7cf1cbb651afa860bb9d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Calling the implementation of roleNames() directly breaks overrides, as
we get inconsistent results.
Add a testcase that verifies that we can call setData and itemData on
a list of QObject subclasses.
Pick-to: 6.10
Change-Id: Ia4fc7859bf9136a6c3452e1317a856c790916315
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends commit eca1e634b657e1e27adc863d196027406b12b00c - the update to
CLDR v47 added data for en-FR, where previously en-FR was used to test
we correctly converted that according to likely subtag rules to en-US.
The initial update simply changed the expected results, thereby losing
the testing that we fall back correctly when asked for an unsupported
combination. Added tests for ar-US to restore testing of fall-backs.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-137782
Change-Id: I13e7a4729da5f65a7b3019da6fcfa3d195191097
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Add a check that we can compare QObjects implementing interfaces to
said interface.
We can.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-135626
Change-Id: I0e1164b43d9112e051add2c034dea50ab5192b2d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Valgrind and asan are incompatible. Says Valgrind:
==1602116==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
Fix by excluding the test from asan builds.
Amends the addition of -sanitize options; didn't look it up, since it
was certainly before Qt 6.0.
Pick-to: 6.10 6.9 6.9 6.5
Change-Id: I4c9922323c4e9457a6d721ca594652da6a0a55fb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The type normalization code was crashing when passing a nullptr.
Fix it by explicitly checking the begin == end case in QTypeNormalizer
code.
Modify the test code to make the difference between a nullptr and an
empty string obvious, and add test-casees to cover these corner cases.
Amends 4dbac23e53 which was added for
Qt 6.0, so pick to all active Qt 6 branches.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0f6855d19146f18170c34061f0631f9192df8bad
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Those are needed by qmlls to be able to jump to C++ definitions.
Task-number: QTBUG-119143
Task-number: QTBUG-128393
Change-Id: I4fb9394b0a22a02501bafdbe95a7cd8998adfe11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add missing dependency to MOC such that the .json files are regenerated
automatically when moc was modified.
Change-Id: Ie874443b0c11cc7c7feefe1bc1a555c3bd135257
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We support char32_t, so there's no reason to not support a
4-byte-wchar_t.
This also fixes a nasty asymmery between QString::arg(L'ä') (integral
output) and QL1SV::arg(L'ä') or QString::arg(L'ä', L'ä') (characters)
[ChangeLog][Important Behavior Changes][QtCore][QString] The unary
arg() function now treats wchar_t as a character (string-like; was:
integer), so u"%1".arg(L'ø') will now return "ø" and not '248". This
makes the function consistent with both QString multi-arg() and
QLatin1StringView::arg().
[ChangeLog][QtCore][QAnyStringView] Supports construction from a
single wchar_t on all platforms now (was: only on Windows).
Fixes: QTBUG-126054
Pick-to: 6.10
Change-Id: I21b7a9782f03d04686207db30d1b1c9d50bc8169
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The qquaternion.h include will vanish from qmatrix4x4.h soon, but some
TUs depended on on the transitive include.
This patch includes qquaternion.h into all TUs that use QQuaternion,
but didn't include its header.
I didn't check all the individual TU's history to make a detailed
"amends", so I'll just pick this all the way back, knowing there may
have been more users in older branches, or some TUs don't exist there,
but it since we're not picking the removal of qquaternion.h from
qmatrix4x4.h further than 6.10, I don't need to do detailed
checking. CI will tell me when something's wrong.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Icf0db8ba4f12421fd46f9d1041f235bf4cc2c12b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The implementation of match() was only looking into the source model,
without considering the fact that data() could be reimplemented in
a QIdentityProxyModel subclass (a very common usage pattern for the
class, part of the documentation).
The simplest solution is to let the default implementation from
QAbstractItemModel do matching the usual way, calling data().
Fixes: QTBUG-78013
Pick-to: 6.10 6.9 6.8
Change-Id: If984ffa5f8dbdfe9a76eaec8b82648d705cfecd4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit replaces one-shot synchronization of threads that were using
QSemaphore with QLatch. QSemaphore is efficient on Linux and Windows,
but allocates memory elsewhere. Even on those platforms where we have
futex-like OS support, QSemaphore is heavier than what we really need
here.
All but one uses of QSemaphore in qtbase libraries (I didn't change
examples or tests) were replaced. The remaining use of QSemaphore in
qnetworkproxy_libproxy.cpp is a proper producer-consumer.
Change-Id: Ib5ce7a497e034ebabb2cfffd1761a4fcb2be9a6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
As a drive-by:
- replace direct by copy initialization and reflow the line with the
ternary
- make objects const
- don't compute the cross product twice; it's anti-commutative, so if
a × b is 0, then so is b × a = -(a × b).
Amends 95d034a14f.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I4dc4582854b3d93a6e3468e8b19afe28d77c6c1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Effectively check if we are importing while still building the current
project
Task-number: QTBUG-135233
Change-Id: If172617463157e84e1b16fc2354147fabae41084
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Like std::latch[1][2]. Originally proposed by N3666, it only became a
reality after the atomic wait functionality in C++20. We can't depend on
that yet in Qt because a) we don't depend on C++20 yet, and b) the
implementations of atomic waiting and std::latch are too recent in the
Standard Library implementations (GCC 12, LLVM 12, MSVC 19.28). This
implementation therefore builds the functionality from scratch, like the
original proposal did[3].
We'll probably keep our implementation for the long run, because it's
more efficient than the Standard Libraries' implementations. The MS STL
implementation is the closest to ours and to bare OS functionality: uses
WaitOnAddress / WakeByAddress as expected, but it generates a bit more
code than is necessary. And it's Windows-specific, of course.
Both cross-platform implementations (libstdc++ and libc++) do far more
work than necessary for platforms that offer a OS futex-like
support. Both of them busy-loop waiting for the atomic value to change
and then exponentially back off using sched_yield(). Those aren't useful
to us, as the majority of our uses are with threads that have just been
created and have therefore likely made little progress. They can be
actively harmful in some cases. The libc++ implementation is even worse
by using std::high_resolution_clock to time this looping up to 64 µs in
inline code before making a system call to sleep and wait (and it can't
/ won't use the latch's address for the futex itself).
Both implementations also use an extra atomic out of a global pool (16
in libstdc++, 256 in libc++) to indicate whether there is any waiter on
this address and therefore avoid the system call to wake them. See the
next commit for an efficient implementation for QLatch.
This implementation uses the limited atomic-wait functionality added by
the previous commit for platforms that don't support futexes.
[1] https://wg21.link/p1135
[2] https://en.cppreference.com/w/cpp/thread/latch/latch
[3] https://github.com/ogiroux/atomic_wait/tree/master/include
Change-Id: Ib5ce7a497e034ebabb2cfffd1761a3a6ff2598d3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
atomic_wait() and atomic_notify_{one,all}() are available in C++20,
which we can't depend on right now. So we implement our own fallback
implementation. This is a simple implementation for systems which don't
have either futexes or the C++20 atomic wait API. That means it's not
very efficient, just simple. The unit test tests the fallback
implementation only: it is not Qt's business to test the Standard
Library.
The fallback implementation and the Standard Library's are not
binary-compatible and cannot be mixed. Callers must ensure that all
sides use the same implementation and the easiest way to do that is to
only use this in non-inline code, or at worst inline code that isn't
shared across libraries/modules/plugins.
Change-Id: Ib5ce7a497e034ebabb2cfffd1761a0e497dd17d4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When the IPv4 netmask is 255.255.255.255 (point-to-point interface), we
were calculating our own local IP. That meant we would route through the
loopback interface to connect to it, not the interface, resulting in
test failures. So just flip one bit and hope that it will work.
FAIL! : tst_QNetworkInterface::localAddress(vpn0-10.124.222.242) The computed value is expected to be less than or equal to the baseline, but is not
Computed (pmtu) : 65535
Baseline (outgoingIface->maximumTransmissionUnit()): 1422
$ ip r get 10.124.222.242
local 10.124.222.242 dev lo table local src 10.124.222.242 uid 1000
Pick-to: 6.10 6.9 6.8
Change-Id: I3d18ad117dd0c49fcec2fffdcb29534e64a438d9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We still want to test the code on non-affected MSVC versions, so we
- remove the header from the manual qt_wrap_cpp call,
- instead, let automoc pick it up by making it part of the target,
- include the moc file to prevent CMake putting the generated file
in the combined C++ file,
- but include it only conditionally to avoid the compilation issue on
MSVC.
This has the side effect that we no longer consider the file in the JSON
output, but that is less important.
Pick-to: 6.10 6.9
Change-Id: I46d93aac9721eba081221586b66a3742c863da90
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
A qt_find_package call first tries to find a Config package
with the CONFIG mode option, and if not found, falls back to an
arg-less mode which searches both Config and Find modules.
For some packages, we know we want to find the Find module because
there can't be a Config package, e.g our FindWrap modules or any of
the other Find modules we carry in our cmake directory.
So we should annotate these calls with MODULE.
Aside from slightly faster configuration, there is another reason to
do so.
Future versions of CMake will automatically log find_package
calls that have a state change (e.g. Not Found -> Found) into
CMakeConfigureLog.yaml.
Due to the Config-first logic in qt_find_package, we always unset the
Foo_DIR variable if the Config package is not found.
This means that there will be a constant build up of not-found
messages in the log.
Explicitly annotating the calls with MODULE will prevent this. Do
that.
This commit relands f1a59e974f
This reverts commit 0ce82b78a3.
Pick-to: 6.10
Change-Id: I5d37579d2f4957215ce1475b5c0ec8509d77c83d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Enable using QFuture for handling async tasks, which
is a use case which can work also for the no-thread
configuration.
Add implementation files and headers for the QFuture
dependencies to the no-thread build. These files build,
but as with no-thread QThread there is no guarantee that
they will do anything useful.
Stub out some more functions in QThread, and also add
stubs for no-op QSemaphore.
Enable the tst_qfuture test and skip tests which require
threads. tst_qfuture now runs with:
Totals: 70 passed, 0 failed, 13 skipped, 0 blacklisted, 6373ms
Pick-to: 6.10
Change-Id: Icd82590915d6034ae7829ead3fb4ebaf1e9c2aad
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
and touchToMouseTranslationByPopup()
Compositor will dismiss the request if we just use mInputDevices in
the setGrabPopup() call in QWaylandXdgSurface::QWaylandXdgSurface().
We don't have a solution to fake it without hacking compositor.
See also https://wayland.app/protocols/xdg-shell#xdg_popup:request:grab
This request must be used in response to some sort of user action
like a button press, key press, or touch down event. The serial
number of the event should be passed as 'serial'.
Pick-to: 6.10
Task-number: QTBUG-137020
Change-Id: I8c78fa8cc269125a4de56625433e313d5767b17d
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Add tests with nested template args.
Add tests for empty and null signatures, requested in code review.
Add a test for `char * const *` to verify that
QTypeNormalizer::normalizeType() normalizes it as expected.
Add a test for explicit void argument inside a template, suggested by
Fabian in code review.
Pick-to: 6.10
Change-Id: I040135355702e9c11d00a8685c274894dc46d848
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Version 2025-06-16_09-45-02_UTC.
[ChangeLog][Third-Party Code] Updated the public suffix list to upstream
version 2025-06-16_09-45-02_UTC.
Pick-to: 6.10 6.9 6.8 6.5 5.15
Task-number: QTBUG-137782
Change-Id: I8f4b430d5d01f73e9cc27ce6947d1fc595a97848
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
A nested window or a subsurface in wayland terms can't get focus.
See also 0bd68fac97 .
Pick-to: 6.10
Task-number: QTBUG-137020
Change-Id: I563b8cfab84c136fa2a1e82f9feecafafc63d4a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If the byte array would detach or reallocate it would copy the data
over, then do the replacements; instead create a new byte array and copy
the data and replacement to it as needed, then swap it with `this`.
Use QVLA to hold the indices of the replacement locations into the byte
array, this way we can do the replacements in one go, instead of chunks
of 4096.
Since we collect the indices, now there is no need to guard against
`before` being part of `this`.
Use qsizetype instead of size_t, so as not to convert from/to each
other. Using an unsigned type to avoid negative values doesn't work,
indices[size_t(-1)] could be out of bounds anyway.
Task-number: QTBUG-133737
Task-number: QTBUG-106185
Change-Id: I8fe87d56227e3c4b2b39b7625659eb61c6b174d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Set a fixed size to the progressbar and verify it before testing minimum and maximum repaint.
Remove setActiveWindow as this anti-pattern is no longer necessary for Linux environments.
Remove flakiness on openSuSE 15.6 and Ubuntu 24.04
Change-Id: I7b0deea5964abbebe31c24d98cacaf7336e82157
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Also `before` points into this.
Pick-to: 6.10 6.9 6.8
Change-Id: I0d1aa522e96c046ea26fc0948546e0625c1a83e7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This breaks reconfiguring Qt in various ways, one of which is
CMake Error at cmake/QtTargetHelpers.cmake:1557 (message):
PkgConfig::ATSPI2 is not a valid target.
This happens because pkg_check_modules sets ATSPI2_FOUND to 1, so
qt_find_package thinks it shouldn't find the FindATSPI2.cmake module,
which ends up not creating the ATSPI2 target.
This reverts commit f1a59e974f.
Pick-to: 6.10
Fixes: QTBUG-137870
Change-Id: Ica74a236c6b1bb9d7ca9af29175cb2e84a93251b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
tst_qapplication is missing the modal_helper executable from
the apk. Set the libmodal_helper.so as a target property for the
tst_qapplication with QT_ANDROID_EXTRA_LIBS property.
Change the name of qtbug_12673() test function to modalDialog(),
I think this better represents what's being tested.
The bug ticket representing qtbug_12673() can be found from
the ticket linked to this commit.
Construct a full path to the modal_helper.so and pass that
to QProcess.start instead of relative path to filename
when targeting Android.
Add a shared utility function androidAbi() that returns
the currently defined Android ABI.
Change the function name in BLACKLIST file.
Task-number: QTQAINFRA-6908
Pick-to: 6.8 6.9 6.10
Change-Id: I13904acda0f5608ea31df49bd95824e1412f2786
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Some of the changes required updating the tests.
Like spanish separators and (English,France) now returning
France instead of United States for territory.
[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v47.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-137782
Change-Id: Ic939666b9718d59ab28c51f65ac38cf84b97bf93
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QUrlPrivate::parse() did not clear all the state because it was designed
for parsing from the QUrl constructor. The few conditions under which it
retained some memory weren't obvious and weren't tested anywhere (it was
the fragment and query).
This will shed memory from the QStrings if we were the last reference,
only to allocate again. There is some value in attempting to reuse their
buffers by doing resize(0) and then appending in qt_urlRecode(), but
that introduces complexity I didn't want to deal with.
This incidentally fixes the qHash() inequalities too.
Changelog in the previous commit.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-134896
Fixes: QTBUG-134900
Change-Id: I1885d0750ac1109aab61fffdbf7fad775706e61f
Reviewed-by: David Faure <david.faure@kdab.com>
When a URL like "http://:pass@example.com" is parsed, we will set the
username field to "present", but if you parse "http://example.com" and
then set the password, the field would still be marked as absent. This
commit fixes that, while restoring its absence if the password is later
removed.
[ChangeLog][QtCore][QUrl] Fixed a number of bugs in QUrl where a URL
modified using the setXxx() functions would fail to compare equal to
itself after going through toString() and setUrl() round-trip.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-134900
Task-number: QTBUG-134896
Change-Id: I490cfd3d01260823ffdffffd4d9ac92dd42723b0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The QShortcutMap triggers shortcuts on key press. It's okay with normal
shortcuts but modifier only shortcuts require extra care. Depending on
the context, they can be triggered either on key press or key release.
For example, for push to talk, they should be triggered on key press,
but if a modifier only shortcut is assigned to a dashboard or something,
then it should be triggered on key release so the dashboard is not
accidentally opened when pressing another shortcut that starts with the
same modifier. The QShortcutMap currently doesn't provide support for
modifier only shortcuts.
The proposed new test case verifies that a modifier only shortcut will
not be accidentally triggered if there is a normal shortcut with the
same modifier keys.
Task-number: QTBUG-132435
Change-Id: I612d0239b29f8c1730016d10257def039b5e6cf1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since the class was not desigend to support a nullptr d_ptr, this
change requires modifications in the destructor and copy-ctor.
The change in destructor is straightforward - simply add a check
that d_ptr is not null.
The copy-constructor was using a qAtomicAssign() helper, which
was relying on the fact that the passed pointers are not null, so
we cannot use it anymore. Use copy-and-swap instead.
The other methods do not require any changes, because the
moved-from object can only be destroyed or assigned-to.
[ChangeLog][QtDBus][QDBusMessage] Added move constructor.
Change-Id: Ic8a0d913b9cf2f881369f7ad4f3a88c1f3fb345f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Move the existing QCocoaFileIconEngine into a separate file in the
darwin platform code, from where we can use it from both the cocoa
and the iOS theme.
Refactor the implementation for macOS to create and retain the NSImage
as a member of the engine, and cache the QPixmap when it's requested,
reusing it as long as it has the correct size.
The iOS implementation is similar, except we need to go through
UIDocumentInteractionController to get the icons for the file's URL.
Explicitly make sure that we maintain the aspect ratio of the image we
get.
Augment the iconbrowser manual test to generate temporary files with
certain extensions, and include those in the UI, allowing us to test
that the icons we get from QAbstractFileIconProvider match the file
type.
Fixes: QTBUG-134239
Change-Id: I8fb63b3c518a6eb200f5948a1c38fd485e3b1c6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This adds {QJsonObject,QCborMap}::asKeyValueRange() which returns a
range over key-value pairs of the object/map
(`pair<QAnyStringView, QJsonValueRef>` and
`pair<QCborValueConstRef, QCborValue>`).
This uses QKeyValueIterator under the hood. QJsonObject's iterator only
iterates over the items, so using it in a range-based for loop won't
give users access to the key. With `asKeyValueRange` one can iterate
over both keys and values and conveniently use structured bindings.
QCborMap's iterator already iterates over key-value pairs, so
`asKeyValueRange` is provided for API symmetry.
In `QKeyValueIterator`, this adds a fourth template parameter `Traits`
to support custom `key()` and `value()` functions.
This is specifically needed for `QJsonObject`, as its actualy key is a
string view, but `key()` returns a `QString`.
[ChangeLog][QtCore][QJsonObject] Added asKeyValueRange to iterate with a
range-based for loop over key-value pairs with support for structured
bindings.
[ChangeLog][QtCore][QCborMap] Added asKeyValueRange to iterate with a
range-based for loop over key-value pairs with support for structured
bindings.
Pick-to: 6.10
Change-Id: I68d97fada8b2d7ef7224f1beb5aa685aac3d1b16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This method executes the wrapped function ahead of destruction, and
can alleviate the need to hold QScopeGuards in optional<>s to emulate
the functionality.
Port such a case in tst_QEventLoop as demonstration.
[ChangeLog][QtCore][QScopeGuard] Added commit() method.
Change-Id: Ie2674e1c82e242bdeb1eeaf183607e5c71c1448a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We must not add an enum qualifie if it is already emitted because
it was part of the property signature.
Amends dea21545b3
Fixes: QTBUG-137850
Pick-to: 6.10 6.9
Change-Id: I07a27014023a60f07a97e323a7d7e5b9d233d555
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The wayland specification now states the seat_name should be sent before
capabilities. Weston has also been changed.
Reverts parts of QtWayland 4322496f73bc093d1ff97b24e90d6385f35189d8.
Task-number: QTBUG-72167
Task-number: QTBUG-115207
Change-Id: If8373ea7a711c287dab0cd9d6a087a825d8239f6
Reviewed-by: David Redondo <qt@david-redondo.de>
A nested window or a subsurface in wayland terms can't get focus.
See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/236 ,
protocol: wl_subsurface will never be focused.
Pick-to: 6.10
Task-number: QTBUG-137020
Change-Id: I2dbecbf112e5ad8918b283ef64d6bba9afc5e861
Reviewed-by: David Edmundson <davidedmundson@kde.org>
tst_qfileinfo still fails due to lack of symlink permissions for me.
Change-Id: I94c621caed5c4167427efffdee59f20b03764714
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
A qt_find_package call first tries to find a Config package
with the CONFIG mode option, and if not found, falls back to an
arg-less mode which searches both Config and Find modules.
For some packages, we know we want to find the Find module because
there can't be a Config package, e.g our FindWrap modules or any of
the other Find modules we carry in our cmake directory.
So we should annotate these calls with MODULE.
Aside from slightly faster configuration, there is another reason to
do so.
Future versions of CMake will automatically log find_package
calls that have a state change (e.g. Not Found -> Found) into
CMakeConfigureLog.yaml.
Due to the Config-first logic in qt_find_package, we always unset the
Foo_DIR variable if the Config package is not found.
This means that there will be a constant build up of not-found
messages in the log.
Explicitly annotating the calls with MODULE will prevent this. Do
that.
Pick-to: 6.10
Change-Id: I465b015ac18f8a09b9a5c86cec7b6312a0bfbdf1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
- Add operator bool() that checks whether the associated stream has
no error status. This operator makes it possible to use streams
and functions that return references to streams as loop conditions:
`while (stream >> data)`.
- Update existing testcases that use or can use the status of stream
operations.
[ChangeLog][QtCore][QDataStream] Added implicit conversion to bool,
returning `status() == Ok`.
Found in API-review (added for symmetry with QTextStream).
Pick-to: 6.10
Change-Id: I3eb8251f40eba1a8164e088fa10de670564f428e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
There are applications that reuse menus for different user interface
elements. For example, a menu can be shown in the menubar or in a right
click context menu.
On the other hand, the QMenu currently locks on the first transient
parent and doesn't change it even after effectively getting attached to
another parent.
This change addresses the issue by making the QMenu re-evaluate the
transient parent on every show event and also ensuring that the caused
widget takes the precedence over other heuristics. The caused widget is
more closely related to the user input.
Pick-to: 6.9 6.10
Fixes: QTBUG-137467
Change-Id: I4f968833380121be1300af1a44237735b9a97b17
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The Golden Rule of container selection is "Never use a
dynamically-sized container for statically-sized data."
The number of threads is fixed, so we should be using std::array
instead of std::vector. Minimize(s) the number of NUM_THREADS
mentions, too.
Amends 253f34082f.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ide69ad08abef9efdbc2ec11be5bd8fd3feb8973a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
It is possible (and somewhat common on Windows) to have getters and
types with the same name. This so far would cause issues in the moc
generated code.
To fix it, we remember all names of enums found in a class, and prefix
references to such types with "enum". Note that this requires a new set
to track them, as other parts of moc currently treat `eunm Foo { Val }`
and `typedef enum { Val } Foo` the same, but `enum Foo` is only valid
C++ for the former.
A similar issue would also exist with inner structs, but that seems to
be less common, so isn't implemented yet.
We also use the opportunity to drop the typeNameForCast member in
ArgumentDef, as we can't do the enum disambiguation with it easily.
Instead, we do it on-demand, which should also give a beneficial
memory/runtime trade-off in any case.
Fixes: QTBUG-137452
Pick-to: 6.10 6.9
Change-Id: I07341f971c9ca65edecbea890ebc33e007087c43
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The old code would return from the test function upon the first wait()
failure. It should, however, reap (join) all the following threads,
too, or fail trying. So drag the QVERIFY out of the loop, ensuring
that all threads got wait()ed upon. This can, in theory, wait for 20*30s
= 10min now, but the test function will be killed by the watchdog after
300s = 5min, and that at least doesn't leave unreaped threads around,
so is still preferable.
As a half-way drive-by, port to chrono timeouts.
Amends 253f34082f.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Icdd36549ecf15fc77b97774aa2ef5b9384a2c67b
Reviewed-by: David Faure <david.faure@kdab.com>
... and QObjects can have thread affinity to such threads.
This was always understood to be the case, but a recent internal
discussion raised doubt whether it would actually work. Since we
didn't find an actual test for this, add one now.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I73556d54cd0b9c079d78b864ca94b66721ae3599
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Instead of reporting no/empty text on the a11y layer when
using a QLineEdit::EchoMode that doesn't display the actual
text as is (e.g. in case of a password field), use
QLineEdit::displayText, which already prevents exposing the
actual text unless it's also displayed on screen.
Previously, the character count and caret/cursor position was
still reported for the actual text, but an empty string was reported
for the text itself, which was inconsistent. (A cursor position of
3 within an allegedly empty text doesn't make sense, and empty text
cannot have a character count of 5.)
With this commit in place, entering "hello" in the QLineEdit from the
sample app from QTBUG-109599 now results in replacement/mask
characters as shown on screen being reported for the text on the a11y
layer as well as long as QLineEdit::Password is used.
Demo using Accerciser's IPython console on Linux, with the
QLineEdit's accessible object selected in Accerciser's treeview
of the sample app's a11y hierarchy.
Without this commit in place:
In [11]: text = acc.queryText()
In [12]: text.characterCount
Out[12]: 5
In [13]: text.getText(0, -1)
Out[13]: ''
With this commit in place:
In [16]: text = acc.queryText()
In [17]: text.characterCount
Out[17]: 5
In [18]: text.getText(0, -1)
Out[18]: '●●●●●'
The Orca screen reader now announces "circle" as expected
when moving the cursor between the individual characters.
This also fixes the assert/crash seen with Narrator as mentioned
in QTBUG-109599, due to the above-mentioned mismatch between
reported character count and actual text length.
(QWindowsUiaTextRangeProvider::ExpandToEnclosingUnit relies on
the reported character count, then accesses the character by
index, but the actual string was empty.)
The QAccessibleLineEdit::text(QAccessible::Value) case
previously had manual handling to report mask characters.
Use the displayText there, too.
Adjust tst_QAccessibility::lineEditTest accordingly and
extend it to test the QAccessibleTextInterface in addition.
Since mask characters for passwords in QLineEdit::displayText
are platform-dependent, don't compare the text reported via
a11y interfaces to a hard-coded string, but instead check it
matches the displayText, but differs from the (plain) text.
Fixes: QTBUG-109599
Pick-to: 6.10 6.9
Change-Id: Ifebb4502b71e11d431b708eea613cb2a10e3f237
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
tst_QWindow::testInputEvents is flaky on openSUSE where a simulated
mouse click is performed before the window is exposed and active.
Verify that the window is exposed and active at start of function.
Fix flakiness on openSuSE 15.6
Pick-to: 6.10
Change-Id: I71e79b09d805ea3c15a558fed4693671bdc2a56d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Renamed enum values to avoid redundant naming.
Resulted from API review.
Pick-to: 6.10
Change-Id: I5213695c02a763d4689c5df97b20c282368b4fbd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Clang 19 -std=c++23 complained that ITERATIONS_PER_THREAD was
captured, but not used, so 668d81f73a
dropped it, after making the variable constexpr.
Picking that change back to older branches, we found that MSVC
(14.29?) complains that it's _not_ captured anymore:
tst_qpointer.cpp(491): error C3493: 'ITERATIONS_PER_THREAD' cannot be implicitly captured because no default capture mode has been specified
To appease both compilers, and cover the maximum range of C++ standard
editions, use implicit [&] capture, which should work everywhere.
Not picking to 6.5, because the cherry-pick of
668d81f73a already had to make that
change in order to pass CI.
Pick-to: 6.10 6.9 6.8
Change-Id: Iacbd53d3904608e8c9cd73edf31ba7924fd508e6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
tst_QScroller::overshoot was initially a boilerplate, making it
difficult to understand what was actually being tested.
Refactor this test to be data-driven. Additionally, create a new test
function, overshoot_segments, which was part of
tst_QScroller::overshoot and should be tested independently.
Transfer the blacklisted platform of overshoot to overshoot_segments.
Change-Id: I59d89dfab4bb09c41fce99ad4f40163736c6ef78
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Writing the tests for QUtf8StringView showed that this conversation does
not work if the underlying storage_type is not char8_t. This is
something a user rightfully expects from our library and we therefore
added an explicit conversion operator for it.
[ChangeLog][QtCore][QUtf8StringView] Added std::u8string_view operator
if compiled with C++20.
Pick-to: 6.10
Change-Id: Ia80507bdd76686bee16a40745be064e9bdfef130
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
__has_include is part of C++17, but moc did not handle it so far.
This commit fixes moc to correctly support it.
It should be noted that support for __has_include relies on all
necessary include paths being passed to moc.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136097
Change-Id: I7284e97dea12d1637b38349d32e090c0102124e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Despite the name, this class is copyable, as evidenced by the fact it
has a copy constructor. But that copy constructor causes the implicitly-
declared copy-assignment operator to be deprecated.
warning: implicitly-declared ‘constexpr Movable& Movable::operator=(const Movable&)’ is deprecated [-Wdeprecated-copy]
tst_containerapisymmetry.cpp:55:5: note: because ‘Movable’ has user-provided ‘Movable::Movable(const Movable&)’
Amends 2e1763d83a (5.14).
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie661f7361a8d86648b21fffdaf9e7d076f86ebe9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Function has become flaky due to additions made in
84e09e060b.
Blacklist for now.
Add missing link to QTBUG-134105 in BLACKLIST file.
Task-number: QTBUG-134105
Pick-to: 6.10 6.9
Change-Id: I2e53ab8de08575f13c950dd92d24ad3017a7dc0a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Our accessibilityWindow implementation asks the parent for it's window,
expecting that it will always be the same. This is conceptually correct.
However, as we don't represent windows through QAccessibilityInterface
and instead rely on the natively provided element, the filtering out of
ignored elements result in accessibilityParent return a null object once
the parent is the window.
Instead, check if we get an interface that represents a Window, and
if so fall through to the code returning the NSView (after going through
QAcessibilityInterface::window call, which was so far missing).
And if we then get a Window element as the parent, then we don't have
to call accessibilityWindow on that parent again. Instead, return the
result directly and only keep going if we got some other element.
Add a test case that confirms that we now get a valid result for the
window attribute.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137157
Change-Id: Ifa485734b290284bd5a1286e3b3c18454442fa10
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Says Clang:
tst_moc.cpp:86:14: warning: inline namespace reopened as a non-inline namespace [-Winline-namespace-reopened-noninline]
86 | namespace B::inline C {}
| ^
| inline
tst_moc.cpp:84:21: note: previous definition is here
84 | namespace A::inline B {}
| ^
There's no minimally-invasive fix, because neither
inline namespace B::inline C {}
nor
namespace inline B::inline C {}
are valid C++.
So wrap the whole thing in another namespace ("Qt_", to avoid clashing
with somthing else, incl. our own namespace Qt), so we have roughly
the same structure as before, but with two non-inline outer namespaces
instead of one.
Amends 5222df2be7.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia0e35e87934abebc76b719e3bd8124ac77ea07f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Sometimes, fillMetaData() is called with a QFileSystemEntry with only
the native (QByteArray) format, which we used above in this function
anyway in order to lstat() and stat() the path. This avoids forcing the
QFSE to create the QString form for us to check the first character.
Pick-to: 6.10 6.9 6.8
Change-Id: I8d93f6db83a28d70a192fffd6668734a8024b88b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Clang informs that ITERATIONS_PER_THREAD need not be captured:
tst_qpointer.cpp:548:66: warning: lambda capture 'ITERATIONS_PER_THREAD' is not required to be captured for this use [-Wunused-lambda-capture]
548 | QThread::create([&startSemaphore, &targetObject, ITERATIONS_PER_THREAD]() {
| ~~^~~~~~~~~~~~~~~~~~~~~
Make ITERATIONS_PER_THREAD (and NUM_THREADS, while at it) constexpr,
indicating even to non-language-lawyers that these variables, indeed,
need not be captured, then drop the capture.
Amends 253f34082f.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I27d94763058e1dcea3a65d4ff2c859b40336446f
Reviewed-by: David Faure <david.faure@kdab.com>
The old code used the same type of container for both target and
source in the range-assign() test. This limits our test coverage.
Fork the test to explicitly test with random-access (std::vector), as
well as forward-only (std::forward_list) iterators. This ensures we
have coverage of random-access, forward as well as the existing input
iterator types.
Amends 426d975cee9c783aec0832f376b836cdabee983f.
Pick-to: 6.10 6.9 6.8
Change-Id: I59c7a322ecbcc564baa1263e02b234bc53563fac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>