Commit Graph

11419 Commits

Author SHA1 Message Date
Marc Mutz
44da43e8e4 QString: add char8_t overload of fromUtf8()
Use the overload-with-template trick from P1423 to avoid ambiguities
when existing callers pass 0 or nullptr.

Add a qdoc-ignored macro to hide the fact that the overload is a
template.

[ChangeLog][QtCore][QString] Added char8_t overload of fromUtf8().

Change-Id: Iaa2d365bfa161ef36cc73fa3bad50aabf34d01db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-23 06:31:28 +00:00
Thiago Macieira
727fab7d29 QCborMap: remove the optimization not to detach from non-const find()
All our tests were find() == end() or !=, which depends on the
evaluation order of the arguments to operator==(). If end() is called
first, then the detach happens before find() and all is well. But if
find() is called first, it may return end() before end() detaches.

[ChangeLog][QCborMap] Fixed a bug that could cause the iterator returned
from a failing key search with find() not to match end(). Now, every
call to find() will detach in shared QCborMaps; to avoid this, use
constFind() and constEnd().

Fixes: QTBUG-84583
Pick-to: 5.15 5.12
Change-Id: I552d244076a447ab92d7fffd161793496a8d03a8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-23 00:29:50 +00:00
Marc Mutz
ffb73175e6 QVarLengthArray: add missing move special member functions
A QVLA is copyable, so it should be movable, too.

Added a helper function a la P1144's uninitialized_relocate_n to deal
with the QTypeInfoQuery stuff. This way, the code is re-usable
everywhere it's needed. The same cannot be said for QArrayDataOps,
which only a parent can love...

[ChangeLog][QtCore][QVarLengthArray] Added missing move constructor
and move-assignment operator.

Task-number: QTBUG-39111
Change-Id: If0dc2aa78eb29062d73dcd3dc4647ba345ae39e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-22 17:24:07 +00:00
Jarek Kobus
95a5cd71b6 Use QList instead of QVector in concurrent tests
Task-number: QTBUG-84469
Change-Id: Ia8113ef044a918e46176bfa3f4b34781dc69dd03
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-06-22 16:46:01 +02:00
Jarek Kobus
b0792f391d Use QList instead of QVector in moc tests
Task-number: QTBUG-84469
Change-Id: I6a775b32a82658485216a4827a43503b395161c6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-22 16:45:55 +02:00
Timur Pocheptsov
c2bf56fc3a QSslSocket: remove certificate-related setters
They were deprecated with replacements in QSslConfiguration proposed (and
some without alternative, which we'll provide if there is any demand
in such an API). Special thanks to M.N. for a nice hint on how to
amend the test without introducing a new API.

Change-Id: I7841a5b3f30469d8204b61cb65921c34275e0650
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-22 12:11:47 +02:00
Shawn Rutledge
29d3e7ce38 Replace "no devices registered" warnings with qCDebug
The idea was to keep nagging us to update all the platform plugins to
do device registration. But besides being annoying, it would cause
test failures if we start adding QTest::ignoreMessage() all over,
and then some platforms start doing device registration properly.

Change-Id: Ia0fbb64cf86f33532be032ec9eebe6e4ad607f20
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-22 11:22:17 +02:00
Andy Shaw
8ba9d2e022 Change boundValues() to return a QVariantList
This enables the order of boundValues to be consistent as with a QMap
it could have been reordered which can be a problem for positional
bindings.

[ChangeLog][QtSQL] Changed signature of QSqlQuery::boundValues() to
return a QVariantList

Fixes: QTBUG-51609
Change-Id: I1c80fa8522fa7352723420b6fc9ec466406315fb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-22 06:54:16 +02:00
Christian Ehrlicher
26a2266304 Remove deprecated QStyleOption::init()
Even it was not marked as deprecated the replacement function initFrom()
is available since Qt4 times (and init() is deprecated since then)

Change-Id: I09a4ebbf66b01fbe7aec67691dc68d2e42d1cd78
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-21 12:51:24 +02:00
Lars Knoll
03326a2fec Move implementation of QVector/List back to qlist.h
And name the main class QList. That's also the one we document.

This gives less porting pain for our users, and a lot less churn
in our API, as we use QList in Qt 5 in 95% of our API.
In addition, it gives more consistent naming with QStringList and
QByteArrayList and disambiguates QList vs QVector(2|3|4)D.

Fixes: QTBUG-84468
Change-Id: I3cba9d1d3179969d8bf9320b31be2230d021d1a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-20 20:01:33 +02:00
Karsten Heimrich
18ec53156e Move QTextCodec support out of QtCore
* Assume UTF-8 on all Unix like systems
* Export some functions to be able to compile QTextCodec once
  moved to Qt5Compat.

Task-number: QTBUG-75665
Change-Id: I52ec47a848bc0ba72e9c7689668b1bcc5d736c29
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-20 02:04:38 +02:00
Giuseppe D'Angelo
3e1d03b1ea Port Q_STATIC_ASSERT(_X) to static_assert
There is no reason for keep using our macro now that we have C++17.
The macro itself is left in for the moment being, as well as its
detection logic, because it's needed for C code (not everything
supports C11 yet).  A few more cleanups will arrive in the next few
patches.

Note that this is a mere search/replace; some places were using
double braces to work around the presence of commas in a macro, no
attempt has been done to fix those.

tst_qglobal had just some minor changes to keep testing the macro.

Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-19 19:38:23 +02:00
Robert Loehning
96065b7227 Fuzzing: Test svg images
Pick-to: 5.15
Change-Id: I1467d07eaaa1233417cd3a18fd65ec3322181984
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2020-06-19 19:16:28 +02:00
Shawn Rutledge
f25bd998a7 Don't return a touchscreen from QPointingDevice::primaryPointingDevice()
This was causing some bogus failures in Qt Quick autotests.
Existing APIs like QQuickWindow::mouseGrabberItem() are not really
compatible with the idea of a mouse-less system; but perhaps we can
revisit this later.

Task-number: QTBUG-85114
Change-Id: Id1c2e5894e5cf13a79998aaea28d5f42fad920cf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-06-19 08:13:36 +02:00
Shawn Rutledge
28ef8d283d Add QPointingDevice argument to every QWSI input event handler function
We want every QInputEvent to carry a valid device pointer. It may be
some time until all QPA plugins are sending it, but it's necessary to
provide the functions for them to start doing that.

We now try to maintain the same order of arguments to all the functions.
handleTouchEvent(window, timestamp, device, the rest) was already there
(except "device" has changed type now), and is used in a lot of platform
plugins; so it seems easiest to let that set the precedent, and modify
the rest to match. We do that by adding new functions; we can deprecate
the older functions after it becomes clear that the new ones work well.

However the handleGestureEvent functions have only ever been used in
the cocoa plugin, so it's easy to change their argument order right now.

Modify tst_qwindow::tabletEvents() to test new tablet event API.

Task-number: QTBUG-46412
Change-Id: I1828b61183cf51f3a08774936156c6a91cfc9a12
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-18 18:53:40 +02:00
Andrei Golubev
68de38ded1 Document QPromise API
Documented QPromise. Added snippets under auto tests
to ensure they are compiled and run in CI.

Task-number: QTBUG-81586
Change-Id: I20084e38f9d2f6fc8540f95ee03ec3d2827177e8
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-18 18:28:41 +03:00
Simon Hausmann
b0f445a152 Add support for QNotifiedProperty to the moc
Change the meaning of Q_PRIVATE_QPROPERTY to imply that the property is
implemented using a QNotifiedProperty. That requires passing the owner
object instance to the value and binding setters.

Similarly, detect QNotifiedProperty members like QProperty.

Change-Id: If49bbb04c8ccd4a661973888c50d2d556c25034f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-18 17:26:11 +02:00
Lars Knoll
7b5d5faae1 Remove unused functionality from QTypeInfo
Change-Id: I10fe4cde7a18047599e656cc3bb67b0dfe18a986
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-18 12:02:51 +02:00
Shawn Rutledge
f04cb9ed63 Begin writing tst_QInputDevice autotest
...starting with a new feature: registering different devices at
different seats and verifying their capabilities and that we can get
them back again.

Change-Id: I8e58a49080633753d02a76e5fdc4932f5c674e0a
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-06-18 08:05:44 +02:00
Shawn Rutledge
9b72900834 Update QTabletEvent device_information manual test
- stop using deprecated accessors in QTabletEvent and QMouseEvent
- position() and globalPosition() provide high resolution so
  we don't need to display hi-res global pos separately
