Commit Graph

43083 Commits

Author SHA1 Message Date
Liang Qi
a275d38385 doc: AA_DisableSessionManager was added in 5.14
This amends 404bee752c.

Fixes: QTBUG-83611
Change-Id: Ic3379a646b9c70fb23fd1f3f4bebed6e0b485664
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-04-20 15:14:37 +02:00
Allan Sandfeld Jensen
13873c6bc6 Add support for high resolution wheel events from Linux 5.0+
They come in as a different relative axis, and we need to ignore the old
axis to not scroll double.

Change-Id: I808cce95417ec9f8058dee26d0a2694dda27944d
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2020-04-20 11:07:27 +00:00
Tor Arne Vestbø
864f18ba2f widgets: Re-calculate focus frame style option after setting new geometry
Fixes: QTBUG-83019
Change-Id: I75d3d93732cb0c5a5b7350f19f0227998bda4791
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit bd78753d62)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-20 12:46:30 +02:00
Tor Arne Vestbø
86f228b819 macOS: Restore fallback sizes when setting application or window icons
We removed this logic in 059c3ae66a under the assumption that the icon
would always provide a set of sizes, but for SVG icons this is not
the case.

Change-Id: Ib3cc5740bca32cf4068a71baf99b52fa536da2ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-04-20 12:25:07 +02:00
Liang Qi
ad9c70c3bb Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	mkspecs/features/qt_common.prf
	src/network/ssl/qsslsocket_openssl_symbols.cpp
	src/network/ssl/qsslsocket_openssl11_symbols_p.h
	src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
	src/plugins/platforms/wasm/qwasmeventdispatcher.cpp

Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: I04fb3139a0e2efd4bc2f0959f131679f192fa0f8
2020-04-20 10:34:48 +02:00
Tor Arne Vestbø
164110f7bb Warn when trying to load an icon without a matching icon engine
A typical case is trying to load an SVG icon without the QtSvg module
built. You want to know what's going on instead of trying to debug why
the icon doesn't produce any valid images.

Change-Id: I4418ad758a1232f1394058368c50e0d87235271e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-17 18:19:07 +02:00
Tor Arne Vestbø
cd41b01f32 macOS: Don't produce NSImages without a single representation
Doing so results in exceptions inside AppKit when passed on to APIs that
expect valid images. It's better to produce nil-images.

Fixes: QTBUG-83494
Change-Id: I1e5bfa2a7fecd75a1ddb95bd1a6dc2e8db6b24f8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-17 18:19:01 +02:00
Assam Boudjelthia
cc106ce565 Android: update Android specific variables docs
Android variable are missing from the list of QMake variables...

Task-number: QTBUG-80390
Change-Id: Ic10f96687334eea99c0302d7137685b1bf6e56c6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-04-17 17:27:36 +03:00
Mårten Nordheim
5c04b83715 QSocketNotifier::activated(QSocketDescriptor...) doc fixup
We agreed to make the type internal but somehow it slipped my mind to
actually label them as such.

Task-number: QTBUG-70441
Change-Id: Id90521ecc09bfa1db29601b96ba70bcdcb64d458
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 15:25:12 +02:00
Tor Arne Vestbø
a962bbec07 macOS: Support [NSPanel becomesKeyOnlyIfNeeded]
We don't set this flag ourselves, but clients may do via winId(). If set,
the panel will only activate if a view with needsPanelToBecomeKey is clicked.

We do not implement needsPanelToBecomeKey in QNSView, which we ideally should,
by e.g. looking at the IME hints. This still works as expected, as QtWidgets will
make sure to activate the window as part of the normal focus handling. For other
use-cases the user will have to catch the mouse event and activate the window
manually.

Change-Id: I4bacdd44b2f7df5920c6334806303bb5eb502b48
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-04-17 13:29:50 +02:00
Tor Arne Vestbø
d04c9e23ff macOS: Activate non-modal windows during modal session if they support it
Commit 593ab63860 ensured that non-modal windows would not be activated
during a modal session, which makes sense for windows that can't be
interacted with. But some windows can, and we should activate them
as normal.

Task-number: QTBUG-46304
Change-Id: I4a9b7ec53157b042d4d6e9535336fa3254f41e0e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-04-17 13:29:48 +02:00
Tor Arne Vestbø
f4889e63c7 macOS: Rework worksWhenModal and update on modal session change
Instead of basing the worksWhenModal property on the window type, which
will include both windows inside the current modal session (as intend),
but also windows below the current modal session (wrongly), we check
to see if the window is a transient child of the current top level
modal window.

