Commit Graph

52026 Commits

Author SHA1 Message Date
Fabian Kosmale
6b36e78352 QBindable: Use setter in setValue for QObjectCompatProperty
Directly writing to the underlying property storage has the potential of
breaking all kinds of internal invariants. As we return QBindable in
the public interface, we should not grant callers access to the
internals of the object.

Pick-to: 6.2 6.1
Change-Id: I737ff293b9d921b7de861da5ae23356c17690b78
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-06-17 19:32:56 +02:00
Alexey Edelev
8aee7c6b29 Fix internal module naming in qmake .pri files
Set the correct value to the _qt_config_module_name property at the
internal module creating step instead of appending _private suffix when
generating .pri files.

Amends 425ff34aa1

Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: I6fa8089358bc638668e313c98c3aee680bf7ec2a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-17 19:32:56 +02:00
Allan Sandfeld Jensen
d3b9759b42 Silence a few warnings from excess semicolons
We dont really need those after functions definitions.

Change-Id: I41f010a223977c55d4b7271ac3ebdc1bb9047b09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
5ec937115b CMake: Export info if an object lib target is a plugin initializer
Needed for qtdeclarative so we can filter out which object library
should go into which export set, because qt_internal_add_qml_module
can create both a backing library export set and a plugin export set.
The plugin initializer object lib should go to the plugin export set.

Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I0fce131eff75a0b3090ac0fbb2a12ecfcba5e38d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
a37957df5c CMake: Add TODO to apply generalized object library linking approach
Pick-to: 6.2
Change-Id: I1ea368e81d8b055ef353a0f021f188b45588c937
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
602d26c38f CMake: Set the plugin class name for qml plugins
This is needed for a change in qtdeclarative to allow building the
Q_IMPORT_PLUGIN-containing object library initializer of a qml plugin.

Show an error if the qml plugin has no class name, it's needed for
plugin initialization so it's mandatory to have a class name.

Show an error if a class name is not found when computing the import
macro for a plugin (both for a regular qt plugin and a qml plugin).

When querying for the class name of a target, query both a Qt6::
prefixed target as well as a non-prefixed one, with the Qt one
taking precedence.
This is to allow querying the class name of user project created qml
plugins.

Currently regular qt user plugins don't use the object library
initializer approach. This will likely be revisited in the future.

Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I46417471a7d8b49651e6821f7b28e7a9d44c2557
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
103c1bc7ba CMake: Don't generate .pri files for qml plugins
We didn't do it in Qt 5 times and it was accidentally done for Qt 6.

There's no reason to generate them, the .pri files are only meant to
be used for regular plugins so a project can do QTPLUGINS += foo.

That mechanism is not needed for qml plugins which use
qmlimportscanner instead.

Furthermore the pri contents didn't contain a class name, so they
couldn't be used anyway.

Pick-to: 6.2
Change-Id: I6299fda21ece0f693a817ab558b45aa46b97e5ee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
15c5f90507 CMake: Remove old add_qt_gui_executable API
Repos should have migrated by now and the function should not be
advertised as a public one.

Pick-to: 6.2
Task-number: QTBUG-88763
Change-Id: Ica5bc55670a17a28c0022f78c126a3a8a8ffdeb5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
51b8c81c84 CMake: Rename qt6_finalize_ios_app to be internal
For now, it's not meant to be called manually. It's called in
qt_add_executable automatically for iOS.

Amends 4d838dae5a

Pick-to: 6.2
Task-number: QTBUG-88763
Change-Id: I90dfcf86f53a3c8e48a813435f7400db232b21f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Andrei Golubev
976cf0152b QList: more explicitly document capacity() shenanigans
Due to capacity() reporting the size of all allocated space, this is
somewhat inconsistent with what QVector::capacity() in Qt5 provided,
due to Q6List being double-ended. So let's document this better

Task-number: QTBUG-92941
Pick-to: 6.2
Change-Id: Iba46389121e721a8d21f0344b154f41c2c245867
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 17:44:52 +02:00
Tim Blechmann
52b2346742 gui: accessible - silence int conversion warning
msvc2019 emits:
warning C4244: 'argument': conversion from 'qsizetype' to 'int',
possible loss of data

