Commit Graph

13231 Commits

Author SHA1 Message Date
Andreas Buhr
30a70fc6e0 Workaround MSVC 2022 bug about QString::replace
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>
2021-11-10 14:10:20 +01:00
Yuhang Zhao
6652bf2353 Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)
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>
2021-11-10 20:31:05 +08:00
Laszlo Agocs
a8be40bd64 rhi: Expose the maximum uniform buffer range limit
Pick-to: 6.2
Task-number: QTBUG-97715
Change-Id: I7f0a52c410b9b77f735fb3b7fd33141674bb0cda
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-11-10 13:31:05 +01:00
Øystein Heskestad
09291eead4 Add additional grapheme, word, and sentence break class tests from tr29
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>
2021-11-10 09:44:03 +01:00
Ievgenii Meshcheriakov
96a03533f9 Update CLDR-derived data to newly-released v40
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>
2021-11-10 00:36:12 +01:00
Fabian Kosmale
a4ce85f356 QDomDocument::setContent: Open device if necessary
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>
2021-11-09 18:33:39 +01:00
Edward Welbourne
e9e0862051 Correct and clarify some comments
Change-Id: I011b04cf0dccea51c00c597c8dff74d574fe36ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-08 17:05:25 +01:00
Edward Welbourne
4b4bc388de Express 64-bit integral constants consistently
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>
2021-11-08 17:05:25 +01:00
Edward Welbourne
f4b19f8bba Give symbolic names to some constants used in time-zone tests
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>
2021-11-08 17:05:25 +01:00
Ievgenii Meshcheriakov
5fc9c02a69 QProcess: Distinguish between null and empty QProcessEnvironment
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>
2021-11-07 01:53:44 +01:00
Thiago Macieira
8790142aeb QPluginLoader: fix indentation and comments
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>
2021-11-05 21:13:35 -07:00
Volker Hilsheimer
02164b292f Don't use QCursor::pos in QTabBar and fix hover handling
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>
2021-11-05 16:54:55 +01:00
Volker Hilsheimer
e5ebc28764 QAIV: Reset double-click flag in mousePressEvent
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>
2021-11-05 14:52:25 +01:00
Marc Mutz
0b768e3c43 Include qproperty.h where needed
Don't rely on transitive include from qobject.h, which will go away.

Change-Id: I99dd97ff4fb1d0632d040daab0bffa2d7b85d3ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-04 21:45:02 +01:00
Thiago Macieira
0ab3c5c250 QPluginLoader/ELF: fix Clang ASan builds
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>
2021-11-04 18:20:09 +01:00
Mårten Nordheim
58b37f5908 QNI manual test: Remove unnecessary capturing and wrapping
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>
2021-11-04 12:02:34 +01:00
Mårten Nordheim
bd52c1bba6 QNI: Add API to check if connection is metered
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>
2021-11-04 12:02:25 +01:00
Morten Johan Sørvig
873edc0f15 wasm: add asyncify manual test
Add simple QtCore-based test case which spins
a nested event loop.

Change-Id: Ia3a4ef76d561d0554faffcac8d36ae5dda2c6c53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-04 09:23:15 +02:00
Marc Mutz
f5fbad669d QByteArrayList: add join(QByteArrayView)
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>
2021-11-04 01:16:16 +01:00
Thiago Macieira
2c2c6de85a qlibraryinfo.cpp: use qOffsetStringArray for qtConfEntries
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>
2021-11-03 14:54:37 -07:00
Volker Hilsheimer
9151ab44bc Release mouse buttons after double click
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>
2021-11-03 18:11:08 +00:00
Ievgenii Meshcheriakov
5175cd89ef tst_qfile: Remove unused methods
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>
2021-11-03 13:42:36 +01:00
Ievgenii Meshcheriakov
57cab7b9a8 QAbstractFileEngine: Remove useless method overrides
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>
2021-11-03 13:42:35 +01:00
Wang Fei
62c2d990f9 Rename LinkName to AbsoluteLinkTarget
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>
2021-11-03 00:42:50 +08:00
Thiago Macieira
a9d8794cf0 QCollator: add public, static functions to do comparisons
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>
2021-11-01 22:30:23 +02:00
Edward Welbourne
25d807f629 Correct qcollator_posix.cpp's check against system locale
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>
2021-11-01 22:30:23 +02:00
Laszlo Agocs
e7a1fbfc47 rhi: Add texture array support
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>
2021-10-29 15:57:13 +02:00
Edward Welbourne
3b51b8c31d Fix signed/unsigned comparison warnings in tst_QArrayData
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>
2021-10-29 14:11:46 +02:00
Janne Juntunen
825505c439 QNX: Handle missing elf.h gracefully
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>
2021-10-28 20:14:45 +03:00
Volker Hilsheimer
05532a0968 Fix test to not rely on event processing
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>
2021-10-27 20:08:33 +02:00
Antti Määttä
ea3ede9c45 Calculate effect bounds when drawing widget graphics effect
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>
2021-10-27 14:32:35 +03:00
Chen Bin
6de36918c0 Update clipping area when antialiasing changes
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>
2021-10-27 15:07:28 +08:00
Mårten Nordheim
323b97ccae QHash: avoid crashing when reserving on a shared hash
Pick-to: 6.2
Change-Id: I21ad13fa223bd5a2c61112e790965093a2750268
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-26 21:56:31 +02:00
Thiago Macieira
0077eac4e4 QHash: double the size of the stored seed
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>
2021-10-26 11:38:56 -07:00
Edward Welbourne
bb220f2d99 Fix overflow issue on parsing min-qint64 with its minus sign repeated
The call to std::from_chars() accepts a sign, but we've already dealt
with a sign, so that would be a second sign. Check the first character
after any prefix is in fact a digit (for the base in use). This is a
follow-up to commit 5644af6f8a.

Fixes: QTBUG-97521
Change-Id: I65fb144bf6a8430da90ec5f65088ca20e79bf02f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-26 17:38:22 +02:00
Volker Hilsheimer
da632baf34 QTabBar: re-layout when tab size hint depends on selected state
QTabBar caches the rects for the tabs to avoid costly recalculation of
each tab's size hint. That cache is only updated via layoutTabs if the
entire tab bar is resized or modified. However, when a style sheet is
set that calculates a different size hint for tabs that are selected,
then the tab bar also needs to be laid-out when the current tab changes.

To minimize the cost, compare the cached size for the new current tab
with its new size hint, and re-layout the tabs when they are different.

Fixes: QTBUG-6905
Fixes: QTBUG-8209
Pick-to: 6.2
Change-Id: I110444d18938c2b3446ee58e4a8c6c472b5f12c3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-26 00:57:36 +02:00
Volker Hilsheimer
01f96b1764 Don't fire shortcut if the action only lives in an unreachable submenu
Menus can be represented by a menu action, and if that menu action has
been hidden or disabled, then the submenu is not accessible from the
parent menu or menu bar to which it was added. Don't walk the menu
action chain further when checking whether the shortcut should trigger.

Note that this is unrelated to the menu being visible or not; we
obviously want to trigger shortcuts for actions that only live in a menu
that has not been shown, otherwise the shortcut would be rather
pointless.

Pick-to: 6.2
Fixes: QTBUG-25743
Change-Id: I48735e17352989bbc84a72263e4828f519b78095
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-25 17:17:40 +00:00
Robert Löhning
a7d1c48ca3 QVarLengthArray: Reduce memory allocations in emplace()
Currently, we allocate memory for elements one by one which can get
pretty slow when adding many elements.

[ChangeLog][QtCore][QVarLengthArray] Reduced number of memory
allocations in emplace() by allocating more memory at once.

Fixes: QTBUG-97489
Pick-to: 6.2
Change-Id: Idfb5b5946b047d5215c8ed00770574249f9f5d40
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-23 01:22:15 +02:00
Volker Hilsheimer
71aaf831d1 QAbstractItemView: auto-scroll with selection rectangle
Some item views, such as QListView in icon mode, implement a selection
rectangle with which the user can "lasso" items. So far, dragging that
rectangle did not trigger auto scroll, so unless an item near the edge
was selected, the user had to stop the lassoing and scroll manually to
reach more items.

Since QAbtractItemView implements auto scrolling for drag'n'drop, we can
use that mechanism also when the selection rectangle is dragged. This
requires some modifications:

We need to make sure that scrolling the view during a drag-selection
generates mouse move events so that the selection is extended and the
rectangle is updated in subclasses.
And we need to stop using QCursor::pos to get the position of the mouse
pointer, as this makes the auto-scrolling untestable. Instead, record
the mouse position last seen during a mouseMove or dragMoveEvent in
content-coordinates (identical to pressedPosition).

As a drive-by, fix some coding-style issues in nearby code.

Done-with: Zhang Hao <zhanghao@uniontech.com>
Fixes: QTBUG-96124
Change-Id: I426f786e5842ae9f9fb04e9d34dc6d3379a6207f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-22 09:43:53 +02:00
Volker Hilsheimer
7d133a5613 Consistently restore threadpool limit at end of tests
Fix warning about unused variable, and use qScopeGuard to make sure that
the limit of the global threadpool is restored even if one of the tests
fail.

