The example was refactored to use the PMF connection syntax.
However this introduced a problem: when connecting a QAbstractButton
to a slot that has a default parameter, the semantics of the connection
change between string-based connections and PMF.
Specifically: when connecting the
QAbstractButton::clicked(bool checked = false)
signal to a slot like
View::zoomIn(int level = 1)
then a string-based connection like
connect(button, SIGNAL(clicked()), this, SLOT(zoomIn()))
would call zoomIn without carrying the signal's parameter over.
In other words, zoomIn's parameter is defaulted. The same connection
using PFM instead is
connect(button, &QAbstractButton::clicked,
this, &View::zoomIn)
which would "connect" the arguments. This makes emissions that pass
false as clicked's parameter result in a zoomIn by 0.
Fix it by avoiding the default parameter of zoomIn -- just split
the function in two (zoomIn and zoomInBy).
Amends 8cf8122314.
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-100135
Done-with: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Change-Id: I10c150c648034449e3154140108de2d64326d965
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This adds significant run-time overhead and should not be on by default.
Pick-to: 6.3
Change-Id: I33d312e31bd714f696d8acf2066eb4b285ff04af
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This little change fixes the build on CentOS 7
Pick-to: 6.3
Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QDateTime represents a specific point in time, so arithmetic
with durations makes perfect sense.
Moreover, we can finally equip QDateTime with a subtraction
operator, to calculate the duration between two QDateTime
objects.
[ChangeLog][QtCore][QDateTime] QDateTime now supports arithmetic
between QDateTime objects and std::chrono::duration objects.
A duration can be added to or subtracted from a QDateTime, yielding
another QDateTime; and two QDateTime objects can be subtracted
from each other, yielding the duration between them.
Change-Id: I656419f3bb9418c49f0e2fd0800c3dbaaf6aff32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use our usual if_x<> = true pattern to move the constraint to where it
belongs (absent C++20 requires-clauses): into the template argument
list.
Amends a00a1d8806.
Change-Id: I846b96bdeec3def221346897181d3d4d3a55316d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Clazy complained that the class has a dtor, but no copy ctor.
Pick-to: 6.3
Change-Id: Ida4024df1ff22c7758b8efa6e9383e03734720a8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
QXmlStreamPrivateTagStack holds the string data in a single large
QString, which, on 64-bit platforms, can hold more than INT_MAX
characters' worth of data. However, the code managing this QString
still used int variables instead of qsizetype, making failure for such
large tag string data all but inevitable, even though I didn't go to
the length of actually constructing a failing test case.
Fix by using qsizetype instead of int where required.
Fixes: QTBUG-102467
Pick-to: 6.3 6.2
Change-Id: I50b7e194e43f3c7dce69c6e1fd4682fc517dd7d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The XmlStringRef(const QString*) ctor calls the (const QString *, int,
int) ctor, passing QString::length() as the third argument. If the
input QString had more than 2 Gi characters, the resulting
XmlStringRef represents only the prefix of the input (mod
(INT_MAX+1)).
Fix by making the delegatee ctor use qsizetype instead of int,
allowing to pass data through without truncation.
[ChangeLog][QtCore][QXmlStreamReader] Fixed several bugs regarding
handling of documents larger than 2Gi characters on 64-bit platforms.
Pick-to: 6.3 6.2
Fixes: QTBUG-102466
Change-Id: Ie48274190ac359f62d3ec3d8fe60eb43cc2c362a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A time_zone represents a timezone identified by its IANA ID. This
allows for a straightforward conversion to QTimeZone.
[ChangeLog][QtCore][QTimeZone] QTimeZone can now be constructed
from a std::chrono::time_zone pointer.
Change-Id: I093d9fc2e989475d30730a9dcdef491903a2aeb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code in the Q_TRACE_ENABLED case was doing the same sort of
qobject_cast that is done in the fileName() accessor; so it's both a
code deduplication and an optimization to get the filename into a
local variable once, and use it both for tracing and for the
@Nx suffix check below.
Task-number: QTBUG-100578
Change-Id: Id7bde4ddbab38e20694c09cc7b412fec091672de
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
No need to assert, returning when the window is already added or not
removed is enough.
Pick-to: 6.2 6.3
Fixes: QTBUG-100173
Change-Id: Id491f17612ce42c4e26e9d41ad38f0a6372775bd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Make ~EventCallback() not clear properties belonging to
other EventCallback instances.
This fixes File::stream(), which creates a new EventCallback
before deleting the old one when updating the callback
function.
Pick-to: 6.3
Change-Id: Ib5f78ccc4158d94e8d3f5b9ebb9979c123b1966a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
To make sure we don't end up use a dangling pointer for m_focusObject.
Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-102447
Change-Id: I75058040be109a39f830bc706efe85969ffbc8ec
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.
Change-Id: I48e2946c4cc8d0a6c3e0cc37e1f73510b878d574
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When generating .pc files there is a warning when executing
QtFinishPkgConfigFile.cmake:
Ignoring empty string ("") provided on the command line.
This happens because the 'postfix' argument is a part of the script
command line even if it's empty. It also makes no sense to check if
'postfix' is empty using genex, use configuring-time check instead.
Pick-to: 6.2 6.3
Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously there was a mixture of buf.constData() and buf.data() with
buf not being const QByteArray. As a result, buf.data() returned a
re-allocated buffer and texData was keeping pointers to that one, which
became invalid once the function returned and the re-allocated buffer
was cleaned up by destructor.
Change buf to const QByteArray so that there is no difference between
data() and constData(). Additionally convert all constData() calls to
data() to avoid confusion.
Detected by Address Sanitizer on testcase
tst_qtexturefilereader::checkMetadata()
Pick-to: 6.3 6.2
Change-Id: Idb6f6141898678bf95ed9233a92b7bb3ad12e250
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.
Could also be skipped in runtime by setting the environment variable:
ASAN_OPTIONS=allocator_may_return_null=1
Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The TLS v1.0 and v1.1 enums are all deprecated since 6.3. At the same
time, the test requires their use, because none of the peers seeem to
implement TLS v1.2, yet (cf. e.g. QTQAINFRA-4499).
Fix by copying the relevant enum values into global variables and
using those. This is a selective way to deal with the issue. The use
of the enums is so widespread in the test that the alternative would
have been to globally suppress deprecation warnings, which, however,
may suppress warnings we may actually want to fix.
Pick-to: 6.3
Change-Id: I4186be72209527fc404f3ba0a5a15f9719c64698
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The Q(Basic)Mutex fast paths are entirely inline in the caller, which
means we need to annotate its operations directly or TSAN doesn't know
what's going on. Also annotate QRecursiveMutex.
The tryLock code could be in principle simplified via a QScopeGuard
but I didn't want to make a central class like QMutex depend on it.
[ChangeLog][QtCore][QMutex] QMutex now has annotations for
ThreadSanitizer.
Change-Id: Ibb130404e63a5ec9bcef9675f9addd16a2c38b7f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC will export any function in an exported class, including inline
ones. Conversely: client code calling inline functions in imported
classes will end up simply calling the symbol of the function, even if
the function is fully inline.
This is a problem for adding post-C++17 APIs in Qt. Such APIs are added
as inline functions protected by feature-macro tests, so that both Qt
and client apps can use any C++ version they want (any combination
works).
However, if we add a function using post-C++17 API to an exported class,
then the combination "Qt built in C++17" + "client built in post-C++17"
won't work any more. The client will expect the symbol for that function
to be exported by Qt, but Qt won't have it (built in C++17).
As a workaround, add a marker that turns these functions into "faux
templates", like Q_WEAK_OVERLOAD does.
Change-Id: I2adab81e3129c881c5a8e0772948b176fa4db1b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There is no need to limit the type to QOffscreenSurface here, QRhi does
not depend on the behavior in QOffscreenSurface. Users can use the
custom offscreen QSurface types if needed.
Task-number: QTBUG-102257
Change-Id: I47a064496f8c5f1986a0e11ec748ea32a03b903e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Request 16 bit floating point backbuffers and set the color space
of the CAMetalLayer to kCGColorSpaceExtendedLinearSRGB if we set
up the swap chain to use extended SRGB.
Unfortunately the required CAMetalLayer.wantsExtendedDynamicRangeContent
property is not yet available on iOS, so for now this is a macOS
only feature.
Change-Id: I28ab12cc0b829eded721061da2679be8e31d6b9d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.
Change-Id: Ibe32a11699f67df2aa80505ba2944f33e5e823e0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Ensure that it's safe to call readAllStandardError()
when process channel mode is set to MergedChannels.
Pick-to: 6.3 6.3.0
Task-number: QTBUG-102177
Task-number: QTCREATORBUG-27196
Change-Id: I01073255d9347dee4654d602802a12d341372b73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There is no use case for QProxyStyle to forward events to its base
style. QApplication does not send events to it; a style using e.g.
timers or so will have them active on *itself*, not on the proxy.
Moreover, forwarding *all* events is broken: QTBUG-96213 has been
triggered by forwarding DeferredDelete events sent to the proxy (thus
accidentally deleting the base style). But one can concoct many other
similarly broken situations; for instance, setting a proxy onto a base
style will make the style a child of the proxy. That sends a
QChildEvent to the proxy (ChildAdded), and that event is then passed on
the base style, resulting in the base style receiving an event saying
"you have yourself as a child".
Change-Id: I3b92bb168ce3c54a32469c36b6d1da4380ed564f
Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
because the old xcb_randr_monitor_info_t was invalid very often
during update.
Pick-to: 6.3
Change-Id: I8c0bda93bde4e816fc98cde1a7205c6369ab39e1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
tst_qmltc_examples failed because m_accessibilityContext
could become a dangling pointer if the object in points to gets
deleted. This resulted in a crash.
Amends e0c61193ea.
Task-number: QTBUG-101865
Task-number: QTBUG-95764
Pick-to: 6.3 6.2 5.15
Change-Id: Ie85118429b1afa6e4a41f899ca065f493e166570
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When PCRE2 is compiled using cmake, a pcre2 cmake file is installed
and Qt fails to configure because components isn't specified for
find_package.
In recent PCRE2 releases components needs to be specified for
find_package.
Fixes: QTBUG-102358
Pick-to: 6.2 6.3
Change-Id: Ib842b2c4b1c0bf38aa5da5475eaa2b3c56c6b822
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The QBoolBlocker would end up using a stale d-pointer if the window
was deleted during delivery of the close event.
Fixes: QTBUG-102327
Pick-to: 6.3 6.2
Change-Id: I8f458581eeabf0d0f27a348ad1f926295caa3a58
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
getDisplayName() now returns QString instead of QJniObject. It's more
clear and allows to save some QJniObject::toString() calls in other
parts of code.
Pick-to: 6.3 6.2
Change-Id: I0f2061cf1dff21c09c2272bf1e9126ff1ea0ed3e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Before the patch we tried to create a java Locale object by passing the
human-readable language, territory and variant strings. However, the
Locale constructor accepts ISO-defined codes.
Fix it by using a factory method Locale.forLanguageTag() [0] that
constructs a Java Locale object based on BCP 47 tag.
[0]: https://developer.android.com/reference/java/util/Locale#forLanguageTag(java.lang.String)
Fixes: QTBUG-101460
Pick-to: 6.3 6.2 5.15
Change-Id: If414c66cf0e5b7e8299ffc3a6038b6f9eb79d5ec
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When the date-time string falls in a spring-forward (so is invalid)
and one of the fields of the parsed string doesn't match the format
it's meant to (e.g. a single-digit seconds field when format ss was
specified), a check that the current fall-back date-time is between
the minimum and maximum for the parser object failed, triggering an
assertion.
In any case, an invalid default-value wasn't useful to the code that
parsed a single section of the date-time string, so brute-force the
current value to a valid date-time (when possible) using the usual
round-trip via milliseconds since the epoch.
Added the test-case which first revealed the problem, plus a couple
more informed by it, to exercise the same code-paths with fewer things
failing.
Fixes: QTBUG-102199
Pick-to: 6.3 6.2 5.15
Change-Id: I658308614505ef25f4c97d0de6148acb54a65a0f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use of QSKIP() means the whole test is skipped; when all applicable
parts of a test have passed and some part of the test is inapplicable,
merely report that it is skipped, rather than discarding the PASS for
all the parts that do work.
In the process, eliminate a spurious layer of indentation; the earlier
test only needed a scope to contain its declaration, a goal adequately
achieved by the scope of the if constexpr block.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Recent fixes to include the "We mean it" comment in the header also
lead to that comment appearing in the generated .cpp file, which also
lacked the "This is a generated file. DO NOT EDIT." comment. The
generated header also lacked a blank line after the "We mean it"
comment, so include that (and take it out, too, in the .cpp). The
"Please see" line of the "DO NOT EDIT" comment also used the name of
the generator script as seen from the Makefile that drives the
regeneration; replace this with the README.md file that actually
explains how to regenerate the files in corelib/global/.
This amends commit 71af0d7059
and commit b852584556
Change-Id: I4b5b4dbef5954819632bb625d1914a9ec46e15d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... a leftover from the initial patch-set not required in the one that
merged.
Change-Id: I0c5e94d8a0409faf4f7f9a354e98e239f7186da3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
For such widgets, QBackingStore::flush() takes both a region and an
offset. Both must to be DPR scaled to the native backingstore
coordinates. When the DPR is fractional, it can happen that the
rounding of both effectively accumulate into an off-by-one error.
Detect and adjust for this situation to avoid painting glitches.
Task-number: QTBUG-96223
Fixes: QTBUG-102366
Pick-to: 6.3 6.2 5.15
Change-Id: I9ccd4ee54660419a1db8c27358f1419de58ae932
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Most likely related to qemu network configuration which cannot be
modified. Reason is that in QNX there is tool which can be controlled
qemu configuration, and it does not provide options for more finer
grade network configuration.
Pick-to: 6.2 6.3
Task-number: QTBUG-101274
Change-Id: I660466e36252e902a2314fb3f4988c531cda9214
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Using QFileDialog::setMimeTypeFilters() with a list of mime types may
in some cases result in the same name for two different mime types,
for example both "image/heic" and "image/heif" will result in the
name "HEIF image (*.heic *.heif)".
When the resulting name filter is propagated to the platform layer,
we add entries to a NSPopUpButton, but the convenience API we used,
addItemWithTitle:, does not allow duplicates. As a result, the entries
in the menu didn't match the list of name filters we then looked up
and applied to the actual file name filtering, causing off by one
errors.
Ideally we'd make sure the name filters are unique and well formed
all the way from the QFileDialog to the platform and back, but for
now we work around issue by using the NSMenu API directly, which
does allow for duplicate entires.
Fixes: QTBUG-101361
Pick-to: 6.2 6.3
Change-Id: Iee3db4e6c5adfdbdd7f0094b4efd65aa2ecc0f57
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>