Commit Graph

55372 Commits

Author SHA1 Message Date
Yuhang Zhao
7261c81152 Windows QPA: fix window style correction for context help button
According to Microsoft Docs [1][2], WS_MINIMIZEBOX and WS_MAXIMIZEBOX
must be accompanied by the WS_SYSMENU style, and the WS_EX_CONTEXTHELP
style is not compatible with WS_MINIMIZEBOX and WS_MAXIMIZEBOX. This
patch adds additional checks for these situations.

[1] https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
[2] https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles

Pick-to: 6.3 6.2
Change-Id: If32f8b42e25cfc67ffd1e84cc4b061f21a01042a
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2022-03-01 12:29:36 +08:00
Yuhang Zhao
770ea68588 Windows QPA: Use less magic number
The correct calculation of the invisible frame margin and the window
border width (they are the same thing actually) is the thickness
of the size frame plus the thickness of the padded border. When
DPI is 96, both of them is 4px and thus the invisible frame margin
and window border width is 8px. So previously the empirical
magic number can work normally is because the error is very small.
It's not a big thing because even on a high DPI screen the error
is still very small. For example, on my 4K monitor with 200%
scaling, the error is only 2px, human eyes almost can't find the
visual difference. But since we now know how to calculate these
values correctly, let's use the correct calculation instead. The
magic numbers and empirical expressions just make people confused.

Pick-to: 6.3 6.2
Change-Id: Ieda4796231935f2ad1b6f28e4aa4af5b5bce2256
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2022-03-01 09:11:51 +08:00
Giuseppe D'Angelo
9c947c131d QLabel: remove some dynamic allocations
QLabelPrivate uses pointers and dynamically allocated objects as a form
of optional. To add insult to injury, the objects are implictly shared,
compounding the effects in terms of required allocations.

Just use std::optional instead.

Change-Id: Ica582dc0d2a9ab56f45ce305290541383b7ddeef
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-01 01:55:08 +01:00
Iikka Eklund
bec3c2a335 Conan: Include Android specific option values in 'package_id'
The Android specific option values need to be included in the
'package_id' to avoid mixing Android binaries built with
different Android sdk, ndk, abis etc.

The 'android_ndk' path can not be used as the option value as such
because this is a local file system path that may be different
on each system. This would make the pre-built binaries unusable
as the value is part of the 'package_id' checksum.

Instead, parse the 'Pkg.Revision' from the 'source.properties'
file pointed by the original 'android_ndk' option value and
use this as the 'android_ndk' option value for the 'package_id'.

The 'QT_ANDROID_API_VERSION' can be used for 'android_sdk' value
for package_id if passed as cmake argument. If not then
currently we need to remove the 'android_sdk' from package_id
calculation as we don't have clear means to query that from
the build system. This should hopefully be fixed in future
releases.

Pick-to: 6.2 6.3
Task-number: QTQAINFRA-4646
Change-Id: I679fbdcf92a1d93e00685215bb011948f1aba71f
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-03-01 00:01:04 +00:00
Liang Qi
404c5dc49f xcb: free a randr monitors pointer after usage
This amends 9a4c98e556.

Pick-to: 6.3
Fixes: QTBUG-101302
Change-Id: Ia7a2f82550843a90a5e101788e3835bf3332f697
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-28 23:44:15 +01:00
Marc Mutz
e1b8257dee tst_qflags: compile with QT_TYPESAFE_FLAGS
In constExpr(), where code incorrectly assumed conversions to int or
uint were implicit, make them explicit.

In classEnum(), don't test bitwise operators between QFlags and
int/uint when QT_TYPESAFE_FLAGS is in effect.

Pick-to: 6.3
Fixes: QTBUG-101294
Change-Id: If119bf56dd12778f7231a9e76293c76e75354809
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-28 22:09:31 +00:00
Marc Mutz
6f50e54138 QFlags: fix missing bitwise xor operators in QT_TYPESAFE_FLAGS builds
Add tests that cover them.

