Commit Graph

52463 Commits

Author SHA1 Message Date
Robert Löhning
b4c44bd0fa QTextEngine: Style fix
Change-Id: I4269dd40eb4ad536f3ce8bde599241bacd898da7
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-07-26 13:14:34 +02:00
Nico Vertriest
111115bf88 Doc: Ensure deprecated APIs in Gui are documented as such
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>
2021-07-26 12:37:12 +02:00
Sona Kurazyan
bd0d8a3adb Update QtConcurrent docs and examples for reductor object usage
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>
2021-07-26 09:42:49 +02:00
Sona Kurazyan
c3a9c1ecbc QtConcurrent: Remove the redundant code for QStringList
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>
2021-07-26 09:42:45 +02:00
Alex Trotsenko
921ff400bb QLocalSocket/Win: allow delayed close to work
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>
2021-07-25 10:06:27 +03:00
Alex Trotsenko
f18d8fd1fb QLocalSocket/Win: do not close the device on disconnectFromServer()
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>
2021-07-24 21:46:44 +03:00
Alex Trotsenko
6481733d45 QLocalSocket/Win: do not flush the pipe in disconnectFromServer()
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>
2021-07-24 16:55:43 +03:00
Alex Trotsenko
594948a07b QLocalSocket: call abort() instead of close() on destruction
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>
2021-07-24 11:53:12 +03:00
Alex Trotsenko
3221c8dbbe QLocalSocket/Win: remove unnecessary call to setWriteChannelCount()
We no longer use the QIODevice's internal write buffer. This patch
amends 5b78d7fdcf .

Change-Id: Ife5a6ba3c2216d5a3e0a8278da98e0a36886d765
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-24 11:52:57 +03:00
Alex Trotsenko
719116db3d QLocalSocket/Win: remove dead code in disconnectFromServer()
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>
2021-07-24 11:52:42 +03:00
Alex Trotsenko
d9c0af92bd QLocalSocket/Unix: fix aborting the socket
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>
2021-07-24 11:52:30 +03:00
Marc Mutz
a7da8e0dab QWidget: cope with QObject::connect()'s incomplete SFINAE-friendliness
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>
2021-07-24 00:33:09 +02:00
Li Xinwei
bd594f9457 CMake: Use namespaced variables in Qt6*Dependencies.cmake
Pick-to: 6.2 6.1
Change-Id: I166988020cfd9750a4d58e519742215d0c03ad3e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-24 03:51:53 +08:00
Edward Welbourne
1ae4c56ceb Purge empty methods from tst_QSqlRecord
There's no point mentioning empty init(), constructor and destructor.

Change-Id: I0b820f62fd46a955aae891adfc68ca366ca60672
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-23 20:35:02 +02:00
Edward Welbourne
415457302b Select PostgreSQL-only data, rather than filtering in the test
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>
2021-07-23 20:35:02 +02:00
Edward Welbourne
54e50792da Rename QSqlRecord benchmark's source file to match its test name
Change-Id: I580f185b3bbe283dfa2f43bbc986233d01219814
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-23 20:35:01 +02:00
Edward Welbourne
432eab3bc0 Make QSqlRecord benchmarks non-fatuous
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>
2021-07-23 20:35:01 +02:00
Edward Welbourne
346bdc6143 Halve the data-set size of tst_QSqlRecord::benchmarkRecord()
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>
2021-07-23 20:35:00 +02:00
Edward Welbourne
328f22561d Convert QLocalSocket benchmark to use QTestEventLoop
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>
2021-07-23 19:48:59 +02:00
Edward Welbourne
ebae6e2041 Assert some more things we can be sure of in the QMap benchmark
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>
2021-07-23 17:19:18 +02:00
Edward Welbourne
23434f487b QMap benchmark: use unsigned accumulators and check them
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>
2021-07-23 17:19:12 +02:00
Edward Welbourne
d0f9743d3b Rename QMap benchmark source file to match test name
s/main/tst_bench_qmap/g

Change-Id: Ic520254f5b5f946f4eaa234352317749a9a7301f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-23 17:19:04 +02:00
Edward Welbourne
b3e2e5f5b9 Give symbolic names to the sizes of data-sets tested in QMap benchmark
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>
2021-07-23 17:18:59 +02:00
Allan Sandfeld Jensen
162d486c0d Remove special casing of HSL QColor comparison
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>
2021-07-23 15:15:59 +00:00
Timur Pocheptsov
b4942f7f0c doCrypt() - check the error codes
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>
2021-07-23 15:40:47 +02:00
Marc Mutz
58cf68529a QMenu: actually deprecate all trailing-shortcut addAction() overloads
The templated ones were forgotten.