Change-Id: I286c0d453f69654ba58f071aee28e557b9f9058d
Pick-to: 6.1 6.2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-06-17 22:55:18 +08:00
Alexander Volkov
d8dbc2b95a QMimeBinaryProvider: cache comments and globPatterns
Avoid multiple re-reads of xml files, for example in dolphin,
which displays MIME type comments as file types.

Change-Id: Ia124930e2a1fdc99d8a4d160f2288a00f55e0e8e
Reviewed-by: David Faure <david.faure@kdab.com>
2021-06-17 17:36:29 +03:00
Allan Sandfeld Jensen
ada29a19cd Fix SSE4.1, RDSEED requirement for clang-cl builds
A misunderstanding seems to have caused several files to be compiled
with extra runtime arch options.

We need to disable multi-target functions though, because it doesn't
work with clang-cl headers.

Task-number: QTBUG-88081
Task-number: QTBUG-88434
Pick-to: 6.2
Change-Id: Ic5829540f9007428c80f9a7bd46af35540745ccd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-17 14:36:29 +00:00
Kai Köhne
c2c15666b7 Porting Guide: Mention that also QSet is affected by stability of references
QSet is internally implemented by a QHash. Therefore the change in
reference stability affects QSet, too.

Pick-to: 6.1 6.2
Change-Id: If1879d5a027211bca0beeff16ffbc77f2f4fce26
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 14:28:46 +02:00
Kai Köhne
b26988d0b5 Porting Guide: Mention deprecation of QLibraryInfo::location
Pick-to: 6.1 6.2
Change-Id: I998a4575ce7fb56ab51d49715071e682a440360b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-17 14:28:45 +02:00
Kai Köhne
3cbe11f934 Porting Guide: Mention changed behavior of QCApplication::quit()
Mention change of behavior introduced by 89f7a2759c in the porting
documentation.

Change-Id: I3c282362f5852cc7768e6655fc7b3901d68f2b10
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-17 14:28:45 +02:00
Kai Köhne
88b92f76ee Doc: Remove mentioning of Qt::MidButton
It's only Qt::MiddleButton in Qt 6.

Pick-to: 6.1 6.2
Change-Id: Ia68bad910c617993e30e3ed1e117192469ec50eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 14:28:45 +02:00
Eirik Aavitsland
e473d96e65 Avoid overflow in text layout
Fixes oss-fuzz issue 34597.

Fixes: QTBUG-94197
Pick-to: 6.2 6.1 5.15
Change-Id: Icabcd5a87b809b6a5ae0f1a696ec3b5dd906886b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-06-17 09:58:27 +00:00
Ulf Hermann
68b855c215 Universally pass QMetaType by value
... and add Qt7 TODOs where we can't because of BC.

Change-Id: Idce8b677ae95231e1690ac4265dc6f06818052e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 11:58:27 +02:00
Giuseppe D'Angelo
c2839843f2 QObject: cleanup the orphaned connection lists on destruction
When a signal/slot connection is broken, it gets added to the
sender's list of "orphaned connections", to clean up later.
This cleanup happens when the sender gets destroyed or as soon as
it emits any signal.

This may cause soft memory leaks in case receivers get destroyed,
and the sender is a long living object and doesn't emit signals
for a while (e.g. QThread).

For some reason, an explicit disconnection cleans up the list
(either by using the QMetaObject::Connection object, or in case
of string-based connect, using a string-based disconnect). This
raises lots of doubts about why having this list in the first
place.

Fix the soft-leak by cleaning up the orphaned connection list when
destroying a receiver.

Note: I still believe that we shouldn't have any "orphaned"
connection list, and rather cleanup on disconnect/deletion
(otherwise, emitting a signal may cause a CPU spike because it
triggers a cleanup).  If we allow for any "impredictability" during
signal activation we're just admitting that signals/slots aren't
suitable for e.g. low-latency codepaths. That's why I'm not marking
the problem as fixed.

