Commit Graph

34727 Commits

Author SHA1 Message Date
Lars Knoll
67f04fa060 Deprecate QVariant::Type uses in QSqlField
Add metaType()/setMetaType() methods to be used instead
of the type() methods taking a QVariant::Type.

Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-15 10:56:33 +02:00
Lars Knoll
8929c0a355 Remove QVariant(int type, void *data, ...) constructor
It was marked internal anyway. Use the constructor taking a
QMetaType instead.

Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-15 10:56:29 +02:00
Alexandru Croitor
af263b003b Android: Be more verbose about which binary is not found
It's unclear that the actual file searched for is different from the
error output. Make it clearer.

Task-number: QTBUG-85399
Change-Id: Ia5eb6d03c42b399604ce452b88408e0e5071d17c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-08-15 08:13:24 +02:00
Lars Knoll
5f552e7b96 Allow constructing a null variant from a meta type
Add a default argument for the data pointer, so one can
construct a null variant of a certain metatype. This
is meant to help replace the QVariant(Type) constructor
that will get deprecated.

Change-Id: If75a1491ffcaa82d28eb5a7efb547da0ef1f2a87
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-14 23:41:42 +02:00
Alexandru Croitor
32121e9882 CMake: Split out some Android functions into a public API file
To fix CMake Qt For Android projects to configure, we need to move
some functions from a private CMake API file only, to a public one.

Add Qt6AndroidMacros.cmake which will be loaded by Qt6Core package.

We'll have to decide how we proceed with Qt5AndroidSupport.cmake,
because that file automatically runs code when included in Qt5, and we
usually don't want to do it.

We'll also have to decide how to handle the define_property() calls
that are still left in the private QtPlatformAndroid.cmake file.

With this fix, Qt example CMake projects that use
add_qt_gui_executable should now be buildable. An APK can be created
with 'ninja apk'.

Unfortunately Qt Creator 4.13 does not currently seem to support
opening and building CMake Qt For Android projects properly.
While the build succeeds after fiddling with the Kit settings, the APK
deploy step fails to run (at least on my machine).

So the simplest way to run the built APK is to open the android-build
dir with Android Studio and launch the example application from there.

Task-number: QTBUG-85399
Change-Id: I77f246331de7a6e9e6d4ba7d973730190138f136
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-14 21:40:28 +02:00
Alexandru Croitor
2e6ca4bbc3 CMake: Fix copying of gradle resources in non-prefix builds
Amends b1f8ca8032.

Task-number: QTBUG-85399
Change-Id: Ibf0d721a7735dabd48e069a6098d1d9338cde660
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-14 18:13:38 +02:00
Allan Sandfeld Jensen
6f0df02d00 Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of
C++17.

Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-14 15:52:58 +02:00
Andy Shaw
9d3a908e9e Doc: Change QPixmap::grabWindow with QScreen::grabWindow
Change-Id: I68df86314cb8c3602d7ddbcf1e4527cf247d5fa1
Pick-to: 5.15
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-08-14 13:17:11 +02:00
Giuseppe D'Angelo
06ffb912ca Drop qunicodechar
It's unused except in the definition of QStringLiteral, where
we can just use char16_t. The static_assert can also go as it's
already checked in qglobal.cpp.

Change-Id: I06e8a87b4dea1582cd84957efca1b8ad0d2e0266
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-14 13:17:11 +02:00
Mårten Nordheim
d40f88e8d2 QDecompressHelper: Introduce zstd support
Also take this opportunity to reshuffle the content-encodings in the
intended ordering since the ordering is used to signify priority.

Task-number: QTBUG-83269
Change-Id: I022eecf1ba03b54dbd9c98a9d63d05fb05fd2124
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-14 13:17:11 +02:00
Edward Welbourne
94b7a4f9b8 QAtomic*: purge deprecated load() and save() methods
Deprecated in 5.14 in favor of loadRelaxed() and storeRelaxed().
Caught one surviving use of load() in the ios platform plugin.

Change-Id: I9518064a948e5d26ccb956490cbb0561bed5d8b5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 10:00:02 +02:00
Edward Welbourne
9ee554ac1d qglobal.h: remove deprecated global functions
Since 5.0 - qMalloc(), qFree(), qRealloc(), qMemCopy(), qMemSet()
Since 5.15 - qsrand(), qrand()

Change-Id: I74fa3d17b05521271c3dc563fc85a5b133289ce3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:59:36 +02:00
Edward Welbourne
ff555d8965 QVariant: remove docs for non-existent deprecated methods
This follows up on commit 3898c022a6
which removed the code but not the methods themselves.

Change-Id: Ia2311921365fdc5fee1104dd3162d6f26e5bb091
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:59:11 +02:00
Edward Welbourne
67ba2a5db8 QObject/Q_OBJECT: remove deprecated old API
Since 5.0, trUtf8(), qFindChild()

Change-Id: I7bc0d125f92faebf24a422c1aac528a3f4687434
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:58:51 +02:00
Edward Welbourne
80602ce2b3 QCoreApplication: purge deprecated API
Since 5.9 flush()
Since 5.6 notifyInternal()
Since 5.0 trUtf8()

Change-Id: I1cc0fc5ebc3d7f2f4809c4494ab2a7486a481b10
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:58:20 +02:00
Edward Welbourne
72205c829b QQueue: purge deprecated API, swap(i, j)
Was deprecated in 5.14 although the relevant annotations won't show up
until 5.15.1.

Change-Id: I5b88bd109b9785d8170c616c619d478969536bbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:57:21 +02:00
Allan Sandfeld Jensen
d4a73d4255 Another round of using noexcept instead of pre-C++11 defines
A few new files were added with old-school defines.

Change-Id: Ieb2c71e094e55102f3f39fb9551823f36863f5f4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-13 19:58:40 +02:00
Frederik Gladhorn
d12afeff40 Set default redirect policy to NoLessSafeRedirectPolicy
Not following redirects is not a feature, but just a hastle for everyone.

The main issue with switching this default is that applications that
actually do manual redirect handling will break in various ways.

FollowRedirectsAttribute was removed as it no longer serves any
purpose beyond duplicating the default value.

[ChangeLog][Network] QNetworkAccessManager now follows redirects by
default with the NoLessSafeRedirectPolicy.
[ChangeLog][Potentially Source-Incompatible Changes]
QNetworkRequest::FollowRedirectsAttribute was removed and has been
superseded by QNetworkRequest::RedirectsPolicyAttribute

Fixes: QTBUG-85901
Change-Id: Ic5b776180a4b84ac4fc895158bb5a66a3c91a042
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:19 +02:00
Mårten Nordheim
09e22c6c32 QNAM: Don't error out if the server doesn't support any ALPN we request
If we ask for HTTP/2 or 1.1 and the server doesn't list either then we
should still try to connect using HTTP/1(.1) just in case, to keep
compatibility.

Task-number: QTBUG-85902
Change-Id: I6ff2e38ac9d767e482a19ee4c81d101be37d3fab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:16 +02:00
Mårten Nordheim
1a8627cf19 QNAM: Don't close the connection due to not having a layer preference
This seems to only be happening when we have a single channel because
otherwise it will try IPv4 in one channel and IPv6 in the second.

Change-Id: I0d513e25fefffeabfc733e895827aa12da335ef9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:14 +02:00
Mårten Nordheim
7e55642c87 QNAM: HTTP/2: Set user-agent for the HTTP proxy's header
The user-agent should be propagated to the proxy as well or else we
get our default one.

Change-Id: Id2283a8f2ade1a32f7fcf3d691be8d380d334b50
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:13 +02:00
Mårten Nordheim
5ecc6eb363 QNAM: Fix proxy auth handling when requesting but not yet changed to h2
In some cases (i.e. with SOCKS) we don't have a HTTP/2 request ready
yet so it would just error out.

Change-Id: I6449de5fb52f5208d5641062c5906c3baff18b77
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:11 +02:00
Andre de la Rocha
c808bd0b60 Windows QPA: Fix omitted Drop event
In some rare cases, when a mouse button was released while the mouse was
static, a drag and drop operation would not be completed until the mouse
was moved. Probably due to a Windows bug, the mouse button state
supplied through the arguments of the IDropSource callbacks, called from
the internal DoDragDrop() loop, would not reflect the actual mouse
button state in this case. This change makes the callback implementation
use the actual mouse button state provided by GetAsyncKeyState().

Fixes: QTBUG-85300
Pick-to: 5.15
Change-Id: I3405bdf7076ddc46415cd274a502434bdc0d2f3f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-08-13 14:47:00 -03:00
Alexandru Croitor
48dbcefe57 CMake: Allow specifying a sysconfdir that's outside the prefix
Also use the value to actually write it into qconfig.cpp so that qmake
reports the right information.

Change-Id: Icc4bf36b0dc6ad75d93ac16f39e5b361c0ce52b4
Fixes: QTBUG-81289
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-13 19:45:33 +02:00
Alex Trotsenko
707d29d5d7 De-inline QIODevice::write(const QByteArray &)
Since QRingBuffer is used as a temporary store for data to be written
to a buffered device, we can implement a "zero-copy" strategy between
the user-space code and QIODevice's internal write buffer. As a first
step, we should have an entry point, where we can implement a possible
solution.

Change-Id: I1c658c13accc98c65a802be943688359cc9f9917
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-13 20:37:50 +03:00
Sona Kurazyan
1df02b5f98 Fix conversions to JSON from QVariant
After reimplementing Qt JSON support on top of CBOR, there were
unintended behavior changes when converting QVariant{, List, Map} to
QJson{Value, Array, List} due to reusing the code for converting
QVariant* types to CBOR types, and from CBOR types to corresponding JSON
types. In particular, conversions from QVariant containing QByteArray to
JSON has been affected: according to RFC 7049, when converting from
CBOR to JSON, raw byte array data must be encoded in base64url when
converting to a JSON string. As a result QVariant* types containing
QByteArray data ended up base64url-encoded when converted to JSON,
instead of converting using QString::fromUtf8() as before.

There were also differences when converting QRegularExpression.

Reverted the behavior changes by adding a flag to internal methods for
converting CBOR to JSON, to distinguish whether the conversion is done
from QVariant* or CBOR types. These methods now will fall back to the old
behavior, if the conversion is done using QJson*::fromVariant*().

Additionally fixed QJsonValue::fromVariant conversion for NaN and
infinities: they should always convert to QJsonValue::Null. This works
correctly when converting from variant to QJsonArray/QJsonObject, but has
been wrong for QJsonValue.

