Commit Graph

37100 Commits

Author SHA1 Message Date
Fabian Kosmale
5481601deb Mark QPropertyAlias as internal
That class was only really meant for the QML compiler, and it is dubious
if event that one needs it. The current implementation is also broken.

Pick-to: 6.1 6.0
Change-Id: Ie40d282707f3fabc8079bee9e98f082aeb9d30b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-02-15 21:37:41 +01:00
Fabian Kosmale
99db1d54ed QPropertyBindingPrivate: Support QQmlProperyBinding
QQmlProperyBinding needs the ability to suspend binding evaluation, and
needs access to the propertyDataPtr.

Change-Id: If82079ffdf28fb277c6e5083714c28478f6e1729
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-15 20:39:09 +01:00
Fabian Kosmale
4d579851c8 QPropertyBindingPrivate: Add further support code for QML
This adds a public function to check whether the QPropertyBindingPrivate
is a normal binding, or a QQmlPropertyBinding. In addition, this check
is used so that the source location function doesn't return garbage, but
instead indicates that the binding was set up from QML.
A function to retrieve the binding location from C++ can be added to
declarative at a later point.

Change-Id: Ica0f70780735fe9c60d01c2b21057d59714079e0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-15 20:38:58 +01:00
Liang Qi
f61b140482 xcb: unset old states and set new ones for window
This partly reverts a02959bb5b.

Pick-to: 6.1 6.0 5.15 5.12
Fixes: QTBUG-87078
Change-Id: I69e18ad3c0a8d142b2e1f5ab87990addc97d9df1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-15 17:09:44 +01:00
Alexey Edelev
01e32d5c4a Remove the corelib_add_mimetypes_resources call for the Core library
Looks like the corelib_add_mimetypes_resources call is redundant and
deprecated. It duplicates the mime-type database in the Core library.

This also fixes the static build of the qmimedatabase tests, since
avoids propagation of the resource symbols by the Core library.

Fixes: QTBUG-89952
Pick-to: 6.0
Pick-to: 6.1
Change-Id: I5c0dbd761b7726589fdf6970cd546af89d2ff837
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 15:07:33 +00:00
Andreas Buhr
6bdffefaa8 Fix QTimer::setInterval to remove existing bindings
A recent change ( a7ca8b1a28 )
led to failure of binding removal in setInterval().
This was fixed by introducing setterScope.
This patch add unit tests for this regression.

Change-Id: Ic8da1f2d82ad6c8ccd81c9b1eff72d42cf75f28a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-15 13:47:31 +01:00
Edward Welbourne
18bf641777 Use newlines more consistently in generate compile-test code
The generated code contained many repeated blank lines.
Most main()s were preceded by one, but not all.
Only include blank lines for actual empty entries in lists, where
configure.json specified them, plus one before main if anything else
precedes it.

Change-Id: I6e6c34940e08712a1aa848a3c9ad1b0fb5806d77
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:45:14 +01:00
Edward Welbourne
c462793d67 Drop parsing of antique TextDate format
Apparently we used to have (back in 2007, only on Windows,
incompatibly with what we were then using on Unix) a TextDate format
(only for QDateTime, QDate used what it still uses) that put the
day-of-month number, with a dot after it, before the month's short
name. We have retained parsing of this format, on all platforms, ever
since.

It no longer matches the format we now use (since 5.2, in 2013, commit
61b56a89a1, which harmonised the format
with Unix and QDate); now seems like a good time to stop complicating
our parser for its sake.

[ChangeLog][QtCore][QDateTime] The parsing of Qt::TextDate in
QDateTime::fromString() no longer supports the old TextDate format
used (only) on Windows by Qt < 5.2 ("ddd d. MMM yyyy" with an
"HH:mm:ss" time either appended or inserted before "yyyy").

Change-Id: I73a798ab78f187543e415119cc4a11f1cfd73820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-15 13:44:48 +01:00
Edward Welbourne
517578e071 QDateTime::toString(): use UTC-offset as time-zone suffix
Since fromString() can't parse the (ambiguous at the best of times;
also backend-dependent and thus potentially system-locale-dependent)
abbreviations currently produced (since 5.9) and can parse UTC-based
offsets, the OffsetName of the zone is a more robust format for the
zone-suffix. This also makes it possible to consistently use the C
locale, compatibly with everything else about post-6.0 date-time
serialization.

[ChangeLog][QtCore][QDateTime] When spec is Qt::TimeZone, the
offset-suffix now used for the toString(Qt::TextDate) format is now a
UTC-based offset string, compatible with the parsing (now) supported
by fromString(). The zone-abbreviation suffix in use since 5.9 was not
parseable.

Change-Id: I4024ae87980c6d3590c68a67b8d1c8f433e36855
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-15 13:44:21 +01:00
Edward Welbourne
3cf84287e7 Prepare TextDate to use UTC-offset rather than GMT-offset zone suffixes
There are GMT-offset zones whose convention for the sign of the offset
is the reverse of what we are (still) using, which is the usual
convention for UTC-offset zone: for example, the Olson Database's
Etc/GMT+3 has offset -3 hours in the UTC-based system we use, so we
give it suffix GMT-0300. The UTC-based suffix is also what we use as
the abbreviation for OffsetFromUTC() in toString().

For now this only adds support for parsing a planned future form: the
old form using GMT is retained, to give client code some chance to
prepare for a backwards-compatible transition. Although the GMT prefix
is matched case-insensitively, only match UTC if fully upper-case;
there is no meaningful precedent for case-insensitive usage here.

[ChangeLog][QtCore][QDateTime] The Qt::TextDate format now recognizes
UTC-based offset suffixes in addition to suffixes based on the
deprecated alias GMT. This prepares for toString() to use such
UTC-based suffixes for time-zones (fromString() cannot parse the
present abbreviation suffix). A future release of Qt shall use
UTC-based suffixes in place of the present GMT-based suffixes (which
conflict with GMT-based IANA zone names) for Qt::LocalTime and
Qt::OffsetFromUTC time-specs. Client code is encouraged to use and
recognize UTC-based zone suffixes in preparation for that transition,
unless compatibility with versions before 6.2 is required.

Change-Id: I5a42a488f1232a30f4b427b7954759283423b9b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-15 13:44:06 +01:00
Edward Welbourne
73fbf8bd30 Simplify test-snippets in configure.cmake
The main(void) signature obviates the need for unused parameters and
has existed since (at least) C89; so use that instead of the
old-fashioned argc/argv arguments we don't use in any of these tests.

Change-Id: Ibfe850a1fce378673c9781011475ea623fd75ad4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:43:52 +01:00
Edward Welbourne
5645ef305a Add some special case markers that seem to have been neglected
At least, running util/cmake/configurejson2cmake.py changes these lines.
Adding them has provoked the script to add a .prev_configure.cmake file.

Change-Id: Idc123d1dee2ce51cd640c090c7910ecc1f0fc5a4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:43:42 +01:00
Edward Welbourne
42101f3871 Update two .prev_configure.cmake files that seem to be out of date
Running the script updated them, without updating the configure.cmake
files they relate to.

Change-Id: I050d2131fa575811ae9ff4b51ef786a073c554c9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:43:30 +01:00
Friedemann Kleint
5de72ac915 QRectF/Documentation: Fix malformed table
The colspan should be 2. Manifests as error in the Qt for Python documentation.

Pick-to: 6.0 5.15
Change-Id: Idec8a2b62a3495e00b7f2b31e8ed9d04b551f22e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-02-15 12:30:43 +00:00
Mårten Nordheim
10aa4b5c61 MinGW: fix warning in QMatrix4x4::map functions
The definitions get the following warning (treated as error):

redeclared without dllimport attribute after being referenced with dll
linkage [-Werror]

I take it to mean that because they are labelled 'inline' the compiler
disregards the 'dllimport', but that makes it inconsistent with the
declaration. So we label the declaration inline as well.

Pick-to: 6.1 6.0 5.15
Change-Id: I87bb42141a1086b2c565db881077f33acb4aab64
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-15 12:11:53 +00:00
Nico Vertriest
7846e2f40d Doc: Fix warning on undocumented enum value
Change-Id: Ia917b86a24bdb621b1040f1e1a9fe4946a1e57ae
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-02-15 09:47:57 +00:00
Mårten Nordheim
6d4da1340f Schannel: Fix incomplete downloads with read buffer restricted
When the read buffer has a max size we do our best not to exceed it.
Usually there's no problem and we just read more when the next
tcp frame arrives. However if there's data leftover after the last
tcp frame arrived then we won't receive any more data. To counter
this QSslSocket would try to invoke QSslSocketPrivate::transmit
indirectly if there were any bytes available on the plain socket.
The problem is that with Schannel the last few remaining bytes
would not be in the plain socket, but in the 'intermediateBuffer'.
So let's make QSslSocket aware of that.

