Need to use QConcatenable<>::ConvertTo for SFINAE, the forwarded type
alias in QStringBuilder itself doesn't work.
[ChangeLog][QtCore][QAnyStringView/QStringBuilder] Implicit conversion
from QStringBuilder to QAnyStringView now works as advertised.
Pick-to: 6.2
Fixes: QTBUG-98138
Change-Id: I1c300675cf43b13017bc56398ae5d8c1c51e64fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Some multi-touch devices send touch information for each finger using
different WM_POINTER messages/frames, instead of a single one with
a list of touches, like most devices. This would result in the generation
of multiple touch events, which can cause unexpected behavior in
applications (the QTouchEvent documentation specifies that it should
contain all simultaneous touches). This patch adds a workaround to
ensure all simultaneous touches are included in the events, to comply
with the expected behavior.
Pick-to: 6.2 5.15
Change-Id: I12a2f84b35a6bdd49ee53d25de580c0941a9aea6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The backingstore may reconfigure the internal data, so clients should
not assume that the image is valid beyond any new operations on the
backingstore.
Pick-to: 6.2
Change-Id: I137ad4f2adb45ec8bb78a989fbb5bac1e72965ce
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The m_pendingFlush variable is used to track what is missing in the
server side backingstore. If we're doing a client side scroll the
pending area is still the same.
If we were to always discard the scrolled area from m_pendingFlush
we would get in trouble on the next non-client side scroll, as
we think the content exists server-side.
Pick-to: 6.2
Change-Id: Ie50a99a8e5d8a83d1299c53534a1c83c6bfb47bd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The area we're going to fill is the one after applying the scroll delta.
Pick-to: 6.2
Change-Id: I254830a15e5f4c93ba28ed8f0a9b35c40f1d1af2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Don't crash if the font does not have any families set.
Pick-to: 6.2
Task-number: QTBUG-97995
Change-Id: I8dc2f2fc00309b6fff6d4a661ec6d659f30808af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
In Qt 5, fonts had both singular family and plural families properties,
and both were stored separately when streaming through QDataStream. The
families list was treated as an extension of family in this case, and
the primary font family was always the singular family property.
In Qt 6, it has been merged into one and family() is now just a
convenience for families().at(0).
But when reading files generated with Qt 5, we would ignore the fact
that these were previously separated. We would first read the family
entry into the families list, and then we would later overwrite this
with an empty families list.
Instead, we detect streams created with Qt 5.15 or lower and make sure
we append the families list instead of overwriting it in this case. In
addition, we need to make sure we split up the list again when
outputting to Qt 5.x.
This adds a file generated with QDataStream in Qt 5.15 to the test to
verify.
[ChangeLog][Fonts] Fixed a problem deserializing the family of fonts
that had been serialized using QDataStream in Qt 5.
Pick-to: 6.2
Fixes: QTBUG-97995
Change-Id: Id3c6e13fc2375685643caee5f8e3009c00918ccb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
QMacStyle has a single NSSlider that is used to render any QSlider. For
each QStyle API operating on a slider, the style sets the slider up with
respecive properties. On macOS 12, the NSSlider maintains some states
that make QSlider instances influence each other's knob position when
rendering, resulting in uncontrollable jumping of the slider.
This can be fixed by not using startTrackingAt/stopTracking APIs, which
are however the only way we have to make the slider knob get rendered
pressed - there is no property in NSSlider(Cell), and none of the NSCell
attributes have any effect. So we need to use startTrackingAt, and work
around the side effect by reinitializing the NSSlider by calling
initWithFrame.
This fixes the positioning error, but also causes flickering of the knob
when dragging. To fix the flickering, we have to always call
startTrackingAt for a slider that is pressed, even for calls to
setupSlider that are made in QStyle APIs that are not drawing anything.
Also tried with no complete success (either positiong bug or flicker):
* call prepareForReuse on the NSView
* always call stopTracking on the NSSlider
Fixes: QTBUG-98093
Pick-to: 6.2 6.2.2
Change-Id: I3423b9f7cb125a59831c6722509ab3b74742b6ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
With pre-11 SDKs, macOS reports version 10.16, which already matches
BigSur, so we only match Monterey if version 12 is reported.
Change-Id: I37fee43756310370444981212750cdfe7fad64b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QObjects must be deleted if the QCoreApplication is being destroyed.
This was previously done by implementing custom code in qtbase and
other modules. So unify it and introduce a Q_APPLICATION_STATIC,
based on the Q_GLOBAL_STATIC, which centralises the logic.
Since we still have a few remaining living QObjects,
this comes in handy to fix those as well.
Task-number: QTBUG-84234
Change-Id: I3040a2280ff56291f2b1c39948c06a23597865c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise the count will be wrong after an out of memory failure in
reinterpretAsFormat.
Pick-to: 6.2 5.15
Fixes: QTBUG-98377
Change-Id: Ice51d47a6db9277126a5c7337e14aaf5ddee3a10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The stack needs to be at least SIGSTKSZ, which isn't constexpr, so we
can't allocate it at compile time. However, we can resize(SIGSTKSZ) a
QVarLengthArray that's probably big enough anyway. At the same time,
increase the compile-time size to 32k, to match what our Catch2
harness for the self-test uses.
Change-Id: I3a34ece73901dd402672cd6fe4da66923f1932c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Shrinks the const array by one zero-terminator and makes the code
accessing it read more gracefully.
Change-Id: I4034116a83ff3cd05ea0feb0ce8a4340c54a9faa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If we fail to install our own action, the contents of oldact are noise
anyway, so we can't use them to decide anything; and, in any case, we
didn't replace the prior action, so have no duty to restore it.
In the process, restructure and comment the code to make it easier to
follow what's going on and why. Package a conditional in a lambda to
make the #if-ery less problematic. This should also make it easier to
hack any other complications into the condition, should they arise.
Change-Id: I712335ee27f68a8594dc2fe6441a91f686967da2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The relevant MS system calls (say they) don't support date formatting
for years < 1601 (but apparently do in fact) and the year field of the
data structure is unsigned, so can't support years < 0. As a result,
the windows back-end for QSystemLocale failed for negative years.
So replace year < 1601 with a place-holder and substitute after
formatting.
Added new tests (based loosely on one in qtdeclarative that failed) to
verify that this actually works. These reveal that macOS also fails to
handle negative years; marked as expected failure there pending a fix.
Change-Id: I9b63cefd5f0b77a39cf1238549412de3e26ca1bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The parameter-list of a method is already in its class's context, so
doesn't need it made explicit on the other class members involved.
Change-Id: I253b098ad1f2d2db80d49d8f484b7f95d14acec1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Given that at least one zone has a negative offset (so that it's in
standard time for most of the year, including summer, and
daylight-saving time relatively briefly during winter), QTimeZone's
docs should explain what that means.
Change-Id: I6649b4cdefbd685dc97bf85d957960da44d07aed
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Its MIN_YEAR was duplicating what's now provided by
QDateTime::YearRange::First, so use that instead.
In the process, tidy up an over-long line.
Change-Id: I109f5435f63cb5cc97d54529a172b640f919dec0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Recent commit 6845c444d0 elicits
warnings about two unused constants. Remove an unused macro at the
same time, and add missing LL suffix to remaining qint64 constants.
Change-Id: I4c84e10b512030e0e4f860d434382e62e6c936f5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.
Amends 8bd0a09475.
Pick-to: 6.2
Change-Id: I077948b33f985cd4a2e3a9e591645cf20d7af91c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Base class dtors should be virtual and public or else protected and
non-virtual. This one was neither of these.
[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
QIODeviceBase destructor is now protected to avoid deleting objects of
classes derived from it through a QIODeviceBase pointer, which would
be undefined behavior.
Change-Id: Id390ace75d5b64f746d9b1865b8800c9f0590977
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- GHS compiler doesn't have -Wextra flag and it leads to huge count of warnings.
Pick-to: 6.2
Change-Id: Id2ba654a49fb163bebc75e3a22ecaa1895ecdbe8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This is basically a revert of: 634ce491e8
The cached keyboard modifier can get out of sync when switching to
another application while a modifier is pressed. In this case we get a
key press event but we might not get the key release event, which is
expected to reset the cached modifier. Switching back to the Qt
application after the modifier was released now still has the old
modifier cached.
Most prominent example is triggering alt + tab to switch to another
application and use the mouse to get back to it. In this case the alt
modifier is still cached.
Task-number: QTCREATORBUG-26581
Pick-to: 6.2
Change-Id: I9d64b7d730af089778bd1a4b3f1296bcccd5d16d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Provide basic boiler plate that sets up the baseline (aka lancelot)
framework specifically for comparing the appearance of widgets, and
implement test functions for QSlider and QPushButton.
Widgets should always look the same if the QPA platform, the OS
version, and certain UI-impacting attributes are identical. Ie.
on any macOS 10.15 machine that runs in "Light" mode, widgets
look the same. On a macOS 11 machine, they might look different.
On an OpenSUSE machine using the fusion style things might look
different from a Ubuntu machine.
The helper function removes DPR differences - images are always
scaled to a DPR of 1.0, which allows us to compare the image\
content and not get distracted by them having different dimensions
(and the fuzzy comparison of images might make the system tolerate
scaling artefacts).
Note: For now, this test is meant to be run locally, either when
testing changes to style code, or when checking how QWidget based
UIs would look on newer version of an operating system. In CI the
test is run, but then skipped in CI as the baseline server is
not configured.
Change-Id: Ie33a9d979d934f0df6883757333ce2c5e2f7ef84
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
CFDateFormatterCreateStringWithDate() creates a CFStringRef that we
need to tidy up once we're done with it, so use the QCFType template
to take care of that.
Change-Id: Ibc3751426cc4496bce25307918fdb11722cde3b2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This is done by disabling system-xcb-xinput feature by default. It will
require user to pass -no-bundled-xcb-xinput to the configure script to
override this.
The reason for the change is that touchpad gesture implementation
requires new code from libxcb, yet this new code is not even released
yet. Even if it was released today, at least several years will pass
until the new version is common enough.
[ChangeLog][Third-Party Code][X11] The xcb plugin is now compiled with
the bundled xcb-xinput library by default, in order to enable support
for touchpad gestures.
Change-Id: Iebb27ecee7facf070ef23f37a55aab0578698f16
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
While all writers of the variable hold fileEngineHandlerMutex for
writing, the qt_custom_file_engine_handler_create() function checks
the value before entering a fileEngineHandlerMutex read-side critical
section, thereby causing a C++11 data race.
Fix by making the variable atomic. Interestingly enough, relaxed
atomic operations suffice here, since the actual synchronization
happens in read- and write-side critical sections, and if
qt_file_engine_handlers_in_use is wrong w.r.t. to the actual list, the
critical sections will still work. We just mustn't cause UB by reading
and writing to a simple bool without proper synchronization.
Pick-to: 6.2 5.15
Change-Id: I30469504cdbc90e2ab27125181e53d74305f13fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Instead of taking a copy of the incoming data, followed by a quadratic
modifying algorithm (single-element erase loop), guaranteeing a
deep-copy detach of the original, just iterate over the incoming data,
building the new dataset by appending only valid items.
Also port to ranged for loop.
There's more quadratic behavior in that function, later on, but that's
for another patch.
Change-Id: I284f3b7c9694c8eb226a198f6f97538765113b19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In contrast to the binary decoder code, the ascii decoder would not
abort and fail on premature end of file.
Pick-to: 6.2 6.2.2 5.15 5.12 5.12.12
Change-Id: If27bce0afa8d1de6c4dbeb2bc0e623c1dcc2f1e0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Calling doneCurrent() on a QCocoaGLContext only clears the current
context, but doesns't reset the drawable (view) of the context. In
most cases this is fine, but it has been observed to cause issues
when using the software GL renderer on Big Sur and above.
To be a good citizen we clear the drawable of any of our contexts
that are tied to the NSView this about to be go away.
Pick-to: 6.2 6.2.2
Change-Id: I8c845727c50871f30fbebc2ed62a7d0485651ecf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
We don't list xmlstarlet in the install documentation, also
because the affect on code size is not too big. We therefore
also don't print a CMake warning then.
Pick-to: 6.2
Change-Id: Ifad3ef0106d09640a7c7d1736f4d5382bcf18e35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reduce overhead for including qguiapplication.h by splitting
up qnativeinterface.h into a public and a private part.
[ChangeLog][Potentially Source-Incompatible Changes] The
qguiapplication.h header no longer implicitly includes
qloggingcategory.h. If your code depends on the transitive
include, explicitly include <QLoggingCategory> where needed.
Pick-to: 6.2
Task-number: QTBUG-97601
Change-Id: Ic02327a1c3092e21730160af5c59a9d58dc1239c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The header for QTestEventLoop hadn't been included.
Pick-to: 6.2
Change-Id: Ife3418d1634c030c421c2aa55469f5a099386d4b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Says GCC:
qtbase/examples/network/multistreamclient/timeconsumer.cpp:85:37: error: incomplete type ‘QIODevice’ used in nested name specifier
85 | QDataStream ds(&buf, QIODevice::WriteOnly);
| ^~~~~~~~~
Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.
Pick-to: 6.2
Change-Id: Id8d87dbcb497e4feca1d5d3ce6b1bdb9da5c0dab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In preparation for addition of new baseline tests, establish a new
test category, "baseline". This is similar to the category
"benchmarks" in that it contains tests that use the QTest framework,
but conceptually are not unit tests, in contrast to those under auto/.
Move the existing QPainter baseline test, tst_lancelot, into this new
category, and rename it accordingly.
Baseline tests use the QBaselineTest extension to QTest. Move that
extension too into the tests/baseline directory, allowing the clean
out of the baselineserver directory.
Pick-to: 6.2
Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If QFontComboBox is instantiated in the form of new and call
QFontDatabase::addApplicationFont, QFontComboBoxPrivate::_q_updateModel()
will be called when the program exits, at this time qApp will crash.
Fix this by when program exiting, QFontComboBoxPrivate don't need
call _q_updateModel().
Fixes: QTBUG-98099
Done-With: Konstantin Ritt <ritt.ks@gmail.com>
Pick-to: 5.15 6.2
Change-Id: I3df3d19c3d1971288d60f2eef386262befbf396b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Quite some code in Qt takes a copy of a QRegularExpression and then
changes something on it (e.g. the case sensitivity) based on some
other criteria:
QRegularExpression copy = orig;
if (cond)
copy.setPatternOptions(copy.patternOptions() | CaseInsensitive);
use(copy);
This pattern can be found in QAIM, QString-related classes, and so on.
The "problem" is that if the attempted modification is a no-op, we'd
still invalidate the copy object (by detaching). Even if no detaches
are involved, setting the same pattern or options on a QRE object
shouldn't require a relatively expensive pattern recompile.
In summary: don't detach/mark a QRE object as dirty if a setter didn't
actually do a modification.
Change-Id: Iae0ab4a5e443e7285a83d3d7e0f1dcfd66e8d51d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The source was already protected, but the destination wasn't.
Pick-to: 6.2
Change-Id: I300f19c3e65abd8bc1eef4309aefa11852d1c049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These algorithms never call mid() with funky values, so they don't
need the mid() side-cases, and associated 7-branch deep conditionals.
Just use sliced().
Change-Id: I05b6a0e47da90f09b34a92211f7e783a2db709f7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Also, add a TODO for migrating to QmlImportsPath in qt.conf.
Task-number: QTBUG-98335
Change-Id: I3c321c99c6286ba64eef643876f5b56d5a8ca695
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In case the class doens't have a default constructor, checking for
object.isValid() will give false because the object won't be created,
however, the class could still be loaded and we could have a valid
jclass.
Pick-to: 6.2
Fixes: QTBUG-96069
Change-Id: I8d59e26d9d7c0e8e363ce443937091a374a24473
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>