Added more tests to verify the expected behavior.

[ChangeLog][Important Behavior Changes] Restored pre-5.15.0 behavior
when converting from QVariant* to QJson* types. Unforeseen consequences
of changes in 5.15.0 caused QByteArray data to be base64url-encoded; the
handling of QRegularExpression was also unintentionally changed. These
conversions are now reverted to the prior behavior. Additionally fixed
QJsonValue::fromVariant conversions for NaN and infinities: they should
always convert to QJsonValue::Null.

Fixes: QTBUG-84739
Change-Id: Iaee667d00e5363906eedbb67948b7b39c9d0bc78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-13 19:36:58 +02:00
Lars Knoll
048debe8f9 Restrict QVariant::isNull() behavior
isNull() would forward to the contained type and check that type's
isNull() method for some of the builtin types. Remove that behavior
and only return true in isNull(), if the variant is invalid, doesn't
contain data or contains a null pointer.

In addition, implement more consistent behavior when constructing
a QVariant using the internal API taking a copy from a void *.
isNull() should return true in both cases. This mainly changes behavior
for some corner cases and when using our internal API.

[ChangeLog][Important Behavior Changes] QVariant::isNull()
no longer returns true when the variant contains an object of some
type with an isNull() method, that returns true for the object;
QVariant::isNull() now only returns true when the variant contains
no object or a null pointer.

Change-Id: I3125041c4f8f8618a04aa375aa0a56b19c02dcf5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-13 08:48:32 +02:00
Lars Knoll
4a69cd7f72 Restrict comparison of variants
Comparing two variants will not try to convert the types
of the variant anymore. Exceptions are when both types are
numeric types or one type is numeric and the other one a
QString. The exceptions are there to keep compatibility with
C++ and to not completely break QSettings (which needs automatic
conversions from QString to numeric types).

[ChangeLog][Important Behavior Changes] Comparing two
variants in Qt 6 will not try attempt any type conversions before
comparing the variants anymore. Instead variants of different type
will not compare equal, with two exceptions: If both types are numeric
types they will get compared according to C++ type promotion rules. If
one type is a QString and the other type a numeric type, a conversion
from the string to the numeric tpye will be attempted.

Fixes: QTBUG-84636
Change-Id: I0cdd0b7259a525a41679fb6761f1e37e1d5b257f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-13 08:48:19 +02:00
Lars Knoll
50c96c17b6 Use the new support for comparisons in QMetaType for QVariant
Remove the compare method in the QVariant::Handler struct. Rely
on the generic support provided by QMetaType instead.

[ChangeLog][Important Behavior Changes][QVariant] QVariant will now use builtin support in
QMetaType to compare its content. This implies a behavioral change
for some graphical types like QPixmap, QImage and QIcon that will
never compare equal in Qt 6 (as they do not have a comparison
operator).

Change-Id: I30a6e7116c89124d11ed9052537cecc23f78116e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-08-13 08:48:03 +02:00
Thorbjørn Lund Martsum
2002158a13 QHeaderView: create virutal initStyleOptionForIndex function
The paintSection was very long and thus difficult to override.
This change makes it far more easy to do custom section painting
or styling in the headerview.

[ChangeLog][QtWidgets][QHeaderView] Introduced QHeaderView::initStyleOptionForIndex
to make it easier to reimplement custom styling and painting of sections.

Change-Id: I99e5fe8d70485a4650ab33e3d3eb4a46d6468326
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-08-13 06:06:51 +02:00
Thiago Macieira
99ce02f692 QCborValue: add support for QCOMPARE string output
Change-Id: Ibdc95e9af7bd456a94ecfffd16066c47ea9766d0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-08-12 21:05:06 -07:00
Volker Hilsheimer
e635568985 QFileSystemModel: use the QFileInfo from the model as much as possible
If the file system already stores a QFileInfo, then it will have the
information cached, which avoids costly roundtrips to the file system.

Task-number: QTBUG-41373
Change-Id: I830a39fe0e20ebf07abde4438a87f7572f608d66
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-12 23:06:36 +02:00
Volker Hilsheimer
99aefbb4c0 QFileDialog: fix warning message when navigating to "My Computer"
The mapping between model indexes, QUrl, and QDir in QFileDialog
resulted in QFileSystemEngine methods being called on empty
strings, which results in a warning from QFileSystemEngine.

When QFileDialog gets an empty string as the new path, then we
know that it's the "My Computer" location, so handle that case
separately. This makes sure we don't call any QFileSystemEngine
methods with an empty string.

Change-Id: I421d3d76b053379c216c41a72fb783d1bad176cb
Pick-to: 5.15
Fixes: QTBUG-67866
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-08-12 23:06:36 +02:00
Volker Hilsheimer
5382bf4220 QFileDialog: reduce number of times a file is stat'ed
When opening a QFileDialog with an initial directory that lives on a
disconnected network drive, repeatedly testing that directory consumes
a significant amount of time during which the UI is blocked.

To reduce the amount of file accesses, refactor the initialization code
to allow sharing of a QFileInfo for the default case of operating on a
local and absolute file system. This reduces the amount of stat calls
significantly during startup time, and in case of a disconnected
network shaves of 10-15 seconds of blocked UI, if Windows has already
noticed that the file system is disconnected.

Pick-to: 5.15
Fixes: QTBUG-6039
Change-Id: Ie082e447db214033291455bef2087cd05f366806
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-08-12 23:06:36 +02:00
Cristian Adam
6b488d8950 Configure.json: Do not link to pthread on Android on feature testing
pthread has been removed from the NDK and the cxx11_feature detection
fails.

Fixes: QTBUG-72330
Change-Id: I22a97814b7e95011ad3944327f02343348c72b91
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-12 16:12:48 +02:00
Konstantin Ritt
95946222e6 QtFontStyle: Add missing const to non-mutable operators
and once I touch these lines anyways, either add noexcept ;)
Fixes-up 8bdbb7f226

Change-Id: Ibfaedcff82c041293220408ab7ae739b3cbd2a4f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-08-12 16:13:15 +03:00
Alexandru Croitor
bc0f5f5d1a CMake: Expose public info about whether Qt is a shared lib build
We expose it in the private QtBuildInternals package, but we need it
also as public information for consumption in qt_import_qml_plugins()
to decide whether it should do anything.

Change-Id: If135ae596b4edaf8e2c458f6a2518b968c6d01c4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-12 14:20:44 +02:00
Robert Loehning
3e3fdbe831 QXmlStreamReader: Don't resize readBuffer to a size it already has
Resizing it to 0 will cause it to allocate memory. This will then
cause append() to copy the data from the other string instead of
using copy on write.

Task-number: oss-fuzz-24347
Pick-to: 5.12 5.15
Change-Id: I581bd109f9b973e1c70b7b41b1f610a2ad5725b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-12 14:18:30 +02:00
Edward Welbourne
ca034e4e50 Inline two macros in the unicode tables
They were only used by one function each, in unicodetables.cpp, so
don't need to be macros.

Change-Id: I3e7f9f661568862d0a0d265bb8f657a8e0782b13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-12 13:47:56 +02:00
Kai Koehne
e6ac26ea60 Windows: Remove method not existing in base class
Change-Id: Ifd016eabb07849fb3f310593ebe5301d3a9b09c1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-08-12 12:52:55 +02:00
Mårten Nordheim
27b1d1a1b2 HTTP/2: Don't handle Remote Disconnected if we haven't switched yet
In that case we haven't created the h2 handler yet, so it will
crash when trying to access various members.

Task-number: QTBUG-85902
Change-Id: Id0699ff06ef67748a16622703f731db0b0867771
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-12 11:38:00 +02:00
Samuli Piippo
7448884bb4 QNX: fix build
Remove unused argument and use default contructor for the flags.

Change-Id: I09d319bc58199ed713333055a2fdd519c249f831
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2020-08-12 12:17:16 +03:00
Samuli Piippo
b92ea7db49 QNX: register mouse input device
Use the new QWSI APIs that take a registered input device.

Task-number: QTBUG-85852
Change-Id: Iefb8239a60ff819172ba64f35f120cdc6975257f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-08-12 12:17:10 +03:00
Ulf Hermann
3e25d09b08 QDecompressHelper: Change order of encodings
Before the introduction of QDecompressHelper gzip was preferred over
deflate. The change seems to be accidental. Amends commit
7b76379a89.

Change-Id: I70f33d551912465d63f49ea3db1ac3575d19a92d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-12 08:27:09 +00:00
Eirik Aavitsland
4db44bc32f Allow smooth curve stroking for very wide lines
The earlier limit set on the curve threshold turned out to be too
strict, leading to visibly bad rendering in reasonable use cases.
Ref. 5322998a0b

As a drive-by, add a missing fixed-to-real conversion. (This is a
no-op in a default build, where qfixed==qreal.)

Fixes: QTBUG-85193
Pick-to: 5.15 5.12
Change-Id: I7cc3543d7aa4e90643b275686372400879decef2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-08-12 07:10:23 +02:00
Paul Wicking
7bd965258e Doc: Remove outdated documentation
We don't have this class in Qt anymore.
Drop the related snippet as well.

Pick-to: 5.15
Change-Id: I5149e2f9da483b9ad678a6d414a278cb7e107f10
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-08-12 05:04:56 +02:00
Andy Shaw
295e98915d Introduce maximumIdentifierLength to return database limits for names
Since Interbase/Firebird has a limit for column and table names then
this function can be used by QSqlRelationalTableModel to make sure that
the aliases created are within that limit.

Change-Id: I0cb1c65b34befcb3690ccad3f081556dd2691344
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-11 22:13:13 +02:00
Thiago Macieira
e790af0e0a QJsonDocument: fix comparison of valid vs default
[ChangeLog][QtCore][QJsonDocument] Fixed a bug that caused
QJsonDocument's equality operator to crash if one of the operands was
default-constructed and the other wasn't.

Pick-to: 5.15
Fixes: QTBUG-85969
Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-11 13:00:47 -07:00
Edward Welbourne
d5ef011b73 Document how keyboard tracking can prevent use of a date/time editor
This follows up on commit 580e9eedf783ccbdcb67baa3d1a9dcdd53922f86; if
the allowed range is narrower than some time interval whose end it
straddles, users can only access the later part of the range if
keyboard tracking is disabled.