Fixes: QTBUG-90625
Pick-to: 5.15 6.0 6.1
Change-Id: If56e4cce558f99c9a08a1f6818e005a887712ef2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-15 10:45:44 +01:00
Juha Vuolle
08ace69f0e Fix minor documentation typos in bindable properties
Change-Id: I4f8474820db613a675950a858438337558f1c88f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-02-15 10:49:16 +02:00
Kai Köhne
df255a4a04 Fix attribution for tinycbor
Amends cbdf2ba46a

Pick-to: 6.1
Change-Id: Ie1a89ec9367ecc2d674b5f8b27ab3d9bc5a16eca
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-02-15 08:11:33 +01:00
Thiago Macieira
91f6460aff Implement futexes for Windows
Windows 8 added this pair of functions that can be used to implement the
same functionality as we have on Linux. For ease of understanding, I'm
calling them "futex" on Windows too.

From Qt 6 our minimum platform is Windows 10 so we can use this
unconditionally.

Change-Id: Ifea6e497f11a461db432ffff1448c6806ecfc36c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-13 17:53:12 +01:00
Allan Sandfeld Jensen
b2631c72c0 Extend colorspace testing and fix bug it uncovered
When changing transferfunction the look-up-tables needs to be
regenerated.

Pick-to: 6.1 6.0 5.15
Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-13 09:16:38 +01:00
Samuli Piippo
0ce443691f Move QEMU emulation detector to QTest
The emulation detection has been usable only on qtbase tests, move it to
QTest so that it can be used in other modules as well.

Pick-to: 6.1
Change-Id: I4b2321b7856414d7b1cfd5e6b1405a633c6bb878
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-13 10:02:51 +02:00
Shawn Rutledge
bfa78aedc0 Fix Wacom Art Pen detection on xcb
Fixes: QTBUG-91102
Change-Id: I6cd7af26153457609c1fa8fb0a9e167939d592fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-12 18:25:51 +01:00
Allan Sandfeld Jensen
95712c5e54 Fix QImage::fill with semi-transparent QColor
A few formats were not treating the input QColor correctly. Fixed and
added more exhaustive test.

Pick-to: 6.1 6.0 5.15
Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-12 17:40:44 +01:00
Christian Ehrlicher
77e1cc4b39 QHeaderView: pass sectionSize to createSectionItems()
.. instead complete size for the affected range. The complete size was
calculated before for every call of createSectionItems() and then the
function calculated the size per section back for no reason.
Passing the sum of all sections is therefore not needed and may lead to
an integer overflow for big datasets.

Task-number: QTBUG-88728
Change-Id: I8af0b0c3e97021ff0637fe1ee3ca3adfa23a2d0e
Reviewed-by: David Faure <david.faure@kdab.com>
2021-02-12 17:39:37 +01:00
Edward Welbourne
1fc3c6f9b9 Update QDateTime::timeZoneAbbreviation docs
Include Qt::TimeZone as a possible spec, use a \list for the spec
values.  Incidentally use the public QTimeZone::abbreviation() instead
of digging around in its privates to achieve the same effect.

Change-Id: Ibabbeac9b085b4d09de46bda911356c20faadae8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-12 11:59:12 +01:00
Edward Welbourne
02ae1b5221 Fix tst_QDateTime::systemTimeZoneChange() for 32-bit systems
The test verified that a LocalTime's time since Epoch changes when the
system time-zone changes. This works when the QDateTime object is in
short form and recomputes its offset from UTC every time it is needed,
but fails with a pimpled QDateTime, as this caches its offset from UTC
when it is created, saving the recomputation which - in the far more
usual case where the system time-zone does not change in the lifetime
of a QDateTime object - would normally produce the same result.

Changed the test to use a newly-created QDateTime constructed with the
same parameters, which doesn't have the cached out-of-date knowledge
of its zone offset. Removed the XFAIL. Made the test data-driven and
added test-cases: one so close to the Epoch that it should be short
even on 32-bit systems, one so far that it's pimpled even on 64-bit
systems (used in reproducing the issue in order to debug it).

This then revealed that Android 5 doesn't seem to support the POSIX
zone IDs used by this test, so it now verifies that LocalTime has the
expected offset from UTC after zone changes, QSKIP()ping if not.

Documented that the behavior of LocalTime is undefined after a change
to the system time-zone. Cleaned up the existing doc of Qt::TimeSpec
in the process.

Fixes: QTBUG-89889
Pick-to: 6.1 6.0 5.15
Change-Id: I1058f47a1ff3ee1c326f3579ac80bd8bab242e28
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-12 11:58:49 +01:00
Nico Vertriest
3183673303 Revert "Remove the qmake project files" for snippets
This reverts a limited part of commit ad2da2d27a
that deleted .pro files for snippets compilation.
Some .pro files which contain snippets used in the documentation
itself should be restored.

Task-number: QTBUG-90483
Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-02-12 09:43:50 +01:00
Mårten Nordheim
5bd16f132d Fix compilation with system double-conversion
A recent patch made it so we don't need to keep patching the includes
of the sources. However it changed how we use double-conversion ourselves
which meant that system installs would no longer work. Keeping an extra
directory and adding another INCLUDE_DIRECTORY fixes both of our problems.

Amends dca74b45a3

Fixes: QTBUG-90961
Change-Id: If17aa1670535867343374eec846055441592f36b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-12 09:41:45 +01:00
Assam Boudjelthia
886a2d4511 Add build.gradle to easily modifying Java project with Android Studio
Pick-to: 6.0 6.1
Change-Id: Ie030ff0a3569caa0eacfa331d21f59e5455c90ed
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-02-12 08:12:19 +00:00
Assam Boudjelthia
448ea34637 Fix docs misuse of escape character \
Use {} instead of \, this fix a badly generated block of text.

Task-number: QTBUG-89632
Pick-to: 6.1
Change-Id: Ia4aad4c06285eb016a092f4340669fcbef1a6780
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-02-12 09:39:12 +02:00
JiDe Zhang
32a2c8b4e4 remove friend class of QClassFactory for QCoreApplication
from this commit: 38be0d1383

Change-Id: I3c1cbdf793f321febfda0c3b5a931eb1190e9195
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-11 23:19:41 +00:00
Giuseppe D'Angelo
654a216499 QMatrix4x4: deprecate operator*(QVector3D, QMatrix4x4)
The operation is sketchy for a number of reasons:

1) Mathematically, it doesn't make sense. The code interprets the
QVector3D as a point, extending it with w=1, and uses it as a
row vector. But similarly, the vector could be intepreted as a
directional vector, with w=0. No semantic is "better" than the
other.

2) QMatrix4x4 is not meant to be post-multiplied. Granted,
one could use a QMatrix4x4 as arbitrary storage for 16 floats,
but QMatrix4x4 builds itself to be always *pre* multiplied
(e.g. translate changes the 4th column, not the 4th row). We
can keep post multiplication for the general case if we do it
against a QVector4D, but I don't feel that we should support it
also for QVector3D.

[ChangeLog][QtGui][QMatrix4x4] The multiplication operator
(operator*) between a QVector3D and a QMatrix4x4 has been deprecated.
User code needs to extend the QVector3D to a QVector4D first
(by specifying the intended w coordinate), and then multiply
the QVector4D by the matrix.

Pick-to: 6.1
Change-Id: I41b64d8ab7eb6126dc4c49fe29cf3f1b7afc7987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 21:16:22 +01:00
Mårten Nordheim
92b15beb9a QNetworkInformation fixups
Addressing feedback that came after the reviews
ended from both bot and people.

Added CLASS_NAME to the CMakeLists files for the plugins so that
cmake can generate the correct import.

Fixes: QTBUG-91061
Change-Id: Ib3f1e863100c1c421a6c0a4081b1d40696d67b23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-11 18:13:01 +01:00
Mårten Nordheim
153ffff7d5 Fix mingw compiler warnings
Mark overridden functions with override.
Remove unused static function.

Change-Id: I06bd52c66ac7b970dfced0e553eac9c4a4d44d79
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-11 16:59:35 +01:00
Mårten Nordheim
6e89ed5a3c Add a shortcut in QDateTimeParser::findTimeZone for UTC
In a small example program using HTTPS (on Windows with Schannel) >40%
of the time was spent initializing the backend, attempting to find the
time zone used in various certificates.

By adding an early check to see if the requested time zone is UTC (or an
alias ('Z')) we can skip most of the lookup that was required.

In the example program this cut away ~200ms of a total of ~550ms.

Change-Id: I4d29568653e02b64feebbf329469899eb7be1494
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:38:17 +01:00
Mårten Nordheim
6ec3321875 QTimeZone: Avoid creating quite as many QByteArrays
Cuts off 1 second from the timezone test locally

Change-Id: I184728e97bcd65ca0362df4c26a3407576e12dfb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:38:15 +01:00
Giuseppe D'Angelo
6862ce3d77 QMatrix4x4: deprecate operator*(QMatrix4x4, QVector3D/QPoint(F))
The operation does not make sense at the "fundamental" level
for these classes (algebraic, in this case), so it shouldn't exist.