Pick-to: 6.3
Fixes: QTBUG-101300
Change-Id: I5a8af4a91d796cc4d287b813bd5cc13da3d7e766
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-28 23:09:31 +01:00
Andreas Buhr
324887779d Activate tst_qmenu for Android
tst_qmenu was disabled because it crashed.
It does not any more.

Task-number: QTBUG-87671
Task-number: QTBUG-87424
Pick-to: 6.2 6.3
Change-Id: I1a3a1d2861b5a8f20d83fd8ba38fdcb3c88faee9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-28 23:08:21 +01:00
Andreas Buhr
a1b90caad5 Activate tst_qfiledialog for Android
tst_qfiledialog was disabled because it crashed. It does not any more.

Task-number: QTBUG-87671
Task-number: QTBUG-101194
Pick-to: 6.2 6.3
Change-Id: Icfda2cd01677f3a076b74429fcf66a1de79d2aa9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-28 23:08:21 +01:00
Alexandru Croitor
8b5648743e CMake: Clean up docs of deployment variables for 6.3
Clarified the docs that using the deployment variables is for avoiding
hard-coding of specific paths.
Added docs on how to customize the variable defaults
Added example doc snippet demonstrating how to modify the values.
Added upstream doc links where relevant.

Pick-to: 6.3
Fixes: QTBUG-100924
Change-Id: I938dcadd776c8b7019da4709dfced166454a6c92
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-02-28 23:08:21 +01:00
Pasi Petäjäjärvi
d0d1d74033 Fix check for IPV6 support without certain features
Without features getifaddrs and ipv6ifname we cannot
get correct IPV6 information for interfaces.

Pick-to: 6.2 6.3
Change-Id: I7f8c4e68d345160d218fde8db640440f3324014e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-28 22:08:21 +00:00
Ivan Solovev
e37919b758 Android: fix tst_QFrame::testPainting
When we create a QPixmap using QWidget::grab(), a default system
image format is used for that.
On Android this format is ARGB32_Premultiplied, while on the desktop
systems it is RGB32.
The images that are saved in the resources and used as references, also
have the RGB32 format.
As a result, on Android we need to convert the pixmap to a proper format
before comparing it to the reference.

Fixes: QTBUG-69064
Pick-to: 6.3 6.2
Change-Id: I2d881e508d34e0b1a2a1a7bffcbc71ae2907d31d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-02-28 23:08:20 +01:00
Alexandru Croitor
34a4fe0166 CMake: Rename FindZSTD to FindWrapZSTD
And the target ZSTD::ZSTD to WrapZSTD::WrapZSTD.
This should allow building Qt with the
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON set.

Pick-to: 6.2 6.3
Fixes: QTBUG-100537
Change-Id: I748601e4ad6f518323bf1034d6fc1de582c815e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-28 23:08:20 +01:00
Alexandru Croitor
0ada264dda CMake: Clean up qt_deploy_runtime_dependencies for 6.3
Ensure both versioned and versionless functions
are available.

Use the versioned function in the implementation of
qt6_generate_deploy_app_script.

Move the low-level warning to the top of the documentation page,
after the TP message.

Clarify documentation of the EXECUTABLE and
ADDITIONAL_ options, that they take relative paths and can use
generator expressions, but can't reference raw target names.

Adjust documentation snippet to cover mac / windows cases.
This mostly coincides with the internal implementation of
qt_generate_deploy_app_script.
Also adjust it to show case more options, like installation of a
helper app and its dependencies.

Output the working directory when executing the deploy tool.

Remove the MACOS_BUNDLE option, it serves no good purpose at the
moment, we already detect bundles by checking if the dir name has
an '.app' suffix.

