Commit Graph

49421 Commits

Author SHA1 Message Date
Alex Trotsenko
ed8b8ffde4 tst_QProcess: fix compilation on Windows
Suppress warning:

..\tst_qprocess.cpp:272:13: warning: 'void childProcessModifier(int)'
    defined but not used ...

Change-Id: Idf601df78be256cfbee0ca80252d1c364c712c8e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-22 23:14:25 +02:00
Giuseppe D'Angelo
8ae9431c79 QMargins(F): add support for structured binding
[ChangeLog][QtCore][QMargins] QMargins is usable in a structured
binding.

[ChangeLog][QtCore][QMarginsF] QMarginsF is usable in a structured
binding.

Change-Id: I0c501847b9377c47bd0e63da3735792075bd0079
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-22 02:22:20 +01:00
Mårten Nordheim
f08492c6fd QCache: fix accidental pessimization
By unconditionally removing the existing entry we never
hit the if (result.initialized) branch. Change it to
only remove the existing entry if we don't plan on inserting.

Task-number: QTBUG-88183
Pick-to: 6.0 6.0.0
Change-Id: If4e7ebac23aa63d4b9d4b0a22882dd7d90a58e8b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-21 13:59:16 +00:00
Andreas Buhr
ae2c309420 Add unit test for QAnyStringView::compare
Coverage tests revealed that
QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity)
was not tested in our unit tests. This patch adds a test for this.

Pick-to: 6.0
Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-21 06:11:55 +01:00
Andreas Buhr
146a2a21b1 Fit tst_qprinterinfo in case there are printers in local network
tst_qprinterinfo compared the output of "lpstat -p" with the
result of a call to "cupsGetDests". "lpstat -p" only returns local
printers, "cupsGetDests" also returns printers on the local network.
This patch fixes the test by using "lpstat -e", which also
shows printers on the local network.

Pick-to: 6.0
Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-11-21 06:11:37 +01:00
Shawn Rutledge
45a65cbeb2 QGuiAppPriv: don't clear target and window for TouchCancel
It's nice not to leave garbage in QPointingDevicePrivate::activePoints
between events; on the other hand, this garbage doesn't matter, because
every press event sets the target and window independently, without
caring what was stored there from before.  But it was wrong to clear
it before we've even delivered the TouchCancel event.

Pick-to: 6.0
Pick-to: 6.0.0
Change-Id: I924039a7c7a8ed75f420d1837c63dc19d3cc98b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-21 03:54:54 +00:00
Volker Hilsheimer
291e8e729e Delete move constructor and move-assignment for QEvent
As of 19f9b0d5f5 we define a protected copy
constructor and assignment operator. Static analyzers warn about missing
move variants, so delete those in addition.

Pick-to: 6.0 6.0.0
Change-Id: I28c1a2afd4560ce35a258bde507dafd93245b75b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 23:16:07 +01:00
Alex Trotsenko
27e08b0c40 QWin32PrintEngine: fix compilation
On MinGW32 it fails with error:

.../src/corelib/global/global.h: 1186:34: error: unused variable 'q'
...qprintengine_win.cpp: 753:5: note: in expansion of macro 'Q_Q'

Pick-to: 6.0 6.0.0
Change-Id: I8eb0e3c5b72f8542cd3bd11514b12d308481f250
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-20 20:30:30 +00:00
Eskil Abrahamsen Blomfeldt
1d14067680 Fix weight when reading old serialized QFonts
The QFont::fromString() needs to differ between strings
produced before and after Qt 6.0 when interpreting the
weight value, since in older strings this will be the legacy
scale.

Luckily the number of tokens in the string can be used for this
purpose, since many tokens were added in Qt 6.0.

This broke KDE, where font settings are stored in QSettings
and serialized using QFont::toString() from Qt 5.

Fixes: QTBUG-88589
Pick-to: 6.0.0 6.0
Change-Id: I199737fed61917f8b9d8f86176ead29a89eb8e0c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-11-20 20:29:00 +00:00
Giuseppe D'Angelo
c63669bb8c QLayout: add a way to unset user-defined contents margins
Once user-defined margins are set on a layout, there's no way
to unset them, except by abusing setContentsMargins and passing
-1, which is a total API abuse (does a negative margin mean that
contents *overflow* the layout?). Add a proper function.