Pick-to: 5.15
Task-number: QTBUG-65
Change-Id: Ie8882bd65bda603133abaa82ad83eb1cdd91f175
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-08-11 21:46:25 +02:00
Alex Trotsenko
8f53d66e3e Introduce QIODevice::skipData()
QIODevice::skip() called a virtual QIODevicePrivate::skip() to
implement an efficient skipping on I/O devices for the internal
subclasses. The user subclasses cannot inherit QIODevicePrivate, so
this functionality was not externally accessible.

This patch replaces QIODevicePrivate::skip() with a virtual protected
QIODevice::skipData(). While the basic implementation simply discards
the data by reading into a dummy buffer, users can reimplement this
function to improve the performance in their subclasses.

[ChangeLog][QtCore][QIODevice] Added virtual protected skipData().
Now, subclasses can implement device-specific skipping of data.

Change-Id: I9522f7f7ab9d03ac06e972a525f8ec2fa909a617
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-11 17:21:45 +03:00
Laszlo Agocs
a99cee1c7b Remove old CBOR-based format from QShader
We only support version 4 and 5 in Qt 6.0. 1 and 2 are already gone
(due to being based on binary JSON), now we remove 3 as well.

Task-number: QTBUG-81346
Change-Id: I3627dcc0587f1e36f11e93edf7172889e911d64e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-11 13:45:09 +02:00
Edward Welbourne
72d14fe32f Fix handling of last second in 1969
Due to a limitation of mktime(), we would have declared it invalid.
Tidied up qt_mktime() slightly in the process.

Change-Id: I25469e314afee6e0394e564bc69a98883005d4ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-11 11:20:43 +02:00
Edward Welbourne
1f96709fdb Tidy up use of local variables and add an assertion
Petty tidy-up, narrowing the scopes and asserting that localtime_r()'s
return, when non-null, is the pointer we gave it.

Change-Id: I6c0959524260028ca9b234f6d33eae78f27c1412
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-11 11:19:44 +02:00
Morten Johan Sørvig
1b4a5af63f wasm: detect canvas resize using ResizeObserver API
The ResizeObserver API is now available on the major
desktop browsers (Safari, Chrome, Firefox), and can
be used to handle canvas resize.

(Previously, we got a callback on viewport resize
only)

Pick-to: 5.15
Change-Id: I8737285416bef70641f90da793c85efcb24f3623
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-08-11 06:43:18 +00:00
Giuseppe D'Angelo
d7205a7cae Add degree<->radians conversions for long double and integral types
For long double: they're just missing, so add them for completeness.

For integral types: follow the advice of C11's trigonometric
functions; first convert the angle to double, then do the actual
conversion. This is offered only for the degree->radians conversions,
as someone may legitimately want to call e.g. qDegreesToRadians(90).

On the other hand, it seems extremely unlikely that someone may
want to do a radians->degree conversion starting from integral
datatypes, so I'm not adding it for the moment being (instead,
I'm leaving a note).

[ChangeLog][QtCore][QtMath] qDegreesToRadians now also accepts
long double and integral types. A value of integral type will be
casted to double before the conversion to radians.

[ChangeLog][QtCore][QtMath] qRadiansToDegrees now also accepts
long double.

Change-Id: Ib1576be5193ae09bb6cb4a70d7a31702955df2c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-11 04:24:12 +02:00
Lorn Potter
20db9a0d7f wasm: fix natural scrolling on mac
Pick-to: 5.15
Change-Id: Icc41b2c54a2e8d0da11ba5068bdde1a0c20686e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-08-11 10:26:30 +10:00
Andy Shaw
6379b697a6 Interbase: Don't call toUpper() on the names as they are escaped
Interbase is case sensitive when tables/fields are escaped so we should
ensure that we pass the value as is.

Pick-to: 5.15
Change-Id: Ia6c4edc9c1e675bd95913c85d47bf22c418d2113
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-08-10 18:51:11 +00:00
Giuseppe D'Angelo
7406a8b45a QMultiMap: add constructors from QMap
We can provide those. They don't lose information, do not have the
problem we face at offering ranged constructors (namely the order of
duplicate keys), and have a distinct advantage over ranged constructors:
a non-shared rvalue QMap can be "upgraded" to a QMultiMap without
allocating memory for the multimap.

Change-Id: Ic23c83927c05a210bc1f0050006c9f26365d3916
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-10 16:35:59 +02:00
Giuseppe D'Angelo
046ad5a442 Improve QMultiMap docs a bit
Change-Id: I170dc5de15dac61620aaed94f32226c158092dce
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-10 16:35:53 +02:00
Volker Hilsheimer
3657405fe7 QFileInfo: make stat method public
Forcing the reading of all file system attributes is generally useful in
multi-threaded applications, and has at least one more use case in Qt.

Using it in QFileSystemWatcher on Windows avoids several file system
accesses.

Task-number: QTBUG-41373
Change-Id: Ib3c3243fd083142393ad46d62f49cb4f7bfda17c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-10 13:17:01 +02:00
Michael Weghorn
3e09c28101 Filechooser portal: Implement "current_filter"
This adds supports for setting and retrieving the selected
MIME and name filter for 'QXdgDesktopPortalFileDialog'.

For preselecting a filter [1]:

> current_filter (sa(us))
>
>     Request that this filter be set by default at dialog creation. If
>     the filters list is nonempty, it should match a filter in the list
>     to set the default filter from the list. Alternatively, it may be
>     specified when the list is empty to apply the filter
>     unconditionally.

The "current_filter" return value was added in xdg-desktop-portal
commit [2].

[1] https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileChooser
[2] 35fca7fae8

Fixes: QTBUG-85658
Pick-to: 5.15
Change-Id: I8651c1a8942dfd358895b7826730729c4d22e680
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-10 12:33:10 +02:00
Alexandru Croitor
ecc72bc63d CMake: pro2cmake: Specify library versions for 3rd party libs part 2
Embed package versions into the qt_find_package calls for various
Linux specific packages.

Task-number: QTBUG-82917
Change-Id: I5d1cb623f81932dfae4658b8a3a89eedb71ea3af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-10 11:56:54 +02:00
Alexandru Croitor
3c52f8af9d CMake: pro2cmake: Specify library versions for 3rd party libraries
If certain 3rd party libraries have a version that's not suitable for
Qt, the configure summary should say so, rather than use them and fail
at build time.

With the current situation, we have to duplicate the version
information from the configure.json files in helper.py, by assigning
the version number as an extra find_package variable.

Rerunning configurejson2cmake then embeds this version info into the
qt_find_package calls in configure.cmake.

Some of the Find modules are rewritten to take the  specified version
into account when looking for the libraries.
This involves moving around the code for creating a target, after
calling find_package_handle_standard_args() so we know if a good
enough version was found.

Task-number: QTBUG-82917
Change-Id: I139748d8090e0630cda413362760034dc3483e11
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-10 11:56:54 +02:00
Giuseppe D'Angelo
7e7796fb00 QLayout: minor tidy in the docs
Change-Id: Ifc2aa62a9c9480c85cc36f60941411e920066db8
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-08-10 11:56:54 +02:00
Kai Koehne
177f040c6c Fix build with mingw gcc 9 and -Wsuggest-override
Change-Id: I780b0761a7f6b19022116b738efa7aca1378b715
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-08-10 11:56:54 +02:00
Allan Sandfeld Jensen
7c861a36f9 Fix compilation in C++20 mode
The comparisons with pointer were ambiguous as the comparisons could
be done between iterators or pointers.

Change-Id: I0484946931502d04bd63519fcd6e886c732758d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-08 19:09:09 +02:00
Allan Sandfeld Jensen
cabc248667 Avoid UB in 64bit compositions
Multiplying 65535 by 65535 would exceed the precision of an int, so
use 65535U instead.

Change-Id: I066e552fb7db03ce867bcbfbd0b555ac98ca4bbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-08 19:08:07 +02:00
Robert Loehning
7fa5fdae5c QBezier: Don't try calculating a unit vector when length is null
It's undefined and causes a division by zero.

Fixes: oss-fuzz-24273
Pick-to: 5.12 5.15
Change-Id: I3d34d5c43cccff9255abaf87af265ddea3fe6d95
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-08-07 16:21:16 +00:00
Edward Welbourne
315257eabe QSettings: purge deprecated API
Since 5.13: setSystemIniPath(), setUserIniPath()

Change-Id: Ie02fa96e652c10ac1a276016bd556474030fe0f5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:45:31 +02:00
Edward Welbourne
563a8d628f QStandardPaths: purge deprecated API
Since 5.2: enableTestMode(bool)

Change-Id: Ibfd5958b6383491d9297d3f0e815ad4679fb57f5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:45:18 +02:00
Edward Welbourne
8b7bde6c49 QFileInfo: inline the file-time methods
As instructed in a // ### Qt6 comment
Added missing #include for QDateTime.

Change-Id: Ic1f9e6ec42ecae07d037b84943444785847bdf98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:45:03 +02:00
Edward Welbourne
fe6a1d34dc QFileInfo: purge deprecated API
Since 5.10: created()
Since 5.13: readLink()

Change-Id: I9722f81750dd92315a67a1c38df41a95ae63e0db
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:51 +02:00
Edward Welbourne
4ef723c82d QFile: purge deprecated API
Since 5.0: set{En,De}codingFunction()
Since 5.13: readLink()

Change-Id: I5386d0accf2724d84550c9bfdbbe914937194be2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:40 +02:00
Edward Welbourne
f369be93a1 Purge deprecated API from QDir
Assignment from QString and addResourceSearchPath(), both deprecated
since 5.13.

Change-Id: I25f08ffadc7b9dfd7895a9199255ca5f1948bd47
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-08-07 17:44:26 +02:00
Edward Welbourne
5a682b04ce Purge QResource of some deprecated API
Removed isCompressed(), deprecated since 5.15, and (since 5.13)
addSearchPath() and searchPath().

Change-Id: I4b6fb8077c02bbe322334e474eaf0a2a7caf0004
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:13 +02:00
Edward Welbourne
74a35a509c QQueue: clean up 5.14's deprecation
Follows up on commit 9dc1edb314, giving
the relevant advice on what to use instead and protecting with the
appropriate version-check deprecation macro.

Pick-to: 5.15
Change-Id: I4191493e6c43448c4390bf22be1571611b172950
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:43:48 +02:00
Edward Welbourne
a450f331fc QSharedData: remove #include relating to deprecation
The header pulled in qhash.h for no readily apparent reason.
It did so subject to deprecation #if-ery, so rip it out.