Pick-to: 6.2
Change-Id: I36747cb451074cceea961561478210728ed6d313
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-22 09:43:42 +02:00
Mårten Nordheim
bfe579613a QNI: Add a convenience method for loading the default plugin
We have some official plugins, we may as well treat them as default
and give a convenient function which loads those.

Change-Id: I6251c77ac042b795bcf24b86e510e960ee4bab54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:49 +02:00
Mårten Nordheim
5f8e9c194e QNI: Add supportedFeatures getter
Which just returns all the supported features

Change-Id: I8c3996b00a6ebb114bdbc9db3085a0e27fc8fa79
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:45 +02:00
Thiago Macieira
5bc315fbe2 tst_QVariant: suppress warning about memcpying over QVariant
tst_qvariant.cpp:3624:15: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QVariant’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]

Change-Id: Ic17a33f599b844d8ab5dfffd16aafcbd74823696
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-21 23:40:40 +00:00
Sona Kurazyan
49f34a402a Remove the unnecessary compile-time check for recursive QSet
It doesn't make sense to have a recursive QSet with deleted operator==,
since it's not possible to add elements to it. Consequently declaring a
metatype for it also doesn't make sense. Remove the commented
compile-time check for it.

Task-number: QTBUG-96257
Change-Id: I74ebefb38adcbe36d5c2f317188743e1f37fe16d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-21 12:58:05 +02:00
Allan Sandfeld Jensen
4748369eb2 Fix inconsistencies between advanceWidth and bounding rects
Unify the logic in QTextEngine

Ensure tightBoundingRect, and the FreeType boundingRect, calculates from
the shaped x offset when calculating the max x coordinate for a glyph.

Fixes: QTBUG-7768
Task-number: QTBUG-70184
Task-number: QTBUG-85936
Task-number: QTBUG-94023
Change-Id: I6daafb25c79158dc7e777529abb5e8d3a284dac0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-21 12:37:22 +02:00
Tor Arne Vestbø
132ed5eb51 Centralize maybeLastWindowClosed checking in QWindow
Instead of plumbing QWidgetWindow close events via handleCloseEvent,
we just implement closeEvent directly. This allows QWindow do save
the state of the window/widget before the close event, so that we
know whether we should trigger lastWindowClosed handling, even if
the window was deleted as a result of the close event.

This also relieves QGuiApplication and QApplication from dealing
with the close logic in their notify functions, so that these
functions can focus on the propagation of events -- not how the
event is handled.

Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-20 21:17:08 +02:00
Volker Hilsheimer
a3c8518268 Make QMainWindow::restoreStateSizeChanged test less time sensitive
Amends 32edae5e26, which introduced a
timeout after which the restored state is discarded. If this timeout
hits during a CI run, then the test is expected to
fail.

Implement a lambda that watches for the restored state to disappear.

This happens primarily when restoring a fullscreen state, where some
desktop environments scroll in a new virtual desktop. It should not
happen for other data tags.

Change-Id: I5ff43a4e1857eca17a5d4fe2b47add1f70636e8d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-10-20 18:05:15 +02:00
Sona Kurazyan
a9d51298ae Fix metatype declaration for QHash/QMultiHash with no operator==
When declaring metatypes, the metatype system tries to detect if the
comparison operators for the given type exist and automatically register
them. In case of QHash, the equality operator was enabled if the value
type provides one. But the implementation needs equality operator of
the key type as well. As a result, when the key type has no equality
operator, the metatype system detects that the equality operator is
available for the QHash itself, but the compilation for metatype
registration fails when trying to instantiate the code that uses
equality operator for the key. This is fixed by enabling equality
operators for the QHash only when both the key and value types provide
one.

The same issue existed also for QMultiHash, with the difference, that
QMultiHash didn't have the constraints even on the value type. So added
checks for both.

Fixes: QTBUG-96256
Pick-to: 6.2
Change-Id: Ib8b6d365223f2b3515cbcb1843524cd6f867a6ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 17:16:53 +02:00
Ievgenii Meshcheriakov
af2f88f5b6 QObjectCompatProperty: Add support for custom getters
Add additional template argument to QObjectCompatProperty to specify
a custom getter. This may be useful for classes like
QAbstractProxyModelPrivate the need to customize property getters.

Task-number: QTBUG-89655
Change-Id: I34fe4bdebbbf1446aff60bd20a946454607f52d5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-20 17:04:51 +02:00
Karsten Heimrich
bb8d84c358 Make QDir::mkpath() return true when given an existing root path
On macOs with APFS mkdir sets errno to EISDIR, so take the error code
into account.

Pick-to: 6.2
Fixes: QTBUG-97110
Change-Id: I8e7d10c95430a2802bdbfbf94dd65219bd9071a7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-20 15:04:51 +00:00
Karsten Heimrich
71652ad4bf Make QDir::mkpath() return true when given an existing drive name
Commit ed48391c59 removed the check for
ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...)
function in case an existing windows drive name was passed as argument.
This restores the behavior of the function which broke after 5.15.

Pick-to: 6.2
Fixes: QTBUG-85997
Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2021-10-20 15:04:51 +00:00
Tatiana Borisova
57ec47921e Compile Private API autotests for INTEGRITY
- GHS's __PRETTY_FUNCTION__ (used by QT as Q_FUNC_INFO) doesn't have spaces
  round the = operator when indicating the type of the template parameter.

 The compilation error:
 qt5/qtbase/src/corelib/kernel/qmetatype.h", line 2104: note #3316-D:
 cannot access position 53 in array of 49 elements
 constexpr const char *begin = func + prefix;
                                             ^
   detected during:
     instantiation of
     "auto QtPrivate::typenameHelper<T>() [with T=void]" at
       line 2186


Task-number: QTBUG-97087
Pick-to: 6.2
Change-Id: I33e61f5d54a61944a5aecf07d149a8dee0ef1e5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 15:04:51 +00:00
Friedemann Kleint
5074679cfc uic: Fix missing Python import when setting tab orders
Add QWidget as default import so that QWidget.setTabOrder() is found.

Pick-to: 6.2
Change-Id: I7593008d1395e3fddacf7124d271a0eaf4c345d9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-10-20 11:34:03 +02:00
Tor Arne Vestbø
acb86da793 Prevent recursive calls to QWindow::close
QWidget will call close() in its destructor, which we might end up
in if a user deletes the widget in the closeEvent.

Pick-to: 6.2
Change-Id: I39684aec0ca130033dad60f2bbf823364a5edcec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 19:06:48 +02:00
Ievgenii Meshcheriakov
826fc8c9bd Update UCD to Revision 28
This corresponds to Unicode version 14.0.0.

Added the following scripts:

    * CyproMinoan
    * OldUyghur
    * Tangsa
    * Toto
    * Vithkuqi

Full support of these scripts requires harfbuzz version 3.0.0,
this version adds support for Unicode 14.0:

    https://github.com/harfbuzz/harfbuzz/releases/tag/3.0.0

With this release 10 test cases in tst_qurluts46 were fixed, one
additional test case is failing in tst_qtextboundaryfinder and
is commented out. In total 62 line break test cases and 44 word
break test cases are failing.

A comment in src/corelib/text/qt_attribution.json was updated to
include the URL of the page containing UCD version number.

Fixes: QTBUG-94359
Change-Id: Iefc9ff13f3df279f91cbdb1246d56f75b20ecb35
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-18 16:45:10 +00:00
Tor Arne Vestbø
df359bcb70 Decouple quitOnLastWindowClosed from quitLockEnabled
In a512e210ac5b032c5fc2edf1ddf72e5a414485fda512e21 quitOnLastWindowClosed
was changed to be implemented in terms of quitLockEnabled, but without
any documentation to that end.

Although the two features are similar (automatic quit under certain
conditions), and interact, it doesn't make sense to overlap them until
we actually expose them as a single property (automaticQuit e.g.)

The logic for determining whether we can can quit automatically has
been refactored to take both properties into account, on both a Core
and Gui level. The call sites still need to check the individual
properties to determine whether to activate automatic quit for
that particular code path.

Change-Id: I38c3e8cb30db373ea73dd45f150e5048c0db2f4d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 15:29:09 +02:00
Volker Hilsheimer
5335cc4a5a Fix cursor positioning on bidi boundaries
When the cursor is positioned between to script items that have different
writing directions, prioritise the script item that has the same direction
as the paragraph (i.e. the QTextEngine) when deciding where and how to
display the cursor. If visual cursor movement is enabled, the behavior is
unchanged.

As a drive-by, clean up coding style and avoid shadowing of function-
local variables.