It's also a semantic trap:
* it interprets a _vector_ as a _point_ instead (the vector gets
  1-extended in 4D)
* after the multiplication, it gets perspective divided.

These semantics do not belong to operator*.

operator*(QVector3D/QPoint(F), QMatrix) will be tackled in a next commit;
we don't have a straightforward replacement for it.

Drive-by, document that map() interprets vectors as points.

[ChangeLog][QtGui][QMatrix4x4] operator* between a QMatrix4x4 and a
QVector3D, QPoint, or QPointF has been deprecated in favor of map()
and mapVector().

Pick-to: 6.1
Task-number: QTBUG-89708
Change-Id: Iad78d6eb68cc8cdc3ac16b1635c4d3b522c95213
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:07:12 +01:00
Assam Boudjelthia
c7bcc51e2c Refactor duplicate code for clearing JNI exceptions before returning
Add a private function to handle checking/clearing and deleting the
local reference to jobject before returning a QJniObject.

Task-number: QTBUG-89633
Pick-to: 6.1
Change-Id: I0ea28c8ba4da0bfc1e341c6b4c1f61fecfec87a6
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-02-11 14:03:58 +00:00
Assam Boudjelthia
deca7cd730 Fix registerNativeMethods for good
The initial implementation and the commit
c00ab6f8ea was wrong:
* env->findClass() in fact returns a global reference, and in any
case we shouldn't be calling that, instead QJniObject would be
enough.
* The size param provided to env->RegisterNatives was wrong.
* A test for registerNativeMethods() is added to ensure such break
is not repeated again.

Task-number: QTBUG-89633
Pick-to: 6.1
Change-Id: I4d3a6a9270755f465c40add25521fb750dd4de0a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-02-11 14:03:50 +00:00
Assam Boudjelthia
3348107c03 Android: take JavaVM() from QJniEnvironment and not QtAndroidPrivate
Task-number: QTBUG-89482
Pick-to: 6.1
Change-Id: Idfd442afc90c00e672b28b43c78c789813f46c7d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-11 16:03:43 +02:00
Tor Arne Vestbø
f0f00dbd11 iOS: Disable three-finger-tap editing interaction menu when there's no focus object
A typical Qt application, such as a QML application, is a single full
screen QUIView, containing all of the granular controls of the UI.

The view accepts first responder status, so that we can pass on text
input to a possible text field inside the UI. That however triggers iOS
to bring up the editing interaction menu whenever the user taps with
three fingers, as iOS can't know that only parts of our view is suitable
for interaction.

To mitigate that we override the editingInteractionConfiguration getter
of the view, as documented, and dynamically report the correct enablement
based on whether we have an active focus object that accepts input.

This works because iOS queries the getter from the three finger tap
gesture recognizer, before showing the menu.

Change-Id: I0874340c42e437e1d7251896993f2eafe122f09e
Fixes: QTBUG-89735
Pick-to: 6.0 6.1 5.15
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-11 15:01:45 +01:00
Tor Arne Vestbø
bda8d7a0b0 testlib: Don't abort on unrecognized -AppleFoo command line arguments
Allow passing command line arguments such as -AppleLocale, that override
user preferences for the test process.

Change-Id: I9e58e91fcb01a36f9d6c64ef52369308be5e95b5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:01:45 +01:00
Tor Arne Vestbø
d8158c6c93 macOS: Be honest about the system locale
The system locale of a macOS application is not affected by environment
variables like LANG. Yet, we were reporting a name determined from
environment variables as the fallbackUiLocale(), rather than one based
on the language and country of the actual system locale.

This lead, via the usual CLDR likely-subtag fallback, to claiming the
system locale's name, language, script and country were those obtained
from these environment variables, even when they were at odds with the
actual locale being used by the system, which was being used for some
queries.

Worse yet, any data not supplied by these queries was being obtained
from the same CLDR locale as the name, making for an inconsistent mix
of locale data.

While we cannot avoid the likely-subtag fallback step for fallback
data, it is more consistent to use the actual system locale's name
as start-point for that fallback.

At the same time, add support for the language, script and country
queries, so that the QLocale::system() describes itself faithfully,
instead of claiming to be the locale that results from that fallback.

If we want to support LANG or other environment variable overrides,
they should be handled by the layer above the system locale, by
changing the default locale of the Qt application, as if the user
had called QLocale::setDefault().

[ChangeLog][QtCore][QLocale] QLocale::system() on macOS no longer
pretends to support LANG or other environment variables as overrides,
as this is not a feature that the system locale on macOS supports.
To override the locale of an application, use QLocale::setDefault(),
or pass -AppleLocale en_US.

Fixes: QTBUG-90971
Change-Id: Ibdaf5ff9a2050f61233a88eabf3c29094f7757f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:01:45 +01:00
Tor Arne Vestbø
62af65551f macOS: Initialize standard NSUserDefaults as early as possible
The standard user defaults are initialized from an ordered list of domains,
as documented by NSUserDefaults.standardUserDefaults. This includes e.g.
parsing command line arguments, such as -AppleLocale "fr_FR", as well as
global defaults. AppKit does this during [NSUserDefaults init], which in
turn initializes the locale returned by CFLocaleCopyCurrent() and
NSLocale.currentLocale.

If those functions are called before NSUserDefaults does its thing the
locale will already have been created, and the logic in NSUserDefaults
won't have any effect -- nor is there any way for us to set/override
the locale after this.

To ensure that the -AppleLocale command line override is available through
the lower level Core Foundation preferences APIs, we need to initialize
the user defaults as early as possible via the Foundation-API.

Change-Id: I906a5a8b05a7216e60020ec45f8da725b801d2c5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-11 14:01:45 +00:00
Venugopal Shivashankar
746393545f CMake: Port the snippet project setup to CMake
Change-Id: I411e58e94752f3b2d0a3e8aac0ab7c4c2272db89
Fixes: QTBUG-89826
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-10 21:19:15 +01:00
Eirik Aavitsland
1549dff04c Filter cosmetic lines using transformed, not world coordinates
Lines smaller than 1e-12 would not be drawn even when scaled up.

Pick-to: 6.1 6.0 5.15
Fixes: QTBUG-75630
Change-Id: I8f261876c325b60f61e95ca2e5fde2cb227d4cba
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-02-10 21:17:48 +01:00
Andreas Hartmetz
e6bd5a5ca3 Fix QNetworkInterface IsUp and IsRunning enum documentation
The information is based on common Linux knowledge, StackOverflow
answers (this is just one of them):
https://stackoverflow.com/questions/11679514/what-is-the-
difference-between-iff-up-and-iff-running
an LKML thread about IFF_UP and IFF_RUNNING:
https://lkml.org/lkml/1999/7/9/69
and the FreeBSD manpage for "ifnet" - e.g.
https://www.freebsd.org/cgi/man.cgi?query=ifnet&sektion=9

Pick-to: 6.0 5.15
Change-Id: I50a47b7fb26a63ac9d3f7eeef559fa7f56003cff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-10 16:07:32 +01:00
Assam Boudjelthia
0d42f4df92 CMake: always pass QT6_INSTALL_PREFIX to androiddeployqt
Qt CMake uses a fake_prefix as install dir when running tests instead of
the main qt install path, this will throw androiddeployqt off since it
expects the real qt install path which has gradle and java sources.

Fixes: QTBUG-88579
Pick-to: 6.0 6.1
Change-Id: I6580470840ae14d4a4a68a95f217b30408d7ab44
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-10 11:40:02 +02:00
Alex Blasche
04eb9b7c32 Fix typo in android APK generation log
Pick-to: 6.0 6.1
Change-Id: I9e593f35e1c4a51ef2cd4b08fe7e4b7c1a35a5d6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-10 10:39:16 +01:00
Alex Blasche
9828559a3d Several fixes to porting guides
Change-Id: I46b1754103d33d21e6cdeb338e3c6e3b0d0a4e29
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-10 10:39:06 +01:00
Andrei Golubev
6512a7fc64 Restore pre-Qt6 QList::fill() behavior
Somehow QList::fill(t, newSize) introduced a regression in Qt6:
when newSize < QList::size() we should resize to the newSize.
This is aligned with QVector::fill() in 5.15 and std::vector::assign()

While 6.0 is already out, picking it to 6.0.x could save someone who
haven't migrated yet as well as fix some accidental bugs in Qt's code

[ChangeLog][QtCore][QList] Fixed QList::fill() regression introduced in
6.0: calling fill() with size < current list size wouldn't truncate the
list