Pick-to: 6.3
Fixes: QTBUG-100923
Change-Id: If7e5d65ce920eb69fd45f004aa4c5bad800c7ba9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 23:08:20 +01:00
Alexey Edelev
6ee4f4233d Do not use PUBLIC linking with plugins and tests
Change-Id: Idf182bbed68e2da27387d4fd4e3b0737aaa5049c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-28 23:08:20 +01:00
CI Insignificant Platforms Monitor Bot
d3a297c0ab Blacklist: test cases blacklisted in tst_QXmlStream:
- initTestCase on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101332
Change-Id: Ie7c561f4c92ec08c1562becefc928c34bc0eed67
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-02-28 14:50:28 +00:00
Joerg Bornemann
268767e9a1 pro2cmake: Update README.md
Mention that flake8 and black can be run via Makefile targets.

Remove the outdated list of flake8 warnings.  The Makefile ignores more
warnings/errors, and it doesn't seem to be useful to duplicate this list
here.

Also remove the description of the black tool's arguments for the same
reason.

Change-Id: I941c3ab68b7a3d2477f7fbb5d28603987d0b2cab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:41:22 +01:00
Joerg Bornemann
dece6f17e6 pro2cmake: Set a project version for examples
For example projects, change the generated project() call to
   project(foo VERSION 1.0 LANGUAGES CXX)

Some CMake API derives default values from the project version, and it's
generally advisable to set a project version number.

The version number is read from qmake's VERSION variable.  That's
actually a target version number, but it might be the right thing in
most cases.  Fall back to version 1.0 if VERSION is not set.

Task-number: QTBUG-96799
Change-Id: Ia0c551cf62621eb217e1dd541dcbd8945f78138e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:41:18 +01:00
Alexandru Croitor
2389aaf8c7 pro2cmake: Handle qmake condition operator precedence
Unfortunately qmake does not have operator precedence in conditions,
and each sub-expression is simply evaluated left to right.

So c1|c2:c3 is evaluated as (c1|c2):c3 and not c1|(c2:c3). To handle
that in pro2cmake, wrap each condition sub-expression in parentheses.

It's ugly, but there doesn't seem to be another way of handling it,
because SymPy uses Python operator precedence for condition operators,
and it's not possible to change the precendece.

Fixes: QTBUG-78929
Change-Id: I6ab767c4243e3f2d0fea1c36cd004409faba3a53
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:41:11 +01:00
Joerg Bornemann
6708fad936 pro2cmake: Fix test_realworld_comment_scope
Change the expected value from None to [], because that's the value of
the if branch.  It has been like that since v6.0.0 at least.

Change-Id: Iefdb22a772fc5540ad5a38566be5a7f529e00cb1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:40:43 +01:00
Joerg Bornemann
7b8913b1ba pro2cmake: Remove superfluous call to _simplify_flavors_in_condition
If the flavors argument is an empty list, this function becomes the
identity function.

Change-Id: I534df079578ff27d24ae15760ea12464e3961f93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:40:39 +01:00
Joerg Bornemann
e33c88a36d pro2cmake: Fix test_scope_handling.py
When the android-embedded scope was removed in
7a4b586f4b, the conditions in
test_scope_handling.py were adjusted following the laws of logic.
However, the scope handling code does not follow the same laws.

Effectively revert the part of said commit in test_scope_handling.py but
use "UNKNOWN_PLATFORM" instead of "ANDROID_EMBEDDED".

Change-Id: Ic090451e2a28b50f5be5668503e216cbe3871633
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:40:36 +01:00
Joerg Bornemann
8a6899239a pro2cmake: Re-format sources with black
...to have a consistent baseline for further improvements.

Change-Id: Iba8e83a7a5cf5ca0cdf509f79e7d2dc2d8f42fec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 15:40:32 +01:00
Andreas Eliasson
354e4e867a Doc: Add \include snippets with optional parameters
There are many different wordings for how to use the module across the
module landing pages. The goal here is to provide consistent wording
and code formatting, which can be used across all landing pages.
The style and wording is based on what has been implemented in the
Qt CoAP module landing page.

This is the syntax in a qdoc file:
\include {module-use.qdoc} {<snippet-id>} {<argument1>}
Inside qdocinc, you can then get the value of the argument1 using the
parameter \1.