Original-patch-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Task-number: QTBUG-88248
Task-number: QTBUG-87774
Pick-to: 6.2 6.1 5.15
Change-Id: Id25f67a45dff49f740132a44d36e88740eb12070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-17 08:56:28 +02:00
Lars Knoll
71b4d4f150 Fix crash in concurrent disconnect
This does not fix all data races that we have in the system yet.
One major issue is the virtual disconnectNotify(), that can be
called from any thread and thus is inherently problematic, as it
can collide with the object getting destroyed at the same time
in another thread.

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-88248
Change-Id: I9d841eb363b7e4f0de1657aeb8f5340d0fd55190
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-17 08:56:22 +02:00
Fabian Kosmale
556fc646cf cleanOrphanedConnectionsImpl: Allow to skip locking
This function is/will be used in a few places where we already have a
lock. Temporarily unlocking and relocking invites all kinds of troubles.
By adding a flag we can instead tell the function that we already hold
the lock.

Pick-to: 6.2 6.1 5.15
Change-Id: Ibca089de61133661d5cd75290f2a55c22c5d013c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-17 08:56:17 +02:00
Fabian Kosmale
7fefce7328 QOrderedMutexLocker: Disable copy and provide explicit dismiss function
Copying a QOrderedMutexLocker is questionable, and would currenly easily
lead to UB. Therefore we delete the copy ctor and copy assignment
operator, and implement well-behaving move operators.
In addition, provide an explicit dismiss method for cases where we don't
want the locker to unlock the mutexes, as they have been manually
unlocked (this could have been implemented previoulsy by using the copy
assignment operator).

Pick-to: 6.2 6.1 5.15
Change-Id: If2a888710e1c74277b28fd3e2939ab26fff0c7ae
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 08:56:13 +02:00
Marc Mutz
259dc8cbe5 QTextStream: fix a dead write
Found by Clazy.

Change-Id: Iabe4fb23f63ea8df2142dc66cd16b04526b628c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 01:33:15 +02:00
Giuseppe D'Angelo
95cb4e2260 QFileInfo: remove a couple of QFlags->int implicit conversions
Change-Id: Iabfca134709852694967d605c6a93f34a9777d8a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 00:53:36 +02:00
Robert Löhning
a7fa9db9b1 fuzzing: Add instructions how to reproduce issues from oss-fuzz
Change-Id: I278516f527990b3c4477436a82695e68b5f6a713
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-16 22:53:36 +00:00
Alexey Edelev
13a4de6bf6 Remove target specific flags from the linker capabilities check
Remove target specific flags from static_link_order.
Move the check to the common config.tests folder.

Amends 5fb99e3860

Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I1368075ec6bd1e743b2b89fd93143df38a278ec2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-16 21:56:09 +02:00
Alexandru Croitor
335123f240 CMake: Don't make example external projects depend on tests
Only depend on the ${project}_src and ${project}_tools targets.

This might exclude some non-obivous target dependencies, but we can
adjust that if needed.

This reduces the build.ninja file of qtbase + qtsvg form 341MB
to 41MB when configuring with tests and examples, as well as reduces
the processing time of calling ninja.

Amends d97fd7af2b

Pick-to: 6.2
Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 20:01:30 +02:00
Alexandru Croitor
906c84a9a3 CMake: Mention resource name on which rcc is run
Pick-to: 6.2
Change-Id: I12189d7bf3fbe8544ae4c3478166515ea2759bec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 20:01:30 +02:00
Alexandru Croitor
9297459900 CMake: Change some custom commands to mention the target name
Pick-to: 6.2
Change-Id: I3a198c87ba2d71306478809095083694b65c7086
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 19:56:46 +02:00
Edward Welbourne
cc64959602 Tidy up tst_QString::localeAwareCompare()
It was suppressed unconditionally (albeit in different places and with
different levels of obviousness) almost everywhere, due to inability
to set the system locale in use by the implementation. Several
test-cases used ISO-8859-1 encoding on Q_OS_MAC, where the tests were
all suppressed anyway. A block of no_NO tests was #if 0'd out; and
should, in any case, have been nb_NO. Tests of any locale but en_US
were skipped on Q_OS_WIN because we can't set the locale (but
including the tests of en_US tacitly assumed that's the system
locale). If setlocale() failed, for ICU or DARWIN, the test was
skipped; but we might as well check for this in the _data() to save
repetition.