Change-Id: I00529dd2b2de11d9a997b6fa766901f5b2f4b254
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:37:20 +02:00
Giuseppe D'Angelo
3f6afac6b1 QPolygon: streamline constructors and special member functions
Employ RO0; inherit the constructors from the base class; and
do some code tidies as a drive by.

The inherited constructors bring in goodies like initializer_list
support.

Change-Id: Ia00a3f9b0ccbf182bf837bc65ba2305110c8dc60
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 15:01:26 +02:00
Lars Knoll
096e268764 Avoid UB in moc generated code
Introduce a Q_OFFSETOF() macro that uses the optional support of
offsetof() for non standard layout types and disables the
corresponding compiler warnings. All our supported compilers
support offsetof() on non standard layout types.

Use the macro to do the offset calculations required in moc
generated code to replace a manual offset calculation that
was dereferencing a null pointer.

Change-Id: I4aab3af3c8bbaa90372f2234aa1cf8399d023c22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-07 13:35:45 +02:00
Paul Lemire
3f64d77003 rhi: QRhiGles2 fix leak BlitFromRenderbuffer
Leaked FBO otherwise lead to massive runtime memory consumption increases.

Change-Id: Ic8ffad4917c11294e6c83cdae0b36114d661b251
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-07 13:02:35 +02:00
Andy Shaw
ac17e62f65 Android: Add support for travesing directories and accessing files
This enables QDir and QFileInfo/QFile to work with entries found from
a entryList() as it will obtain the permission for these files correctly
when it is encountered.

Due to what seems to be a quirk in the Android API, we cache whenever we
come across a known directory to save time later on for checking if it
is a directory. All uris accessed where we get permissions for are
cached so we get the right URI for that given content url as some are
granted via the Intent.

Fixes: QTBUG-85538
Fixes: QTBUG-83041
Fixes: QTBUG-76886
Pick-to: 5.15
Change-Id: I685b3c60804812a0e4b85fbdbb4ec5efaa09420c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-08-07 12:04:57 +02:00
Tor Arne Vestbø
b4f6fdf575 macOS: Handle platform window destroy and create in backingstore
We observe changes to the NSWindow to pick up color space changes,
so we need to track when the platform window is destroyed and created
to match our observer with the recreated NSWindow.

This does not handle the fact that we're internally recreating the
NSWindow if certain window flag changes requires so, without letting
clients know via surface events.

Task-number: QTBUG-85915
Pick-to: 5.15
Change-Id: I7a7d728c742def79adebaadc985cedd86ea0d581
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-07 12:01:22 +02:00
Tor Arne Vestbø
abb985a403 macOS: Fix crash when re-using backingstore for re-created QWindow
The observer we add for the NSWindow of the backingstore window
will not be valid once that window is destroyed, but we may get
last minute notifications for it still, in which case our platform
window is gone.

This patch fixes the immediate crash, but reveals a more fundamental
problem of assuming the platform window that's alive during construction
is the one that will always be used with the backingstore. This is not
the case when for example QtWidgets opens a combo box, and reuses the
backingstore for the widget each time the combobox popup is shown.

Fixes: QTBUG-85915
Pick-to: 5.15
Pick-to: 5.12
Change-Id: Ia66a45d003882602ac29476aabf2d58b0ac33c1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-07 12:01:22 +02:00
Assam Boudjelthia
5735a14c2b Android: fix NoSuchMethodException exception in QtActivity.java
This amends the parent change but intended only for dev and not
to be picked for 5.15.

Change-Id: If7a2d81045c0625f19554eaf6b5cf69e72d42384
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-08-07 10:01:21 +00:00
Giuseppe D'Angelo
9edfb7a1b5 QMap/QMultiMap: use =default for their default constructors
Change-Id: I48e5bd8367fc6040128a50cd08c803310d3a4507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-07 02:05:46 +02:00
Thiago Macieira
ef8fe74324 Add x86 vector implementation of UTF-8 comparison to UTF-16
Change-Id: Ied637aece2a7427b8a2dfffd161181f75b738532
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-06 15:07:36 -07:00
Mårten Nordheim
ad1a5bf63f QDecompressHelper: Add brotli support
Task-number: QTBUG-83269
Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-06 20:56:42 +02:00
Lars Schmertmann
af1544bda2 Mark QSslError(SslError error) as explicit
Currently it is possible to compare a QSslError with a
QSslError::SslError because QSslError has an implicit
constructor. But the comparison often fails because
a QSslError received from the system contains a
certificate.

[ChangeLog][QtNetwork][QSslError] The constructor
QSslError(QSslError::SslError error) is now explicit.

Change-Id: I36cc5895245d3b43ab4b8d65a9635893d6b0e6a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-06 19:49:02 +02:00
Giuseppe D'Angelo
3938d93222 QCalendar: actually remember if the registry has been populated
The "populated" variable is otherwise never written into.

Change-Id: I979411a19927dc4e7e09c6c36edfb2308f519596
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-06 19:33:28 +02:00
Allan Sandfeld Jensen
9a900dfb07 Update qgrayraster.c
In particular switching the SUBPIXELS macro with FRACT makes the logic
valid for all 24dot8 fixed point values.

Change-Id: I4e58df94f8cf3c557f670c5d3088942e9b8efa6d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-08-06 19:15:39 +02:00
Alexandru Croitor
92ee9bd6b8 CMake: Properly handle CONFIG += thread aka Threads::Threads
mkspecs/features/qt.prf adds a dependency on the system threading
library if the Qt Core thread feature is enabled. Because qt.prf is
loaded by any public or internal Qt project, it's essentially a public
dependency for any Qt consumer.

To mimic that in CMake, we check if the thread feature is enabled, and
and set the Threads::Threads library as a dependency of Qt6::Platform,
which is a public target used by all Qt modules and plugins and Qt
consumers.

We also need to create a Qt6Dependencies.cmake file so we
find_package(Threads) every time find_package(Qt6) is called.

For the .prl files to be usable, we have to filter out some
CMake implementation specific directory separator tokens
'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call
target_link_libraries() with a target created in a different scope
(I think).

As a result of this change, we shouldn't have to hardcode
Threads::Threads in other projects, because it's now a global public
dependency.

Task-number: QTBUG-85801
Task-number: QTBUG-85877
Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-06 19:15:39 +02:00
Giuseppe D'Angelo
bd2bcd4e1d QMultiMap: add range erase
Also remove duplication by centralizing the main code for
erase(), and implement erase(pos) in terms of erase(first, last).

Change-Id: Ie0272ebac92fd7da48c31f9d68e69a2faa583bbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-06 19:15:39 +02:00
Giuseppe D'Angelo
4fc539bd84 QMap: fix insert() rvalue overloads
Receiving an rvalue still requires to check whether the parameter
is detached, otherwise we can't steal its backing std::map.

Change-Id: Ie88dbf39fd777112ad7bb20a46d5c2d65be8eb3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-06 19:15:39 +02:00
Giuseppe D'Angelo
14090760a8 Long Live QMap as a refcounted std::map!
... and QMultiMap as std::multimap.