Task-number: QTBUG-100369
Change-Id: Ib25e509e119008157e69db629eb011e5a9074022
Pick-to: 6.3
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-02-28 12:39:55 +01:00
Friedemann Kleint
95603e09c9 Fix assert showing default-constructed QPrintPreviewDialog
Fix call to qBound(), avoiding an assert introduced
by ad5c5bb541.

Pick-to: 6.3
Fixes: QTBUG-101297
Change-Id: I823cdfcd2491c6bb4c87058318479d188ca38742
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-28 12:39:54 +01:00
Martin Reboredo
5b07f14a4f CMake build: generate pkgconfig for public modules
After the update to the CMake based build system the ability to
generate pkgconfig files, like it was with QMake, was lost.

This patch adds pkgconfig generation again via a new internal command
named qt_internal_export_pkg_config_file.

The functionality of this command consists in checking if the target
is internal. Then gets the compile definitions. It performs a search
for dependencies that is somewhat similar to
qt_get_direct_module_dependencies, although it won't recurse down for
more deps. Each dependency is then again, checked if it's internal or
has a public interface. Later these deps get deduplicated and lastly
a pkgconfig file is filled.

The resulting pkgconfig files of many of the Qt6 packages were
validated via invocations of `pkg-config --validate` and
`pkg-config --simulate` commands and later used to build local
projects plus tests that use the pkg-config provided details at
compilation time.

Although it has some limitations, with qt_internal_add_qml_module if
it specifies non-public deps these won't be listed and with non-Qt
requirements, notably in static builds, not being appended to the
PkgConfig file.

Task-number: QTBUG-86080
Change-Id: I0690bb3ca729eec328500f227261db9b7e7628f6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-28 08:39:54 -03:00
David Faure
74a4d88e9a QAbstractItemModel: fix persistent index corruption when moving columns
QHeaderView creates persistent indexes in
_q_sectionsAboutToBeChanged(), called by the slot connected to
rowsAboutToBeMoved/columnsAboutToBeMoved.

In the case of rows, QAbstractItemModel emits the signal *before*
preparing to update persistent indexes in itemsAboutToBeMoved(),
so it can see the ones newly created by QHeaderView, all is well.

In the case of columns, the emit was done *after* calling
itemsAboutToBeMoved(), so the additional persistent indexes created by
QHeaderView were ignored, and in endMoveRows() we could end up with:
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex: "persistent model indexes corrupted"

This bug has been there since the very beginning of beginMoveColumns(),
but was undetected because moving columns in a model is pretty rare
(in my case there's a QTransposeProxyModel that turns columns into
rows in the underlying model, and a proxy that handles dropMimeData...)

Pick-to: 6.3 6.2 5.15
Change-Id: I74bad137594019a04c2a19c2abb351ff3065c25a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-02-28 09:43:37 +01:00
Timur Pocheptsov
af05f278ed QMacStyle: fix tool buttons (in checked mode)
While switching to the 'momentary push in' button type, the old code that
shows button as pressed/checked was removed. Since 'square' buttons
were sharing this part with rounded push buttons, the change broke
checked square buttons. So we retain the old code for this particular
case.

Also, add a minimal baseline test for this scenario: square button,
triggering 'toolbutton' style with/out 'checked' state.

Fixes: QTBUG-100802
Pick-to: 6.3 6.2
Change-Id: Ib7b15b13ead834c7bb2cd36de76ccd5bedb07810
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-28 08:46:21 +01:00
Pasi Petäjäjärvi
81c6f224c4 Fix test when accessing patched plugin too fast
At least one OS (QNX) can't dlopen() a library that is still
open for writing elsewhere

Pick-to: 6.2 6.3
Fixes: QTBUG-101020
Change-Id: I84ca709a65fc824ec4b3e3f1ea03704bf1cc0414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-25 14:52:34 +02:00
Ivan Solovev
3b82c2d167 Fix tst_qaccessibility on Android
On Android we had 10 failing unit-tests in tst_qaccessibility

One of them was failing because on Android QMdiSubWindow is created
maximized by default, so we need to explicitly call showNormal() on
it before doing all the checks.