[ChangeLog][QtWidgets][QLayout] Added unsetContentsMargins().

Change-Id: I089788a7470f9649a8f00e42914dafb7242f12cd
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-11-20 20:48:59 +01:00
Allan Sandfeld Jensen
a31484302d Fix safe conversion
Ensure the resulting QScFixed values are no larger than can
be safely returned to int after shifting the fixed factor
away.

Pick-to: 6.0 6.0.0
Fixes: QTBUG-88683
Change-Id: Id0754b021e5fa9a3cf0d15e37ac643cfc1509993
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-11-20 20:42:12 +01:00
Joerg Bornemann
fb21a5ce1a CMake: Name QT_NO_MAKE_*/BUILD_* variables consistently
For consistency, apply the following renamings:
QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT
QT_NO_MAKE_TESTS    -> QT_BUILD_TESTS_BY_DEFAULT
QT_NO_MAKE_TOOLS    -> QT_BUILD_TOOLS_BY_DEFAULT
BUILD_EXAMPLES      -> QT_BUILD_EXAMPLES
BUILD_TESTING       -> QT_BUILD_TESTS

This should help to better convey the difference between "BUILD" and
"NO_MAKE".

To configure tests, but not to build them by default, pass the
following to CMake:
-DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF

Analoguous for examples:
-DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF

Tools can be excluded from the default build with:
-DBUILD_TOOLS_BY_DEFAULT=OFF

The variable BUILD_TESTING is still available and initialized with the
value of QT_BUILD_TESTS.

Pick-to: 6.0 6.0.0
Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 20:38:03 +01:00
Thiago Macieira
47778847ec QCoreApplication: add doc to discourage use of processEvents
Change-Id: If51855da004b4f3fbf43fffd1648fc580c00224a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-11-20 11:38:03 -08:00
Thiago Macieira
8ec9a48e80 QCoreApplication: add more information to processEvents() docs
Just shows how bad an idea to call this function it is.

Pick-to: 5.15
Fixes: QTBUG-88653
Change-Id: If51855da004b4f3fbf43fffd1648fc294065160d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-20 19:38:02 +00:00
Assam Boudjelthia
4713298b98 Android: exclude qarraydata::dataPointerAllocate() from CI tests
Task-number: QTBUG-88705
Task-number: QTBUG-87025
Pick-to: 6.0
Change-Id: If2dc0e650e5104d00a097e6195dd117d6cfd64e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 21:38:02 +02:00
Cristian Adam
e395cbb43d CMake: Fix build of plugins/styles/mac using PCH
If a target inherits precompile headers from a different target
that has more languages enabled (CXX, OBJCXX), the target will
depend on PCH artifacts for a language that is not actually
present.

Ammends d9d137c8f3

Fixes: QTBUG-88609
Pick-to: 6.0.0 6.0
Change-Id: I9735317e634b62732df0fce84fe7cf229cfdea1b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 16:06:38 +00:00
Cristian Adam
98e6234bd4 CMake: Generate less pri files and mark header modules as no_link
Plugins will no longer get .pri files generated in non-static builds.

Header modules are now marked in the .pri files as CONFIG += no_link.

Pick-to: 6.0 6.0.0
Fixes: QTBUG-88221
Change-Id: I06e31fa970ad021261c43ca3acd88055cc4c9555
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 16:06:17 +00:00
Joerg Bornemann
9e0fb9c4fb CMake: Fix Android top-level prefix build
During a top-level prefix build, while configuring qtsvg,
Qt6BuildInternalsConfig tries to include QtBuildInternalsAndroid.cmake
but such files are not copied by qt_copy_or_install() at configure
time.

We need to use the "module" form of include() to take CMAKE_MODULE_PATH
into account. Then QtBuildInternalsAndroid.cmake can be loaded from the
source tree.

The include's current form was introduced in commit
3cb9ee3a5b without further
explanation. Assuming an accidental change.

Pick-to: 6.0 6.0.0
Task-number: QTBUG-88460
Change-Id: If06ac715fae3c2bebbeffca44b7e07265ffb0f71
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 16:05:55 +00:00
Alexey Edelev
85f0792d2b CMake: Change way of 'INPUT_' values handling
Move 'INPUT_' variable detection logic out of
'qt_feature_set_cache_value' function. Use 'INPUT_'
variable to enable/disable related 'FEATURE_' in case if
'FEATURE_' is not defined.