The test was laboriously going through the sign cases; relocate the
QString::compare() test's sign() function so that we can use it here,
too, and simply QCOMPARE() signs. Introduce a TransientLocale class,
copied from tst_QLocale, to take care of setting and restoring the
locale using setlocale(). Change the locale name to a QByteArray so
that we save having to convert it to one in order to pass it to
setlocale(). Since that changed every _data() row, reformat those rows
in the process - most of them were long lines.

On the systems where we can't set the locale used by the function
being tested, condition each block of tests in the _data() on whether
LC_COLLATE looks like the locale to be tested, and report how a
determined developer at least can (by repeatedly running the test with
different locales set) test all the cases; and we'll attempt the ones
that we can, when one of the relevant locales is in use. If that
leaves us with no tests we can do, QSKIP() in the _data() to avoid an
assert failure for "Test data requested, but no testdata available."

Change-Id: I75709fda8827dcbe74f80c4136042054da6fcb13
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-16 17:42:37 +02:00
Alexey Edelev
5fb99e3860 Check the impact of static link order for user projects
For user projects we run the static link order check once
'find_package(Qt6 ...)' is called.

If linker can resolve circular dependencies between static libraries
and object files we set the _qt_link_order_matters property of the
Qt::Platform target. This indicates the use of finalizers is not
required and we may rely on CMake-base propagation of resource
libraries and resource object files.

If linker could not resolve circular dependencies depending on
the _qt_resource_objects_finalizer_mode value:
  - Finalizer will be called and collected resource objects will be
    linked to the target directly.
  - Finalizer will be omitted and resource objects will be linked
    using the target_sources function implicitly. This only
    propagates resource one level up if consumer links the static
    library PUBLICly, but all symbols will be resolved correctly
    since object files are placed in the beginning of the linker line.

In the CMake version 3.21 we expect that CMake will take care about
the order of the resource object files in a linker line, it's
expected that all object files are located at the beginning of the
linker line.

TODO: Need to confirm that the CMake 3.21 meets the expectations.

Amends 4e901a2f99

Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: Ia68976df8182d3d3007b90c475c1e3928a305339
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-16 16:58:45 +02:00
Edward Welbourne
1f4b237dad Use year with same day-of-week pattern as fallback for out-of-range
The kludge previously implemented for handling dates outside the
supported time_t range, by asking for a corresponding date in a year
in the range, had a comment remarking that this is broken due to the
wrong day of the week and, consequently, the placement of DST
transitions, e.g. those scheduled by the last Sunday of a month,
happening on different dates in the year asked about and the in-range
year passed to the system time_t functions.