Fixes: QTBUG-91042
Pick-to: 6.0 6.1
Change-Id: Ic166e2c5e42390b61df1030f7c705e344433f7f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-02-10 10:36:59 +01:00
Assam Boudjelthia
ab907053bd CMake: fix typo in qt_finalize_executable snippet
Task-number: QTBUG-90943
Pick-to: 6.1 6.0
Change-Id: Idea90f1a5fdd2070102ebda85feed79abcba3f70
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-10 00:00:38 +02:00
Mitch Curtis
1c2aa56cfa Doc: link to QScopeGuard in QScopedValueRollback documentation
Pick-to: 6.1 6.0 5.15
Change-Id: I02b9960fe37b09bc373ed52dec84b1efc8f43397
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-09 20:44:56 +01:00
Alexey Edelev
43cb801ccb Fix compilation of the QPSQLDriverPlugin plugin with enabled PCH
PostgreSQL package delivers several header files such as pthread, zlib,
zconf, uuid, etc. within Windows installation package. The headers are
exposed to the compiler by PostgreSQL include paths and have different
versions. When compiling PCH of the QPSQLDriverPlugin plugin, MinGW uses
the pthread.h header from the PostgreSQL include paths, that cause an
error related to pthread implementation mismatch.

Disable PCH for the QPSQLDriverPlugin plugin, when using MinGW.

Fixes: QTBUG-90850
Change-Id: I0be91bbefe37731acb2658d679b5b644ef552b23
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-09 15:49:47 +01:00
Jonas Karlsson
2861cfb6f8 QTextureFileData: support key value metadata
Task-Id: QTBUG-76970
Pick-to: 6.1
Change-Id: I9dba1b373250cea4d0c806997290a7afcdc900d7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-09 13:39:47 +01:00
Morten Johan Sørvig
d66cb667ef Windows: Change default to ProcessPerMonitorV2DpiAware
Fixes: QTBUG-68712
Change-Id: Id73c4a5422e50b5bee2160468feb4d2f09c5461a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-09 13:33:17 +01:00
Tor Arne Vestbø
7a1be5ee1e Properly name system locale data to clarify its use
Change-Id: Iace9644388444260c59ae46c9ca07bfada739bfd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-09 13:29:26 +01:00
Tor Arne Vestbø
f218d89522 Clarify what QSystemLocale::fallbackLocale() is used for
Change-Id: I8f073f996505ccb42020b32fd76520ecef54e628
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-09 13:29:22 +01:00
Wang Chuan
13ae47d980 QPlainTextEdit: adjust scroll bars when showing up
The text of QPlainTextEdit might change when it is invisible, so an
adjustment of scroll bars is needed when the QPlainTextEdit showing
up, otherwise the range of scroll bars might be incorrect.

Fixes: QTBUG-77937
Pick-to: 5.15 6.0 6.1
Change-Id: I45c686c7e09ca7b2944c36122e9157de0ec4f0e0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-09 20:00:59 +08:00
Assam Boudjelthia
817f8ac03c Documentation improvements to JNI API
Amends 4e60681c87.

Fixes: QTBUG-89632
Pick-to: 6.1
Change-Id: I7856e9b63eea5ba68a5472575016540ae656ec5f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-09 11:22:17 +00:00
Joerg Bornemann
9d84bafeba Make it possible to disable the PrintSupport module
Introduce the 'printsupport' feature to control whether the PrintSupport
module is built.

[ChangeLog][QtPrintSupport] Building of QtPrintSupport can be disabled
by passing -no-feature-printsupport to configure.

Fixes: QTBUG-90778
Change-Id: I8a9a4b7f8dd8f39a81565c8eb14ce1ae0839267d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-09 09:17:21 +01:00
Hou Lei
841e63cb77 Canonical pointer usage
Other affected rows have also been fixed.

Change-Id: Ie0a32f724bd2e40e7bfacfaa43a78190b58e4a21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-09 10:27:14 +08:00
Christian Strømme
86e10e1acd Android: Fix the input type for date/time
The default variation of the DATETIME class is to show the layout for
date and time. If either date or time is requested, then only set one
of them.

Pick-to: 6.1 6.0 5.15
Change-Id: I5178f5f80490b7b0d7e7011d11da402a316d164a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-08 18:31:25 +00:00
Mårten Nordheim
e940ab807c Schannel: fix suspicious sizeof marked by clang
sizeof(1) should be fine, but it looks weird, so let's just use the type
instead.

Change-Id: I543462a837b0214883ca389be0e7e6ba2057cdd0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-08 17:02:31 +01:00
Laszlo Agocs
faebfdea1b Long live VK_KHR_display platform plugin!
Experiment with this once again, this time in a more forward looking
manner: move the code previously placed into eglfs's eglfs_viv backend
into its own plugin.

Move our attention to devices like the Raspberry Pi 4, where
VK_KHR_display has recently been introduced to the Mesa v3dv
backend. This is not in Mesa 20.3.3, the latest release at the time of
writing, but is available and functional when building master. This
serves as the reference system for testing the plugin, because it
looks like a fairly robust implementation.

The sole thing the plugin enables at the moment is creating a
QVulkanInstance and a QWindow with surfaceType VulkanSurface. This is
sufficient to run plain QWindow+QRhi (with QRhi::Vulkan), Qt Quick,
and Qt Quick 3D (with QSG_RHI_BACKEND=vulkan) applications.

One display and mode is chosen, by default the first in the
enumeration lists reported by the Vulkan extension. This can be
overridden with QT_VK_DISPLAY_INDEX and QT_VK_MODE_INDEX (modeled
after QT_VK_PHYSICAL_DEVICE_INDEX). The indices can be determined
based on the logs printed to the debug output. Changing the mode seems
to be working nicely with v3dv.

Multiple screen setups, where there would be more than one
VkDisplayKHR enumerated, have not been tested yet. Regardless,
multiple screens (reporting more than one QScreen, with a different
QWindow on each, eglfs style) are not currently supported. This may be
improved later (while keeping in mind that VK_KHR_display does not
have a fully-featured output management API).

Multiple (non-fullscreen) windows and especially raster windows
(QWidget) are not and will not be supported. Our single QWindow is
always forced to fullscreen.

When it comes to input, the level of support should match linuxfb and
eglfs. Note that while mouse input is fully functional, there is no
mouse cursor. (and this is unlikely to be implemented)

[ChangeLog][Platform Specific Changes][Embedded Linux] Introduced a
vkkhrdisplay platform plugin to run Vulkan-based applications in
fullscreen, without a windowing system, on systems where
VK_KHR_display and VK_KHR_display_swapchain are supported by the
Vulkan implementation.

Change-Id: I6388416f7fb2bfdc4b412a0a4971f25cc05d4668
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-02-08 13:01:22 +01:00
Laszlo Agocs
d8c771c53a egl: Add debug option to print all EGLConfigs
QT_QPA_EGLFS_DEBUG=1 prints the attributes for the chosen EGLContext.
Make QT_QPA_EGLFS_DEBUG=2 print the same for all EGLContexts.

Pick-to: 6.1
Change-Id: Id161d04789fbd015e29e5a5a89a0901000096ea3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-02-08 12:32:13 +01:00
Laszlo Agocs
3bda970935 eglfs: kms: Log gbm bo handle and stride as well
Pick-to: 6.1
Change-Id: Ie345a3f4a4ab0407e3c532c6385ae31ca698d628
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-02-08 12:32:12 +01:00
Mårten Nordheim
2d5506dd9c QNetworkInformation backend for Android
Based on the old bearer manager code!

A lot of the old code went away though since it had been deprecated
in the time since it was written.

Task-number: QTBUG-86966
Change-Id: I21a6db1d4ebd8367084355a8e3202f4c05d9dce5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8652493529a46a375c11bbaf16d2122ee8466c29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 11:30:37 +00:00
Allan Sandfeld Jensen
0ffdbb2126 Handle macOS 11 issues in softHyphens test
Calculate the effective width of the hyphen better, and compare with
ceiled sizes.

Pick-to: 6.1 6.0
Fixes: QTBUG-90698
Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-02-08 11:22:08 +01:00
Ulf Hermann
4e5d0cf5e5 QLibraryInfo: Rename Qml2ImportsPath to QmlImportsPath
The "2" is meaningless. We retain the old name as alias for source
compatibility, but we don't document it anymore.

Task-number: QTBUG-85064
Change-Id: Id10d58f6d39a0faaec042304b374ae6b23469362
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2021-02-08 11:00:12 +01:00
Morten Johan Sørvig
c35643dba3 Windows: Add support for PerMonitorV2 DPI awareness
Add support for opting in to PerMonitorV2 DPI awareness
on the command line:
	-platform windows:dpiawareness=3

This mode is supported on Windows 10 and up. Setting it
requires using the new SetProcessDpiAwarenessContext
API, which can be resolved from user32.dll.

Task-number: QTBUG-68712
Change-Id: I37821e27a67e08c2e9fef25e494cfd7abed13314
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-08 08:13:56 +01:00
Joerg Bornemann
d9a7d1a89c Revert "Fix static build with tests"
This reverts commit 74f549b402.

Reason for revert: This breaks transitive dependencies.

