Commit Graph

53735 Commits

Author SHA1 Message Date
Alexandru Croitor
f917df2752 CMake: Fix _QT_TOOLCHAIN_VARS_INITIALIZED check in toolchain file
The environment variable check to set extra env vars
was using invalid syntax. The condition always resolved to TRUE
which means the env vars were constantly re-assigned inside each
try_compile project.

To check for undefined-ness, one can use if(NOT DEFINED ENV{...})
To check for false-ness, one can use if(NOT "$ENV{...}")
To check for string emptiness, one can use
  if(NOT "$ENV{...}" STREQUAL "")

In this particular case checking for false-ness is good enough.
The extra re-assigning had no visible effect, so this is just cleanup.

As a drive-by, clarify one comment.

Amends ca59c20939

Pick-to: 6.2
Change-Id: I8fd400101efa9e610a81268c33cac8c0cb33cba3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-29 15:34:12 +02:00
Alexandru Croitor
402b8b9cee CMake: Use Qt6HostInfo dir for Tools CMAKE_PREFIX_PATH assignment
Instead of hard-coding a lib/cmake suffix to CMAKE_PREFIX_PATH
use the parent directory of the Qt6HostInfo package which is always
searched for when QT_HOST_PATH is set.

Amends d2359b2d4e

Pick-to: 6.2
Change-Id: I7f3c8fe17bc82f733580d68d928146434a57d849
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-10-29 15:34:12 +02:00
Alexandru Croitor
102c1cff72 CMake: Clean up and improve QT_HOST_PATH_CMAKE_DIR computation
Previously when one wanted to use a cross-compiled Qt with a host Qt
installed in a non-default location, they'd have to provide both
QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR.

This change will now try to first check if ${QT_HOST_PATH}/lib/cmake
is a valid path on disk and use that. This is nicer to the user
because they don't need to specify 2 paths anymore.

Furthermore the path computation and sanity checks are now done after
any extra toolchain cmake files are loaded, to give an opportunity
to the files to set the paths first.

Finally, both variables need to be added to
__qt_toolchain_used_variables so they are passed along to try_compile
calls if the variables are specified manually.
Otherwise when the toolchain file is loaded by a try_compile project,
it will error out saying no host path found (as long as the initial
paths embedded in the toolchain are invalid).

Amends 93fc3afe71 and
ec90f9013b

Pick-to: 6.2
Change-Id: I433239b36b084f2d0a7a0dd043fdf87d77c138f3
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-29 15:34:12 +02:00
Alexandru Croitor
c82bca9efe CMake: Fix forcing usage of host tools when doing a desktop build
One can now set QT_FORCE_FIND_TOOLS to ON together with passing a
QT_HOST_PATH to ensure that a new desktop build uses
already existing tools from a different Qt host (desktop) installation.

Depends on a0e56294c1
to work, which is not in 6.2, but this change is still included in
6.2 because it cleans up the conditions a bit to make them more clear.

Amends 42d3b21c92
and 5a779a4ad3

Pick-to: 6.2
Fixes: QTBUG-95099
Task-number: QTBUG-97658
Change-Id: If6258fb1091c6c1e457f22ae5f468b811bd20d57
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-29 15:34:12 +02:00
Alexandru Croitor
9ed274a48d CMake: Enforce lookup of host Tools packages in qt_internal_add_tool
When cross-building, qt_internal_add_tool would accidentally find device
QtFooTools CMake packages as a result of calling find_package. It should
have found host Tools packages instead.

The reason was due to a combination of setting
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH, find_package preferring
the lookup of packages in CMAKE_FIND_ROOT_PATH before CMAKE_PREFIX_PATH
and there being a Tools package in the device sysroot.

Because qt_internal_add_tool didn't adjust CMAKE_FIND_ROOT_PATH to
contain the host path, the device package was picked up.

Change the implementation not to set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
and instead modify both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH
to prefer the host packages instead.

This aligns to the behavior that was introduced in
ec90f9013b
which is used in QtModuleDependencies when looking for Tools packages.

Pick-to: 6.2
Fixes: QTBUG-97599
Change-Id: I8e38284774ae97981ccfd5071465609f3de80f01
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-29 15:34:12 +02:00
Volker Hilsheimer
ffc9323671 Fix performance regression when avoiding scrollbar flipping
Amends 6c4dc722cb.