Fixes: QTBUG-88501
Pick-to: 6.0 6.0.0
Change-Id: I1162ac0fb562036898a37b52c3f80229ec8a0970
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 16:05:33 +00:00
Volker Hilsheimer
08f46bb400 Toplevel builds: Add utility toplevel targets for each module
Add a target for each level-1 subdirectory in a module. Ninja already
generates phony targets such as "qtbase/src/all", but those are not
available in e.g. IDE integrations of CMake. With this addition, targets
like qtbase, qtbase_src, and qtbase_tests are available in IDEs.

Pick-to: 6.0 6.0.0
Change-Id: If1c3369e9413b3ce127e68c443d4d22949708d5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 15:52:22 +00:00
Assam Boudjelthia
aaed8f283c CMake: add CMAKE_FIND_ROOT_PATH as extraPrefixDirs for androiddeployqt
androiddeployqt has extraPrefixDirs to provide extra prefix paths in
addition to the main Qt install path, however, for some reason, it was
not being used.

With this, apps for Android using Conan can pass the Conan build prefix
for androiddeployqt to use it as well.

Task-number: QTBUG-88519
Change-Id: Iad73055ac6c03e3ffe86fca271dbda67ac29a275
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 00e726ce12431e8c3db8bc9deb8952f930a5a672)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 15:45:52 +00:00
Alexey Edelev
eaedd7efbf CMake: Fix resource_name variable name in __qt_propagate_generated_resource
__qt_propagate_generated_resource used resourceName variable from
parent scope instead of one passed to function.

Pick-to: 6.0.0 6.0
Change-Id: I18ce8a9f9c01bcfdbab532def55af4e2780d7753
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 15:29:32 +01:00
Ivan Solovev
1a0ae4e32d Extend tests for QMargins
- Add check for QT_NO_DATASTREAM macro
- Add tests for QDebug operator<<