The object file we're adding with target_sources will not be
propagated transitively.

For example, qmltestrunner depends on QuickTest, and
QuickTest depends on Quick.
The 'qrc_scenegraph.cpp.o' object file will not be propagated to
qmltestrunner if added with target_source(Quick INTERFACE ...).

Fixes: QTBUG-90933
Pick-to: 6.0
Change-Id: I11269537ae75de14189f8b5f59094b467e2eee24
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-02-07 20:10:42 +00:00
Hou Lei
584541c7e4 Avoid C-style casts when possible
Other affected rows have also been fixed.

Change-Id: I1d2c28eb37a9d259d3132156163d4135894c18c3
Reviewed-by: David Faure <david.faure@kdab.com>
2021-02-07 01:17:46 +00:00
Mårten Nordheim
67d2963583 Remove QNetworkStatusMonitor
Since the old code is now fully integrated in QNetworkInformation backends

Change-Id: Ia843d17bb3c98333e8d68752e25722b5860f48e0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 7860b9e6ffece207d054ac0c321bc3c5b983708f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-06 10:28:20 +00:00
Mårten Nordheim
b063d22147 SCNetworkReachability based backend for QNetworkInformation
For macOS/iOS. Based on the code Timur wrote for QNetworkStatusMonitor,
and uses QNetworkConnectionMonitor. It has less detail than the other
backends which is unfortunate but should be fine!

Task-number: QTBUG-86966
Change-Id: I0d5930d539f9668f001d6f85c86c9df0803d0f60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 309a2360fdb3e9c1b07d2937859c521da187c486)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-06 10:28:14 +00:00
Mårten Nordheim
63a9793360 NetworkManager based backend for QNetworkInformation
For Linux. Based on the code from the old bearer plugin for
NetworkManager with changes to fit better the objective of
QNetworkInformation.

Task-number: QTBUG-86966
Change-Id: I90c3488ff31ef6dfdcfb877c0e9c592c6c328a89
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6d85e6e45ac9efe12f01ae38619487a23c585e9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 14:52:57 +00:00
Edward Welbourne
128942ccc9 Clean up documentation in QVector[234]D
Change-Id: I13f04c06280b998e5489eb114977ec0ed37178b7
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-02-05 15:40:01 +01:00
Edward Welbourne
968f4001a8 Fix warning from syncqt.pl about header inclusion path
After a "QtCore: WARNING:" intro (separated to avoid being mistaken
for a footer) syncqt.pl said:

 .../qtbase/src/corelib/kernel/qjnienvironment.h includes QScopedPointer when it should include QtCore/QScopedPointer

Change-Id: Iaa1f025367b7321af9c5de27196ebf271f9179df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-05 15:34:00 +01:00
Richard Moe Gustavsen
0bae5fbabb iOS: close edit menu upon focus transfer
If you select text, the edit menu will show.
But if you tap directly inside another input
field, and as such, transfer focus, the menu
will continue to stay visible.

This patch will ensure that we hide the edit
menu when the input field that it was
requested for looses focus.

Pick-to: 6.0 6.1 5.15
Fixes: QTBUG-90937
Change-Id: I1d97bd57fc793826a3170404795b06a1e058d1b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-05 15:25:10 +01:00
Eskil Abrahamsen Blomfeldt
ef763e1958 Fix crash when requesting A32 glyph on Wayland
On Wayland we aren't getting any information about the subpixel
layout of the screen. On Freetype, this triggers an
assert / memory corruption when explicitly requesting a subpixel
antialiased glyph (via QRawFont) because it needs to know the
layout to render the glyphs.

It might be possible to get this information in the Wayland plugin,
but at least we should have a failsafe which doesn't crash when
the problem occurs. This simply falls back to using A8 antialiasing
when it doesn't know the subpixel layout.

[ChangeLog][Freetype] Fixed crash when calling
QRawFont::alphaMapForGlyph() with subpixel antialiasing on Wayland.

Fixes: QTBUG-90236
Pick-to: 6.0
Pick-to: 6.1
Pick-to: 5.15
Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-02-05 15:13:11 +01:00
Tor Arne Vestbø
7c85a45fde macOS: Don't assume NSEvent charactersByApplyingModifiers: produces character
In cases where the keyboard layout doesn't have a mapping for a given
event and modifier combination the result will be an empty string.

Fixes: QTBUG-90683
Pick-to: 6.0
Change-Id: Ice06241f0ae71a19cde041410818decc312bc630
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-05 11:50:18 +01:00
Tor Arne Vestbø
6faa33192c macOS: Don't wrap key event keys in QChar
Key events have a wider range of possible values than the unicode range,
as they also include all the special keys as defined in Qt::Keys.

Instead of turning the argument to keyMapForKey into an integer,
we can remove the argument completely, as it was only used as a
fallback in the cases where UCKeyTranslate (or in the future,
charactersByApplyingModifiers:), failed to map the virtual key
and modifiers to a character. But in those cases we should not
fall back to the Qt key from the key event, as that doesn't
match what the keyboard layout defines. Most keyboard layouts
explicitly define the base key as the key for these "undefined"
mappings, but if the keyboard layout does not, we should not
produce any input in the application, to match what AppKit does
in this case.

Fixes: QTBUG-90315
Pick-to: 6.0
Change-Id: Ib9ffd9521049ee8e4b103597c1d34cbe3d23dbdf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-05 11:50:14 +01:00
Tor Arne Vestbø
98b60450f7 rhi: metal: Present drawables via addScheduledHandler instead of presentDrawable
The former API is the recommended way to present drawables -- avoiding
WindowServer submission throttling and potential issues with lock-ups
when window are not serviced, are being moved to other screens, or users
mistakenly call waitUntilCompleted.

The scheduled block captures the drawable and retains it until the block
is done executing.

Change-Id: I99dca2db3bcfbea67c686dd5d97ba5011598997e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-05 11:50:09 +01:00
Tor Arne Vestbø
0cba6a27e2 rhi: metal: Manually manage drawable lifetime
The drawable returned from nextDrawable is autoreleased, which means
unless we explicitly retain it we have no guarantee that it will stay
alive long enough to be used again in endFrame(). For example, if the
user had an autorelease-pool in their custom render code, where the
call to beginPass() happens, the drawable would be released when that
pool went out of scope. The only reason we didn't hit this yet is due
to the default autorelease-pool being at the level of the runloop, so
the drawable happened to outlive the rendering of a single frame.

An advantage of manually managing the lifetime of the drawable is
also that we can release it immediately after being done with it,
instead of waiting until the autorelease-pool drains.

Change-Id: Ie6fd271adbe1121eb947bb7075142f1a6c81175d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-05 11:50:06 +01:00
Fabian Kosmale
0a86e7fb6d QMetaType: avoid id() calls in compare
We can avoid the overhead of the out-of-line function calls if the id is
already set.
As a drive-by, use relaxed loads in QMetaType::id (was: acquire).

Change-Id: I1d53dbf7e58eae80776ff36334ebf0642ba7842f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-05 07:40:35 +01:00
Giuseppe D'Angelo
a1e9817cec QStandardItem(Model): refactor multiData support
QSI(M) allow users to override their data() functions. This
means that we can't have their data() implemented in terms of
multiData(), or otherwise a subclass that overrides data() will
fall out of sync with its multiData() implementation. We must
keep multiData() implemented in terms of data() instead.

While at it, document QSI::multiData().

Pick-to: 6.0 6.1
Task-number: QTBUG-89423
Change-Id: If30a980d8449135b516745fec73170d53367b4b7
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-02-05 01:00:17 +00:00
Edward Welbourne
7a738daa97 Make explicit that we expect co-ordinates to be finite
The various spatial-vector, line, point, region and margin types have
all long taken for granted that their co-ordinates are finite and, in
particular, not NaN. Make this expectation explicit in the
documentation. Added assertions where (chiefly) noexcept and (where
the assertion would be a simple qIsFinite() call) constexpr didn't
preclude doing so. Also assert against zero divisors that would lead
to non-finite results.

Make minor clean-ups to docs in the process. QMarginsF had several
methods whose declaration, definition and docs weren't consistent in
their parameter names.

Task-number: QTBUG-89010
Change-Id: I601a830959d13a73dcb17ce31a1202a1486c8f7f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-02-04 17:18:51 +01:00
Edward Welbourne
96ef1769c1 Rationalize QVector[234]D's length-handling
Use qHypot() instead of casting to and from double so much,
use qFuzzyCompare(_, 1.0f) rather than qFuzzyIsNull(_ - 1.0f).

Change-Id: I70f38fe2d9aefe1ceb15e1a370f181a7856911b7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-04 17:18:46 +01:00
Edward Welbourne
8c1532eeaa Rationalize QQuaternion's length-scaling code
Use qHypot() to implement length(), avoid duplicating its code and use
its result more carefully, saving the need for casting to and from
double.

