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>
This lets it avoid a two-digit year that would clash with month or day.
That shall make fixing up system locale date formatting run cleaner.
Add a test for QGregorianCalendar's two extensions.
Change-Id: I77083ff9d5e4035763250904a59fcf416286545b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In paintAndFlush, QWidgetRepaintManager subtracts opaque children if
the target isn't overlapped and isMoved is set to true. So in moveRect,
set isMoved to true after the blitting of movable areas, and reset it to
false if we have overlapped sibling or child regions. Otherwise, moving
so far that sourceRect is invalid (none of the original pixels are
visible after the move) we end up in a code path that sets isMoved to
true even with overlapping children or siblings, which then breaks
paintAndFlush's assumptions.
Reuse the test case written by Sergiy Korobov <tiamatenko@gmail.com> in
earlier attempts to fix this bug.
Fixes: QTBUG-26269
Pick-to: 6.2
Change-Id: If7443863f5eee79a80220cd587522122f42a21e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Since QMainWindow::setMenuWidget accepts a QWidget (allowing users to
implement their own menu widget), we need to use qobject_cast on the
stored widget to see if it is a QMenuBar before calling QMenuBar APIs.
This qobject_cast may return nullptr.
Pick-to: 6.2
Fixes: QTBUG-98247
Change-Id: Iff1dbd24fa7ca09098fe49c179770356c966251d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QTabBar implements wheelEvent to move the current index up or down. This
is useful for clicky mouse wheels, but a bad user experience when using
a kinetic wheel or touch pad, as every pixel movement will change the
current index.
Instead, scroll the entire tab bar when the wheel event comes from a
device that supports scroll phases, without changing the current index.
As drive-by's, fix the test introduced in aa09bea00c to
not leak memory or leave a test-specific style set on the QApplication
instance, which can break other tests.
Also, make relevant layout code in QTabBar respect the usesScrollButtons
property, const'ify local variables, and return an accepted QWheelEvent
if the event resulted in a change.
[ChangeLog][QtWidgets][QTabBar] Scrolling with a kinetic wheel or touch
pad scrolls the entire tab bar, without changing the current index.
Change-Id: I990e51466dd25c741877bbf0e197449f897a9efb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The slider is very touch friendly from macOS 11 on, and the knob is quite
large. Give it some extra pixels, and adjust the test accordingly.
Pick-to: 6.2
Task-number: QTBUG-98093
Change-Id: Iedf6db1081cdd4013ca29ce760aea1e0361b1123
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This change allows canceling the chain of continuations attached to a
future through canceling the future itself at any point of execution of
the chain.
[ChangeLog][QtCore][Important Behavior Changes] The chain of
continuations attached to a future now can be cancelled through
cancelling the future itself at any point of the execution of the chain,
as it was documented. Previously canceling the future would cancel the
chain only if it was done before the chain starts executing, otherwise
the cancellation would be ignored. Now the part of the chain that wasn't
started at the moment of cancellation will be canceled.
Task-number: QTBUG-97582
Change-Id: I4c3b3c68e34d3a044243ac9a7a9ed3c38b7cb02e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Adding new entries to QOperatingSystemVersion in patch releases
was previously breaking our BC guarantees because the entries are
exported, thus users cannot freely switch between different
patch-releases without a recompile if they adopted the new entries.
Move the data itself to a base class so that the entries can be
constructed inline.
Task-number: QTBUG-97808
Change-Id: Ic44f07488af8a04a3bedc10bebb740c4d68f43f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QMultiHash::operator== crashes when comparing two unequal objects.
This patch fixes it.
Pick-to: 6.2
Fixes: QTBUG-98265
Change-Id: Ibf9fef3372a2b4581843be5f25e65cc9a55ef64d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Check that a file name, not the full path, contains a dot.
Fixes: QTBUG-59401
Pick-to: 5.15 6.2
Change-Id: I193b2ae457a3ac6a460524dbf200786eb3461cef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Explain why QSystemLocale needs to be an export. Unexport
QLocaleId::fromName() now that qttools no longer uses it.
QLocalePrivate was only Q_CORE_EXPORT for the sake of one use in
tst_QLocale, that can now be replaced by a call to a public QLocale
method.
Change-Id: I1efe8ee03488acfc6e1c36661f6e956a86e191c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
After special processing for hover, QPushButton::mouseMoveEvent()
needs to call the base class function, like every virtual override
should, to continue processing other logic. Amends
3310e13a17
Fixes: QTBUG-97937
Pick-to: 6.0 6.2
Change-Id: Ic2e111d6c38371e0aa04423f5fb26c52717bf5fb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Since e05e3c7762, the advance test in
tst_QFontDatabase::condensedFontMatching() passes with the bundled
freetype engine, so the XFAIL causes a failure when running with this
configuration.
Pick-to: 6.2
Change-Id: Ie6fbccfa0d9c79654563e9e3f19694f252e32fc6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Tests of QTimeZone::dispayName() were burying most of what was
interesting in the variations among them by repetition of a large
amount of boilerplate. Package the repetition in a macro so that
the differences between checks are more evident.
Change-Id: I23bcafab641b7d3bed50248ba5313250c150d30c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC 2022 (17.0.0) complains about "'QString::replace':
12 overloads have no legal conversion for 'this' pointer".
This is a compiler bug. It is reported to MS. Still we workaround
it here so that qtbase can be built with MSVC 2022.
Pick-to: 6.2
Task-number: QTBUG-96975
Change-Id: I0180e2e6760d2809ca61e3cd8f02b04f970172a7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time,
to unblock the developers from accessing the latest Windows APIs.
Pick-to: 6.2
Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Stop turning THAI CHARACTER SARA AM into a grapheme boundary because it
breaks a test and chromium does not consider it to be a separate
grapheme.
Fixes: QTBUG-88545
Change-Id: Ib1aea8dbb66ac42b2129cf9fe04c39f5f76eeb36
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Update tst_qlocale to take into account "narrow" day representation
change for Russian locales. This version of CLDR changes narrow forms
to one letter. Previously those forms were identical to short forms
(two letter). The new representation is consistent with other languages
and so does not appear to be a bug.
Fixes: QTBUG-94358
Pick-to: 6.2
Change-Id: I9724c281a250685da8232e5c05c9c375a8c79253
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This restores the Qt 5 behavior in Qt 6, but prepares for disabling it
in Qt 7. We want to deprecate the current behavior, as it makes it
unclear who is responsible for calling close.
Fixes: QTBUG-97747
Pick-to: 6.2
Change-Id: I2c99eb96667e784576d8850085068ca334d75b16
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Use the Q_INT64_C() macro and qint64()-as-function instead of C-style
casts.
Change-Id: I9d169715da96a49898e9c9e2a6d3ee5182e1d91c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Where std::numeric_limits<...>::min() is used used as invalid value
for an API return, save it as a named constant so that the comparisons
are against an informative name, rather than leaving the reader to
guess the significance of the min-value.
Change-Id: Ia99c75e21856f65cb4494120d05eed36f5fc2d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation for QProcessEnvironment's default constructor
says:
This constructor creates an empty environment. If set on a
QProcess, this will cause the current environment variables
to be removed.
This is not the case however, because setting such an environment
for a process is equivalent to not setting an environment at all
and the child process is executed with parent's environment.
It is still possible starting from Qt 6.2.0 to create an empty
environment by adding a variable to a null environment and removing
it, but that's cumbersome, and the comparison operator says that
it is equal to the null environment but it is obviously behaving in
a different way.
This change adds an additional constructor to QProcessEnvironment
that can be used to construct a null environment, and changes the
default constructor to produce an empty environment. The comparison
operator is changed to correctly distinguish between such objects.
This is a behavior change, but the current behavior is broken
and this is unlikely to affect working code.
[ChangeLog][QtCore][QProcessEnvironment] An additional constructor
was added to explicitly create an object that when set on QProcess
would cause it to inherit the environment from parent (this was
formerly the behavior of a default-constructed QProcessEnvironment,
which will now (as documented) actually give a process an environment
with no variables set). A new method inheritsFromParent() was added
to test for such objects.
Fixes: QTBUG-58053
Change-Id: I15e20c6a5f01ebe2c736d5578c75dba1ee319320
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Indetnation was bad in commit 0ab3c5c250
and was missed in code review and one comment wasn't updated when the
code was.
Take the opportunity to remove an old TODO that has been completed for
years.
Change-Id: Ice04365c72984d07a64dfffd16b4899604513680
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Relying on QCursor::pos makes tests fragile and prevents multi-seat support.
Instead, record the mouse position in the already existing event handling,
and use that instead. Styles might use either WA_Hover or enable mouse
tracking for the widget to enable hover-effects, so we need to support both.
Fix the scenario where a newly inserted tab ends up under the mouse, which
was previously not handled correctly (only the case of removing a tab was).
Clean up the repaint management when the hovered tab changes; just call
update on the old rect, and then later update on the new rect; there's no
need to make a copy first, updates are posted and compressed.
Add a unit test that makes sure that we paint tabs that should be under the
mouse in the hovered state. Since not all styles enable hovering and/or
mouse tracking in all cases, use a style sheet for those styles that don't.
Change-Id: I7cdbb18e9e04b52651e273680fec87b50cb81e05
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Amends 17c1ebf8bf, which introduced logic
that recognizes double clicks to avoid duplicate clicked() emits. If a
slot connected to doubleClicked opens a dialog, then the release-event
will not be seen by the item view, leaving the flag incorrectly set and
preventing the next clicked signal.
Fixes: QTBUG-97853
Pick-to: 6.2 5.15
Change-Id: Iced83e8c66a763672f522265435dc52a745227e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Don't rely on transitive include from qobject.h, which will go away.
Change-Id: I99dd97ff4fb1d0632d040daab0bffa2d7b85d3ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Clang aligns the object at 32-byte boundaries even though we
specifically asked for alignof(void*), so tell it not to sanitize the
address of the plugin object. Tested with Clang 12 and 13.
GCC seems not to be affected, even when ASan is enabled.
If this doesn't work, we may need to accept reading a note that is
improperly aligned. I don't think the output will be actually a correct
note because the intra-note alignment will be wrong (I carefully chose
the ELF note name so it would not require alignment, but that's only
valid up to 8-byte alignments).
Fixes: QTBUG-97941
Change-Id: Ice04365c72984d07a64dfffd16b422fe074d8a70
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
No need to capture anything by reference, it's a leftover from when
the MainWindow was changed from inside the lambda.
And no need to wrap the argument to QLatin1String.arg() with QStringView
explicitly. This change is made just for brevity and consistency.
Change-Id: Ib8c163bcf5932d35a9d43dd8ce124588c539d5a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This may be a useful factor in deciding whether or not you should
perform communications over the network which are not purely essential.
For example, if you have a logging mechanism you can delay uploading
them until you are no longer on a metered network.
Task-number: QTBUG-91024
Change-Id: I19d32f031a3893512dc440914133678004987fb1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Add simple QtCore-based test case which spins
a nested event loop.
Change-Id: Ia3a4ef76d561d0554faffcac8d36ae5dda2c6c53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Since QByteArray/QByteArrayView don't overload nicely, we need to make
the existing QByteArray overload a Q_WEAK_OVERLOAD (= a template) as a
tie breaker. This automatically prefers the QByteArrayView version
over the QByteArray overload, transparently optimizing existing users
passing char string literals to avoid the implicit creation of a
QByteArray just for passing the separator.
None of our modules exports a subclass of QByteArrayList, so turning
join(QByteArray) into a function template should be ok.
[ChangeLog][QtCore][QByteArrayList] Added join(QByteArrayView)
overload.
Change-Id: I090671d9b94c30b63a986f17e966d124c22b5c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Beats a manual array with too wide strings. I thought even to simply
replace this with a switch (loc)... it's not like this is
performance-critical code, given it uses QString.
Change-Id: I2bbf422288924c198645fffd16a977778ff8d52d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Otherwise, the button state maintained by Qt when using the offscreen
plugin is not reset, breaking following tests.
Pick-to: 6.2
Task-number: QTBUG-97964
Change-Id: Ib37fd038e214863e1e316dc3d41e9d28c157b1f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
Remove at() and chmod() methods of MyEngine class. Those methods
are not used anywhere and look like remainder of old API to me.
Change-Id: I754a4281124cb8c9d74e79a9a2b99fb1b1f41e52
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove useless overrides of QAbstractFileEngine methods from the derived
classes. Also remove "This virtual function must be reimplemented by
all subclasses" passages from the QAbstractFileEngine's documentation.
There are pure virtual methods for such use cases. QAbstractFileEngine
already contains useful defaults for classes not supporting all the
functionality.
Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The existing symLinkTarget() always resolves the symlink
target to an absolute path; It will be clearer to change
LinkName to AbsoluteLinkTarget. It is ready for the commit
about add symLinkPath() to read the raw link path.
Fixes: QTBUG-96761
Change-Id: I8da7e23b066c9ac1a16abb691aa1c4a5f1ff8361
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Wang Fei <wangfeia@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Collation with the default QCollator object (no numeric, punctuation or
case sensitivity changes) is a common-place occurrence, so add two
functions to do this work.
It's also what QString::localeAwareCompare() calls.
The test ends up testing that default, static collator updates after the
default QLocale changes too.
Task-number: QTBUG-95050
Change-Id: I7e0b82c2d2fe464082d8fffd1696ac77f32840b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The check was made against the default locale but the code calls the
system functions (wcscoll, wcsxfrm, wcscmp) for locale-specific
collation, so should be comparing to the system locale's collation
locale (i.e. LC_COLLATE). Also correct the Android-only check in
tst_QCollator::compare() which duplicated the check but neglected the
C locale, which is also supported (via QString::compare).
Pick-to: 6.2
Change-Id: I48c3237dd6825e2070272ab88d95bdb8cbb9fc37
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Arrays of textures have always been supported, but we will encounter
cases when we need to work with texture array objects as well.
Note that currently it is not possible to expose only a slice of the
array to the shader, because there is no dedicated API in the SRB,
and thus the same SRV/UAV (or equivalent) is used always, capturing
all elements in the array. Therefore in the shader the last component
of P in texture() is in range 0..array_size-1.
Change-Id: I5a032ed016aeefbbcd743d5bfb9fbc49ba00a1fa
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
QArrayDataPointer<>::size is now a qsizetype, not the uint it used to be.
Pick-to: 6.2
Change-Id: I09d7e5a50401b46a12f29f93b2b39d646b771cfc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It seems that after commit id 46fc01d7ca
the qpluginloder test case cannot find elf.h in QNX test environment.
This is just a workaround, fix for missing elf.h (QTBUG-97833) needs
to be done later on.
Change-Id: I3f6ec36c8ceaed82552fd0e156a56637c056780d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QTest's simulation of mouse move events currently uses QCursor::setPos
and then processes events. This is unreliable across platforms.
This test relies on the event processing and either way has inverted
logic in the paint event; the painted region needs to at least include
the tab's rect, not the other way around. Also, the mouse move wasn't
needed here at all, and some styles don't have a different style for
pressed tabs anyway.
Pick-to: 6.2
Change-Id: Ib8f6f7be017ff87458e96ec419edcd065dd75b15
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Calculate effect bounds for the updated region when drawing the effect
so that the whole affected area gets updated. The effect bounds have
already been added to the region so it doesn't need to be handled in
the drawing function.
Pick-to: 6.2 5.15
Fixes: QTBUG-96240
Change-Id: I0c317311622e6299fb1a3015541408d1d83c93de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Antialiasing is disabled when the painter's antialiasing attribute
is set behind the clipping function(example `setClipPath` or
`setClipRegion`). The cause of this problem is that the
antialiasing state of the clipping region is not updated after the
antialiasing attribute is set.
A variable is required to record the painter's transformation state
set before the clipping function, because the transformation will be
applied to the clipping region, resulting in the abnormal clipping
region. The value of `s->matrix` is not accurate for the clipping fun-
ction.
Pick-to: 6.2
Fixes: QTBUG-97269
Change-Id: I409a9db32efc3b991ebb97ec9aed19bbddb273d8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
There's now another half of the seed which will be used by the hashers.
This is not stored in QHash, so it is never changed for the lifetime of
the application (not even when QHashSeed::setDeterministicGlobalSeed()
is called). However, we will not use it when we're in deterministic
mode.
This commit uses the compiler thread-safe statics to implement the
initialization of more than one atomic word, thus freeing us from having
to have a reserved value. As a bonus, the QT_HASH_SEED warning will only
be printed once.
Change-Id: Id2983978ad544ff79911fffd16723f1673f9a5b4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>