This can be handled by selecting a year in the time_t range which has
the same pattern days of the week (and length of the year, i.e
leap-ness). That may (particularly for leap years) need to select a
year far from the end of the range (and there may be a change to the
zone's rules between the selected year and the end).

Change-Id: Ia353b2cc7b7d266b7abf80e37cac61544ce95c2d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-16 15:53:23 +02:00
Tor Arne Vestbø
9661cde161 Apple: Use POSIX IPC instead of System V in sandboxed applications
System V semaphores are not supported in sandboxed applications,
so when Qt is configured with App Store compliance, or the user
requests POSIX IPC explicitly, we use that instead.

https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24

As the shared memory name limit on Apple platforms is very low,
we have to skip the existing logic for naming, and instead use
a truncated hash of the key. This should still be fine for
avoiding any collisions in practice.

An explicit check for the ENAMETOOLONG error has been added to
catch any cases where they key goes beyond the allowed length.

Sandboxed applications also have an extra requirement that the
key must include an application group identifier. This requirement
has been pushed up to the user and documented, as we don't have
enough information in Qt to know which identifier to use.

Both tst_QSystemSemaphore and tst_QSharedMemory work as before
with both sandboxed and non-sandboxed applications, after removing
some assumptions in tst_QSharedMemory about System V behavior.

Fixes: QTBUG-91130
Change-Id: Iaf1edb36a5d84d69e42ec31471a48d112faa8c6a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-16 15:53:23 +02:00
Tor Arne Vestbø
20f835329a macOS: Detect sandboxed state for command line apps
The documentation says that if we "pass a URL to the main
executable of a bundle, the bundle as a whole is generally
recognized.". By passing the executable instead of the
bundle we include command line applications that don't
have a app bundle folder (but have an embedded Info.plist).

Pick-to: 6.2 6.1 5.15
Change-Id: I3a2f145c1ec6e16607e9c04baf08678d5dea0b81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-16 15:53:23 +02:00
Liang Qi
01ff216c82 tests: update startsystemmove manual test with latest api
Change-Id: Ib9a070f7878fa67b7db1e26c8ebbbb54873cb645
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 15:53:22 +02:00
Liang Qi
50a4b97d31 xcb: fix QWindow::startSystemMove()/Resize() triggered by touch
Abort the system move/resise at XCB_INPUT_TOUCH_END.

Limit the behavior only on supported platforms, such as KDE and
OpenBox.

Change-Id: I53c86979ca56f4de8c5cf2807f781abdad6987b2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-06-16 15:53:22 +02:00
Liang Qi
8e506fdd29 xcb: fix QWindow::startSystemMove()/Resize() triggered by mouse
We can't get mouse release event from master pointers after
QXcbWindow::doStartSystemMoveResize() which calls xcb_ungrab_pointer(),
it looks like most X11 WMs work as that.

So we try to get mouse release event from slave pointers.

Based on https://specifications.freedesktop.org/wm-spec/1.4/ar01s04.html
, we need to send _NET_WM_MOVERESIZE_CANCEL when we get mouse release
event.

Task-number: QTBUG-91077
Change-Id: I01e74a01c87b381ee7cd6f20d51a1fa61c0e98fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 15:53:22 +02:00
Joerg Bornemann
3ca5b46e5d Expose the "debug" build feature privately
Consumers can now check the "debug" feature to determine whether Qt was
built in the "Debug" configuration.

Pick-to: 6.2 6.1
Change-Id: I225125d38ded508e9792a730ce421b33bceacddf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-16 14:07:09 +02:00
Marc Mutz
9648ffff7e QLoggingSettingsParser: port setContent() to QStringView
Amends 16f927a4f1.

At the time the original change was written, QStringTokenizer
had not been integrated, yet.

Change-Id: I83c31d816199bc48c4baea855d13cbf9eda9aaa2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-16 13:22:18 +02:00
Volker Hilsheimer
6ce44c53c7 Windows: Read page size and orientation from setup dialog
PAGESETUPDLG's hDevMode reports the page size and orientation selection
of the user, so read that data to get accurate results.

Otherwise, the page size of a landscape page wouldn't match any known
page format, and we'd end up with a custom size that would not be valid
for the preview, breaking the preview UI's orientation state.

Reuse the helper from QPageSize to map Windows page size ID to our own
enum.

Fixes: QTBUG-93764
Pick-to: 6.2 6.1 5.15
Change-Id: Ib9a848619e3ba8780264ad76ed43c4fffae6b07f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-06-16 13:22:18 +02:00
Andy Shaw
dc1efcfc93 Add a style hint to draw the left/top border lines when header is hidden
Since there is no header then the cells appear with no actual border so
it can look a bit strange without it. This ensures that the border is
at least shown when there is no header to represent it if the style hint
is turned on. This gives an option for those who want it to have it
turned on.

Fixes: QTBUG-85523
Change-Id: Ib94874bddddd31738fbcd41c6f77a2e0fa2ef443
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-16 13:22:17 +02:00
Alexandru Croitor
7f0f44f014 CMake: Promote all targets to global within a scope when possible
CMake 3.21 introduced a new IMPORTED_TARGETS directory property which
we can use to promote all imported targets within a scope to be
global.

This would cover transitive non-Qt imported targets which the Qt build
system does not know about and is thus a more complete solution
compared to promoting only Qt targets.

Run a finalizer at the end of the directory scope where
find_package(Qt6) is called to promote all imported targets within
that scope to global (when requested).

The old promotion method is disabled when the CMake version is new
enough.

Pick-to: 6.2
Task-number: QTBUG-92878
Task-number: QTBUG-94528
Change-Id: I533a3bd4186eba652f878ddd72c76118c2fd8bae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 13:22:17 +02:00
Alexandru Croitor
561fc8107f CMake: Allow promoting the Qt libraries to be global targets
User projects can set the QT_PROMOTE_TO_GLOBAL_TARGETS variable to
true so that the various imported targets created by find_package(Qt6)
are promoted to global targets.

This would allow a project to find Qt packages in a subdirectory scope
while using those Qt targets from a different scope.

E.g. it fixes errors like

  CMake Error at CMakeLists.txt:5 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:Qt6::Widgets_resources_1>

  Objects of target "Qt6::Widgets_resources_1" referenced but no such
  target exists.

when trying to use a static Qt from a sibling scope.

Various 3rd party dependency targets (like Atomic or ZLIB) are not
made global due to limitations in CMake, but as long as those targets
are not mentioned directly, it shouldn't cause issues.

The targets are made global in the generated
QtFooAdditionalTargetInfo.cmake file.

To ensure that resource object libraries promoted, the generation
of the file has to be done at the end of the defining scope
where qt_internal_export_additional_targets_file is called,
which is achieved with a deferred finalizer.

Replaced all occurrences of target promotion with a helper function
which allows tracing of all promoted targets by specifying
--log-level=debug to CMake.

Pick-to: 6.2
Fixes: QTBUG-92878
Change-Id: Ic4ec03b0bc383d7e591a58c520c3974fbea746d2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 13:22:17 +02:00
Richard Moe Gustavsen
d829d54a42 iOS: cleanup connection when a screen disconnects
The iOS port creates one QIOSViewController per connected
screen. And each view controller listens for changes to
the application state. The problem is that we never
disconnect this connection again. So if a screen is removed, and
the corresponing view controller is deallocated, the
connection is still kept alive. This will cause crashes to
occur when the signal emits, since the slot will then be accessing
deleted memory.

Fixes: QTBUG-76948
Pick-to: 6.2 6.1 5.15
Change-Id: I758e51af9297cd62de193aae825f4475a2c7c3e5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 13:22:17 +02:00
Allan Sandfeld Jensen
ec675f5dc7 Improve tst_QColorSpace::imageConversion64PM test
Makes it able to catch the last bug of saturating color values above a
certain value.

Change-Id: Ib2a3918623a1defe2981efe61cf8118e019e9d4b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-06-16 12:23:41 +02:00
Jani Heikkinen
046d819e2e Revert "Remove old Android code that have now has alternative public APIs"
This reverts commit 03eb44394e.

Reason for revert: This breaks the dependecy update round in dev now. The revert can be reverted again after
1) Full dependency round is succeed in 'dev'
2) Android extras submodule has been removed from qt5.git#dev (7aa41d22fa485f212aebbef500ea91921c7bc38b)
3)qtmultimedia has been ported to use new api instead of this old one
4) Full dependency round with all above is succeed in 'dev'

Change-Id: I23241d2a90307074ecfc9573d2b58baba1874cfc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-16 09:59:49 +00:00
Shawn Rutledge
bc30d5624d Fix rendering of text checkboxes when text is selected
Fixes: QTBUG-94532
Pick-to: 5.15 6.1 6.2
Change-Id: I4343558dcec6149dcdcc0f7ca32c49fdc67452af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-16 09:25:15 +00:00
Kimmo Ollila
56ed35bd02 Add missing qHash overload for INTEGRITY
Fixes build issue "no instance of overloaded function "qHash" matches
the argument list" on INTEGRITY

Pick-to: 6.2
Change-Id: Ia1273587840d55199846dc64d487d194f9a4d565
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-06-16 09:09:01 +03:00
Kai Köhne
1591a95987 md4c: Fix MSVC compiler level 3 warnings
Fix various C4244 warnings with the MSVC compiler for 64 bit

Proposed upstream fix:
 https://github.com/mity/md4c/pull/162 for an upstream fix,

Pick-to: 6.1 6.2
Change-Id: I2ac1c17febb4fb269ac7244458f4cd90ce8b8e49
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-06-15 22:21:38 +00:00