Unix dispatcher is not used and - as such - redundant on WASM.
Change-Id: Ia8789ef783b06ce9cfba2ce9d67159db2355b594
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
If OpenSSL version is 3.1.1 or above - this version moved the protocol
under security level 0, but the default one is 1.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-116166
Change-Id: Iaabb2cf33e2a9f280d6167233ee16080dee808b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Static variables for a message handler were used only in developer
build, while they were declared unconditionally.
That has lead to compiler warnings about unused variables in a
non developer build.
=> declare them only in developer build
=> move assignment and static method in front of the method,
that uses them.
Pick-to: 6.6 6.5
Change-Id: Ie06f91f7857130f08fd484a6e7319ddfd16c546b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When appending to an empty string or byte array, we optimize and
copy the internal pointer. But if the other string/byte array was
created with fromRawData this might be temporary data on the stack/heap
and might be de-allocated or overwritten before the string/byte array
is used or is forced to make a deep-copy. This would lead to incorrect
data being used.
This is easy to overlook if you plan to append multiple strings
together, potentially supplied through an argument. Upon appending a
second string it would make a full copy, but there might not be a
guarantee for that. So, it's hard for users to avoid this pitfall!
Fixes: QTBUG-115752
Pick-to: 6.6 6.5 6.2
Change-Id: Ia9aa5f463121c2ce2e0e8eee8a6c8612b7297f2b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
IndexedDB version of QSettings will now use solely the sync versions
of data access functions. Those will suspend with JSPI.
This makes IDB settings conform to the QSettings contract - and also
allows us to enable tests in tst_qsettings for the IDB version of
QSettings.
Also, do not treat the IndexedDB format as one defining read/write
functions in QSettings - those are the same as for ini format, as
IndexedDB settings backend uses a backing ini file.
Change-Id: Iee3471cc79c0cea87378923cf9baac58e56d1272
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Starting from OpenSSL v 3.1.1 DTLS 1.0 is only available, if the
security level is 0, which is not the case most of the time. So
we consider this version number to be a 'threshold' after which
we don't test v 1.0 anymore.
Pick-to: 6.5 6.6 6.2 5.15
Task-number: QTBUG-116166
Change-Id: I9763703f36ae742e1d3c7cb17872cf8d0d82ab85
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Observers should only be registered when _reading_ the property.
Otherwise we get binding loops.
Pick-to: 6.6 6.5
Change-Id: I974f6ea444fa7a5d333ed79eea6f34e3d757d169
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The loop was iterating over a temporary, so it couldn't have changed it.
Store the container in a local const variable and port to ranged-for.
Drive-by change: don't call ps->availablePrintDeviceIds() multiple
times.
Task-number: QTBUG-115839
Change-Id: If2cabec68040dc7096acf0b7ddeff72d7c8c7750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
resolution(): a local const container, Q_FOREACH wasn't needed here to
begin with, port to ranged-for
The rest, the loops were iterating over temporaries, so just put them in
local const auto variables and use ranged-for.
Task-number: QTBUG-115839
Change-Id: Iebe6d164661d74df9fefb764c370cdc9a8e817ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
msgMimeTypeForFileNameFailed(): the method takes the container by const&
and I've made the container const at the call site, so now it's
iterating over a const container.
allMimeTypes(): iterating over a const container.
checkHasMimeType(): was iterating over a temporary, store it in a const
auto variable.
Task-number: QTBUG-115839
Change-Id: If10eb425d55484bc1857dfdeafa9d65b2beb765f
Reviewed-by: David Faure <david.faure@kdab.com>
proEval(), proParser(): the loop was iterating over a temporary so it
couldn't have changed it. Hold the container in a const auto variable
and use ranged-for.
formatValue(): iterating over a const QList& parameter, and the container
isn't changed at the call sites during iterating, so Q_FOREACH wasn't
needed to beging with. Use ranged-for instead.
Task-number: QTBUG-115839
Change-Id: Idabe0bbd84b5bcc86cef275f80497651353a4d9e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
systemEnvironment(): the loop was iterating over a temporary; hold the
temporary in a local const auto variable and use ranged-for.
runCommand(): the container is a const&, the loop doesn't change the
container and the containers the method is called on aren't changed
during iteration.
Task-number: QTBUG-115839
Change-Id: I6687e5ff64ff8c2fa26e34abf4044b98718e65d4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
specifyMetaTagsFromCmdline(): the loop was iterating over a temporary so
it couldn't have modified it; hold it with a const auto variable and use
ranged-for.
relatedMetaObjectsNameConflict_data(): make the container const and port
to ranged-for.
Task-number: QTBUG-115839
Change-Id: I6a5afdf0e5a3dd47818da0025fbbeacd05335b39
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The loop was iterating over a temporary container, so it couldn't have
changed it. Use a const auto variable to hold the container and port to
ranged-for
Task-number: QTBUG-115839
Change-Id: I66e7cbdb811666ca352cdf064b1228caa346d876
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
badString(): const'ify the static QList, this is both faster as the
compiler doesn't need to check if it has been already initialized, and
it means we can use it directly in ranged-for as the method returns
const QList&.
Drive-by change: don't go the long way around to get a const char*:
qPrintable(QString("fail %1").arg(ba))
instead use:
QTest::addRow("fail %s", ba.constData())
(thanks to dfaure for pointing it out in review).
Task-number: QTBUG-115839
Change-Id: I6e8efa6df47ee94f1d71a63e22ab121647e6bf20
Reviewed-by: David Faure <david.faure@kdab.com>
The container is local to the function, but can't be made const due to
the way it's filled. The loop clearly doesn't modify the container so
use std::as_const and ranged-for.
Task-number: QTBUG-115839
Change-Id: Ia9f01dfaccfca3225fe0487aafd0a386605cf466
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
These are member containers of nested (in the test function) structs.
It's clear the container isn't modified in the loop body, so use
ranged-for and std::as_const.
Remove "#undef QT_NO_FOREACH".
Task-number: QTBUG-115839
Change-Id: I0588bf4b6520b42d6d8678d702192fb894956b05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is a local container that isn't modified in the loop, so use a
ranged-for loop with std::as_const.
Task-number: QTBUG-115839
Change-Id: Ie9129e065f8ae9bd8c93cf95093a77529aef0803
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Use std::initializer_list/std::array for data known at compile time.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH".
Drive-by change: de-duplicate some trivial code.
Task-number: QTBUG-115839
Change-Id: Ifb1a93579bd4ab8fd10f78665a28559cc61da7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
These are local containers that are either:
- Already const and didn't need Q_FOREACH to begin with
- Can be simply made const, just by adding const keyword
In one case the unittest checked that the container's size is 1, so use
list.first() instead of a for-loop.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH". Also remove those files from NO_PCH_SOURCES.
Drive-by changes:
- Remove parenthesis from one-line for-loops
- Make the for-loop variable a const& where a copy isn't needed
Task-number: QTBUG-115839
Change-Id: Ide34122b9cda798b80c4ca9d2d5af76024bc7a92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The loop was iterating over a temporary container, so it couldn't have
changed it. Store the container in a const auto variable and use
ranged-for.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH".
Task-number: QTBUG-115839
Change-Id: I402df5fa48f4287f3cc989ddae1524da43999049
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
cleanupTestCase: the loops don't change the member containers, so use
std::as_const and ranged for.
iterateRelativeDirectory(): the for loop doesn't change the container,
so make it const to begin with, and use a ranged-for loop.
Drive-by change: make the for-loop variables const&, no need to create
unnecessary copies.
Task-number: QTBUG-115839
Change-Id: Ic2776459f695c9f334f83916b1c9bbe5646a3b9d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Each loop was iterating over temporary containers, so use a const auto
variable to hold it and use ranged-for
Drive-by change: make the for-loop variable a const& (QString,
QFileInfo).
Task-number: QTBUG-115839
Change-Id: Idffaedb8e2e8782a0f4f907995f62f3c0de44bba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
filterLinks() is always called on a temporary QStringList, so make it
take by && (which proves it's always called on a temporary), and modify
the parameter directly.
Task-number: QTBUG-115839
Change-Id: I40611f40cc0096a58d5c9d8e68c5df06d43152e5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
cleanupTestCase(): the loop doesn't modify the member container, so use
std::as_const and a ranged-for.
mounting(): the loop was iterating over a temporary QList, store it in a
local auto variable and use ranged-for.
Drive-by change: add braces to a multi-lined for block.
Task-number: QTBUG-115839
Change-Id: I0542cad4df3730d6a09b39e64a54a84fc0d57062
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Other recent commits have fixed the other Q_FOREACH uses in this file.
Task-number: QTBUG-115839
Change-Id: I03063f3e8f1e99c5a2aa2d9188260f3e79ca43bd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The density of Q_FOREACH uses in this and some other modules is still
extremely high, too high for anyone to tackle in a short amount of
time. Even if they're not concentrated in just a few TUs, we need to
make progress on a global QT_NO_FOREACH default, so grab the nettle
and stick to our strategy:
Mark the whole of Qt with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. For TUs that are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too).
In tst_qglobal.cpp and tst_qcollections.cpp change the comment on the
#undef QT_NO_FOREACH to indicate that these actually test the macro.
Task-number: QTBUG-115839
Change-Id: Iecc444eb7d43d7e4d037f6e155abe0e14a00a5d6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Instead make "benchmarks" a member variable and call qDeleteAll() on it
in cleanupTestCase(). This doesn't make much difference since the
allocated resources would be freed when the whole test is destroyed
anyway, but still.
Change-Id: Iba66d32697fd3f2283185ee65a0a514176b4b258
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously name() has always used underscore and bcp47Name() dash; let
the user chose which one best fits their needs.
[ChangeLog][QtCore][QLocale] QLocale's name() and bcp47Name() now let
the caller chose what separator to use between the tags making up the
name, where there is more than one.
Change-Id: Ia689e6a3fb581b42905e7fb1ae7a7b688244d267
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... and rename it to qbswap(), thus enabling the endian conversions
for Id128bytes via q{To,From}{Little,Big}Endian() functions.
Found during Qt 6.6 API Review.
Pick-to: 6.6
Change-Id: Ie320cee52ec2b9de0aaa112adec8febb7f5b68a2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Accent color role has been renamed according to name rule of other
color roles in QPalette.
Fixes: QTBUG-116107
Pick-to: 6.6
Change-Id: I70ac98a1e97afbdc7ea5f8d79f808c307e170712
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reduce test precision to account for rounding errors, and at the same
time increase the setup precession by premultiplying in rgba64 instead
of argb32, which makes the test randomness trigger more regularly.
Pick-to: 6.6
Task-number: QTBUG-115945
Change-Id: I3e95449ada26ff5bb0acc00412f345733603f4c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The function was replacing the `>` character in generator expressions coming from `add_compile_definitions`. This was creating generator expression syntax errors. Discard generator expressions from character replacing.
Add tests for the three cases.
Fixes: QTBUG-111717
Change-Id: I694d2908738085fdf15112834f20183a9f393422
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When changing the current index while the tab bar is not visible,
calculating the necessary scroll offset might result in wrong results if
the tab bar still has an old size. When the tab bar then gets shown and
resized, the scroll wouldn't be corrected, potentially leaving tabs
unnecessarily scrolled out.
We don't need to make the current index visible if the tab bar itself is
not visible, it's enough to flag the layout as dirty so that the next
show event (which either way makes the then current index visible)
triggers a laying out of the tab bar tabs.
Amends e851d4c06154bf02b23030ff1f7024a8b9edf874.
Fixes: QTBUG-115109
Task-number: QTBUG-113140
Pick-to: 6.6 6.5
Change-Id: I3d8633f9f8b907a36190123839a6104a17bfe138
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The test removes the file in memfs that IndexedDB settings use as the
backing store. This forces a new instance of IDB settings to read from
the actual IndexedDB, instead of the file.
Change-Id: I7c04a90ae80e47b7742bd133b2d9327ce0063fe2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
It has always returned dash-joined forms of the locale names, and
callers who need an underscore-joined form have been obliged to
replace('-', '_') before using them. Given that everything it adds to
the list comes from QLocaleId methods that accept a separator, it's
trivial to let it offer the same choice to its callers and save them
this hassle.
Amended code in QTranslater and QMimeType to save them that hassle.
[ChangeLog][CoreLib][QLocale] QLocale::uiLanguages() now lets the
caller choose what separator to use between the tags that make up each
locale-identifier in the list returned.
Change-Id: I91fcd0b988d9a64e0e9ad9e851f6cb8c1be8ae50
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's ... broken. Found and filed lots of bugs. Add #ifdef'ery and
QEXPECTED_FAIL() to document the state of affairs, hopefully reminding
us to fix these things come Qt 7.
Task-number: QTBUG-116064
Task-number: QTBUG-116076
Task-number: QTBUG-116077
Task-number: QTBUG-116079
Task-number: QTBUG-116080
Pick-to: 6.6 6.5
Change-Id: I29e89fdf995ddf60ef1e03c7af009e80980c9817
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We were only ever testing with a 0 seed, even though the function was
called for all QFETCH_GLOBAL seeds.
Add the seed.
Amends 5e93361888.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I3c78714ad6fb3f94233789dd2c8884d9b157fa76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The loops don't change the m_connections container. The call chain is:
- registerObjectPeer() unittest constructs a MyServer, which connects
QDBusServer::newConnection to MyServer::handleConnection(), the
latter stores each new connection's name in m_connections
- An QTestEventLoop is entered, which triggers handleConnection(),
handleConnection() calls exitLoop() at the bottom (this is repeated
multiple times)
- server.unregisterObject() is called, iterating over m_connections
- server.registerObject() is called iterating over m_connections
- between the unregisterObject() call and the registerObject() calls
m_connections is not modified AFAICS
Thus no need for taking a copy of m_connections (not that it matters
much, it's a QStringList with size() == 3).
Change-Id: Idaea2ca4d3b27fc88d39f8434e3817a2a4098c72
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends f2f8820073.
I have no idea how this went through the CI, but assigning to a const
variable cannot possibly compile.
Reported-by: Axel Spoerl <axel.spoerl@qt.io>
Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I0f22dcd5ab691f92880ea3c6446aedca53df0721
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Extended linear Display P3 + FP16 is likely the thing to use
on platforms such as VisionOS and iOS (and optionally on macOS)
and perhaps iOS). Enable testing this on macOS with the hdr
manual test.
Change-Id: I67f0bdbadae8c7ebccae7de008f12fd8d9135529
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The method calls show() on a dock widget group window, when the window
flags have changed. When all of its contained, tabbed dock widgets are
programmatically hidden or docked on the main window, an empty group
window is shown.
This patch implements bool hasVisibleDockWidgets(). It returns true, if
at least one of the group window's dockwidget children is not hidden.
It replaces show() by setVisible(), passing the return value of
hasVisibleChildren().
It adapts tst_QDockWidget::floatingTabs() to test the fix.
(Drive-by: remove dead code)
Fixes: QTBUG-115058
Pick-to: 6.6 6.5 6.2
Change-Id: Ifb8e2450e91a7c78decc06f592e160631ca2faf5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The method reads the next element in a loop, as long as valid elements
exist. Within the loop, it returns
- false if the end of an element has been reached
- true if a new element has started
When the document end has been reached, the loop continues, until
readNext() returns Invalid. Then, PrematureEndOfDocumentError is launched.
This is wrong, because reading beyond the document end is caused by a
missing return condition in the loop.
=> Treat document end like element end and return false without
reading beyond it.
=> Test correct behavior in tst_QXmlStream::readNextStartElement()
Fixes: QTBUG-25944
Pick-to: 6.6 6.5 6.2
Change-Id: I0160b65880756a2be541e9f55dc79557fcb1f09f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By actually registering them.
Commit 850d850c5a changed from
qMetaTypeId<QDBusArgument>() to QMetaType::fromType<QDBusArgument>() and
in Qt 6, fromType() does not register the type with the database. That
means the lines became runtime no-ops at that time or during the
QMetaType updates since 6.0. All they did was instantiate the C++ inline
variable.
The testing also detected we didn't register QList<QDBusVariant> as an
alias for the "av" signature. I'm not entirely sure you're allowed to
use this because QtDBus does not like re-registration of the built-in
types, and "av" is already assigned to QVariantList. This is no trouble
for the parser, anyway.
Minor change to qdbuscpp2xml to allow reading from stdin, so we don't
have to create temporary files.
Pick-to: 6.5 6.6
Fixes: QTBUG-115964
Change-Id: I80612a7d275c41f1baf0fffd177a14925e7d23ac
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Strictly speaking, we don't need the *bus*, only libdbus-1, but some
machines in our CI appear to be misconfigured somehow. I don't
understand how they can both have and not have this library in the same
run.
Pick-to: 6.5 6.6
Change-Id: I80612a7d275c41f1baf0fffd177a66a04951948c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
We've known for a long time that this is producing worse code with GCC
because of how we implemented in Q_ASSUME_IMPL(). So bite the bullet and
actually deprecate the macro, replacing all extant Q_ASSUME() with
Q_ASSERT().
The replacement is in C++23. Backporting the support onto Q_ASSUME_IMPL
was previously rejected by reviewers.
[ChangeLog][Deprecation Notice] The Q_ASSUME() macro is deprecated. This
macro has different side-effects depending on the compiler used (GCC
compared to Clang and MSVC), and there are certain conditions under
which GCC is known to produce worse code than if the macro was absent.
To give a hint to the compiler for optimizations, use the C++23
[[assume]] attribute.
Change-Id: I80612a7d275c41f1baf0fffd177a3a4ad819fb2d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This constructor matches way too many argument types (integral,
unscoped enums, FP types), so it's likely to cause mayhem, even if
left in as an explicit constructor.
We now have a named constructor for the same functionality, so just
drop the "unnamed" constructor.
"Unnamed" constructors are important when emplacement is more
efficient than construction + move, or when implicit conversion is
required. Neither is the case here: The named as well as the
"unnamed" constructors just copy ten bytes around, and the compiler
can optimize those extra copies away just fine.
Found in API review.
Pick-to: 6.6
Change-Id: I7faafd3ebf522fb2b0e450112fb95d643fece5ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QSharedPointer is 'meh', see QTBUG-109570 and 18113e22e9.
This is just a textual replacement of
- QSharedPointer<(.+)>::create() → std::make_shared<\1>()
- QSharedPointer → std::shared_ptr
And it compiles and still passes. No non-standard APIs to fix up.
Task-number: QTBUG-109570
Change-Id: I827d4a9be0511780c3900bd53ffcbdcb6aacbc3b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
All of these fall into the trivial category: loops over (readily made)
const local containers. As such, they cannot possibly depend on the
safety copy that Q_FOREACH performs, so are safe to port as-is to
ranged for loops.
There may be more where these came from, but these were the ones that
stood out as immediately obvious when scanning the 100s of uses in
qtbase, so I preferred to directly fix them over white-listing their
files with QT_NO_FOREACH (which still may be necessary for some files,
as this patch may not port all uses in that file).
Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I7b7893bec8254f902660dac24167113aca855029
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The original code duplicated contained elements of a QStringList by
repeated appending it to itself, preventing the container from being
marked const.
Instead, keep a list of unique mime-types, and iterate over the list
eight times.
As a drive-by, port from QList to a C array ("never use a
dynamically-sized container for statically-sized data"), use u""_s
UDLs (since we're touching almost all lines of the function, anyway,
also in the unrelated mimeTypeForName() call).
This allows porting the Q_FOREACH loop (which anyway cannot deal with
C arrays) to a ranged for one (which can).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I844ae38104bb2980ea194b85f9017a3e95791ea2
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables.
As a drive-by, replace a QList legacy left-shift-based- with
initializer_list-construction.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I453e24272c4c4b7dce5b91a0bd04481d833c50bb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables.
As a drive-by, replace a QList with a C array
("never use a dynamically-sized container for statically-sized data").
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I1b1e8f093abf75093900631e6fe3cbc9e3019d34
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables.
We don't have a mechanism to mark a subtree as Q_FOREACH-free, and
adding QT_NO_FOREACH to each executable is overkill, so we just have
to hope that no new uses are being introduced until we can mark the
whole QtBase module as Q_FOREACH-free.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I13dc176756633674bab8c93a342ecdba6c5dd23e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When the placeholder text is changed after having been displayed, it
doesn't get updated on the screen any more, unless the entire viewport
is updated, e.g. because of a document change or a focus event.
This patch simplifies QPlainTextEditPrivate::updatePlaceHolderVisibility()
to update the visibility if the text document is empty.
It replaces the member QPlainTextEditorPrivate::placeholderVisible
by the function isPlaceHolderTextVisible(). It returns true, if the
document is empty and a placeholder text exists, and otherwise false.
It adapts and corrects tst_QPlainTextEdit::placeHolderVisibility():
- usage of new member function instead of data member.
- do not expect an empty placeholder to be visible.
Fixes: QTBUG-115831
Pick-to: 6.6 6.5 6.2
Change-Id: Ic4427ce7f7f1b8cde89957b9de0b978bd34ba923
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
QAndroidPlatformInputContext::focusObjectStopComposing() sends an input
event for each character newly added by the Android virtual keyboard.
It then sends a second input event to notify that the cursor has
advanced to the position after the new character.
The implicit assumption is, that the receiver of the input event does
not change the text.
If e.g. QLineEdit::setText() is called in the QLineEdit::textEdited
slot, the text does change. If the change implies a cursor change,
QLineEdit notifies the platform input context about it.
However, by sending the second input event, QAndroidPlatformContent
returns the cursor back to the position after the last character added
by the virtual keyboard.
This patch joins the composed text and the cursor position into one
single input method event. A new cursor position, set by the receiver
of the input method event, is no longer overridden.
The patch adds test functionality to tst_QLineEdit::setText().
Fixes: QTBUG-115756
Pick-to: 6.6 6.5 6.2
Change-Id: I85ffac5d6bab93ccb144be0f5b8083258a270550
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Add more tests on WebAssembly platform for better tests coverage.
Change-Id: Iaaaa824ae6058a9ae5dba4c4038a7f687bfc17e0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Take 2.
Re-land previously reverted commit, due to not handling resource names
that are not valid c++ identifiers. Now we sanitize the resource names
just like rcc does by replacing non-alphanumeric characters with
underscores.
Original commit message.
During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.
This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.
It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.
We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.
This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.
To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.
It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.
For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.
The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.
A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.
This reverts commit bc88bb34ca.
Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: Idce69db0cf79d3e32916750bfa61774ced977a7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Headers must be free of Q_FOREACH uses if we want to white-list only
those .cpp files that still use Q_FOREACH in order to enable
QT_NO_FOREACH by default.
In common.h, the situation is pretty clear: the loop bodies clearly
don't modify the container being iterated over.
In MyServer, the situation is not clear at all, and this author
doesn't have the time to investigate, so take a copy and iterate over
that (eactly what Q_FOREACH does), and leave a comment.
As a drive-by, fix missing {} around multi-line loop bodies.
Task-number: QTBUG-115839
Change-Id: I06311a641c83daeee25f45522c694ac355ee86b6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
QSqlDatabase uses a Q_APPLICATION_GLOBAL and so should not be used
without QCoreApplication instance. The test crashes if the existence
of an application instance is asserted in Q_APPLICATION_GLOBAL
code.
Pick-to: 6.6
Change-Id: Iaa3f4dff7b2722257735680dd3885aeed0ac810b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
operator=(~) and assign(~) share similar names but, until now, have not
shared the same functionality. This patch introduces the usage of
QByteArray::assign() within the non-sharing assignment operator to
effectively boost efficiency by reusing the available capacity.
Since these assignment operators are frequently used in many places,
both within Qt and non-Qt code, this patch comes with benchmarks.
The preview of the benchmark results are compared with this patch and
before this patch. The findings indicate a slight enhancement in
performance associated with the assignment operator. Despite the results
displaying only a minor improvement, progress has been made. Therefore
use assign(QByteArrayView) as replacement.
(x86_64-little_endian-lp64 shared (dynamic) release build (O3); by
gcc 13.2.1, endeavouros ; 13th Gen Intel(R) Core(TM) i9-13900K
benchmarks executed with -perf -iterations 1000000
* The last value at the EOL represent the string size.
QByteArray &operator=(const char *ch) (current)
65 cycles/iter; 317 instructions/iter; 16.0 nsec/iter (5)
71.7 cycles/iter; 383 instructions/iter; 13.0 nsec/iter (10)
59.8 cycles/iter; 318 instructions/iter; 10.9 nsec/iter (20)
70.8 cycles/iter; 340 instructions/iter; 12.9 nsec/iter (50)
80.2 cycles/iter; 419 instructions/iter; 14.6 nsec/iter (100)
164.2 cycles/iter; 899 instructions/iter; 29.9 nsec/iter (500)
260.5 cycles/iter; 1522 instructions/iter; 45.6 nsec/iter (1'000)
QByteArray &operator=(const char *ch) (before)
66.8 cycles/iter; 317 instructions/iter; 16.9 nsec/iter (5)
76.5 cycles/iter; 383 instructions/iter; 13.9 nsec/iter (10)
63.7 cycles/iter; 318 instructions/iter; 11.6 nsec/iter (20)
71.6 cycles/iter; 344 instructions/iter; 13.0 nsec/iter (50)
77.5 cycles/iter; 419 instructions/iter; 14.1 nsec/iter (100)
143.4 cycles/iter; 893 instructions/iter; 26.1 nsec/iter (500)
270.8 cycles/iter; 1516 instructions/iter; 48.2 nsec/iter (1'000)
Task-number: QTBUG-106201
Change-Id: I0745c33f0f61f1d844a60960cc55f565320d5945
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Test sendEventsOnProcessEvents has been noticed to fail when
qgtk3 (Glib) is loaded - Should be fixed in QTBUG-87137
Moving test from blacklist to use QEXPECT_FAIL as it's more
recommended until test is fixed in the relevant configurations.
QEXPECT_FAIL is selected to use as original investigator
reported also some cases when glib is working. Therefore
this approach is giving us more insight for further
investigation is it always failing with glib or not.
It was also reported linkage to zeroTimer test QTBUG-84291,
but not sure why removing that has affected to this one.
Update to QEXPECT_FAIL documentation to tell in first place
that XPASS is not only marking it as XPASS but also failing
the test. Same is mentioned in different location but it
needs more searching or testing how it works in real test.
Task-number: QTBUG-115155
Change-Id: I7fb4ef28dba8adb7009be528f88fc758a12e9006
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Instead of copying a list, sorting it just to check it's sorted, and
making a QSet out of it just to check the size is the same as that of
the list (thereby checking there were no duplicates), simply apply
adjacent_find with greater_equal. If none of the elements is ≥ their
successor, that means all elements are < their successor, and _that_
means the range is sorted and has no duplicates. q.e.d.
Pick-to: 6.6 6.5
Change-Id: Id73c674ad4e29117370e8fc6af9fdfc690a3fba9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
As a header, it would otherwise make all TUs that include it (with
PCH: all) incompatible with QT_NO_FOREACH.
Without deeper analysis (which economy of time forbids in this case,
given this is just a manual test that's probably run 10 times per
year), and seeing as this is in an event handler, I opted to play it
safe and iterate over a copy (which is exactly what Q_FOREACH
does). Added a comment to indicate it may not be needed.
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I7db75321dd34888f6dd7a64cccb7462ff35935fa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
First include the common tst_qmimedatabase.cpp (and nothing else),
then implement the differing
tst_QMimeDatabase::initTestCaseInternal().
This will allow adding #undef QT_NO_FOREACH to tst_qmimedatabase.cpp
in the next step.
Pick-to: 6.6 6.5
Change-Id: Icc1890229e9443bd35c81d4f0440ba7df5da906c
Reviewed-by: David Faure <david.faure@kdab.com>
The single Q_FOREACH use here is simple, as it's over a local variable
that just isn't marked as const due to the way it's constructed, and
the loop body clearly doesn't modify the container, so the protective
copy that Q_FOREACH performs is not needed. But std::as_const() is, to
prevent a detach() (attempt). Add that.
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: If228f649efd87388f6e312078b24a5b46ac8dc36
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Drag the QCOMPARE (which even dynamically allocated a QString
fromLatin1()) out of the QBENCHMARK loop. Testing performance of
QString::fromLatin1() and/or qCompare() is not pertinent to the task
at hand, which, ideally, doesn't involve any memory allocations, so
there's at least the chance that this skewed the result noticably.
Didn't run the benchmark as this was developed on an asan build.
Yes, this breaks comparability with the stone-age measurements
reported in comments there, so sue me.
As a drive-by, replace the fromLatin1() with a u_s UDL.
Pick-to: 6.6 6.5
Change-Id: I9b2a8b2e3596ec9b07c6b4ea369257b1a86e09db
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Various comments need to continue using the enumdata.py names, as they
associate data with particular enum members, but we can now correctly
use the en.xml versions of their names when we report them, rather
than the enum-friendly names we use in the code. Since this now means
the data may stray outside plain ASCII - it'll be UTF-8-encoded - this
implies replacing the QLatin1StringView()s of the code that formerly
read this data with QString::fromUtf8().
Fixes: QTBUG-94460
Change-Id: Id3b08875a46af58c0555c3e303b0e15a19441509
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We could already use dashes in some, rather than spaces, and now no
longer need to capitalize each word. This changes the *_name_list[]
entries for affected languages to more closely match what CLDR gives
as their names. It also amends various comments. Added tests for the
QLocale::*ToString() functions to cover the entries changed.
Task-number: QTBUG-94460
Change-Id: I0163795cb282881f15a97be00a5311c1936c3a09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Test names and output need to be UTF-8 for the XML data formats to not
end up malformed - which would upset Coin's testrunner, when it
validates the XML as part of checking - and the few other uses of
toLatin1() were to ASCII content anyway, so can harmlessly (this being
test code, where the slight performance advantage of Latin-1 doesn't
matter) use toUtf8() as well, for the sake of uniformity.
Use of toLatin1() broke an imminent commit in which some territory,
script and language names depart from ASCII, leading to malformed
UTF-8 when they appear in test-data-row names.
Task-number: QTBUG-94460
Change-Id: Ifb826b1e417ba24fd862b93d24d0e7a38858a17f
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The following commits neglected to amend
tst_QImageReader::supportsOption() with the ImageOption enumerators
they added to QImageIOHandler:
- c0ba249a48
- 163af2cf53
- ba323b04cd
Fix first and foremost by adding the missing ImageOption::ImageFormat
to the list of PNG-supported formats (which, curiously enough, predates
the public history and therefore the above three commits), and second,
by rewriting the whole test function to enable -Wswitch, so further
additions are less likely to be forgotten.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I102121b2c8a9067864b8ade2ebe2650be6fb6010
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Identifiers matching _[A-Z_].* are reserved for use by the C++
implementation. Replace the __ prefix of variable names with _v_,
making them non-reserved.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I35127d7473678e2efd93a4b21847db562c53abd2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
In main.cpp, the loop is over a local variable which would be const
were it not for the multi-step initialization that I didn't want to
change. The loop body clearly doesn't modify the container, so port to
ranged for loop with std::as_const().
In printvolumes.cpp, the loop _does_ invoke unknown code (through the
function pointer passed as the second argument), but, as could be
expected, the two users of the function don't pass functions that know
about `volumes`:
- in the tst_QStorageInfo auto-test, an rvalue `volumes` is passed,
so we don't need to analyze the qInfoPrinter function passed there,
as it cannot possibly reference the temporary
- and in main.cpp of the manual test, we just pass printf (which is
technically UB (taking the address of a standard library function),
but I don't care right now).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Ibcd10a0e0b3229d8f2a1d98545d8fa6d473a0f75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Most of these are of trivial kind (loops over const locals).
The one that isn't, in cleanupTestCase(), is, however, also simple:
it's a loop over a local, too, but it would be too much churn to
change the initialization to make the container const, and the loop
body clearly doesn't modify the container, so just go with the
std::as_const() pattern here.
Task-number: QTBUG-115839
Pick-to: 6.6 6.5
Change-Id: I188a78ea67a63be2d50a81fea431e5ea9f2783cb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
I'd previously understood CLDR's minimumGroupingDigits to mean the
most significant group must have that many digits. It turns out to
mean only that the first grouping separator doesn't get added unless
the more significant group has this many. Once we have one separator,
more can be added that do isolate a single digit.
In the process, I discover some of the prior arithmetic is incorrect;
it is now fixed. Added some basic testing, amended some existing
tests. In the process, fixed naming of some double validator tests.
Pick-to: 6.6 6.5
Fixes: QTBUG-115740
Change-Id: Ia6ce011ba72e72428b015ca22b97d815ebf751b2
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This source file is included in four other test projects, so it makes
more sense to port it away from Q_FOREACH than to white-list it
everywhere it's used.
The change in ModelMoveCommand::doCommand() is trivial. I only dropped
the pointless top-level const of the loop variable as a drive-by.
The change regarding `parents` in ModelChangeChildrenLayoutsCommand's
doCommand() is also trivial, I just ported to braced initialization to
get the QList to be const. We're forced by the Qt API
(layoutChanged()) to use a QList here, therefore no array.
Ibid., the change regarding `persistent` is simple. The container
cannot be marked as const without a lot of churn to its initialization
(applying IILE, basically), but other than that, it's a local
variable, and the loop body clearly doesn't modify it.
Task-number: QTBUG-115839
Pick-to: 6.6 6.5
Change-Id: I7a0e85804626a3cc612921b49e72e4b9f30b676d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
"Never use a dynamically-sized container for statically-sized data."
Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Ib89d07fb751e3905a230ee5641e2e509e9415bed
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
There was a gap in its numbering, and the quick brown fix could do
with some competition.
Change-Id: I1283bbb6ba321ae2b65b4459327f2428a45f85cc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This one isn't trivial, but straight-forward: the only place the
container is modified is in fill(). Like the setOpaqueChildren()
function, this is only called from top-level test functions, and, in
particular, not from event handlers (setAttribute() sends events).
That fill() doesn't clear() the container, even though the single
UpdateWidget instance is being reused across test functions, looks
wrong, but doesn't invalidate this analysis.
Task-number: QTBUG-115803
Change-Id: I284a19da2fe476278986c61810dd334fc73034b0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The Q_FOREACH is in a header, so we need to port away from it,
otherwise it makes any TU that includes it (in PCH builds: all)
incompatible with QT_NO_FOREACH.
This is a trivial case of marking the local constructor const, but go
a step further and replace the QList with a C array ("never use a
dynamically-sized container for statically-sized data"). Both
consumers of the container (after s/foreach/for/) can deal with array.
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I142e438dcf2d785bb34022a3fb1ff46b8eaa0edd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This is more readable and at the same time helps to eradicate some
more Q_FOREACH uses for an eventual global QT_NO_FOREACH for all Qt
sources (QTBUG-115796).
Task-number: QTBUG-115803
Change-Id: I9cbe76bee8a6306fab0c0bc94cd874405ca825ba
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
"Never use a dynamically-sized container for statically-sized data."
Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I40773a0397b83cce0c803967ee3fd7ae274933d3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
"Never use a dynamically-sized container for statically-sized data."
Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Ifef42704c4f695a8fb05ea5d9b3e095af3f35171
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
"Never use a dynamically-sized container for statically-sized data."
Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Iecfc037c8bbfc0b3196ed0c65f680768a8d2353a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QList rather pointlessly has a startsWith() function, which means this
code compiled. But the code makes no sense: it tests the same
condition over and over again, so I'm assuming that it should be
path.startsWith() and not path_s_.startsWith().
Amends 3f56950862, but that just
imported the code from qttools. I didn't check whether the bug was
present there, already.
Pick-to: 6.6 6.5
Change-Id: I98a4bbfe0400700655a5c2137f7a976a835a8d28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables, albeit sometimes at the cost of an extra scope
(can't, yet, use C++20 ranged for loops with initializer).
In resizeMaximizedChildWindows(), decided to leave the container
construction as-is and use std::as_const instead (applying IILE to
make the container const would be too much churn).
In setViewMode(), removed a pointless clear() that prevented the
container from being marked const. There are no references to the
container following the clear(), and the container does not hold smart
pointers, so the clear() cannot have had non-trivial side-effects.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I00ce9c12ab696de30229f3605c16313af7eafffc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The single use of Q_FOREACH in this test is safe to port 1:1 to a
ranged for-loop, since we're in a constructor, and the loop body only
calls member functions of data members (incl. the base class), so we
cannot possibly modify the container passed in as a constructor
argument: any connections or event processing that could re-enter our
caller hasn't been set up, yet.
Task-number: QTBUG-115803
Change-Id: I7095aef1edddbda0d1b0c471192b18acd6fd1793
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
These are all simple: QObject::children() returns a reference-to-const
QList, so we can leave the calls in the for loop (no detach()ing).
The loop bodies also clearly don't modify the list of the QObject
children (they're just QVERIFYs).
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I9c5dcb2aefc433a1dead55dab669e645b6906963
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This is iterating over data member containers that are otherwise only
touched in the constructor of the same object. Luckily, the
initialization of these containers does not require *this, so use
NSDMI and mark the containers const, proving they can never be
modified and thus the protective copy of Q_FOREACH isn't required. Now
that we got rid of Q_FOREACH, we can and do make them arrays for extra
measure ("never use dynamically-sized containers for statically-sized
data").
Unfortunately, C++ neither allows us to use "flexible array
members" nor AAA in NSDMI, so grab the nettle and supply the array
size manually (ever so slightly violating DRY, but the compiler will
complain if we get it wrong).
Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: Ibb2ce48b6dcaf2e9d3d1a625602f3865d280c7c6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is iterating over a data member container that's otherwise only
touched in the constructor of the same object. The only reason why
it's not a const is that the initialization from QWizard::addPage()
makes that very cumbersome. So port to a ranged for-loop and apply
std::as_const().
Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I033e3725df95b29a8ef295c4e74d746d83234835
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is iterating over the keys() of a member container we've just
filled in the same function. The loop body clearly doesn't modify the
container being iterated over. Port to the future-proof ranged
for-loop over asKeyValueRange(), using the _-in-SB pattern Christian
Ehrlicher showed me to indicate we're not interested in the value.
Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I3d86a1de9ea460b7d57fa421ea76e41d2c122f43
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is safe to port to a ranged for loop, as it's iterating over a
private member container that is not modified under iteration
(WizardPage::shown() is just returning a boolean member).
Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I50891e4b7509bd64399a128a5ee47d7795374f8e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This function is called only from one test function. Mark the
function's argument as const in the caller, bringing this use into the
const-local category, which is implicitly safe to port 1:1 to
ranged-for.
Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I9145c1ae2aed5ab3cafc4947dc3eaaf9a27c6a04
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Fix typo so tst_qfuture on platforms without exceptions can be build
correctly.
Change-Id: I32c12effdda13da9c8669bfddd362acc1c8a14c7
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
For the child windows we have to use showNormal() explicitly,
as the default window state logic of platforms like iOS does
not have access to the QWindow, only to its flags, and we
can not use Qt::SubWindow as a proxy for being a child window,
as that's a window flag meant to be used for MDI sub windows.
Pick-to: 6.6
Change-Id: I2b5e669f6180ffdcb75479dece38ae5e5430aef6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Ran the script, no new IDs to add. Revised tests of Central Standard
Time: America/Ojinaga has joined Matamoros for it, in Mexico.
Pick-to: 6.6 6.5
Fixes: QTBUG-115732
Task-number: QTBUG-111550
Change-Id: I9b41d8c0156b9fbe3961dbe9a35d55493fc55501
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables.
The only noteworthy point here is that, in order to mark it as const,
I had to move a container definition to the more narrow scope in which
it was actually initialized. There are no references to the container
outside the narrow scope that would require it to be defined in the
larger scope.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I20890f48a48ca662679f55fa5db759419d4db8c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
These are all trivial: all are over (already or newly-made) const
local variables.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: Idd6e65065ee27c2d29ce1b49607aadb2eaf5e15d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.
This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.
It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.
We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.
This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.
To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.
It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.
For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.
The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.
A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.
Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: I39c325aac91e36d53c3576a39f881949c3b21e3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
My FreeBSD does not have /proc mounted, so this test doesn't run almost
ever. I have no idea about OpenBSD and no one has tested Qt on AIX in
over a decade.
Change-Id: Ifbf974a4d10745b099b1fffd1777a598ee91eb5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Emit properties with MEMBER field specified with 'readwrite'
access. Previously only READ and WRITE filed where used
for deriving the access value.
Add a property using MEMBER to the test class used by
tst_qdbuscpp2xml.
Fixes: QTBUG-115631
Change-Id: I12351985a9fafd934ccc5e0b805077a9e44b6608
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
...while sharing the related code between the d3d backends.
The isHardCodedDefaults flag is not used in practice and is
now removed. Add the luminance behavior and SDR white level
(for Windows) to help creating portable 2D/3D renderers that
composite SDR and HDR content. (sadly the Windows HDR and Apple
EDR behavior is different, as usual)
The new test application is expected to run with the command-line
argument "scrgb" or "sdr". It allows seeing SDR content correction
(on Windows) in action, and has some simple HDR 3D content with
a basic, optional tonemapper. Also shows the platform-dependent
HDR-related screen info. With some helpful tooltips even.
Additionally, it needs a .hdr file after the 'file' argument.
The usual -d, -D, -v, etc. arguments apply to select the 3D API.
For example, to run with D3D12 in HDR mode:
hdr -D scrgb file image.hdr
The same in non-HDR mode:
hdr -D sdr file image.hdr
Change-Id: I7fdfc7054cc0352bc99398fc1c7b1e2f0874421f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
which is flaky.
Task-number: QTBUG-115598
Pick-to: 6.6 6.5
Change-Id: Ibb0a0c6b1e225144e2ce796691c40bb7510bfd56
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
I.e. concatenating a null byte array and an empty-but-not-null byte
array should result in an empty-but-not-null byte array.
This matches the behavior of QString::append(QString) too.
Fixes: QTBUG-114238
Pick-to: 6.6
Change-Id: Id36d10ee09c08041b7dabda102df48ca6d413d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It relied on an implementation detail of operator+=(), that the latter
wouldn't just use assignement (e.g. if `this` is empty/null).
It also had undefined behavior, when the char array used with
fromRawData() went out of, the nested, scope, the code was pointing to a
dangling stack pointer.
Thanks to Thiago for the explanation in code review.
This ties in with further changes in this series, where append() is
changed to preserve null-ness; there is no way to preserve null-ness in
append() while keeping this unittest passing.
Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Everyone must have this by now. This test was 1193 ms of CMake time.
Since this was a PUBLIC feature, I've left it around with a constant
condition.
Change-Id: Ifbf974a4d10745b099b1fffd177754538bbff245
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
To avoid having to take high-DPI scaling into account for geometry
calculations/comparisons.
Pick-to: 6.6
Change-Id: I941b74781264455b70520df8d1e6e91592e00310
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Missing parts of local storage backend implemented:
- fallback mechanism
- removal of all child keys for groups
- variant decoding instead of string decoding
- report AccessError when organization is empty in settings' ctor
Some WASM-specific adjustments to tst_qsettings have also been
introduced.
Task-number: QTBUG-115509
Fixes: QTBUG-115037
Change-Id: I02cde965b11d98a64fc1ecb261d74838c508afd6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Ran the scripts, added the new enum members to docs.
Updated tests:
* Two of the new languages are right-to-left,
* Canada has replaced a silly date format with a sensible one.
Fixes: QTBUG-111550
Change-Id: Ie6f1e6e94477167c9e2b5c67e6518ca0f6a7e7fb
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Introduce QT_SUPPORTS_INT128 and QT_NO_INT128 marcos to handle 128-bit
types. These macros allow to undef Qt's own 128-bit types and the
related code, but keep the compiler definitions unchanged.
This is required for Qt Bluetooth, where we need to use
QT_BLUETOOTH_REMOVED_SINCE to get rid of the APIs using
QtBluetooth-specific struct quint128 which clashes with the 128-bit
types. The idea is to use QT_NO_INT128 in Qt Bluetooth's
removed_api.cpp instead of directly undef'ing __SIZEOF_INT128__,
because the latter is UB.
This commit amends befda1acca.
Pick-to: 6.6
Change-Id: Ia2c110b5744c3aaa53eda39fb44984cf5a01fac2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit ca54b741d6 used the internal
has_operator_equal (and commit 01d94760d8
copied that for has_operator_less_than) instead of using the recursive
expander that was being used here. That assumed that the contained type
in std::optional would always be the last final check, which is an
incorrect assumption.
Fixes: QTBUG-115646
Pick-to: 6.6 6.5
Change-Id: Ifbf974a4d10745b099b1fffd177702934bec27ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The blacklisted test does not crash, as its expected output indeed shows.
Pick-to: 6.5 6.6
Change-Id: I07522a7d065b5f39620975a3546bcd156024c41d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In porting the selftest machinery to Catch2 in 24e83de8d1 we
accidentally added an unconditional early return when determining
whether to check for unexpected stderr output, resulting in not
checking error output on any platform.
The return statement has now been moved into the Q_CC_MINGW
condition, but as we now seem to have similar issues on macOS
and Linux with some of the tests outputting "Received signal 6
(SIGABRT)" as we do for QEMU, we need to add a few more explicit
early return conditions to the function.
Pick-to: 6.5 6.6
Change-Id: I7a25f000843b5f1003a5db883f08285185046b46
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Nothing prevents client code from calling QLocale::setDefault() before
we ever instantiate QLocale::system() - aside from some quirks that
mean setDefault(), currently, does instantiate QLocale::system() to
force initialization of defaultLocalePrivate - so using defaultIndex()
could set the system QLocalePrivate instance's index incorrectly.
In any case, even if the index is initially set correctly, a
subsequent change to the system locale would change the correct index;
and nothing outside QLocale::system() has access to the instance that
would then be remembering an out-of-date index.
Actually tripping over that inconsistency took some deviousness, but
was possible. The index is (currently) only used for month name
lookups and those special-case, for the Roman-derived calendars, the
system locale, to only use the index if the system locale offers no
name for a month. Meanwhile, updateSystemPrivate() uses the fallback
locale's index for its look-up of which CLDR data to copy into the
fallback QLocaleData for the system locale.
None the less, a non-Roman calendar's lookup will go via the index to
get at the CLDR data for that calendar, thereby exposing the system
locale's index to use; and, sure enough, a setDefault() could lead
that to produce wrong answers.
In QLocale::system() there's a cached QLocalePrivate, whose index we
need to ensure stays in sync with the active system locale. So pass
its &m_index to systemData(), which will now (when passed this) ensure
it's up to date. Since we always have called systemData(), to ensure
it is up to date, we can skip that update in the initialization of the
cached private and use m_index = -1 to let systemData() know when it's
in the initial call, thereby making the static cache constinit.
Amended a test to what proved the issue was present.
Change-Id: I8d7ab5830cf0bbb9265c2af2a1edc9396ddef79f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
- Pass the QList by value, no heap allocation and no plain new/delete
- A lambda means that there isn't runtime string-based lookup to find
the member method in QObjectPrivate
The code is only a couple of lines and used in a single place, so might
as well move the code from _q_reregisterTimers to the local lambda.
Modify tst_moc to account for the numer of methods in QObjectPrivate
changing. The test had hardcoded numbers.
Change-Id: I07906fc7138b8e601e4695f8d2de1b5fdd88449c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit f647375275. There are
no signed integer overflows in atomics.
For the non-atomic side, unlike the commit being reverted, we fix the
signed integer overflow by removing the "signed" part instead of the
"overflow" part, and use unsigned integer overflows instead.
Change-Id: I53335f845a1345299031fffd176f5ba479163e44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit adds some initial support for handling the 'L' suffix after
numbers. This one is especially important given that the __cplusplus
define is using it.
Other suffixes will be handled in some later commit, which should also
unify the already divergent parse behavior between DIGIT and PP_DIGIT
parsing (e.g. when it comes to byte prefixes).
Task-number: QTBUG-83160
Task-number: QTBUG-115558
Pick-to: 6.6 6.5 6.2
Change-Id: Ie61eae49c468abfaee80e7e4f7097917a254dc0e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There is no QT_CONFIG_thread.
Thanks to Alexey Edelev for spotting why I couldn't run the test.
Pick-to: 6.6 6.5
Change-Id: I11c99d9b1ff8fed67b118028b76fba8ee6db3c42
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Those tests often fail on Android 13 on RHEL 8.6 and 8.8. This patch
skips them to unblock CI while the underlying reasons are investigated
and fixed.
Task-number: QTQAINFRA-5606
Change-Id: If088d69c2160470ef50b2e74cd9b9399451c526d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Rewritten to be a bit simpler, added a few more yield/YieldProcessor
alternatives, added RISC-V support.
[ChangeLog][QtCore] Added qYieldCpu() function.
Fixes: QTBUG-103014
Change-Id: I53335f845a1345299031fffd176f59032e7400f5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Remove stray comment at the end of tst_qexplicitlyshareddatapointer.cpp
Pick-to: 6.6
Change-Id: I31a6c38002e56e7c43e527864ba3d9324950079f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Remove stray comment at the end of tst_qxmlstream.cpp
Pick-to: 6.6
Change-Id: I88550e2b75194e7895d8578ca0e8350af59d4dfe
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
This is done in anticipation of another test for dragging
Change-Id: I56961eb1d16a4a6b6c58890c9c882dea813dfa08
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Use qwasmwindow_harness_entry instead of the old createQtAppInstance.
Change-Id: I381dd43d9144fe70f055c19db4cd95f90313883b
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
- rvalues, they work due to e.g. the implicit conversion to QString, so
the compiler picks the "const String &" overloads. (This may change by
adding rvalue overloads in a later commit, although that will mean
adding many more operator+() overloads to disambiguate the calls)
- QByteArray + QByteArrayView
- More P and more Q (even though in some cases P and Q are defined as
the same operator in some QStringBuilder unittest "scenarios")
Change-Id: I4e7daecdb6887fb52f45732cd32323af20b1b850
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
E.g. a group separator, a -/+ sign, or 'e' (exponent). Input ending with
one of these characters now returns Intermediate, as it can become
Acceptable if the user types more characters.
Remove a check from initialResultCheck(), as it's now covered by
QLocaleData::validateChars() checking that the last character in the
buffer is -/+, this works the same if buffer's size is 1.
Extended unittests based on the linked bug report; the other cases for
"last" are already covered by existing unittests.
Task-number: QTBUG-111371
Change-Id: I9b6979c29f07a5f57b040004cd3dbf4e27147c21
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Add an option to disable handling of positional binding so jsonb
operators are not screwed up
[ChangeLog][QtSql][QSqlQuery] Add setEnablePositionalBinding() to be
able to disable positional binding.
Fixes: QTBUG-96636
Change-Id: I428a9d3b10274b97292ab86a74d9b3971d6f10e9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The same _data() will be re-used with trim().
Change-Id: Ie9b794b7e8d40552d9cacb71df0f8a151d4348a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They aren't used because the C++11 atomics are the only atomics we've
supported since commit 9d1fab424e (5.6).
Pick-to: 6.6
Change-Id: I53335f845a1345299031fffd176f84ccd054b804
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
By the time QObject::destroyed() is emitted from ~QObject(), sender no
longer is-a SenderObject, only a QObject, so calling a SenderObject
member function on it is UB.
Says UBSan:
tst_qfuture.cpp:3854:84: runtime error: member call on address 0x60200000e550 which does not point to an object of type 'SenderObject'
0x60200000e550: note: object is of type 'QObject'
00 00 00 00 e8 3f 96 c9 51 7f 00 00 80 3e 00 00 c0 60 00 00 02 11 00 00 08 00 00 00 16 00 00 72
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
Fix by removing the QObject::connect().
This, of course, breaks the test's WHEN, but I don't see how to keep
that WHEN without the UB. At least the THEN part is not invalidated,
and there doesn't appear to be another test that tests that destroying
objects before signal emission results in a cancelled future.
Amends 612f6999c8.
Pick-to: 6.6 6.5 6.2
Change-Id: I38ca4611c071e8fd200393b600210e36d4030bc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QSpan is Qt's version of std::span. While we usually try not to
reimplement std functionality anymore, the situation is different with
QSpan. Spans are non-owning containers, so the usual impedance
mismatch between owning STL and Qt containers doesn't apply here:
QSpan implicitly converts to std::span and vice versa, making STL and
Qt APIs using spans completely interoperable.
We add QSpan mainly for two reasons: First, we don't want to wait
until we require C++20 in Qt and can use std::span. Second, in the
view of this author, some design decisions in std::span hurt the
primary use-case of spans: type-erasure for containers. This results
in two major deviations of QSpan from std::span: First, any rvalue
container is convertible to QSpan, allowing seamless passing of owning
containers to functions taking spans:
void sspan(std::span<T>);
void qspan(QSpan<T>);
std::vector<T> v();
sspan(v()); // ERROR: rvalue owning container
auto tmp = v();
sspan(tmp); // OK, lvalue
qspan(v()); // OK
This author believes that it's more helpful to have compilers and
static checkers warn about a particular wrong usage than to make
perfectly valid use-cases impossible or needlessly verbose to code.
The second deviation from std::span is that fixed-size span
constructors are also implicit. This isn't as clear-cut, because an
explicit QSpan{arg} isn't per-se bad. However, it means you can't
transparently change from a function taking decltype(arg) to one
taking QSpan and back. Since that's exactly what we intend to do in Qt
going forward, in the interest of source-compatibility, the ctors are
all implicit.
Otherwise, the API of QSpan follows the std::span API very
closely. Like std::span, QSpan isn't equality_comparable, because it's
not clear what equality means for spans (element-wise equal, or (ptr,
size)-wise equal?). The major API additions are Qt-ish versions of std
API functions: isEmpty() on top of empty() and sliced() instead of
subspan(). The (nullary) first()/last() functions (Qt speak for
front()/back()) clash with the std::span function templates of the
same name, so are not provided.
This patch adds QSpan as private API. We intend to make it public API
in the future.
Pick-to: 6.6
Fixes: QTBUG-108124
Change-Id: I3f660be90eb408b9e66ff9eacf5da4cba17212a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
When parsing a string whose time-zone part matches local time's name,
use local time in preference to the QTimeZone with that name. The case
is ambiguous, and the bug was already fixed (by something else) in
dev, but this caused a failure in 6.2 through 6.5; and using local
time is more natural to QDateTime in any case. The fix incidentally
makes the the logic of the zone-resolution code more straightforward
and a closer match to how findTimeZone() found the match.
The issue was hidden from 6.6 by a change [*] to the handling of POSIX
rules, that lead to plain abbreviations such as CEST and BST - for
which the IANA DB has no entry - no longer being considered "valid"
zones, despite being technically valid POSIX zone descriptors
(effectively as aliases for UTC).
[*] commit 41c561ddde
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114575
Change-Id: I4369901afd26961d038e382f4c4a7beb83659ad7
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's actually testing that the system locale (which it obtains via the
default constructor, relying on setDefault() not being called first in
the helper program - which I'll soon change) behaves as expected.
Change-Id: Iedd2c1bb549288661c910dfbaac509ede9506d04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Although QSystemLocale is (to make its query enum usable) defined
despite the QT_NO_SYSTEMLOCALE define, it's not used in that case, so
tests based on it won't work. So extend the reach of the #if-ery to
include the test using a custom class based on it. Also rename the
test from systemLocale(), as that's the name the emptyCtor() test
really should have.
Change-Id: Ief69bf161251cde47ee45014cc2627d42cfcc526
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Amends a452e22546. No new tests, existing
tests fails when QPlatformTheme returns a QIconEngine implementation
that provides the tested icons. However, the existing test fails when
the platform icon engine provides and address-book-new icon, and depends
on the order of test functions, as the name() test function modifies the
global theme name and search path. Fix those issues in the test.
Pick-to: 6.6
Change-Id: Ie1c1d14f08fad5e906296bab662df5cfacdbbf07
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Looping over the entries had a typo in it and was quite unnecessary,
as it just made a fresh copy of a list we already had.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I0f3023b06163e5854d425d816e465785cda5fc91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Allocate participating threads and objects on the stack, not the heap.
As a drive-by, port from QList to C arrays (never use a
dynamically-sized container for statically-sized data™).
Code predates the public history, all active branches are affected.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If8def658c1c7b505074938d637e78ad2d1f9fd57
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Like in 9f8449a054, for
doubleProxySelectionSetSourceModel(), the sortStable() test also
leaked _everything_. Fix in the same way, by allocating model and view
on the stack intead of the heap.
With this patch, tst_QSortFilterProxyModel is now asan-, but not
ubsan-clean (and, because of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110704, asan still
reports a leak in cp-demangle.c, which should be™ gone once we fix the
rest of QTBUG-99563).
Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-115264
Change-Id: Ic0e833d7336435e324457f9d9667ee8573a7dafc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QThreeWidgetItems that have been removed from their parents (or the
widget) must be deleted manually. The treeWidgetModel() test forgot
that, driving asan nuts.
Code predates the beginning of the public history, so picking to all
active branches.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I139549b0bd8baf4abfb90f926f6290119471046f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
A caller of Q(Abstract)NetworkDiskCache::data() is supposed to delete
the returned value, and this caller forgot.
Do it now; better late than never.
Amends feb1afc782.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I1b27663df9ad49e0203172265d224fdb6ec06646
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
A text editor commonly wants to display a list of codecs that are
supported. With the introduction of the ICU based QStringConverter, that
list is no longer statically known. So provide the necessary
functionality.
Fixes: QTBUG-109104
Change-Id: I9ecf59aa6bcc6fe65c8872cab84affafec4fa362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The user might not be aware of, or able to see, the difference between
Unicode's assorted horizontal spacing characters, leading them to
expect their input to be accepted for a format despite differences in
spacing. So treat the various horizontal spacing (other than tab)
characters as equivalent when matching the separators in a date-time
format. Add a test-case that failed before this fix.
Fixes: QTBUG-114909
Pick-to: 6.6 6.5
Change-Id: I3e798d3e5b89adb8e86168ebd3954904b258d630
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The QUuid(quint128) ctor was handing the incoming data differently
from the QUuid(Id128Bytes) ctor. Same was valid for the return
values of QUuid::toUint128() vs QUuid::toBytes().
The provided test didn't reveal it, because it was treating the same
128-bit input value as BE in one place, and as LE in another place.
This patch fixes the test, and updates the implementation of
QUuid(quint128) ctor and toUInt128() method to verify that the
updated test passes.
This commit amends 8566c2db85
Pick-to: 6.6
Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
earlyConstructedSockets is a QObject, but had no parent and was never
deleted, leaking all the data is holds.
Fix by giving it a parent.
The code predates the begin of the public history.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QTest::toString() returns a new[]'ed char array, which needs to be
manually deleted and QVERIFY2() doesn't take ownership of its second
argument.
Fix by wrapping in unique_ptr<char[]>(...).get().
Bug exists since the dawn of the public history.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I19ec09f46ec0ce5eacf1437f62dc625bc9343831
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Setting the parent of a QObject to nullptr means the ex-parent no
longer owns and deletes the object as its child, leaking it.
Fix by creating a scope-guard to defer deletion until the tests have
run.
This is simpler than the alternatives:
Putting it into unique_ptr would require a new variable name, or a
larger refactoring of the function, because the `test` variable is
being re-used for many different objects in the course of the
function, most of which should not be deleted.
Using QAutoPointer would drag in QtWidgetsPrivate, and the class is
probably not available in all active branches.
Finally, deleteLater() would require reliably returning to the event
loop, which may not happen if the test is run in isolation.
Bug exists since the dawn of the public history, and QScopeGuard is
available in all active branches.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ib4fcb44b0b68d4ccbcf5af144a18ffb378a72213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
In C++20 std::basic_string_view has gained a range constructor (like
QStringView always had), but that range constructor has been made
explicit. This means we can't just pass a QString(View) to a function
taking a u16string_view. The consensus seems to be that that types that
should implictly convert towards stdlib's string views should do that
via implicit conversion operators. This patch adds them for
* QByteArrayView => std::string_view
* QString(View) => std::u16string_view
* QUtf8StringView => std::string_view or std::u8string_view, depending
on the storage_type
QLatin1StringView doesn't have a matching std:: view so I'm not enabling
its conversion.
QByteArray poses a challenge, in that it already defines a conversion
towards const char *. (One can disable that conversion with a macro.)
That conversion makes it impossible to support:
QByteArray ba;
std::string_view sv1(ba); // 1
std::string_view sv2 = ba; // 2
because:
* if only operator const char *() is defined, then (2) doesn't work
(situation right now);
* if both conversions to const char * and string_view are defined, then
(1) is ambiguous on certain compilers (MSVC, QCC). Interestingly
enough, not on GCC/Clang, but only in C++17 and later modes.
I can't kill the conversion towards const char * (API break, and we use
it *everywhere* in Qt), hence, QByteArray does not get the implicit
conversion, at least not in this patch.
[ChangeLog][QtCore][QByteArrayView] Added an implicit conversion
operator towards std::string_view.
[ChangeLog][QtCore][QString] Added an implicit conversion operator
towards std::u16string_view.
[ChangeLog][QtCore][QStringView] Added an implicit conversion operator
towards std::u16string_view.
[ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion
operator towards std::string_view (QUtf8StringView is using char
as its storage type in Qt 6). Note that QUtf8StringView is planned to
use char8_t in Qt 7, therefore it is expected that the conversion will
change towards std::u8string_view in Qt 7.
Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I cannot get it to fail on my local machine
Change-Id: Iec30858df6bf5ef51a805745745cc0e98e8db03a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We need deduction guides to turn the AtomicPointer template argument
(the pointee) into a pointer:
QAtomicPointer<int> → QAtomicScopedValueRollback<int*>
Extend a test to cover pointers, too.
Fixes: QTBUG-115105
Pick-to: 6.6 6.5
Change-Id: Ib416c6a43e4da480b707a0bf6a10d186bbaad163
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Different mime types are widely used on mobile devices. For example all
text copied from gmail is copied as text/html type.
After 2937cf91c7 commit there is a
regression that makes it impossible to paste any text different than
"text/plain".
To fix it, any "text/*" mime type should be treat as it contains a text
(not only "text/plain"). That will allow to paste different text mime
types.
During this work also tst_qclipboard testset was turned on for Android
and new test (getTextFromHTMLMimeType) was added.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-113461
Change-Id: I3ef9476b8facdc3b61f144bd55222898390127c9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The test was relying on the fact that, having written 1 byte to both
writeEnd1 and writeEnd2 (and ensured those bytes were written with
waitForBytesWritten()), both read ends would be activated by the next
event loop. It turns out that this was an unreliable assumption, because
the processing of that 1 byte on the second socket may not have happened
yet. So firm up by waiting that both read ends are readable before even
creating the QSocketNotifiers we will read on.
I'm not entirely sure what this test is attempting to test. Its
documentation says it's testing a QAbstractSocket condition, but the
read ends aren't QAbstractSocket (this test should have been in
tst_QAbstractSocket if so). It may be testing the condition that caused
that QAbstractSocket behavior, but that wouldn't be a good test.
Drive-by remove redundant flush()-after-waitForBytesWritten() calls.
Fixes: QTBUG-115154
Pick-to: 6.5 6.6
Change-Id: I61b74deaf2514644a24efffd17708f8071f707ed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Register the directory tokenError in the build system to expose it to
embedded devices / for cross compiling.
Do not fail the test function, when a test file isn't found. The tested
functionality is platform independent and will be tested on other
platforms.
Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
As a result of the fix for QTBUG-75214, Qt inadvertently no longer
reads the AND mask that specifies transparency for 16-bit and 24-bit
ico files. This is because it tries to detect 32-bit icons by checking
icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the
QImage, not the depth of the icon, and 32-bit QImage is used for all of
the non-indexed cases (16-bit, 24-bit and 32-bit.)
This commit instead uses icoAttrib.nbits, which should reliably
determine whether or not the icon is 32-bit. This makes the behavior
consistent with other ico reading software, including Windows.
Also, adds a unit test that verifies correct behavior of icon masks,
checking for both QTBUG-75214 and QTBUG-113319.
Amends 1d128ed1df.
Fixes: QTBUG-113319
Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385
Pick-to: 6.6 6.5 6.2 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
ASSERT: "size_t(i) < size_t(size())" in file qbytearray.h, line 492
due to info being emptied out completely and then the code does
while ((info.at(0) == '*')
info was empty because the recent fix "that wasn't the function argument
list" would exit the loop with pos at end.
Incidentally, this change fixes the fact that qCleanupFuncInfo was
removing lambdas:
main(int, char**)::<lambda()>
became
main(int, char**)::
which was, well, shorted, but weird.
Pick-to: 6.6 6.5
Change-Id: Ic7e8f21ea0df7ef96a3f25c4136a727dc0def207
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amend 3e59a88e89, which incorrectly used
isHidden() to test whether the scrollbar is visible or not.
QWidget::isHidden() is only true for child widgets that are explicitly
hidden (or created for visible parents, which the scrollbars are not).
Since the scrollbars are children of a container that is hidden and
shown, isHidden always returns false.
Instead, use QWidget::isVisibleTo, passing the scroll area, as that
tells us if the scrollbar's visibility is relevant for the layout of the
scroll area.
Add a test case for QAbstractScrollArea, verifying that the scrollbar's
size is correctly taken into account when calculating the size hint.
This change revealed an instability in the tests introduced in the
earlier commit: the layout process is asynchronous, requiring event
processing to update the visibility of the scrollbars. Add a call to
processEvents before storing the reference size hint. Also, explicitly
set a style that doesn't use transient scrollbars as otherwise we cannot
control when the scrollbars are shown.
The chagne also revealed an inaccuracy in the QListView test, which
only passed because the width of the vertical scrollbar was included.
We cannot use font metrics results to compare expected width, as the
item delegate's text rendering uses text layouts.
Task-number: QTBUG-69120
Fixes: QTBUG-109326
Fixes: QTBUG-113552
Pick-to: 6.6 6.5
Change-Id: I1f06f9e88046a77722291ac17c56090f8dff7cf3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QXmlStreamReader accepted multiple DOCTYPE elements, containing DTD
fragments in the XML prolog, and in the XML body.
Well-formed but invalid XML files - with multiple DTD fragments in
prolog and body, combined with recursive entity expansions - have
caused infinite loops in QXmlStreamReader.
This patch implements a token check in QXmlStreamReader.
A stream is allowed to start with an XML prolog. StartDocument
and DOCTYPE elements are only allowed in this prolog, which
may also contain ProcessingInstruction and Comment elements.
As soon as anything else is seen, the prolog ends.
After that, the prolog-specific elements are treated as unexpected.
Furthermore, the prolog can contain at most one DOCTYPE element.
Update the documentation to reflect the new behavior.
Add an autotest that checks the new error cases are correctly detected,
and no error is raised for legitimate input.
The original OSS-Fuzz files (see bug reports) are not included in this
patch for file size reasons. They have been tested manually. Each of
them has more than one DOCTYPE element, causing infinite loops in
recursive entity expansions. The newly implemented functionality
detects those invalid DTD fragments. By raising an error, it aborts
stream reading before an infinite loop occurs.
Thanks to OSS-Fuzz for finding this.
Fixes: QTBUG-92113
Fixes: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I0a082b9188b2eee50b396c4d5b1c9e1fd237bbdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It's a bit cumbersome, but works, in principle, using CTAD.
Pick-to: 6.6 6.5 6.2
Task-number: QTBUG-114200
Change-Id: Ib7354180e870a695a978edabf684aedfcf9d9ecc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This reverts commit c2a92199b57b195176d2a0d68d140d72c1cbfb71
"QLibrary::setFileNameAndVersion: reset the tag after findOrCreate".
This restores the behavior of resolve() and compatibility with Qt 4 and
5, which is documented to imply a call to load().
Do note that if you call load() or resolve() and don't call unload(),
the library you've loaded can never be unloaded now. So don't leak!
[ChangeLog][Important Behavior Changes] QLibrary::isLoaded() now reports
whether this instance of QLibrary has succeeded in loading the library,
via direct or indirect call to load(). Previously, it used to reported
whether the actual library was loaded by any QLibrary instance.
The change to QLibrary::resolve() itself is effectively a no-op in this
patch, because isLoaded() would have returned false, but it ensures that
the implementation does what it says it will do.
Fixes: QTBUG-114977
Pick-to: 6.6
Change-Id: I907aa7aea8ef48469498fffd176d7a76ae73e04a
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
We are gradually enabling more tests for WebAssembly platform
for better test coverage.
Long linking time is no longer an issue due to test batching.
Change-Id: I7ee9f877ecda726bc23d8dd2507c616bb381ebc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
The test hasn't failed on Windows for a long time, but regularly fails
on macOS in CI, so replace the entry accordingly.
Task-number: QTBUG-115154
Pick-to: 6.6
Change-Id: Ib89d15cb9edafad5dd71f6e3f830d03aaeb16331
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Its single parameter is a pointer that defaults null, so don't bother
passing nullptr, much less 0, as it.
Change-Id: Iec68bf388d848c020359001699c971e12266a335
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Previously only toDateTime() was tested. Adding a test-case for
toTime() provoked adding full testing for both it and toDate(), based
on toDateTime() tests.
Pick-to: 6.6 6.5
Task-number: QTBUG-114909
Change-Id: I5c24b3869b3deefc36a7125133822e8f41cd24ba
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
As happens for other widgets
(s. QAccessibleWidget::parentObject), report the app
as accessible parent for item views that don't
have another parent set.
Otherwise, the accessible tree is broken when
there's a top-level item view:
The application has the item view as a child,
but the child does not have any parent set.
Extend a QListView autotest accordingly.
Fixes: QTBUG-115135
Pick-to: 6.6 6.5
Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
onExit is called whenever the application exits, i.e.
when the app canvas should no longer be displayed and
the loader/embedder code should take some action.
Emscripten provides two callbacks which can be used
here:
- onExit, called when the app exits (but see EXIT_RUNTIME)
- onAbort, called on abort errors.
These map to the two cases Qt's onExit supports. onExit
is not called when EXIT_RUNTIME is disabled, which means
we don't need the special case for exit code 0.
In addition call onExit on any exception. The second
call to showUi() in html_shell.html is then not needed
any more and we avoid duplicating the UI state handling
in user code.
Update the qtloader_integration test to handle changes in
behavior (we no longer set the error text on exit). Use
emscripten_force_exit() to simulate application exit -
using this function makes Emscripten call onExit even
when EXIT_RUNTIME is disabled.
Pick-to: 6.6
Change-Id: I72b5463c1836e8d5054e594abbd304fbc67032b7
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
This is done as one of the last steps inside QProcess itself, so the
child modifier and all other tasks still run with the parent process'
permissions. On Linux, setting the UID to non-zero will also
automatically clear the effective capabilities(7) set.
This feature is only useful for setuid or setgid applications, so this
commit updates the QCoreApplication::setSetuidAllowed() documentation to
mention the QProcess flag.
Change-Id: I3e3bfef633af4130a03afffd175e940c0668d244
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Doing setsid() and disconnecting from the controlling terminal are, in
addition to resetting the standard file descriptors to /dev/null, a
common task that daemons do. These options allow a QProcess to force a
child to be a daemon.
QProcess ensures that the operations are done in the correct order.
Change-Id: I3e3bfef633af4130a03afffd175e9451d2716d7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The QProcessunixProcessParameters sometimes fails in CI with an XPASS.
Unclear under what conditions QNX behaves correctly, so accept that it
is unpredictable and only expect a failure when a failure is imminent.
Amends f9c87cfd44.
Change-Id: Icf70861343747e6323c7953a2462b7bbc46549b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Spin the event loop with QTRY_VERIFY when checking the dialog box's
focus widget, to stop flaking.
Pick-to: 6.6 6.5
Change-Id: I24fab1264796e05645da4c12e4672daec9b06067
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
SQLite does not provide a proper case folding for non-ascii characters
due to a lack of a proper ICU library. Therefore add an option so Qt can
do it for SQLite.
[ChangeLog][SQL][SQLite] Add new option
QSQLITE_ENABLE_NON_ASCII_CASE_FOLDING for correct case folding of
non-ascii characters.
Fixes: QTBUG-18871
Change-Id: Ib62fedf750f05e50a581604253cf30d81e367b42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Testcase appearsAndSort failed when running the complete testcase but
not as single test. More irritating was the fact that the error was in
QAbstractItemModelTester::headerDataChanged() but the affected test did
not change any header nor does it use the blamed model...
The reason for this is, that QAbstractProxyModel emits a queued
headerDataChanged signal when the header item count changes and
therefore only evaluated when the event loop is run.
Fix it by calling processEvents() after the rowCount change in
filterColumns().
Amends 72e802f3b0
Pick-to: 6.6 6.5
Change-Id: I10cb5aa9c40a6925113cc9c23616774bf15784a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
a611a9f537 (in Qt 5) added support for
mixed-type comparisons through QCOMPARE. That commit added a new
overload for qCompare taking two types, T1 and T2; but it also left the
same-type qCompare(T, T) overload around, guarded by a Qt 6 version
check.
The mixed-type version is however not a generalization of the same-type
one, because it won't work if one of the arguments doesn't participate
in FTAD. Case in point: braced-init-lists. In Qt 5 this worked:
QCOMPARE(some_container, {42});
but in Qt 6 it does not work any more. The mixed-type overload fails
deduction (can't deduce T2); in Qt 5 the same-type overload deduced
T=SomeContainer, and {42} was used to select a constructor for
SomeContainer.
--
There's a partial, straightforward workaround for this: default T2 to
T1 in the mized-type overload. In that case T2 has a "fallback" if it
cannot be deduced. This is partial because of course doesn't address
the case in which T1 cannot be deduced, but I don't think that is
common at all.
QList is special here, because it has qCompare overloads that makes it
comparable with arrays, initializer lists and more. I don't like that
very much -- we should probably have a qCompare(input_range,
input_range) overload, but that's an exercise for C++20.
Change-Id: I344ba33167829984978cd8d649a1904349a9edab
Pick-to: 6.5 6.6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Replace D-BUS with correct splling D-Bus in the source code,
Keep the old spelling inside XML DTD declarations for compatibility.
Change-Id: Ifa5d43f9fa1417431c81cf1bce0d897a966409b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use this format when reporting diagnostics relating to a source file:
<file name>:<line>:<column>: {error|warning|note}: <message>
This makes it easier to find the source elements that caused
a diagnostics report.
Fixes: QTBUG-2597
Change-Id: I8d8d13f7d71d1ce0c5050a0d08dddd33f9997f27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>