Just use the implementation from the STL; we can't really claim that
our code is much better than STL's, or does things any differently
(de facto they're both red-black trees).

Decouple QMultiMap from QMap, by making it NOT inherit from
QMap any longer. This completes the deprecation started in 5.15:
QMap now does not store duplicated keys any more.

Something to establish is where to put the
QExplictlySharedDataPointer replcement that is in there as an
ad-hoc solution. There's a number of patches in-flight by Marc
that try to introduce the same (or very similar) functionality.

Miscellanea changes to the Q(Multi)Map code itself:

* consistently use size_type instead of int;
* pass iterators by value;
* drop QT_STRICT_ITERATORS;
* iterators implictly convert to const_iterators, and APIs
  take const_iterators;
* iterators are just bidirectional and not random access;
* added noexcept where it makes sense;
* "inline" dropped (churn);
* qMapLessThanKey dropped (undocumented, 0 hits in Qt, 1 hit in KDE);
* operator== on Q(Multi)Map requires operator== on the key type
  (we're checking for equality, not equivalence!).

Very few breakages occur in qtbase.

[ChangeLog][Potentially Source-Incompatible Changes] QMap does not
support multiple equivalent keys any more. Any related functionality
has been removed from QMap, following the deprecation that happened
in Qt 5.15. Use QMultiMap for this use case.

[ChangeLog][Potentially Source-Incompatible Changes] QMap and
QMultiMap iterators random-access API have been removed. Note that
the iterators have always been just bidirectional; moving
an iterator by N positions can still be achieved using std::next
or std::advance, at the same cost as before (O(N)).

[ChangeLog][Potentially Source-Incompatible Changes] QMultiMap does
not inherit from QMap any more. Amongst other things, this means
that iterators on a QMultiMap now belong to the QMultiMap class
(and not to the QMap class); new Java iterators have been added.

Change-Id: I5a0fe9b020f92c21b37065a1defff783b5d2b7a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-06 19:15:39 +02:00
Eirik Aavitsland
7d27316d9f Make clang-format ignore formatting of third party code
Pick-to: 5.15 5.12
Change-Id: I865f86a1f9967971c4e525e634279a26ce11f688
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-08-06 13:35:30 +02:00
Eirik Aavitsland
6f909a5178 Avoid potential ub in corrupt bmp file
biHeight may be int_min, in which case qAbs<int>() will not work.

Fixes: oss-fuzz-22997
Pick-to: 5.15 5.12
Change-Id: Ic07d5aa0b4e4f2b6395e1a12d742e31b5282fdfc
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-06 13:35:12 +02:00
Eirik Aavitsland
e22c0368d8 Update bundled libjpeg-turbo to version 2.0.5
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.5

Pick-to: 5.15 5.12
Change-Id: I9d4c403fbc998243c32d1bf1f1fbaf53270ffb9c
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-08-06 13:34:53 +02:00
Shawn Rutledge
a95d4f68ee Add qt.pointer.grab logging in QEventPoint
Add the logging category qt.pointer.grab, which generalizes the
qt.quick.pointer.grab category in Qt 5 (and is almost always needed
for troubleshooting Qt Quick pointer-handling bugs).

Change-Id: I10b4f43aa60e8717d92ac43384d8fdeefd41d836
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-06 12:53:37 +02:00
Giuseppe D'Angelo
6d9ec41f6f Mac: (temporarily?) drop support for QMultiMap in QSettings
In preparation for the QMap/QMultiMap split. The previous code
had a workaround for storing multimaps, because the CF classes
actually don't support it: build a dictionary from one key
to a _list_ of values. Stop doing that.

In principle, if QMultiMap support does get added to QVariant
(which it probably should), then a similar workaround could be
readded for QMultiMap support.

[ChangeLog][Important Behavior Changes][QSettings] On Apple platforms,
when using the native format, QSettings is no longer able to handle
QVariantMap values which are actually multimaps. Since the native storage
does not actually support multimaps, QSettings used to flatten and
unflatten the maps. However, with QMap being changed to no longer
allow for equivalent keys, flattening when writing does not make
sense any more (there cannot be equivalent keys, because QMap in Qt 6
is a single-key map). Reading existing settings is supported by having
a key in the map mapping to a QVariantList of values.
Support for QMultiMap may be added back to QVariant and QSettings in a
future version of Qt.

Change-Id: Iaa9535100fe5ef55693f22a2068454a84180b4a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-06 10:14:26 +00:00
Eskil Abrahamsen Blomfeldt
76068d0114 Make QFontDatabase member functions static
QFontDatabase is a singleton and all instances would share
a single, mutex-protected global data pointer. But some functions
were implemented as non-static functions. This caused a lot
of code on the form

	QFontDatabase().families(...)

since there was no static access. Other functions were implemented
as static.

To consolidate, we make all functions static. This should be
source-compatible, but not binary compatible.

[ChangeLog][QtGui][Fonts] Some functions in QFontDatabase were in
principle static, but previously not implemented as such. All
member functions have now been made static, so that constructing
objects of QFontDatabase is no longer necessary to access certain
functionality.

Fixes: QTBUG-83284
Change-Id: Ifd8c15016281c71f631b53387402c942cd9c43f6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-08-06 11:43:24 +02:00
Morten Johan Sørvig
b7a1bd3064 macOS: Make getColor() return generic RGB components
Discard the color space and return the selected RGB/CMYK
color components, without any color space conversion.

This enables predictable color handling as long as you
stay on a single display. All color triplets are display
RGB: drawing the QColor returned by getColor() will
reproduce the selected color on-screen.

(Predictable color across multiple displays require
color management, which is out of scope here).

Fixes: QTBUG-84124
Pick-to: 5.15
Change-Id: I43d8dc15d07635fabdd0662c84f7c0b5ac40b7ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-06 08:34:12 +00:00
Shawn Rutledge
6d6ed64d6c Add QPointerEvent::is[Press|Update|Release]Event accessors
QQuickPointerEvent had them, so despite how trivial they look,
it's very convenient to keep using them in QQuickWindow rather than
duplicating these kinds of checks in various places, and for multiple
event types too.

Change-Id: I32ad8110fd2361e69de50a679ddbdb2a2db7ecee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-06 10:23:56 +02:00
Shawn Rutledge
b9873b7dde Add QEventPoint::pressTimestamp() and priv setPressTimestamp()
There was no good reason for QEventPoint::pressTimestamp() to be
missing.  The case for QEventPoint::timestamp() is a bit dubious
because it's redundant with QInputEvent::timestamp(); but for now,
we keep m_timestamp, in anticipation that Qt Quick may need to keep
copies of eventpoints between events, thus they need to avoid depending
on their shorter-lived parent events too much.

Change-Id: Iec38acfdfaa2afb3dc77d5cd1b95baa8d301c0fd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-06 10:23:17 +02:00
Thiago Macieira
3caeb0187d qustrlen: Add #warnings to explain how to deal with GCC 7.x's ASan
The build breaks by disabling ASan in this function because it also
removes its ability to emit SSE2 code. That's clearly broken because all
x86_64 can use SSE2. So this adds #warnings so people are told how to
choose their solution.

Clang doesn't currently define __SANITIZE_ADDRESS__ but I added a
conditional just in case some future version does.

Fixes: QTBUG-84856
Pick-to: 5.15
Change-Id: I552d244076a447ab92d7fffd1617875fdd8dbe62
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-08-05 21:51:24 -07:00
Thiago Macieira
274e07a339 Optimize non-vectorized UTF-8 to UTF-16 comparison to US-ASCII
This allows us to skip the surrogate pair decoding too, since it can't
match anyway.

Change-Id: Ied637aece2a7427b8a2dfffd16118183e5d76794
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-05 21:51:24 -07:00
Thiago Macieira
45838673df Implement UTF-16 to UTF-8 case-insensitive compare and make public
Change-Id: Ied637aece2a7427b8a2dfffd16116cf3645c6359
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-05 21:51:24 -07:00
Thiago Macieira
9422b5ebc3 QtPrivate::isLatin1: fix SSE2 non-SSE4.1 code
The implementation was broken. The "high" in PUNPCKHBW's "unpack high
data" means the high 64-bit of the 128-bit, not the high byte of a 16-
bit word. This never worked. It always passed for me because I don't
build non-SSE4.2 code (too old, no longer relevant).

So just use the working version of simdTestMask.

Pick-to: 5.15 5.12
Change-Id: I35a1b4d0a19a43149daefffd16284542f0de3fa3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-08-05 21:51:24 -07:00
Thiago Macieira
60aa0d0868 Allow use of charXX_t in QUtf8Functions
Even added an internal char8_t type if the compiler doesn't have one.

Change-Id: Ied637aece2a7427b8a2dfffd1611813c345d10ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-05 21:51:24 -07:00
Thiago Macieira
9f4c9529f6 MSVC: remove the extern template
The problem was that QtCore exported those classes deriving from
containers, which caused applications to try and import those same
functions from QtCore, depending on whether they saw the #include or
not.

Now we don't need the hack anymore.

Change-Id: I0a103569c81b4711a649fffd14ec9282454a1fdc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-05 21:51:24 -07:00
Liang Qi
e80767d1fc xcb: avoid a usage of invalid reply in qxcbdrag
Fixes: QTBUG-83446
Pick-to: 5.15
Change-Id: I1f148c611dcab6cad951ddd934072933fef75452
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-06 06:51:24 +02:00
Mårten Nordheim
7b76379a89 Make use of QDecompressHelper for HTTP downloads
Changes are not too big for now. Just replaces use of the previous
calls to the zlib decompression function. And initialize
QDecompressHelper when we know the content-encoding.

Task-number: QTBUG-83269
Change-Id: I41358feaef2e7ac5f48f14e3f95ec094e0c110b7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-05 17:19:10 +02:00
Mårten Nordheim
bbb3619a13 QAuth.: Reset the nonce-count when the server requests using a new nonce
Some servers have an upper limit on how many times a nonce can be
reused. Because the nc was not being reset the server would get a
high nc and would close the connection.

Change-Id: I71d5a316f79777a45c7323d93e28b3845aefcfad
Original-patch-by: Benjamin Reikowski
Pick-to: 5.15
Fixes: QTBUG-85729
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-05 11:32:01 +02:00
Morten Johan Sørvig
e8997cb05e wasm: factor visual viewport scale into dpr
By default, mobile browsers create a (layout) viewport
much wider than the visual viewport in order to be
compatible with web pages created with desktop browsers
in mind.

This means that the default view is zoomed out. This
zoom is not reflected in window.devicePixelRatio, and
Qt ends up setting the canvas render size to be larger
than actually needed.

The window.visualViewport.scale property reflects this
“mobile” zoom level: add it as a devicePixelRatio factor.
(The value will be less than 1 when zoomed out). User
pinch-to-zoom may change the zoom level and resize
the visual viewport; install a resize handler as well.

For now we limit the devicePixelRatio value in order
to avoid creating gigantic backing store images - this
is something we can revisit later on.

Pick-to: 5.15
Task-number: QTBUG-85662
Change-Id: I96db6121fe17a6c213216e04e4724efc93a9b66a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-08-05 11:23:13 +02:00
Morten Johan Sørvig
9704cbaf03 wasm: set viewport size to device size on mobile
This is a good default, and also works around a couple
of current bugs in the Qt implementation. (Applications
can change the default values in the .html file as
needed.)

Change body height to 100% of the visual viewport (“100vh”)
to make the html body cover 100% of the viewport after
landscape -> portrait transitions on iOS.

Pick-to: 5.15
Task-number: QTBUG-85536
Task-number: QTBUG-85662
Change-Id: Iced1aee03940361c96f1fe3c104f3e6eb983cb90
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-08-05 11:23:11 +02:00
Morten Johan Sørvig
ec82a44b40 XCB: Update logical DPI on “Xft/DPI” change
Install XSettings property change callback on the “Xft/DPI”
property. Update QxcbVirtualDesktop::m_forcedDpi and QScreen
logicalDPI on change.

Pick-to: 5.15
Change-Id: I578ebe9017fee58acd7a5c432cbd614fd35f2f55
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 09:23:09 +00:00
Tor Arne Vestbø
b6de6a9699 Teach QMacVersion to deal with 32-bit Mach-O headers
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I7946aa35722bc76326e2d6cf0820353c4ba13fad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-05 11:10:44 +02:00
Joni Poikelin
de3b2541de Clear old triangulated vertex data when a path is completely clipped
Old data was held in buffers which caused OpenGL paint engine to
re-render previous shape again with current settings if the current path
was completely clipped.

Pick-to: 5.15
Fixes: QTBUG-35513
Change-Id: I0cd448e0b18d199af11e82d79b1ab72d0f89c79e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-08-05 12:08:46 +03:00
Alexandru Croitor
f69dbb0b41 CMake: Don't use std=gnu++11 when building Qt internal targets
The logic is a bit involved in qmake.

The Qt internal qt_common.prf adds CONFIG += strict_c++ which applies
to qt modules, qt plugins, qml plugins, qt helper libs, winmain and
qt_apps, qt_tools, but NOT tests (which is important because the tests
on Windows MinGW fail to build without the GNU extensions).

Then default_post.prf checks for the strict_c++ value and either uses
the strict or non-strict C++ standard flags. default_post.prf is
loaded for all qmake projects, not just the Qt internal ones.

Now CMake doesn't provide a transitive based option to disable C++
GNU extensions with a mechanism similar to target_compile_features.

It only provides the CXX_EXTENSIONS property and it's associated
CMAKE_CXX_EXTENSIONS variable. We can't set the variable at a
directory scope, because that is too coarse grained.

So we rely on setting the property via a function in every relevant
qt_add_<target> function.

Now the naming of the function is weird.
We name the function as qt_internal_<...>, because it's not meant to be
used by Qt users.

We prepend an underscore to the name because we need to place it in
Qt6CoreMacros, so that the function can be called by
qt_add_qml_module which IS a public function.
That's because in Qt5 load(qml_plugin) was private API, but in Qt 6 +
CMake we decided to make qt_add_qml_module() as public API.

Change-Id: Id014626b087d590e25cb46843f93d0c67fc36e44
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-05 09:03:15 +00:00
Edward Welbourne
f12ddfaecc Tidy up unicode table generation
Eliminate some needless parentheses, tidy up some spacing and
indentation and split some long lines.  Change first += after
declaration to initializer.

Change-Id: I05ff2a6337b7ed14e0a2dc9c03fc784c92b63515
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-05 10:02:11 +02:00
Assam Boudjelthia
a310307ae3 Android: fix NoSuchMethodException exception in QtActivity.java
Adding these method definitions because QtApplication might fail
to find them.

Change 80f7494e8a added few exceptions
printStackTace(), the line
src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java#106
prints error of java.lang.NoSuchMethodException for these methods.

Pick-to: 5.15
Change-Id: I63b1f0d3abd5a7fe7d9e87bbff252c437300722f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-08-05 07:47:34 +00:00
Mårten Nordheim
07b008425a Privately introducing QDecompressHelper for network purposes
To support streaming decompression in QNAM.
Will also be used to refactor existing decompression code in QNAM.

Task-number: QTBUG-83269
Change-Id: Iecf3e359734163f15686c949f75d41fa4794a00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-05 09:17:11 +02:00
Samuli Piippo
c8db3115a2 Define unix platform interfaces also without opengl
Fix build without opengl.

Change-Id: I691fd4112d69b16690915fcf33f5ae30ca2d7a93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 09:34:58 +03:00
Samuli Piippo
54182e47c3 QNX: adapt to new event APIs
Use the new event APIs and split the single mouse event into
three separate events (move, press, release). QNX events only
give us current state, deduce the pressed and released buttons
by comparing to the previous state.

Change-Id: I9e647922679ddb792b10cb5e6ceee7ede4878444
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2020-08-05 09:34:50 +03:00
Michal Klocek
4886514fc3 Fix compiler issues when qreal is float
Change-Id: Ide3b5a3b0f2d93708409edac8aa999eb25c3ab54
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 07:24:14 +02:00
Oliver Wolff
f4093d02ff Fix "rectange" typos in qtbase
Pick-to: 5.15
Change-Id: If064fae5eaaeb2e53e3dd05cb9dc1cdf49ad1f04
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
2020-08-05 05:13:30 +00:00
Thiago Macieira
ed991b7d15 Add an AES-based qHash function, inspired on Go's
Change-Id: I09100678ff4443e6be06fffd1481e94089c47799
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 20:56:59 -07:00
Thiago Macieira
f2abfb39d7 QDebug: add operator<<(const char16_t *)
Avoids the conversion from UTF-8 for uses that are not dumping a string.

Mass conversion of Qt sources left for future opportunity.

Fixes: QTBUG-85811
Change-Id: I4ca4a35b687b46c39030fffd1626ae6c3294cacf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 15:13:09 -07:00
Giuseppe D'Angelo
31c232d3b7 QList: properly declare operator== for MSVC
The operators were declared as friend function templates (so, free
functions in the Qt namespace). Unfortunately, the template argument
of the operators was also defaulted -- causing MSVC trying to
instantiate those functions at all times, causing interesting
recursive template instantiation errors (C2968). It's extremely
likely that we're facing a MSVC bug, but work around it by not
defaulting the template argument. This in turn requires to move
the function definition outside QList's definition, otherwise
an extern template definition (like the ones we have for QList<QPoint>)
would cause a template redefinition error...

Change-Id: If03477ac1fa0a72aa252bb9e08e2a19c2b517b1b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 20:04:54 +02:00
Sona Kurazyan
8003ae79bf Document the changed semantics when passing arrays to QByteArray methods
After adding QByteArrayView overloads of QByteArray methods that used
to take char*, the way of determining the length of passed fixed-sized
array data has changed, due to the QByteArraiyView's optimization to deduce
the length at compile time for arrays. Document the behavior and add a
changelog item.

[ChangeLog][QtCore][QByteArray] When passing fixed size C arrays to
QByteArray methods, the length of the data on which the method will operate
is determined by array size, and not by scanning for the first '\0'
terminator, as it was in Qt 5.

Task-number: QTBUG-85815
Change-Id: I11cba17d428791e06c9bd4c7a727b7bd6b6aec3c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 19:52:22 +02:00
Sona Kurazyan
883f2dd81f Avoid possible ambiguities with QByteArrayView's comparison operators
QByteArrayView's comparison operators are declared in the global
namespace, which can collide with the ones declared for other types that
are implicitly convertible to QByteArrayView (see the example attached to
the bugreport). Changing them to be hidden friends will make them visible
only when at least one of the operands is a QByteArrayView, so the
ambiguity will be avoided.

Fixes: QTBUG-85880
Change-Id: Ic3582269d9bda9a2105336ef0f044ea619af37ba
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-04 19:52:08 +02:00
Timur Pocheptsov
8a91947423 QSslSocket: remove a redundant forward declaration
Change-Id: I9a3b6ccc022a036fa82d429ad008adeabe46f4ce
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-04 19:52:01 +02:00
Timur Pocheptsov
2d2ef81117 QtNetwork: use Q_DISABLE_COPY_MOVE
We have several classes inheriting QObject (directly or not) and disabling
copy (thus non-movable implicitly). Let's make them non-movable explicitly
now.

Change-Id: I509a066e9977480b30842afef26319b8afec6001
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-04 19:51:56 +02:00
Fabian Kosmale
652062dde3 QNotifiedProperty: avoid crash
We can end up in a situation where a (soon to be destroyed) observer is
owned by a binding which is about to be deleted. If in that situation
the binding is destroyed first, we end up with a dangling pointer
and ensuing memory corruption. Instead, we now first transfer the
ownership of the observer and only destroy the binding afterwards.

Fixes: QTBUG-85824
Change-Id: I721c0319281ada981ae7896bd2e02e9a0cc901b8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 11:28:33 +00:00
Tor Arne Vestbø
4e74bb4823 Resolve SDK and deployment target OS from load command
Pick-to: 5.15
Pick-to: 5.12
Change-Id: Icce79186645f173b7f9be8ee6da0abed25cf3da0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-04 13:28:33 +02:00
Giuseppe D'Angelo
c580a5cdd4 Fix -Wshadow warnings
Turns out headersclean doesn't run on this header...

Change-Id: Ice8691dc0b4b46b2bde38467ca398b61b569a769
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 07:12:32 +02:00
Michal Klocek
3d89fa97cc Remove InfoFlag from docs
It seem to be a leftover after 4e400369.

Change-Id: I1c12bfa70cb3716d5cd9d1306db23242b58f3096
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-08-04 07:12:32 +02:00
Tor Arne Vestbø
a00ad95137 Remove last remaining bits of QtPlatformHeaders
Task-number: QTBUG-84220
Change-Id: I951e04bfe9358a99951d1d61ff47b675584b7f81
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-08-04 07:12:32 +02:00
Tor Arne Vestbø
4595fb2c1e Remove QWaylandWindowFunctions
The subsurface sync/desync functions were unimplemented on the
qtwayland side, so this is all dead code. We will introduce the
platform interfaces if an actual use-case with an implementation
comes up.

Task-number: QTBUG-84220
Change-Id: I921ee7262e5f0a7171058aaf0ff2102d9e6f438e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-08-04 07:12:32 +02:00
Shawn Rutledge
d1d4ea5ddf Add qHash implementations for QRect and QSize
We need them to implement qHash for QQuickPixmapKey.

Change-Id: Ia67de25ec0068b9e1b889bc9c6ee077e24eb71a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-04 07:12:31 +02:00
Andrei Golubev
b3c1093751 Introduce swap functions for QPromise/QFutureInterface
Made QPromise::swap public, added free standing swap() for
QFutureInterface and QPromise. Updated QPromise special member
functions. Extended tests

Task-number: QTBUG-84977
Change-Id: I5daf6876df306d082441dbcdf5ae4dee3bfc0ead
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-03 16:47:31 +02:00
Topi Reinio
fddb0c895f Doc: Document QGradient::Preset enum values
Pick-to: 5.15
Fixes: QTBUG-85749
Change-Id: Ie77145e851ff64d4c88fce7211135d66e9b94a84
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-08-03 16:47:31 +02:00
Andy Shaw
7d4baabdae Android: Install the qmldir files when configuring for a single abi
This amends 0ef46b41d8 to ensure the
new configuration is styled correctly for qmake.

Task-number: QTBUG-80938
Change-Id: Iebfff3ff0570d2e92d01d4eb1178c0d6261468f9
Pick-to: 5.15
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-03 16:47:31 +02:00
Laszlo Agocs
3f2251994d Fix doc signature in QOpenGLContext
Just T makes qdoc's clang parsing fail, it needs template<typename T>.

Also, the return type is T*, not T.

Change-Id: I210676aff3122b432888c3d79d9967e249ac88e1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-03 09:41:33 +02:00
Laszlo Agocs
f0c5802a5c Add more doc fixes for Vulkan types
Add dummy typedefs just for qdoc, this way the types show up in
the generated docs.

Change-Id: I408eeb5c4c1cbbb8cd7df8ca3c9c6b7c64b0ca88
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-03 09:41:22 +02:00
Laszlo Agocs
61bd046b58 eglfs_kms: Do not skip the initial SetCrtc
Trying to be clever seems to cause issues on some systems, for example
AMD (RADV) on Ubuntu 20.04 gives totally garbled output by default.

Remove the undocumented ALWAYS_SET_MODE env.var. as well, it won't have
much of a purpose since we'll in effect hit the SetCrtc path always now
once on startup.

Change-Id: Ibaa463ff913eb0c1251d6d3435aa4799fe5c8a29
Fixes: QTBUG-85797
Pick-to: 5.15
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-03 09:41:14 +02:00
Laszlo Agocs
a0db31ee52 eglfs: Prevent printing a warning in every widget-based app
Attempting to reflect reality with the value of AA_ShareOpenGLContexts
was a valiant attempt, but it is not possible to do setAttribute without
getting a warning now once QGuiApplication is constructed. So just leave
the attribute as is, changing its value is not strictly required.

Fixes: QTBUG-85796
Pick-to: 5.15
Change-Id: I0f0f981bb4883856b216b2a9aad3b5bf2d7da01a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-03 09:41:10 +02:00
Mårten Nordheim
246e712548 Move-enable QByteDataBuffer::{append,prepend}
Change-Id: I2fd342465475e3a694c8459a54957149f8b418a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-01 10:51:21 +02:00
Mårten Nordheim
5d7be66fd7 QList: Add a append(QList &&) overload
We already had append(const QList &) and now there's an overload
taking an rvalue reference.

Change-Id: Id2fbc6c57badebebeee7b80d15bb333270fa4e19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-01 00:01:52 +02:00
Allan Sandfeld Jensen
0c53f8ba98 Fix undefined use of memcpy and memcmp
Don't call them on a nullptr, even with a length of 0.

Change-Id: I7fee23303562e5771697a16365cae12e3e87af6f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 20:08:50 +02:00
Thiago Macieira
e3a6ede895 Try again to fix Clang's -Wconstant-logical-operand warning
Commit daaa557259 changed the enum to
bool, but the warning is still happening.

Pick-To: 5.15
Change-Id: Ibdc95e9af7bd456a94ecfffd1603f332a356c788
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 10:44:52 -07:00
Thiago Macieira
95afe6b244 QSharedPointer: do allow calling deleters on null pointers
I don't know why std::shared_ptr allows this, but why not.

[ChangeLog][Important Behavior Changes] QSharedPointer objects will now
call custom deleters even when the pointer being tracked was null. This
behavior is the same as std::shared_ptr.

Fixes: QTBUG-85285
Pick-to: 5.15
Change-Id: I24006db8360041f598c5fffd161c260df0313b55
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-07-31 10:40:25 -07:00
Thiago Macieira
fe9e6b2ceb QString::vasprintf: fix 't' modifier for integers on 64-bit
‘t’
     Specifies that the argument is a ‘ptrdiff_t’.
     This modifier was introduced in ISO C99.

We use qsizetype, which is the same width as ptrdiff_t, so it makes no
difference in va_arg().

Change-Id: Iea47e0f8fc8b40378df7fffd16255730109413a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 10:36:33 -07:00
Edward Welbourne
a6b3a1e459 Remove deprecated binary json feature
Deprecated in 5.15 in favor of CBOR.

Fixes: QTBUG-81239
Change-Id: I711d4bd7dd1247f58e77ac9fa53304cbe5028918
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 17:12:48 +02:00
Mitch Curtis
13c90a0a75 Document that keys() and values() run in linear time
keys() and values() can be slower for large containers.
I ran into this recently when profiling, and was surprised that keys()
had to build the list of keys (by appending in a loop).

Pick-to: 5.15 5.12
Change-Id: I73215f5a917790236704ad7ef78cefc4a049cd89
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 16:54:23 +02:00
Mitch Curtis
46ec92dad0 Fix build with MSVC2019
The error was:

src\virtualkeyboard\qvirtualkeyboardinputcontext_p.cpp(305): error C2678:
binary '!=': no operator found which takes a left-hand operand of type
'QList<QInputMethodEvent::Attribute>' (or there is no acceptable conversion)

This patch fixes the issue by manually defining an operator== for
QInputMethodEvent::Attribute.

Change-Id: Idb283cf7b6ff4388a38ea7780c3d5c1c5f77038d
Fixes: QTBUG-85789
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 16:54:10 +02:00
Allan Sandfeld Jensen
0792188440 Add float->qfloat16 rounding and fix the tests
Our hardware optimized conversions of float to qfloat16 rounds to even
where our table based conversion truncated to zero.

The rounding is not in this patch exactly round to even like the
hardware implementation but much closer.

Change-Id: I4c5e72c15fef9079d3660680b2727ff7ba4e768a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 16:50:30 +02:00
Paul Lemire
c95fc0f662 rhi: QRhiGLes2::gatherUniforms fix gathering in struct
In the case we don't have an array of structs, structPrefix needs to be
suffixed with a dot to get the proper uniform names.

Change-Id: I50ed54c2f7c3cc4556ed1854419bc4fe3a2989f7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-31 15:43:20 +02:00
Linus Jahn
c19bafc60c QtCore: Use system-wide libb2 if present
This adds the option to build Qt with libb2, which is especially
recommended, if you care about the performance of the BLAKE2 hashing
algorithms. The bundled version is the pure reference C implementation
of BLAKE2, while libb2 has many additional hardware optimizations.
However, the API of both is the same, so no changes to the code were
necessary here.

Change-Id: I3563982f4e07be300291fe103c38b16a404b3ebb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-31 15:05:24 +02:00
Linus Jahn
5d69aa3ee1 QCryptographicHash: Add BLAKE2b and BLAKE2s hashing algorithms
BLAKE2 does not specify requirements about specific hash sizes and
since QCryptographicHash does not support dynamic hash sizes, only the
most common hash sizes could be covered by this.

The supported hash sizes were chosen to match the ones supported by the
Linux kernel.

The new hashing algorithms for QCryptographicHash are:
 * BLAKE2b (160 bit, 256 bit, 384 bit, 512 bit)
 * BLAKE2s (128 bit, 160 bit, 224 bit, 256 bit)

[ChangeLog][QtCore][QCryptographicHash] Added BLAKE2b and BLAKE2s
hashing algorithms.

Fixes: QTBUG-78198
Change-Id: Id9e0180a974093982fdf1cdd6180988a2e5e9f4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 15:05:18 +02:00
Linus Jahn
06f7a24574 3rdparty: Add reference C implementation of BLAKE2
This is required for adding support of the BLAKE2 hashing algorithms in
QCryptographicHash.

Change-Id: Icc981c3a99a2713fdd1c18766b05619254650622
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 15:05:08 +02:00
Thorbjørn Lund Martsum
24d60cb64d Make initStyleOption virtual for various classes
Often a simple change in the styleoptions is needed in e.g a paintEvent,
but it was impossible without copying the whole paint-function which
is not always trivial and also wouldn't be kept up-to-date if it was
changed in Qt.
The initStyleOption is similar to viewOptions in QAbstractTableView
and it is handy that this function is virtual. Furthermore
QStyledItemDelegate::initStyleOption is already virtual.

This change only makes initStyleOption virtual for public classes.

[ChangeLog][QtWidgets] InitStyleOption has been made virtual in
public Qt classes to make override of stylebehavior more simple.

Change-Id: I38974c6d4dd0793ca5976ecf3aa28892215a1579
Task-number: QTBUG-77642
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2020-07-31 14:58:54 +02:00
Volker Hilsheimer
26c742c1e1 QFileSystemModel: make sure files are stat'ed in the worker thread
QFileInfoGatherer creates QFileInfo objects in the worker thread to
offload the work from the UI thread, but it never calls any methods on
the QFileInfo objects that would trigger a stat'ing of the files. For
large directories on remote file system, that easily results in the
UI thread being blocked for a very long time.

Add a private 'stat' method to QFileInfo which allows forcing it to
stat all attributes from the worker thread, and make
QFileInfoGatherer a friend so that it can call the function from the
worker thread. This way, QFileSystemModel can access the cached data
for each QFileInfo object, without having to touch the file system
from the UI thread.

Also reduce the amount of signal emissions for drive information,
batch all drives (which can safely be assumed to be at most a two
digit figure) into a single emission instead.

Change-Id: Ifdcae150406187db9984d0fec9add93597b5f85b
Fixes: QTBUG-41373
Pick-to: 5.15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-31 10:59:58 +00:00
Allan Sandfeld Jensen
5747f31392 Another round of 0->nullptr cleanup
Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-07-31 12:56:50 +02:00
Alexandru Croitor
e755ce99d9 CMake: Regenerate load(qt_app) projects
To use the new qt_internal_add_app function.

Change-Id: I9776ce18c3a8b01f1a42e8da346cfd0a98374ef8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:33 +02:00
Alexandru Croitor
b3b1e47378 CMake: Introduce qt_internal_add_app
This new function is meant to be used where load(qt_app) is used.

It delegates functionality to qt_add_executable, while handling
some additional behavior via a finalization function (mostly handling
of macOS Info.plist files and icons, as well as Windows icons and
resource files)

It uses a new PlatformAppInternal interface target.

Task-number: QTBUG-85757
Change-Id: I1a2d5851b137fcd4a6323e0e06fb154f91619800
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:32 +02:00
Alexandru Croitor
704e215295 CMake: Regenerate projects
Change-Id: Iac12acd07513e790e531ae93366fdae70c1c61a5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 12:55:32 +02:00
Fabian Kosmale
cb80720287 Expose QMetaTypeInterface::alignof in QMetaType
We already have the information in the QMetaTypeInterface, and provide
functions to access sizeof. Adding alignof support seems natural, and
should make it easier to handle over-aligned types.
This should also be helpful in QVariant.

Change-Id: I166be76f4b7d2d2e524a3a1e513bd2f361e887c1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 09:46:54 +02:00
Thiago Macieira
61ccfefb25 Fix warning in QStringView::compare(QChar) on qsizetype->int
size() - 1 is converted to int as the result, but size() is a qsizetype
and could be bigger than INT_MAX. So rewrite to not depend on the cast.
This was introduced on b2f79cceb1.

I could have replaced size() - 1 with int(size() > 1) - 1, but that's
even more complex. To simplify, I split the function in two while
retaining the C++11 constexpr requirements.

Bonus: removes the use of the ambiguously-named "empty()" function that
looks like a verb.

Fixes: QTBUG-85665
Pick-to: 5.15
Change-Id: Ieffc3453b88c4517a1dbfffd162338fdb084a376
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-30 20:29:23 -07:00
Thiago Macieira
caa40f57d4 QLocale: update qt_asciiToDouble to use qsizetype
No need to change the output variable from int to qsizetype. That would
complicate the use of libdouble-conversion, which uses ints.

Change-Id: Iea47e0f8fc8b40378df7fffd1624bfdba1189d81
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-31 03:29:11 +00:00
Edward Welbourne
2ab4fe2ac8 Be clearer about the locale-aware comparison QString supports
The docs didn't make clear that there's a case where a rather poor
locale-aware compare may be in use - which turns out to be in use on
Android.

In the process, stop duplicating (in two slightly different variants)
the same paragraph in many places when we can use a \sa to refer to a
sub-section of the class doc.

Pick-to: 5.15
Task-number: QTBUG-63518
Change-Id: I5a41b0a269e477e74236131310992e70462734d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-07-30 13:15:42 +02:00
Allan Sandfeld Jensen
a57419b10d Document run-time acceleration of using the conversions functions
Pick-to: 5.15
Change-Id: I985b93135b9d8fdfdd64e9183b23cbf8a7b4e3eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-30 09:52:24 +02:00
Tor Arne Vestbø
7940851863 Fix no-PCH build on Apple platforms
Change-Id: I5257af8079e6b2f26893d1bc44adb48ad4a1684b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 20:34:17 +02:00
Tor Arne Vestbø
3d03f4e989 Register QPlatformBackingStoreOpenGLSupport when needed
Static builds can not rely on a constructor function in the QtOpenGL
library, as that will be linked out unless something in the application
pulls it in.

Instead we export a helper function that clients that depend on
OpenGL support in QPlatformBackingStore can use to bring it it.

Change-Id: Ic54058bf413a476287884c78df5624b862f97695
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-29 20:34:15 +02:00
Volker Hilsheimer
d14cf6d3d9 QFileInfo: Fail faster when stat'ing filepath on a disconnected drive
The Windows implementation of QFileSystemEngine tries hard to fill the
metadata for a file, even if GetFileAttributesEx returns with error.
This is good in many situations, but when the error code indicates that
the drive on which the file resides has been disconnected, then we
should fail quickly.

Task-number: QTBUG-6039
Pick-to: 5.15
Change-Id: I7574c5a2e524e913306d0b470b4f227416442c13
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-29 20:03:50 +02:00
Alex Trotsenko
8969070cfd QEventDispatcherWin32: redesign event notifiers activation
The previous implementation multiplexed callback-based event
notification into a single proxy event (cf. 85403d0af), which was
in turn object-waited for (this was the case since the beginning
of public qt history). It makes more sense to multiplex into a
posted message, because that also works with foreign event loops
that do not know anything about our event objects.

Task-number: QTBUG-64443
Change-Id: I97945ac8b5d7c8582701077134c0aef4f3b5a18f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:34 +03:00
Alexander Volkov
2b781fd678 Revert "Add missing override" for 3rdparty vk_mem_alloc.h
This partially reverts 9bad3508fc.
Disable -Wsuggest-override for gcc when including the header
instead.

Change-Id: Id2507ce731da62bbd64aa6477b181735ba62adc1
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-29 15:35:01 +03:00
Tor Arne Vestbø
9b8695998b Add proper dependencies for doc snippets
On iOS the plugin is statically linked into the app. We need to wait
for the plugin library to build before we can build the snippets.

Change-Id: I79c89c5615f16d63a46c25481c9a40bf2b4a7eaa
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2020-07-29 14:12:54 +02:00
Tor Arne Vestbø
7fdb47862c iOS: Add Metal framework as dependency
Change-Id: I7d8d8cef8252a65378b24af1ade87bb484d5fa68
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 13:54:26 +02:00
Tor Arne Vestbø
19d32f0a5f Add QOperatingSystemVersion support for macOS Big Sur
Pick-to: 5.15
Pick-to: 5.12

Change-Id: Ide57f675b20b08210f301da5177df45d008423c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-29 13:25:28 +02:00
Tor Arne Vestbø
3e71e2e851 Fix build of testlib doc snippets
The file src_qtestlib_qtestcase was built twice,
causing duplicate main symbols

Change-Id: I18750b87eee27603d9f56129fd6c30fddf4a4828
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2020-07-29 13:22:12 +02:00
Friedemann Kleint
ed114b728d Windows: Prevent event processing during QDesktopServices::openUrl()
The platform implementation uses the Win32 API ShellExecute(),
which may spin an event loop to do COM processing, causing things
like QMetaCallEvent being processed. Run it in a thread
to suppress this.

Pick-to: 5.15
Fixes: QTBUG-85676
Change-Id: I240ca78b41b39ded22e466662ffce8e9b03c10a2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-07-29 08:22:18 +02:00
Lorn Potter
44d4bc6d90 wasm: fix setTransferTimeout
WebAssembly does not need the http feature, but these functions were
hidden behind that feature.

Fixes: QTBUG-83867
Pick-to: 5.15
Change-Id: I7cd9aa73003f45ccbc2613c67c21e4067d6edddd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-07-29 09:09:03 +10:00
Lorn Potter
762b5f09a6 wasm: fix network headers logic
Fixes: QTBUG-85083
Pick-to: 5.15
Change-Id: Iaf0f3365ee20fe257f3edac0e1105bdfcc5ba0da
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-07-29 09:09:00 +10:00
Allan Sandfeld Jensen
d782df4861 Make qfloat16 helper functions consistent with float/double versions
Infinite is only when the mantissa is 0, everything else is NaN.

std::isnormal returns false on zero.

Pick-to: 5.15
Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 18:12:07 +02:00
Thiago Macieira
f16613f7ef QLocale: fix conversion of "\0" to double
That is not a valid conversion. An empty string is a valid conversion; a
string containing a null should fail.

Change-Id: Iea47e0f8fc8b40378df7fffd1624c088f3bd1b14
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:06 -07:00
Thiago Macieira
f50945b8fd QLocaleData: remove unused internal function
Pick-to: 5.15
Change-Id: Iea47e0f8fc8b40378df7fffd1624bf3469e66c90
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:03 -07:00
Thiago Macieira
efd3c7bf24 QByteArray::toDouble: fix buffer overflow reads on fromRawData()
If Qt was not compiled with libdouble-conversion, sscanf() requires
null-termination, which fromRawData() does not require. This could be
fixed by making QByteArray pass a reallocated copy if it is operating on
raw data, but fixing qt_asciiToDouble() means we catch all cases and we
optimize for the common case of not-horribly-long strings.

Fixes: QTBUG-85580
Pick-to: 5.15 5.12
Change-Id: Iea47e0f8fc8b40378df7fffd16246f6163b01442
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 08:54:02 -07:00
Shawn Rutledge
c13ce05482 Export the QMutable* event classes
They are needed often in Qt Quick.

Change-Id: I8f68798042dd7440958c8bc2b8fe7021af8ec34d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-28 17:32:14 +02:00
Timur Pocheptsov
c9a702a04d QSslSocket (OpenSSL, Windows) - make sure we ignore stale fetch results
The CA fetcher on Windows works on a separate thread, it can take
quite some time to finish its job and if a connection was meanwhile
closed (via 'abort', 'close' or 'disconnectFromHost') but the socket
is still alive/re-used - we don't want to be fooled by the previous
fetch 'finished' signal, only if it's fetching for the same certificate.

Change-Id: Ibd0a70000ad10cff10207d37d7b47c38e615d0f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-28 15:35:41 +02:00
Friedemann Kleint
964f5757ea Windows QPA: Move some internal functions to the new interface
Move createMessageWindow(), the GPU detection for qtdiag and the async
expose setting (used by Active Qt) from QWindowsNativeInterface to
QWindowsApplication.

Remove unused registerWindowClass() and use logFontToQFont() directly from
the font database.

Task-number: QTBUG-83252
Change-Id: I9c72351970b47457d08125557c2580016c66e586
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:21:10 +02:00
Friedemann Kleint
2405aa9d67 Windows QPA: Move mime-type related classes to the new interface
Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA
plugin in Qt 5) to the platform namespace and add register functions to the
native application.

Move in test code from QtWinExtras.

Task-number: QTBUG-83252
Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:20:23 +02:00
Timur Pocheptsov
904eaec9de QSslSocket (OpenSSL) - fix a minor type error
Change-Id: I76bf6c7d47c7d29228837bbb139a7f6a32de0e5e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-28 12:38:30 +02:00
Timur Pocheptsov
1482739002 QHostAddress: resolve API issues marked with ##Qt6
Also, remove the deprecated function and its auto-test.

Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 12:38:15 +02:00
Alex Trotsenko
83f00b8229 QNativeSocketEngine/Win: fix write() in case of splitting
When a first call to ::WSASend() consumes less data than requested, we
are trying to make a second call, leaving 'bytesToSend' unmodified.

Instead of setting a new value for 'bytesToSend', it seems reasonable
to break the loop, if the system buffer overflow detected.

Pick-to: 5.15
Change-Id: I8038e95c20221518955efe786f2d0dadb98360fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 10:40:18 +03:00
Fabian Kosmale
30395e9185 tslib: Add missing override annotation
Else developers fail to compile due to the newly added
-Wsuggest-override

Change-Id: I1fdcab794a8639a7cf2f6712e9ede6f25f7d3f69
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-28 09:29:33 +02:00
Allan Sandfeld Jensen
f26147b493 Replace Q_ALWAYS_INLINE with static inline
Static inline on functions serves the same purpose of keeping non-
inlined instances from different binaries from being mixed, and has the
benefit of being available across compilers.

Change-Id: I12467f6d887471d8fd70ff4623c473c2a5a45664
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 08:39:42 +02:00
Giuseppe D'Angelo
b71c8eb386 QCompleter: fix an out of bounds access in a QMap
If the iterator points to the map's begin(), then one can't
decrement it. Split the check and the decrement.

Change-Id: I3d816f13d0bcacc8253ba6d223bc83c874e5efb5
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-27 23:02:33 +02:00
Thiago Macieira
a77c159044 QWindowsServices: ungarble the URL
QUrl::toString always encodes as UTF-8, regardless of what the local
encoding is. So this produces garbage on Windows (and any non-UTF-8
system, but those don't exist any more outside of Windows, by
definition). So use %ls to keep the UTF-16.

Task-number: QTBUG-85745
Pick-to: 5.15
Change-Id: Iea47e0f8fc8b40378df7fffd162584f98e5bd633
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-27 13:39:38 -07:00
Robert Loehning
188501fe27 Sanitize lengthValue in CSS parser
Limit the LengthData to the integer range before rounding it, taking
into account that qRound() substracts 1 from negative values.

Fixes: oss-fuzz-23220
Pick-to: 5.15 5.12
Change-Id: I1b4383f3c33aac22746831002b2c74fc134faf77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-27 12:29:55 +02:00
Friedemann Kleint
beb3916858 Windows QPA: Potential crash fix for Wine
Add a check for theme instance.

Pick-to: 5.15
Fixes: QTBUG-85734
Change-Id: I10aced73379cd5e0b49d5cee08ceead060397a54
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-07-27 11:30:12 +02:00