Commit Graph

52504 Commits

Author SHA1 Message Date
Marc Mutz
3a72496b5c tests: fix some -Wvolatile
C++20 deprecated compound volatile statements such as pre- and
post-increments, to stress that they're not atomic. So instead of

    volatile i;
    ~~~~;
    ++i;

you're now supposed to write

    volatile i;
    ~~~~;
    int j = i; // volatile load
    ++j;
    i = j; // volatile store

which matches more closely what hardware does.

Instead of fixing every use of volatile pre- or post-increment in this
fashion individually, and realising that probably a few more Qt
modules will have the same kind of code patterns in them, write
QtPrivate functions to do the job centrally.

Change-Id: I838097bd484ef2118c071726963f103c080d2ba5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-28 17:50:09 +02:00
Nicolas Fella
74a91773af [qgenericunixservices] Consider kde-open5 for opening URLs
When xdg-open is not found the KDE-specific kfmclient is considered.
That however is part of Konqueror and may not be present as well.
Plasma offers another option, kde-open5, which should be considered
before falling back to webbrowsers.
This is particularly for non-http URLs like tel: where opening in a
webbrowser is not wanted.

Pick-to: 6.2 6.1 5.15
Change-Id: I2b606562e21568fbe43f4593de67a1d467918cc4
Reviewed-by: David Faure <david.faure@kdab.com>
2021-07-28 16:37:10 +02:00
Timur Pocheptsov
4c0f81490b Provide new code paths for OpenSSL v3
With OpenSSL v3 it would be possible to compile-out functions,
directly working with entities like RSA, DSA, DH and EC_KEY.
For this you have to define OPENSSL_API_COMPAT >= 0x30000000L.
This would break QSslKey and QSslContext.
To mitigate this potential problem, we switch to the 'generic'
API, that works with EVP_PKEY instead. All functionality
will be preserved, except inability of QSslKey::handle()
to get pointers to RSA, DSA, DH or EC_KEY.

Fixes: QTBUG-95122
Pick-to: 6.2
Change-Id: Ic85b48502421c4330cf4877b52850539c855fa74
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-28 16:24:24 +02:00
Marc Mutz
25fff849e8 QDirIterator: add nextFileInfo()
Before this change, next() was the only way to advance the iterator,
whether the caller was ultimately interested in just the filePath()
(good) or not (bad luck, had to call .fileInfo()).

Add a new function, nextFileInfo(), with returns fileInfo() instead.
Incidentally, the returned object has already been constructed as part
of advance()ing the iterator, so the new function is faster than
next() even if the result is ignored, because we're not calculating a
QString result the caller may not be interested in.

Use the new function around the code.

