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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
...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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
Many of these were generated by clazy using the new qevent-accessors check.
Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The helper processes were not in the correct location.
Change-Id: I0a80a22a931625ea0c9370db38ff29c881b964cb
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Make the API more symmetric with regards to both QString and QStringRef.
Change-Id: Ia67c53ba708f6c33874d1a127de8e2857ad9b5b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
[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>
Tests focusProxyAndInputMethods and
multipleToplevelFocusCheck will be blacklisted
Task-number: QTBUG-84259
Change-Id: I7d5baf1e700192eed3c7c8dcfe671e247f11b8c7
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
There's no real dependency to QTextCodec in those files anymore.
Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
Use QStringConverter instead. Also change the default
encoding of QTextStream to utf8.
Change-Id: I30682e75fe0462d1a937539f773640c83a2d82e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
This is a replacement for Qt::codecForHtml().
Change-Id: I31f03518fd9c70507cbd210a8bcf405b6a0106b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Also port its callees. These functions scream to the QStringView-ified...
Change-Id: I13c95d65941eb8d02223306d80efd1437b4bd9b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Expected and actual were inverted.
Pick-To: 5.15
Change-Id: Idc3fae4d0f614c389d27fffd15e9fa6a0a8f25e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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>
Should improve performance and is going to be required in
the future anyway.
Change-Id: I89d7c50441d2491da1ab0a4d564dcc91f52ade85
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
Cleaning up those that are trivial to remove because they have direct
replacements.
Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>