Added missing #if-ery and deprecation macros to a QFont constructor
that was only documented as deprecated.
Fixes: QTBUG-94521
Fixes: QTBUG-95310
Pick-to: 6.2 6.1
Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
After 6ebe3d0f08 users don't have to
specify the result type when using functors for as a reductor.
Task-number: QTBUG-88448
Change-Id: I065fed11c1a66833ba0aac3d18e7ff0545247be1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QStringList is a typedef for QList<QString>, so it doesn't need special
handling.
Change-Id: Ib371f9fa49d9d45da7956287dd0f5b6c0224f439
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This mechanism was neither properly designed nor correctly tested
initially on Windows.
[ChangeLog][QtNetwork][Important Behavior Changes] QLocalSocket on
Windows now implements delayed closing, which is consistent with
the behavior on Unix.
Change-Id: Ic3bc427e68eea7f18201f6129df19fbc87d68101
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
It's the user's privilege to do so when they want to finish reading the
QIODevice. Moreover, this is the only difference between close() and
disconnectFromServer().
[ChangeLog][QtNetwork][Important Behavior Changes] The Windows
implementation of QLocalSocket::disconnectFromServer() no longer calls
close(), which is consistent with the behavior on Unix.
Change-Id: Ie9ce20c60259a2b08f5254b719355bd7be9b17cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
In the case where we have pending data to write, calling flush() here
may cause the device to close immediately, if the pipe writer already
got a result of the last operation from the thread pool. In this
scenario, the device does not enter the 'Closing' state, which leads
the following code to unexpectedly fail on Windows
socket.write(...);
socket.disconnectFromServer();
QVERIFY(socket.waitForDisconnected());
Removing the call to flush() makes the behavior consistent with the
implementation on Unix.
Change-Id: Ic31fbc999be979c1e5befa8f132d9fb367f472ca
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
The QLocalSocket destructor should immediately close the connection
and destroy the socket, clearing any pending data in the write buffer.
The abort() call ensures that the pipe is destroyed on Windows, making
the additional call to destroyPipeHandles() from the private destructor
unnecessary.
Change-Id: Ic7a0d8cf2779cd933cded864c8bab0d096469499
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
The _q_pipeClosed() slot unconditionally removes the pipeWriter just
before closing the pipe. Thus, if we have an invalid handle here,
the pipe writer has already been destroyed anyway.
Change-Id: I57463d8464afe6141c21a63851a56ebddabd3f13
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
According to the documentation, calling abort() should immediately
reset the socket to its initial state. This includes:
- closing the file descriptor;
- closing the QLocalSocket as an I/O device;
- canceling a pending outgoing connection, if it exist;
- reseting 'serverName' string.
So, adding a call to close() resets the state entirely.
Pick-to: 6.1 6.2
Change-Id: I9c604b5187c6300b437d7aa4c2d06db03edacf21
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The plan for QObject::connect() (perfect) forwarders, such as
QWidget::addAction(), was to just use a variant of the Detection Idiom
to see whether QObject::connect() with the arguments as given would
compile and SFINAE out the forwarder otherwise.
It turns out that the "functor" overload of QObject::connect(), in
particular, is severly underconstrained and accepts e.g. QKeySequence
as a function object, only erroring out via a static_assert() in the
body of the function, and thus at instantiation time and not, as
needed, at overload resolution time.
At the same time, we don't really want QObject::connect() to SFINAE
out on argument mismatches between signal and slot, because the
resulting error messages would be ... unkind to users of the API. We
would like to keep the static_assert()s for easier error reporting.
Reconciling these two contradicting requirements has so far eluded
this author, so for now, to unblock progress, we explicitly black-
and, in one case, white-list possible arguments. Because QKeySequence,
in particular, is implicitly constructible from int(!), and therefore
any enum type(!), incl. Qt::ConnectionType, we need to do way too much
coding in the addAction() constraints. Hopefully, we'll be able to fix
the issue at the root cause, in QObject, before Qt 6.3 is out, but
until then, this is an ok-ish stop-gap measure.
Add thorough overload set checks (positive ones only, for now) to
tst_qwidget and tst_qmenu.
Change-Id: Ia05233df818bc82ecc924fc44c1b349af41cbbf1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
There's no point mentioning empty init(), constructor and destructor.
Change-Id: I0b820f62fd46a955aae891adfc68ca366ca60672
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Two QSqlRecord benchmarks that are only relevant for PostgreSQL were
being run for all backends, without producing useful results for the
others. Since the test is data-driven and the generic data-table code
can take a backend-name to decide which to include, pass a suitable
string to the generic data method instead, so that we now simply skip
these tests (and say we're doing so) rather than "passing" them.
Change-Id: I2223c16007a7095a9cadd13a9b2d46813507a35f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Because QBENCHMARK re-runs its block repeatedly, to get sensible data,
the block needs to actually do something when repeated. Since these
tests had blocks that looped while (qry.next()), they left qry at its
end state, so such repeats tested nothing. Use seek(0) at the start of
each cycle to actually do the work repeatedly when the block is
repeated. As a drive-by, split a long line.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
At 1000, the set-up was taking longer than the five minutes
QtTestLib's WatchDog allows, so the test got killed.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Now that this event loop pays attention to test failures, we can avoid
the time-outs that used to happen on test failure. Also check for
premature failures (but don't return early, so we can shut down the
server gracefully) and give the event-loops sensible time-outs.
Task-number: QTBUG-91713
Change-Id: Ib895a5fba0f22654c7fecf996f23649a4b5ce0de
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Just in case the test isn't testing what we think it is.
One of my earlier changes didn't until this told me about it.
Change-Id: Idd6f415d543509cabb3a64219736bb43e60a70ef
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The sum of the first 100000 naturals is more than 2^32, so using an
int accumulator to collect the values is susceptible to overflow,
which is UB for signed integral types. So switch to an unsigned type.
We don't care about the actual sum, only having the various map
entries we fetch "used".
Since unsigned arithmetic is well-defined even when it overflows, we
can calculate the expected sum and verify it, to ensure that no matter
how clever the optimizer, it won't throw out the accumulator as
written but not read (and then optimize out all the tested code).
As a drive-by, rename one of the accumulators to match the rest.
Change-Id: I93a2825247c96ca88fe52fdb7ce1e5456eebad54
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Mostly so that I can put comments on them to indicate why some tests
are bigger and others not so big.
Change-Id: I633ceb264aa96ee8f5345e3f342a518e8ae4838b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
All other equality comparisons except floating-point are value
comparisons, not interpretation comparisons.
[ChangeLog][QColor] Equality on HSL colors is now raw value
based like other color-formats, instead of being partially
interpretation based.
Pick-to: 6.2
Change-Id: I391464da172af6a2d69178b94203d36f7ce2c07d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Disabled (moved into the legacy provider) DES-CBC results in a crash,
when setting key length.
Pick-to: 6.2 6.1 5.15
Change-Id: Ie0b49424f11d8042ebecebfd3b6346263f730551
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
All the getters of QFutureWatcher are consistent with the getters of the
corresponding QFuture, except for the isFinished() method, which returns
'true' only after the finished() signal is delivered. This behavior
might be unintuitive for the users. In particular, isFinished() returns
'false', even if it's called immediately after waitForFinished().
[ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The
QFutureWatcher::isFinished() method now indicates if the related
QFuture is finished, instead of indicating if the finished() signal was
delivered. This makes it consistent with the future that is being
watched.
Fixes: QTBUG-91048
Pick-to: 6.1 6.2
Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
While we're here:
- remove the GCC precondition for compiling this benchmark.
Task-number: QTBUG-88484
Change-Id: I14f3ea7e4708e274d032a6297e9d4a87ae5dc1c0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The fontFamilies and fontStyleName have an asymmetric getter and setter.
The setter takes QStringList, but the getter returns QVariant (?), for
no reason whatsoever (the underlying QFont APIs take QStringList,
and the docs say that they should return QStringList).
It's not entirely obvious that we can fix this without introducing
badly-named getters (getX) or somesuch, so for the time being, mark
this to be fixed in Qt 7.
Change-Id: I49706af00906a2c5d950ada4be3cbc76dbee432c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Follow-up to commit 915be6606e, catching
some benchmarks that took for granted they can assign an arbitrary int
to QChar. Since 6.0 this has triggered an assertion.
Given the choice between limiting the range (from 100000 to 0x10000)
and actually handling the out-of-range values as UCS-4 data, the
latter seemed like a more interesting test.
At the same time, take the construction of the strings out of the
loop, as that's not a QMap performance matter, it's a QString one.
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
One was long redundant. The other two, relatively recently added,
should be redundant thanks to the former enum member MSECS_PER_DAY
being changed to a constexpr qint64 by
commit 4059af81d3
Change-Id: I601ed8dae905fed6399ce29c25545ec651e9838a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
QAbstractButton::setChecked is not virtual, so QToolButton cannot
override to synchronize the default action's checked state. This resulted
in button and default action not being in sync when the checked state
of the button was changed programmatically, while changing the checked
state on the action kept the button in sync.
Connect to the button's own toggled signal instead to keep the state of
the default action in sync. Make it a unique connection to allow multiple
calls to setDefaultAction, which are used by QToolButton to keep the
button updated if properties of the default action change.
Add a test that confirms that button and action are synchronized both
ways, and that we only get single signal emissions when changing either
programmatically.
Fixes: QTBUG-95255
Pick-to: 6.2 6.1
Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Extend tests to explicitly check the behavior of empty
default-constructed container.
Also add some missing tests to increase the code coverage.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ie57b5d13fad9a846c29c87be4985c87e69bba305
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This patch introduces some test improvements to check the calls of
different methods on an empty default-constructed string.
Apart from that, some other tests are added to extend code coverage.
As a drive-by:
* fix int -> qsizetype in the test data
* fix int -> enum in the test data
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I159473b7f5dcbea1bdaf2966979e066296351208
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
CMake 3.21.0 + Ninja now pass absolute source file paths to the
compiler which causes __FILE__ to be absolute and qFindTestData
to ignore any QT_TESTCASE_BUILDDIR value.
This causes the test to fail, because it won't find test data in the
custom specified location.
Disable the test for now.
Amends 70464b355e
Pick-to: 6.2
Task-number: QTBUG-95268
Task-number: QTBUG-95018
Change-Id: If99035e897ac1d5f153d4e19c94e4355f88970af
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
CMake 3.21.0 introduced a regression where per-config sources can't be
specified for object libs when building Qt with Ninja Multi-Config
and cross-config mode on.
We hit that in our Windows resource compiler handling.
To work around the issue, pass the config-specific sources directly to
the target rather than via an object library, when using CMake 3.20 or
later. The original issue of not being able to do that has been fixed
in 3.20.
Amends ba6175eb73
Amends a1ccedeb44
Amends 657fa0462d
Pick-to: 6.2
Fixes: QTBUG-95229
Change-Id: Idea6d5bcc54b3124c66c45538c2e06e92f288f5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
The MinGW resource compiler fails to handle compile definitions
with multiple values.
When the resource file is compiled as part of the main target rather
than a separate object library, the resource generation rule will
inherit all the compile definitions from the main target.
For the case of tst_selftests this causes errors like
gcc: error: badxml\: No such file or directory
gcc: error: benchlibcallgrind\: No such file or directory
gcc: error: benchlibcounting\: No such file or directory
gcc: error: benchlibeventcounter\: No such file or directory
gcc: error: benchliboptions\: No such file or directory
Limit the compile definition to the C++ language only, so the multiple
values are not passed to the resource compiler.
Pick-to: 6.2
Change-Id: Ie53666839272556323b50d79c090f0dc71745d11
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
No Qt API throws exceptions, ever. Kill the throwing paths, leaving the
normal paths in which a permission request is denied.
Pick-to: 6.2
Change-Id: I6bebaf155c5232444bf5014e25e9c469d5dccfa6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The correct variable to check is WIN32 rather than WINDOWS.
This affects which plugins get automatically linked in a static
Qt build.
Amends a3b58a7844
Amends d385158d52
Pick-to: 6.1 6.2
Fixes: QTBUG-95283
Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Change a += to simple assignment where it's string arithmetic (a
hundred thousand concatenations of "Hello World" add up to more than a
megabyte, in an incremental growth that's going to dominate the QMap
operations we were meant to be benchmarking) and the only reason for
it is to avoid an unused result warning. Accumulating int values is
harmless, but strings are another story !
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Explicitly specify that calling this method for an empty set or with
an invalid iterator results in undefined behavior.
On a debug build an assert is triggered in such case, but on a release
build it will access the incorect index of an array.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
While QFileSelector is documented to work on files, select accepts
arbitrary URLs. Moreover, the QML engine can end up intercepting
arbitrary (user provided) URLs, including to directories.
Prior to this change, passing "file:///" or "/" to the function would
break: We would temporarily get a "//" path, which is invalid, and thus
we would return an invalid in the end.
Prevent this by only appending a slash to the path when it doesn't have
one.
Fixes: QTBUG-85410
Pick-to: 6.2
Change-Id: I1d2807a9d225df611c3a5e871e3c1d90a6a25953
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
'main.cpp' is quite generic when using search to look for it.
Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Fixes static analyzer warning 12b19393e18b2394a398806f633c6eee, and
amends a1a6e3d21b.
In the process, replace the "int& *= double" with correct integer
arithmetic that'll produce the intended result without going via
double.
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Pick-to: 6.2
Task-number: QTBUG-8096
Change-Id: Ib2aa8ae46a1bfd4d121e61cf99141c0311502215
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QtConcurrent reduce functions were requiring to explicitly pass the
the result type when passing functors as reductor. This was because of
inability to deduce the result type from the functors. The result type
of the QtConcurrent reduce functions should match with the type of the
fist argument of the operator() when a functor is passed. Reused the
ArgResolver type trait (already used for QFuture and QtConcurrent::run)
to find out the result type in that case.
Task-number: QTBUG-88448
Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
layoutAboutToBeChanged must be called before
persistentIndexList as the user might create persistent indexes
as a response to the signal
Fixes: QTBUG-93466
Pick-to: 6.2 5.15
Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4
Reviewed-by: David Faure <david.faure@kdab.com>