Don't search for the optimal size of the scrollarea's widget if it can't
be found anyway. Try the size with scrollbar first, which covers the
vast majority of sizes.

Optimizing the loop with e.g. a binary search adds no value, as the size
is often just a pixel too small.

Since we can't rely on the number of height-for-width calls, we can't
meaningfully test this behavior. The number of calls is still very high
during showing and resizing; optimizing this further is for a separate
commit.

Fixes: QTBUG-97811
Pick-to: 6.2 5.15
Change-Id: If145302e6414b32cf1ce7251ff33b0039f584867
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-29 14:53:56 +02:00
Alexey Edelev
53ffa665d0 Fix target existence check in qt6_android_generate_deployment_settings
Move the check to the beginning of the function.

Pick-to: 6.2
Change-Id: Ia44bb2e56626b00e75efabf2ebdc8eb97eee0ff8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-29 14:53:56 +02:00
Alexey Edelev
d273f38726 Replace deleteRecursively function with QDir::removeRecursively
Use QDir::removeRecursively instead of deleteRecursively when cleaning
up top-level build folders.

Change-Id: Ifb406fc1965a0781eab4fd63a3764a84f4309d25
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-29 14:53:56 +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
Robert Löhning
ee487c6b89 QVarLengthArray: Add explicit assertions for implicit assumptions
Change-Id: I4dfbf6174483b4af91f31a05c18cfec2aaec6e1f
Pick-to: 6.2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-29 12:11:46 +00:00
Mårten Nordheim
a6947853ee QNI: transportMedium support for iOS
It can only differentiate between cellular and not cellular
and then we can determine if it's disconnected or (presumably) using
wifi.
It is also explicitly not supported on macOS, which adds to the
confusion.

Task-number: QTBUG-91023
Change-Id: I1d002ba06dd9acf1a0daabfb2a4193c07871e9b4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-29 13:01:55 +02:00
Ivan Solovev
f40e0bcf67 Extend documentation for bindable properties
Extend the general property system page with a section on how
to use bindable properties.
Add some cross-references to improve the user experience.

Task-number: QTBUG-97656
Pick-to: 6.2
Change-Id: I2520cdc168e3a8a66ea387e4ab717f4e0f969424
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-10-29 13:01:55 +02:00
Mike Achtelik
d6da61f3b9 Android: Treat ACTION_CANCEL as TouchCancelEvent
Change 64d62c53c1 started treating an
ACTION_CANCEL as a TouchPointReleased. This leads to unintentional
presses, if e.g. an edge swipe for the android back gesture starts on a
MouseArea.

When Android takes possession of the motion, an ACTION_CANCEL is
delivered, which needs to be handled as such. It should not be treated
as a normal up event that triggers a press. Otherwise, we get the
above-mentioned issue, where an unintentional action is performed.
So let's use QWindowSystemInterface::handleTouchCancelEvent to treat it
as a canceled touch in Qt.

Task-number: QTBUG-72110
Pick-to: 6.2 5.15
Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-29 08:39:55 +02:00
Lorn Potter
97be0cca17 wasm: fix changing cursor shape
The previous implementation would occasionally result
in a crash when a window was closed.

Apparently 'auto' cursor does not work so well,
so we now use 'default' name.

Fixes: QTBUG-96178
Pick-to: 6.2 5.15
Change-Id: I0179d20dbdc01f0e3021d746324e1e39c678a298
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-29 04:18:34 +00:00
David Skoland
d685c4682b Revert "wasm: Hide popups when a window is left-clicked"
This reverts commit 0921caf976.

Reason for revert: This change breaks mouse press handling in popups themselves. I'll make another solution.

Change-Id: Ib9fd41f3f078e6abf22e5b0f75724d4acc737ead
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-29 01:16:35 +00:00
Joerg Bornemann
7531994379 CMake: Fix undefined reference to WinMain errors with MinGW
When linking against Qt with MinGW, libmingw32.a must come before
libQt6EntryPointImplementation.a on the linker command line.  Otherwise
the linker cannot find the WinMain symbol that's defined in the
EntryPointImplementation library.