Fix a couple of cases of next(); fileInfo().filePath() (just use
next()'s return value) as a drive-by.

[ChangeLog][QtCore][QDirIterator] Added nextFileInfo(), which is like
next(), but returns fileInfo() instead of filePath().

Change-Id: I601220575961169b44139fc55b9eae6c3197afb4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-28 15:16:42 +02:00
Nico Vertriest
8ccd5d5af2 Doc: Fix link errors in qmake manual
- Replaced # with / after link prefix "Qt for macOS"
- added definite article
- punctuation issue
- Added prefix "Qt for macOS/" to one link, and
  changed "macOS Version Dependencies" to "Supported Versions"

Fixes: QTBUG-90662
Change-Id: Ib2e48ee477e8d34fece64d6dea1f86fe73f09478
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-28 14:40:10 +02:00
Mårten Nordheim
a3889e1cc4 QSysInfo: Delete pre-windows 10 code
It's not supported.

Change-Id: Id8c6ca7e7ad152620c76b5479ca495e9f64cc354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-28 13:18:50 +02:00
Mårten Nordheim
6a51ff3f0d io: Remove version checks for versions below Win 10
It's not supported.

Change-Id: Ia17fc7e1d5ae785eca0a6ba530f9b9bc960605d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-28 13:18:50 +02:00
Mårten Nordheim
c877e9760b QEventDispatcher: Remove code dealing with Windows < 10
It's not supported.

Change-Id: I650a48f214bc4965b5e28f04e4f095273d7f9e5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-28 13:18:50 +02:00
Marc Mutz
becb3596f0 QtCore: clean up API removals
Use the same new pattern as in QtWidgets.

Amends de18b3ff37.

Change-Id: Ia1cbd40aa7a7efc9a954d22b599e13a19a6a9266
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-28 09:43:03 +02:00
Marc Mutz
d3ecc6db29 QMenuBar: remove addAction() functions
They're now in QWidget itself. Remove them from the API, but not the
ABI.

[ChangeLog][QtWidgets][QMenuBar] The addAction() functions have been
moved down into QWidget.

Change-Id: Iaa023ff227686e8e67a2b5594f0fbc31b95177a3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-28 02:01:21 +02:00
Marc Mutz
99f0db695a QNetworkReply: hold QAtomicInt in shared_ptr, not QSharedPointer
Ditto QNetworkAccessAuthenticationManager.

QSharedPointer performs twice as many atomic operations per pointer
copy as std::shared_ptr, and this is private API, we're not bound by
BC constraints, so we can port to the more efficient version.

Change-Id: I59dc09ff4eb3b4acf5d7a68695752a9a7110d8d3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-28 02:01:21 +02:00
Paul Wicking
017eb5627b Doc: Add missing comma
Fixes: QTBUG-95379
Pick-to: 6.2
Change-Id: Ie66feccff27d055a4ebd4f7b26313910934ad234
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2021-07-28 01:43:09 +02:00
Mårten Nordheim
a52e5689aa QString: extend number(double) formatting test
The number(double) testing done in tst_qstring was a bit lacking,
so other tests (like tst_uic) had to be run to properly test changes.

Task-number: QTBUG-88484
Change-Id: I2fc6cba27788ab4fab6d625257f35868e2b684e3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-28 00:29:32 +02:00
Giuseppe D'Angelo
cc584c59de QMap: add operator+ and - for iterators
We missed the chance of deprecating them in 5.15, so
they'll just add to the pain of porting to 6.0. We
should not keep them around forever, though; QMap isn't
random access and so its iterators should only have
bidirectional APIs.

Pick-to: 6.2
Fixes: QTBUG-95334
Change-Id: I3577f7d25e8ab793722d2f220fd27bc85c622b0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 23:48:29 +02:00
Fabio Falsini
7d7f09d556 Add Android service check on quit app
When quitApp() delegates the quit action to runAction(), this
function only checks if an activity exists. If the process is
a service, rather than an activity, it has no activity, so the
action is skipped and the service is not exited.

Check in runAction() for a service as well as an activity.

Pick-to: 6.2
Change-Id: Iec6f0550064506a780892d3d840f7488fc894569
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-07-27 22:45:57 +02:00
Daniel Nicoletti
8f75ab231f Allow to set Local Socket listen(2) backlog
Unix sockets do not suffer from SYN flood, thus the hardcoded value to
50 is size of the only queue to hold connections to be accepted,
resulting in dropped connections when the limit is reached.

On Windows the hardcoded value is 8, this patch changes the default to
50 matching UNIX.

[ChangeLog][QtNetwork][QLocalServer] Added setListenBacklogSize() to
be able to have control over the listen backlog feature.

Change-Id: Iaee6349a46b75b0bd05e40e7ade5948f1cf9f407
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-27 16:47:31 -03:00
Ivan Tkachenko
e4fd86d53a Deduplicate offset calculation in QMetaObjectBuilder
Not even an optimization (unless your compiler sucks). Just improves
readability, since offset is already calculated few lines above.

Offset formula used to be somewhat more complicated, but since commit
e58b44d557 it became reusable here.

Change-Id: I4128b2643daf2cb112c9b861342fd0e27c9a1a95
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 19:21:36 +00:00
Ivan Solovev
b095d26878 QHash/QSet: fix squeeze() for default-constructed container
QHash::squeeze() was unconditionally calling reserve(0), which is
always allocating memory (even for 0 size).
This was leading to a confusing situation when calling squeeze() on
a default-constructed container with 0 capacity() actually allocated
memory. This is very misleading, as squeeze() is supposed to free
unneeded memory, not to allocate more.

This patch adds a check for non-zero capacity. As a result, nothing
is done for default-constructed container.

Note that this patch also affects the QSet::squeeze() behavior, because
QSet uses QHash as its underlying data type.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ib1c3c8b7b3de6ddeefea0e70b1ec71803e8fd3b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-27 20:57:49 +02:00
Thiago Macieira
c8782acd45 QUrlQuery/Doc: update the information about encoded vs decoded
This class was not subject to the QUrl API update that took place
between 5.0 and 5.1 that changed the QUrl string defaults and added
QUrl::ParsingMode. It always parses as TolerantMode.

Fixes: QTBUG-95254
Change-Id: I37d93a60a0d649688bddfffd169348d874eacc92
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-27 11:38:07 -07:00
Sona Kurazyan
08de1fb281 Don't report results when the results list is empty
When inserting items into the result store, a ResultItem is created,
which stores a pointer to the results list and their size. If the size
of the ResultItem is set to 0, it means that a single result is stored.
In case of trying to report results via an empty list, the size is 0, so
result store treats it as a single result.

Added checks before storing the results to make sure that the result
list isn't empty. Note that empty lists are allowed in some cases for
the filter mode, because ResultStoreBase::addResults() knows how to
handle those cases correctly.

Task-number: QTBUG-80957
Pick-to: 5.15 6.1 6.2
Change-Id: I399af4c3eef6adf82fea5df031fe9a9075006b1f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-27 19:57:27 +02:00
Mårten Nordheim
3b8127c3fc doubleToString: Fix assert when double is NaN
wholePartSpace asserts that its input is >= 0, but NaN is not a number

Change-Id: Iafc075663d5f8841f21edf0a3d4d36694287a51f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 18:16:13 +02:00
Ievgenii Meshcheriakov
62b33b6730 QTextStream: Always use direct connection inside QDeviceClosedNotifier
Force direct connection when connecting aboutToClose() signal of device
to flushStream() slot of QDeviceClosedNotifier. This allows use of a
QTextStream from multiple threads when synchronization is handled by the
application.

Queued connections from aboutToClose() don't make much sense because the
device is closed immediately after emitting the signal. If a QTextStream
object is used by threads different from the one where it was created,
queued connection may result in attempting to flush the data after
the associated device is already closed, and accessing the QTextStream's
buffers from multiple threads.

Fixes: QTBUG-12055
Change-Id: If601d0f04f08b248b21ed1630b7dfd3546aee068
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 16:16:13 +00:00
Marc Mutz
0c8b98774c QtWidgets: clean up API removals
As suggested by Peppe and Lars, use one file per module to hold the
removed functions, not one per major version and subdir. Also, make
the remove macro more like QT_DEPRECATED_SINCE.

Change-Id: I2ade51ccc8cb8720ece493936775dfd3b5d438d7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 17:44:30 +02:00
Marc Mutz
8c49ae522d QDuplicateTracker: bring back appendTo() &&
This reverts commit c19695ab95.

Just because QSet has limited API doesn't mean we can't provide this
in an efficient way for std::unordered_set :P

Added tests.

Pick-to: 6.2
Change-Id: I4f8f0e60c810acdc666cf34f929845227ed87f3b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 17:44:30 +02:00
Eirik Aavitsland
6b400e3147 Improve fix for avoiding huge number of tiny dashes
Some pathological cases were not caught by the previous fix.

Fixes: QTBUG-95239
Pick-to: 6.2 6.1 5.15
Change-Id: I0337ee3923ff93ccb36c4d7b810a9c0667354cc5
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-07-27 17:44:30 +02:00
Markus Goetz
85cfbae1d6 QNAM: Allow to configure when connections to a host are torn down
This introduces a new attribute that allows behavior to keep
the TCP connection(s) to a HTTP1/HTTP2 host longer or shorter
than the default of 120 seconds.
Note that the server might still close the connection earlier.

Fixes: QTBUG-20726
Fixes: QTBUG-91440
Change-Id: I7da64230a78c642c12c0ddbe6b678cf17c3aafde
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-27 17:16:58 +02:00
Ievgenii Meshcheriakov
5597e26256 time: Rerun cldr2qtimezone.py
This updates qtimezoneprivate_data_p.h changing any mention of Country
to Territory in it. The change was introduced by the following commit:

    e51831260a

There are no code changes. This reduces number of changes visible after
rerunning cldr2qtimezone.py.

Pick-to: 6.2
Change-Id: I0898ecf224108604b7178e31fa7e76b4cb13a965
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 15:55:55 +02:00
Ievgenii Meshcheriakov
4679209120 QCalendar: Make SystemId constructors with one argument explicit
This avoids unwanted type conversions.

Pick-to: 6.2
Change-Id: Ie57e80da615c6bc162224fa3816fc21a47ab4b00
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 15:07:39 +02:00
André de la Rocha
0235c02178 Windows QPA: Fix coordinates reported through UI Automation
Conversion to/from native screen coordinates was incorrect and could
fail for non-primary screens. This could cause a control's bounding
rectangle to be incorrectly reported, or a search for a control based
on its position within the window to fail, causing incorrect behavior
with accessibility tools and other software interacting with the
application using UI Automation.

Fixes: QTBUG-91459
Pick-to: 6.2 6.1 5.15
Change-Id: I5d56584ff26d977cdd34d35af46644e32aa11e7c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-27 15:07:39 +02:00
Marc Mutz
8e0c2d7d22 Fix various -Wdeprecated-enum-float-conversions around the code
In two cases, it was as easy as replacing an unnamed enum's values
with constexpr variables. In the case of QSimplex, I opted for
qToUnderlying(), as the enum made sense on its own.

Change-Id: Ifcf5be14bd2f35e50adabdbd7ecdb2e83f6bf5b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 14:58:41 +02:00
Marc Mutz
18113e22e9 Add a benchmark for QSharedPointer
Initial results with GCC:

Even though GCC's assembly looks rather bad because of the implicit
fall-back from atomics to non-atomics for single-threaded
applications, libstdc++'s shared_ptr still performs twice as fast as
QSharedPointer, proving that the branch predictor eats libstdc++'s
is-multi-threaded-check for breakfast and the two atomic operations of
a QSharedPointer copy vs. one for std::shared_ptr dominate the
run-time.

********* Start testing of tst_QSharedPointer *********
Config: Using QtTest library 6.2.0, Qt 6.2.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.1.1 20210712), ubuntu 20.04
PASS   : tst_QSharedPointer::initTestCase()
PASS   : tst_QSharedPointer::refAndDeref_null_QSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_QSP_int():
     0.0000024 msecs per iteration (total: 81, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_SSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_SSP_int():
     0.0000024 msecs per iteration (total: 81, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_BSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_BSP_int():
     0.0000025 msecs per iteration (total: 87, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_QSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_QSP_QString():
     0.0000025 msecs per iteration (total: 86, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_SSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_SSP_QString():
     0.0000023 msecs per iteration (total: 80, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_BSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_BSP_QString():
     0.0000026 msecs per iteration (total: 88, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_QSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_int():
     0.000019 msecs per iteration (total: 83, iterations: 4194304)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_SSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_int():
     0.000010 msecs per iteration (total: 90, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_BSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_int():
     0.0000094 msecs per iteration (total: 79, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString():
     0.000017 msecs per iteration (total: 75, iterations: 4194304)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString():
     0.000010 msecs per iteration (total: 90, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString():
     0.0000091 msecs per iteration (total: 77, iterations: 8388608)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int():
     0.000016 msecs per iteration (total: 68, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int():
     0.000025 msecs per iteration (total: 53, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int():
     0.000027 msecs per iteration (total: 58, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString():
     0.000016 msecs per iteration (total: 71, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString():
     0.000027 msecs per iteration (total: 58, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString():
     0.000017 msecs per iteration (total: 73, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int():
     0.00073 msecs per iteration (total: 96, iterations: 131072)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int():
     0.000408 msecs per iteration (total: 107, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int():
     0.00033 msecs per iteration (total: 89, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString():
     0.000877 msecs per iteration (total: 115, iterations: 131072)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString():
     0.00033 msecs per iteration (total: 89, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString():
     0.000385 msecs per iteration (total: 101, iterations: 262144)
PASS   : tst_QSharedPointer::cleanupTestCase()
Totals: 26 passed, 0 failed, 0 skipped, 0 blacklisted, 7995ms
********* Finished testing of tst_QSharedPointer *********

Change-Id: I0bed70142ffdbde6898ec0e27cb470b50fc0e97d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 14:58:41 +02:00
Tor Arne Vestbø
df62fdb51c macOS: Add helper function to check whether we're running under Rosetta
As described in https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment?language=objc#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary

Pick-to: 6.2
Change-Id: I16fa4be20e4a55c87c2eb760d671d27ee4de1703
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-27 12:58:41 +00:00
Ievgenii Meshcheriakov
25170b324b QCalendarBackend: Use QAnyStringView to create backends by name
Combine two implementations of QCalendarBackend::byName() accepting
QStringView and QLatin1String arguments into one accepting
QAnyStringView to reduce code duplication.

Add a note to QCalendar constructors accepting strings to do the
same for Qt 7.

Change-Id: Idfc3b9c61e22712543c723bd94fcd788da52780a
Pick-to: 6.2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 14:58:41 +02:00
Ivan Solovev
7d49dc2222 QVarLengthArray: extend unit tests
This patch introduces some test improvements to check the calls of
different methods on an empty default-constructed container.
Apart from that, many other tests are added to extend code coverage.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Icc1f1342738603c9bed065b2a36c72ea60b48962
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 13:36:17 +02:00
Nico Vertriest
d700ccc007 Doc: document deprecated classes in Qt Widgets
Fixes: QTBUG-94536
Pick-to: 6.2
Change-Id: Ibef78df4f17d084218e2cfd021692c09a621a2d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 06:44:42 +00:00
Mårten Nordheim
5d0542a356 QString::number(int): Avoid going through qlocale machinery
For increased performance, as measured with the number_qu?longlong
QString benchmarks.

The results are all good, reducing runtime by anywhere between 40
and 220 nanoseconds. The slowest test previously completing at ~330ns,
now completing at ~105ns.

Task-number: QTBUG-88484
Change-Id: Ie96e86e57b635bac01389aed531a6d9f087df983
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-26 20:43:44 +00:00
Paul Wicking
7ff72d0a0f Doc: Minor cleanup in QWidget docs
* Add missing . in \brief to silence warning.
* Move relevant text about behavior change since 4.7
  from the end to the start of the documentation block.

Task-number: QTBUG-85839
Pick-to: 6.2 5.15
Change-Id: Id3671413f17d06023035c15fc7d5badbde59c5a6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2021-07-26 20:37:40 +02:00
Robert Löhning
129b0a8d34 Fuzzing: Guide the compiler to the right ctor of QCalendar
Change-Id: I4e828f6ce33636eaef4f51e94e0879d735736ef1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-26 18:37:12 +02:00
Ievgenii Meshcheriakov
9ce4241ef3 Fix typo in function name
Fix typo: containsProhibitedOuptut -> containsProhibitedOutput.

Pick-to: 6.2
Change-Id: I4eb8be4c7ceb2e96ac129ef7c64215558f7b308e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-26 18:06:28 +02:00
Tor Arne Vestbø
5604f633c0 Move Android implementation of permissions API to QtAndroidPrivate
And remove plumbing from public QCoreApplication API, which is going to
be removed in follow up patch after leaf modules have moved to the private
Android API.

The public permissions API will be reintroduced in 6.3 after further work.

Pick-to: 6.2
Change-Id: I46772284b98d0ced8d4a624a850adaa4a1dfe645
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-07-26 14:19:17 +02:00
Jaeyoon Jung
c89a9ccbcc CMake: Keep public include header locations for internal module pri
Amends f254d62cb1.

Task-number: QTBUG-95303
Pick-to: 6.1 6.2
Change-Id: Ica8d2850fe427b780d62cd9a9528f387a7ea1b79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-26 20:46:40 +09:00
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