Backstory.
The main reason why we keep getting "unable to promote 3rd party 'X'
target to global scope" errors when building Qt repositories, is
because we try to promote 3rd party imported targets in a different
scope than where the imported targets were created.
What were the main motivations for promoting 3rd party targets to
global?
1) imported targets are by default local to the directory scope they
were created in
2) we want 3rd party targets to be accessible across subdirectory
scopes, but looked up once, e.g. qt_find_package(JPEG) looked up in
src/gui/CMakeLists.txt, but the target should also be usable in the
sibling scope
src/plugins/imageformats/CMakeLists.txt
Having the package lookup close to the consuming qt module is easier
to maintain, because all the other 3rd party dependency lookups are
in the same file. This goes against the conventional CMake advice
where each subdirectory should look for its own dependencies, or the
dependency should be available directly in the root project scope.
3) to make the 3rd party targets available in the root project scope
as part of the following flow:
QtPostProcess.cmake ->
qt_internal_create_module_depends_file() ->
qt_collect_third_party_deps() ->
get_property(INTERFACE_QT_PACKAGE_NAME) ->
write 3rd party Dependencies.cmake file for each qt module.
Properties can only be queried from an imported target if it's in
the same scope or was promoted to global, otherwise you get
'non-existent target' errors.
4) for prl and pri file generation, where we need the targets to be
available during generator expression evaluation within the
relevant qt module directory scope
Here is a list of approaches I came up with on how to improve the
situation.
1) Make all imported targets global during the Qt build, by iterating
over the directory property IMPORTED_TARGETS and making each one
global.
Requires CMake 3.21.
Status: Already implemented for a long time, but is opt-in.
Pros: Relatively robust
Cons: Minimum CMake version for building Qt is 3.16.
2) Make all imported targets global during the Qt build using the
CMAKE_FIND_PACKAGE_TARGETS_GLOBAL variable.
Requires CMake 3.24.
Status: Not implemented, but can be set by Qt builders directly on
the command line.
Pros: Should be robust
Cons: Minimum CMake version for building Qt is 3.16.
3) Abandon the desire to have a single qt_find_package in a single
directory scope, and embrace the CMake-way of repeating the
dependency in each subdirectory that requires it.
Status: Not implemented.
Pros: Should be robust
Cons: A lot of qt_find_package duplication, will require rewriting
various code paths, QtPostProcess would have to be done at
directory scope, unclear if dependency tracking will still work
work reliably when there might be multiple same-named
directory-scoped targets, other unknown unknowns
4) Move all qt_find_package calls into a $repo_name/dependencies.cmake
file which would be read at project root scope. This would
potentially avoid all scoping issues, because all dependencies will
have to be specified at root scope.
Status: Not implemented.
Pros: No duplication
Cons: Dependencies are not scoped anymore to module directories,
won't be able to conditionally look for dependencies based on
module feature evaluation, not clear yet how this will tie into
standalone tests which are in tests/ subdir, other unknown unknowns
5) Try to promote as many 3rd party libraries at project root scope
as possible.
Currently we have 2 general locations where we look up
dependencies.
One is each qt_find_package call. The other is
Qt6FooDependencies.cmake ->
_qt_internal_find_third_party_dependencies().
Many 3rd party targets are created by
_qt_internal_find_third_party_dependencies() in the root scope, but
not promoted, and then we try to promote them in child scopes using
qt_find_package, which causes the promotion errors.
Starting with 58eefbd0b6 and
37a5e001277db9e1392a242171ab2b88cb6c3049 we now record the provided
targets of previous qt_find_package calls.
So instead of waiting to try and promote targets later during the
configuration process, we can make sure we promote the targets at
_qt_internal_find_third_party_dependencies() call time, right
when we lookup the Qt dependencies of the qt repo, in the root
scope.
Status: Implemented in this change
Notably, we only promote 3rd party targets to global for qt builds,
and not user projects, to not accidentally break user project
behaviors.
Also, we only promote 3rd party targets, and not Qt internal
targets like Qt6::Core, Qt6::Platform, Qt6::PlatformCommonInternal,
Qt6::GlobalConfig, etc, for a few reasons:
- the code that requires targets to be global only cares about
3rd party targets
- promoting the internal targets is more prone to breaking, because
there is more than one place where find_package(Qt6Foo) might be
called, and if that ends up being in a different directory scope,
we encounter the same global promotion errors.
Some notable cases where this happens:
- tests/CMakeLists.txt brings in extra Qt packages via
StandaloneTestsConfig.cmake files
- qtbase standalone tests qt_internal_qtbase_pre_project_setup()
calls find_package(Qt6 COMPONENTS BuildInternals) which ends
up creating the Platform target in the root scope instead of
the tests/ scope
- Qt6::BundledLibpng links against Core, which ends up trying to
promote Core's internal dependencies Platform and GlobalConfig
To only promote 3rd party targets, we walk the dependencies of
an initial target recursively, and skip promoting targets that have
the _qt_is_internal_target or
_qt_should_skip_global_promotion_always properties set.
Pros: Improves the situation compared to the status quo
Cons: Still not ideal due to the various filtering of internal
targets and having to mark them as such.
6) Avoid promoting targets to global if we can detect that the target
was created in a different scope than where we are trying to
promote it.
We can do that by comparing the target's BINARY_DIR to the
CMAKE_CURRENT_BINARY_DIR and skip promotion if they are not equal.
Status: Not implemented, but we can consider it because it's
quick to do.
Pros: More robust than newly implemented approach (5)
Cons: Requires CMake 3.18, because trying to read the BINARY_DIR
property on an INTERFACE_LIBRARY would error out.
Also, if we implement it and make it the default when using 3.18+,
we might 'collect' a lot more hidden promotion errors that will
only be revealed later once someone uses CMake 3.16 or 3.17,
because most will probably use newer CMake versions.
Perhaps the trade-off is worth it?
Fixes: QTBUG-89204
Fixes: QTBUG-94356
Fixes: QTBUG-95052
Fixes: QTBUG-98807
Fixes: QTBUG-125371
Change-Id: I088a17a98ef35aa69537a3ad208c61de40def581
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d2e85cede01c0898ca73cbc3fb9f53aa9612cab5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
They will used from another Public.cmake file in a follow up commit.
Change-Id: I71b69ed76ca48c391ba45329eb9c305e4a2a238b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit dad49f5a1e91dbdf91a683e0a68d05cdfa2e1ef1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Will be used in a future commit to do target filtering.
Change-Id: Iaf7039ff456ca11d94c44c6e12f63408d2aaa484
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4801d4c708f27a1c29118b0dccd24d2e0d3d6ccc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Introduce some command wrappers for adding the Platform,
PlatformXInternal and GlobalConfig targets, to apply some common
options.
This will allow for less churn in the future when we need to apply
options to all these targets.
The Qt6CoreMacros, Qt6AndroidMacros and Qt6WasmMacros inclusion are
moved before QtBaseGlobalTargets to make the
_qt_internal_add_library command and other platform specific
commands available before we create the Platform targets.
Change-Id: I260fdbeb95a39f06951dfefc714d3da604abb0bb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit af60bdee8dcb86b73caa23d4d54611b0f1d33bf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This ensures that the EGL::EGL dependency is promoted to global in
the same scope as GLESv2::GLESv2 if it is a link dependency.
Amends c4d3e5d7d3
Change-Id: Ia156676b40e6d04a5037a305db35192cad306a0c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 52a3ab1eb23915b620948dceb577cf23c1b2391f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
It usually looks up the Threads target, so we want it to be recorded
as a provided target.
Amends 58eefbd0b6
Change-Id: I0f06aaae98fd99da8fb6436d232a147e163580a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8c0fb7e07de071de56a74fc637f448afc8bbd102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The link to QChronoTimer::singleShot seems to ambiguous for qdoc, as
it's both a property and a method. But linking from startTimer to the
QChronoTimer (and QBasicTimer) class rather than singleShot makes
more sense anyway.
Change-Id: I499b1008b8460d9529b8afd00b5dafbb314ceea1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6bbc9c714bf067d33ad2f487c552025aaa7278db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The last requirement for making the iterator random-access, so
change category type.
Based on review comments.
Task-number: QTBUG-126150
Change-Id: I617f38f92d0f9279781e62ea3ab1929dbf6a07cd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e4b2d7607c0243f2a7ca3f38f59e8532c543fcc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Required for making the iterator random access.
Based on review comments.
Task-number: QTBUG-126150
Change-Id: I80ee8ed584747759acb17ee956551caba4d5bdaa
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c4e406e3792405cfc0b8cc97a29f136c0fd44a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Required for making the iterator random access.
Implement compareThreeWay, add tests. Comparing iterators operating
on different containers is undefined behavior, so assert if they don't
match (even if they are different QJniArrays referencing the same
Java array).
Based on review comments.
Task-number: QTBUG-126150
Change-Id: Ib3b94558fc66fb9cff19139d2110c6bbd4ac14b5
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d04f38f6f5e49a81211ab598ba23049dc4ef1507)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We implicitly support QString, QStringList, and QByteArray, as well as
C++ types that are equivalent to JNI primitive types (such as bool for
jboolean, or int for jint) in QJniObject and some QJniArray APIs. Make
this symmetrical for QJniArray::to/fromContainer.
Add more compile- and run-time time test coverage.
Change-Id: I8cc84e6181a93f889282d2d3f0a05207416c4dbe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d9dd8c4986373789b8bd250d0c2b36b660fe210f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add a template parameter that is defaulted to what our logic would
select as the appropritate container type. If the type is contiguous
and the element is primitive, use the optimized implementation with
the JNI helpers for copying the entire array region.
Otherwise, use an emplace_back loop.
Change-Id: I669bc3261f111bc0c7e3dd2af8fd33293c083801
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a6b1f80cd6c833f6eb2fbfb778254cd7fcbc000f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
glibc introduced the glibc-hwcaps/XXXX path in glibc 2.33 (2020) and
removed the old, legacy "haswell/" prefix in glibc 2.37 (2022). This
means anyone deploying HW-capable libraries must be deploying symlinks,
so we are not losing functionality.
Because it says "glibc-hwcaps", I am now making this dependent on glibc
for libraries.
Added unit testing for this feature. Tested on Linux, FreeBSD, macOS,
and Windows (the QLibrary test SKIPs everywhere except Linux). We do
create a "libtheplugin.dylib.avx2" on macOS with this change, but won't
attempt to load it (Darwin has fat binaries so lipo(1)ing the files
together would be the right thing to do).
Change-Id: Ic0adfa808d28487a8303fffd17d9e78ec87bbd9a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a1db2959129cb4630adfffcaaece19bafe16db77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Start numbering Android touch points from 1 instead of 0.
The QPointingDevice was added in Qt6. This means we don't need to worry
about unique IDs for each touch point.
Different IDs are needed for multi touch. The touch point ID of each
physical finger must be unique and immutable as long as either finger is
still pressed.
Theoretically, it doesn't matter from what value we start the numbering
of touches.
The problem with numbering from 0 is that the touch point can be easy
overwritten. It is enough to create QSinglePointEvent (like QMouseEvent)
and by default touch point with 0 ID will be cleared and lose all
current data.
Because of that, Android's touch point numbering will start from 1
instead of 0.
Pick-to: 6.7 6.5
Fixes: QTBUG-112287
Change-Id: I83a4678a0751bdb7a5ff5353ec49866d4cca5f05
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit cb3b972bb128e0ee9e4e18a49119934eee4f7c6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
realpath() is supposed to return the canonicalized absolute path, so
there should be nothing left to clean.
Change-Id: Ie30a3caf09ef4176bb36fffd17cde30c7538dba9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 31cf699e69808403b6533b08b3194af24cac2eab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The QThreadPrivate::finish() cleanup code is not prepared to be
subjected to POSIX cancellation: if, like on glibc, thread
cancellation is implemented by stack ununwinding, we get exceptions in
dtors and therefore std::terminate(), and otherwise, we leak
resources.
It would be very hard to make the code robust against this, as it
would require all cleanup to be wrapped in pthread_cleanup_push/pop,
with the added problem that these functions need to appear in the same
lexical scope. Another alternative would be to move all cleanup code
into a thread_local destructor, but it's not clear whether code
running as part of thread_local destruction would be exempt from
cancellation, and it would be a major rewrite.
The simplest method is to disable cancellation for the remainder of
the thread lifetime in the shutdown code, just like the startup code
only enables cancellation after initial setup, so do that.
[ChangeLog][Important Behavior Changes][QThread] On Unix,
fixed a race of QThread::terminate() with normal thread exit (running
off the end of run()) which could corrupt QThread's internal cleanup
code. The fix involves disabling thread cancellation for the remainder
of the thread's lifetime once control reaches QThread's cleanup
code. If you rely on a PTHREAD_CANCELED return status, be aware that
this change may mask late cancellations. Likewise, slots connected to
QThread::finished() using Qt::DirectConnection are now run in a regime
where thread cancellation is already disabled. If you need
cancellation in that situation to work, you need to define your own
finished()-like signal and emit that at the end of run().
Fixes: QTBUG-127008
Change-Id: I23030eefdfcebf0a6d6796db5cbbbf0812ae12c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 01d4be4a8327458a3242804594b498f840480289)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The siphash qt_attribution.json file was moved to the 3rd party
directory out of corelib, without adjusting the attribution file dir
path.
Amends da2d3e914c1b3f9da17c40502c8e7c1463d35612
Change-Id: I25cf9b9f19bc596898d51449ef9561eb9882a046
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0b0b30f7cf900ea0463f4073f0e82d014920fd1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
In windows CMAKE_SYSTEM_PROCESSOR can be set to both arm64 and ARM64.
Make the comparison case-insensitive when defining mkspec.
Pick-to: 6.7 6.5
Fixes: QTBUG-127044
Change-Id: Id0c8f04bc0ec6b70993e400f9c285168d4c1499b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7ae19cee1c782fadfbd0c617568fdad8aba9a493)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Doesn't test anything, just that it doesn't crash.
Turns out we have a race between thread cancellation and normal exit
(filed as QTBUG-127008). Worked around by adding an infinite loop to
run(), after terminate().
Android doesn't support cancellation at all, and our Windows
implementation hits QTBUG-127050, so skip the test on those
platforms.
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I47a635a31caaf116d3688f31b9b5c5875e9765f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9f7e75a2647732ff998f1c0d112682dbd5c4e28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Remove duplicated comment and code that sets and resets the environment
variable. As a side effect, restore the environment variable to the
value that was set before overwriting it, instead of un-setting it
bluntly.
Pick-to: 6.7 6.5
Change-Id: Ife0b2631aff27dbcb23079c2162ffed797b351dc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit f984a6ab7a99ace65e0d73c3f37ef6ad79dd0aa0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
On macOS with secure transport, set QT_SSL_USE_TEMPORARY_KEYCHAIN
environment variable to avoid the permission UI, which fails the test.
Amends b1e75376cc3adfc7da5502a277dfe9711f3e0536, and makes the test pass
reliably on a local machine.
Pick-to: 6.7 6.5 6.2 5.15 5.12
Change-Id: Id70ceaecfa523d5183236464fe6cfaf4cdbadf4a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 14a61026216d20eb3a2893420b7d51374e820b44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We're getting load() == false but errorString() == "Unknown error".
Not backporting past 6.8 because of a new translatable string.
Change-Id: Ic0adfa808d28487a8303fffd17d9ee19ce074e4b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 2be44b57da951007ecab4d6c9e4bc2f3b5cd067a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
ActiveQt already has a tst_bstr, so configure fails for top-level builds
with both Core and ActiveQt.
Amends 93686386c078e2be03fb8bc42dee60a9e36fc23f.
Task-number: QTBUG-126530
Change-Id: I4a3d67d72be14202fe487f241ecd3d7c97936e29
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
(cherry picked from commit 43a54cbe82a59a32ae666ddd0cc54e5edd0ccf50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
... to make sure that the follow-up patch does not change the behavior.
Pick-to: 6.7
Change-Id: I4a1898ce0987940622ff38fd70819a83d62515db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 27fe14cf430980b133694bc86d1224bd56e3faeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The assertion is about entries at the same index having matching
language, script and territory tags. I forgot that the system locale
has its m_index set to match the closest-matching CLDR data table, so
might not have the same tags as the locale_data[] entry at its given
index.
Fixes: QTBUG-126390
Change-Id: Icb8cc09cc2a9d66a0af301a300f44923d7400ce9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1df1c0b6fdc40a3cb9e89c4d07adc89c37c7582b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
PDF/A-1 and PDF/X-4 require the use of an output intent. Insofar this
has been hardcoded to be sRGB. Instead, expose the relevant setting so
that the user can choose another colorspace, and set the metadata
about the intent.
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
[ChangeLog][QtGui][QPdfOutputIntent] New class.
Change-Id: Ib3f0620477ddcc8b294a7039c120e89cc318f513
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit e8fcdf9bb6318e75d64179a6682481154cdef14f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Isolate the code inspired by the SipHash reference C implementation
in a separate file. This makes it clearer what code is available
under the CC0 license, and which not.
[ChangeLog][Third-Party Code] Adapted copyright information for the
SipHash Algorithm (used in Qt Core).
Change-Id: I9b8fc27a4e791c0f1ccbdfa6244d4fa47c7a219b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit da2d3e914c1b3f9da17c40502c8e7c1463d35612)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Use an approximation of the "Unicode Standard Annex #31"
for checking the property names and enumerations.
Remove check for dynamic properties and use character literal
formatting for them instead, which will escape offending characters.
As a drive-by, use QStringView parameters for the check function.
Amends 53c8d1fe7c59f3462b85193b688d02ff353b51d5.
Task-number: QTBUG-126265
Task-number: QTBUG-126860
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I90fe555e64327e4164a17c1af0a734e4b1d834db
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit aae20da52a11e0ebb8c4f5fcfb95ce6744f659a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Darwin turns out to know about offset changes a million years into the
future, but to not admit to there being any transitions more than (a
bit over) half a million years into the future. It thus failed the
non-ShortData part of tst_QDateTime::timeZones(), thanks to using
correct offsets that showed there must be a transition in the
interval, but not believing in that transition.
The discrepancy leads to QTimeZonePrivate::stateAtZoneTime() getting
valid data for before and after the transition, with different
offsets, so amend its "no later transitions" early return to check the
offsets do in fact match. If they don't fall back on the code that
handles the case where we don't know about transitions but do have
offset data.
Pick-to: 6.7
Fixes: QTBUG-126391
Change-Id: Iefda439377ebc3025f2b754e2ec686fcc6361a1b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cb870adad612018e7007f4a1b6066b49d0f2dc4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
macOS only claims to conform to POSIX.1-2001, but has had utimensat
since macOS 10.13.
By enabling the utimensat code path, using stat.st_mtimespec as input,
we get nanosecond precision when qmake installs files.
Without this the tst_qmake::install_files tests fails due to the source
file having a sub second timestamp -- 2023-07-31 15:58:12.468 -- while the
installed does not: 2023-07-31 15:58:12.000.
The reason this test passes in the CI right now is probably because
the source file archive we use to pass test sources to the test
machines does not support the same level of precision.
Change-Id: I6ca7a2a2f9e71981814cbf496aa55717b3a3f74f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a2779192eec649a15b909cd9becade7eb0bda34e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
PDF/X-4 is a subset of PDF 1.6, aimed at printing fidelity. We can
support it with a few refactorings of the existing code in
QPdfEngine.
* Add the new PDF version to QPagedPaintDevice / QPdfEngine.
* Always write the XMP metadata, no matter what's the PDF version
used. XMP used to be written only for PDF/A-1b, but it's supported
by PDF 1.4 and 1.6 so there's little reason not to write it.
* While at it, ditch the search&replace approach for the metadata
and use QXmlStreamWriter instead, since it gives us extra
flexibility that we need (emit different tags depending on the
PDF version in use).
* The old code had a bug where the timestamps in the XMP metadata
and the document information dictionary could fall out of sync.
Just use one datetime object in both places.
* Add /ModDate and xmp:ModifyDate (required).
* Add the required attributes in the xmpMM namespace.
* Add a way to set the document ID to a custom UUID, and use it
in the XMP metadata as well as in the /ID in the trailer. Emit
the ID unconditionally, as it's been available since PDF 1.1.
* Emit the output intent for both PDF/A-1b and /X-4. This will be
amended in a future commit to let the user choose the colorspace.
The only missing bit is §6.5.4 of the PDF/X-4 spec. This imposes that
all symbolic TrueType fonts shall *not* specify an Encoding, and have
exactly one encoding in the cmap table. This is basically requiring what
§5.5.5 in PDF 1.6 only suggests (page 400). However it seems that we are
not embedding a cmap table when extracting a font subset, and that's
already violating PDF/A-1b anyhow. This is tracked by QTBUG-125405.
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
[ChangeLog][QtGui][QPdfWriter] Support for PDF/X-4 has been
added.
Task-number: QTBUG-125405
Change-Id: Ia81f29b07b819eca5767c9f17692d92a3010f5ad
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2fbece8a73cb2d2692c78c38e1576c0c9c62fce7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We used to mark Q_DECLARE_SHARED all our value classes in Qt 4 times,
but since many Qt types these days live in nested namespaces that
macro, which only works in the QT_NAMESPACE, has become less useful.
As we use it in more and more places and eventually add more
responsibilities to it, we don't want every module to define its
version by hand, like QT3D_DECLARE_SHARED did in 2016 already.
So add two namespace-aware versions of Q_DECLARE_SHARED, to be used
inside or outside nested namespaces.
Extend the test.
Despite the name, this is not a public macro.
Found missing Q_D_S in API-review, so picking this to 6.8 to aid with
fixing the 6.8 API.
Change-Id: I367ca0d5b005b64090de44f7b7541d8639f9a4e0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 37b2b2ea4ef3cf494d23885de186a9519763e744)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Commit ae64c54f8c broke configure
arguments like
--webengine-jumbo-build=20.
That commit transforms the argument to
-webengine-jumbo-build=20
but single-hyphen arguments take values without an equal sign.
We need to store the unaltered argument (with the two hyphens) for
further handling instead of the single-hyphen variant.
Fixes: QTBUG-126872
Change-Id: I243eb072dfe5535a648bd78bb3aeb3b9e0e4ede0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 76d5bceba7f1c553b02def689f2010db671ec60f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Otherwise we lose the scheme when reading it back as QUrl
Pick-to: 6.7 6.5
Change-Id: Ice6e083611c93641ef33f00fa48f1b32dc25f718
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 46ffca13fb0705c54ad05bc2c1a37f7d5fb5132d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
On Apple platforms we no longer _debug suffix libraries (and plugins)
in single config framework builds. This is a follow-up for logic in
qmake that didn't get adjusted in d3be87ff1d558f05309b1f29f7e71f291498584f.
Change-Id: I6461fca9da5c3ac1382ffc46e63409ef0150ad46
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 20d89a2710488ca5f9f6674c4c6d167f3a193383)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
As part of 5ba0982b28 we started calling
QWidgetPrivate::setVisible instead of QWidget::setVisible when showing
children, to avoid setting ExplicitShowHide.
Unfortunately some widget subclasses wrongly override setVisible to do
initialization, which resulted in these widgets not running their init
code. The documentation clearly specifies to use showEvent or Polish
for this use case, but to avoid a regression we temporarily set a flag
that prevents QWidget::setVisible from setting the ExplicitShowHide
attribute.
We can not rely on simply unsetting ExplicitShowHide after our call
to QWidget::setVisible, as the call might recurse into logic that
checks ExplicitShowHide and wrongly determines that the show is
explicit.
Fixes: QTBUG-126721
Fixes: QTBUG-126218
Pick-to: 6.7
Change-Id: Ibf88340b68cb4fcb20ce3d8ec5b76de0fd2d2551
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fc4c6fb5f6bd6bd63b13f1f8b5b7a7289a5fd230)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We no longer support fake fullscreen mode on macOS, and haven't for
a long time.
Pick-to: 6.7 6.5
Change-Id: Ic2eb6065239c4e5be5ab2011a6da50272c77460a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4079ecfb9b3dc794212a81154e18145256741cfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When the QCocoaWindow is created it picks up the QWindow geometry,
and applies that to the NSWindow it creates. But since we haven't
created an NSWindow yet for the first step, our logic to adjust the
window geometry when the positionPolicy is WindowFrameInclusive is
a noop. As a result the NSWindow gets a client geometry corresponding
to what the user requested as the frame geometry.
To fix this we hook into [QNSWindow setContentView:], where we apply
QWindow properties to the NSWindow after creation.
The tst_QWindow::positioning test has been split out into a separate
framePositioning test.
Pick-to: 6.7 6.5
Change-Id: I85fe6ad10aee8346202de3d55d6b2cd89915c5df
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 31ec108dd08d6381a15e49b6fbec9337705c3b2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
- Repeated return types
- Make member functions static
- narrowing int conversions
- Use auto *
- Use list.isEmpty()
- Use modern includes
- Remove redundant access specifiers
- minor fixes
Change-Id: I14ddf1add667536739fbb5fabb357dbaa7ef35c3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 6346c5b426935a767575ea758e99749bc6544f54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Instead of default-construction followed by move-assignment, delegate
to the move ctor instead.
We can't expect the optimizer to do this transformation for us, since
fromLatin1() is out-of-line and compilers are not, yet, known for
optimizing atomics (ref-count) around out-of-line function calls.
Amends 6abdbb65e5.
Pick-to: 6.7 6.5
Change-Id: I75b747c4d5269ae125bf12cda57a1f718aa7a467
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f7853680ef68ce2495662ffc7c7a933655436f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We seem to be using more and more of these, and their definition is a
bit subtle (need to have an explicit default ctor to avoid {} being
an initializer for the type).
Port the existing tag structs over to the new macro and add a test,
even though we found two users of QT_DEFINE_TAG in QtBase alone, one
of which is actually widely used (Disambiguated_t). There are more in
other modules.
Change-Id: I046bb2b70a2c7e79be2315d91c43e5fd2f0968a0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 74a87a329498422db0dea3e469fb84704accbb2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We return a default-constructed QVariant. What else could we possibly
return? Right: nothing else.
So document it and add a test.
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: If9808703b8ddfd15ceb013996741af8cd4efea12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d1a5e602df5978cee6bd263db77745f8047e508e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Check that it marks types are Q_RELOCATABLE_TYPE and adds the ADL
swap().
Pick-to: 6.7 6.5
Change-Id: Ibde0f4ad594e4a6b3636357da2fd211507293b60
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 91a96ea8fb100fca08b37eb3ba644083b3316e6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>