Going via NSApp.modalWindow means we also catch cases where the top
level modal session is run by a native window, not part of the modal
session stack in the Cocoa event dispatcher.

The new logic relies on windows such as popups, dialogs, etc to set
the correct transient parent, but this seems to be the case already.

To ensure the window tag is also updated, we call setWorksWhenModal
on modal session changes. We could change worksWhenModal into e.g.
shouldWorkWhenModal and always use the setter, but that would mean
the initial window tag update in [NSWindow _commonAwake] would pick
up the incorrect value. And if the window tag is not updated after
that due to the workaround in [QNSPanel setWorksWhenModal:] being
compiled out, the window would not be possible to order front,
which is worse than being able to order front a window with
worksWhenModal=NO.

Fixes: QTBUG-76654
Task-number: QTBUG-71480
Change-Id: I38b14422d274dcc03b4c7d5ef87066e282ed9111
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-17 13:29:17 +02:00
Kimmo Ollila
23a6479715 Add mkspec for INTEGRITY Qualcomm SA8155P ADP
Change-Id: I3430868fb88f357c3d2d1d3cd8e00088aa26649c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-17 10:22:02 +03:00
hjk
300bd7fff8 rcc: Always seed the hash with 0
That was already done to pass the auto tests, but the randomization also
bites for reproducible builds.

Change-Id: Ibf4da513059deb5a806d2ac1a83c1994edf09d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-17 09:02:22 +02:00
Robert Loehning
33b1662f16 Fuzzing: Add fuzz target for QCborStreamReader::next
Change-Id: I8e7d90d89b66395370809935b1cb5bf144bded49
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-16 21:12:00 +02:00
Volker Hilsheimer
0c65176847 Docs: show more relevant and correct way of using Q_FLAG
The snippet didn't quote the QLibrary header correctly, and didn't
register the flags type, but only the enum type with the meta object
system.

Update example to use QItemSelectionModel instead as a more relevant
class for readers, and restructure the text a bit.

Change-Id: I572e2aaac4601087e7aa6d2ea7a8f8fd65d82539
Fixes: QTBUG-83474
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-04-16 13:52:12 +02:00
Mårten Nordheim
487dd80bce Introduce QSocketNotifier::activate(QSocketDescriptor, QSN::Type)
The pre-existing overload passes an int, but this can mean the
descriptor gets truncated in compilations where the descriptor
is 64-bit.

The old overload with int is visible when querying the metaobject system
so string-based connects still work as before, and connecting to it will
produce a deprecation warning in the output.
At the same time the PMF-based connect will, on recompile, pick the
QSocketDescriptor overload. As an added improvement it also comes with
the notification type, removing the need for separate slots where the
code would be mostly shared anyway.

The QSocketDescriptor type can be implicitly converted to and from
qintptr to ensure existing code still compiles. It can also be
constructed from Qt::HANDLE on Windows.

In this same patch I also update the existing string-based connects in
this module, which then includes updating the parameters for some slots
as well.

[ChangeLog][QtCore][QSocketNotifier] Added
QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type).
This replaces the activated(int) signal which in 64-bit environments
could truncate the socket descriptor. If you use "activated" with the
string-based connect() then you need to update the parameter type of the
signal and slot if it had one. If you use it with the pointer to member
function based connect() then all you need to do is update your slot's
parameter type if it has one. If you need to compile your source code
with multiple versions of Qt then connect() to this function using
pointer to member function and update the slot's parameter type if
needed.

Task-number: QTBUG-70441
Change-Id: Ic43d6bc4c5bcb4040867b2ffad8d36fb01eed8af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-16 13:52:11 +02:00
Edward Welbourne
b34158d7a1 Fix display-name calls in QAndroidTimeZonePrivate::init()
Following up on commits 4fa8dfee5d and
c20c7efea9, where I apparently got the
call to Java's getDisplayName() method wrong. Use the same code as our
own displayName() method used for this, pulled out as a function to be
shared by the two callers.

This requires a locale and it's not immediately obvious which to use,
so try the three most plausible candidates: C locale because IANA IDs
are typically in it; default because that's most likely what language
a user-supplied locale name might be in; and system because the name
may have come from the system, not the user.

In the process fixed some loops that didn't visit all the values they
thought they did.