- keep a pointer to the last-seen QPointingDevice instance
  rather than copying fields out of it; it will only be deleted
  if the platform plugin does that (usually only at exit or
  when it's unplugged)
- show seat ID
- show platform-specific device ID

Change-Id: Ic34e1d1256d6956867992db831c2e66bdda7001e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-17 09:12:20 +02:00
Shawn Rutledge
6589f2ed0c Introduce QInputDevice hierarchy; replace QTouchDevice
We have seen during the Qt 5 series that QMouseEvent::source() does
not provide enough information: if it is synthesized, it could have
come from any device for which mouse events are synthesized, not only
from a touchscreen. By providing in every QInputEvent as complete
information about the actual source device as possible, we will enable
very fine-tuned behavior in the object that handles each event.

Further, we would like to support multiple keyboards, pointing devices,
and named groups of devices that are known as "seats" in Wayland.

In Qt 5, QPA plugins registered each touchscreen as it was discovered.
Now we extend this pattern to all input devices.  This new requirement
can be implemented gradually; for now, if a QTWSI input event is
received wtihout a device pointer, a default "core" device will be
created on-the-fly, and a warning emitted.

In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when
multiple devices were in use simultaneously. Now that each event
identifies the device it came from, this hack is no longer needed.

A stub of the new QPointerEvent is added; it will be developed further
in subsequent patches.

[ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer
to an instance of QInputDevice, or the subclass QPointingDevice in case
of mouse, touch and tablet events. Each platform plugin is expected to
create the device instances, register them, and provide valid pointers
with all input events. If this is not done, warnings are emitted and
default devices are created as necessary. When the device has accurate
information, it provides the opportunity to fine-tune behavior depending
on device type and capabilities: for example if a QMouseEvent is
synthesized from a touchscreen, the recipient can see which touchscreen
it came from. Each device also has a seatName to distinguish users on
multi-user windowing systems. Touchpoint IDs are no longer unique on
their own, but the combination of ID and device is.

Fixes: QTBUG-46412
Fixes: QTBUG-72167
Task-number: QTBUG-69433
Task-number: QTBUG-52430
Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-06-16 22:06:56 +02:00
Laszlo Agocs
9b8d4a9e45 rhi manual tests: Prevent warnings with MSVC
The QPair changes trigger warnings about size_t vs. quint32.

We made offsets and sizes 32-bit in the QRhi API to emphasize that
some of the graphics APIs are using 32-bit sizes still. It's a bit
unfortunate that pairs now generate warnings when the size does not
match. Just cast as needed.

Change-Id: I88504eed8be6f4bdb2205b3671e2c2a9db9fcb1e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-15 15:34:05 +02:00
Laszlo Agocs
ed231455cc Relax tst_qvulkan::vulkanVersionRequest to make it compatible with 1.1
The Vulkan spec changed the behavior for VkApplicationInfo::apiVersion
in 1.1, conveniently breaking compatibility with all existing 1.0 logic.

We can no longer assume that the 1.0 behavior, which was failing instance
creation with VK_ERROR_INCOMPATIBLE_DRIVER for an unsupported version,
is always in place. So do not rely on this in the test, and add a
reminder in QVulkanInstance docs as well.

Fixes: QTBUG-85040
Change-Id: I8f5c7a7830877b72d106c444aebfaea191083ee0
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-06-15 15:33:46 +02:00
Robert Loehning
927a82f5e0 Fuzzing: Don't try to load huge valid images
They are justified in using huge memory.

Pick-to: 5.15
Change-Id: Id16d2ea67cfac0e031d05258173391e222b41097
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-15 09:31:56 +00:00
Mårten Nordheim
306ebe03ea Http: Fix POST-to-GET redirects still uploading or transmitting CL
CL = Content-Length

The uploadByteDevice was kept after a redirect which caused the
internals to assume that we had to upload the data. Even if this was
not the case we still transmitted the Content-Length header from the
first request which was now stored in two places.

Fixes: QTBUG-84162
Pick-to: 5.15
Change-Id: Ic86b1ef0766ffcc50beeed96c1c915b721d40209
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-06-12 16:11:55 +02:00
Lars Knoll
5caf7ef3b1 Remove deprecated methods
Those aren't part of Qt 6 anymore.

Change-Id: I9ea7de07d89156e8d0fb6ae9deeb24e0de5fa429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-12 15:50:08 +02:00
Timur Pocheptsov
8a65cd8dcd long_name_onDemandCerts_static - stop testing/using the deprecated API
Pick-to: 5.15
Change-Id: Ia937fc393b2dbc2602a93f2b3a71328a805ec1a6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-12 14:09:23 +02:00
Timur Pocheptsov
b7724048f9 long_name_onDemandCerts_member - stop testing/using the deprecated API
Pick-to: 5.15
Change-Id: I3d7ea78627afcd0225e717d243da49fd70b58461
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-12 14:09:04 +02:00
Timur Pocheptsov
56187f1e45 tst_qsslcertificate - suppress a deprecation warning
In Qt 5 we have to work with the esisting API (QSslCertificate::verify),
taking only the peer's chain and the name. We already have a private
API to have a CA's list as an additional parameter, the proper fix
in Qt6 will also introduce a public complement for this.

Pick-to: 5.15
Change-Id: Ib1f75c3056b135c6e6d42f977b5a7034fca658ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-12 14:08:55 +02:00
Marc Mutz
3f6142f5a1 Rename new slice() method sliced()
The recently-added slice() method has the problem that it's a noun
as well as a verb in the imperative. Like std::vector::empty, which
is both an adjective and a verb in the imperative, this may cause
confusion as to what the function does. Using the passive voice form
of slice(), sliced(), removes the confusion. While it can be read as
an adjective, too, that doesn't change the meaning compared to the
verb form.

Change-Id: If0aa01acb6cf5dd5eafa8226e3ea7f7a0c9da4f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 19:14:03 +00:00
Lars Knoll
d0689ec867 Get rid of the obsolete isEditable flag for properties
Change-Id: I54411bd8e223671523c9c8fad5c80bfa6b5b7097
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-11 19:39:56 +02:00
Fabian Kosmale
630c7b4811 Cleanups in QMetaProperty
This changes the layout of the meta object data, so
also bump the meta object revision.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I176fb16c207e8ebe59e358e69554be813406232f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 19:39:54 +02:00
Lars Knoll
5603be705e Qt6: remove support for property flags being functions
Property flags should be compile time booleans, not something to
be determined at runtime.

We've been using this to dynamically disable some properties in QWidget
based classes dependent on the state of a different property, but this
should better get implemented on top of our widgets.

Change-Id: I6296e8761303ecdf24d9e842142e8596304c015d
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-11 19:39:53 +02:00
Lars Knoll
8ea11e0cf7 Remove most overloads taking a QStringRef from the QString API
Add QStringView overloads where they were missing. This keeps things
almost 100% source compatible.

Task-number: QTBUG-84319
Change-Id: Ica8ee773b2ce655e9597097786117959e34b236e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-11 15:52:25 +02:00
Volker Hilsheimer
f9940b15f7 Fix breakage of QPushButton on macOS when a style sheet was set
Amends comment 6e1d70ae12, which
introduced SE_PushButtonBevel so that QPushButton could ignore clicks
outside of the button's bevel.

In the macOS style, make sure that the framerect we pass to
NSButton::alignmentRectForFrame is the rect we receive from QPushButton
in the style options. The frame property of the shared NSButton* object
might not be initialized.

In the style sheet style, handle SE_PushButtonBevel the same ways as
Contents and FocusRect, as it is not a separately styleable property.

Change-Id: I12eb1b046c864a02b34d276e6352e2e16d44231e
Fixes: QTBUG-84852
Fixes: QTBUG-84879
Task-number: QTBUG-81452
Pick-to: 5.15
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-06-11 15:52:25 +02:00
Marc Mutz
c549ff3fd4 Also check QStringView(std::nullptr_t) for constexpr'ness
Pick-to: 5.15
Change-Id: I85967caa014fa93d2cd3f26b63e4a85414f6a803
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-11 08:24:13 +02:00
Lars Knoll
ecacb3c62f Port QLocale::quoteString from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I29726ebfda7a5f51a0a6ee29e905b0b904256c8d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-11 02:50:16 +02:00
Timur Pocheptsov
7d98964815 tst_QSslSocket - stop using qrand (to suppress a warning)
Whoever wrote this test, was a PROPER hacker: trying to force a TLS implementation
not to properly compress some data, they generated a sequence of bytes in a very fancy manner,
something like 255 0 0 0 255 0 0 0 123 0 0 0 255 0 0 0 - yeah, it's really a random sequence
of bytes, surely, it's impossible to compress! Meh.

Pick-to: 5.15
Change-Id: Ia10ae18a40b5b8f006c45147b06fe5be6efcb129
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-10 22:55:49 +02:00
Shawn Rutledge
84e76c37a5 Restore default role names in QStandardItemModel::roleNames()
Amends 32b586864e, which added an override
of QStandardItemModel::roleNames().  It's good for it to have its own
QHash so that roles can be added, and because
QStandardItemModel::setItemRoleNames() remains un-deprecated; but before
that change, they were the roles that QAbstractItemModel had initialized
from QAbstractItemModelPrivate::defaultRoleNames().  In particular, we
need "display" to map to Qt::DisplayRole by default; several tests in
qtdeclarative depend on that.

Change-Id: I58b2d6aa6b6c78b1d618335ddc4ecb834af57274
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 19:58:48 +02:00
Giuseppe D'Angelo
8e98a161e9 Long live std::pair!
Make QPair an alias for std::pair, and qMakePair just a forwarder
towards std::make_pair.

Why? Fundamentally to ditch a bunch of NIH code; gain for free
structured bindings, std::tuple and std::reference_wrapper
compatibility, and so on.

Breakages:

* Some that code manually forward declares QPair.
We don't care about it (<QContainerFwd> is the proper way).

* Some code that overloads on std::pair and QPair. Luckily
it's mostly centralized: debug, metatypes, testing macros.
Just remove the QPair overload.

* Usages of qMakePair forcing the template type parameters.
There are a handful of these in qtbase, but only one was actually
broken.

* std::pair is NOT (and will never likely be) trivially copiable.
This is agreed to be a mistake done by practically all implementations
in C++11, can can't be fixed without breaking ABI.
Some code using QPair assuming it's trivially copiable may break;
exactly one occurrence was in qtbase.

* QMetaType logic extracts the type names in two different ways,
one by looking at the source code string (e.g. extracted by moc)
and one via some ad-hoc reflection in C++. We need to make
"QPair" (as spelled in the source code) be the same as "std::pair"
(gathered via reflection, which will see through the alias)
when compared. The way it's already done e.g. for QList is
by actually replacing the moc-extracted name with the name
of the actual type used in C++; do the same here.
On libc++, std::pair is actually in an inline namespace --
i.e. std::__1::pair; the reflection will extract and store
"std::__1::pair" so we need an ad-hoc fix to QMetaType.

[ChangeLog][QtCore][QPair] QPair is now an alias to std::pair,
and does not exist as a class in Qt any more. This may break
code such as functions overloaded for both QPair and std::pair.
Usually, the overload taking a QPair can be safely discarded,
leaving only the one taking a std::pair. QPair API has not changed,
and qMakePair is still available for compatibility (although
new code is encouraged to use std::pair and std::make_pair
directly instead).

Change-Id: I7725c751bf23946cde577b1406e86a336c0a3dcf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-10 16:49:08 +02:00
Timur Pocheptsov
d9b2115060 tst_QSslSocket - do not test the deprecated API
We deprecated several setters on QSslSocket, no need to test
them then (and I'm removing them in Qt 6 anyway, so changing
the test is the phase 1).

Pick-to: 5.15
Change-Id: I5807abfb280cbacd4fcc19468793f9d1f3b2ff20
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-10 16:47:48 +02:00
Eirik Aavitsland
56f40cdca6 Remove the openglextensions module
[ChangeLog][General] The QtOpenglExtensions module has been
discontinued. It provided only convenience functionality for certain
direct OpenGL usage. With the new RHI graphics API abstraction, that
is no longer a primary use case. Applications that still need to
access that API have a number of alternative options, including
QOpenGLExtraFunctions.

Fixes: QTBUG-84085
Change-Id: I272af61c69ebcec207b576d67d08b59623d485ec
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-10 09:35:04 +02:00
Lars Knoll
d2833a3ce5 Ensure left/right/mid behave in a compatible way
QString and QStringRef did bounds checking for left/right/mid, whereas
QStringView was asserting on out of bounds.

Relax the behavior for QStringView and do bounds checking on pos/n
as well. This removes a source of potentially hidden errors when porting
from QStringRef (or QString) to QStringView.

Unfortunately, one difference remains, where QByteArray::left/right()
behaves differently (and somewhat more sane) than QString and
QStringRef. We're keeping the difference here, as it has been around
for many years.

Mark left/right/mid as obsolete and to be replaced with the new
first/last/slice methods.

Change-Id: I18c203799ba78c928a4610a6038089f27696c22e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-09 16:51:16 +02:00
Andrei Golubev
385f0732d9 Add QPromise implementation
QPromise and QFuture created from it share the same internal state
(namely, QFutureInterface object). QPromise provides high-level
management of the shared resource, ensuring thread-safe behavior
on construction and destruction (also taking into account
QFuture::waitForFinished() semantics).

QFuture acts as a primary controller of QPromise via action
initiating methods such as suspend() or cancel(). QPromise is
equipped with methods to check the status, but the actual
handling of QFuture action "requests" is user-defined.

[ChangeLog][QtCore][QPromise] Added QPromise class to accompany
QFuture. It allows one to communicate computation results and
progress to the QFuture via a shared state.

Task-number: QTBUG-81586
Change-Id: Ibab9681d35fe63754bf394ad0e7923e2683e2457
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-09 17:21:38 +03:00
Fabian Kosmale
4c32443bc9 metatype: Do not try analyze T in Q*Pointer<T> if T is incomplete
Change-Id: I41737ce470f6d2b071ad5e85f8cad1da3869241c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-09 14:20:31 +02:00
Alexandru Croitor
db1de48291 CMake: Fix failing plugin tests on MinGW
MinGW plugins should not have the lib prefix in the shared library
names. Do this manually for a couple of libraries, and also for the
generic qt_add_cmake_library function.

Amends 9b0e23ef8a

Change-Id: I1cfaf8fc046f86edd3e755adfa599aa0aa854ee3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-09 09:34:17 +02:00
Volker Hilsheimer
44fb925f50 Phase 2 of removing QDesktopWidget
Remove QDestopWidget public header, simplify the implementation that
maintains a Qt::Desktop type QWidget for each QScreen, and turn
QWidget's initial target screen into a QScreen pointer.

QApplication::desktop() now takes an optional QScreen pointer, and
returns a QWidget pointer, so that applications and widgets can get
access to the root widget for a specific screen without having to
resort to private APIs.

QDesktopWidgetPrivate implementations to look up a screen for an index,
widget, or point are now all inline functions that thinly wrap
QGuiApplication::screens/screenAt calls. We should consider adding those
as convenience APIs to QScreen instead.

Note that QWidget::screen is assumed to return a valid pointer; there is
code that handles the case that it returns nullptr (but also code that
trusts that it never is nullptr), so this needs to be defined, verified
with tests, and asserted. We can then simplify the code further.

Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-08 20:29:49 +02:00
Shawn Rutledge
a061a64642 Replace calls to deprecated QEvent accessor functions
Many of these were generated by clazy using the new qevent-accessors check.

Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-08 19:11:51 +02:00
Eskil Abrahamsen Blomfeldt
078c3b7d68 Remove deprecated text-related enums
Fixes: QTBUG-82367
Change-Id: Iff2645759657f8e350754e90e791dbd583017671
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-08 15:04:19 +02:00
Eskil Abrahamsen Blomfeldt
18e8519dcd Win: Choose a suitable font in tst_QTextLayout::textWidthVsWIdth
The default font on Windows 10 (Segoe UI) will return the
wrong minimum right bearing at some sizes, which will cause
us to skip the textWidthVsWIdth() test at some scale factors,
since we cannot trust the layout to be perfect in this case.

Based on experiment, Arial is more accurate, so in order to
avoid skipping the test, we default to this on Windows instead.
(Note: The problem has not been observed with the default fonts
on Linux or macOS, so we only do this for Windows specifically.)

Task-number: QTBUG-84415
Pick-to: 5.15
Change-Id: I8cdb5d0d9922915a6ed1574d62a561dda0e1dc5d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-08 13:03:48 +00:00
Lars Knoll
38096a3d70 Implement first/last/from and slice() for string-like classes
These methods are scheduled as a replacement for left/right/mid()
in Qt 6 with a consistent, narrow contract that does not allow
out of bounds indices, and therefore does permit faster
implementations.

Change-Id: Iabf22e8d4f3fef3c5e69a17f103e6cddebe420b1
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-08 13:17:32 +02:00
Eskil Abrahamsen Blomfeldt
3279c8e7d7 Move some flaky text tests into Lancelot
There are some slight differences between normal drawText()
and QGlyphRuns/QStaticText for decoration widths in certain
fonts. We decided to accept this and tried working around it
in the test by using ForceIntegerMetrics (since the difference
is < 0.5 pixel). This enum has been deprecated, so we move
the tests into Lancelot instead, since the idea here is to
test for regressions, not to compare the two painter commands.

Note that there is something off about decorations with
drawGlyphRuns() and drawStaticText() which is exposed
(not caused) by this, perhaps related to using a matrix
for positioning, since that was untested before.

This also takes the liberty of moving the emoji test string
from text.qps, since this was not in the statictext.qps yet.

Change-Id: Ib2d697095cbd11829cdd50b3c0268c85e9607c78
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-08 06:45:49 +02:00
Oliver Wolff
45b0f1be68 Remove winrt
Macros and the await helper function from qfunctions_winrt(_p).h are
needed in other Qt modules which use UWP APIs on desktop windows.

Task-number: QTBUG-84434
Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-06 20:25:49 +02:00
Giuseppe D'Angelo
c0f7ecab20 QVariant: remove UB and fix semantics in a test
The code was reading from uninitialized memory when creating a
variant. Fixing that reveals that the test semantics
are broken: when dealing with datatypes without a registered
operator==, QVariant resorts to memcmp, so the two objects
would've actually compared equal. Amend that.

Change-Id: I36bad7ee6a45154d5d534b7dd8b618cc0a900126
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-06 13:29:34 +02:00
Marc Mutz
ee63557112 QString/View: add tokenize() member functions
[ChangeLog][QtCore][QString, QStringView, QLatin1String] Added tokenize().

Change-Id: I5fbeab0ac1809ff2974e565129b61a6bdfb398bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-06 02:07:28 +00:00
Allan Sandfeld Jensen
999c79863c Remove QThreadPool::cancel()
Deprecated in 5.9

Change-Id: Ib6e2a5da1e7ee2664fb6fa496bdc880fab870901
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-06-05 20:57:32 +02:00
Eskil Abrahamsen Blomfeldt
a389001710 Fix compilation of lance tool
The QLayout::setMargin(x) call has been deprecated since Qt 5.13.
It was an alias for setContentsMargins(x, x, x, x) so we just
replace it with that.

Change-Id: I1c89eebfe776e0e3c8d0bdc19244bd452db4ef3c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-05 14:26:41 +02:00
Edward Welbourne
5f8c6f1760 Rework testing of qstr*cmp() functions
Previously only qstr*icmp() were tested and the test data was sent via
QString and {en,de}coding. Use a local data-type to package pointers
to actual string literals for passing to these functions that take
them.  Fold the various tests involving null pointers and empty
strings into the general testing, removing from "singularity" tests,
and combine the remainders of those tests into a single test of
singular cases for QByteArray::ompare.  Move all these tests to
alongside the existing tests for QByteArray::compare.  Use nullptr
rather than 0 as the null string.

Change-Id: Ie6d01e839c330c2f960af4bcc95e5633539337d6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-05 12:13:05 +02:00
Liang Qi
ee8ba0e0ca Revert "Disable tests with qemu-arm & developer-build configurations in the CI"
We don't want to have untested qtbase.

This reverts commit 3598ffcc26.

This change also skips two network tests on b2qt.

Change-Id: I5c6f5e19487775f0a1c0feafa5e085208cbf7e9a
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-06-05 12:10:07 +02:00
Jarek Kobus
79fd1cb2c6 Reuse the non blocking implementation for blocking one
Replace the implementation of blockingMappedReduced():
after calling non-blocking version of mappedReduced() we are getting
the future object, so we may call in sequence result(), which
will block and return the result when the all tasks are done.

The same is done with blockigMapped(), which calls blockingMappedReduced()
with a custom reduce function.

Looks like with this pattern we can reuse the non-blocking version
for implementing blocking version of mapped / filtered methods.

Task-number: QTBUG-83918
Change-Id: I7f240cfbd04834d551ff79d717b72194a26996d7
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-05 12:09:59 +02:00
Lars Knoll
c49728eb27 Port qmake from QStringRef to QStringView
Change-Id: Ie07a976cd3c634e04c8b9b1e0a6cacd4c2d94939
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-05 09:07:14 +02:00
Alexandru Croitor
6f8ecc2497 CMake: Fix tst_qclipboard test on macOS
The helper processes were not in the correct location.

Change-Id: I0a80a22a931625ea0c9370db38ff29c881b964cb
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 23:21:13 +02:00
Alexandru Croitor
4ada40c08d CMake: Fix tst_quuid to pass on macOS
The helper executable needs to be a bundle, because that's
what the test expects.

Change-Id: I7c3f72f12b7a744478b4832685d032abfc679e5b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 23:21:09 +02:00
Alexandru Croitor
0cbd307d6a CMake: Regenerate tests/auto/other project
Change-Id: I0dbcef3c918b9502528bf2fe0907a7582dcde0ea
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 23:21:00 +02:00
Alexandru Croitor
9b1190fd68 CMake: disable macnativeevents tests
It's disabled in qmake too, due to being almost all blacklisted
and flaky. Plus locally when i tested, i had to give accessibility
permissions manually, otherwise it failed.

Change-Id: I55ce7a81c46ac28f41c43f5c159fecc22d489966
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 23:20:55 +02:00
Alexandru Croitor
f52a48d963 CMake: Fix tst_qregexp test
It was missing the resource files.

Change-Id: Iaa97922eaedc8ba55ef4e568a6abfcffd19509fa
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 23:20:49 +02:00
Fabian Kosmale
1a3c9df90a tst_qobject: fix build when exceptions are disabled
Change-Id: Id98d39b4cc14608661a53df7e5c5bba5fb875022
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-04 22:43:59 +02:00
Sona Kurazyan
37cfc3c6d2 Deprecate the pause-related APIs of QFuture* classes
Deprecated the pause-related APIs of QFuture* classes and
added alternatives having "suspend" in the name instead.

With 2f15927f01 new
isSuspended()/suspended() APIs have been added to QFuture* classes for
checking if pause/suspension is still in progress or it already took
effect. To keep the naming more consistent, renamed:

 - setPaused() -> setSuspended()
 - pause() -> suspend()
 - togglePaused() -> toggleSuspended()
 - QFutureWatcher::paused() -> QFutureWatcher::suspending()

Note that QFuture*::isPaused() now corresponds to (isSuspending() ||
isSuspended()).

[ChangeLog][Deprecation Notice] Deprecated pause-related APIs of
QFuture and QFutureWatcher. Added alternatives having "suspend" in
the name instead.

Change-Id: Ibeb75017a118401d64d18b72fb95d78e28c4661c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-06-04 22:32:43 +02:00
Miika Pernu
036c3c19e7 Fix to crash in QWindow::event when delete this called on closeEvent
Starting from Qt 5.11 QWindow::event is called after QDialog::closeEvent
which would cause a crash if "delete this" was called on closeEvent.  The commit
that changed this was e0b5ff4ad5. Added
a check before QWindow::event call utilizing QPointer to prevent the
function call in case object is destroyed by a user in close event handler.

Change-Id: I64a4a0f3271714e55bf7e806177f0d8b39b67fa3
Fixes: QTBUG-84222
Pick-to: 5.15 5.12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-04 20:29:38 +00:00
Volker Hilsheimer
94dcb5454f Remove the deprecated QDirModel
QFileSystemModel is the documented replacement. It uses threads to
populate the model, which QDirModel doesn't.

Change-Id: I7818ecd8f849eb566ac176612f382e17a0471c47
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-04 19:11:19 +02:00
Timur Pocheptsov
6d6bfcb9ad QtNetwork remove deprecated signals
Use 'errorOccurred' instead of 'error' and 'sslHandshakeErrors'
instead of 'sslErrors'.

Fixes: QTBUG-82605
Change-Id: I19d4845b16c7b636af7b0658d4fbbba4eef9d029
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-04 15:58:02 +02:00
Giuseppe D'Angelo
77a8005dcb QStringBuilder: code tidies in the tests
Including other headers, while defining very questionable macro
names, can and will result in trouble. Stop doing that.

While at it, move from including <QtTest> to include-what-you-use,
and clean up the code a bit.

Change-Id: Idb02ef2b612c0805baecac3ce6edd435609aca4c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-04 15:58:02 +02:00
Edward Welbourne
9dd8e655cd Limit QByteArray's 8-bit support to ASCII
Previously it handled Latin-1, which made it incompatible with UTF-8,
which is now our preferred 8-bit encoding. For Qt6 it is limited to
ASCII. Adjusted tests to match. QLatin1String::compare() turned out
to be relying on qstrnicmp()'s Latin-1 handling.

Removed some spurious Q_UNLIKELY()s and tidied up code a little in the
process.

[ChangeLog][QtCore][Important Behavior Changes] Encoding-dependent
features of QByteArrray are now limited to ASCII, where previously
they worked for the whole of Latin-1. This affects case-insensitive
comparison, notably including qstricmp() and qstrnicmp(), and
case-transforming functions.

Fixes: QTBUG-84323
Change-Id: I2925d9908f8654599195a2860847b17083911b41
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-04 10:39:53 +02:00
Marc Mutz
6a3c6f939f Long live QStringTokenizer!
This class is designed as C++20-style generator / lazy sequence, and
the new return value of QString{,View}::tokenize().

It thus is more similar to a hand-coded loop around indexOf() than
QString::split(), which returns a container (the filling of which
allocates memory).

The template arguments of QStringTokenizer intricately depend on the
arguments with which it is constructed, so QStringTokenizer cannot be used
directly without C++17 CTAD. To work around this issue, add a factory
function, qTokenize().

LATER:
- ~Optimize QLatin1String needles (avoid repeated L1->UTF16 conversion)~
  (out of scope for QStringTokenizer, should be solved in the respective
  indexOf())
- Keep per-instantiation state:
  * Boyer-Moore table

[ChangeLog][QtCore][QStringTokenizer] New class.

[ChangeLog][QtCore][qTokenize] New function.

Change-Id: I7a7a02e9175cdd3887778f29f2f91933329be759
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-06-03 19:13:54 +02:00
Jonas Karlsson
1b33ee95e5 Use QByteArray instead of QString
Since the variable names in QShaderDescription are later compared to
QByteArrays we can gain some performance from not having to convert them
to QByteArrays later.

Task-Id: QTBUG-83706
Change-Id: Iaf80d0966f45cbb09e7c1000b7854bc488e57bb3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-03 18:56:21 +02:00
Ulf Hermann
07ded4912f Fix and compactify QNotifiedProperty
The static observer can live in a union with the inline observers. We
only need to take care of calling the ctors and dtors manually then.

In order for any observers to be called in the presence of a static
observer, the static observer has to be called after the other
observers.

Change-Id: I2f56fa64f3fe6fcd7f06cc403929362da7d86f65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-03 18:53:40 +02:00
Alex Trotsenko
33e6e5fac3 QEventDispatcherWin32: retrieve PM_REMOVE value as a bit flag
Windows unexpectedly passes PM_NOYIELD flag in wParam parameter to the
hook procedure, if ::PeekMessage(..., PM_REMOVE | PM_NOYIELD) is called
from the event loop. So, to ignore undocumented flag, we should
interpret wParam as a bit field.

Thanks to Robin Lobel for research.

Pick-to: 5.15
Fixes: QTBUG-84562
Change-Id: Ib16d7d747aebc9a3628e4ee67478c4d3edeb96f1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-03 19:36:34 +03:00
Tor Arne Vestbø
93a04332eb Move QtAccessibilitySupport into QtGui
Task-number: QTBUG-83255
Change-Id: Ibc1b38e77c3c90030a832c41f4de65c6c38bc91d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-02 23:32:36 +02:00
Fabian Kosmale
47c6466d0a QMetaType: create metatype for void
Create a QMetaTypeInterface for void. This allows us differentiate
QMetaType::Unknown from QMetaType::Void. In addition, this will enable
the usage of QMetaMethod::metaReturnType in QMetaMethod::returnType,
and will facilitate using metaReturnType in declarative, which needs to
distinguish between Unknown and Void.

Change-Id: I83296b49587f3deb7ec73e25a33f0d8c98cf8da0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-02 22:42:15 +02:00
Fabian Kosmale
649d834443 add unit test for QMetaMethod::revision
Change-Id: I724702d8ac9a75fefd848afccf4f4de9fc0ba4af
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-06-02 22:42:15 +02:00
Fabian Kosmale
fa987d4441 MetaObject: Store the QMetaType of the methods
This does the analog of 46f407126e for the
methods we care about (signals, slots, Q_INVOKABLEs). In addition to the
actual QMetaType, we store an array with offsets so that we later can do
a mapping from methodIndex to metatype.

The newly added QMetaMethod::{return,parameter}MetaType methods can then
be used to retrieve the metatypes.

This does however require that all involved types are complete. This is
unfortunately not a feasible requirement. Thus, we only populate the
metatype array on a best effort basis. For any incomplete type, we store
QMetaType::Unknown. Then, when accessing the metatype, we fall back to
the old string based code base if it's Unknown.

Squashes "moc: support incomplete types" and  "Fix compile failures
after QMetaMethod change"


Fixes: QTBUG-82932
Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-02 22:42:15 +02:00
Lars Knoll
4c5f6eb74c Stabilize autotest
calling emplace() on a std::vector with a reference
pointing into the same vector is undefined behavior.
Fix this by using a temporary inbetween.

Change-Id: I47c28700dffa2107fb0cba302168c86b659eafb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-01 20:57:55 +02:00
Lars Knoll
aac39167b7 Add QStringView::split() methods
Since QString::split() is not going away in Qt 6, we should aim
to provide API symmetry here, and ease porting existing code from
QString(Ref) to use QStringView.

This is easier than having to port everything to use tokenize() at
the same time. tokenize() will however lead to better performance
and thus should be preferred.

Change-Id: I1eb43300a90167c6e9389ab56f416f2bf7edf506
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-01 20:43:21 +02:00
David Faure
4f1ebf666e QMimeType::suffixForFileName shouldn't lowercase the file suffix
It was returning a lowercased suffix because it was extracting it from
the pattern (*.txt) rather than from the filename ("README.TXT").

This broke expectations on the application side, since this method is
documented to return a suffix from the given filename.

Ref: https://bugs.kde.org/show_bug.cgi?id=402388

Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-01 13:36:05 +02:00
Giuseppe D'Angelo
529f052add Port QRegularExpression to QStringView, drop QStringRef
The idea is pretty simple -- add QRegularExpression matching over
QStringView. When matching over a QString, keep the string
alive (by taking a copy), and set the view onto that string.
Otherwise, just use the view provided by the user (who is then
responsible for ensuring the data stays valid while matching).

Do just minor refactorings to support this use case in a cleaner
fashion.

In QRegularExpressionMatch drop the QStringRef-returning methods, as
they cannot work any more -- in the general case there won't be a
QString to build a QStringRef from.

[ChangeLog][QtCore][QRegularExpression] All the APIs dealing
with QStringRef have been ported to QStringView, following
QStringRef deprecation in Qt 6.0.

Change-Id: Ic367991d9583cc108c045e4387c9b7288c8f1ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-31 21:46:32 +02:00
Lars Knoll
a1056096fc Add support for count() to QStringView
Make the API more symmetric with regards to both QString and QStringRef.

Change-Id: Ia67c53ba708f6c33874d1a127de8e2857ad9b5b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-30 23:11:09 +02:00
Lars Knoll
beaef85b8d Add toInt() and friends to QStringView
Make the API more symmetric with regards to both QString and QStringRef.
Having this available helps making QStringView more of a drop-in
replacement for QStringRef. QStringRef is planned to get removed in Qt 6.

Change-Id: Ife036c0b55970078f42e1335442ff9ee5f4a2f0d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-29 19:01:58 +02:00
Sona Kurazyan
2f15927f01 Add a way of notifying QFutureWatcher when pause is in effect
Because setting QFutureInterface to paused state does not mean that
the computations that are already in progress will stop immediately,
it may be useful to get notified when pause actually takes effect.

Introduced the QFutureWatcher::suspended() signal, to be emitted when
there are no more computations in progress, and no more result ready
or progress reporting signals will be emitted, i.e. when pause took
effect. Added {QFuture, QFutureWatcher}::isSuspended() methods for
checking if pause took effect.

QtConcurrent will now to send QFutureCallOutEvent::Suspended event
when the state is paused and there are no more active threads.

[ChangeLog][QtCore][QFutureWatcher] Added a new QFutureWatcher::suspended()
signal, to be emitted when pause took effect, meaning that there are no
more computations in progress. Added {QFuture, QFutureWatcher}::isSuspended()
methods for checking if pause took effect.

Fixes: QTBUG-12152
Change-Id: I88f2ad24d800cd6293dec63977d45bd35f9a09f0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-05-29 16:58:43 +02:00
Edward Welbourne
948511a143 Turn badly-named test into two data rows of another test
Since ancient times, tst_QDateTime::fromString_LOCALE_ILDATE() has
claimed to be Windows-only, although there is nothing MS-specific
about it; its name also purports to implicate locale, which it
doesn't. Turn it into two data rows for the more general
fromStringDateFormat() test, with no extra #if-ery about it.

Change-Id: I239c0f80f8f7fa42d498a0f801cc8edfb1db3d8c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-05-29 16:58:43 +02:00
Eskil Abrahamsen Blomfeldt
4e5d686a87 Make tst_QTextLayout::textWidthVsWIdth() more robust
Some fonts misreport the minimum right bearing, and in those cases
we may not be able to do a perfect text layout inside the bounds
set. This is a limitation we have chosen to accept.

To avoid random failure when testing this, we detect the case and
skip the test if we see that it may fail.

Fixes: QTBUG-84415
Pick-to: 5.15
Change-Id: I6b53ea2631c5c6e476e2902b5514829a2141796f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-29 07:28:10 +02:00
Simon Hausmann
36f6922925 Implement support for QProperty<T> with a static observer
A common pattern in Qt Quick will be QProperty members that are
connected to a callback that needs to perform something when the value
changes, for example emitting a compatibility signal or marking scene
graph node data dirty.

To make such a pattern more efficient, a new QNotifiedProperty type is
introduced that offers the same API as QProperty<T>, with two changes:

    (1) The template instantiation not only takes the property type as
    parameter but also a callback pointer-to-member.

    (2) Since that member itself cannot be called without an instance
    and to avoid storing an instance pointer permanently, the API for
    setBinding and setValue are adjusted to also take the instance
    pointer. For the former it gets stored in the binding, for the
    latter it is used to invoke the callback after setting the new
    value.

Change-Id: I85cc1d1d1c0472164c4ae87808cfdc0d0b1475e1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-05-28 21:08:51 +00:00
Allan Sandfeld Jensen
d80a98d525 Fix ExtendedRgb and Rgb encoding comparisons
ExtendedRgb should be treated as Rgb as it can be an automatic upgrade.

Pick-to: 5.15
Change-Id: I2942a1067ed5cacb2f60f303f467887cb44c36dd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-28 21:15:55 +02:00
Laszlo Agocs
56977990e0 rhi: Harmonize create-destroy API pattern with the rest of Qt
For historical reasons we use build and release instead of create and
destroy. This becomes confusing now that more modules in Qt start taking
QRhi into use. Migrate to the more familiar naming, so those who have
used QWindow or QOpenGLContext before will find it natural.

Change-Id: I05eb2243ce274c59b03a5f8bcbb2792a4f37120f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-28 17:53:32 +02:00
Edward Welbourne
449b347644 Rework QLocale and QDateTime tests that expect CET abbreviation
The name CET is locale-dependent; but QLocale doesn't know about
localization of time zone names. Such abbreviated zone names are, in
any case, potentially ambiguous - various zones around the world have
collisions - so they can't be relied on.

QTimeZone's various backends have differing handlings of how to
abbreviate zone names (MS's provides no abbreviated names at all); and
it appears macOS actually follows the relevant localizations.

So it is hopeless to hard-code the expected zone abbreviations.
Changed the tests to consult QTimeZone for the abbreviation and
compare what it gets with the results of checks which should match
this. This is less stringent, but it is at least robustly correct,
thereby getting rid of assorted kludges and #if-ery.

Pick-to: 5.15
Task-number: QTBUG-70149
Change-Id: I0c565de3fd8b5987c8f5a3f785ebd8f6e941e055
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-28 15:15:17 +02:00
Dimitrios Apostolou
b37cf68810 Add tests for a couple of edge cases
Change-Id: I1cd799cc671fa2191e20d4681632588dc79e98dd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-28 10:48:58 +02:00
Andrei Golubev
cfbb30decd Make QDateTimeParser recognize local time offsets
Fixes: QTBUG-84209
Pick-to: 5.15
Change-Id: Iedbc7beafcaa55c72fec3ac5a5f519c6ed5f7770
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-28 11:48:57 +03:00
Friedemann Kleint
9c31acbf47 Move windowsuiautomation API support into QtGui
Task-number: QTBUG-83255
Change-Id: Ibface71931b6384494842ba9744d76f738c5ca85
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-27 22:28:41 +02:00
Ulf Hermann
a64a0ce331 Add a QPropertyAlias
A property alias is the equivalent of the "alias" keyword in QML. It
provides the same API as QProperty, but redirects any access to the
QProperty it was initialized with. When the original property is
destroyed the binding becomes invalid and ignores any further acccess.

Task-number: QTBUG-84370
Change-Id: I0aef8d50e73a2aa9e7703d51194d4c5480573578
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-27 14:41:52 +02:00
Volker Hilsheimer
ee92ee7a3c Remove deprecated QProcess methods
Add default parameter for arguments in start, startDetached, and
execute for better source compatibility with Qt 5.15. This has the risk
of then hiding incorrect calls to the previous overload taking a single
"command" strings if code is ported from pre-5.15 or ignores deprecation
warnings. This is acceptable, given that the alternative is that all
calls to these functions would require a default constructed QStringList
as the second parameter.

Change-Id: I1ba4df97ac4894d007da5083c8359015d784ddbb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-27 11:55:06 +02:00
Shawn Rutledge
3373aa8b35 QTextMarkdownImporter: allow nesting text span formatting
The bold+italic combination indicated by ***triple stars*** requires
this; but it enables combinations of italics, bold, strikeout, anchor
text (and associated link formatting), image alternate text, and inline
code formatting (monospace). A code span overrides the formatting from
surrounding spans (which might be a bug to fix in another patch, if we
compare to how md2html formats code nested in bold-italics for example),
but the format stack restores state when any char format span ends.

Task-number: QTBUG-81306
Pick-to: 5.15
Change-Id: I289556fa53de400eb50a4d159b9b344eafc517da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-27 11:55:02 +02:00
Ulf Hermann
524d781607 QProperty: Support multiple observers
Previously, only the first observer would get notified. Also, make sure
that the notifiers are always retained when switching between bindings
and values.

Change-Id: I9c25c0f2e288dac3a335b68e618f7ddeb44be25a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-27 11:54:30 +02:00
Ulf Hermann
36bd34dbdc QProperty: Apply coding style and avoid warnings
Change-Id: I14efdb293a4be39b3849b34bd8013fdab016ce7e
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-27 11:54:16 +02:00
Sona Kurazyan
d7d6a1fe32 Don't queue events in QFutureWatcher when pause is requested
When QFutureWatcher (or QFutureInterface) is paused, it doesn't
mean that it will take effect immediately: the pending tasks may
still be in progress and keep reporting results. At the moment
QFutureWatcher will queue those events and report only with the
next resume. This behavior is wrong, QFutureWatcher should not
decide when to report events, the sender should decide when is the
right time. There's no benefit in reporting already happened events
with delay. Because of this, even the pause event itself was being
reported after resume.

Fixed the behavior by removing the logic of queueing events when
the state is set to "paused". It seems unlikely that the users of
QFutureWatcher rely on reporting events with delay.

[ChangeLog][Important Behavior Changes][QtCore] QFutureWatcher will not
immediately stop delivering progress and result ready signals when the
future is paused. At the moment of pausing there may be still computations
that are in progress and cannot be stopped. Signals for such computations
will be still delivered after pause, instead of being postponed and
reported only after next resume.

Fixes: QTBUG-12152
Change-Id: I9f0b545ac096578c52cc72d60575c018c01e3368
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-05-27 11:53:28 +02:00
Fabian Kosmale
d8a2456fbf moc: handle include directives in enums
When including files, moc inserts a MOC_INCLUDE_BEGIN and
MOC_INCLUDE_END token into the token stream. Those are already handled
in the toplevel Moc::parse function, but parseEnum lacked support so
far.

Pick-to: 5.15
Fixes: QTBUG-80578
Change-Id: I35c8fd959347d94af20090b3a505dd9e6bfaff88
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-27 09:21:08 +02:00
Giulio Camuffo
7db527dbdd Add a property to QSFPM to show children of accepted items
[ChangeLog][QtCore][QSortFilterProxyModel] Add a 'autoAcceptChildRows'
property to always show children rows of accepted rows.

Change-Id: I2402469ece438179d0f19888b9775cc27cf5c749
Reviewed-by: David Faure <david.faure@kdab.com>
2020-05-26 15:11:40 +02:00
Heikki Halmet
fc8c011450 Blacklist imageAtRightAlignedTab in CentOS
Task-number: QTBUG-46206
Change-Id: I98add304d052f3fc5c0ab80077ba66e8e159748e
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2020-05-25 08:16:14 +03:00
Heikki Halmet
d8ea25b917 BLACKLIST test_Gestures tests for new platforms
Task-number: QTBUG-84258
Change-Id: I4722444ffd8a9b1ebc262a424778a19704881832
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-05-25 05:16:10 +00:00
Heikki Halmet
3e17098fcd BLACKLIST QWidget tests for CentOS
Tests focusProxyAndInputMethods and
multipleToplevelFocusCheck will be blacklisted

Task-number: QTBUG-84259
Change-Id: I7d5baf1e700192eed3c7c8dcfe671e247f11b8c7
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2020-05-25 08:16:05 +03:00
Tony Sarajärvi
623670d243 Blacklist tst_QTimer::zeroTimer on Ubuntu 20.04
Task-number: QTBUG-84291
Change-Id: I198cfe813617a5bb65b0e1059a43b6933d610720
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-05-25 05:16:00 +00:00
Tony Sarajärvi
778b8265b7 Blacklist tst_qfont tests on new platforms
Task-number: QTBUG-84248
Change-Id: I5285a12a9f1feaf748fc1734f122473c02d115e5
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-05-25 05:15:53 +00:00
Kari Oikarinen
afdfb08e3a Remove references to deleted file shift-jis.txt
Amends 33bb695a28.

Change-Id: I7a7d90dc406ffbf015e760a7c41534564bfbe13e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-24 22:24:47 +03:00
Giuseppe D'Angelo
ed2c3f6756 QSslCertificate: overhaul ASN.1 datetime parsing
Instead of manual string splitting (EW!), use QDateTime parsing.
Moreover, X.509 certificates *must* have a valid start/end date.
In case of parsing failure, reject the certificate. An autotest
for this last case is coming in a separate patch.

Change-Id: I934bf9e6a4a92e4befdb3b0f9450f76f67bad067
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-22 15:40:22 +02:00
Eskil Abrahamsen Blomfeldt
3ec0df4b5f RHI: Store texture handle as 64-bit int
When storing a void* pointer to the texture handle, we had
to ensure that the variable would exist until the build phase,
which is error prone and caused errors in QQuickWidget because
we copied the texture ID from the FBO into a local variable
before passing it into QQuickWindow::setRenderTarget().

The reason for using a void* was that we cannot know the width
of the handles in the different backends, but we do know that
they are 64-bit at maximum, so instead of storing potentially
dangling pointers, we just make it a 64-bit integer and cast
it back and forth in the backends.

Task-number: QTBUG-78638
Change-Id: I7951e24351ddb209045ab6197d81eb1290b4da67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-22 10:32:10 +02:00
Lars Knoll
2f05aa82e7 Adjust resize() behavior of QString and QByteArray to match Qt 5
resize() to a smaller size does not reallocate in Qt 5 if the container
is not shared. Match this here.

As a drive-by also fix resize calls on raw data strings to ensure
they are null terminated after the resize.

Change-Id: Ic4d8830e86ed3f247020d7ece3217cebd344ae96
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-21 17:59:31 +02:00
Robert Loehning
4c9acd103b Fuzzing: Add fuzz target for QImage::loadFromData
Pick-to: 5.15
Change-Id: Ie67eb9be80fe42d463c566c728c73c9c92c2081b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2020-05-19 23:18:16 +02:00
Liang Qi
b2c991bfea Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-05-19 08:21:02 +02:00
Jarek Kobus
8a11641bb9 Enable setting custom QThreadPool for QtConcurrent methods
Task-number: QTBUG-53465
Change-Id: Icff05d5f65dce453ff702502b85c35e20fca86a9
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-18 10:03:29 +02:00
Liang Qi
2cd6d76d68 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/text/qbytearray.cpp

Change-Id: I63706409464d31391012bacdadfd1f6300509787
2020-05-18 08:52:33 +02:00
Marc Mutz
3df3bdcdb3 QTaggedPointer: verify constexpr'ness of some ctors
Change-Id: I44196ba3a823ce04b7c82aacfb9da301cc0f1886
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-16 08:55:28 +02:00
Sona Kurazyan
1a5cc8d13d Add support of cancellation handler callbacks to QFuture
Added QFuture::onCanceled() method, for attaching handlers to be called
when the QFuture gets canceled.

Change-Id: I1f01647d6173ba0c1db6641e14140108b33ac7c4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-15 22:35:30 +02:00
Sona Kurazyan
612f6999c8 Add support of connecting signals to QFuture
Introduced QtFuture::connect(sender, signal) function returning a
QFuture object, which is resolved when the signal is emitted.

Task-number: QTBUG-81589
Change-Id: Idbe301eb247b468b9b34f3470c3359d6a7af2f3a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-15 22:35:06 +02:00
Volker Hilsheimer
2b10a192a1 Remove deprecated method from QFont, QFontMetrics, and QFontInfo
Change-Id: Ifc8fb5c5d53359b33b8abab3bbee3de61bfef539
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-05-15 18:56:20 +02:00
Fabian Kosmale
794150e5bd QMetaType: Support char16_t and char32_t
Change-Id: Ieec6d4bc64967d875ea12b31638aab05bc682ea3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-15 18:46:39 +02:00
Volker Hilsheimer
45cf8da63c Reduce QDesktopWidget API to bare minimum
The class is documented as obsolete, and the majority of APIs is marked
as deprecated. In this first phase, remove all explicitly deprecated
APIs and trivial implementations.

The test case is complete removed; what's left when code that uses any
of those deprecated methods is removed is not testing anything
meaningful.

For some methods, there is no practical replacement using QScreen yet,
and QDesktopWidget is still used in QWidget internals. Those require
refactoring to only use QScreen before the rest can be removed.

Change-Id: I8f7c968ec566820077221d37b817843758d51d49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-15 18:46:39 +02:00
Andy Shaw
9803ba9b6f Deprecate QGuiApplication::paletteChanged() signal
Rather than have a paletteChanged() signal which can be connected to for
tracking when the application palette has changed, then it is better to
use the event that is sent to all windows and the application itself.
That way it is easy for a window/widget or item that cares about the
change to the application font to catch it in the event() function.

[ChangeLog][QtGui][QGuiApplication] Deprecated paletteChanged() signal
in favor of QEvent::ApplicationPaletteChanged.

Change-Id: I95da211e30590e357007cc14d8ee266baceba7b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-15 18:46:39 +02:00
Marc Mutz
b655734965 QString: fix an aliasing issue in remove(QString)
Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with
the advent of substring sharing, this will become even more
pronounced. Use the same fix as was already used in QString::insert().

Pick-to: 5.15
Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-15 03:00:45 +00:00
Marc Mutz
3b7f278d38 tst_qstringref: remove some wtf?
As best as I can guess, this used the QString::operator=(char), which
I locally removed. Before that lands in Qt, remove this ... wtf?

Pick-to: 5.15
Change-Id: Ie083fe69500d6b5b633416f89f5dd1d7068c20b2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-14 20:30:35 +00:00
Lars Knoll
b4fd377aa9 Make utf8_source the default for qmake builds
We now assume that source code is encoded in UTF-8 by default on
all platforms (and verify this with an auto test). Provide
a CONFIG+=no_utf8_source option for backwards compatibility.

[ChangeLog][qmake] qmake will tell the compiler that source code is
encoded in utf-8 by default. This mainly has an effect on Windows, where
MSVC still assumes source code is encoded in the current ANSI code page.
Use CONFIG+=no_utf8_source to get back the Qt 5 behavior.

Change-Id: I6dcafcaeefdea7d3907ccb723aeb7d23ccc0f04f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 19:14:51 +02:00
Giuseppe D'Angelo
9e1dc1e8a9 QStringView: add converting constructor from array-like containers
Centralize, rather than keeping adding constructors from any
array-like container.

A more robust implementation, likely following the converting
constructor for std::span ([span.cons]), is out of scope for C++17
and will require C++20's ranges and concepts.

[ChangeLog][QtCore][QStringView] QStringView can now be constructed
from any contiguous container, as long as they hold string-like data.
For instance, it's now possible to create a QStringView object
from a std::vector<char16_t>, a QVarLengthArray<ushort> and so on.

Change-Id: I7043eb194f617e98bd1f8af1237777a93a6c5e75
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-14 12:19:47 +00:00
Giuseppe D'Angelo
594abde1a2 Enforce that statically allocated array-like containers have 0 capacity
It has been the case for both QStringLiteral and QByteArrayLiteral
since Qt 5.0, and Q_ARRAY_LITERAL since Qt 6.0.

Since it's definitely surprising, add a note in the docs, which
is "somehow" consistent with the interpretation of capacity as
the biggest possible size before we reallocate. Since it's 0,
any manipulation of the size will cause a reallocation.
(Alternatively: the capacity() is for how many elements memory was
requested from the free store. No memory was allocated, so 0...)

Task-number: QTBUG-84069
Change-Id: I5c7d21a22d1bd8b8d9b71143e33d537ca0224acd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 14:19:47 +02:00
Alexander Volkov
af3caa2271 QBasicDrag: Send QDragMoveEvent when modifiers change
... without moving the mouse.
This allows to update drop action and cursor.

Task-number: QTBUG-56218
Task-number: QTBUG-82934
Pick-to: 5.15
Change-Id: I8b0ac2a008a9dbcc4c2d6abce282e6f169c2f542
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-05-14 15:19:47 +03:00
Lars Knoll
45ed28a9d3 Remove QRegExp from QVariant
Add an operator QVariant() to QRegExp to keep things at source compatible
as possible.

Add a hack to QVariant::load/save() to recognize the old typeid
for QRegExp and stream them correctly as long as the streaming operators
for QRegExp are registered.

Also move the datastream test for QRegExp to tst_qregexp, and adjust it to
the qvariant changes.

Change-Id: I120b38a7541b43ec07a21b17f7f35c55f071eb75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-14 12:19:47 +00:00
Lars Knoll
b2ee684a13 Remove QRegExp support from QString and StringList
Replacement methods do now exist in QRegExp, or
for QRegularExpression when porting to it.

Remove all autotests associated with the old methods.

Change-Id: I3ff1e0da4b53adb64d5a48a30aecd8b960f5e633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 14:19:47 +02:00
Lars Knoll
7370b60cfe Move methods using QRegExp in QString(List) over to QRegExp
The prepares for the removal of those methods from QString and
QStringList. The new methods in QRegExp are left as a porting help.

Change-Id: Ieffa33a79caf53b83029e9b070c4eb5cadca1418
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-14 14:19:47 +02:00
Qt Forward Merge Bot
76fe36645e Merge remote-tracking branch 'origin/5.15.0' into 5.15
Change-Id: I06396fa0a3d1687a0935e48d290358edbb0e59e8
2020-05-14 14:01:32 +02:00
Lars Knoll
57037145f5 Streamline the code in the conversion to and from utf8
Move pre/and post condition handling out of the main loop
to make that one as fast as possible.

Remove special handling of a corner case when the input length
is zero, where the utf8 decoder did something else than all
other decoders.

Change-Id: I94992767ea15405b38f7953adadaa6ff98b20b6f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:45 +02:00
Lars Knoll
1a6bf6c549 Remove QTextCodec dependency in the old SAX parser
Just so we can get this cleaned up as well and remove it from
Qt Core.

Change-Id: I2b5b821b039ce2c024ec3cb7338a1a9becdd2157
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:32 +02:00
Lars Knoll
2b8863a98c Get rid of some QTextCodec leftovers
There's no real dependency to QTextCodec in those files anymore.

Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:20 +02:00
Lars Knoll
8a84eb6c4a Remove autotest for codecForHtml
The test was rather bogus anyway...

Change-Id: I81b4f87bb811b2894ce88b1fdbb3183fc7259057
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:54 +02:00
Lars Knoll
9515d45f88 Remove QTextCodec dependency from test
Change-Id: Ie546065c3179d475df46b284ca7df502c4465b93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:49 +02:00
Lars Knoll
124d587bb9 Document the string converter classes
Document QStringConverter, QStringDecoder and QStringEncoder.

In addition, do some touches to the API, renaming one enum value,
add a flags argument to one constructor and make some members private.

Change-Id: I8f99dc3d98fb8860cf6fa46301e34b7eb400511b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:29 +02:00
Lars Knoll
4d67b9dcfb Get rid of QTextCodec in QTextStream
Use QStringConverter instead. Also change the default
encoding of QTextStream to utf8.

Change-Id: I30682e75fe0462d1a937539f773640c83a2d82e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:19 +02:00
Lars Knoll
33bb695a28 Start porting QTextStream away from QTextCodec
As a first step add setEncoding/encoding() methods that use the
QStringConverter::Encoding enum, and port all uses of setCodec()/
codec() over to the new API.

Internally QTextStream still uses QTextCodec, this will be ported
over to QStringConverter in a follow-up change.

Change-Id: Icd764cf47b449b57f4ebd010c2dad89e6717d6c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:13 +02:00
Lars Knoll
b8db123341 Add a method to determine the encoding for encoded HTML data
This is a replacement for Qt::codecForHtml().

Change-Id: I31f03518fd9c70507cbd210a8bcf405b6a0106b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:49:05 +02:00
Lars Knoll
13af1312f7 Add QStringConverter::encodingForData()
Add method that tries to determine the encoding of the data
from an initial byte order mark.

Change-Id: I348c51a3d4db9b434af53359b739a7e17acfc760
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:48:55 +02:00
Lars Knoll
a639bcda1e Add methods to convert between encoding and name to QStringConverter
Add static methods that allow converting between a name for an
encoding and the Encoding enum.

Change-Id: I12bc503cf757ea31d3ca8d5e1f1216efddcb16d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:48:49 +02:00
Lars Knoll
3ce9162ab5 Construct a string converter by name
Add a constructor, that allows constructing a string converter by
name. This is required in some cases and also makes it possible to
(in the future) extend the API to 3rd party encodings.

Also add a name() accessor.

Change-Id: I606d6ce9405ee967f76197b803615e27c5b001cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:48:42 +02:00
Lars Knoll
a383d79772 Get rid of QSettings::iniCodec()
Always encodee INI files as utf-8 in Qt6. This is mostly backwards
compatible, as old ini files would encode all non ascii characters.

[ChangeLog][Important behavioral changes] QSettings will now always
encode INI files as utf-8 (and the iniCodec/setIniCode methods are
removed). This is a change from Qt 5 and earlier, where QSettings would
by default escape all non ascii characters. The behavior is equivalent to
what you got in Qt5 by setting a utf-8 iniCodec on the settings object.
Settings files written in Qt 5 will still be readable in Qt 6 (unless
an iniCodec different from utf-8 was used), but to read Qt6 based ini
files in Qt 5 applications, setting the iniCodec to utf-8 is required.

Change-Id: Ic7dffcca17779bd5e3dae50d42ce633170289f6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-14 07:48:28 +02:00
Lars Knoll
940665eff5 Add some incremental tests
Feed the data one by one to the encoder or decoder to
verify that the handling of incremental decoding is
correct.

Change-Id: I565e4f1872e00859026334f7662b6778772e159d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:48:13 +02:00
Lars Knoll
cab0d57d1e Clean up the Flag handling in QStringConverter
IgnoreHeader was a rather badly defined enum, in addition the
utf8 and utf16 codecs where handling BOMs somewhat different
for stateless decoding.

Fix this by introducing explicit flags for writing a bom when
encoding and not skipping the initial bom when decoding.

Source compatibility for QTextCodec is done with a couple of
static constexpr variables.

Change-Id: I0b2d94f84c937cec1e0494c16ef448c00382691d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:47:33 +02:00
Lars Knoll
2c7f9565ed Always write XML documents as UTF-8
Remove support for setting a codec different from UTF-8
for writing XML files.

All XML readers today can handle UTF-8, and there is no
reason anymore to write a file in a different encoding.

Change-Id: If89fb2d2474a2b55644d9bed7473c11ad91033eb
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-14 07:47:06 +02:00
Lars Knoll
f64a6bd638 Start work on a new API to replace QTextCodec
The new QStringEncoder and QStringDecoder classes
(with a common QStringConverter base class) are
there to replace QTextCodec in Qt 6.

It currently uses a trivial wrapper around the utf
encoding functionality.

Added some autotests, mostly copied from the text codec
tests.

Change-Id: Ib6eeee55fba918b9424be244cbda9dfd5096f7eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:46:14 +02:00
Volker Hilsheimer
92df790f46 QApplication: refactor delivery and propagation of wheel events
Handle wheel grabbing via wheel_widget in a single place, and
propagate events in the same way for all (spontaneous) events.

Handle ScrollMomentum the same way as ScrollUpdate to allow
partial sequences.

Fix the incorrect ignoring of wheel events by default; like all
other input events, they are now again accepted by default and
ignored in the default event handler implementation of QWidget.
This way, implementing the handle suffices to accept the event.
Note that QWidget::wheelEvent doesn't need to be changed, as the
event is ignored there today (an oversight of the change made in
f253f4c3, perhaps).

This also fixes changing of direction of a wheel event while
the event sequence is grabbed by a widget.

Change-Id: Ia0f03c14dede80322d690ca50d085898a0497dbe
Fixes: QTBUG-67032
Task-number: QTBUG-79102
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-05-13 15:07:55 +00:00
Marc Mutz
a504f63f2e Port qt_punycodeEncoder() to QStringView
Change-Id: I264e67bc08413f8a39e2d16c774bfd2c76c320ac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-13 13:22:09 +00:00
Marc Mutz
90f864a4c5 QString: remove op+=(char) and op+=(QChar::SpecialCharacter)
The former messes in bad ways with the overload set (it, fatally,
attracts char16_t, e.g.). The latter was probably added in response to
ambiguities between (char) and (QChar). While it's harmless now,
remove it, since it no longer pulls its weight.

The no-ascii warning is now coming from QChar(char), so the protection
isn't lost.

[ChangeLog][QtCore][QString] The += operators taking char and
QChar::SpecialCharacter have been removed as they cause adding a
char16_t to QString to call the char overload, losing information. The
append() function was not affected.

Change-Id: I57116314bcc71c0d9476159513c0c10048239db3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-13 14:38:48 +02:00
Volker Hilsheimer
082eebe6a4 Remove deprecated QDesktopServices APIs
Change-Id: Ic21ad2938b20c1aa3ae499a921c9cff92f615816
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-13 14:38:23 +02:00
Mårten Nordheim
80e0d0e08e QNetworkReply/http2: Add a contentEncoding test
Will be useful when DecompressHelper gets taken into use for both.

Task-number: QTBUG-83269
Change-Id: Iaf253219bed193025c2b82d6609f4dcc4de33df8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-13 13:54:44 +02:00
Tony Sarajärvi
1736746228 Blacklist imageAtRightAlignedTab in SLES
Task-number: QTBUG-46206
Change-Id: I8da530eedcef937f5dea6c7507be74cbe26186a1
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2020-05-13 09:34:56 +00:00
Marc Mutz
b49314af1d Port qt_check_std3rules() to QStringView
Also port its callees. These functions scream to the QStringView-ified...

Change-Id: I13c95d65941eb8d02223306d80efd1437b4bd9b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-13 08:04:40 +02:00
Marc Mutz
548dcef089 Port qt_urlRecode() to QStringView
It's about time :)

Change-Id: I27e597516318382850d4c193fd5b66a35fb9c316
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 23:04:42 +02:00
Andrei Golubev
bed25fdf60 Teach QDateTimeParser some common time-zone offset formats
Fixes: QTBUG-83687
Fixes: QTBUG-83844
Pick-to: 5.15
Change-Id: Ia1c827017b93cf8277aa5a0266805d773d2d9818
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-12 12:45:58 +03:00
Marc Mutz
23849826b4 Sweep of int-ish → char-ish types near calls to QString::fromU*()
The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going
to be deprecated. Use the newer fromUtf16(char16_t*) and
fromUcs4(char32_t*) overloads.

As a drive-by, use std::end()/std::size() where applicable.

Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 05:43:37 +00:00
Marc Mutz
b62bff2ef3 Use QChar::fromUcs4() more
Change-Id: I02be41de92d84145186de9ac5f5ea3541a941964
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:34 +02:00
Marc Mutz
48827dd41f tst_QShortcut: avoid int -> QChar conversions
They're being made explicit/deprecated/removed.

Change-Id: I2d849d85e51c58b1f837c6795f3d45371f773a92
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:26 +02:00
Tor Arne Vestbø
24e83de8d1 Rewrite Qt Testlib selftest to not rely on Qt Testlib itself
We use the Catch2 testing framework to test Qt Testlib, which also opens
up the possibility of using it for other internal testing once it's made
available through the build system.

The test now has a --rebase mode which will write out the actual results
as new expected files. Once we add the required post-processing to the
results to remove timestamps and other testrun-specific data we can
remove the standalone python script generate_expected_output.py that
today has to be kept in sync with the test itself.

No attempt has been made to clean up the comparison-functions, but
these could all benefit from moving their logic from the comparison
to the sanitization step. This will both make the expected files
more generic, and will reduce the diff once a failure occurs, since
we're not seeing all the hunks that the comparison-functions ignored.

Change-Id: I1769d42e7958d56d1ad5da958db0e8fe3a2a3c23
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-11 15:42:28 +02:00
Andrei Golubev
b428e98052 Make qtbase compile without QT_CONFIG(timezone)
Fixes: QTBUG-83795
Pick-to: 5.15
Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-11 14:42:00 +03:00
Lars Knoll
a4eea312ed Correctly parse non BMP char refs in the sax parser
Update the auto test accordingly, and at the same time remove
all uses of QTextStream (as they aren't required).

Change-Id: I71b7cf6a6b54ea59507f27d5d2d04cc5ae5885fc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-10 11:31:57 +02:00
Marc Mutz
928d57d8da QChar: add fromUcs{2,4}()
The fromUcs2() named ctor is designed to replace all the non-char
integral-type constructors of QChar which make it very hard to control
the implicit QChar conversions, which have caused a few bugs in Qt
itself. As a classical named contructor, it simply returns QChar.

The fromUcs4() named "ctor", however, needs to expand surrogate pairs,
and thus can't just return QChar. Instead, it returns a small struct
that contains one or two char16_t's, can be iterated over and be
implicitly converted to QStringView.  To avoid bikeshedding the name
(FromUcs4Result, of course :), it's defined inline and thus can't be
named outside the function. This function replaces most uses of
QChar::requiresSurrogates() in QtBase.

[ChangeLog][QtCore][QChar] Added fromUcs2(), fromUcs4().

Change-Id: I803708c14001040f75cb599e33c24a3fb8d2579c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-09 06:26:08 +00:00
Marc Mutz
3d58a6a0c8 QGraphicsAnchorLayout: port to QHVContainer [4/4]: sweep Orientation -> Qt::Orientation
This part of the patch changes all remaining occurrences of the local
versions of Orientation to Qt::Orientation.

Change-Id: Ic9ec19b8f069f614061f319abd30841e10cdd626
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-05-09 08:24:04 +02:00
Marc Mutz
2a11940b2a tst_stringview: remove dead code
wchar_t hasn't been QStringView's storage_type for a very long time
(at least since 5.10). And in Qt 6, we require char16_t support not
only in the compiler, but also in the stdlib, so drop the guards and
the alternative code paths.

Change-Id: I99f28b575f61c16a2497840708beaa4b54a80f57
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-08 21:11:17 +02:00
Timur Pocheptsov
920487bf6b QSslSocket::setSslSonfiguration - set d.configuration properly
We end up with an absurd situation:
QSslConfiguration conf;
//we set CA certs so that on demand loading is disabled:
conf.setCaCertificates({...});
QSslSocket s;
s.setSslConfiguration(conf);
Q_ASSERT(conf == s.sslConfiguration); // this assert fails.

Pick-to: 5.15
Change-Id: I272bed145434082acc6ead95fe3640d222b21131
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-08 18:11:03 +02:00
Marc Mutz
dd4e96df52 tst_qstringview: modernize functions in help namespace
They don't work with std::span, since std::span has neither
const_iterator nor cbegin()/cend().

To fix, perfectly forward the return type with decltype(auto) instead
of mentioning T::const_iterator, and rely on the const-qualfication of
the help::c{r,}{begin,end}() functions' arguments to select the
correct T::{r,}{begin,end}() overload.

Change-Id: I4992d4bd521d2dc0f9ea51ae70cde8286ae543a5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-08 16:53:04 +02:00
Marc Mutz
d67551ff5b tst_qstringapisymmetry: test split() with char16_t seps
Change-Id: I6744291b88d5334764da78375899313ac771294b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-08 16:52:59 +02:00
Edward Welbourne
2491ee98b1 QTest::ignoreMessage(): interpret the message in UTF-8
The message to ignore is given in source code, hence UTF-8; it was
being ingested as local 8-bit, which lead to problems when a debug
message wasn't 7-bit clean and the system's native encoding wasn't
UTF-8. Modified QtTest's selftest to check encoding failure.

Pick-to: 5.15
Change-Id: I898744a450115b6d2ee992f1d3b36d8efaeeff7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:51:38 +02:00
Edward Welbourne
e325bd68fd Catch overflow in QDateTime::fromSecsSinceEpoch()
It's documented to be undefined if the number of seconds is outside
the allowed range, but it doesn't hurt for that undefined behavior to
happen to be that the result is invalid. Added a simple test.

Change-Id: I20c3f680c7948b3904f213452272133be77e4d62
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:51:24 +02:00
Edward Welbourne
5ba66c5622 Remove all locale-dependence from Q(Date|Time)+
[ChangeLog][Important Behavior Changes][QDateTime] Removed all
locale-dependence from QDate, QTime and QDateTime, including the
Qt::DateFormat members that select the formats of the default and
system locales and the toString(Qt::DateFormat, QCalendar) overload,
which only used its calendar for these formats.  All toString()
methods now use, and all fromString() methods only recognize, the C
locale's names for days and months.  Use QLocale's methods if you need
to take locale into account.

Fixes: QTBUG-80441
Change-Id: I3a8968438741afb00f44262f79659c51e9b06c35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:51 +02:00
Edward Welbourne
48e5a37536 Move a test of QLocale's methods out of tst_QDateTime
It clearly belonged in tst_QDate::toDateTime(), for which it adds a
few more test-case and in which it inspires some further testing.
The new testing of case-insensitivity doesn't work if the format
contains stray non-format characters, so added a new data column to
take care of that.

Pick-to: 5.15
Change-Id: I73619be02091c97024a84cb963c7029e9fd0569a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:24 +02:00
Edward Welbourne
1f13a0fbec Condition some date-time tests on feature textdate
They use the Qt::TextDate format, so do depend on the feature.
Rename one in the process; nothing in its test has anything to do with
de_DE locale.

Pick-to: 5.15
Change-Id: I2adae5c46e6009c13b433993ed2c3c761a500bfb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:16 +02:00
Laszlo Agocs
8cdc9ac5b2 rhi: vulkan: Fix calling finish() twice with some copy commands in-between
The native command buffer handle was not updated, so the subsequent
finish() call attempted to record an invalid VkCommandBuffer. The
problem was not present with offscreen frames, only when finish() is
called with a swapchain-based frame active.

Task-number: QTBUG-84066
Change-Id: I9c4cb701c3dbbc28f237d6ae1cbf65aafd1fa95f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-05-07 21:15:52 +02:00
Thiago Macieira
798492ccee QCborValue: catch overflow in QByteArray when decoding chunked strings
We checked against integer overflow, but not against overflowing the
QByteArray size limit. That caused a std::bad_alloc to be thrown, which
is bad when decoding unknown data. QCborStreamReader wasn't affected,
since it doesn't merge chunks.

Change-Id: I99ab0f318b1c43b89888fffd160c36f495fada87
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-07 07:39:26 -07:00
Shawn Rutledge
3e12951c0b Remove QScreen::orientationUpdateMask
It simplifies the API and reduces surprise to have rotation working by default.
On Android, the manifest specifies which orientations the application has
been designed to support; on iOS, it is controlled via the
UISupportedInterfaceOrientations property list key.
In addition, QWindow::contentOrientation() is another way to give
a hint to the window manager, or on iOS to directly control whether
the window's rotation is locked or not.

Task-number: QTBUG-35427
Task-number: QTBUG-38576
Task-number: QTBUG-44569
Task-number: QTBUG-51012
Task-number: QTBUG-83055
Change-Id: Ieed818497f686399db23813269af322bfdd237af
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-05-07 13:48:08 +00:00
Jarek Kobus
a245945f29 Add more tests for QtConcurrent::filterReduced()
Test the case where reduce function of the form:
V function(T &result, const U &intermediate)
has T and U types different.

Task-number: QTBUG-83802
Change-Id: Ic89396caba16e7e47ae3ec1527e31b8620f1b08c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-07 15:23:58 +02:00
Jarek Kobus
daea738b9f Cleanup the qtconcurrentfilter test
Get rid of code repetition in concurrentfilter test.
Move tests with initial value next to their original version.
Join new lambda tests into a common functions
testing all possible 16 combinations of
functor / function / member / lambda, as they
test in fact the same function. There is no need
to distinguish lambda case over other cases.
This helps in test readability and maintenance.
Add missing tests for lambdas with a combination
of initial value.

Task-number: QTBUG-83802
Change-Id: I45930c1e18a9e4e561909f46a5cbbdf0ad7ba333
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-07 15:23:46 +02:00
Volker Hilsheimer
9b4b406142 Handle disk full situations by skipping QFile::moveToTrash test
If any of the temporary directories and files can't be created, skip the
test. Otherwise, the cleanup routine would recursively delete "/".

Change-Id: I51f908a468be8fd2ebd523ff7ce27a7c78d1b4e2
Fixes: QTBUG-83863
Pick-to: 5.15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-07 14:27:17 +02:00
Volker Hilsheimer
a033c23ddf QFile::moveToTrash: work with relative file paths on Windows
The system APIs expect an absolute "display name" of the file path,
so make it absolute.

The test was overly tolerant in accepting failure, as a QStorageInfo
initialized with a file path that doesn't exist is invalid, and thus
always different from the QStorageInfo of the home directory. Fix the
test to compare only valid QStorageInfo objects, and postpone the check
until the file we want to move has been created.

[ChangeLog][QtCore][QFile] moveToTrash supports relative file paths
on Windows

Change-Id: I94c8cd40c60fde469e38f76a98f867f20c6a0b15
Fixes: QTBUG-84015
Pick-to: 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-07 14:27:09 +02:00
Lars Knoll
5f5f010885 Port baselineserver from QRegExp to QRegularExpression
Change-Id: I1e76345caa560c27ca75204e1b48a69ba2237ae4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-06 09:58:42 +02:00
Volker Hilsheimer
660b38bb2c Remove a bunch of deprecated members from src/gui/painting classes
Also remove dead code that isn't compiled anymore in Qt 6 builds.

Change-Id: I7a7ae35e61fb2ad9cc21180fb7224357ade1505f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-06 09:54:17 +02:00
Volker Hilsheimer
d39fefc0eb QComboBox: Remove deprecated auto-completion properties
The replacement is to set, and configure, a QCompleter directly via
setCompleter. With the removal of the separate properties in QComboBox,
the configuration of the completer is not maintained if the line edit
is replaced. A QCompleter is created and set implicitly when the line
edit is set, unless the line edit came with a completer. This is what
the auto test verifies as well.

Change-Id: I9a4c73db5e39a2558aad346c0904be6deb4f1cd2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-05-06 09:54:08 +02:00
Volker Hilsheimer
a8fee0bf43 Don't move focus away from previous proxy in QWidget::setFocusProxy
This amends 23b998fa45, and the commits
3e7463411e and
947883141d. This change restores the
pre-5.13.1 behavior of setFocusProxy to not move focus away from a
previously set focus proxy.

With the previous changes, focus would move away from a proxy when a
new proxy is set, if the old proxy had focus. While there are arguments
in favor of this behavior, it is a change of behavior that shouldn't
be introduced to 20+ years old functionality in order to fix the real
bugs addressed by the initial commits.

Instead, move focus only to the new proxy when the focus widget was
the widget that gets a focus proxy.

[ChangeLog][QtWidgets][QWidget] setFocusProxy no longer moves focus
away from a previously set focus proxy, restoring pre-Qt 5.13.1
behavior.

Change-Id: Icf2ad7cba5b860014aeef91cb274c442a2ab9d42
Fixes: QTBUG-83720
Pick-to: 5.15
Reviewed-by: David Faure <david.faure@kdab.com>
2020-05-05 23:03:26 +02:00
Cristian Maureira-Fredes
2f975b39a9 uic/Python: import all the classes for QtCore and QtGui
We already had this approach for QtWidgets, so to avoid
adding the specific cases every time, we import all the
classes from QtCore and QtGui.

Change-Id: I38dd2eec3bbdfb83f156a48f35a2f4fda44528c7
Pick-to: 5.15
Fixes: PYSIDE-1287
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-05-05 22:04:51 +02:00
Thiago Macieira
83223ca3ef Remove Perforce commands from setupSuite.sh
This file mustn't have changed at all, aside from the copyright headers,
since we switched to Git in October 2008.

Quick check shows the data from W3C is still online:
 https://dev.w3.org/cvsweb/2001/XML-Test-Suite/

I didn't check that the CVS server is actually running because none of
my machines even has the cvs command anymore...

Pick-To: 5.15
Change-Id: I4e559af2a9a1455ab770fffd15f4e740114a2433
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-05 12:24:38 -07:00
Thiago Macieira
c377bb385c tst_QProcess: create a more reliable crashing
Turns out that crashing on purpose is more difficult than it seems. It
should be easy, given how often we do it accidentally...

Let the null pointer dereferencing be the fall back. Some compilers are
too smart for their own good and remove the fault. Instead, let's rely
on raise(SIGABRT) on Unix and on the UD2 instruction on Windows.

Pick-To: 5.15
Change-Id: Ibdc95e9af7bd456a94ecfffd1603f1c9b73b167d
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-05 12:24:35 -07:00
Thiago Macieira
d0c028e898 tst_QResourceEngine: fix the order of arguments to QCOMPARE
Expected and actual were inverted.

Pick-To: 5.15
Change-Id: Idc3fae4d0f614c389d27fffd15e9fa6a0a8f25e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-05 12:23:43 -07:00
Qt Forward Merge Bot
16e21c0a67 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-05-05 19:52:04 +02:00
Qt Forward Merge Bot
025e88bfe5 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I003c0d6271c6444748bf30b4331eca3fb2410f44
2020-05-05 19:51:50 +02:00
Jan Arve Sæther
8d6d1d6fea Fix bug in QTextLayout::min/maxWidth for WrapAtWordBoundaryOrAnywhere
In that specific wrapping mode, it will first try a normal word wrap. If
it doesn't fit within the specified line width it will discard the
result of that and try WrapAnywhere by calling layout_helper()
recursively. The problem was that at the point it called itself again it
had already adjusted eng->maxWidth:

        eng->maxWidth += line.textWidth;

This was not restored, but carried on to the recursive call to
layout_helper(), so the end result was that the maximumWidth would
accumulate text widths from parts of the same line twice.

Due to the same recursive behavior the minimumWidth also had a problem:
It always returned the width of the widest word because it took the
qMax() of the minimum widths of the two passes, (WordWrap and then
WrapAnywhere) effectively making the minimum width always be the width
of the widest word (even though it could wrap at finer granularity).

Pick-to: 5.15
Task-number: QTBUG-77337
Change-Id: Ie7e9c17b157506352c2da38cc7f4a8dfa1283966
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-05-05 19:17:35 +02:00
Marc Mutz
900e8b023b QChar: make std::hash'able
Change-Id: I2164df19cd17ab96a39020de66a3fe9fec838a36
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-05 18:58:26 +02:00
Lars Knoll
52f3a7d9d4 Build qmake with QT_USE_STRINGBUILDER
Should improve performance and is going to be required in
the future anyway.

Change-Id: I89d7c50441d2491da1ab0a4d564dcc91f52ade85
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-05 18:41:10 +02:00
Friedemann Kleint
ae7e701074 uic: Generate string-based connections for custom slots
Qt Designer let's you add custom slots and signals to the main
form; they should use string-based connection syntax since the
class is not known in setupUI(). Amends
da3cb1deb6.

Task-number: QTBUG-76375
Change-Id: I5a3a5630f77c812d48db1cdb7a8658a4d2718228
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-05-05 15:35:51 +02:00
Edward Welbourne
ca222646ff Purge from Q(Date|Time)+ most things marked to go at Qt 6
Change-Id: Ib3f48c74132b47649dc7b4cbacf2cefed5a57687
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-05 15:34:15 +02:00
Edward Welbourne
1673e66047 Re-order the sub-dirs to catch real culprits before things they break
A failure in testlib is apt to imply misleading failures elsewhere, so
catch those first. Likewise, broken tools or corelib break
everything. Put the rest of the list in alphabetic order.

Restructure auto.pro to use conditional SUBDIRS += (in the right
order) instead of setting SUBDIRS to a full list and then doing
conditional SUBDIRS -= for most entries. This more closely matches the
way the generated cmake config does things, although it still doesn't
regenerate cleanly.

Change-Id: Idc15326c3534eb4fdce55394269f2dfbc17fcd99
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-05 15:34:15 +02:00
Thiago Macieira
419f429031 QCoreApplication: force the process locale codec to UTF-8
As discussed in the mailing list and in the Qt Contributor Summit 2019.

Tested on Linux, macOS and FreeBSD, showing these fallbacks:
OS        environment         setlocale() call
FreeBSD   empty               "C.UTF-8"
FreeBSD   LC_ALL=C            "C.UTF-8"
Linux     empty               "C.UTF-8"
Linux     LC_ALL=C            "C.UTF-8"
Linux     LANG=en_US          "en_US.UTF-8"
Linux     LANG=de_DE@euro     "de_DE.UTF-8"
Linux     LANG=en_GB.iso885915 "en_GB.UTF-8"
Linux     LANG=hy_AM.armscii8 "hy_AM.UTF-8"
Linux     LANG=ja_JP.sjis     "ja_JP.UTF-8"
Linux     LANG=ru_RU.koi8r    "ru_RU.UTF-8"
macOS     empty               "UTF-8"
macOS     LC_ALL=C            "UTF-8"

Versions tested: FreeBSD 12.1, Linux w/ glibc 2.30, macOS 10.14.2.

See
* https://wiki.qt.io/Qt_Contributor_Summit_2019_-_QtCore
* https://lists.qt-project.org/pipermail/development/2019-October/037791.html

Change-Id: Ia2aa807ffa8a4c798425fffd15d97ddb4f35b0ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-05 15:34:15 +02:00
Laszlo Agocs
a206f52acd Hotfix for int->qsizetype fallout in QShader
The proper solution is to use qint32 everywhere, but that is left as
a separate exercise.

Change-Id: Id0c06b102b56a1b3b48dd67c6c29c28da7d1f22d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-05 11:34:39 +02:00
Kai Koehne
fcceae605a Allow switching of QT_NO_CREATE_VERSIONLESS_TARGETS
Fixes: QTBUG-83774
Change-Id: Ib3f2507a917046426b94a779e205012ce52cbfe9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-05 08:33:40 +02:00
Qt Forward Merge Bot
5e94fdc488 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-05-04 23:12:40 +02:00
Sona Kurazyan
ed6fbeffb2 Port more tests from qtbase/tests/auto/corelib/io/ to CMake
Change-Id: I56427e3e1908047a0674c8c80c24eeda80e947c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-04 19:21:15 +02:00
Qt Forward Merge Bot
0f7987f0c9 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/text/qlocale.cpp
	src/network/access/qnetworkaccessmanager.cpp

Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt

Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
2020-05-04 17:38:40 +02:00
Friedemann Kleint
da3cb1deb6 uic: Generate Qt 5 connection syntax
Add a enum and formatting for member function pointer based
connections. Now preferably use member function pointer for Qt classes
or parameterless connections.

This should not require qOverload() within Qt classes after the
Signal/Slot disambiguation.

Add command line option to force either syntax for all connections.

Task-number: QTBUG-76375
Change-Id: Icdb4051e1173172a71cd536bdbc7d1ab1edf267d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-04 08:12:33 +02:00
Eskil Abrahamsen Blomfeldt
8231614661 Fix QTextDocumentLayout test with certain fonts
If there is a negative right bearing on the last character of the string,
it will stretch past the tab position (which aligns the advance position,
and not the right edge of the glyph). For certain fonts, this would cause
the actual ideal width to be calculated as 301 instead of 300 (which is
the right alignment edge set in the code).

Pick-to: 5.15
Fixes: QTBUG-46206
Change-Id: I03e8b8fb86e9ebe5337d3ba3384ade73d2ccdd69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-04 08:00:37 +02:00
Lars Knoll
52053a8994 Remove useless code
We don't rely on a latin1 locale anymore for the test,
and the other code was not doing anything.

Change-Id: I08bc08d200c9e037884d8b680dfbb24c129f3d2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
Lars Knoll
55dc178271 Remove QTextStream dependency from tst_qfile
Change-Id: I83cb05da8c094185b50e9cedea2e705ad1c7f948
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
David Faure
f0ea852d4d QCommandLineParser: Wrap very long option names to leave room for descriptions
Fixes: QTBUG-79926
Change-Id: I3302e0ed5b58949a35ccb001c71b22a6400a6c81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 10:53:55 +02:00
Simon Hausmann
709648993c Fix crash when using QProperty<T>::setBinding(Functor ...)
We must move the functor properly into the binding object, otherwise we
end up with stale pointers as pointed out by ASAN.

Change-Id: Icd84f4c113dd48e1e3e2d744abac0902cdf9339e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-30 19:39:42 +02:00
Simon Hausmann
3d7265db90 Provide a way of exposing private QProperties with a fake API
The API reduces the amount of manual plumbing required to offer a
conceptual property through the traditional setter/getter API as well as
through QProperty<T> API. Since the latter would require inlining the
type and thus making it impossible to add new properties without
breaking binary compatibility, this patch introduces a fake API that
behaves similar but does not contain the property by value.

Change-Id: Ib9bccd867f0e4e36a520e5583ba348e728284253
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-30 19:39:25 +02:00
Simon Hausmann
b480acb372 Allow for private properties to be implemented using QProperty
Recently the moc learned that Q_PROPERTY(int x ...) can mean that "x" is
implemented as QProperty and then allows installing bindings, etc. -
this works by scanning the same class' members.

For our own use of QProperty, we need to place the QProperty member
itself into the d-pointer to be able to maintain the ability to add new
properties without breaking binary compatibility. That however means
that moc can't know that a certain property is backed by QProperty - we
don't scan the members of the private class.

As a workaround, this change enables the syntax where the property type
used in Q_PRIVATE_PROPERTY may be wrapped with QProperty<T>.

In addition this patch fixes the compilation of such declared properties
by ensuring the accessor prefix (t->$accessor) is applied also for the
QProperty related meta call variants.

Change-Id: I8fbdc49319048b57f4eb0b65b56daba0459e9598
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-04-30 19:39:19 +02:00
Qt Forward Merge Bot
94fe42a753 Merge "Merge remote-tracking branch 'origin/5.15.0' into 5.15" 2020-04-30 18:04:07 +02:00
Edward Welbourne
c78a960198 QCOMPARE: treat values as equal if qFuzzyIsNull(each)
We hope this shall avoid some flaky failures noticed in quick tests,
e.g. tst_QQuickMenu::Material::subMenuPosition(cascading,flip) was
recently seen failing with 3.88e-11 != 0. This required some revision
to test data in the testlib selftest for floats; the resulting
expected output differs in details but not in which tests pass or
fail. QEMU, naturally, made life difficult, requiring special-case
code in the test-driver.

[ChangeLog][QtTestLib][QCOMPARE] QCOMPARE() now treats its values as
equal when qFuzzyIsNull() is true for both of them.

Change-Id: Icc6ad5164b609937eddbe39cc69120f0abf0f3b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-04-30 13:44:08 +02:00
Thiago Macieira
821e71fded QCborValue: check parsing of invalid URL
QUrl will reject invalid URLs for us, so we don't get normalization. The
original junk should be retrievable, of course.

Change-Id: Ibdc95e9af7bd456a94ecfffd160610f5b2c8e1a2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-30 08:01:28 -03:00
Thiago Macieira
8366c06d46 QCborValue: add tests of parsing invalid ISO date-time strings
We rely on QDateTime::fromString being proper, so this is not extensive
testing.

Change-Id: Ibdc95e9af7bd456a94ecfffd160610cdac5d62e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-30 04:01:05 -07:00
Thiago Macieira
2a53017df4 QCborValue: add an extra check against producing invalid ISO dates
By QCborValue design, we store the textual representation in ISO format,
equivalent of CBOR tag 0, which isn't allowed to have negative years or
beyond year 10000.

Change-Id: Ibdc95e9af7bd456a94ecfffd16060ccff359c296
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-30 04:00:47 -07:00
Thiago Macieira
52a2505672 QCborValue: avoid signed integer oveflows when decoding time_t
QDateTime::fromSecsSinceEpoch() multiplies by 1000 but does not check
for overflow. That means we must do so in QCborValue validation. We
can't use mul_overflow<qint64> on 32-bit platforms, so we do a compare-
and-branch there. For 64-bit platforms, we prefer to do the
multiplication with checked overflow, as the common case is that it will
not overflow and we'll need the multiplication anyway.

Change-Id: Ibdc95e9af7bd456a94ecfffd16060cba6f1c86b8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-30 11:00:29 +00:00
Alexandru Croitor
49212cb55a CMake: Fix build of qlogging test on MinGW
The linker doesn't have a -rdynamic option. Otherwise the build
fails with
g++.exe error unrecognized command line option '-rdynamic'

Task-number: QTBUG-75578
Change-Id: Ie89a19fd25e90bef14e64d1d98fd973fa0315997
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-30 10:13:22 +02:00
Sona Kurazyan
3a34fdf72a Port more tests from tests/auto/corelib/tools to CMake
Also removed add_subdirectory calls for subdirs which no longer exist.

Change-Id: I759f408ca812e1721dde495b0e23feffdeeb9c60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-29 22:48:45 +02:00
Friedemann Kleint
a19d743b2c uic tests: Update version in baseline
Change-Id: I74334587727097a59fdeccd2fc58d18096cfed0a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-04-29 22:48:26 +02:00
Friedemann Kleint
512be78e01 tst_QDialogButtonBox: Port away from QAbstractButton::animateClick()
Use QAbstractButton::click(). Refactor and polish the tests
to use QTRY_VERIFY() instead of qWait(), speeding them up.

Pick-to: 5.15
Task-number: QTBUG-81845
Change-Id: I119bede8143ec1db5f5250517dee38b576d5a8d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-29 10:10:37 +02:00
Marc Mutz
05a38c05f7 tst_Gestures: fix -Wdangling-else GCC warning
... and do a local code cleanup:

- add override
- port from foreach to C++11 ranged for loop
- remove dead code (`gestureEvent` (née event) was already
  dereferenced when we check it for null'ness, so it cannot be
  nullptr, so the condition is always true).

Pick-to: 5.15
Change-Id: Ica5e34fbe65c95f6573630f188582b90be15c8f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-04-29 08:10:36 +00:00
Volker Hilsheimer
0fda43cf33 Remove deprecated members from QtGui/image classes
Cleaning up those that are trivial to remove because they have direct
replacements.

Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-29 06:20:07 +02:00
Sona Kurazyan
469e044f06 Port qtbase/tests/auto/gui/painting to CMake
Task-number: QTBUG-78225
Change-Id: Idc1333b119939e65da8f47d8de5333a38701bcb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-27 14:34:56 +02:00
Sona Kurazyan
7e1dacc27a Port qtbase/tests/auto/corelib/text tests to CMake
Task-number: QTBUG-78220
Change-Id: I497da6ed489854bdee5a1ead9a3f34118c78d001
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-27 14:34:51 +02:00
Volker Hilsheimer
1a342b2db1 Remove deprecated QComboBox::SizeAdjustPolicy enum value
Change-Id: Ia8ae2eb11b86bc615e1297d7fabd1afcb821557c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-27 12:22:33 +02:00
Volker Hilsheimer
dccf28b7c3 Remove deprecated members from several QtGui classes
Those can be trivially removed as they have direct replacements, or
are completely unused.

The migration path for QCursor::bitmap and QCursor::mask is

QBitmap *pb = c.bitmap(); // up to 5.15, warns in 5.15
QBitmap vb = c.bitmap(Qt::ReturnByValue); // from 5.15, works in 6
QBitmap b = c.bitmap(); // from 6.0 on

Change-Id: I3b3acd1c7f09c4c8414e98b3ce11986f1ecd5eda
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-27 12:21:29 +02:00
Volker Hilsheimer
bc205d81e7 QApplication: deliver all wheel events to widget that accepts the first
For kinetic wheel events, Qt tries to make sure that all events in the
stream go to the widget that accepted the first wheel event.

It did so by directing all events from the stream to the widget from
which the spontaneous event was returned as accepted.
However, that widget might have passed the event on to some other
widgets; e.g QScrollArea forwards wheel events from the viewport to the
relevant scroll bar. The event might then have come back accepted only
because parent propagation kicked in (the scrollbar might not accept
the event, so the parents get a chance, and some parent's scrollbar
ultimately accepts the event).

In this scenario, the wheel widget would be the viewport under the
mouse, when it should have been the scrollbar of the parent. The
next events from the stream were then delivered to a widget that didn't
scroll; and parent propagation is not (and should not be) implemented
for the case where Qt has a wheel widget.

Instead, make the first widget that accepts any initial wheel event
the wheel widget, even if the event was not spontaneous. With this
change, all events from the stream are delivered to the widget that
actually handled the event. That has the effect that ie. a viewport
of a scroll area only gets the first event; all following events are
delivered directly to the scrollbar.

The test case added simulates the different scenarios - nesting of
scroll areas, classic wheel events and a stream of kinetic wheel
events.

[ChangeLog][QtWidgets][QApplication] Wheel events from a device that
creates an event stream are correctly delivered to the widget that
accepts the first wheel event in the stream.

Change-Id: I5ebfc7789b5c32ebc8d881686f450fa05ec92cfe
Fixes: QTBUG-79102
Pick-to: 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-25 01:34:04 +02:00
Volker Hilsheimer
ed86a4f253 Don't send QEvent::Hide to an already hidden top level widget
When hiding a popup by clicking outside of its area, a window is closed.
Depending on the platform specific implementation details, this can
result in multiple calls to QWidgetPrivate::setVisible(false). The first
one from the handling of the close event in QWidgetWindow::event; the
second from the destruction of the window in QWindow::event.

Since the first call already sets the Qt::WA_WState_Hidden flag before
calling QWidgetPrivate::hide_helper, we can test if the flag is set
and skip the second call if it is.

The included test does not reproduce the issue, as that issue only
reproduces if the close event is generated by the mouse event handling
in the Cocoa platform plugin (which doesn't call QWidget::close, but
rather sends a native close event to the platform window). However, it
verifies that the fix doesn't introduce any regressions.

Change-Id: Id0eda9326a8adf0cc1f6a3840f9ac0b635ab39a1
Fixes: QTBUG-79134
Pick-to: 5.15
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-24 17:40:36 +02:00
Volker Hilsheimer
cc54685b8d Remove deprecated ApplicationAttribute enum values
In the declaration, leave them in as comments so that the gaps in the
numbering of the values doesn't create confusion.

Change-Id: I92ff299416896c471e7c7d80b988cd4642b6b756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-04-24 17:40:17 +02:00
Marc Mutz
3238445b27 QString: add append, op+=, prepend, insert taking QStringView
[ChangeLog][QtCore][QString] Now supports appending, prepending
and inserting QStringViews.

Change-Id: I7538c050c67590f27d91443eda0b94a4b80b62f2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-24 10:45:09 +00:00
Andy Shaw
dddd197d42 Deprecate QGuiApplication::fontChanged() signal
Rather than have a fontChanged() signal which can be connected to for
tracking when the application font has changed, then it is better to
use the event that is sent to all windows and the application itself.
That way it is easy for a window/widget or item that cares about the
change to the application font to catch it in the event() function.

[ChangeLog][QtGui][QGuiApplication] Deprecated fontChanged() signal in
favor of QEvent::ApplicationFontChanged.

Change-Id: Iae8e832238fc85e385a52305bc04f16e597454b0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-24 10:10:55 +02:00
Vitaly Fanaskov
9ba0715f08 QFuture: the result type doesn't have to be a default-constructible
Added asserts to insure the invariant declared in the documentation.
Canceled future object is not valid, hence we don't need to handle
this case separately.

Fixes: QTBUG-83389
Change-Id: Ib0653ef40cd3135574a91740e4ce2c6dc4da8a71
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-04-23 17:09:52 +02:00
Volker Hilsheimer
23b998fa45 QWidget: fix regression when changing focus proxy while it has focus
This follows up on commits 3e7463411e and
947883141d.

The changing of the pointer of QApplicationPrivate does not transfer
focus properly. It updates the pointer, but it doesn't deliver events
or update the widget hierarchy's focus chain. The result is that
multiple line edits might show a blinking cursor.

Instead, use QWidget::setFocus when the focus proxy has changed while
it had focus, and pass OtherFocusReason rather than NoFocusReason.

Add a basic test for QWidget::focusProxy, which exercises this code
path and verifies that pointers are consistent when focus changes as
a side effect of modifying the focusProxy.

Change-Id: I15a4d868bab2b590cfe4a1daa6a3c8cebc9c9ca2
Fixes: QTBUG-83720
Fixes: QTBUG-79707
Pick-to: 5.15
Reviewed-by: David Faure <david.faure@kdab.com>
2020-04-23 16:19:07 +02:00
Eirik Aavitsland
9e83d268d6 Fix data corruption regression in QJsonObject::erase()
The internal removeAt(index) method was implemented as taking cbor
indexes directly, in contrast to the other ...At(index) methods.

Fixes: QTBUG-83695
Change-Id: I16597eb6db1cf71e1585c041caa81bf8f7a75303
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-04-23 13:42:01 +02:00
Laszlo Agocs
3ef7a760ff rhi: Take mip size into account for render target size
Also extend autotesting, both for rendering into a given mip level
and for rendering into a given cubemap face.

Change-Id: Ida94b71150477ceb50a3b5616d8b7be13174558b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-04-23 10:19:53 +02:00
Qt Forward Merge Bot
7f895553ac Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Iaa439ba7dff19a17e3716b3d30f49f60fa6e38f8
2020-04-23 01:00:36 +02:00
Qt Forward Merge Bot
c6128fc67c Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-04-22 19:17:52 +02:00
Qt Forward Merge Bot
efd7757154 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/widgets/widgets/qabstractbutton.cpp
	src/widgets/widgets/qbuttongroup.cpp
	src/widgets/widgets/qbuttongroup.h
	src/widgets/widgets/qsplashscreen.cpp
	tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
        tests/benchmarks/opengl/main.cpp

  Needed update:
	src/plugins/platforms/cocoa/CMakeLists.txt

Change-Id: I7be4baebb63844ec2b3e0de859ca9de1bc730bb5
2020-04-22 15:28:01 +02:00
Andrei Golubev
7605451604 Handle specified time-spec in date-time parsing
When a date-time was parsed from a string, the result was equal (as a
date-time) to the correct value, but had (at least in some cases) the
wrong spec, where it should have had a spec reflecting the zone
specifier parsed.

The time-spec imposed for the benefit of QDateTimeEdit is now moved
from QDateTimeParser to QDateTimeEditPrivate, which takes over
responsibility for imposing it. QDateTimeParser assumes Qt::LocalTime
in member functions (where applicable) and uses the time-spec parsed
from the string when constructing the date-time.

QDateTime::fromString() and QLocale::toDateTime() are updated to
use the full QDateTime returned by QDateTimeParser.

Fixes: QTBUG-83075
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I8b79add2c7fc13a200e1252d48dbfa70b36757bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-22 14:14:30 +03:00
Friedemann Kleint
26a0a89421 Fix assigning int QFlag-type properties
Ensure they are handled as enumerations in QMetaType.

This is required for handling QFlag-type properties in Qt Designer

Fixes: QTBUG-83689
Change-Id: Ifbfb5c5b5cd34fce462e299505d063e22e725c2e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-04-22 09:49:48 +02:00
Lars Knoll
50916edd9d Always encode HTML as utf-8
When converting a text document to HTML, always convert it to utf-8,
as required by the HTML standard. This also means that we remove
the optional encoding parameter.

Change-Id: I0bd2fc9df2d06734e1c5b8053b964fbfbb6881e1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-21 15:46:36 +02:00
Jarek Kobus
df234035d0 Squash again some tests in concurrentmap
After adding new tests, the source code of tst_concurrentmap
grows rapidly with copy/paste/replace pattern.
This intoduce the issue with maintaining the test.
Get rid of separate functions for testing blocking versions
of mapped/mappedReduced and test blocking versions in parallel
with non-blocking flavors. So again, get rid of duplicated code.

Task-number: QTBUG-83258
Change-Id: I4cac6f4e1bfd1b50363dc094610717674aebf2af
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-04-21 10:28:06 +02:00
Jarek Kobus
d998a467ac Add more tests for QtConcurrent::mappedReduced()
Test the case where reduce function of the form:
V function(T &result, const U &intermediate)
has T and U types different. Make use of
numberSumReduce function and corresponding functor
that reduce Number class object to the result of int type.

Fixes: QTBUG-83258
Change-Id: I194d290988b48e7bca91228c0cd5d39efd1b4712
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-04-21 10:22:26 +02:00
Jarek Kobus
82729ddb2a Get rid of code repetition in concurrentmap test
Move tests with initial value next to their original version.
Join new lambda tests into a common functions
testing all possible 16 combinations of
functor / function / member / lambda, as they
test in fact the same function. There is no need
to distinguish lambda case over other cases.
This helps in test readability and maintenance.
Add missing tests for lambdas with a combination
of initial value.

Task-number: QTBUG-83258
Change-Id: I7a3d2bf87384d7feecffaaf39281cd626955b0a4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-04-21 10:03:49 +02:00
Shawn Rutledge
51a348b2e2 Markdown writer: omit space after opening code block fence
The CommonMark spec shows that it's not necessary to have a space
between the code fence and the language string:
https://spec.commonmark.org/0.29/#example-112
This also avoids a needless trailing space after a code fence that
does not include a language string.

Change-Id: I2addd38a196045a7442150760b73269bfe4ffb22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-20 21:08:32 +02:00