Other 9 were failing because we didn't get A11Y events when expected.
This is a bit more tricky.
On Android a11y state is not explicitly set by calling
QPlatformAccessibility::setActive(), there is another flag that is
controller from the Java side. It is set to 'true' only when some
of the a11y services are enabled on the device. The state of this
flag is queried during event processing, so a11y state can be reset
to false while we do QTest::qWait().
This logic is absolutely correct for real applications, but it is
a problem for the test case, because we can't easily enable a11y
services in the CI.
To overcome the issue in unit-tests, re-enable a11y before each test.
A more precise fix will require re-enabling it after every qWait() or
processEvents() call, but the current tests pass with such condition.

Fixes: QTBUG-87674
Pick-to: 6.3 6.2
Change-Id: I6f765bc6d3aaeaa19aba3a64473ea25e9cbdb0f8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-25 13:52:33 +01:00
Marc Mutz
5a39173c34 Don't allocate in qt_asciiToDouble()
The sscanf implementation ensured NUL-termination of the input data,
by copying it, and appending NUL.

Since this function is ignoring trailing garbage and reports the
progress back, we could be parsing the first double in a multi-MiB
buffer. And we'd been copying and copying the buffer for every double
scanned. This is clearly not acceptable.

An alternative is to use the max-field-width feature of scanf. By
giving the size of the input data as the maximum field width in the
format string, we stop sscanf from reading more than the available
data.

This code should let everyone's alarm bells go off: a format string
constructed at run-time is really the last thing one should consider,
but I haven't found a way to pass the field width as an argument, so
bite the bullet and go through with it. Copying potentially MiBs of
data is the worse of the two evils.

Pick-to: 6.3
Fixes: QTBUG-101178
Change-Id: Ibaf8142f6b3dab4d5e3631c3cc8cc6699bceb320
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-25 08:08:21 +00:00
Yuhang Zhao
64d65a645c Windows QPA: Highlight the first entry in the system menu
This is what native Win32 applications usually do.

Pick-to: 6.3 6.2
Change-Id: I19f1170113b4064f1d683dbd13b7de7d263105f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2022-02-25 12:43:16 +08:00
Yuhang Zhao
56fa390d72 Windows QPA: More debug enhancements
Pick-to: 6.3
Change-Id: Ibf03fa82f14cf704267b85348ce11ee2d505ff24
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-25 09:30:35 +08:00
Pasi Petäjäjärvi
93a3d09840 Fix compiler warnings about unused parameters
When FEATUREs getiffaddrs and ipv6ifname are not enabled variables are
unused.

Pick-to: 5.15 6.2 6.3
Change-Id: I0fde7ef3a4ee1e89927e2c5550ac24fba76ba155
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-25 01:45:53 +02:00
Thiago Macieira
a072de78dd QTextFormat: remove unnecessary namespace-scope stream op declarations
These two pairs already exist as hidden friends inside the two classes.

Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d4a3bc633e6d53
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-02-24 15:45:53 -08:00
Thiago Macieira
c9f6678fb4 tst_qstring: properly fix the build when LC_MEASUREMENTS is not defined
Instead of proxy-testing for the OS, test for the thing you're going to
use. Fixes the build on FreeBSD.

Pick-to: 6.3
Change-Id: Ibf4acec0f166495998f7fffd16d693df09871492
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-24 15:45:53 -08:00
Andreas Buhr
c57e2b5d51 Fix tst_qformlayout::wrapping on Android
The content of the window was intended to trigger wrapping.
On Android, the window is larger, so more content is
necessary. This patch adds more content.

Fixes: QTBUG-87401
Pick-to: 6.2 6.3
Change-Id: I33a2fe4560c358f2b0b83523ee4ab26bb5dd2513
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-24 23:41:14 +01:00
Giuseppe D'Angelo
b20cf7feee QLabel::setPixmap(): remove the no-op self-masking
When calling QLabel::setPixmap() with a 1bpp pixmap (i.e. a bitmap), and
that pixmap didn't have a mask set, QLabel would then set the pixmap as
its own mask.