Under certain circumstances, mingw32 was linked after
EntryPointImplementation.  To reliably ensure the order of said
libraries, we introduce the imported library EntryPointMinGW32.  This
target represents libmingw32.a and links against EntryPointImplementation.

The link dependencies look like this:
EntryPointPrivate -> EntryPointMinGW32 -> EntryPointImplementation

The imported library EntryPointMinGW32 is defined in a separate .cmake
file which is included by both src/entrypoint/CMakeLists.txt and
Qt6EntryPointConfig.cmake.  This is needed, because the consumer outside
of Qt must access this imported library, and we cannot export imported
libraries.

Pick-to: 6.2
Fixes: QTBUG-93671
Change-Id: Ib3c5e80cbcc9c793d000e5ad637325bcf735a1ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-28 22:15: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
Thiago Macieira
0f6453703c QLoggingRegistry: Disable internal tracking of source file names
Commit d78fb442d7 (5.4) did this for all
regular users of our macros, but obviously missed this manual override.
So apply here too.

Change-Id: I8c6a0ff3ec184205a544fffd16af7734fed2ebd1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-27 12:40:33 -07:00
Thiago Macieira
806545fcc8 QLoggingRegistry: add the ability to have environment variable overrides
Quite a lot of our code in Qt predating QLoggingCategory has manual
environment variable controls. For compatibility with established
documentation and tips-and-tricks out there, we should keep them working
when switching to categorized logging.

Change-Id: I3eb1bd30e0124f89a052fffd16a6c151d3e9d552
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-27 12:40:33 -07:00
Volker Hilsheimer
0c0892a3e2 Fusion: Consistent width calculation and rendering of menu items
The width calculation lacked the addition of the windowItemFrame
constant, which was added in the rendering code. This resulted in
ellision for long items.

To make the code easier to follow, const'ify, rename, and reorder some
local variables, and use constants from QFusionStylePrivate instead of
(now obsolete and removed) constants copied from the Windows style.

Break long lines as a drive-by.

Fixes: QTBUG-94481
Pick-to: 6.2
Change-Id: I6d3e9d0feebee58fc70beaaf29236b8473242083
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-27 20:08:33 +02: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
Alexandru Croitor
5ffc744b79 CMake: Allow disabling package version check
When building Qt repos, all find_package(Qt6) calls request a
PROJECT_VERSION version which is set in .cmake.conf via
QT_REPO_MODULE_VERSION.

This means trying to configure qtsvg from a 6.3 branch using a
6.2 qtbase won't work, because qtsvg will call find_package(Qt6 6.3)
and no such Qt6 package version exists.

There are certain scenarios where it might be useful to try to do
that though.
One of them is doing Qt development while locally mixing branches.
Another is building a 6.4 QtWebEngine against a 6.2 Qt.

Allow to opt out of the version check by configuring each Qt repo
with -DQT_NO_PACKAGE_VERSION_CHECK=TRUE. This setting is not
recorded and will have to be set again when configuring another
repo.

The version check will also be disabled by default when configuring
with the -developer-build feature. This will be recorded and embedded
into each ConfigVersion file.

If the version check is disabled, a warning will be shown mentioning
the incompatible version of a package that was found but that package
will still be accepted.
The warning will show both when building Qt or using Qt in a user
project.
The warnings can be disabled by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE

Furthermore when building a Qt repo, another warning will show when an
incompatible package version is detected, to suggest to the Qt builder
whether they want to use the incompatible version by disabling the
version check.

Note that there are no compatibility promises when using mixed
non-matching versions. Things might not work. These options are only
provided for convenience and their users know what they are doing.

Pick-to: 6.2
Fixes: QTBUG-96458
Change-Id: I1a42e0b2a00b73513d776d89a76102ffd9136422
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-27 16:41:26 +02:00
Joerg Bornemann
9beae46b59 Fix treemodelcompleter example
All nodes in the view were at the top level due to a spurious trimmed()
call.

The condition in the indentation calculation was flipped, leading to a
segfault.  Also, the input data does not contain tabs.  Remove the
condition that checks for tabs altogether.

This amends commit 3fede6cb54.

