This was lost when QtCore, QtGui and QtWidgets were split up. Restored
now via a virtual function on QObjectPrivate.
Chose to return std::string instead of QString or QByteArray because
its SSO is usually sufficient to hold these flag strings.
[ChangeLog][QtCore][QObject] Restored printing of Qt3-style
information from dumpObjectTree().
[ChangeLog][QtWidgets][QWidget] Restored printing of Qt3-style
information from QWidget::dumpObjectTree().
Fixes: QTBUG-101732
Change-Id: I39ff5728ea5f5abbdbf81b5d7e13b8d16b6ee8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
... in preparation for replacing the QString keys in the public API
with QAnyStringView ones.
This removes the "important optimization" that avoids a detach in the
common case where the input is the same as the output of
normalization. But that optimization is beside the point, because it
trades a memory allocation avoided in the library for O(N) allocations
inserted into user code for each call to QSettings::value(), the vast
majority of which are calls with string literals.
With the public interface ported to QAnyStringView in the follow-up
patch, we can then internally optimize memory allocations _in a central
place_ (e.g. by returning std::u16string or QVarLengthArray<QChar> from
normalizeKey() instead of QString). But first we need to get rid of all
the unwarranted allocations in user code.
Change-Id: I45fc83d972c552a220c9c29508001d3f172e1162
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Selection change handlers of the items might call a method that
implicitly recreates the selectedItems QSet, which then invalidates
the iterators of the ranged for loop, resulting in crashes.
Iterate over a copy of the set instead.
Add a test case that crashen without the fix.
Fixes: QTBUG-101651
Pick-to: 6.3 6.2
Change-Id: I6da6f4043fe1906b0186931a37283f635cb5a404
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Add move constructor and move assignment operator.
To allow for the the change to be implemented QTemporaryDir, the
internal d_ptr was modified from a QScopedPointer, which is not movable,
to a raw pointer.
Add member + free swap implementations.
Add tests.
[ChangeLog][QtCore][QTemporaryDir] Enabled move semantics.
Change-Id: I9f196a77c70b4ca0b7f0c06505d00fdd87a9785c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
ClipboardManager didn't have any APIs to clear clipboard data before
API level 28.
As a workaround an empty Intent with MIMETYPE_UNKNOWN is created and
inserted into the clipboard for lower API levels.
This makes the QApplication::clipboard()->clear() method work more or
less as expected.
This allows to unblacklist tst_QPlainTextEdit::copyAvailable().
Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I454376199cf3b8eed0fa2ecf2f85b87f40892280
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Because setObjectName() now takes a QAnyStringView, passing C string
literals is much more efficient than using QString::fromUtf8().
This patch only deals with setObjectName() as a known property,
probably from a name attribute. If the objectName property is set by a
<property> element (or so I assume), we still emit a
QString::fromUtf8(). Detecting objectName there would be too much
magic.
Besides, I haven't been able to find why sometimes there's a second
setObjectName call right after the first, when in the XML it seems all
kosher (name attribute and objectName <property> agreeing on the
content).
Change-Id: Icf07bad841ac735a9c744bbd955428ba15758089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Parent window in sizeLessWindow test was using software pipeline at
least on webOS, causing a QCRITICAL() exit when the test was executed.
Fixes: QTBUG-101869
Pick-to: 6.3
Change-Id: Ie8cc0ea0b6a09729475389be44197e01a45b217f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
There is no reason to allow relock() on a locked locker, or unlock()
or an unlocked one, just like we don't allow that on a plain mutex
to begin with. The docs already said that e.g. relock() locks an
_unlocked_ locker.
[ChangeLog][QtCore][QMutexLocker] QMutexLocker allowed relock() and
unlock() on an already closed (resp. open) locker object. These
semantics have always been undocumented and are now unsupported
(in both cases they yield undefined behavior.)
Change-Id: Id5f67beb5dc30d6435dae88a3085fba93ec7d96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Percent-decoding was previously only present as a static method taking
a QBA parameter; it might as well be an instance method of that
parameter. Change most QBA tests to use it rather the static method.
[ChangeLog][QtCore][QByteArray] percentDecoded() is now available as
an instance method of the byte array to be decoded, equivalent to the
static QByteArray::fromPercentEncoding().
Change-Id: I982101c44bdac5cc4041e85598d52ac101d38fa1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The class is similar to unique_lock in that it allows for unlocking
and relocking. Since the locked state is tracked by QMutexLocker itself,
it's trivial to make it movable.
[ChangeLog][QtCore][QMutexLocker] The class is now movable.
Change-Id: I534044f8024575e996c12efb2236761d493798a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Connecting to nullptr, or connecting to a non-signal PMF, would result
in a QFuture which would never finish. Catch these cases and handle
them.
Windows+MSVC for some reason fails the test. I can't entirely understand
why, so I've marked it as XFAIL, with QTBUG-101761 to track it.
Change-Id: I314980e7e9b7156d8cddd3b33d5cbf1d0bcd6116
Pick-to: 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Use VERBATIM option to prepare the correct command line for the
add_custom_command. This especially sensitive when using build
directories with names containing special symbols, that cannot be
handled by shell correctly.
Change-Id: I51d7041cb806411135fd59bf6273c04a3c695443
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QString already has a localeAwareCompare(QStringView, QStringView)
static method. Use it in QStringView::localeAwareCompare(QStringView).
[ChangeLog][QtCore][QStringView] Added
QStringView::localeAwareCompare().
Task-number: QTBUG-98431
Change-Id: Iec3865a5439d9fb653cc1150da21042186bdee98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
On Wayland, there is no protocol to do it yet.
Task-number: QTBUG-100792
Task-number: QTBUG-101145
Change-Id: Id72625a8161359111a2d0f43f3215e787778ba6b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Remove some kludgy, redundant and never used functionality for setting
project and test case names, as it also hindered overriding those
properties at runtime.
Pick-to: 6.3 6.2
Change-Id: Ibef7d7d0cb5fc1e462752f2ba2db76cc088dbd48
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In Qt 7 32-bit builds, the ShortData will be larger than the
d-pointer.
So don't swap() the d-pointer, but a) delegate to Data to swap itself
and b) swap the ShortData there, adding a static_assert in the .cpp
file that triggers when the assumption that ShortData is always at
least as large as a pointer is violated.
Found while porting away from overly-generic qSwap(), so done that,
too.
Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I5139da58d99e9491a582ff2cb2f817cd96952044
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Connecting to a non-signal should fail, but apparently it doesn't on
Windows+MSVC under certain conditions.
Task-number: QTBUG-101761
Change-Id: I3e014660e4e5b287242e32307f677bb22ab10a39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- The newest GHS compiler versions set the value of has_signaling_NaN to False.
Add compilation and autotest fix for GHS-compiler 2021/2022 releases.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I45e5da6759a15c60c17f896e565002cbba8524ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That is, insert() doesn't overwrite an existing entry, and range
insert inserts the first of equivalent keys' values, not the last.
This allowed this author to optimize the implementation of
makeUnique() to a O(N) algorithm (was: O(N²)). Said optimization would
have been possible with the old semantics, too, but I wrote the
algorithm first and only then noticed the broken insert() behavior is
present on QFlatMap, too, so I decided not to let good code go to
waste and to fix both problems at the same time.
In order to give users a hint of the changed semantics, make the new
API opt-in until Qt 6.5, so Qt 6.4 ships with the both the old and the
new semantics disabled, where they contradict.
Fixes: QTBUG-100092
Change-Id: Ic96d8bfe6bed9068dbe8c0d7171bd8921050fd95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Animations in that style depend on the current time, which makes it
impossible to run baseline tests. Introduce a dynamic property that
allows us to set the time that animations use.
This way, tests can turn the animation off, or control which time should
be used.
To keep performance overhead low, check only once whether the dynamic
property is set at all.
Pick-to: 6.3
Change-Id: I9bc57b9867fb0d852e101570eca4c7609e7fe1a8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Add a cmake test that builds a simple widgets application, installs
it, in a shared Qt build deploys the runtime dependencies and then
runs it to confirm that the app works.
With a static Qt, the installation of the runtime dependencies is
skipped, but the app should still run.
The test is expected to pass only when targeting Windows and macOS
(both when using shared and static Qt).
Pick-to: 6.3
Task-number: QTBUG-98545
Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
In no particular order:
- use the variable field width feature of QString::asprintf() to
generate the indentation implicitly, instead of fill()ing a
QByteArray with the desired number of spaces
- just default-construct 'flags', don't assign an empty string
- use qUtf16Printable() to avoid funneling UTF-16 data through 8-bit
encodings
- use a C++11 ranged for instead of a counted loop
- remove a pointless isEmpty() guard (the loop won't execute when the
children().isEmpty())
- avoid copying object->children() (returns by cref, so it's also ok
to stuff it directly into the ranged for loop).
Add a test.
Pick-to: 6.3
Change-Id: Ie7314713cb48de7e890cdee0760c0361dd24fd18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test task191545_dragSelectRows relied on the fact
that the view is not scrolling. But on a small screen,
it scrolls automatically.
Fixes: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: I691361c965ab03d8a012f2b83715c7c96d990ec5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The previous constraint called for the value_type of the container to
exactly match the value_type of the tokenizer, which means
toContainer() could only ever work on containers of views. But there
is value in allowing QStringList, even though it works only on QL1S
needles (QStringView -> QString isn't implicit). But users may have
other types that for better or worse implicitly convert from views, so
we shouldn't over-constrain the function.
[ChangeLog][QtCore][QStringTokenizer] toContainer() now works on
containers whose value_type can be constructed from the tokenizer's
value_type. It no longer requires an exact match.
Fixes: QTBUG-101702
Change-Id: Ie384cd1c4b51eaa57675f2a014141ceec8651c81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Android 9 introduce an API call to clear the clipboard, before that
it wasn't possible to do that, the test QPlainTextEdit::canPaste()
should expect that to fail.
Pick-to: 6.3 6.2
Task-number: QTBUG-100470
Change-Id: Ie2d8aabf77672c62b3a6c72a080a4e37f1696303
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
In a recent improvement (6de36918c0) the
last set clip region or path was stored in separate variables, in
order to be set again if the aliasing mode changed. That solution was
too simplistic, as it would break down as soon as more than one clip
area was set, with the latter either replacing or intersecting the
first. It was also unnecessary to introduce new storing of clip areas
and transforms, as those are already recorded in the clipInfo stack in
the painter state. This patch hence reverts much of that implementation.
However the basic idea of setting the clip area again after AA change
is good, so that part is kept, implementated instead by calling a
pre-existing function to replay the clipInfo stack.
One of the baseline test cases is extended to excercise the
combination of clip areas. As a driveby, support for setClipRectF is
added to the painting baseline test scripts, and the build of the
manual lance tool is fixed.
Fixes: QTBUG-101474
Pick-to: 6.3 6.2
Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Amends a74cdf778c, after which the
initialization of items in invisible rows is skipped. Since data members
in QFormLayoutItem were lazily initialized, this resulted in out-of-bounds
access of QList entries.
Use member initialization for all QFormLayoutItem fields, and check that
vLayoutIndex is valid before using it to access the list entry. Skip
labels and fields for which it is not initialized.
Add test case. As a drive-by, silence the test's provoked warning
messages via ignoreMessage.
Change-Id: I374b414a51df20b9af3087a2676061fc6b7f23e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.
We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.
Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.
The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.
This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.
Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.
This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).
Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
[ChangeLog][QtGui][QColor] The constructors from string-ish type, as
well as the setNamedColor() and isValidColor() functions, have been
deprecated effective Qt 6.6 in favor of fromString() and
isValidColorName(), resp.
Fixes: QTBUG-101389
Change-Id: I002646bd48c1e4340dc6842fd136fc9f35bb9b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The resulting blurriness is too significant, and it's hard to see where
the difference comes from. Better to encode the screen DPR into the
appearance ID if it's not 1.0, and warn about the comparison not being
done to the baseline images with a 1.0 DPR.
Pick-to: 6.3
Change-Id: Iceab7b0a4cc50627145bd1267cff22344f7d8e5b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Widget tests run in VMs that don't have their own git clone.
Pick-to: 6.3
Change-Id: I20ab32affabfc7ce6dfaa445306b19efb51803e9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Mangling it into the checksum makes it hard to navigate the available
images.
Pick-to: 6.3
Change-Id: I54dcab5681e747ce1c5fe1b141ef6c4441d1f7eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Previously the blacklisting file format only worked with slot:data or
plain slot names for the items to blacklist. However, tests with
global data report themselves with the global data-row tag in the same
way as function-specific ones do; and tests which have both join the
two as slot(global:data) in the test output name, so the reader is apt
to mistake global:data for a data tag. In any case, it is potentially
desirable to be able to blacklist a function with either or both of
global and local data-row tags specified. Add support for that and
remove a blacklisting that was only needed due to the lack of this
support.
For now, make the new parameter to checkBlackLists() optional, so
that qtdeclarative's qmltest framework can adapt to this change.
Fixes: QTBUG-100870
Change-Id: I9125811ebdab75d3fb462ba8b60561f003426502
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This was not previously tested.
Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
pthread_yield() is a non-posix extension and was deprecated for a long time.
It's been removed recently at least from Fedora 35. Use sched_yield() instead.
Change-Id: Iae47fa09cc89005aa466446149be87e1b673c074
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
for QInputDevice::primaryKeyboard() and
QPointingDevice::primaryPointingDevice().
This also reverts ae9fefe3c8.
Fixes: QTBUG-100790
Pick-to: 6.3
Change-Id: Id02f277db25f823eb29e939e25801325df8e4076
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Found when retesting the testcase completer.zip from QTBUG-54642
Pick-to: 6.3 6.2 5.15
Change-Id: Id84eefeb3a33dc6d790cfa23755352381cc097a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And remove their uses.
[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.
Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window. Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.
In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.
In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).
RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.
The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)
Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.
Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed. The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.
The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)
As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.
It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.
QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.
For existing applications there are two important consequences with
this patch in place:
- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.
- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform. (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)
- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().
Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If a test crashes it might leave local sockets, causing test failures
on subsequent runs due to the socket already being "in use".
Pick-to: 6.3
Change-Id: Ie1107c414f4819026907071c7b8281b2e27b8541
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
RFC2397 doesn't explicitly mention it, but references RFC2045, which,
in Section 2, states:
> All media type values, subtype values, and parameter names as
> defined are case-insensitive.
and goes on, in 6.1:
> mechanism := "7bit" / "8bit" / "binary" /
> "quoted-printable" / "base64" /
> ietf-token / x-token
>
> These values are not case sensitive
So regardless of whether "base64" is a parameter name, or a mechanism,
we need to treat it case-insensitively.
Use QLatin1String::endsWith() instead of QByteArray::endsWith(),
because the former takes Qt::CaseInsensitive while the latter would
need a toLower().
Add a test.
As a drive-by, use the same trick for the existing case-insensitive
comparison with "charset".
As a further drive-by, fix inappropriate uses of QLatin1String (=
where they don't prevent allocations).
[ChangeLog][QtCore][QUrl] Now recognizes the ";base64" marker in
"data:" URLs case-insensitively.
Pick-to: 6.3 6.2
Change-Id: Ife6ba771553aaad3b7c119c1fa631f41ffa8f590
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We want to mark the corresponding QColor ctor(s) explicit.
Use Qt::GlobalColor or the new QColor::fromString() instead.
Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QObject's cache the binding status pointer to avoid TLS lookups.
However, when an object is moved to a different thread, we need to
update the cached pointer (as the original thread might stop and thus no
longer exist, and to correctly allow setting up bindings in the object's
thread).
Fix this by also storing the binding status in QThreadPrivate and
updating the object's binding status when moved. This does only work
when the thread is already running, though. If it is not running, we
instead treat the QThreadPrivate's status pointer as a pointer to a
vector of pending objects. Once the QThread has been started, we check
if there are pending objects, and update them at this point.
Pick-to: 6.2 6.3
Fixes: QTBUG-101177
Change-Id: I0490bbbdc1a17cb5f85044ad6eb2e1a8c759d4b7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
QComboBox is included because it works like a button when it is not
editable. QGroupBox is included because it has a checkbox and QCheckBox
is a subclass of QAbstractButton.
Change-Id: Iad89259314e77f78c915dce83ec601df94c88941
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Qt Creator crashes when max is INT_MAX and min is -1, see bugreport.
Change-Id: I441e76c0ff87052083ed3d77e6085b186402e5d8
Fixes: QTBUG-101581
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Required for the API symmetry between QStringView and QLatin1String.
[ChangeLog][QtCore][QStringView] Added an overload of
QStringView::count() for QLatin1String.
Change-Id: Ic49a4b31e8f6f0969eff0f792654d23a60e06c49
Task-numer: QTBUG-98431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Also contains some fixes which fix the Windows build, amending
e1b8257dee.
Pick-to: 6.3
Fixes: QTBUG-101294
Fixes: QTBUG-101304
Change-Id: I779f50fc705ed32f0314daf28b39b477a7fe925d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check that the expected overloads are selected in
QString/QAnyStringView overload sets.
Pick-to: 6.3
Change-Id: I38148c20a72eb60cf86844a39fe0ed419d2fa562
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
It is customary for Qt types that can be constructed from string-ish
to provide a fromString() named constructor. QColor didn't, relying
instead on a set of overloaded implicit and explicit constructors.
Add the named constructor, with the intent to deprecate the string-ish
QColor constructors after a grace period.
To prevent new users from using known-to-become-deprecated API, mark
the old functions as \obsolete.
Also rename isValidColor() to isValidColorName(). The only reason why
these are lumped together in single commit is so that their docs can
refer to each other instead of having to temporarily refer to obsolete
API.
[ChangeLog][QtGui][QColor] Added fromString() and isValidColorName(),
both taking QAnyStringView.
Task-number: QTBUG-101389
Change-Id: I2857c728257ad2f14c7c968b45547bdf07c44b63
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Without this change, the test fails when run twice in a row. Also, skip
the test if we can't move the cursor.
Pick-to: 6.3
Change-Id: Ic45c073007d114fbd7825cedef6761c1e410b4af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Also include the comprehensive tests for bool cast compilation which I
originally wrote to confirm that the QTEST_ASSERT() change should be™
correct.
Pick-to: 6.3
Task-number: QTBUG-101406
Change-Id: I9a2871bfd4be9999b7a720bec775bba7aeffbe24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
QDateTimeEdit's default constructor instantiates the start of
1752-09-14 as its default earliest time; however Friedeman has seen
this triggering an assertion. The QDTE tests should be picking that up
anyway, but let's overtly test it in QDate's startOfDay testing, too.
Change-Id: Ifae87f2695ac3a7993c173a7c21809c87d5daa71
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The test crashed for some reason, so other testcases are also not
executed. Skip the test for now to enable more tests in the CI
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I5ad38645d1b8f86c64da7208c0ae4f66d126c7d9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Most of the blacklisted tests were already fixed earlier.
The tst_QPlainTextEdit::adjustScrollbars() test needed a small fix
to show the window non-fullscreen, so that the scrollbar could appear.
Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3
Change-Id: I849f411a5798053742323fc4db3fe30f2b690a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This overload set may come in handy to cushion some of the concerns
regarding replacing QString functions with QAnyStringView ones.
Overloading with a Q_WEAK_OVERLOAD QAnyStringView function requires
users to jump through hoops in order to avoid the QString overload,
but with the Q_WEAK_OVERLOAD roles reversed, the QAnyStringView
overload becomes the preferred version, relegating the QString
overload to a fall-back to facilitate sharing where it makes sense
(e.g. for QObject::setObjectName()).
Pick-to: 6.3
Change-Id: Ic65ead505beee627976a306e2d430e800540a600
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Use two template parameters for the haystack and needle types, to test
all possible combinations of all argument types.
Note that the tests for QByteArray::count() are removed: it doesn't
make sense to have them in tst_qstringapisymmetry, and we already have
the symmetry tests for QByteArray in tst_qbytearrayapisymmetry.
Change-Id: I33901fd135eb7433f0d45300a7248aef4d40324a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Don't use the haystack as needle when testing count() for QLatin1String.
This wasn't caught earlier, since QLatin1String has no count() yet, and
the codepath was never tested.
Pick-to: 6.3 6.2
Change-Id: I2764070894ddce047eceaea52456e5a521252dab
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The test is no longer failing on Android in dev and 6.3, but still
failing in 6.2.
I think it's fixed by 63a35898f4
which is integrated into dev and 6.3
Task-number: QTBUG-87396
Pick-to: 6.3
Change-Id: I82e0aac1547f8e43353f0948cd3f91b4b8f9720e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The operators are declared in the Qt::Literals::StringLiterals
namespace, to avoid collisions in the global namespace.
[ChangeLog][QtCore][QLatin1String] Added literal operator""_L1 that
converts string literals and chars to QLatin1String and QLatin1Char.
Fixes: QTBUG-98434
Change-Id: Ia945a6acf4b8d4fbbb5f803264e4d79d7b17a8da
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Our associative containers' iterator's value_type isn't a destructurable
type (yielding key/value). This means that something like
for (auto [k, v] : map)
doesn't even compile -- one can only "directly" iterate on the
values. For quite some time we've had QKeyValueIterator to allow
key/value iteration, but then one had to resort to a "traditional" for
loop:
for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i)
This can be easily packaged in an adaptor class, which is what this
commmit does, thereby offering a C++17-compatible way to obtain
key/value iteration over associative containers.
Something possibly peculiar is the fact that the range so obtained is
a range of pairs of references -- not a range of references to pairs.
But that's easily explained by the fact that we have no pairs to build
references to; hence,
for (auto &[k, v] : map.asKeyValueRange())
doesn't compile (lvalue reference doesn't bind to prvalue pair).
Instead, both of these compile:
for (auto [k, v] : map.asKeyValueRange())
for (auto &&[k, v] : map.asKeyValueRange())
and in *both* cases one gets references to the keys/values in the map.
If the map is non-const, the reference to the value is mutable.
Last but not least, implement pinning for rvalue containers.
[ChangeLog][QtCore][QMap] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiMap] Added asKeyValueRange().
[ChangeLog][QtCore][QHash] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiHash] Added asKeyValueRange().
Task-number: QTBUG-4615
Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
[ChangeLog][Network][QNetworkCookieJar] It is possible to use
system's copy of publicsuffix database when it is available.
This behavior is enabled by default on Linux and can be
controlled using new command line switches -system-publicsuffix,
-qt-publicsuffix, -no-publicsuffix, and -publicsuffix=all.
Fixes: QTBUG-95889
Change-Id: I911e1a13c1422cdc35851953309fff064e7c5f26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The existing API of QFlatMap did not allow efficient removal of
elements:
- std::remove_if does not apply, because it works by moving elements
back in the range onto those that need to be removed, which doesn't
work in flat_map's case, because, like for all associative
containers, the key in value_type is const.
- The node-based erase-loop (over it = cond ? c.erase(it) :
std::next(it)) works, but, unlike in traditional associative
containers, is quadratic, because flat_map::erase is a linear
operation.
According to Stepanov's principle of Efficient Computational Basis
(Elements of Programming, Section 1.4), we're therefore missing API.
Add it.
I couldn't make up my mind about the calling convention for the
predicate and, despite having authored a merged paper about erase_if,
can never remember what the predicate is supposed to take, so be fancy
and accept all: (*it), (it.key(), it.value()), (it.key()). This means
that unary predicates can either not be generic or must be properly
constrained to distinguish between pair<const K, V> and K, but that's
not necessarily a bad thing.
There's no reason to supply a Qt-ified removeIf on top of the standard
name, because this is private API and doubling the names would do
nothing except double the testing overhead.
Fixes: QTBUG-100983
Change-Id: I12545058958fc5d620baa770f92193c8de8b2d26
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
... if there aren't any.
Pick-to: 6.3
Change-Id: I8531e0c1c3ca41d1b1a9d55c9d11782bd63b6f76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
As a drive-by, fixed misleading wording used in docs.
[ChangeLog][QtCore][Potentially Source-Incompatible Changes][QLatin1String]
Added QLatin1String(std::nullptr_t) constructor, which makes
QLatin1String(0) call ambiguous. To fix the ambiguity, nullptr
must be passed instead of 0.
Task-number: QTBUG-98433
Change-Id: I2b888aa23469343d78aa640dc39a6028b77165dd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
on Wayland
Task-number: QTBUG-100917
Pick-to: 6.3 6.2
Change-Id: I66c42bb0ceca83fd0531159c606d22c58b18b371
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
In QPainter, clipping can only be done on whole pixels. The various
ways of specifying a clipping rectangle to the QPainter API have been
inconsistent in how fractional rectangles (either specified directly,
or as a result of fractional scaling) are mapped (rounded) to integer
coordinates.
Also, the mappings have not made sure to keep the edge-to-edge
property of clip rects under scaling. This is particularly important
when scaling QRegions with multiple rects, as QRegion is designed on
the assumption that an area can be described as a set of edge-to-edge
rects.
The fix rounds a clip rect identically with a fill rect. (Indeed, a
followup plan would be to merge QRasterPaintEngine's
toNormalizedFillRect() with the rectangle rounding function in this
commit).
Notably, a QRectF clip is now interpreted the same as a QPainterPath
clip describing the same area.
This modifies d9cc149995
Task-number: QTBUG-100329
Fixes: QTBUG-95957
Task-number: QTBUG-100343
Pick-to: 6.3
Change-Id: Iaae6464b9b17f8bf3adc69007f6ef8d623bf2c80
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
tst_qxmlstream was disabled because it crashed. It does not any more.
But it extracted an input zip archive in-place, which is not
possible on Android. To resolve this, input files are
copied to a temporary directory first.
Also, input directories were given to rcc. rcc has a problem
with recursive directories. To circumvent this,
the file list is created in CMake and then given to rcc.
Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: I88bb823b9e5c085404e263d4a648d65c9cd6024c
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
QNX tests are run under QEMU so have the same problem as b2qt
Pick-to: 6.2 6.3
Task-number: QTBUG-100948
Change-Id: I2abc8a4bca9e8ba414197721301d493296e7ce0b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This test crashed and prevents other testcases from execution.
The test requires a proper fix, but that's not trivial, so skipping
to enable more tests in the CI for now.
Task-number: QTBUG-101321
Pick-to: 6.3 6.2
Change-Id: I1bd4b1182cc868a36391a718457eae647675fc17
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
This test uses the cursor. However we have no cursor support on Android.
Skip the test instead of blacklisting it, because that is the correct
behavior.
Fixes: QTBUG-87389
Pick-to: 6.3 6.2
Change-Id: I1a2d2dd406b3d7da1bc70b51c2072a83d9a29ca5
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>