Commit Graph

13647 Commits

Author SHA1 Message Date
Marc Mutz
e74e27e67e QObject: give some TLC to dumpRecursive()
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>
2022-03-16 02:26:56 +00:00
Andreas Buhr
50f6356f8e Repair some of tst_qtableview tests on Android
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>
2022-03-15 21:05:31 +01:00
Marc Mutz
f3c340c276 QStringTokenizer::toContainer(): allow more types of target containers
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>
2022-03-15 21:05:31 +01:00
Assam Boudjelthia
a818885a3d Android: expect QPlainTextEdit::canPaste() to fail after clipboard clear
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>
2022-03-15 16:09:04 +02:00
Eirik Aavitsland
f46db29d8c Painting: fix overriding and combining different clip types
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>
2022-03-15 12:45:46 +01:00
Volker Hilsheimer
1822550529 QFormLayout: Fix assert when showing with hidden rows
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>
2022-03-15 12:45:46 +01:00
Marc Mutz
0aaada0ddc QString::asprintf: check that passing field widths as arguments works
Pick-to: 6.3 6.2 5.15
Change-Id: Ifb36179b9c26ce15378f10c2947c8cb1e38e10d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
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>
2022-03-15 11:36:09 +01:00
Marc Mutz
ce83a03cfd QColor: deprecate isValidColor, setNamedColor, string-ish ctors
[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>
2022-03-15 10:36:09 +00:00
Heikki Halmet
ee0908228f Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"
This reverts commit d3a297c0ab.

Reason for revert: Unnecessary blacklisting

Task-number: QTBUG-101332
Change-Id: I1e2c94585e719199724695347b243dffcde49259
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-03-15 07:32:32 +00:00
Giuseppe D'Angelo
9b8015ed8d QMutexLocker: add isLocked()
It's basically for free.

[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.

Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 03:32:14 +01:00
Volker Hilsheimer
b2edef557c Baseline: don't compensate for DPRs != 1.0
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>
2022-03-14 23:38:10 +01:00
Volker Hilsheimer
16d154ca5f Baseline: Allow setting git commit through environment variable
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>
2022-03-14 23:38:09 +01:00
Volker Hilsheimer
ad333b9b87 Baseline testing: make style name explicit
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>
2022-03-14 23:38:09 +01:00
Edward Welbourne
479c95729a Support global data tags in blacklisting identification of test-cases
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>
2022-03-14 20:16:35 +01:00
Edward Welbourne
84984cfce2 Add some %-encoding round-trip tests that use % in the plain-text
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>
2022-03-14 20:16:34 +01:00
Laszlo Agocs
1ea73bc29b Fix losing QOpenGLWidget paints when a child widget is invisible
Pick-to: 6.3 6.2
Change-Id: I136b486d30e31acadd6b1b837dc7e834ee3e23fb
Fixes: QTBUG-101620
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-03-14 17:48:52 +01:00
Volker Hilsheimer
fd4186cd23 Fix click position for check box and radio button baseline tests
Some styles override the clickable area.

Pick-to: 6.3
Change-Id: Id6ec9d9aa2faff39489b2baa412af4339779ff5c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 16:13:06 +01:00
Ville Voutilainen
7f85425cb5 pthread_yield() has been removed in newer linux distros
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>
2022-03-14 07:53:34 +02:00
Liang Qi
9c6b986d96 gui: return first default device when seatName isNull
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>
2022-03-13 22:08:16 +01:00
David Faure
7382e5735e QCompleter: fix crash when setting the same model twice
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>
2022-03-13 16:13:29 +00:00
Axel Spoerl
2140edaaab Add setCurrentId in QWizard
setCurrentId(int id) implemented incl. forward skip warning
respective test added in tst_qwizard

Fixes: QTBUG-99488
Change-Id: Ieaf31698baf1e8ec97484b4a221c8587385c9fb3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-12 13:24:29 +01:00
Sona Kurazyan
6585963583 Deprecate {QString, QByteArray}::count()
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>
2022-03-12 01:05:45 +01:00
Laszlo Agocs
68a4c5da9a Compose render-to-texture widgets through QRhi
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>
2022-03-11 21:25:00 +01:00
Tor Arne Vestbø
8ccf1080fc tst_QLocalSocket: Clean up leftover local sockets before listening
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>
2022-03-11 20:32:08 +01:00
Tor Arne Vestbø
d5b3238def tst_QLocalSocket: Output error when listening fails
Pick-to: 6.3
Change-Id: I742de5f522e4a28794abdee863eea2758536d392
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Marc Mutz
d743fd0d0a qDecodeDataUrl(): treat ";base64" marker as case-insensitive
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>
2022-03-11 19:15:49 +00:00
Marc Mutz
61e3fe7fd9 Do not assume implicit string-ish → QColor conversion
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>
2022-03-11 20:15:49 +01:00
Marc Mutz
52092802b7 Rewrite tst_qdataurl as a data-driven test
... to make adding new test cases simpler.

Pick-to: 6.3 6.2 5.15
Change-Id: I54d08cebc7ae4bea9f0397ba3eec1ef6308a5161
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-11 20:15:49 +01:00
Marc Mutz
eded55cfbb tst_qflatmap: fix -Wunused-local-typedef (Clang)
False Positive, of course, since it's used in dependent callee
transparent_impl().

Amends 58e8ae5605.

Pick-to: 6.3
Change-Id: I7520fb7cf6bce28a5fd9381783ba349119309132
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-11 19:15:49 +00:00
Robert Löhning
0031c5cb79 QStyle: Fix cases when logicalValue is outside range
Change-Id: I410c40425d6677612dbe3a40cbaa1debba998064
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-10 12:39:11 +01:00
CI Insignificant Platforms Monitor Bot
797a6ca7e6 Blacklist: test cases blacklisted in tst_QSystemSemaphore:
- initialValue on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101618
Change-Id: Iea5a45690aa2e1225297c3b652d88864cf5f3ddb
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-03-10 08:18:42 +00:00
Fabian Kosmale
ba6c1d2785 QProperty: fix threading issues
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>
2022-03-10 07:21:11 +01:00
Noah Davis
64ffe0aacb Widgets: use QPlatformTheme::ButtonPressKeys for pressing buttons
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>
2022-03-09 19:13:41 -05:00
Robert Löhning
4b49c2006f QStyle: Fix overflows and crash when converting slider positions
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>
2022-03-09 20:38:16 +00:00
Sona Kurazyan
82e12c79b2 Add an overload of QStringView::count() for QLatin1String
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>
2022-03-09 15:58:47 +01:00
Sona Kurazyan
30d28810ee Add QLatin1String::count(needle)
[ChangeLog][QtCore][QLatin1String] Added QLatin1String::count(needle).

Task-number: QTBUG-98433
Change-Id: I31c9fdf14fd81500722ff9f5998eadf0e6cedc5c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-09 15:58:47 +01:00
Marc Mutz
b142d2ad73 tst_qflags: test w/and w/o QT_TYPESAFE_FLAGS
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>
2022-03-08 11:16:19 +01:00
Marc Mutz
5235b1bdc8 tst_qstringapisymmetry: check expected overloads are selected
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>
2022-03-08 06:51:11 +01:00
Marc Mutz
78b6876974 Long live QColor::fromString()!
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>
2022-03-08 06:51:10 +01:00
Volker Hilsheimer
3f5a424264 Move cursor out of the way before running test
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>
2022-03-08 01:52:32 +01:00
Volker Hilsheimer
e27e3ad546 Un-blacklist test that's always skipped on macOS
Pick-to: 6.3
Change-Id: I045e1923b471f6bb1d482f32924f190a94b21d2a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-08 01:52:32 +01:00
CI Insignificant Platforms Monitor Bot
d60e29cab7 Blacklist: test cases blacklisted in tst_QTouchEvent:
- multiPointRawEventTranslationOnTouchPad on windows-11

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101519
Change-Id: Idbba677893f559ee239739d8c78aa820d974e120
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-03-07 22:14:10 +00:00
Marc Mutz
53890b5d3c qtestmouse.h: compile with QT_TYPESAFE_FLAGS
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>
2022-03-07 18:25:35 +01:00
Tor Arne Vestbø
9e01827193 Add QFileInfo::isAlias() to reflect whether the file is a macOS alias
Change-Id: I772066d0d8e69893f7c4aee1cd2305d46d5834c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-06 18:46:54 +01:00
Thiago Macieira
49722de995 QWeakPointer: befriend other QWeakPointers
Commit c677b3b8af added move constructors,
which introduced the issue.

Pick-to: 6.2 6.3
Fixes: QTBUG-100795
Change-Id: I74249c52dc02478ba93cfffd16d2c879b923e352
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-04 19:00:45 -08:00
Sona Kurazyan
f39f539858 Add numeric conversion methods to QLatin1String
[ChangeLog][QtCore][QLatin1String] Added numeric conversion
methods.

Task-number: QTBUG-98433
Change-Id: I414577ae715debe3d5ba9c6a160859aca790e017
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-05 02:03:17 +01:00
Edward Welbourne
f0333355dd Add tests for an assertion seen on Windows
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>
2022-03-04 23:26:13 +01:00
Ivan Solovev
5133ed072a Android: skip crashing tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow
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>
2022-03-04 22:20:18 +01:00
Ivan Solovev
79dcb2657c Android: unblacklist tst_QPlainTextEdit tests
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>
2022-03-04 22:20:18 +01:00