Fixes: QTBUG-97727
Pick-to: 6.2 5.15
Change-Id: Ic5068ead755c4dae5f0607724ac7704cce03227c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-10-27 16:34:44 +02:00
Øystein Heskestad
dece6f5840 Add missing macOS header file that was indirectly included before
Change-Id: I4d4c7d4f957fc36dea5e06eb6d661aeecf6385f1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-27 16:34:44 +02:00
Joerg Bornemann
51cc8a7267 Fix QDebug operator<< for QMultiMap when Q_CLANG_QDOC is defined
This amends commit 8a8bf1b84e.

Pick-to: 6.2
Change-Id: If863d33d055e0a743606d11859b11c112de105f1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-27 15:00:31 +02:00
Morten Johan Sørvig
2c3cfa0ae7 wasm: remove sse2 config block
This breaks the build for qmake-based applications,
with the error

  Project ERROR: Could not find feature sse2.

Remove the offending section to make applications
build again.

Pick-to: 6.2
Change-Id: I0b22faa1d8d62e208d79879b822e21637bb03a3e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-27 12:00:06 +00:00
David Skoland
aa6405ee03 Adjust behavior of windowIsPopupType and hasTitleBar
The previous implementation did not check for the popup flag, so
it was added, and the tool window exception was preserved.
hasTitleBar was also changed so it checks for popups and not tooltips
specifically (tooltips are always popups).

Change-Id: I3e2ba3be56e992b30ca2a07375092073572e7fcb
Pick-to: 6.2
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-10-27 13:45:08 +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
Pasi Petäjäjärvi
11999a0aaf CI: Enable building autotests for QNX QEMU
Task-number: QTBUG-87628
Pick-to: 6.2
Change-Id: Id88daa2a08491b71d9d113ab02d0ca7806872a0e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Marianne Yrjänä <marianne.yrjana@qt.io>
2021-10-27 10:30:02 +00:00
Pasi Petäjäjärvi
6c22f7e39c CI: Add QNX qemu support
* Script used to parse env variables and run test over ssh on qemu
* Script to start qnx qemu
* Script used to set env variables for ssh so they are correct in qemu
* Add b2qt sdk host toolchain to path for actual qemu binaries

Task-number: QTBUG-87628
Pick-to: 6.2
Change-Id: I951172211c2963654899491568771310a410e616
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2021-10-27 13:30:01 +03:00
Pasi Petäjäjärvi
c91b5dae9a QNX: Generate empty string for WORKING_DIRECTORY test wrapper
Tests for QNX are run in qemu over ssh and setting WORKING_DIRECTORY
will cause created test wrapper to try change specified directory
which will fail (expects local directory) when test is invoked over
ssh.

Task-number: QTBUG-87628
Pick-to: 6.2
Change-Id: If991002398811cc9cb9cbac54da5d2cb0d8c3589
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-27 13:30:01 +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
Lorn Potter
3d89257ce4 wasm: fix window activation
This fixes window activation of dialogs and tooltips

In the case of tooltips, We were activating the window
being removed.
In the case of dialogs, we need to raise the window
before requesting the activation.

Change-Id: Ie989e6d92afedf1895b5e188f0695f6254d70272
Fixes: QTBUG-94918
Pick-to: 5.15 6.2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-27 14:42:41 +10:00
Rami Potinkara
b1820295e1 Revert "Android: Place cursor correctly on screen when editing"
This reverts commit 5c6b10c3ce.
It caused a regression such that the main window no longer resized or
panned when the VKB is shown, in spite of android:windowSoftInputMode
being set.

Pick-to: 6.2 5.15
Task-number: QTBUG-95300
Task-number: QTBUG-96117
Task-number: QTBUG-97503
Change-Id: If56e1113eea69a940f6760bdb2ad06a93a0759c1
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-26 20:46:24 +00: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
e3f05981cb QHash: use the shadow seed
[ChangeLog][Important Behavior Changes] The qHash functions operating on
string-like types and the qHashBits function will now mix in a shadow
seed (not available in any API) if the provided main seed is not 0. This
means the hashing value for any particular input has an almost zero
chance of being equal in two different processes, even if processes of
the same application. This unpredictability makes QHash more strongly
resist denial-of-service attacks through degenerate hashing tables.

Change-Id: Id2983978ad544ff79911fffd167240196f7cd5c8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-26 11:38:56 -07: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
Alexey Edelev
6adaaa7745 Add internal property to store Qt namespace
In some cases it might be useful to use the value of Qt namespace in
CMake files. Currently the value is only stored inside Core target
compile definitions. This adds the internal property _qt_namespace to
the Core target and exports it.