Amends 09d1196281.

Change-Id: I042f25be814fc38e681acfe655124a66e78a1045
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-23 14:12:52 +02:00
Nico Vertriest
a2c8184b6b Doc: Ensure deprecated APIs in Qt Core are documented as such
Added \deprecated [version_since] when needed
Remove references to deprecated functions in \sa statements

Fixes: QTBUG-94534
Pick-to: 6.2
Change-Id: I3b3d4277d63fc5d6d207c28ff2484aed30b83247
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-23 10:39:04 +00:00
Sona Kurazyan
53e4a50c6b Make QFutureWatcher::isFinished() consistent with the watched QFuture
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>
2021-07-23 09:32:54 +02:00
Mårten Nordheim
640c5ca088 Add benchmarks for QString::number
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>
2021-07-22 23:01:41 +02:00
Giuseppe D'Angelo
08411a3ddf QTextCharFormat: mark a couple of API mistakes to be fixed in Qt 7
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>
2021-07-22 21:21:12 +02:00
Edward Welbourne
b5950f6aff Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range i
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>
2021-07-22 18:49:16 +02:00
Edward Welbourne
9159ce0373 Remove some now-redundant casts to qint64
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>
2021-07-22 17:08:43 +02:00
Volker Hilsheimer
188d739400 Sync default action when checking tool button programmatically
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>
2021-07-22 16:17:49 +02:00
Ivan Solovev
29017f1395 QSet: extend tests
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>
2021-07-22 16:17:49 +02:00
Robert Löhning
49d89d867c QColorSpace: Guard against division by zero
Fixes oss-fuzz issue 35547.

Pick-to: 5.15 6.2
Change-Id: Ida0b92ab17548f359d8634114bbdeb4c9d3a8dc8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-22 14:08:33 +00:00
Ivan Solovev
8ac686e9f4 QString: extend unit tests
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>
2021-07-22 16:08:33 +02:00
Alexandru Croitor
d654ff4e99 CMake: Disable test_QT_TESTCASE_BUILDDIR cmake build test
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>
2021-07-22 15:56:37 +02:00
Alexandru Croitor
cd89b7b619 CMake: Fix Windows -debug-and-release builds with CMake 3.21.0
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>
2021-07-22 15:56:37 +02:00
Alexandru Croitor
3a19c5b2e6 CMake: Fix Windows resource compiler failure in selftests with MinGW
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>
2021-07-22 15:56:37 +02:00
Giuseppe D'Angelo
21782bdc04 Android: stop making throwing promises
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>
2021-07-22 15:54:52 +02:00
Alexandru Croitor
91cc4fd699 CMake: Fix incorrect default plugin conditions on Windows
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>
2021-07-22 12:04:15 +02:00
Nico Vertriest
fbf836657f Doc: Ensure deprecated APIs in Qt Sql are documented as such
Added \deprecated + [version_since] where needed

Fixes: QTBUG-94585
Pick-to: 6.2 6.1
Change-Id: Id6d1fee1bbb6f8194e90a494673edef34530482b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-22 07:08:56 +02:00
Edward Welbourne
2e24ee02af Don't slow down a QMap benchmark by growing a megabyte-long string
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>
2021-07-21 20:33:24 +02:00
Ivan Solovev
e5ec09ba86 QSet::erase - extend docs
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>
2021-07-21 20:12:17 +02:00
Fabian Kosmale
7b1b1d990b QFileSelector: Preserve path to root directory
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>
2021-07-21 19:37:16 +02:00
Mårten Nordheim
ec0b44003b QString benchmark: rename the source file
'main.cpp' is quite generic when using search to look for it.

Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-21 17:20:35 +02:00
Volker Hilsheimer
fe1085e9ae Update deprecated NSAccessibility method
accessibilityEnabledAttribute is replaced with isAccessibilityEnabled.

https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc

Fixes: QTBUG-95293
Pick-to: 6.2 6.1 5.15
Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-21 15:53:18 +02:00
Volker Hilsheimer
1ee9496679 Prevent array-out-of-bounds access
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>
2021-07-21 15:53:18 +02:00
Sona Kurazyan
6ebe3d0f08 Fix QtConcurrent to properly work with functors
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>
2021-07-21 09:46:33 +02:00
Luca Beldi
1dcfb09c5b emit layoutAboutToBeChanged timely
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>
2021-07-20 21:27:27 +01:00