Subtracting a double from 1.0f still got a double, so the
qFuzzyIsNull() checks were using double's tolerance, where the use of
1.0f indicates the float tolerance would have been more apt. Also, use
qFuzzyCompare(_, 1.0f) instead of qFuzzyIsNull(_ - 1.0f).

In getEulerAngles(), scale co-ordinates by length before multiplying
(to ensure O(1) quantities) rather than scaling the products by the
squared length (possibly after {ov,und}erflowing).

Change-Id: Id8792d6eb047ee9567a9bbb246657b0217b0849f
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-04 17:18:38 +01:00
Assam Boudjelthia
d6b9200e32 Fix compiler warnings for QFontMetrics use
Pick-to: 6.1 6.0
Change-Id: I4c416280cef8c316258817184e94962c250370da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-04 16:50:45 +02:00
Richard Moe Gustavsen
be06164201 iOS: don't report selection changed if it didn't change
Be more careful about reporting a new selection to Qt. The code for
handling IM selection events in QQuickTextArea is quite complex
and need to take pre-edit text into account. The latter means
that when the pre-edit text changes, as a result of the user composing
a word, the width of the pre-edit text will also change (and as
such, the cursor rectangle). But the cursor position itself stays
the same.  And for this reason, it emits cursorRectChanged more often
than strictly needed. But rather than trying to clean that up, we
do some extra checking before we send the IM event from QPA in
the first place.

Pick-to: 6.0 6.1 5.15
Fixes: QTBUG-63018
Change-Id: I689d989c3fe5d61ef2b1dbee7a70418b7790bce9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-02-04 14:33:12 +01:00
Jan Arve Sæther
f4887aca1e a11y: Report mixed state if QCheckBox is PartiallyChecked
Previously it only returned checked or unchecked for a tri-state
checkbox.

Fixes: QTBUG-84616
Pick-to: 5.15 6.0 6.1
Change-Id: Ife72098e35f8295fd389bda232de5478ffa7e87f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-04 13:23:33 +00:00
Richard Moe Gustavsen
b390812304 iOS: hide edit menu if typing on the input panel
On iOS, if you select some text, the edit menu will show on
top of it. And if you tap on the screen (or inside the menu) it
will hide. But if you type on the input panel, it will stay
open. This is wrong.

This patch will keep better track of whether or not the edit
menu was opened by us, and if it was, ensure we close it also
if the cursor moves by typing on the input panel.

Pick-to: 6.0 6.1 5.15
Fixes: QTBUG-90860
Change-Id: I0a51382030560182e7925c8b694b42e50943514e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-04 12:29:47 +00:00
Morten Sørvig
f7dd793db5 Android: Use new QPlatformInputContext geometry API
This simplifies the Android platform plugin code, since
it no longer has to make QHighDpi scaling calls.

QPlatformInputContext returns geometry in the native
window coordinates. These can be used directly, or in
some cases be mapped further to native global (screen)
coordinates. Note that this mapping now happens after
High-dpi scaling, so we must use QPlatformWindow::mapToGlobal()
instead of QWindow::mapToGlobal()

The inputItemTransform() is applied by QPlatformInputContext
when needed, these calls can also be removed.

Change-Id: I179d44d148dded43683df5e97ad506940894c423
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-04 13:29:46 +01:00
Volker Hilsheimer
5c329f023a Add "we mean it" warning to private header
Fix warning from configure.

Change-Id: I12def11a4effb7298ec0501cfac4ffd37b777ff6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-03 23:46:31 +01:00
Liang Qi
faab8f603d testlib: Only consider major version for macOS 11 and later in blacklists
Pick-to: 6.1 6.0 5.15
Change-Id: I9d3f7ca2022b17559dd5bdd5c6bb8c85e89c3f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-03 19:21:01 +00:00
Allan Sandfeld Jensen
0c5d9b953e Optimize RGBA64PM->RGBA64 for SSE4
And remove direct conversion to take advantage of both the SIMD, but
also threading on all platforms.

Change-Id: I782ae7c80e82b694e23abee28d69cecd0d28c32f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-03 17:24:25 +01:00
Edward Welbourne
9505bd84db De-const the members of QHypotHelper to enable assignment operators
Being able to iterate h = h.add(next) over a sequence of numbers makes
it possible to implement arbitrarily-many parameter functions that
need hypot, e.g. the implementation of V4's Math.hypot().
This amends commit b08368d99f.

Change-Id: I76bb65bd5f318e915d42fa4c935129850e258132
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-02-03 14:05:10 +01:00
Edward Welbourne
dca74b45a3 Use the double-conversion sources without rearrangement
This simplifies the include path addition we need when compiling and
eliminates the need to rewrite all the #include lines on update.

Change-Id: I14e301d277f1eb49286721b012559f0ec84ea520
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-03 14:04:50 +01:00
Laszlo Agocs
d136299bb8 rhi: gl: Attempt reading back floating point formats
...in the hope that they may work. If not, that's it, but at least we
tried.

Task-number: QTBUG-76970
Change-Id: I134c5cc4cfb5ad1e6f9edbfcf506df20022e127a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-02-03 10:40:47 +01:00
Richard Moe Gustavsen
eadbf2dd0b QGuiApplication: use global position to create local position for synthetic mouse events
When QWidgetWindow handles a QTouchEvent, it will call
updateTouchPointsForWidget() for each widget it tries
to deliver the touch event to. This will make sure that
the point's position() is updated to be local to the
widget being processed.

The problem is that we never reset this overwriting of
local positions in the event after we're done. So if we
later try to synthesize a mouse event from it, the local
position in the fake mouse event will be based on the local
position inside a random widget, and not the original local
position sent from QPA.

Rather than trying to store all the original local
positions inside the event before going through this delivery
logic, and reset it afterwards, we base the local position of
the synthesized mouse event on the (unmodified) global
position instead.

Fixes: QTBUG-90033
Change-Id: I1588351482de7cce9c06d102db3686ea8dd0c118
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-03 09:05:21 +00:00
Assam Boudjelthia
4493b90224 Android: fix compiler warnings for Android input
QPointingDevice requires using the constructor to set its settings
in Qt 6.

Replace + with | operator and return QKeyCombination instead of int.

Change-Id: Id3da469cc13b34ec7b55afa751dbc04601880df6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-03 11:02:24 +02:00
Mitch Curtis
b1d750d59b Improve and expand QShortcutMap debug output
- Replace vague symbols with descriptive words.
- Use qScopeGuard() to ensure that removeShortcut prints the number of
  removed shortcuts for all execution paths.

Change-Id: I4d36366445756b41b1dc40bbb1e987dce669a723
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-03 09:46:40 +01:00
Eskil Abrahamsen Blomfeldt
fccd419dd6 Remove false Q_UNREACHABLE from shaping code
This was added by 9ff76c27b9 on
the basis that it signifies a shaping error and would later assert
or crash.

But the line is easily reachable by user code. If Harfbuzz returns
0 glyphs, it just means it is unable to shape the string, for instance
if the input string only contains default ignorables (like a ZWJ)
and does not have any appropriate glyph to use for replacement.

Qt expects there to always be at least one glyph in the output
(num_glyphs == 0 is used to indicate shaping is not yet done), so
to avoid asserts later on, we simply populate the output with a
single 0 token, which is a required entry in the font that is
reserved for representing unrepresentable characters.

This also adds a test and therefore a zero-width joiner to the test
font to reproduce the issue.

[ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts
when shaping strings consisting only of control characters.

Fixes: QTBUG-89155
Pick-to: 5.15
Pick-to: 6.0
Change-Id: Ia0dd6a04844c9be90dcab6c464bebe339a3dab11
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-02-03 09:44:44 +01:00
Andreas Buhr
52fcd0b6d7 Add method to conditionally remove binding to QObjectCompatProperty
Setters of QObjectCompatProperty need to remove the binding, but
only if it is not in the wrapper. This patch adds this method to
the public interface.

Change-Id: Ibc96418fe15b0aeeb2059411ea910ba1f733c255
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 09:32:12 +01:00
Joerg Bornemann
74f549b402 Fix static build with tests
A static build of Qt with QT_BUILD_TESTS=ON would fail with errors like
this:

FAILED: tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2
undefined reference to `qRegisterResourceData(...)'

We create object libraries for resources. In this case, for the
mimetypes of QtCore.

For static builds we added the object files to INTERFACE_LINK_LIBRARIES
of the Qt module the resource belongs to:
    target_link_libraries(Core INTERFACE
        "$<TARGET_OBJECTS:$<TARGET_NAME:${resource_target}>>")

That is, however, a problem for projects that link only against QtCore,
like testProcessEcho2 above. On the linker command line Qt6Core.a is
before qrc_mimetypes.cpp.o and that doesn't work, because the latter
needs symbols of the former.

To have the resource object files before any other libraries on the
linker's command line, we now treat them as source files.

Pick-to: 6.0
Fixes: QTBUG-90582
Change-Id: Ia2786beb5f7c2eba194e8f00ae8785572df1cf6e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-03 09:22:21 +01:00
Allan Sandfeld Jensen
936d499ed4 Optimize RGBA64->RGBA64PM for SSE2/AVX2
And remove the direct conversion so we can get both the SIMD
optimization and threading applied.

Change-Id: Id032ea91cc40c1cbf1c8a1da0386de35aa36cfb5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-03 08:22:16 +01:00
Allan Sandfeld Jensen
ba6b29a367 Fix inefficient use of qToBigEndian
It can do unaligned access directly as well.

Change-Id: I4046cf69e2ad8eb628b8b53bfa521800bb35dc6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-02 13:06:16 +02:00
Li Xinwei
fce1019133 qtlskey_schannel_p.cpp: fix a compilation error
qtlskey_schannel.cpp(183): error C3861: 'lcSsl': identifier not found

Change-Id: I406860f87a7b7f93ac2c0ca3d426dfa88615a90e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-02 18:34:26 +08:00
Tor Arne Vestbø
3d341ae882 macOS: Reduce duplicated code for showing file dialogs
The initialization was duplicated across the different modes. We now do
the setup once, in a shared showPanel:withParent function.

This also simplifies and removes the need to store the return code.

Change-Id: I3c4da48cfef92bcc59c76cffa15b40150de1a9e1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:16 +01:00
Tor Arne Vestbø
1724fccb01 macOS: Reduce duplicated updates of file dialog properties
Change-Id: I2017bfdfa6d5598405d700680ecaaf04fd6023fd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:13 +01:00
Tor Arne Vestbø
7f8a80ebf8 macOS: Refactor computing of accepted extensions in file dialogs
Change-Id: Ie71db5a0ab66dd9d157b53297cbb9aba248fa8af
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:11 +01:00
Tor Arne Vestbø
9366e034d9 macOS: Use single variable to track file dialog in QCocoaFileDialogHelper
Relying on Objective-C's no-op behavior when sending messages to nil was
nifty, but a bit confusing when trying to track the ownership model of
the class.

It's now explicit at the call sites what's going on (a cast).

The canSelectHiddenExtension property is valid both save and open
panels, but AppKit will only show it for save panels.

Change-Id: I8e12d629639e2179d155b2ecda1bb2dab2a5757d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-02 11:26:17 +01:00
Mårten Nordheim
a3b58a7844 NetworkListManager based backend for QNetworkInformation
For Windows. Based on the code I wrote for QNetworkStatusMonitor.
It also renames the netlistmgr feature, avoiding the abbreviation.
Locally my MinGW fails the networklistmanager feature test so it may
not be supported on MinGW, likely leaving it without a backend at all.

Change-Id: I13bbe4127edc2a9c0bb91602c95f1cb206a85a69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:10:06 +01:00
Morten Sørvig
dc3446c1e3 Make setSelectionOnFocusObject() take native pixels
Change the setSelectionOnFocusObject() to take geometry
arguments in native pixels, in order to be consistent with
other QPlatformInputContext API.

Calling code which pass non-native geometry must be updated
(in practice only the Android platform plugin).

Change-Id: I1c61b8cf583afe607567d6056ca7ff23cc3de3f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-02 10:22:52 +01:00
Christian Strømme
8ad66a1488 Android: Replace magic number for TYPE_NUMBER_VARIATION_PASSWORD
This field has been defined since API level 11, so no reason why we
shouldn't just use that instead.

Pick-to: 6.0
Change-Id: I8e3ffde3680e41f26d776e1f0474f632186a6b27
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-02 09:17:22 +00:00
Christian Strømme
5e95fab53f Android: Fix input method hints for ImhHiddenText
If ImhHiddenText is set then that should take precedence over the
other input method hints. Also, certain combinations aren't really
possible. E.g., ImhEmailCharactersOnly and ImhHiddenText doesn't have
its own specific variation on Android.
ImhSensitiveData and ImhNoPredictiveText are also likely to not work
as TYPE_TEXT_FLAG_NO_SUGGESTIONS is normally ignored by Android
keyboards. A common workaround is to use the visible password variation
but since this will force the layout to use latin characters it's not
something we can use as an universal workaround, so users will need to
manually enable it through the environment variable
QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT

Fixes: QTBUG-85787
Pick-to: 6.0 5.15
Change-Id: I0ff591ec9acf8dd556c7987e6d997cff3ddfe38e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-02 11:17:07 +02:00
Assam Boudjelthia
c00ab6f8ea Fix QJniObject::registerNativeMethods use of global reference
registerNativeMethods() should be using the local jclass from
findClass() instead of the global reference.

Task-number: QTBUG-89633
Change-Id: I469a9a1ecff95ab9948421baa5c88735ba7ad776
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-02 10:32:36 +02:00
Allan Sandfeld Jensen
9f4098937b Fix nullptr dereference on out-of-memory conditions
Fixes two static analysis warnings.

Change-Id: Id4644d1944e97c9c53d2268a9a71e5f6347d3946
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-02 09:32:36 +01:00
Allan Sandfeld Jensen
feb6711a79 Segment qimage conversion block irrelevant of depth
Always try segments from 64k to 128k pixels, this matches
qimagescale logic, and gives a one percent speedup locally.

Change-Id: I3ef468eac9dca4b84f04850e970f3d15a4f16255
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-02 09:32:36 +01:00
Morten Sørvig
b23f5621d7 iOS: Use new QPlatformInputContext geometry API
This enables support for QT_SCALE_FACTOR on iOS.

Fixes: QTBUG-74978
Change-Id: Ibcf0741c178e44802065e472e096a5f4c7d6f3cf
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 22:44:51 +01:00
Morten Johan Sørvig
dafe9e2363 Windows: Fix frame margins calculation
Passing nullptr to QHighDpi::toNativePixels() is seldom
correct, and will work only on the main screen.

Instead, call frameMargins() on the platform window
(instead of on the QWindow) and get the margins directly
in native pixels.

Pick-to: 5.15
Fixes: QTBUG-90716
Change-Id: Id7b31ec3246010c367781b64ed832c589bbaeb0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-01 22:43:59 +01:00
Joerg Bornemann
a4574bfd34 Fix duplicate symbols warnings in bundled freetype
Some of the listed source files are already included and must not be
compiled.

Pick-to: 6.0
Fixes: QTBUG-90777
Change-Id: I80b4ca6a50b882445aca513d800ef8375070d786
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-01 20:13:38 +00:00
Friedemann Kleint
90dc13ae5f Windows: Fix flicker when resizing translucent windows with QSizeGrip
Do not use the startSystemResize() functionality in that case.

Fixes: QTBUG-90628
Fixes: QTBUG-73011
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I8d4843c1715c7f75f9b41c904e6f1aebbf0e02d7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 20:44:27 +01:00
Jonas Karlsson
c5e9708ce6 Support cubemap ktx files
Change-Id: I6905c393647d31fab958cdd9471bb0a6ffe83596
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-01 20:28:37 +01:00
Timur Pocheptsov
5caf4b074e Schannel - fix a compilation error
While rebasing and resolving conflicts, I've acidentally removed a
declaration of supportsTls13() making a call expression invalid.

Change-Id: If561091db36f0354b61fa050ff9f72b29eddce53
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-01 20:25:59 +01:00
Morten Johan Sørvig
fddc0b34df Add geometry accessors to QPlatformInputContext
Currently the platform plugins use the public QInputMethod
API when querying geometry. However, QInputMethod returns
geometry in device independent pixels, while the platform
plugins require geometry in native pixels.

Add new API to QPlatformInputContext which returns input
geometry in the native window coordinate system:

    QRectF inputItemRectangle()
    QRectF inputItemClipRectangle()
    QRectF cursorRectangle()
    QRectF anchorRectangle()
    QRectF keyboardRectangle()

These make the relevant QHighDpi calls internally, and
such calls can then be moved out of the platform plugins.

Disambiguate inputItemRectangle() in qandroidinputcontext.cpp
by renaming it to screenInputItemRectangle().

Change-Id: I561745b64fb197d64e3dfddcf0751528bb8d0605
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 20:06:52 +01:00
Edward Welbourne
38a72af4fd Fix handling of Sunday in POSIX time-zone rules
Dating from the origins of our support for the zoneinfo file format,
the mapping of POSIX's day-numbering (0 = Sunday through 6 = Saturday,
see [*]) to Qt's (1 = Monday through 7 = Sunday) was done by mapping 0
to 1, when it should have been 7.

[*] http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

Corrected a QTimeZone test that trusted the results it got without
checking which day of the week those were: they were all Mondays.
Verified that the corrected dates are in fact Sundays.
Checked the zone abbreviations, too.

Fixes: QTBUG-90553
Pick-to: 6.0 5.15
Change-Id: I84b4b14f9892ff687918cd3c42c7c9807e45313c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-01 16:28:26 +01:00
Ulf Hermann
38d1444a60 Do delete on QMetaType::destroy() even without dtor
As we call operator new on create(), we also need to delete on
destroy(). Otherwise we leak memory.

Change-Id: Ib80fe96c4173cba6fa474d3c81d88fe603d1ded2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-01 15:46:39 +01:00
Craig Scott
d6a8560eae Ensure Core target has INTERFACE_QT_COORD_TYPE property defined
In order for other Qt modules to be able to reliably use this property,
it needs to be defined under all supported scenarios. Previously, it
would only have been defined for a per-repo build and not for a top
level superbuild. The only place it was being set was in the
Qt6CoreConfigExtras.cmake file and only when QT_NO_CREATE_TARGETS was
false (so it wouldn't be defined for examples even in a per-repo build).

It was also noticed that INTERFACE_QT_MAJOR_VERSION was also being
handled in Qt6CoreConfigExtras.cmake, but this was not needed. This was
already being done as part of a call to qt_autogen_tools_initial_setup()
which occurs inside qt_internal_add_module().

Fixes: QTBUG-90617
Change-Id: I589316ffb8138bd2df8a1d49fdd6335d2e2836f1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-02 00:59:01 +11:00
Richard Moe Gustavsen
3811be28ad iOS: always hide edit menu when showing the magnifier glass
Bug: If you do a press and hold on a line edit, the edit menu
will show to let you select a word etc. If you now do
another press and hold to bring back the magnifier glass,
the edit menu will stay open while you move the magnifier glass.

This patch will ensure that we always hide the edit menu when
we show the magnifier. There is never a case where both of
them should show at the same time. By hiding the menu from
the place where we show the magnifier means that we can
remove code from the QIOSSelectionRecognizer that used
to do this for one of the cases from before.

Pick-to: 6.0 5.15
Fixes: QTBUG-90743
Change-Id: If2a92f94422c730c2b223129d96f5bc3bf3deeee
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-01 14:50:33 +01:00
Eirik Aavitsland
93243b5d6a Avoid int overflow in gradient drawing
Fixes oss-fuzz 29348

Pick-to: 6.0 5.15
Change-Id: I3568a0a7a7e8d87881f5b052c6c00831b53b3842
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-02-01 14:47:58 +01:00
Robert Loehning
c08ebbeca9 Fix compilation with 32-bit clang
Currently fails with: undefined reference to `__mulodi4'

Change-Id: Iefa321d6fd7cb989dd4a00166ed65e5b7f3ba33f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-01 13:47:13 +00:00
Andreas Buhr
f1cebefd01 Fix compilation of ibase sqldriver plugin, added override
With gcc 10.2, I cannot compile qtbase without this patch.

Pick-to: 6.0 5.15
Change-Id: I5be48947e2301d5befeec397291c0da597f7eb63
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-02-01 14:44:48 +01:00
Timur Pocheptsov
1a0da3ae69 QSsl::TlsKey - provide the interface and implementations
which will become parts of TLS plugins in the future.

Task-number: QTBUG-65922
Change-Id: I4ee3c59c435fc34a9f4dacd3ff0e3cfb44251e23
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-01 14:36:40 +01:00
Alexey Edelev
59252a3a96 Remove the 'corewlan' feature
Remove 'corewlan' feature from the network related configure.json.

The 'bearer' component was removed in the Network module. It was
the only consumer of the 'corewlan' feature. There are no
plans, yet, to use CoreWLAN framework in the future.

Pick-to: 6.0
Fixes: QTBUG-90672
Change-Id: I1afb7b04ea75f8cb09cb570d820d16f54a130cf9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 13:34:53 +00:00
Alexey Edelev
566ba523ad Move static PCRE2 defines to non-system PCRE2 section
Private PCRE2-specific definitions should be only used with the
built-in PCRE2 library.

Ammends 7c69eb8868

Fixes: QTBUG-90556
Change-Id: If47e0b9eaaece290676d6c2b484bb52281aa7c68
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 14:34:46 +01:00
Alexey Edelev
295d4d6955 Remove usage of the definitions that are never defined
The QT_BUILD_QMAKE_BOOTSTRAP and QT_BUILD_QMAKE_LIBRARY definitions
are never defined in the project since migrating to CMake build.

Change-Id: I7108c92387005a2fde6ebdb2d74843e3efc6413e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 14:34:41 +01:00
Edward Welbourne
658b93386e Update double-conversion library to current master
Turned our local diffs into a side-branch in the upstream repo, got
material changes upstreamed (leaving only our #include changes),
rebased it to master, copied back to our version. Upstream has made no
new release since 3.1.5 in 2019 May, but there is substantial change
since then, including acceptance of our upstreaming. Our patches have
been refined in the process of upstreaming.

The list of source files is slightly changed. The double-conversion.*
files are split in two, string-to-double.* and double-to-string.*, but
the old double-conversion.h header is retained, simply pulling in its
two halves. These thus need to be present in the include directory.

Changed the patches/ directory to be in git format-patch form, for
sending or applying to the upstream repo, before copying files into
the qtbase source tree. This should make future upstreaming easier.

Task-number: QTBUG-90214
Change-Id: Id94198f58ef7bdf02af117c35cb9678b5c34ac0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-02-01 14:31:30 +01:00
Giuseppe D'Angelo
784c443ab0 QMatrix4x4: implement operator*(QVector3D/QPoint(F)) in terms of map
Rather than the other way around, in preparation for deprecation.

Change-Id: I001d7617425a24e960871925130c5314c393ea8c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-01 00:23:22 +01:00
Piotr Mikolajczyk
36ddabfa52 Shrink the memory footprint of QLocalSocketPrivate
Member variables have been reordered to reduce the memory
footprint by 8 bytes.

Change-Id: Ib03f916c065861fa317f8802695363fd152e314a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-01 00:23:22 +01:00
Andreas Buhr
a1a2d97e34 Remove QObjectCompatProperty::operator= for safer usage
Introduction of QObjectCompatProperty requires every write to
the property to be examined whether it is OK or should be replaced
by a setValueBypassingBindings/markDirty combination. The existence
of operator= make this difficult as it is easy to miss places where
it is written. By not having operator=, we can help developers
make sure they had a conscious decision about each write to the
property.

Change-Id: Ia61ea4722eb0bab26ce7684b85dd03d710cd1751
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-29 16:06:19 +01:00
Andy Shaw
115bcdb862 Cocoa: When validating menus, account for modal window only if active
When a modal window is WindowModal then it is possible for another top
level window to be active and therefore the menus shown may be valid
for the window. So we can still allow the menu items to be validated in
the context of that window.

Fixes: QTBUG-74088
Pick-to: 6.0 5.15
Change-Id: Ifb9c3fe12654b2972e0e3c368dc093fae1ed4cc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-29 11:55:43 +01:00
Alex Trotsenko
8f9222db3b QEventDispatcherGlib: do not omit active notifiers on source dispatching
It is quite common for a socket notifier to be disabled in a slot
connected to its activated() signal. But the event dispatcher did not
update the position in the list of registered notifiers, which caused
the next notifier to be omitted. Of course, on the next iteration of
the event loop, the omitted notifier would fire again, but this reduced
the scalability of applications that use a large number of sockets.

To solve the problem, we update the current position in the list when
a notifier becomes unregistered.

Change-Id: I6565bf23500d9e38ce84b34784d89d227fa166e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 10:55:42 +00:00
Alex Trotsenko
f9896cb3cd QProcess/Unix: remove dead function
findExitCode() doesn't do anything on Unix.

Change-Id: I3efdc1380a39437c4c029073f3b10ccf7a65e580
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 12:55:42 +02:00
Allan Sandfeld Jensen
f2c3b52c6c Revert "Port QThreadPool to the new property system"
This reverts commit 8f8405e046.

Reason for revert: Appears not entirely thread-safe and caused QTBUG-90705

Change-Id: I390c0b1a555a18e6a095b52010371d017071e26b
Fixes: QTBUG-90705
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-29 10:55:42 +00:00
Christian Ehrlicher
0ca3f1732a QDial: fix painting QDial when the rect has an offset
When the QDial should be painted with an offset, the dial was not draw
correct.

Fixes: QTBUG-89574
Change-Id: I646c3d42fba34e8c603a8f81f363ed827f04d5de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-29 07:26:56 +01:00
Christian Ehrlicher
180c662b07 QHeaderView: Mark the drop section during section move
Currently there is no visual feedback where the section move will end
up. Therefore mark the drop section to show where the dragged section
will be inserted.

Fixes: QTBUG-673
Fixes: QTBUG-1114
Change-Id: I3e45a9a9c0604342bb0286fc7cd4c89c757c28cd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-29 06:26:55 +00:00
Hou Lei
693aa08ddf Specification of pointer usage
Avoid C-style casts when possible.

Change-Id: I8e86eb8c439b456da41d52a5666190330edeeda2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 02:23:46 +00:00