Fixes: QTBUG-81975
Change-Id: I7867ca6f46951315a41c389107439acb439eaf08
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-04-16 13:52:11 +02:00
Timur Pocheptsov
8ddffc6ba4 OpenSSL: handle SSL_shutdown's errors properly
Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s)
returns 1). Also, do not call SSL_shutdown if a session encountered a fatal
error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown
was unsuccessful (returned code != 1), we have to clear the error(s) it queued.
Unfortunately, SSL_in_init was a macro in OpenSSL 1.0.x. We have to
resolve SSL_state to implement SSL_in_init.

Fixes: QTBUG-83450
Change-Id: I6326119f4e79605429263045ac20605c30dccca3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8907635da5)
2020-04-16 11:26:04 +02:00
Tor Arne Vestbø
8138c812cb macOS: Remove a bunch of dead (forward) declarations
Change-Id: I402668a17b48c164658f775bacd832615a6d2587
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-15 17:33:06 +02:00
Fredrik Orderud
1bee5937bc Windows: Make QStandardPaths::writableLocation low-integrity aware
Return %USERPROFILE%\AppData\LocalLow instead of %USERPROFILE%\AppData\Local
when running in a low-integrity process.

[ChangeLog][QtCore][QStandardPaths] When used in a low-integrity process
on Windows, QStandardPaths::writableLocation returns respective low-integrity
paths.

Fixes: QTBUG-83453
Change-Id: Ie5e4625a34d08e4ef54be4ba45b2dae9e60feb63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-15 13:18:48 +00:00
Allan Sandfeld Jensen
c7e8ee4e62 Fix image scaling on WASM platform
Apparently it has trouble with multi-threading from the main thread.

Change-Id: Ib544d69270c2780d4a42bde6fd7f491e32f29cd2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-04-15 15:00:13 +02:00
Shawn Rutledge
c38e4db6b1 doc: Recommend the QSplashScreen constructor taking a QScreen*
Amends 49362d064f

Change-Id: If217af44cf6ebe8ebed37bbd927ac311b23d8c0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-15 14:56:18 +02:00
Volker Hilsheimer
e38e1d02cc Add QButtonGroup::idClicked/Pressed/Released/Toggled signals
Following the deprecation of the signal overloads, the remaining signals
did not provide equivalent functionality for connecting a slot expecting
an integer. The mapping from QAbstractButton* to the ID is comparatively
cumbersome to do in the connected slot.

Add uniquely named signals that emit the ID of the button directly.

[ChangeLog][QtWidgets][QButtonGroup] Added signals
idClicked/Pressed/Released/Toggled that replace the deprecated signal
overloads.

Change-Id: I77215e4f815c4fb7dd6326e1f431230e6601e8f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-15 14:29:08 +02:00
Volker Hilsheimer
c61b81c385 Refine deprecation warning for QMetaProperty::isEditable
Following up on header review.

Change-Id: I88553fdaa56364fe93e7eac5d2b062402c760be4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-15 14:25:56 +02:00
Tor Arne Vestbø
7fd271e733 macOS: Clean up header includes to use quotes or brackets as appropriate
The includes can be sorted and unified even more, but that's left for
another rainy day.

Change-Id: I4d5670d6d8389f69d2631b83b8f421d1f685a0f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-15 13:58:39 +02:00
Friedemann Kleint
4bb803477b Windows QPA: Fix geometry when firing a full expose
There are several places in the code where a full expose
event is fired, but the geometry in logical coordinates is
used (pre-dating High DPI scaling). Fix by introducing a
helper function for it.

Task-number: QTBUG-83449
Change-Id: Ie8bb306de0b9b2b85306ed1bb6ba71181b76a958
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-04-15 09:29:56 +02:00
Timur Pocheptsov
8907635da5 OpenSSL: handle SSL_shutdown's errors properly
Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s)
returns 1). Also, do not call SSL_shutdown if a session encountered a fatal
error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown
was unsuccessful (returned code != 1), we have to clear the error(s) it queued.

Fixes: QTBUG-83450
Change-Id: I6326119f4e79605429263045ac20605c30dccca3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-04-15 08:14:18 +02:00
Friedemann Kleint
18fa1ed747 Windows QPA: Fix showing translucent windows maximized/full screen
Translucent (layered) windows require an additional expose
event. This was sent with the wrong size since the order of
handleGeometryChange(), handleWindowStateChange() in
handleResized was wrong.

Fixes: QTBUG-83449
Change-Id: Iafd3fa8c0893aa28079201f73b7eb529087ba079
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-04-15 07:39:38 +02:00
Friedemann Kleint
c92fedd761 Windows QPA: Fix restoring from fullscreen in High DPI setups
The logic for checking whether the saved geometry (native pixels)
is still within a screen compared them against logical coordinates.
Work with the platform screen geometry instead.