Task-number: QTBUG-88183
Change-Id: I346777a3237986f7f950f157e50cae846b077e11
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-11-20 15:02:11 +01:00
Giuseppe D'Angelo
fb6b7869e8 QPoint(F): add support for structured binding
QPoint(F) are "naturally" destructurable in their x/y
counterparts (hello Mac/Carbon users, we don't live in 1999
any more, it's x and then y, and not vice versa...).

[ChangeLog][QtCore][QPoint] QPoint is usable in a structured
binding.

[ChangeLog][QtCore][QPointF] QPointF is usable in a structured
binding.

Change-Id: I8718a4e80be4ce03f37f012034f1fba009304b32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 16:01:14 +02:00
Tor Arne Vestbø
7d5ba1c17e widgets: Don't report new focus object during clearFocus() unless needed
We do not unconditionally clear focus_child like the existing comment
said. We only do it if the focus_child was the widget that is clearing
focus. So in many cases we'll end up with the same focus object as
before. We can not report that as a focusObjectChanged to the window,
as that will potentially trigger a reset or cancel of the current
input method for the (unchanged) focus object.

Fixes: QTBUG-86976
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I54367e46eda7a94d967f58960bd926c195dc09cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-20 14:51:59 +01:00
Timur Pocheptsov
16f4ce89ed QDtls - remove redundant RAII struct
As noted by LCOV, the part with q_BIO_free(bio) was never executed
since we were taking the result from QScopedPointer before returning.
While it's a what RAII idiom is for, there is quite a low probability
that SSL_set_bio() one day will start throwing exceptions.

Pick-to: 6.0
Pick-to: 5.15
Change-Id: Id24e480dac34166c627b71bb2972de558c644339
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 14:49:27 +01:00
Timur Pocheptsov
1d7189f5b3 tst_qocsp: improve code coverage
By simply extending the basic test to trigger qHash, isEqual and
a bunch of getters.

Pick-to: 6.0
Pick-to: 5.15
Change-Id: Ib1d88fc6d2ad623743cea77ac286ae6ac819dfd1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 14:46:33 +01:00
Tor Arne Vestbø
a6aaa2b707 macOS: Propagate device-pixel-ratio of system tray icon
When preparing a system tray icon on a system with a retina screen,
we end up creating a full-height icon of height 44. If there's also
a 1x screen available, macOS will scale down this image for us when
presenting the icon on the 1 screen, but the downscale will fail to
preserve the aspect ratio of the original image on Big Sur.

Telling macOS which device-pixel-ratio the image has seems to fix
this, and is the right thing to do in any case.

Pick-to: 5.15
Pick-to: 5.12
Fixes: QTBUG-88600
Change-Id: Ic31def94d073da1b256bbfcaf5905f92c169f43d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 13:44:15 +00:00
Tor Arne Vestbø
a07c9a1a70 macOS: Upgrade supported SDK to 11.0
Testing seems to indicate building against the 11.0 SDK works fine,
and doesn't opt in to any new behaviors on Big Sur that Qt isn't
ready for.

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I7da11cf25f2be7443c94ba7a4e9cd99dc1034455
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 13:44:03 +00:00
Andreas Buhr
b02147788b Add unit test for YearMonthDate
Coverage analysis showed that QCalendar::YearMonthDate was not
rigorously tested. This patch adds a unit test.

Pick-to: 6.0
Change-Id: I0af485d13c4883764b61ea1e35455905cc77b966
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-20 14:43:33 +01:00
Andreas Buhr
7b0fd20775 Add unit test for QString::insert(negativeint, QChar)
QString::insert(qsizetype, QChar) can insert at negative positions,
then counting from the end of the string. Coverage analysis revealed we
do not have a unit test for this. This patch adds a unit test.

Pick-to: 6.0
Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-11-20 14:42:49 +01:00
Andreas Buhr
756c4faccb Add unit test reproducing integer overflow in QDateTime::fromString
Task-number: QTBUG-88656
Change-Id: I05b9ad1dfa9b3f02480d8e99a523371342bdba9b
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2020-11-20 14:42:32 +01:00
Timur Pocheptsov
1a2e2921d2 QSslCipher - improve its code coverage and auto-tests
tst_qsslcipher was quite useless - now we test that default constructed
QSslCipher reports expected values. Test the non-default from the
different auto-test,  where we are sure we have really useful
ciphersuites (with different parameters obtained from a TLS backend,
where it's possible).

Pick-to: 6.0
Pick-to: 5.15
Change-Id: Iff14a0580fed889cf9e0873bee01d968773626db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-11-20 14:38:59 +01:00
Giuseppe D'Angelo
b119b17717 QScopedPointer: streamline code with qExchange
Change-Id: I88059d2c484fa2762ec0fc526d81db543043b58b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:34:22 +01:00
Giuseppe D'Angelo
dda6a7497e QScopedPointer helper deletes: add operator()
To make them compatible with unique_ptr. Drive-by,

* add missing noexcept
* turn a `if (p) free(p)` into just `free(p)`.

Change-Id: I234dad6f6b953202dbc537875b94f653a09910fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:34:18 +01:00
Giuseppe D'Angelo
37808ee55a Remove QScopedSharedPointer
It's private and unused since ~2012.

Change-Id: Iea11af27f7eebf3eae2467b22b68cd4c26885edd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:34:14 +01:00
Timur Pocheptsov
4111d8e8e7 tst_QTcpSocket::connectToHostError - handle possible timeouts
... instead of failing the test. On Ubuntu 20.04 when calling
'connect' with 0.0.0.1 we get EINPROGRESS and nothing else,
since our own internal timer has 30 s. timeout, the event loop
in the test stops before this and no socket error detected yet.
Handle such situation without failing a test.

Fixes: QTBUG-88042
Change-Id: Id6add27fcf9bbbe5fbf83a193652edf08fbad8d6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-11-20 14:34:04 +01:00
Sona Kurazyan
289f909621 Test conversion of ulonglong variant to JSON
Make sure ulonglong variant converts to a double JSON value when the
value is greater than 2^63.

Change-Id: I4d4392b05de29c220624056d5d0d4664fb2c08b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:31:49 +01:00
Mitch Curtis
5861e06568 Doc: explain how to create a test touch device for use with touchEvent
Change-Id: Ib60eb0754449da7c50f8632ebd5228ddbe8389f1
Pick-to: 6.0 6.0.0 5.15 5.12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-20 13:30:52 +00:00
Li Xinwei
3ef32ce901 CMake: Don't install pri and debug info for bundled harfbuzz and pcre2
For shared build, Qt6BundledHarfbuzz.lib and Qt6BundledPcre2.lib are not
installed. But their pri files(qt_ext_harfbuzz.pri, qt_ext_pcre2.pri)
and debug info files(Qt6BundledHarfbuzz.pdb, Qt6BundledPcre2.pdb) are
still installed. These files should not be installed too.

Pick-to: 6.0.0 6.0
Change-Id: I3e54bec01d94ee3897b485a982d01b24edc602aa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 13:30:29 +00:00
Andy Shaw
d8602ce58b QFont: Prefer setFamilies() over setFamily()
By depending on setFamilies() then we can be sure that font names with
spaces, commas, quotes and so on are correctly handled without being
misinterpreted. For now it will split on the comma when a string
containing one is passed to setFamily. But from Qt 6.2 this will be
removed to preserve the family string as a convenience function.

[ChangeLog][QtGui][QFont] Indicated that setFamilies/families is
preferred over setFamily/family to ensure that font family names are
preserved when spaces, commas and so on are used in the name.

Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-11-20 14:30:22 +01:00
Simo Fält
13c460d0ff Add coin instructions to run Android test in emulator
Task-number: QTQAINFRA-3867
Pick-to: 6.0
Change-Id: Ie6dd9c2dfeeccd526c2133d7ac03efce5b7ed091
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-11-20 13:28:31 +00:00
Giuseppe D'Angelo
612a01be65 Deprecate QScopedPointer::take()
We've decided that QScopedPointer shouldn't be movable,
because it would break the semantics of being "scoped"
(the pointer/pointee won't survive the scope).

Then, QScopedPointer shouldn't allow for take() either.
If you need those semantics, reach for unique_ptr.

[ChangeLog][QtCore][QScopedPointer] The take() function
has been deprecated. This was an API mistake, as it
allowed the pointer/pointee to escape from the scope,
defeating the point of the QScopedPointer class. If you
need such semantics, use std::unique_ptr (and call
release()).

Change-Id: I3236f085f763b04eb98e3242abc06f7c54fb3d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-20 14:28:31 +01:00
Giuseppe D'Angelo
5dd7e7b7a8 Add deprecation warnings for 6.1
Change-Id: I8e78f29f338670078488247f233b99125eabb4b6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-20 14:28:31 +01:00
Marianne Yrjänä
703485c293 QNX7.1 updates
Updates due to newer compiler version in QNX7.1

Task-number: QTBUG-88300
Change-Id: If9bbc08d49a077d80174a1807e069b5d4ef61c0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 15:28:31 +02:00
Kai Koehne
ce29ce586f Revert "Allow QWindowsPipe{Reader,Writer} to work with foreign event loops"
This reverts commit ee122077b0.

Reason for revert: This causes QProcess::readAll() to sometimes
return nothing after the process has ended.

Fixes: QTBUG-88624
Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 13:28:31 +00:00
Shawn Rutledge
5509449daf Add tst_QHighDpi::mouseVelocity()
Ensure the values are reasonable regardless of screen DPI.  Velocity
is supposed to be in logical pixels / second.

Task-number: QTBUG-88252
Task-number: QTBUG-88346
Change-Id: Ic209887f8ed0381c033a9ff04ae48b072c444df4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-11-20 10:45:11 +01:00
Giuseppe D'Angelo
915be6606e QChar: assert on illegal construction
If the input is out of range for the respective input type,
then fire an assert. Remove a redudant bitwise-and.

The constructors from char have been left alone: we are
documenting that QChar(char) constructs from Latin1 (!), not
ASCII/UTF-8, so all values are valid.

Change-Id: I55e261015d5efa0699c78c25e454f09bb17a913f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-20 03:34:37 +01:00
Andreas Buhr
06f58a909b Add unit test for QString::replace with out-of-bounds position
QString::replace(pos, len, *unicode, size) can handle positions
which are outside of the this-string. In that case, it is a no-op.
Coverage analysis revealed we do not have a unit test for this.
This patch adds one.

Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 23:56:15 +01:00
Andreas Buhr
ebaae45ea1 Fix logic error in QString::replace(ch, after, cs)
Coverage analysis showed that an if-branch marked "Q_LIKELY" was never
taken. It turns out the code was incorrect, but behaved correctly.
This patch fixes the logic and adds a unit test.

Pick-to: 5.15
Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-19 20:28:27 +01:00