This seems to be a no-op due to how QPixmap::setMask is coded:

  void QPixmap::setMask(const QBitmap &mask) {

    // ...

    if (static_cast<const QPixmap &>(mask).data == data) // trying to selfmask
      return;

  }

Moreover, in order to convert the pixmap to a QBitmap, the code would just
straight downcast it, triggering UB (if the input to setPixmap wasn't a
QBitmap to begin with).

I *guess* this was done this way to avoid a QBitmap::fromPixmap call,
which however is not expensive at all if the pixmap is already 1bpp,
which QLabel::setPixmap checks explicitly (before attempting to mask the
pixmap). I don't know the historical reasons for the code to have the
shape it had (and the code history is from before open governance).

So get two birds with one stone: remove the no-op and also the UB.

Change-Id: Ibab20492c2945bd1d01f98a18b168fabc56292b0
Pick-to: 6.3 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-24 22:41:59 +01:00
Thiago Macieira
96a025c28b QRandomGenerator: find getentropy() on macOS
It's in <sys/random.h>. The header exists on Linux and on FreeBSD and
declares getrandom(), which we don't use, so it's harmless.

Pick-to: 6.3
Change-Id: Ibf4acec0f166495998f7fffd16d69005ab59df3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-02-24 12:29:43 -08:00
Thiago Macieira
d581778251 qedidvendortable.py: include something before using macros
Since it's a private header, qglobal_p.h makes sense.

Change-Id: Ibf4acec0f166495998f7fffd16d5d8a38ee8f1f8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-02-24 12:07:00 -08:00
Thiago Macieira
75e0d1b5c1 Make sure all qtbase private headers include at least one other
See script in qtbase/util/includeprivate for the rules.

Since these files are being touched anyway, I also ran the
updatecopyright.pl script too.

Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-24 12:07:00 -08:00
Eirik Aavitsland
51ff94ec92 Avoid using deprecated API in the icons example
Fixes compilation warning.

Fixes: QTBUG-100155
Change-Id: I1af2e69c070497509645c933df58fd42277cfb18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-02-24 20:17:41 +01:00
Volker Hilsheimer
4cca8ee527 QGuiApplication: use translation-based layout direction unless explicitly set
The stored layout direction used to get changed during initialization
to what was auto-detected based on the translation. Changing the
translation then overwrote that stored value, even if an explicit call
to setLayoutDirection was made by the application.

Calling QGuiApplication::setLayoutDirection(Auto) has so far been a
no-op.

Change this logic so that the stored layout direction continues to be
LayoutDirectionAuto also if it's set based on auto-detection, and only
overwrite it when explicitly called with a non-Auto value. This way,
applications can set a layout direction that stays unchanged even when
translators are installed.

Add test coverage that uses a QTranslator.

In practice, this is not a change of behavior, unless applications called
setLayoutDirection(Auto) (which is no longer a no-op), or called
setLayoutDirection() and then installed a translator and expected the
translator's layout direction to come into effect in spite of the explicit
setting.

[ChangeLog][Gui][QGuiApplication] Calling setLayoutDirection with a non-
auto value now disables the auto-detection based on installed
translators. Applications that explicitly set a layout direction and also
want translators installed afterwards to take effect should reset the
layout direction to Auto, which is now no longer a no-op.

Fixes: QTBUG-100632
Pick-to: 6.3
Change-Id: I1fdcebd43a9b1b468ff95bf15f53f441bb214e08
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-02-24 19:46:01 +01:00
Alexandru Croitor
32b596b7b1 configure: CMake: Add -no-prefix option
Introduce a new -no-prefix option that can be used to build Qt without
having to install it.

Currently, -no-prefix is already implied by -developer-build, but
-developer-build also implies -warnings-are-errors and
-feature-private-tests, which not everyone might want to use.

Some Qt builders likely use -developer-build for the no-prefix
behavior, hence we introduce a standalone -no-prefix option to offer
a nicer user experience without -Werror and friends.