Fixes: QTBUG-83448
Change-Id: Ib68f967d1a33a490f88a7bec6dcc788788a10389
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-04-15 05:39:07 +00:00
Robert Loehning
5e3b32b608 Fuzzing: Add fuzz target for QTextStream's extraction operator
Change-Id: Ia5fa2e36f5439ebcc323d6d18c33c2dd58404aba
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2020-04-14 23:39:36 +02:00
Lorn Potter
c034089fa6 wasm: do not try to resume main thread if mainloop has not started yet
(cherry picked from commit d928beb024)
Fixes: QTBUG-83293
Change-Id: Ibd891629d1d023e47d196dd60821cc5c583a178d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-04-14 19:37:03 +00:00
Lars Schmertmann
6e0591437a Add information for macOS to qsystemdetection.h
Change-Id: Ibc99b5481709b1b99cdbbdd94ad544175871cbae
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-14 18:26:19 +02:00
Tor Arne Vestbø
d6fe9c2160 Deprecate QMacNativeWidget and QMacCocoaViewContainer
Change-Id: I489870f97dcf7b54a4427ead3a9e627dd938f4ca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-04-14 17:30:55 +02:00
Volker Hilsheimer
eaada70d4e Fix deprecation warnings in QCocoaCursor
Explicitly use the Qt APIs that return QPixmap and QBitmap by value, and
fix the API taking those to use const references rather than pointers
or const values.

Change-Id: I2bb7ad1edb3b65f806f0475fca383e5b9bdb61f3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b61ea367a5)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-14 16:50:56 +02:00
Tor Arne Vestbø
c2efc16126 macOS: Replace foreach with ranged for loops
Change-Id: I9d0dbb60e05e4ef85219740465bb941ef8d8eb0f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-14 15:54:22 +02:00
Kai Koehne
9ba09e26d7 QSettings: Read past UTF-8 BOM even without textcodec support
Try to read past an UTF-8 BOM even if no textcodec support is available,
but do set the status to FormatError then.

This is in line with the general 'best effort' approach in QSettings.
It also allows qmake (that is built without textcodec support) to
gracefully load qt.conf files with a UTF-8 BOM, though non-Latin1
characters might still be misrepresented.

Fixes: QTBUG-83456
Change-Id: I31b45dc5a8adf7950910897a2b33ae16990d3818
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-14 15:51:46 +02:00
Andy Shaw
e7eff98401 Android: Only check for uri permissions when it is a file or content
This amends f36b042e2b to only check
permissions for uris that are going to be local to the device itself.
Other uris, such as http, https etc, should go through fine without a
check.

Change-Id: If05caadb6e0712d9db8f57185ef017d724d9e172
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-04-14 14:51:17 +01:00
Tor Arne Vestbø
504b37e399 syncqt: Ignore deprecation macros when resolving class names
Otherwise we will fail to resolve the symbol and will not create
a forwarding header for the class.

Change-Id: I34922d8458bdb994a194108183ac9b9d14530c5e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-14 10:14:37 +00:00
Tor Arne Vestbø
10c1625cd8 macOS: Move translations to their respective source files
lupdate can deal with Objective-C++ sources nowadays, most
likely due to appending them to SOURCES instead of the
deprecated OBJECTIVE_SOURCES.

Task-number: QTBUG-30125
Change-Id: Ifc6b06f13e0f679a011d999f11c2e6d25dcf27ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-14 12:13:10 +02:00
Thiago Macieira
bfb9b02d3b QCborValue: fix the move-assignment operator
The double-swap technique I used was flawed and broke on
self-assignment. What I had meant to use was the move-and-swap
technique. Thanks to Peppe for pointing it out.

This also fixes a compiler bug in the Green Hills compiler. It was
finding the wrong "swap" function in qSwap:

    using std::swap;
    swap(value1, value2);

It's supposed to find swap(QCborValue &, QCborValue &) due to argument-
dependent lookup. It's instead finding std::swap<QCborValue>, which
recurses.

Fixes: QTBUG-83390
Change-Id: Ibdc95e9af7bd456a94ecfffd1603e1bee90cd107
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-04-11 12:04:25 +00:00
Shawn Rutledge
1ec350e35f Stop using obsolete TouchPoint rect accessors in tests and examples
Followup to cf4a8b12fa
68916fede4 and
3c159957f8.