Task-number: QTBUG-88529
Pick-to: 6.2
Change-Id: I15227b10b1469d9caf1235b00e4d6f9f64a8b510
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-18 13:05:42 +02:00
Volker Hilsheimer
f54044d4a9 Fix cursor placement at left and right ends of bidi text
In a text line that has a change of direction at either end of the text,
the cursor needs to be positioned where the next character is inserted,
or where backspace deletes the previous character. In bidi text, this is
ambiguous as illustrated by this example:

abcشزذ

Depending on whether this string was typed in a left-to-right document
or in a right-to-left document, it could be first latin, then arabic; or
it could be first arabic, then latin.

If a general left-to-right context, cursor position 0 should be in front
of the 'a', and cursor position 6 should be at the end of the arabic
text, in the visual middle of the line. Cursor position 3 can be either
after the 'c' if the next character typed would be latin, or at the
visual end of the line if the next character will be arabic.

Qt calculated the cursor position past the right end of the text as 3
(which is not wrong, but 3 has two visual positions), and placed the
cursor at the visual end of the line (favoring the right-to-left
alternative). Backspace would then delete the 'c', writing a new
latin character would insert a 'd' next to the 'c', writing a new arabic
character would insert it also in the middle - none of these operations
happen at the visual end of the line, where the cursor was blinking.

To fix this, we take into account the general layout of the text, which
is typically based on the document, or the user's locale setting and UI
translation, and calculate the cursor position accordingly: if we are
past the visual end of the document on either side, then the cursor
position is either 0 or the last character of the text, depending on the
direction of the QTextEngine used. This way, the cursor ends up in the
middle of the document when we click beyond the end of the line, which
is where characters are removed and inserted. Typing a 'd' at this point
will make the cursor jump to the end, where the d is added.

There are still corner cases: clicking on the right-most arabic character
calculates the cursor position as 3, which is then ambiguous, as it can
be either at the visual end of the string, or next to the 'c'. َQt makes
the inconsistent choice to place the cursor at the visual end, showing
the left-to-right indicator, but pressing a 'd' adds the 'd' after the
'c' in the middle of the text.

Fixes: QTBUG-88529
Pick-to: 6.2
Change-Id: Idccd4c4deead2bce0e858189f9aef414857eb8af
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 13:05:42 +02:00
Thiago Macieira
8c2969ea86 QPlugin: Move the plugin metadata to a note in ELF platforms
A few systems, like OpenWRT, may strip the section table off the
resulting binaries (see [1]), making it impossible for us to pinpoint
the exact location of the Qt plugin metadata. This commit moves the meta
data to a location that is identifiable even in fully stripped binaries:
an ELF note.

By naming our section ".note.qt.metadata", we instruct the linker to
place it along the other notes and to mark it in the program header
section. Another advantage is that the notes are usually in the very
beginning of the file, as they are used by the dynamic linker itself, so
we'll need to read much less of the full contents.

The unit test is modified not to attempt to strip the plugin of
debugging data. In fact, we add something to the end that would,
otherwise, be matched as (invalid) metadata.

The following was produced with GCC 11 and GNU binutils ld 2.36.1.

Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES Flags Lk Inf Al
[ 0]                      NULL         0000000000000000 00000000 00000000  0        0   0  0
[ 1] .note.gnu.property   NOTE         00000000000002a8 000002a8 00000030  0 A      0   0  8
[ 2] .note.gnu.build-id   NOTE         00000000000002d8 000002d8 00000024  0 A      0   0  4
[ 3] .note.qt.metadata    NOTE         00000000000002fc 000002fc 000001ac  0 A      0   0  4

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
...
  NOTE           0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030 0x000030 R   0x8
  NOTE           0x0002d8 0x00000000000002d8 0x00000000000002d8 0x0001d0 0x0001d0 R   0x4

The Qt metadata note is 4-byte aligned and can thus be found in the
second note section, which spans from 0x02d8 to 0x02d8+0xac=0x0384.

GNU readelf -n can even show it:

Displaying notes found in: .note.qt.metadata
  Owner                Data size        Description
  qt-project!          0x0000018f       Unknown note type: (0x74510001)
   description data: 01 06 03 81 bf ...... ff

I chose 0x7451 as the prefix for our notes, even though they're already
namespaced by the owner in the first place, because eu-readelf
mistakenly tries to interpret note 1 as a GNU ABI tag regardless of
owner. The owner name was chosen to be 12 bytes long, so the ELF note
header is 24 bytes in total. There's no space wasted because the payload
needs to be aligned to 32-bit anyway and I didn't want to use only 4
characters (header total size 16 bytes) so we'd skip the "GNU" note on
size, without string comparison. And I couldn't think of a 4-character
representative string ("QtP" ?).

[1] https://github.com/openwrt/video/issues/1

Fixes: QTBUG-96327
Change-Id: I2de1b4dfacd443148279fffd16a3987729346567
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 01:53:27 -07:00
Shawn Rutledge
362e56b520 Markdown importer: keep entities in HTML blocks with the HTML
If an entity occurs directly in markdown, we parse and insert it
directly; but if it occurs in an HTML block, it has to be added to the
HTML accumulator string for deferred parsing when the HTML block ends.

Pick-to: 6.2
Fixes: QTBUG-91222
Fixes: QTBUG-94245
Change-Id: I0cf586d68d6751892ca035a98f77cd67950d3bc4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 16:10:49 +02:00
Volker Hilsheimer
32edae5e26 Fix restoring main window state for maximized/fullscreen windows
On systems that asynchronously resize the window to maximized or full
screen state, the window will become visible in its normal geometry
before it gets the final size by the windowing system. This might cause
multiple resize events, to each of which the widget's layout responds
with a call to its setGeometry implementation.

The QMainWindowLayout is special in that it will shrink dock widgets if
there is not enough space for them, but it doesn't grow them back once
there is. With the initial resize event being for a smaller size than
what was restored, the state is not restored correctly, but remains in
the state that fit into the smallest size with which setGeometry got
called.

To fix this, we have to keep the restored state around until the window
either gets a size that is large enough for it to fit, or until we can
be reasonably certain that the windowing system is done resizing the
window while transitioning it to the maximized or full screen state.
Since across the various platforms and windowing systems there is no
reliable way to know when the window reaches its final size, we have
to use a timer that we (re)start for each call to setGeometry with a
size that's not large enough. Once the timer times out, we have to
give up; then the last layout state calculated is the final state.

To calculate the size of the layout, introduce a function to the
QDockAreaLayout that returns the size required for the current sizes
of the docks. Refactor sizeHint and minimumSize (which were identical)
into a helper template that takes member-function pointers to call the
respective method from the dock area layout's content items.

Add a test case for various permutations of the scenario. The timeout
of 150ms is based on running this test case repeatedly on various
desktop platforms and X11 window managers.

Fixes: QTBUG-46620
Change-Id: I489675c2c40d3308ac8194aeb4267172b2fb38be
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-16 09:46:22 +02:00
Andy Shaw
a36c84c6a3 When filling a pixmap after an assignment ensure the set DPR is not lost
Pick-to: 6.2 5.15
Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-15 10:27:15 +02:00
Tatiana Borisova
144f3fe5a3 Fix autotest public API compilation for INTEGRITY
- getgid/getpwuid are not supported
- process should be used with config check

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: Ib6854772bcf52f3533cb722f963426717926258b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-15 11:00:25 +03:00
Shawn Rutledge
5e55297ee0 Markdown writer: indent fence consistent with code block
- Under a list item, we've been indenting code blocks:
  ```
  int main() ...
  ```
- But it's also ok *not* to indent (and github handles that better):
```
int main() ...
```
- There was a bug that when the code is not indented, the fence would be
  indented anyway:
  ```
int main() ...
  ```
  and that was not OK, neither for md4c nor for github.