Previously it was possible to achieve the same by specifying
-prefix $PWD, but that relies on $PWD expanding property in the used
shell.

The new -no-prefix doesn't depend on the type of the shell and
is shorter to type.

Internally this gets passed by configure as -DINPUT_no_prefix=yes to
CMake, and transformed into a -DQT_FEATURE_no_prefix=ON feature.

The feature also gets automatically auto-detected to ON if
developer-build is set, -prefix is either unset or $PWD.

CMake code should still query QT_WILL_INSTALL to decide whether
files need to be installed or not.

As a drive-by, we now also export QT_FEATURE_developer_build to
be available for querying during configuration of other repos
(previously it was only possible to query FEATURE_developer_build).

Pick-to: 6.2 6.3
Change-Id: Iaa6c8d8ae2b736282e9949d2a5d7f412e290a253
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-02-24 19:46:01 +01:00
Ievgenii Meshcheriakov
7a58ca2d3a Remove util/publicSuffix
This program was replaced by psl-make-dafsa.

Task-number: QTBUG-95889
Change-Id: If52d92734ad362364c6250473281886e1ea5545d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 19:36:26 +01:00
Ievgenii Meshcheriakov
cba40055b1 Network: Use public suffix database in DAFSA format
This saves 91kiB of text size and makes it easier to use
a locally installed database when available.

[ChangeLog][Third-Party Code] Moved attribution of
The Public Suffix List from Qt Core to Qt Network.

[ChangeLog][Third-Party Code] Added attribution of new libpsl
library to Qt Network. libpsl is available under
the BSD 3-Clause "New" or "Revised" License.

Task-number: QTBUG-95889
Change-Id: Ibd37c7a94fdf235e75d96fec20d427fb5c2bd2a4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 19:36:26 +01:00
Ievgenii Meshcheriakov
d0b22762be tst_qnetworkcookiejar: Remove tests that rely on public suffix database format
This format will be changed by the next commit. Also it is an
implimentation detail that can be changed at any time.

Task-number: QTBUG-95889
Change-Id: I00b1133078f1035e03e2cd6fae28192de54d2154
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 19:36:26 +01:00
Kai Köhne
1058f053e5 MSVC: Raise minimum version of Visual Studio 2019 to 16.7
The compile-time check for /permissive- only works from Visual Studio
16.7 onwards. Older compiler versions will fail the check, even if
/permissive- is passed.

Let's rather bail out with a more explicit error in this case.

[ChangeLog][Windows] The minimum MSVC version was raised to
Visual Studio 2019 version 16.7 (VC++ version 14.27). Trying to use
an older version will now result in a compile time error.

Pick-to: 6.3
Task-number: QTBUG-101049
Change-Id: Ibfa2930e1186eb63d8fed69efe161a9d79ccb1be
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-02-24 19:36:25 +01:00
Giuseppe D'Angelo
2b6daa610e QColorDialog: code tidies
Combine two flag-like enumerations using a bitwise OR, not a plus.
Cleanup for the follow-up commits.

Change-Id: Iceb05bf5ea0635d623ba9a7d145606e80b7f21f3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-24 19:36:25 +01:00
Volker Hilsheimer
a74cdf778c Implement QFormLayout::set/isRowVisible
Hiding a row in a form layout is inconvenient to do as access to the
widgets in each row is cumbersome. In addition, a row might include a
layout for the label or the field column, and we can't hide layouts and
instead need to navigate to the widgets inside the layout. And even if
an application developer does all that, the spacing calculation doesn't
ignore hidden rows.

Add setRowVisible and isRowVisible APIs with the usual overloads.
Implement the logic to traverse a layout item to its contained widgets,
so that they are explicitly hidden when a row is hidden, and skip hidden
rows in the spacing calculation.

[ChangeLog][Widgets][QFormLayout] New APIs setRowVisible and isRowVisible
to hide and show rows in a form layout.

Fixes: QTBUG-6864
Change-Id: I6af98409802f331c4523e91d7dac8a97762c579d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-24 17:07:43 +01:00