Task-number: QTBUG-83403
Change-Id: Ieaf418860c565dbe883384e7f296a829fbfa1e33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-10 13:54:43 +00:00
Thiago Macieira
9de8313b0b Fix warning about deprecated QComboBox::AdjustToMinimumContentsLength
Change-Id: Ibdc95e9af7bd456a94ecfffd1603f5c25dabf78e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-09 11:33:31 -03:00
Shawn Rutledge
cf4a8b12fa Remove more calls to deprecated TouchPoint functions
Followup to ed3ed0b9db
68916fede4 and
3c159957f8.

In QWindowSystemInterfacePrivate::fromNativeTouchPoints() and
QWindowSystemInterfacePrivate::toNativeTouchPoints() we continue using
struct TouchPoint's QRectF area as storage for the screen position +
ellipse diameters; as the comment says, this is _unrotated_, meaning
that rotation is stored separately, and area should not be construed as
the bounding box of the rotated ellipse. (In Qt 6 we can make the
QPA touchpoint look the same as the QTouchEvent::TouchPoint to
eliminate the need to calculate the center of the rect.)

In QGraphicsScenePrivate::updateTouchPointsForItem(), setRect() sets the
position and the ellipse diameters, but the latter is redundant because
the purpose of this function is to localize a touchpoint to the
coordinate system of a particular QGraphicsItem.  Ellipse diameters
should stay the same.

In QApplicationPrivate::updateTouchPointsForWidget(), as in
QGraphicsScene, we are localizing touchpoints to a widget
and to the screen that the widget is shown on, so only the position
needs to be set, while preserving the sub-pixel resolution that
mapFromGlobal(QPoint) loses.

Fixes: QTBUG-83403
Change-Id: I61d29e14cbe38567767b164af6ae895082c5e1a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-09 15:57:02 +02:00
Thiago Macieira
7cd2d2b751 tst_QFileInfo: fix running with systems without /etc/passwd
Clear Linux containers running as root may have no /etc/passwd. But
they'll have /etc/machine-id because systemd creates that. Also test
/proc/version (a Linux-specific file) because that isn't writeable even
by root.

Take the opportunity to check with access() instead of assuming root and
only root can write to the file.

Change-Id: Ibdc95e9af7bd456a94ecfffd1603e8359604752b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-09 10:55:25 -03:00
Thiago Macieira
f0ec2eb151 Fix warning about QMetaObject::isEditable() being deprecated
Change-Id: Ibdc95e9af7bd456a94ecfffd1603f482445bff28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-09 13:55:25 +00:00
Allan Sandfeld Jensen
712ed3d5d6 Switch to using versioned deprecated macros
Change-Id: I4728e6ecc7218a6c98fd3a10e50e6edd1704fb83
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-09 15:55:25 +02:00
Thiago Macieira
954d66e572 QCborArray: fix operator[] that extends the array
This was never tested. The infinite loop in QCborContainerPrivate::grow
is the proof.

[ChangeLog][QtCore][QCborArray] Fixed an infinite loop when operator[]
was called with with an index larger than the array's size plus 1.

Change-Id: Ibdc95e9af7bd456a94ecfffd1603df3855c73f20
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-09 09:41:56 -03:00
Thiago Macieira
57a57fda78 QCborMap: fix assigning elements from the map to itself
Similar to the QJsonObject issue of the previous commit (found with the
same tests, but not the same root cause). One fix was that copying of
byte data from the QByteArray to itself won't work if the array
reallocates. The second was that

  assign(*that, other.concrete());

fails to set other.d to null after moving. By calling the operator=, we
get the proper sequence of events.

[ChangeLog][QtCore][QCborMap] Fixed some issues relating to assigning
elements from a map to itself.

Note: QCborMap is not affected by the design flaw discovered in
QJsonObject because it always appends elements (it's unsorted), so
existing QCborValueRef references still refer to the same value.

Task-number: QTBUG-83366
Change-Id: Ibdc95e9af7bd456a94ecfffd1603df846f46094d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-09 09:41:40 -03:00
Thiago Macieira
ddc7b3c156 QJsonObject: add missing detach2() calls
The refactoring to use CBOR missed two places where we could assign from
the same object and thus cause corruption. In fixing this issue, I found
a design flaw in QJsonObject, see Q_EXPECT_FAILing unit test and task
QTBUG-83398.

[ChangeLog][QtCore][QJsonObject] Fixed a regression from 5.13 that
incorrect results when assigning elements from an object to itself.

Fixes: QTBUG-83366
Change-Id: Ibdc95e9af7bd456a94ecfffd1603df24b06713aa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-09 09:41:06 -03:00