Now with this change, either way is rewritable: you can read markdown
into QTextDocument, make small edits and write it back out again, with
the indentation being preserved (the code block is either part of the
list item, thus indented, or else it's outside the list completely).

Pick-to: 6.2
Task-number: QTBUG-92445
Change-Id: I5f51899e28ba9f09b88a71e640d9283416cce171
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 19:57:09 +02:00
Volker Hilsheimer
74e634d82c macOS: Correctly record normalGeometry in Cocoa plugin
Cocoa sends QWidget the state-change notification after the window has
been resized already, at which point we cannot store the normal geometry
anymore.

Handle zoom and full screen callbacks prior to the state changing
to store the geometry in QCocoaWindow. We do not need to handle
minimized state, as the window will still reflect the original
geometry.

Return the stored value from an override of
QPlatformWindow::normalGeometry so that QWidget gets the correct values
even though the new state is already active.

Fix the tst_QWidget::normalGeometry test to make it pass on all
platforms by waiting for the window to actually have transitioned to
the new state before comparing geometries. Both macOS and Windows fully
pass; on Xcb, deminimizing a window using setWindowState does not work,
which is why the test was partially skipped (confirmed by visual
testing). Move those problematic, complex test cases to the end so
that most cases are covered on Xcb as well.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Pick-to: 6.2
Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 17:19:38 +00:00
Tor Arne Vestbø
e95e9c28f0 QWidget: Don't rely on topextra to determine if window is top level
Doing so results in bailing out early for a widget that hasn't been
shown yet, or otherwise resulted in creating extra and topextra,
which means the normalGeometry will not reflect the widget's geometry.

Pick-to: 6.2
Change-Id: Ieb85e9a6109ae34fe20d79e3c12f4517f827a590
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 19:19:38 +02:00
Shawn Rutledge
5c436365f5 Support background-color CSS styling on <hr/>
[ChangeLog][QtGui][CSS] The background-color style can now be applied to
<hr/> to set the rule color.

Task-number: QTBUG-74342
Change-Id: Ib960ce4d38caa225f258b6d228fb794cef43e1b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-10-14 17:09:20 +02:00
Doris Verria
ec09900997 Call QWidget close handling in QWidget::close for non-toplevel native widgets
Since commit 7ba75d0 we close the QWindow in QWidget::close for native
widgets and trigger the closeEvent in QWidgetWindow. However, if the
widget's window handle is not a top level window, QWindow::close()
will not close the window, failing in this way to deliver the
closeEvent and call the close handling in QWidgetPrivate::handleClose.
To fix, call handleClose() from QWidget::close for such widgets.

Task-number: QTBUG-74606
Pick-to: 6.2
Change-Id: Ied342eced3340aaf19b5443762935b1a5fc5c27b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 10:19:29 +02:00
Giuseppe D'Angelo
a45bc2d123 QList: avoid a iterator->pointer conversion in the test
Being a test, I'm going to abuse operator-> on end() to check
that we get what we want (a pointer past the end).

Change-Id: I7ab8d017b0fe320018820eff336d496328ade481
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-14 02:26:41 +02:00
Tor Arne Vestbø
947188b969 Fix references to QGuiApplication::lastWindowClosed
The signal is emitted from QGuiApplication these days.

Pick-to: 6.2
Change-Id: I7423cd4808e8df86960f225fd6e4a12a1a4f11f3
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-13 22:30:08 +02:00
Thiago Macieira
cb0ea39895 CMake: remove support for building Qt with the old Intel compiler
This hasn't worked for some time. It's not in our CI and I don't think
it was working at all. When I tried to build it, I ran into several
problems with C++17 and an Internal Compiler Error I did not have any
interest in working around.

After discussing with the Intel compiler team, it was decided that
fixing those issues in the old compiler is not going to happen. Instead,
their recommendation is to adopt the new LLVM-based compiler, which
the last commit added support for.

This commit does not remove qmake support for the old ICC. It's possible
someone is using qmake with a non-Qt6 project and ICC.

Change-Id: Icb2516126f674e7b8bb3fffd16ad6350ddbd49e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 12:49:49 -07:00
Volker Hilsheimer
f7a4a79c62 Take overshoot into account when laying out QAbstractScrollArea
QAbstractScrollAreaPrivate::layoutChildren() positions the viewport, but
did not take the overshoot from scrolling with a scroller into account.
If the scroll area was resized during a scroll, then this resulted in the
roll back overcompensating for the overshoot, placing the viewport outside
the visible area.

Fix this by taking the overshoot into account when positioning the
viewport.

Add a test case. We have to use QWindow-based mouse event simulation, as
the QWidget based move events use QCursor::setPos, which doesn't reliably
go through the gesture framework.

Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Zhang Hao <zhanghao@uniontech.com>
Fixes: QTBUG-94769
Pick-to: 5.15 6.2
Change-Id: Idf650c91e5a9cffa996e23e743939243b1d4fcc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-13 14:27:12 +00:00
Giuseppe D'Angelo
49cf0b9459 Re-enable QT_NO_NARROWING_CONVERSIONS_IN_CONNECT for Qt
This define used to be set for the entirety of the Qt build but
was lost during the qmake->CMake transition. Re-enable it.

Change-Id: Idc4cb6ada485158559485b60f62f76439550b255
Pick-to: 6.2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-13 04:09:21 +02:00
Edward Welbourne
ba23507960 Fix handling of time-zone gap in QTimeZonePrivate::dataForLocalTime()
This was handled correctly when the backend supplies transitions
bracketing the time in question, but the fallback code tried to use
the DST offset at the time with larger offset from UTC; this did not
work when the gap was due to a change in standard time. Discovered by
ANS1 parsing of a date-time with two-digit year, for which the
date-time parser tried to use 1921-05-01T00:00 local time when filling
in the fields it had parsed; but, when run in Europe/Helsinki, there
is no such time due to the 20m 11s skipped when joining EET from the
prior local solar mean time.

Correct the calculation to use the actual change in offset from UTC,
as used in the (far better tested) between-transitions branch of the
code, rather than the DST offset after the transition.

Add a test-case based on the ASN.1 certificate date whose parsing
revealed the issue. Although it seems nothing in Coin can reproduce
the issue, the reporter has verified that the test does indeed fail on
the system where the bug was found and the fix does fix it.

Fixes: QTBUG-96861
Pick-to: 6.2
Change-Id: I12b02bad01daca2073d1a356452cd573684aa688
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-12 22:52:50 +02:00
Volker Hilsheimer
8513bcd90c Fix caching of parsed border color values in CSS parser
When parsing CSS, a border-color value is parsed as four brushes, as css
allows assigning up to four values, one for each side.

When applying the CSS to the HTML, we accessed it as a color value,
which overwrote the parsed value with a QColor. So while we had a valid
parsed value (and didn't re-parse), the code accessing that value still
expected it to be a list, and thus failed to retrieve the data.

There are several ways to fix that, but the cleanest way without
introducing any performance penalty from repeatedly parsing (and in fact
removing a parse of the string into a color) is to enable colorValue to
interpret an already parsed value that is a list without overwriting the
parsed value again. To avoid similar issues in the future, add assert
that the parsed value has the right type in brushValues.

As a drive-by, speed things up further by making use of qMetaTypeId
being constexpr, which allows for it to be used in a switch statement.

Add a test case.

Fixes: QTBUG-96603
Pick-to: 6.2 5.15
Change-Id: Icdbff874daedc91bff497cd0cd1d99e4c713217c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-12 18:26:26 +02:00
Thiago Macieira
878b2047b5 QList::iterator: use templates for advancing operators
Because of the addition of the operator T*(), the expression "it + N"
where N was not exactly qsizetype but any other integer type was a
compilation failure because of ambiguous overload resolution.

With GCC it's apparently a warning:

 warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
 note: candidate 1: ‘QList<T>::iterator QList<T>::iterator::operator+(qsizetype) const [with T = char; qsizetype = long long int]’
 note: candidate 2: ‘operator+(char*, ptrdiff_t {aka long int})’ (built-in)

With Clang, it's an error:

 error: use of overloaded operator '+' is ambiguous (with operand types 'QList<int>::const_iterator' and 'ptrdiff_t' (aka 'long'))
 note: candidate function
        inline const_iterator operator+(qsizetype j) const { return const_iterator(i+j); }
 note: built-in candidate operator+(const int *, long)

Pick-to: 6.2
Fixes: QTBUG-96128
Change-Id: Ie72b0dd0fbe84d2caae0fffd16a06f23dd56b060
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 08:46:31 -07:00
Volker Hilsheimer
971bf3a9bb Activate tst_QWidget_window::tst_showWithoutActivating on cocoa
The test passes, the functionality is implemented in QCocoaWindow.

Task-number: QTBUG-8857
Pick-to: 6.2
Change-Id: I2f4b3a39cec1aaaf4351753b590f35e280503461
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-12 14:08:08 +02:00
Shawn Rutledge
826765f654 Select a single range of cells in QTableView, away from merged cells
- when there is no intersection between the current selection and the
  spans collection, get ranges for all cells, just as if no span exists
- when there is an intersection between the current selection and the
  spans collection, get separate ranges for each cell (as before)

This fixes the regular case of selecting multiple non-spanned cells
after some cells are merged (get a single range for all cells instead of
separate range for each cell). However, when selecting together a group
of spanned and non-spanned cells, you still get a separate range for
each cell. But this is normal behavior in similar applications; for
example in LibreOffice, you cannot select and merge spanned and
non-spanned cells: an error dialog tells you that it's not allowed.

Done-with: Christos Kokkinidis
Pick-to: 6.2
Fixes: QTBUG-255
Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 09:07:54 +02:00
Volker Hilsheimer
9a77230685 QTableWidgetSelectionRange: Make it possible to compare for equality
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.

Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-12 09:07:54 +02:00
Thiago Macieira
f11bc38850 QOffsetStringArray: rewrite in modern C++17
Less clunky due to having better constexpr support, plus fold
expressions.

Change-Id: I3eb1bd30e0124f89a052fffd16a6bc73ba79ec19
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 19:00:52 -07:00
Thiago Macieira
8e5fcf02bd QPlugin: add qt_plugin_query_metadata_v2() to dynamic plugins
They return a pointer to the actual header, skipping the magic string.
This is done in preparation for the header located in an ELF note, which
won't have the magic.

Change-Id: I3eb1bd30e0124f89a052fffd16a8229bec2ad588
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 18:59:52 -07:00
Thiago Macieira
c89286b26a QPlugin: suppress the "QTMETADATA !" magic in static plugins
The .qtmetadata section is already suppressed for static plugins, but we
carried this unnecessary magic string. For library file formats where we
don't have a scanner (Windows COFF PE), a library that linked multiple
static plugins could end up with multiple metadata found.

We can't suppress the header because the version of moc could be
different to the version of Qt, so we need to read the header version
too. Right now, the version isn't output by moc (all the logic is in
qplugin.h), but this could change again in the future. In any case, 4
extra bytes are not a big deal, so the header stays.

Change-Id: I3eb1bd30e0124f89a052fffd16a82088d8303081
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 18:59:45 -07:00
Volker Hilsheimer
9d26de4069 Activate tst_QDialog::showAsTool test on macOS
The skip-reason only cites Qt/X11. Convert the #ifdef into a platform
name check instead. The test also fails with the offscreen plugin, so
skip it for that as well.

Pick-to: 6.2
Change-Id: I49607b89f4b32359e81e1d9aadff2c3e03035c53
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-11 15:48:33 +02:00
Volker Hilsheimer
44b9aec8d9 QDialog: respect WA_ShowWithoutActivating
QDialog overrides setVisible to set focus on the default push button, or
(if there is no such button), make the first autoDefault push button the
default button. QDialog also explicitly sends a FocusIn event to the
focus widget in the dialog.

All this should not be done if the dialog does not become active after
getting shown, which will be prevented if the WA_ShowWithoutActivating
attribute is set.

Add a test case.

Fixes: QTBUG-8857
Pick-to: 6.2
Change-Id: If47021a4721a280ba45e95b43d0424cdacd9b4ea
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-11 15:48:33 +02:00
Volker Hilsheimer
6c4dc722cb Reduce the width of a hfw-widget if scrollbar would be flipping
For a widget that implements height-for-width, the vertical scrollbar
becoming visible might be just enough to make the scrollbar unnecessary.
In that situation, the scrollbar flips on and off continuously.

To avoid that situation, make the width of the widget smaller until the
height fits without scrollbar, up to the point where we have space for
the scrollbar anyway.

The calcuation here is assumed to be cheap, but depends on the
heightForWidth implementation in the widget. Running the while-loop a
few dozen times should have no performance impact during resizing
and laying out the scroll area contents.

Add a test that confirms that within a brief period of time we only get
the one hide-event we expect.

Done-with: Zou Ya <zouya@uniontech.com>
Fixes: QTBUG-92958
Pick-to: 6.2 5.15
Change-Id: I0faeb5f9b1a226aada958c18333d9c2ac8203dd1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-11 10:49:57 +02:00
Timur Pocheptsov
dd57605b9e Http/2 - handle PADDED flag correctly
Previously, when deciding where the actual data is, Frame was calling
padding() to test if offset is needed. A curious case with a DATA frame
containing compressed body and having 'PADDED' flag set with a padding
equal to ... 0, ended in a decompression error (and assert in 6.2 code).

Pick-to: 6.2 5.15
Fixes: QTBUG-97179
Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-09 12:49:01 +02:00
Qiang Li
5d4b91ea66 Fix QTabBar's SelectPreviousTab behavior
When setCurrentIndex is called by removeTab, the old current index
might no longer be valid. Only update the lastTab value of the new
current tab if the old current index is still valid.

As a drive-by, use the validIndex helper function.

Fixes: QTBUG-94352
Pick-to: 6.2
Change-Id: I945e2093a90a1fccbba86d32b1113f83fedd41de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-09 05:41:00 +02:00
Sona Kurazyan
ce59ccb334 Optimize QPromise destructor
Unify cancel and finish in QPromise destructor in a single call. This
saves us one extra mutex lock and atomic state change.

Task-number: QTBUG-84977
Change-Id: Iac06302c39a2863008b27325fcf6792d4f58c8ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-08 17:17:20 +02:00
Volker Hilsheimer
e0b6b27d39 Add style hint for preventing spin box selection on up/down
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.

This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.

[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.

Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-08 00:45:18 +02:00
Mårten Nordheim
e4a09b0194 QNI: Update the manual test 'transportMedium' naming
I staged the manual test a little too soon, forgetting it's not compiled
in CI

Change-Id: Iaae8b8caaf8433c45e66ff662bb9bb7b25a3b8bd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:51 +02:00
Mårten Nordheim
7fb855e175 QNetworkInfo: Add transport medium detection API
The new public API returns and notifies changes to the currently active
transport medium for the application. And there's a new private API to
report it, with backends to follow.

Task-number: QTBUG-91023
Change-Id: I527985f9dabcd7bc4a32f36597e21bc4ab664c4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:23 +02:00
Doris Verria
911c97f2b5 QCocoaWindow: Make window key if the app's modal window is hidden
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.

However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.

This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.

Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-07 14:30:53 +00:00
Edward Welbourne
f644a12212 Add a basic round-trip test for QStringConverter
For now it only has a trivial test (empty) and an all-surrogate test
(Chakma digits) - but at least now all conversions to and from UTF-16
are tested. In particular, there were previously no UTF-32 tests.

Pick-to: 6.2
Change-Id: I9317928a88b9990530126db80e4756b880a364df
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-07 14:22:56 +02:00
Volker Hilsheimer
51300566ff Fix closing and showing a window with a native child
Closing a window with a native child results in the native child's
QWidgetWindow being closed. That explicitly calls setVisible(false)
on the child, which will still have the ExplicitShowHide attribute
set from the initial (explicit) show. Even though we then reset
the ExplicitShowHide, the WState_Hidden attribute will still be
set, so Qt considers the window to have been hidden, and not show
it again when the parent becomes visible.

Add a test case.

Fixes: QTBUG-96286
Fixes: QTBUG-79012
Fixes: QTBUG-71519
Change-Id: I482e6d5236c959d82ce66798176b259a3176972c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-10-07 12:54:10 +02:00
Volker Hilsheimer
1453f048f5 Clean up tst_qwidget
Remove dead code
Make logic to position test widgets more consistent across test functions
Consistent cursor positioning logic
Get rid of unnecessary event processing
Reduce calls to qWait with hard coded values
Use qWaitFor to establish asynchronous preconditions
Ignore expected warning messages
Expect-fail (instead of blacklist or skip) some tests that always fail
Ignore unpredictable events in childEvents test
Split large "render" test in multiple test functions

Task-number: QTBUG-52974
Task-number: QTBUG-26424
Change-Id: I206e114c2c1d9801e08600d3341c2738dc881f17
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-10-07 12:54:10 +02:00
Joerg Bornemann
6f1eb0b2bc Don't build tests/auto/tools when cross-compiling
There already was an attempt, but the wrong variable name was used.

Pick-to: 6.2
Change-Id: I4bdd73f86ff6aa5151e4427024b83daa57b54a39
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-07 08:03:40 +02:00
Volker Hilsheimer
af31b6cf05 Silence compiler warning from int/size_t mismatch
Amends 4757b93b0e.

Change-Id: I678785cd61dbdecb3b1e7e68c7daf9f18cad4d02
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-07 00:49:17 +02:00
Thiago Macieira
46fc01d7ca QElfParser: rewrite using elf.h
This rewrite uses the actual structures supplied by the system's C
library, so it should be easier to read. It removes hardcoded constants
with little evident meaning in favor of sizeof() and the macros from
that header. It also removes advancing the data pointer in favor of
having absolute offsets.

The resulting implementation is stricter than the original, checking
more fields in the header. Because the QPluginLoader and QFactoryLoader
users may make decisions based on availability of plugins before
attempting to load them, it's better to be stricter here than to fail
later when trying to dlopen() them.

Debugging and testing are much improved. Instead of stored artifacts, I
added a routine to modify a valid plugin to make it invalid, given the
conditions we've found so far.

If you turn debugging on for this category, you'll see things like:

 not-elf.fcqdMq.so : Not an ELF file (invalid signature)
 wrong-word-size.QrnSAx.so : ELF 32-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-word-size.bOkXvp.so : Invalid ELF file (class 0), LSB (GNU/Linux)
 unknown-word-size.ogYKeF.so : Invalid ELF file (class 66), LSB (GNU/Linux)
 wrong-endian.owiElX.so : ELF 64-bit MSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-endian.FRxClR.so : ELF 64-bit invalid endianness (0) (GNU/Linux)
 unknown-endian.FfvRrP.so : ELF 64-bit invalid endianness (65) (GNU/Linux)
 elf-version-0.gPTdpQ.so : ELF 64-bit LSB (GNU/Linux), file version 0
 elf-version-2.jlIUUg.so : ELF 64-bit LSB (GNU/Linux), file version 2
 executable.LlXiFp.so : ELF 64-bit LSB (GNU/Linux), version 1, executable, x86-64
 relocatable.UsOYuy.so : ELF 64-bit LSB (GNU/Linux), version 1, relocatable, x86-64
 core-file.hqvNRz.so : ELF 64-bit LSB (GNU/Linux), version 1, core dump, x86-64
 invalid-type.CIJgfS.so : ELF 64-bit LSB (GNU/Linux), version 1, unknown type 259, x86-64
 wrong-arch.UcNmgz.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, AArch64
 file-version-0.lZYuda.so : ELF 64-bit LSB (GNU/Linux), version 0, shared library or PIC executable, x86-64
 file-version-2.ucfdwL.so : ELF 64-bit LSB (GNU/Linux), version 2, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : contains 0 sections of 64 bytes at offset 0 ; section header string table (shstrtab) is entry 0
 no-sections.rSjsHh.so : no section table present, not able to find Qt metadata
 qtmetadata-executable.vrxcIf.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 qtmetadata-executable.vrxcIf.so : contains 42 sections of 64 bytes at offset 997256 ; section header string table (shstrtab) is entry 41
 qtmetadata-executable.vrxcIf.so : shstrtab section is located at offset 996831 size 423
 qtmetadata-executable.vrxcIf.so : section 0 name "" type NULL flags X offset 0x0 size 0x0
 qtmetadata-executable.vrxcIf.so : section 1 name ".note.gnu.property" type NOTE flags AX offset 0x2a8 size 0x30
 qtmetadata-executable.vrxcIf.so : section 2 name ".note.gnu.build-id" type NOTE flags AX offset 0x2d8 size 0x24
 qtmetadata-executable.vrxcIf.so : section 3 name ".hash" type HASH flags AX offset 0x300 size 0x44c
 qtmetadata-executable.vrxcIf.so : section 4 name ".gnu.hash" type 0x6ffffff6 flags AX offset 0x750 size 0x3b8
 qtmetadata-executable.vrxcIf.so : section 5 name ".dynsym" type DYNSYM flags AX offset 0xb08 size 0xd50
 qtmetadata-executable.vrxcIf.so : section 6 name ".dynstr" type STRTAB flags AX offset 0x1858 size 0x15d8
 qtmetadata-executable.vrxcIf.so : section 7 name ".gnu.version" type 0x6fffffff flags AX offset 0x2e30 size 0x11c
 qtmetadata-executable.vrxcIf.so : section 8 name ".gnu.version_r" type 0x6ffffffe flags AX offset 0x2f50 size 0xb0
 qtmetadata-executable.vrxcIf.so : section 9 name ".rela.dyn" type RELA flags AX offset 0x3000 size 0x480
 qtmetadata-executable.vrxcIf.so : section 10 name ".rela.plt" type RELA flags AX offset 0x3480 size 0x7e0
 qtmetadata-executable.vrxcIf.so : section 11 name ".init" type PROGBITS flags AX offset 0x4000 size 0x1b
 qtmetadata-executable.vrxcIf.so : section 12 name ".plt" type PROGBITS flags AX offset 0x4020 size 0x550
 qtmetadata-executable.vrxcIf.so : section 13 name ".plt.got" type PROGBITS flags AX offset 0x4570 size 0x8
 qtmetadata-executable.vrxcIf.so : section 14 name ".text" type PROGBITS flags AX offset 0x4580 size 0x110e
 qtmetadata-executable.vrxcIf.so : section 15 name ".fini" type PROGBITS flags AX offset 0x5690 size 0xd
 qtmetadata-executable.vrxcIf.so : section 16 name ".rodata" type PROGBITS flags AX offset 0x6000 size 0x473
 qtmetadata-executable.vrxcIf.so : section 17 name ".qtversion" type PROGBITS flags AX offset 0x6478 size 0x10
 qtmetadata-executable.vrxcIf.so : section 18 name ".qtmetadata" type PROGBITS flags AX offset 0x64a0 size 0x19b
 qtmetadata-executable.vrxcIf.so : found .qtmetadata section
 qtmetadata-writable.stzwrk.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64

Change-Id: I42eb903a916645db9900fffd16a4437af9728eea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-06 12:12:53 -07:00
Volker Hilsheimer
e7cd245628 Silence compiler warning
clang warns that: local variable 'big' will be copied despite being
returned by name [-Wreturn-std-move]

So force the intended move using std::move.

Change-Id: If5ff557c1b577789e6659783d8106295fafb3485
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-06 15:05:20 +02:00
Allan Sandfeld Jensen
733923c81c Add a safer way to use QThreadPool::reserveThread
Add startOnReservedThread that specifically releases a reserved thread
and uses it atomically for a given task. This can make a positive
number of reserved threads work.

Change-Id: I4bd1dced24bb46fcb365f12cbc9c7905dc66cdf1
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-06 14:55:20 +02:00
Giuseppe D'Angelo
2c3617dfcb Always enable QRegularExpression's JIT when testing
Given on most CI configurations we run tests only on debug builds, this
means that effectively we don't test JIT paths (JIT is kept disabled in
debug builds). To keep it enabled in a test, we have a few options:

* export a developer-build-only variable from QtCore, to force JIT
usage, and set it in the test. This is still suboptimal as many
configurations aren't using developer builds in the first place;

* use the already existing QT_REGEXP_USE_JIT environment variable,
setting it from CMake/CTest. The problem here is that although add_test
does support it, we don't expose it through our wrapper functions;

* just set that env variable from within the test itself. I went for
this option.

Change-Id: I73abfb7fc0d76ec77e881f24c5daf5be304ab948
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-06 13:34:17 +02:00
Alex Trotsenko
82b86960c0 QLocalSocket/Win: stop reading in close()
After calling close(), the socket can enter 'Closing' state, in which
we try to write buffered data before disconnecting. As the device is
already closed, we must disable any pipe reader activity and clear the
read buffer.

Change-Id: I8994df32bf324325d54dd36cbe1a1ee3f08022d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-10-06 10:16:14 +03:00
Tatiana Borisova
d093683119 Compile private Qt APIs autotests for INTEGRITY
- getgrgid/getpwuid are not supported
- the default constructor of "ObserverOrUninit" must be referenced for GHS compiler

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: I24093da76e116aba4b87a8f5c5763b03d082a2cd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-05 20:35:47 +03:00
Juan Casafranca
0263cfdfa0 Remove qshadergraph files
- Those files were moved as part of Qt3D as its the sole
  user of these
- Also removed associated unit tests

Pick-to: 6.2 5.15
Change-Id: I302bc219218a58071c86d2447cb4449601fca32c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2021-10-05 17:49:51 +02:00
Thiago Macieira
461084b6c4 Q{Elf,Mach}Parser: harmonize the arguments passed
Both functions took a QString for the input file name, but while the ELF
parser had an optional QLibrary pointer (which was never null) where to
store the error string, the Mach-O parser received a pointer to a
QString. So make both of them take a single in/out QString pointer,
which has the file name on input and is cheap for us because of COW.

Drive-by fix the name of the static function in qmachparser.cpp from
"ns" (which stood for "not suitable") to "notfound".

Change-Id: I3eb1bd30e0124f89a052fffd16a8182f4f8541c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:42 -07:00
Thiago Macieira
349fb14c1d QPlugin: update the arch requirements to match the x86-64 ISA levels
When we created the functionality, the levels were not yet standardized.
Now they are and you can use -march=x86-64-v3 (for example) to get to
them. We're making a split between "v1" and "baseline" here for the
benefit of 32-bit, which is not included in the ISA levels.

Change-Id: I2de1b4dfacd443148279fffd16a397a700b9a15a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:40 -07:00
Thiago Macieira
788a7bfdb1 QPlugin: move some of the logic from moc's output to qplugin.h
This will allow us to make changes in QtCore itself, without having to
worry about moc compatibility.

The output uses an #ifdef so this version of moc can still be used to
compile earlier versions of Qt (usually, in cross-compilation
environments). See discussion in the mailing list[1].

[1] https://lists.qt-project.org/pipermail/development/2021-September/041732.html

Change-Id: I2de1b4dfacd443148279fffd16a39784c80c5f3b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:34 -07:00
Albert Astals Cid
ae10084ef9 Respect font stretch if set together with font style
Fixes: QTBUG-77854
Change-Id: I2bf9cea9d5ecd151a9d96bbe93e9477a9159ca1f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-10-04 16:10:11 +02:00
Albert Astals Cid
6cd1d6e927 Add lancelot test for smallcaps text path
Change-Id: I62b824e852fe6c05afabbd7ab80efaad5a298f82
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-10-04 16:10:00 +02:00
Ievgenii Meshcheriakov
9a3f4afb70 Remove checks for features available in C++17
This patch removes most of the checks that are made using C++20
__cpp_* macros for features available in C++17 and earlier.
Library feature check macros (__cpp_lib_*) are unaffected.

Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-02 17:54:39 +02:00
Edward Welbourne
8c52f8cbf5 Rename command-option to generate_expected_output.py
The --skip-benchlib option was misnamed: there are several benchlib
tests, of which it only skipped the callgrind one. As there is no
other test involving callgrind, rename to --skip-callgrind.

Change-Id: I0179fd35dd79c525f79e4a28a626e964323409bf
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-01 19:24:31 +02:00
David Faure
8652f4766b Untangle qsortfilterproxymodel unittests
With the QRegExp variant removed, it was weird to have all QSFPM
tests in "tst_qsortfilterproxymodel_regularexpression", even those
completely unrelated to regexps. Instead of reuniting into a single
executable as before, I simply split it out in separate executables:

* tst_qsortfilterproxymodel has the "standard" QSFPM tests
* tst_qsortfilterproxymodel_regularexpression has the regexp-related tests
* tst_qsortfilterproxymodel_recursive is separate as before

Change-Id: I345530b4352671164008bba4805af7b12ac90247
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-01 18:30:25 +02:00
Volker Hilsheimer
132d6d0127 QFontCache: don't start cleanup timer if we are not in the main thread
We can only start timers in threads started via QThread, and even then
we cannot assume that the thread runs an event loop. So only start the
timer when we are in the main thread.

Add a test that verifies that we don't get the warning message.

Pick-to: 6.2
Change-Id: I40d7d9ff115720f9ecd3eedaebbade2643daf843
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-01 16:46:48 +02:00
Allan Sandfeld Jensen
9a6c653eaf Cleanup of qthreadpool
Don't bother overwaiting in waitForDone(), if it was done at one point
after it was called we can return true. And do not stop threads recently
awakened by a startThread call as they have tasks to do.

Make allowing at least one thread regardless of reservation more
standard instead of hacked in certain places.

Pick-to: 6.2
Change-Id: I304bcdc5822f440d5e72fc33ba2aa1678c9ba0d0
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-01 12:01:21 +02:00
Ievgenii Meshcheriakov
49d94bbb41 Assume that <variant> header is always present
This header is a C++17 feature that is already used unconditionally
in qtypeinfo.h.

Change-Id: I26330d298e95102f3e94c0c69fc95c1025666eb4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-01 02:46:27 +02:00
Ievgenii Meshcheriakov
e0b87edd73 tst_qthread: Don't use QVERIFY in multiple threads in threadIdReuse()
Testlib is not thread safe. Store the status into variable and check
it in the main thread instead.

Pick-to: 6.2
Change-Id: I840c8a3dceb1115a1b81ffeaa0fab96f9d2f1ff0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-01 02:46:17 +02:00
Ievgenii Meshcheriakov
44a7412795 Remove checks for C++ standard versions C++17 and below
Qt requires a compiler that support C++17 thus __cplusplus
is always 201703L or higher. This patch removes checks
for __cplusplus value that always succeed.

Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 02:46:09 +02:00
Volker Hilsheimer
79f62380f0 QAbstractItemView: Fix IM input starting edit session
Item views can open an editor widget on the first key press, and need to
take special care not to break input methods. The initial key press
starts compositing by the system input method, which is then interrupted
by the focus transfer to the editor.

To solve this problem, the widget needs to keep focus while the initial
composition is ongoing, and only transfer focus to the editor once the
composition is either accepted or cancelled by the user. Add a state flag
that is set during this initial preedit phase.

During this initial composition, the item view will receive all input
method events, and needs to forward these to the open, but not yet focused
editor for the user to get the correct visual feedback during the preedit
phase. The item view also needs to report to input method queries on
behalf of the editor to make sure that the IM UI is correctly positioned
without covering the user input.

Implement a test that simulates the sequences through synthesized
QInputMethodEvents; we can't simulate the entire system input stack.

Fixes: QTBUG-54848
Change-Id: Ief3fe349f9d7542949032905c7f9ca2beb197611
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 01:48:50 +02:00
Karsten Heimrich
55ab987c9a Fix QDir::entryList to work for directories that end with '.lnk'
In addition to checking the .lnk extension, check that the
the specified path is not a path to a directory.

Pick-to: 6.2
Fixes: QTBUG-85058
Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-30 21:20:25 +02:00
Volker Hilsheimer
6ad88e7898 Add testcase for QWidgetRepaintManager
At the current state, Qt::WA_StaticContents is not respected on any
platform, and optimizations for opaque widgets is not implemented on
Cocoa.

Task-number: QTBUG-73117
Change-Id: I48b7b0c4436da5a609fdbe51bb1c9789a2a059bd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-30 21:10:48 +02:00
Paul Olav Tvete
b869d9b768 Add manual test for window activation
This is a manual test of QWindow::requestActivate() and how it
interacts with implicit activation from the window system. Written in
order to test QtWayland, but hopefully also useful for testing on other
platforms.

Task-number: QTBUG-91542
Change-Id: Id18dc6d146d213a7c730cff343d9fc25f6c42514
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-30 20:51:52 +02:00
Mårten Nordheim
ce988284c4 Add transport info to the QNetworkInformation manual test
Task-number: QTBUG-91023
Change-Id: I0015bc18b0f5c7faf5826a46ee880add09a7b244
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Mårten Nordheim
11d2524bc4 Refactor QNetworkInformation manual test
To make it a little cleaner

Task-number: QTBUG-91023
Change-Id: Ib99cc722b47835d13707beeeea35573729e4b032
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Ievgenii Meshcheriakov
52ad59f9ea QThread: Reset the system thread ID when thread exits on Unix
Unix QThread implementation stores pthread_t as a system thread ID
when the thread is created, but never resets the system ID when
those threads are destroyed. Some implementations may reuse the
same thread IDs for new threads, and this may cause QThread::wait()
to erroneously complain that "Thread tried to wait on itself".

This patch sets the system thread ID to nullptr when the thread is
about to exit and be destroyed by the system.

A regression test is added to tst_qthread.

Fixes: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:53:49 +02:00
Volker Hilsheimer
223066d431 Don't clear focus if setParent doesn't change the parent
QWidget::setParent might be called to change the window flags, without
changing the parent. For those cases, we don't have to clear the focus.

Decouple the newParent state from the wasCreated flag. In most places
where newParent was tested, wasCreated was either tested previously and
can't be false anyway, or the code executed is irrelevant for widgets
that are not yet created (there can't be a paint manager). In the
remaining case, test wasCreated explicitly to maintain existing logic.

Add test for the cases where the previous code broke the focus, both
for QWidget and QDialog.

Fixes: QTBUG-93005
Pick-to: 6.2
Change-Id: I39dc179c2d348054de3927aa8b69eecef4935511
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2021-09-28 17:42:57 +02:00
Eirik Aavitsland
5e2725772a Add testing of QPdfWriter output to QPainter lancelot test
Utilizes the native pdf renderer of macOS, so the test is only enabled
on that platform. As the PDF generation should be platform independent
anyway, this should not matter.

Pick-to: 6.2 5.15
Change-Id: I8b6b70562d1f24fdb77795aa7eb5843279aaae85
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-28 17:06:57 +02:00
Eirik Aavitsland
66a44f4eba Preserve QImage metadata when converting format with color table
Unlike the other conversion functions, convertWithPalette() did not
call copyMetadata().

Fixes: QTBUG-96926
Pick-to: 6.2 5.15
Change-Id: I2b171cec16bc5a90d33e80d6fe178c650ed3fe36
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-09-28 15:59:31 +02:00
Thiago Macieira
57960ab075 Q{Elf,Mach}Parser: simplify the return codes
The multi-state return code was a legacy of how Arvid wrote the ELF
parser code back in the day, the fact that it scanned for two different
types of plugins in Qt 4 and that the metadata could exist in different
places.  None of that matters nowadays: who cares if the file is a
corrupt binary, not a valid binary, does not have the right
architecture, or has no suitable section? It's not a plugin, period.

The Qt 4 plugin mechanism was removed for Qt 5.0 in commit
7443895857 ("Remove support for Qt 4 style
plugins").

Change-Id: I42eb903a916645db9900fffd16a442d800399b98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-24 20:16:05 -07:00
Volker Hilsheimer
a03a67fbfa macOS: Remove special cases in enter/leave event handling
The Cocoa QPA plugin no longer tracks popups, but dispatches enter/leave
events when popups show and hide. So the special handling in tests and
QWidgetWindow can go away now.

Change-Id: Ib6ef00689de231996e5e57ecdd8fd0d4c861d68b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 21:37:06 +02:00
Thiago Macieira
60b0b0dedd tst_qplugin{,loader}: make it pass on Macs
Debug builds were broken.

WARNING: tst_QPluginLoader::errorString() testdata bin/libtst_qpluginloaderlib.dylib could not be located!

$ ls -l bin
total 112
-rwxr-xr-x 1 tjmaciei staff 77296 Sep 14 08:46 libtheplugin_debug.dylib
-rwxr-xr-x 1 tjmaciei staff 33408 Sep 14 08:46 libtst_qpluginloaderlib_debug.dylib

Pick-to: 6.2
Change-Id: I42eb903a916645db9900fffd16a4bb0a51ef967c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 11:40:44 -07:00
Volker Hilsheimer
a5e5943d8a macOS: send enter/leave when a window opens/closes
Since macOS doesn't give us any event when a modal window opens,
we need to do so ourselves explicitly so that the current mouse
window gets a leave event when e.g. a popup opens, and an enter
event when the popup closes again. The case for modal dialogs is
partially handled by QGuiApplication already.

Note: We cannot rely on the transientParent of the opening/closing
window, as it's nullptr for QMenu windows even if the QMenu has
a widget parent.

Add a test for enter/leave events when a secondary window opens,
covering both the dialog and the popup case. For the dialog case,
we sometimes get two Enter events when the dailog closes, which
we have to tolerate for now.
To make the test pass on b2qt platforms, fix the offscreen plugin
to explicitly send enter/leave events in the same way as Cocoa
now does.

Fixes: QTBUG-78970
Pick-to: 6.2
Change-Id: If45e43e625e8362c3502c740154f6a6a8962b9e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 19:19:42 +02:00
Alex Trotsenko
d3a622f817 Revert "QProcess: do not emit aboutToClose() twice"
This reverts commit efb90f6e7e.

Reason for revert: behavior change for signal listeners

Change-Id: Ibe3c5d496cd61a9fccab17a10cc9fda8334fc9d4
Reviewed-by: Björn Schäpers <qt-codereview@hazardy.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-24 05:57:47 +00:00
Edward Welbourne
298e41b830 Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all
checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in
some places in the process, particularly #include order.

Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00
Alexandru Croitor
0da123d67b CMake: Bump almost all cmake_minimum_required calls to 3.16
Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-22 19:36:49 +02:00
Ievgenii Meshcheriakov
fe46cd59ce Add isValidUtf8() methods to QUtf8StringView and QByteArray{,View}
The new methods return true if the string contains valid UTF-8
encoded data, or false otherwise.

[ChangeLog][QtCore][QByteArray] Added isValidUtf8() method.

[ChangeLog][QtCore][QByteArrayView] Added isValidUtf8() method.

[ChangeLog][QtCore][QUtf8StringView] Added isValidUtf8() method.

Task-number: QTBUG-92021
Change-Id: I5d0cb613265d98b1f189c5f5cc09c1f7db302272
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-22 15:40:30 +02:00
Alex Trotsenko
a320b54bb6 QLocalSocket: reorder device closing
To allow reading from a slot connected to the aboutToClose() signal,
we should call QIODevice::close() just before closing the inner device.

This patch amends 21f3ff65b8.

Pick-to: 6.2
Change-Id: Ic8cd00497e1bdf923b980c26e9ca874b77e82f89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-21 21:40:27 +00:00
Tatiana Borisova
dbab926883 locale: INTEGRITY does not define LC_MEASUREMENTS
- It does however use the Unix backend for system locale, so don't entirely
  skip setting environment variable, only leave out LC_MEASUREMENTS.

Pick-to: 6.2
Change-Id: If292f1077851b29da2a21af7c46f4db9c0e4ed19
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-21 17:56:54 +00:00
Fabian Kosmale
01d94760d8 tst_qmetatype: Fix operator< detection for std::optional
Amends ca54b741d6.
operator< is not constrained in MSVC's standard library, either.

Pick-to: 6.2
Fixes: QTBUG-96690
Change-Id: Ibcbb9e53a1f9e8b13786f6d8c01489c61d8d2d7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-21 19:27:50 +02:00
Pasi Petäjäjärvi
3635acd27a locale: QNX does not define LC_MEASUREMENTS
Pick-to: 6.2
Change-Id: I01ce03e578173f53639927e70f49e6d9b0d08d20
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-21 14:36:18 +03:00
Mårten Nordheim
810e4e56bd QNetworkInformation: Actually compare names case insensitively
The docs (10 lines above) say it will find the backend case
insensitively. Thus the comparison should also be case-insensitive.

Pick-to: 6.2
Change-Id: I65901ed81b7d8bdfcf76f5b6c7b40efe63245503
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 21:00:01 +02:00
Volker Hilsheimer
3714e51436 QWidgetWindow: Stabilize test on Xcb
Showing, hiding, and showing a window can result in the Xcb QPA plugin
warning about

qt.qpa.xcb: internal error:  void QXcbWindow::setNetWmStateOnUnmappedWindow()
called on mapped window

The point of the test is to verify that we get a paint event on a window
that is shown again after having been hidden, not to verify that async
windowing systems can handle a show/hide/show sequence. So wait for the
window being exposed before we hide it.

Pick-to: 6.2 5.15
Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-20 19:00:05 +02:00
Volker Hilsheimer
6dc587dfdd Un-blacklist quitOnLastWindowClosedMulti test on macOS in CI
After the recent refactoring in 28b14b966f
this test should run stable on all platforms. However, the way the test
was written made it quite flaky. Simplify it to verify that closing one
window doesn't prevent a second timer to fire (which it would if closing
the first window already quit the application).

Change-Id: I0306792cd7573ebd3418d1aabffe2b78700ec2d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-20 19:00:05 +02:00
Volker Hilsheimer
8fcfd7f591 Eat expected warning messages in QGuiApplication test
Verifies that we get the messages we want, and makes it easier to see
relevant debug output.

Pick-to: 6.2
Change-Id: Ide92959b120f325badbf200236cdc85f72226e1e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-20 19:00:05 +02:00
Tatiana Borisova
766904bf5b Compile autotests for Integrity
- process environment/DNS are OFF for INTEGRITY

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: I189a97f88c96a428586c31a66b8d250e04482900
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 17:29:04 +03:00
Edward Welbourne
7943480f0f Fix QDateTimeParser's handling of 't' format to match serialization
This amends commit 68f19fb630 to only
consume one 't' from the format string, to match qlocale.cpp's
serialization of time-zone specifiers, which only consumes one, so
will repeat the time-zone specifier as many times as unquoted t
appears in the format. It's hard to imagine why anyone would want this
behavior, but it's what our serialization has always done and parsing
should match serialization.

Add test-cases for double time-zone specifier.
Delete a lie in the process.

Task-number: QTBUG-95966
Change-Id: I574896040a74085dee89a4fefd8384be44ad827b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-20 15:05:36 +02:00
Dimitrios Apostolou
a5d501000e Blacklist flaky test
Task-number: QTBUG-96270
Pick-to: 6.2 5.15
Change-Id: I3feb604c0c2f394b2915b3d98d3b02f469331a18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-20 15:05:36 +02:00
Laszlo Agocs
481bc82d59 rhi: Remove Q_RELOCATABLE_TYPE for types with QVLA in them
QVLA itself is non-relocatable due to self references. (ptr pointing
to array[Prealloc] as long as capacity < Prealloc)

Seems we shot ourselves in the foot in multiple places with this.

Pick-to: 6.2 6.2.0
Fixes: QTBUG-96619
Change-Id: I57a2ce539b671326cd352dbe57a1f3d4c46a6456
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-20 12:25:37 +02:00
Ivan Solovev
b4bb3a5415 Introduce QDoubleValidator::setRange overload with two parameters
The QDoubleValidator::setRange() used to have 3 parameters, with
the third one (the number of decimals) having a default value of 0.
Such default value does not make much sense for a *double* validator.
Also, since a default value was used, omitting the decimals was
silently overwriting the previous decimals value, discarding the
value that could be previously explicitly specified by user.

[ChangeLog][QtCore][QDoubleValidator][Important Behavior Changes] The
QDoubleValidator::setRange() method now has two overloads.
The first overload takes 3 parameters, but does not support a
default value for decimals.
The second overload takes only two parameters, not changing the
number of decimals at all.
Hence, the number of decimals will only be changed if the user
explicitly specifies it.
To maintain the old behavior of setRange(), pass 0 as the 3rd
argument explicitly.

Note that it is a source-incompatible change. But it should be fine,
because using QDoubleValidator with 0 digits after decimal point does
not make much sense and so, hopefully, is not that common.

At the same time, change the default-constructed QDoubleValidator
to use -1 for decimals, which allows arbitrarily many digits in
the fractional part. The value was previously 1000, which allowed
more than anyone would reasonably use, so this should make no
practical difference.

Some more unit tests to cover the behavior of the setRange()
overloads are also added.

As a dirve-by: remove unnecessary QValidator::State to int conversions
in the unit tests. QCOMPARE is capable of comparing these enums and
provides a better output in case of failure for enums.

Task-number: QTBUG-90719
Change-Id: I523d6086231912e4c07555a89cacd45854136978
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 09:39:13 +02:00
Alex Trotsenko
efb90f6e7e QProcess: do not emit aboutToClose() twice
This signal is emitted by the QIODevice itself, so we don't have to
emit it from QProcess::close().

Pick-to: 6.1 6.2
Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-19 10:42:50 +03:00
Liang Qi
0d3b395c16 tests/xcb: add a test for screen off and on
Task-number: QTBUG-96247
Change-Id: I1fd6f21ad914480b7e8d07227ee80184e305276a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +02:00