Change-Id: Ic0454f0ce6b8c65b5a186981463d3977169b022e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-26 19:20:47 +02:00
Mårten Nordheim
f670e483c1 QNI: refactor to avoid tiny lambda slot objects
by just adding the parameter to the signal there's no longer a need for
the tiny lambdas that just call a getter.

Originally the idea was that, since the emission from Backend to the
'frontend' may be a queued emission, I wanted to use the getter so that
the data emitted from the frontend was as up-to-date as possible.
But on one hand, that's not really a big problem, and at the same time
it would then emit the signal twice with the same value.

Change-Id: Ief0959f8cbf06faf1b02a1ed4ae777181ff4f059
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-26 18:28:04 +02: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
David Skoland
25e85ec45f Remove unused statements in QWindow
Change-Id: I91f0d23d22923f7c2b8c9099371288d226d541c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-26 13:59:59 +02:00
Topi Reinio
cdf8fd5e86 Doc: Enforce zero warnings for QtCore, QtGui
Change-Id: I7b39f9bf8d7bc9c9c5c21c4bd648a86281162740
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-26 11:54:41 +00:00
Ivan Solovev
5f0e57ebc7 QObjectComputedProperty docs: move example to snippet
This patch amends 89a4c8d40d.
It moves the code sample into a separate snippet file, which allows us
to use Q_OBJECT macro in it without complaints from moc.

Task-number: QTBUG-97656
Pick-to: 6.2
Change-Id: I368d8dd8c00dbbebd8a6bf3788be796c8ca4bce8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-26 10:18:07 +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
David Skoland
0921caf976 wasm: Hide popups when a window is left-clicked
This logic is taken from the macOS platform implementation and seems
reasonable to reuse in WASM.

Fixes: QTBUG-90990
Change-Id: Id4a4dd8d9fdd9de3085bfcd9079793aad3dda363
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-25 22:17:39 +00: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
Joerg Bornemann
e022ff0a8e qmake/vcxproj: Fix "CONFIG += combine" extra compilers
Extra compilers with "CONFIG += combine" were broken for qmake's vcxproj
generator since forever.

Usually, extra compilers are handled by attaching the Custom Build Tool
to the input file.  This is not possible for combine extra compilers,
because they map multiple inputs to one output.  We cannot attach the
Custom Build Tool to the output either, because this would result in
circular dependency errors (output trying to create output itself).

To fix this, we create a custom build tool fake file (.cbt) for the
output and attach the Custom Build Tool there.  This is the same trick
we do for regular extra compilers that have C++ sources as
input (e.g. the one that generates moc_predefs.h).

Pick-to: 6.2 5.15
Fixes: QTBUG-94806
Change-Id: Ib808a43fead737df91b89a1ac5e180aeae37efae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-25 18:10:43 +02:00
Joerg Bornemann
3681369120 qmake: Make some debug code actually compilable
Change-Id: Ia57b0d83ba3bf005d7d19e7958bb7131c7dc50b3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-25 16:37:38 +02:00
Ivan Solovev
89a4c8d40d Make QObjectComputedProperty documentation visible
QObjectComputedProperty belongs to public API. It's even referred in
other documentation (for example, QBindable).
It does not make sense to have its documentation marked as \internal.

Task-number: QTBUG-97656
Pick-to: 6.2
Change-Id: I6ca81292cfafea873dd3577fb0e5ddb583969dc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-25 14:57:18 +02:00
Ivan Solovev
164e575673 Fix -trace build on Windows
The TraceLoggingValue template does not have overloads for Qt
types, so it was throwing multiple template instantiation errors
while trying to log the unknown types.
Fix it by serializing such types to QString using QDebug::toString,
and the logging this string.

Apart from that, fixes some other compiler errors on Windows build
with -trace enabled:
- implicit size_t to ULONG conversion
- complaints on std::min
- add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE to the generated
  *_tracepoints_p.h headers to fix the namespace build.

Task-number: QTBUG-97246
Fixes: QTBUG-97241
Pick-to: 6.2
Change-Id: Ifba134bab8d7fda7f1e30da9938e25cae813e1c6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-25 14:57:18 +02:00