Compare commits

...

789 Commits
dev ... 6.5.0

Author SHA1 Message Date
Fabian Kosmale
aea92807be Revert "qdbusxml2cpp: invert Q_DECL_DEPRECATED and inline in the output"
This reverts commit 310f6666150f18d40630b54cf5c9424e4cfb5567.

Reason for revert: Causes a fail-to-build regression

Task-number: QTBUG-111330
Change-Id: I08a6a68d2c81e1a1189356aa7cf36aaf24fd8c9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-25 06:28:03 +00:00
Thiago Macieira
22943b3a3f QVariant: ensure the type custom is registered on construction
I must have broken this in the 6.5 work I did for QMetaType and
QVariant, but I haven't searched which commit exactly did it. Our
QVariant tests are old and thus only checked the type ID, which meant
that they caused the registration by the act of asking for the ID in the
first place; this commit adds a couple of explicit checks for the type
registered by name before the ID.

Fixes: QTBUG-112205
Change-Id: Idd5e1bb52be047d7b4fffffd174f1b14d90fd7a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8570e86fff183ffa4c1dff577c7fa14e3342daee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-24 05:49:28 +00:00
Dennis Oberst
fd1020f2d6 docs: Remove map and runfunction example
amends: fbb470b40b2c86a55751bf3099cc0424f66c7274
amends: de5e0422ca14ad1bc042889fa68772bf6912a215

Change-Id: I04d4a60f7e5f7f0d149667d0e78ca56bac23280d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 11df026ea199c71b1e24c36dc0a6b7468288ce98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-23 06:22:18 +00:00
Marc Mutz
a845725d13 QSQL/ODBC: fix regression (trailing NUL)
When we fixed the callers of toSQLTCHAR() to use the result's size()
instead of the input's (which differ, if sizeof(SQLTCHAR) != 2), we
exposed callers to the append(0), which changes the size() of the
result QVLA. Callers that don't rely on NUL-termination (all?) now saw
an additional training NUL.

Fix by not NUL-terminating, and changing the only user of SQL_NTS to
use an explicit length.

Amends 4c445ef0bae8b36ec4a742552f0ebd81a1a90723 and
46af1fe49f7f419dc1b3231de9860e2da0ea48f8.

Done-with: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Change-Id: I6210b77e9417f46294df94cb32ab4134af8dc4c2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 9020034b3b6a3a8118e5959beed699bb8aaa3f95)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-23 06:22:13 +00:00
Mikolaj Boc
fa5a8fa821 wasm: Text input hotfix
Focus the canvas on window activation to make the screen receive
key events.

Fixes: QTBUG-111848
Change-Id: Iad3474681653b176eebd901aaf59e84538681351
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-03-23 06:22:08 +00:00
Dennis Oberst
e453de0c0b Example: rename progressdialog to primecounter and modernize it
The previous example finished way too quickly and provided no real
value in regards to API understanding. Previously, QtConcurrent::map
was used, which was also used in other examples. We are now using
QtConcurrent::filterReduce to demonstrate other functionality.

Task-number: QTBUG-111165
Change-Id: Ibd6eb119d0711cddfe8b211d460e9d67d6ce95c3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8352756d27e5657390b6e87f45e0c0bae6b7784e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-21 12:55:33 +00:00
Dennis Oberst
6ea0d57565 Example: update wordcount example
Added a QFileDialog to let the user select a path. Before, the path
was statically assigned with "../../" , which is not optimal.
I also modified the findFiles function to check for text files in
general and not only *.cpp and *.h files. Lastly the result of the
word counting is now displayed on the console, as I think this is an
informative output from this example.

Task-number: QTBUG-111165
Change-Id: Ie27c6acb4f79a78e3bef141edb92de08901fde71
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d795dfaee7093a30b278e6e8b9dea30c2e7a2106)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-21 05:14:04 +00:00
Mårten Nordheim
6c00b495a6 Fix FTBFS with -qtnamespace
qtbase/src/corelib/kernel/qvariant.h(54): error C2888:
'const bool qIsRelocatable<qt::QVariant>': symbol cannot be defined within namespace 'qt'

Amends 0ca803a5d325f26f5e4e0fcab8b9c9a02f154336

Fixes: QTBUG-112016
Change-Id: I43b3f292fa85b6cda00f36da6c8aff65da4ed742
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c0a732f984f407f7613805ff04b8a6d46c12f754)
2023-03-19 07:42:50 +01:00
Christian Ehrlicher
dbf4d319f0 SQLite: Update SQLite to v3.41.1
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.41.1

Change-Id: Ibc88ae7b73ea46797d7aff00ee193b1ccfaae31b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 17e4b2d8ed8fc6c05e9ce66d39f0eff5a768cbd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-19 06:42:39 +00:00
Dennis Oberst
29f73f0c9a Example: update imagescaling example
Updated the example to align with the Qt6 Example-Guideline.

https://wiki.qt.io/Qt6/Example-Guideline

Task-number: QTBUG-111165
Change-Id: Ibd9e7ce0d4dee90f6a693b81516d2f5b86345b1d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b5e9d418959a9d427c14468886470791527e157f)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-03-17 10:07:17 +00:00
Bartlomiej Moskal
c60e8ef680 androiddeployqt: remove infinity loop in deleteMissingFiles
There was a possibility of infinite loop and eventually crash when
androiddeployqt was used for the second time. Everything because of
deleteMissingFiles function for clean up previous build.

When we find the same names and those are directories, we call
recursively deleteMissingFiles. The parameters we use are absoluteDir,
not absoluteFilePath. As we use parent of found dir, deleteMissingFiles
is called with the same values as before.

This commit removes possibility of infinite loop by using
absoluteFilePath. That allows to avoid calling deleteMissingFiles with
the same parameters.

There is still a possibility, that directory that was found is not the
same as we were looking for. That will cause not needed files removing,
but those file will be copied again later.

This regression was created by 7dc05252a0df829bb5ea3994160d425bb0da26cb
commit

Fixes: QTBUG-111027
Change-Id: I195b4c407068b14e2ef94800ad1945adc66408cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f4d897f04eee6386382096945f872ae9f306a5de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b0553d15a06c9a842e82caf8ce62530bd45d888c)
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-03-16 12:59:09 +00:00
Andreas Eliasson
ce891ca3e4 Doc: Remove broken link to Anchor Layout Example
This example was moved to manual tests in 6.5, which broke the link.
Now that it's in manual tests, I guess we can stop promoting it.

Change-Id: I1aa4a7de5123e96bf9ff56eeae49104acdce9645
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 9f93f96394fd4ab209ba45cd99753b9c7edcf373)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-13 20:03:55 +00:00
Ivan Solovev
257eaa6408 Imagescaling example: fix memory leaks
* The DownloadDialog was never destroyed properly. Pass 'this' to its
  constructor to fix it.
* When re-creating an image grid layout, properly clean up old image
  labels in Images::initLayout()

Task-number: QTBUG-103514
Change-Id: Ief52774002632d4ad3a6cca85bb0c0aa1a1d4bc0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 0ac234f9e256949cbacb77f94d39fff90caba7b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-13 20:03:29 +00:00
Fabian Kosmale
b68ad5ef7f QMetaType: Ensure that qfloat16 gets correct id
Code initially compiled against Qt <= 6.2 does not have a qfloat16
metatype that unconditionally gets registeret from QtBase.

Therefore, any preexisting metatype instance for qfloat16 will hit the
custom type registry code path. As builtin metatypes are not part of the
custom registry, we will create a new type-id, and the type will thus
not compare equal to new code using the builtin type-id.

Avoid this issue by inserting an alias to the type in
QMetaTypeCustomRegistry's constructor.

Pick-to: 6.5 dev
Change-Id: I825265ad16e274c08b2c4a3a4814475b6c6c6187
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-13 20:03:15 +00:00
Kai Köhne
973f499cca Fix listed files for sha3_keccak
JSON allows duplicated fields, but the last one will prevail. Therefore
move the new "comment" before the actual list of files.

Amends fa4b7495b741c3e7943860c5ff15212afceda710.

Change-Id: I06874745c8c51e55d79d7a373236cc8d9151079d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d4dba80863324302f9d5d26b184352845263adc3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-13 20:03:06 +00:00
Giuseppe D'Angelo
7d86115a17 QVariant: fix comparisons between strings and integer 0
250ca8d5f8bb3771695ae8eccb8d9b469003d840 changed the qConvertToNumber
to have a std::optional return instead of a boolean out-argument.

In doing so a code path that was supposed to report a failure (string
could not be converted to an integer) accidentally starting reporting
success (and converting the string to 0).

The problem is that the `ok` check from QString::toLongLong was
accidentally dropped in the refactoring; previously the function set
`ok` to false and returned 0, now the function just returns 0.

Instead, amend that return to return nullopt (because the conversion has
failed).

Change-Id: Iaedef5463f3ec500a97bd4c9bbddf977f66df61a
Fixes: QTBUG-111867
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a25644aecf056b9b021189de5384519b6f06c1e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 21:39:06 +00:00
Volker Hilsheimer
f4b1a9b8bd Make it possible to use QObjectPrivate::connect in private code
In most QObjectPrivate-subclasses, the Q_DECLARE_PUBLIC macro is used in
the private segment of the class declaration. In that case, the q_ptr
becomes a private member of the private class, and then the
QObjectPrivate::connect function can no longer be used, as it needs to
access the d_ptr.

Fix this by declaring QObjectPrivate, and the static-assert-helper, as
friends of the class using the Q_DECLARE_PUBLIC macro.

Adapt the QObject test by moving the Q_DECLARE_PUBLIC macro into
the private section of the test-private, and add a compile test.

Change-Id: Ifc04be3b305221e138b1e08bb3a3838d871f4fcb
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>
(cherry picked from commit 4f02973e2f447dfc92234ec247d7157ea0e1e807)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:40:50 +00:00
Mårten Nordheim
ae30462585 Fix overflow in SHA-3/Keccak
state->rate is always larger than or equal to state->bitsInQueue;
when bitsInQueue == rate the queue is consumed and bitsInQueue is set to
0 again.

Done-with: Marc Mutz <marc.mutz@qt.io>
Change-Id: I56d268a19fb3cd542cc027edc962253f09d97a14
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fa4b7495b741c3e7943860c5ff15212afceda710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:40:49 +00:00
Volker Hilsheimer
7a56f8b974 Doc: fix more links to cmake functions
Use qt6_ consistently as the link target, and qt_ when referring to the
function.

Change-Id: I9bb903cd2c32dcded1ee7a2804aa36074e8a5c38
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 454dafb0e1a36ef6bbe9eafc240c22f6cd14e312)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:40:49 +00:00
Giuseppe D'Angelo
e64eaf57f3 QTypeInfo: move helpers in QtPrivate namespace
qIsRelocatable and qIsValueInitializationBitwiseZero are not public API,
hide them away.

Change-Id: Ib4eeaab46d01759098e96091b700e9a28fd50962
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0ca803a5d325f26f5e4e0fcab8b9c9a02f154336)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-10 17:40:49 +01:00
Marc Mutz
42612b0180 tst_QCryptographicHash: Extract Method ensureLargeData()
... to make large data usable from other test functions.

Change-Id: I302070121a8bb49f373c7711bc3ab9e6418874ef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f7ea9b36b7c56bb288f3ea55f587d2ccb8a9b7fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:40:49 +00:00
Dennis Oberst
def0024f98 Example: remove map example
This example only demonstrates the use of blockingMapped. Considering
that the QtConcurrent::mapped~ functions are already included in the
wordcount example, and have very similar APIs to the
QtConcurrent::filter~ functions, which are included in the
progressdialog example, this no longer serves a useful purpose.

Task-number: QTBUG-111165
Change-Id: Ibc526e1a9fb17070e376e45151e9c2bdbc69bd32
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit fbb470b40b2c86a55751bf3099cc0424f66c7274)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 11:59:53 +00:00
Marc Mutz
1a8e1d4170 Make compare(QU8SV) a non-template, document it
Templates have different overload characteristics from normal
functions, and treating q_no_char8_t and q_has_char8_t::QUtf8StingView
separately is never necessary, as one implicitly converts into the
other.

Add docs for the new UTF-8 compare() functions.

Amends b977ae371a753a82e1d0bb32c5b62099da663721.

Found in API review.

Change-Id: I58b4b28a3eccde1976d71cfa3412b734d46f314d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bbb9cf225fd030a87818cb867c24ab651f797100)
2023-03-10 06:20:33 +01:00
Dennis Oberst
0c2bd25712 Example: remove runfunction example
This example shows how to use QtConcurrent::run by calling a global
function and printing the thread ID. As the documentation already
explains the functionality very well, I don't think this example is
necessary.

https://doc.qt.io/qt-6/qtconcurrentrun.html

Task-number: QTBUG-111165
Change-Id: I42a718cdaabdaeeab39b933d12c67d11978c95da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit de5e0422ca14ad1bc042889fa68772bf6912a215)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 05:20:15 +00:00
Thiago Macieira
9ef8020dde QCborValue: add missing Q_DECLARE_OPERATORS_FOR_FLAGS
Change-Id: Ib1d2fc7100134f7597cdfffd174a650ccda287ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 06f60b24e23a9aa6640608f6010137ed75e2841e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 10:17:18 +00:00
Andreas Eliasson
2828b3fdca Doc: Update docs to reflect method being renamed
The new method has been renamed from markDirty to notify.

Fixes: QTBUG-111267
Change-Id: Ib7926a315cfd11ca6930c785290089b7031d34ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 12c62dd243dd139023fa1fc5c3a7c0fd8e3ee0ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 10:17:14 +00:00
Tor Arne Vestbø
ec3aac74a4 Plumb QMessageBox::setCheckBox() through QPlatformMessageDialogHelper
Without this plumbing we have no way of knowing if the QMessageBox
has a checkbox set, and can't decide to skip the native dialog,
leaving the user without the expected checkbox.

As the suppression checkbox on macOS can be customized, we can use
this plumbing to actually provide native dialog support for generic
check boxes.

This mechanism can also be used by QErrorMessage, which now matches
behavior between native and non-native dialogs in terms of the label
of the checkbox and its initial state. We might want to tweak this
in the future, since user's might expect the suppression label and
state to match the system default, but that's something we can
expose from the platform theme if so, and should apply equally
to the non-native dialog.

Fixes: QTBUG-111803
Change-Id: Ied9fc34383fe79fbd8437592ad1c1993b9396178
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a0313c85a9b8ab6ba0ec273f0c8638e2f7b8cc18)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-09 10:17:11 +00:00
Tor Arne Vestbø
dcf7247e05 QErrorMessage: Reset 'again' check box between each error message
The choice of whether to show a message again is per message,
so when showing a new message we need to reset the check box
back to its default checked state, otherwise the user might
mistakenly dismiss more than the indented message.

[ChangeLog][Widgets] QErrorMessage will now reset the check
box for showing a message again for each new message shown,
as each individual message has its own suppression state.

Change-Id: I86d4bb5eabdb5b7a478c03516108a5edf87fcbe3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f2fc2013defc2f346fa1936dcf357d34bae3dbba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 10:17:07 +00:00
Santhosh Kumar
cb14d0ec7f docs: Remove side panel and swipe to remove examples
Removed side panel and swipe to remove examples as part of patchset
3bc6f344a8f10699313c3e0c9236dd6945edd895 and updated docs to reflect
that change.

Fixes: QTBUG-110989
Change-Id: I6241dd9842b1584e3dd25057591fe29eaa34d579
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 87567f3a46885bcc110fbf041d5b1b6b8bd0e28d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 05:13:07 +00:00
Joerg Bornemann
7b44f7181b Doc: Fix keyword for CMake commands related to deployment
The pages are supposed to use the \keyword command to provide a target
for the versioned command name.

Change-Id: Ic91f5becc80985622a691aba96ce2c4e2984078e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 565e43fc704919923e53103911a72b3fec5c9d16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-08 11:43:29 +00:00
Volker Hilsheimer
124cd88242 Doc: use () in references to cmake functions
Change-Id: Ia4177a293c9c93edb8f27aec237df45b98caf20d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a9427bedd48cf978fcc8c24c5da14a9b79326c71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-08 11:43:27 +00:00
Alexandru Croitor
eced0ccefc CMake: Fix xmlstreamlint to use the manual test api
Amends e13b57d06ab6e81cf04c090cc46dd23b4f8daccf

Fixes: QTBUG-111774
Task-number: QTBUG-110647
Change-Id: I585cdf20e2e60d4e11170a6e2131b7abc2b7eaf3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b3a60e49cdd2ff82bb820be4278cf00298777a37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-08 05:20:11 +00:00
Tor Arne Vestbø
805f40924e macOS: Use non-native app modal message box from nested event loops
The NSAlert does not stay open when ran from a nested event loop,
so we need to fall back to the cross platform dialog. The window
modal dialog does not have this issue.

Fixes: QTBUG-111524
Change-Id: I63fba0a092018bb19edeef78c06587455d752235
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4e59a5252c11738ce4849032a5aa2a23f97a18ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 18:21:19 +00:00
Jan Arve Sæther
556a56104e Move anchor layout example to manual tests
Change-Id: I9c9a9dbcdaf705a31208b80b71e978938a492142
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 5773c3ac28dc3f7bd5e6e4571b99f944199fd9d7)
2023-03-07 11:38:40 +01:00
Volker Hilsheimer
74078c5fc6 Doc: fix QOpenGLWidget::defaultFramebufferObject documentation
Fix the link to QSurfaceFormat::StereoBuffers, and clean the text up
a bit. If everything is a \note, then we might just as well not have
notes, so move the statement about when this function is useful out
of a note, and combine the statements elaborating on ownership and
lifetime of framebuffer and contexts into a single note.

Change-Id: I7cb1f9ff78ba760e99d639550130f5c833ad684a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 47df0eb5131a5fc0decd049bd3f9eefeb26276df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 05:48:52 +00:00
Volker Hilsheimer
d3edb65620 Doc: Fix syntax error
Amends e0ecb0ded21082f4e00ee77411339009cb1294a4

Change-Id: If315d97e93047a8bece36c727c7646d30eb7458b
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 3ff66569eac5737af56a5bf910cbc2970d7312f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 05:48:47 +00:00
Volker Hilsheimer
2e1233d3ec Doc: fix link to QTest::failOnWarning
Also fix incorrect failOnWarning*s* elsewhere in comments.

Change-Id: I0bbc5e71060348153876f3d9a7c77c67f3c2e00d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9e31631557ea3f99506377ff91a1e15e942f9e88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 05:48:39 +00:00
Volker Hilsheimer
908b5ebdc9 Doc: fix links to changed or renamed i18n pages and sections
Change-Id: Ibe00b793ae0943cdbbcfa272e5cae4e91da5bf7d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 2e6de6f8b27f4a3ed2fbaf2e393614ee8f09a043)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 05:48:34 +00:00
Thiago Macieira
9ab1c94111 qsimd_p.h: remove LZCNT feature from the ARCH_HASWELL list
And for good measure, I'm also removing BMI2. The one we really care
about ensuring gets enabled instead of -mavx2 is FMA anyway.

Complements commit 29d3938aa56663f09666a0ac58b33e70e00abff2 (which in
turn complemented commit a98cf15ed1b57aee695de01b04a974637b2cd44a),
which removed BMI1 because AMD introduced it before AVX2. Looks like
they also introduced LZCNT in some earlier processor too (family 10h) or
GCC 12 began emitting __LZCNT__ for that family -- IIRC the AMD feature
list was bigger than just the lzcnt instruction.

Fixes: QTBUG-111698
Change-Id: I7f354474adce419ca6c2fffd1748f5b24f69a692
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8413824ca00188fa36b6adf46d4a5bddb9515ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:46 +00:00
Tor Arne Vestbø
e230713f8c qmake: Resolve target suffix based on Qt build config for static plugins
The qtPlatformTargetSuffix() function is used in various places to
determine the suffix of targets based on the config, which for macOS
will result in a _debug suffix in debug mode.

This becomes tricky when one project built in debug mode tries to depend
on the libraries/plugins of another project (Qt) built in release, as
the qtPlatformTargetSuffix() function uses the current CONFIG as input,
which may be different than the QT_CONFIG (or CONFIG of whatever project
is being depended on).

For libraries this was fixed in 50e664835bc2130e8693364641f9aaa7133b6998
by iterating all known library paths, and trying the CONFIG suffix before
falling back to release version.

For plugins this was never solved, which becomes an issue when linking
to static plugins, either in a fully static build of Qt, or when some
of the plugins are static (permission plugins e.g.).

In this situation, the user project has to have the same configuration
as Qt was built with, to avoid errors like:

 error: no such file or directory: '~/6.x-static/qtbase/plugins/platforms/libqcocoa_debug.a'

To work around this, we assume that a plugin installed into the Qt
tree has the same build configuration as Qt itself, then then use
QT_CONFIG as the determining factor when linking to the plugin.

This still ties the build config of the plugin to the config of Qt,
but relaxes the relationship to the application, allowing it to be
built in either debug or release, which is an improvement to the
current state.

Task-number: QTBUG-110356
Change-Id: Icee67fc01313a6c6f34178a6345ccae1b57429d7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e2446afaa10ddd365d8de834d3fb1d00fd661355)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:38 +00:00
Volker Hilsheimer
d5921e7376 Doc: fix links to qFuzzyIsNull
The function is in the QtNumeric documentation context.

Change-Id: Ibc6a8961bc04efd4ab1eb50bb371e6a169d513dc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c1cbb12e57e24b977b1a5c5be711793d6e67c113)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:26 +00:00
Volker Hilsheimer
eaec945923 Doc: fix qdoc warning, explicitly qualify enum type
Change-Id: Ie289f2468a3a71d35696907691586a31f70d5b1e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d48dbafeb24ee82ad6b97e8e5e9c9fcaa5f8a2d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:20 +00:00
Tasuku Suzuki
959d339729 Fix build with -no-feature-lineedit
Introduce a new feature for password dialog in cups that needs several widgets

Change-Id: I93799b814ac06e661c19cffcd7d3c9bfa56ff814
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 45df0ed2462beefce1aa51abf3cda7bc18e52118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:14 +00:00
Edward Welbourne
b5fa546f5f Doc fix in QIntValidator::validate() and comment on a test
The doc said positive values for a negative range were intermediate
but the code actually rejects them if the value has an overt plus
sign, so make clear that intermediate is only for the case without a
sign. Incidentally comment on a test where it might not have been
obvious to the reader that a space is the locale's digit-grouping
chracter.

Change-Id: I3edab74fe8c2cbe8448c0e523676f1fd0d0d8a9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 58f5ec35f108bca01489124e74e96018fd937ed4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 06:22:09 +00:00
Edward Welbourne
eec2fb9380 Simplify and relax UTF-8 locale override machinery for Darwin
There's no need to try the various permutations of the language
and region specific locales, as they all point back to the same
CTYPE in /usr/share/locale/UTF-8/LC_CTYPE

In addition, processes started from launchd come with an empty
locale environment (LC_ALL/LC_*/LANG), and hence will default
to the "C"/POSIX locale, even after picking up the environment.
This primarily applies to applications launched from Finder,
but also affects processes launched as background services.
And since a child process will inherit its parent's environment
the empty locale environment is propagated when running apps
from IDEs such as Qt Creator or Xcode, or commands in an SSH
login session (as sshd is a background service), unless the
environment has been explicitly set up by the shell (Zsh).

Since neither of these situations is the result of user
misconfiguration, it makes little sense to spit our a
warning.

We however still warn if we detect that the character
encoding has changed from the default "C" encoding, or
if the encoding is "C", but we detect that the user has
modified any of the relevant locale environment variables,
as this indicates either a change in the system default
behavior, or that the user has explicitly requested a
"C" locale, which is wrong.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Fixes: QTBUG-111443
Change-Id: I6fd14d1f8adddc2914d6ff4d3b5ad34a3871ef82
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ac6c7aa12fb6203855a745b2c1b4a1e07149b4af)
2023-03-05 07:22:04 +01:00
Edward Welbourne
f56646d6c1 QCoreApplication::initLocale(): Improve warning on failure
If we fail to set a UTF-8 locale, the warning claims Qt shall use a
UTF-8 locale, for which it reports an empty string, when in fact it
isn't using a UTF-8 locale, although it'll interact with the system as
if it were.

Also, the user is liable to understand "system locale encoding" as
referring to the underlying system rather than whatever they may have
configured in a local shell; and a non-native speaker assures me the
use of "shall" is also apt to confuse; so reword the messages.

As the old locale is only needed for the code path prints the
warning we can defer resolving it until we know we're going to
use it, by querying the locale at that point.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Ie6a6e7a707200e58335fcb64cb1584f0c307895a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fff9395c2899841bdca07f400392595963d9ff93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-05 07:22:00 +01:00
Laszlo Agocs
e1d4583a0c GL paint engine: Fix drawPixmapFragments when using buffer objects
Until recently the buffer object-based code path (so not client-side
pointers) was only hit with a core profile context. This changed at
some point in 6.4 and later to support WebGL (that has no client-side
pointers, unlike OpenGL ES 2.0 it is based on). Now buffer objects
are preferred over client-side pointers, always. Problem is,
drawPixmapFragment() was never functional on this code path, it seems.

Expecting that transferMode() does all the uploadData() needed is wrong.
transferMode() bails out if the mode is the same as before, and that's
exactly what happens when an application calls drawPixmapFragments()
on the painter twice, after each other.

How exactly this works with client-side pointers is not fully clear, but
presumably the data buffer address stays the same so all pointers passed
in to the glVertexAttribPointer calls are valid, and it sources the data
for each draw call (probably), thus the rendering is all correct even
though only the first, not the second, drawPixmapFragment() led to
calling uploadData() internally.

Amends e487b07e18f1cb7ff126744be57b2ae1b9839c6c although this patch on
its own is just as applicable pre-6.4 as well (to fix drawPixmapFragments
when using a core profile context).

Fixes: QTBUG-111416
Change-Id: I2ad358424e613192a51b99b937aef7660f5dbe08
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d6c5a2f9177f427d14aae64d111c172d1bf28b6c)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-05 07:21:51 +01:00
Øystein Heskestad
6f96d1785f Move xmlstreamlint example into tests/manual
This example is useful but not a typical starting point for an
application.

Task-number: QTBUG-110647
Change-Id: Ic4af8ed648c587b91110a7403fa80c619549289d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e13b57d06ab6e81cf04c090cc46dd23b4f8daccf)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-03-03 11:57:01 +00:00
Jan Arve Sæther
baaed3faa7 Move Weather Anchor Layout example to manual tests
Change-Id: I8782a83b5c12b4f57bf9ef9063818cb124bddd56
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit a84b2e5973ace6327ef38644e023e0f81fad21f4)
2023-03-03 09:44:54 +01:00
Volker Hilsheimer
72a132bbcd Remove the 'sdi' example
It is essentially the same as the other mainwindow examples, showing
how to create a text editor. The only special code here is the tiling of
the different main windows, which - without any documentation or
explanation - is neither very helpful, nor relevant in 2023.

Change-Id: I48b92b1cf057f586e0d2842d1c0a3312154e9a13
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3c104c279911419f3d0a9e6f3ac050e6f3968e7e)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 05:46:11 +01:00
Øystein Heskestad
d32e64ab75 Remove htmlinfo example
This example is removed because what it does is already covered by the
other XML examples.

Task-number: QTBUG-110647
Change-Id: If33e3fc55dcd9c7c10cfdfa86405f8bcf5cb6187
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 56b3123689be7c408d9b6c8c48648a15f0e46658)
2023-03-03 04:46:06 +00:00
Marc Mutz
7800a41a9d QDebug: fix std::string/view stream operators; add u8 versions
Make them templates, for two reasons:

- so they can accept std::pmr types and, in general, any basic_string
  with custom allocators and char_traits

- to break overload ambiguities with the Qt string view types

Also, add the missing C++20 char8_t overloads.

Also, avoid creation of a QString in the sizeof(wchar_t) == 2 case
(Windows). Add a comment to optimize for the sizeof(wchar_t) != 2 case
later.

Found in API review.

Change-Id: I30139520f582a38863a0936f8eca4b1ed33e37c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 52c7f699ac3124889b9c01fbc1fd542e30da6753)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 04:46:01 +00:00
Volker Hilsheimer
e8f7b2f151 Doc: fix link to XML Streaming page
Change-Id: Ibc8e869e140e25d7f90bd8ff922918afb3935e42
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c9dc3d7427919bc9496c1d222a29cd96955ea597)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-03 04:45:53 +00:00
Edward Welbourne
ea84a9fba9 Tidy up QCoreApplicationPrivate::initLocale()'s #if-ery
Explain each exception cleanly and as itself, thereby avoiding the
need for long and tangled #if-ery conditions.

Make sure to setlocale(LC_ALL, "") everywhere we think we have
initialized the locale, including Integrity - it plainly has
setlocale(), since we call it for LC_CTYPE - since we should at least
give it the chance to set its implementation-defined default locale,
instead of the standard-defined POSIX locale in use on entry to
main().

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Iab00984ba45dfc9a324b6a3c12e3d330b655a5a9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 91bea4470ea25c1e6fe7e46559a37bdd7b703b63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-03 04:45:49 +00:00
Marc Mutz
aec4a7d1fd qobjectdefs.h: properly disable rvalue qReturnArg()
template <typename T> qReturnArg(T&&) is an unconstrained perfect
forwarder, and will "win" for everything for which `T&` is not an
equal match. e.g. a volatile T.

Restrict the deleted overload to actual rvalues. We don't need to use
`const volatile T&&`, because rvalues never bind to `T&`, we just need
to get off using a universal reference, and adding const does that.

As a drive-by, change the deleted overload's return type to void, to
mimic std::as_const(), the prototype for rvalue-deleted function
overloads.

Change-Id: If4fbc311677b993488859b2c4e226b94daed71fe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c6dbae9550e3819a3e1ade1bf06f5d9cb030d561)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-03 04:45:43 +00:00
Marc Mutz
ce56402bce QBasicTimer: replace new qint64 overloads with chrono ones
Found in API review.

As per "chrono first" initiative[1], implement the int overload via the
chrono one, not vice versa

[1] https://lists.qt-project.org/pipermail/development/2023-January/043563.html

Change-Id: I65fe7039ad8ae5f9eb21d9c59a46b9c5c152fac3
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 5573e2d6ac09ff8b8f23edca93f601ff7679fa3c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-03 04:45:38 +00:00
Volker Hilsheimer
6c5b7839b9 Doc: point at tetrix example for QBasicTimer usage
The wiggly example is gone, but tetrix shows how to use QBasicTimer
as well.

Change-Id: Iaad78b0d7e2136ef41d98f634d0680e6f7f3c4e1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b7b712181bd47a84640a655100661c4aa008c6e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 21:22:49 +00:00
Volker Hilsheimer
e3d9ebb97c Doc: move snippet for implicit translation context
The 'sdi' example is a candidate for removal, so point at the
spreadsheet example instead, which is not.

Change-Id: I4405f2421db8be79898a38ca4f3fa1ea5fe0280b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 721b4a4b5a8b4e16d50690e0d9ca62725c3ddafb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 21:22:43 +00:00
Volker Hilsheimer
fcd990e2e7 Doc: fix link to Widgets Tutorial
It's been a while since we had a single Tutorial for all of Qt.

Change-Id: I7317291c445c09b0bf728513670b6a575dd536bc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a776aea7aacfcb11a14afcb4fe8cd3edfbf86b37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 21:22:41 +00:00
Tor Arne Vestbø
d8269a96b8 doc: Fix spelling of 'equivalent' in QString documentation
Change-Id: I1d39bee80fbaf3e3e6eb5e383fd845bb0f9071e5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3154aec540b29827173d9de0ef7aad30849e6890)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 21:22:36 +00:00
Marc Mutz
c773473d75 qobjectdefs.h: optimize AreOldStyleArgs
Use a template alias instead of C++98-style inheritance.

Saves one template instantiation.

Change-Id: I95ee9cf1e5eac1db5fc8e05cd95f5e745134214d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b37b820ce8801613139241036d15baa581a6a403)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 20:11:17 +00:00
Marc Mutz
bb115cc21d Apply q20::remove_cvref_t around the code
Found in API review. It's not BC-critical, but let's get this into 6.5
to minimize the diff to our future LTS.

Change-Id: Iaa63afad1d31f6edef29e1185897d925f47a094d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ebb833d7f70465844e474583571770ad14adcebf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 20:11:16 +00:00
Assam Boudjelthia
95ee8d3bc7 Android: fix and document QStandardPaths behavior on different versions
Partially revert e1440dd7bc1a5da9a536f88b9733d04ec8fa6e61 for Android
versions below 11 which could take advantage of the manifest
flag android:requestLegacyExternalStorage. And for other newer versions
avoid returning them while adding a note to the docs about this
behavior.

Fixes: QTBUG-108013
Fixes: QTBUG-104892
Task-number: QTBUG-81860
Change-Id: I10851c20e2831bddaa329164c941e2ae71f0a497
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 81a748efb742092f5a0a1c33b8340478e52cc79f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 20:11:14 +00:00
Marc Mutz
b4fe493a79 QVarLengthArray: move a static_assert() to the correct place
Having the Prealloc > 0 assertion only in the QVLA(qsizetype) ctor
makes no sense. Prealloc > 0 is mandated by the class as a whole, not
that particular ctor, so we shouldn't delay the assertion to the
instantiation of this ctor.

Move it to class scope instead, alongside the assertion for
nothrow-destructible.

Change-Id: I0225a4533841e5b433a3d9781b2642c084f775ab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0f447e875da42f62cf8533e78435b7b24ca41ae0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 20:11:09 +00:00
Marc Mutz
2822ac9c91 tst_qvarlengtharray: add test for QVLA(n) ctor
Also add one for types that are neither copy- nor move-constructible.
In contrast to resize(n), the QVLA(n) ctor worked for such types, so
make sure it stays that way.

Change-Id: If54fbc9dd6a4808175c4bcb0ffb492b33c879746
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e7c792ba7179c4c81fb2e26f66031ec81234b0d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 18:15:03 +00:00
Marc Mutz
8714ae353a tst_QMutex: use constexpr variables instead of 'enum-trick'
C++20 doesn't like arithmetic with enums anymore. While this hasn't
caused immediate pain, yet, fix it pro-actively for an imminent patch.

As a drive-by, fix the missing space at start of comment.

Change-Id: Id08bb227c587bc7b900c593a7b6d2655ca32eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b8966021ffb2cfddc77aee6dbe145eb74ef22f9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 18:15:00 +00:00
Volker Hilsheimer
5accb5ba49 Doc: fix links to renamed network examples
Change-Id: I8790bb660070a092e268294b5640c6d5af41deb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a02fb41c8ee039032045cbad02dd4f1dc3887d2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 18:14:55 +00:00
Volker Hilsheimer
f742631b98 Doc: we no longer provide a list of common mnemonics
Remove the claim from the QKeySequence documentation, fixing the
respective qdoc warning.

Amends f10ae4b887f6652dcad95516ded43f2e2994e88f.

Change-Id: If234cfb0a6b7dc20fb10e623cc3ee2ec167f22c9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 1e50420354fc717b665cb8398658e97b89a7f953)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 18:14:49 +00:00
Volker Hilsheimer
ae7fbe7871 Doc: point at fetchmore example for QDir usage
The Find Files example is gone.

Change-Id: I63bc33c3b9db7c8bfcf07fbcee0182a492c01dbd
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b6fae509aae9145019fce344a2aa11cde8d1249e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 17:31:51 +00:00
Assam Boudjelthia
a582295604 Android: document limitation for QFile::copy() operation for content uri
Document that the operation is not supported.

Task-number: QTBUG-98974
Change-Id: I1faacb7af7e11943d6da62313ed104fda063d30d
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 7af39be05295c5743d04ef83468a0d250141b145)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 16:20:51 +00:00
Paul Wicking
65843a6c92 Doc: rewrite shortcut focus section
As pointed out in review, somewhat contradictory advise.
Rewrite the section to be more active, focus on the user and
their application, and a bit more consistent.

Change-Id: Idbbf29d3033d32ade553290a2e89bd778876224c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7273a0eacc235c5b28394c064cdfc3fa72f0ef5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 16:05:25 +00:00
Ilya Fedin
9467141a9b Rely on Windows to generate CF_TEXT when active code page is UTF-8
It's possible since Windows 10 1903 to set the active code page
to UTF-8 using the manifest. In that mode, QString::toLocal8Bit
converts to UTF-8 and the legacy programs not using UTF-8 codepage
can't interpret the value.

We can detect whether the UTF-8 code page is used, and in that case
only provide data as CF_UNICODETEXT. Windows will then synthesize the
CF_TEXT format when the clipboard data is consumed, using the right code
page for the target application.

https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

Change-Id: Ie024a618556d9bb5b5c7ac70507d279b959ff6db
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 481771a331b904810ce3da459d4b6293a83fcec0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 16:05:23 +00:00
Antti Määttä
b7c6654987 Document tracing location android meta-data
Change-Id: I13467f022f1a3646315f2c0319e54db82d41e2c7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 25d15948f8801d71d446353f6e97f6086bcecb74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 15:36:17 +00:00
Ievgenii Meshcheriakov
f9ec287412 pingpong example: Remove pong.h
Move the class definition inside pong.cpp.

Task-number: QTBUG-111366
Change-Id: Id4b376451cb2bdbd04ccce4b2dcf0760dbfbfb2a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f952e74cfea438a5a411454cb50d470cd5928be7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 11:37:40 +00:00
Ievgenii Meshcheriakov
63dc68a2c2 pingpong example: Modernize the code
Use qWarning()/std::cout instead of C IO functions.

Use default parameters for QDBusInterface's constructor.

Remove useless Q_SCRIPTABLE.

Use type-safe invokeMethod().

Extract a local variable for the used D-Bus connection.

Task-number: QTBUG-111366
Change-Id: Idc38a7c1dd97d71308d9491193039744c759d6f2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 07b8a5a4093ecb69ced47b67cbcac5121064fe5e)
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-03-01 12:37:40 +01:00
Amir Masoud Abdol
32124d3705 Avoid resetting CMAKE_AUTOMOC_MACRO_NAMES
Instead of overwriting the CMAKE_AUTOMOC_MACRO_NAMES, we try to append
our desired moc names to it, and don't get rid of what's there.

Thanks for Friedrich W. H. Kossebau for filling a descriptive bug report
and offering a solution as well.

Fixes: QTBUG-110497
Change-Id: I582af431151cacfe24085b890ae9dba0a0e53f3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 38ee9ee8497291c899c2a72e0ed24bfffe9ced4e)
2023-03-01 11:37:40 +00:00
Ahmad Samir
2c117edf7c QString: change test data to compile with QT_NO_CAST_FROM_ASCII [8/13]
Change-Id: I72ebb7bb19e35a10aa85ea7da6ee6b1b332050a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 448683809bc0dd7deb3b939d8a2e95e61e67e948)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-01 13:37:39 +02:00
Eskil Abrahamsen Blomfeldt
785e8fde49 Update to Freetype 2.13.0
Also adds a file to patches which is a required modification
to the update in order to make it compile.

Fixes: QTBUG-111536
Change-Id: Iaabc1b7736cfd98217a8aff2b7f9bc65402d0451
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18aa3309a4e4b5a874298af1243095db9aa207d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 08:52:26 +00:00
Eskil Abrahamsen Blomfeldt
f7a874ca48 Update Harfbuzz to 7.0.1
Note: 6.4.x update has to be done in a separate commit
because it did not get the update to 6.0.0, so the
cherry-pick will not apply.

Task-number: QTBUG-111535
Change-Id: I9d4aae98f8267827ec983ca89b1310006c6aee78
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a6edf9cbe5bd1d1c6bc08733f97fc07812126bde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 08:52:26 +00:00
Thiago Macieira
6cfd299084 tst_QTimer: suppress the cross-thread timer stopping warnings
Both QTimer's and QObjectPrivate's destructors print a warning if the
current object lives on another thread and has an active timer:

QWARN  : tst_QTimer::moveToThread() QObject::killTimer: Timers cannot be stopped from another thread
QWARN  : tst_QTimer::moveToThread() QObject::~QObject: Timers cannot be stopped from another thread

This timer is used to ask the thread to quit, which in turn allows us to
destroy this QObject without a cross-thread warning. Because it's
already fired once and done its duty, we can make sure it's not active
by simply making it single-shot.

Change-Id: Ieec322d73c1e40ad95c8fffd17465067b27c044b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5f32c9edce208125f642c86a4bc9e73564386243)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 08:52:26 +00:00
Thiago Macieira
2ac4e797a9 QThread/Unix: move qt_nanosleep to qthread_unix.cpp
It's the only place that uses it.

Change-Id: Ieec322d73c1e40ad95c8fffd17465370ac209c2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit cf059ac9ece88a70eb4f582f3f9cf80186cc69a1)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-01 00:52:26 -08:00
Oliver Wolff
9ff5b886fa Windows drag&drop: Use correct window for drag target processing
GetFocus will return the window that currently has keyboard focus. This
is not what we want for drag and drop handling though. Use the window
under mouse and process events for that window when doing the touch/pen
input workaround. If no window is found we fall back to the focus
window. Followup to 31e7790102b260344893eaa8bf8b7b1a0f95e3b7

Fixes: QTBUG-111149
Change-Id: Ib8233debc267df0cc19b21c1dc5c6881d018d84a
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit c912bde52a1b85a782db6aed8d6f9917d597f58b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 05:29:57 +00:00
Andy Shaw
9a1a7e4965 SQLite: Update SQLite to v3.41.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.41.0

Fixes: QTBUG-111539
Change-Id: Ia90939bf57222a290fe7bcb3741013c2576eec13
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8f33a0424f5799a87d6d56691f3e47a09156c720)
2023-02-28 21:39:32 +00:00
Christian Ehrlicher
42cbf42a75 SQL/OCI: use QDateTime::toString("ttt")
Use QDateTime::toString("ttt") which is available since Qt6.5 instead
own implementation

Fixes: QTBUG-111275
Change-Id: I41676d3a327c5aaabdeb4f54b9d169e228c482e1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 79b22bb1f3ba51f37de03faefc7ddcd712e8e385)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:14:29 +00:00
Santhosh Kumar
7b96dad1e9 Add API in QWindowsPrivate to provide window palette
The window uses default palette (QPalette()) to determine frame
color (either light or dark). This doesn't work for quickcontrols
as they depend quicktheme palettes and they don't overwrite default
palettes.

This patch add API in QWindowPrivate to provide palette for window
and this can be overridden by quickcontrol windows to provide
their corresponding palette.

Fixes: QTBUG-111491
Change-Id: I39eea20ee7c61ecf0279143c9784da35be15edd3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 170fadadd67fa97621a7782ea845c314bd9ee09d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:54 +00:00
Volker Hilsheimer
8269d5cd82 Remove unneeded include of qfloat16.h
Amends 5838074912905686475a2cb4ae9780c2532d424b.

Change-Id: Ib591aeb9ecb2f7910cd6fe50f578f283b9acd6ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b0eeed1fd10347767bf259415ecc5cb241d90353)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:53 +00:00
Volker Hilsheimer
0e5e7acca8 QAbtractItemView: deselect before click opens editor
A click on the selected item should deselect all other items before
editing starts.

Remove the part of the test case that assumes that we can have multiple
items selected in ExtendedSelection mode, and click on an item to start
editing while maintaining selection. That can never happen.

Fixes: QTBUG-111131
Change-Id: I0312eed4614502cfb77eca26d3f7615427493d7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3f2d02e2f4436ace5f0fbbf432878a963f5ee969)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:53 +00:00
Volker Hilsheimer
acb0cb62fe QAbstractItemView: execute posted layouts before painting
tst_QListView::moveLastRow asserts now and again, unless only that test
function is running. We repeat failing test functions individually, so
this never blocked CI.

The reason seems to be that we get a paint event only for the viewport,
after the item model's structure has been changed by the test. Moving
rows does trigger a delayed layout, and in some circumstances the
entire view is updated, rather than just the viewport. But if only the
viewport is updated, then layout execution in QAbstractItemView::event
never happens, and the data structure that the paintEvent implementation
relies on is outdated and contains invalid item pointers, resulting in
an assert.

If we need to execute delayed layouts when the entire view gets painted,
then we also need to execute them when only the viewport gets painted.

Change-Id: Ibb46c2315825d99c82b884226817c494a3d95975
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 85ab3f26656b2b51eaa5b5247cc0d90d401fd8df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:53 +00:00
Kristoffer Skau
84f5dcf4ec Increase cache size for QOpenGLTextureCache
Currently images that does not fit in the cache will be destroyed, which
is unfortunate. 256 MB cache is too small for todays standards, so
increasing it to 1 GB. Also adding an environment variable so that it is
changeable if required.

Fixes: QTBUG-111498
Change-Id: I70c65cad6219a59102b16abc50f098aa0b017314
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 55568b8c626576726c6c9138c8044ea52bc3a355)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:53 +00:00
Amir Masoud Abdol
fde53406e1 Align qt_internal_add_manual_test with qt_internal_add_test
They now share their implementation. Manual tests can be created by
passing the MANUAL arguments to the qt_internal_add_test as well.

Fixes: QTBUG-111382
Change-Id: I1c207b7e4a67526554df1ee43fe032bb20fc92fa
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b6bc4199ec866a326f94ae86f3a35b73bc3eb30e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 19:02:53 +00:00
Christian Ehrlicher
fb004f0f44 SQL/OCI: Correctly calculate utc offset string when icu is not available
When ICU is not available, QTimeZone::displayName() does not return a
valid timezone offset string so the OCI driver will get a wrong utc
offset string and inserting a QDateTime will go wrong.
Fix it by creating the utc offset string by ourself (toOffsetString()
inside qdatetime.cpp is static and therefore not accessible for us).

Fixes: QTBUG-111275
Change-Id: Ib724d760688614e162246e1e028ee5e004cc9477
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6b9977c4adfa0ffd9cb87b4aec288c7a335aef6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 16:25:31 +00:00
Mårten Nordheim
655fdae123 QtConcurrent: yield CPU when spinning on atomics
Change-Id: I3eef19d8737da60bee40385a64a1bc136d2e7329
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ee1651efdd32dfb96443828ddaeddccb3e4e3648)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 16:20:46 +00:00
Mårten Nordheim
7f2efb1d9c Fortune* Example: update screenshots
Fixes: QTBUG-108875
Change-Id: Ib57482959973815681b0b178acea3634a4f63220
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 97dcf1ba1865934b7d047d573443e804699a05e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 16:20:46 +00:00
Laszlo Agocs
593d63b005 Remove threadeqopenglwidget example
It is neither documented nor very useful, and it has
platform-specific issues as reported over the years.

Remove it now as part of the example revamp initiative.

Task-number: QTBUG-50278
Task-number: QTBUG-110093
Task-number: QTBUG-76054
Task-number: QTBUG-43209
Change-Id: I6dadaf4162b4c19411c544b9f204c19e37aa740d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 6462a454e3d53c3711817b510cff59c136711b9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:46 +00:00
Volker Hilsheimer
73e139c447 QtGui: Use single precision for mouseMove detection
QGuiApplication::lastCursorPosition is a QPointF, and (at least on macOS)
compares always different from the QPointF stored in the event. This
might be due to the translation from system coordinates to QPointF
introducing noise.

The result is that even a simple button press causes mouseMove events
to be delivered.

To prevent this event noise, overload equality operators for the special
QLastCursorPosition type when comparing with QPointF to explicitly use
single precision comparison.

Fixes: QTBUG-111170
Change-Id: I82ea23ac9f4fa80c55c9c5c742527dd7ee74fd99
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 519e3963fad0761bac5629b1f6eabc58060265c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:46 +00:00
Volker Hilsheimer
bae383002a QListView: Reset style after using a temporary proxy
Amends 0242be90606b377864c6fd02d5a8e0afaf635acf, and removes unwanted
side effect of having a modified style behavior for later functions.

Change-Id: If3dff0d7ab9e6c6c10e7a92d0a3eaff98fa1457f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f75b29fbbde79d66ee539162441a007a90035b96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:46 +00:00
Jan Grulich
a44e0ca93c Fix QCH:supportsAlgorithm() result for unsupported hashes in OpenSSL
OpenSSL doesn't support some Blake2s and Blake2b hashes and querying
these would automatically report that they are unsupported, while we are
actually using non-OpenSSL implementataion for these and therefore they
are always supported.

Change-Id: I300694459891c3103502705d6c8271caa47d8d01
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 86a517ac786c90b9ce8deb502c413287e31058c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:46 +00:00
Marc Mutz
54aedff72f QMessageAuthenticationCode: use QCryptographicHashPrivate in finalizeUnchecked()
... basically inlining static QCH::hash(), which, however, accepts
only one piece of data, while we have two.

Avoids the memory allocation of the QCH d-pointer. The toByteArray()
is now the only memory allocation left in finalizeUnchecked(), and
will be removed in a subsequent commit.

Change-Id: I7549d6e1c116a4cdc29dac74b867dfa6647022a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d235953a82bf8df5a6011dcf55331e287f0e6e65)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-28 14:31:46 +01:00
Marc Mutz
080f2654bb QCryptographicHash: don't include openssl/sha.h
... it conflicts with rfc6234/sha.h's SHA{1,224,256,384,512} symbols.

We can't drop the rfc6234/sha.h header, as openssl/sha.h doesn't give
us the algorithm's block sizes, necessary for HMAC
(QMessageAuthenticationCode).

But we can drop openssl/sha.h. The only reason we included the header
was to get access to SHA<N>_DIGEST_LENGTH, but this is a well-known
value and easily obtained from rfc6234/sha.h as SHA<N>HashSize, so use
that.

Even reduces #ifdef'ery.

Amends d9f9d03fd34d951eb587fe082a0dbda33b8df248.

Fixes: QTBUG-111467
Change-Id: Ice19ad8c788fb2828666647cc40abb894cd7af2b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e388d219a4a29e7a5a81ff1a6dcf995662177b43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:45 +00:00
Marc Mutz
4d2c4ff384 Merge qmessageauthenticationcode.cpp into qcryptographichash.cpp
They share so many things, and QMAC is lacking so many of the changes
QCH has received over the last few months, that it seems QMAC is
better off being implemented in the QCH TU.

Among other things, this will allow QMAC to use QCHPrivate for its
implementation, drastically reducing the number of memory allocations
required to perform HMAC operations.

Change-Id: I3c81a52e3a9ad57c14c91c16bc347f215fd407ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d9f9d03fd34d951eb587fe082a0dbda33b8df248)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:45 +00:00
Doris Verria
dee2d5a885 Examples doc: Tag 'To Do List Example' for iOS
All QtQuickControls examples are marked for android by default.
However, the To Do List example is iOS specific so don't include it.
Add it to the list of iOS tags instead.

Fixes: QTBUG-111426
Change-Id: Ic89d6b40d263f81ed402a2064f2e44b2fa826940
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 276bf8cb239a678e9c9b4b5b36cfa7015780b292)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-28 14:31:45 +01:00
Amir Masoud Abdol
d8a87b6942 Remove qmake files that provide support for building Qt modules
Repeating the body of the reported bug, "Building Qt modules with qmake
is unsupported in Qt6 and since 6.5's switch to syncqt.cpp broken."

[ChangeLog][qmake] Support for building Qt modules with qmake was
removed.

Fixes: QTBUG-110134
Change-Id: Iee5aa5c85f7106bce742df448ec502e6cc039454
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 863eb576c879e0284e794b60ff8450c468f6ae3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-28 13:31:45 +00:00
Volker Hilsheimer
14eacdaf24 QStyleSheet: never treat styled scrollbars as transient
If a style sheet is applied to a scrollbar, then we cannot treat it as
transient, as the QStyleSheetStyle doesn't implement any fade-in/out
animation logic. And we also need to set the overlap to 0 (in both
the style sheet and the macOS style) if the scrollbars are not
transient; otherwise the opaque scrollbar will be placed on top of the
content.

Since a style sheet might only apply to a scrollbar based on its
orientation, we also have to pass the style option through to all calls
of the styleHint function.

And since that function is also called from other QStyle implementations
in the macOS style, we have to make sure that we call styleHint() on the
widget's style to get the correct value based on the style sheet.

Fixes: QTBUG-63381
Change-Id: Ic67ce3a7cb5089f885dabfd5a1951e3029915446
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f5105ea89a76d6051f058834d99385582cc61f85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 18:26:38 +00:00
Ievgenii Meshcheriakov
aa5b3da439 chat example: Update code style
Use lambdas instead of slots where practical.
Consistently use signals to transmit D-Bus messages.
Extract a local variable for the used D-Bus connection.

Task-number: QTBUG-111366
Change-Id: Icc6667e1392ada1b7d3b33c4e4b32917dd648390
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 742e79312fc98711f68749937d0db433d961f546)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 14:55:39 +00:00
Ievgenii Meshcheriakov
47b372ae8c chat example: Remove empty destructor
Task-number: QTBUG-111366
Change-Id: I880c16638c992a4ee8528b1c545e6f563a7efa8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 57d25b3a535736aea7edcec1f8466984e36822de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 14:55:32 +00:00
Ievgenii Meshcheriakov
9e2d03eec3 chat example: Remove commented-out code
Task-number: QTBUG-111366
Change-Id: Ib8e89427357f604ab30cb0de50eb373cffb945fa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fd03a04457294b934525c5ca6c8a670cc18b1194)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 14:55:26 +00:00
Ievgenii Meshcheriakov
2f15ece9a7 chat example: Use QInputDialog to get a user nickname
This gets rid of a custom form. Also quit the application if user
closes the input dialog without entering a nickname.

Task-number: QTBUG-111366
Change-Id: I56ed99d69d031e7ef06711fc7ec112311c974ca6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8b4865759029250d0f75c84ca0b1312429d24086)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 14:55:20 +00:00
Marc Mutz
da062aeda4 tst_QMessageAuthenticationCode: check that setKey() reset()s
It's documented as such.

Change-Id: I7299d289117e52dcefe3c4ab917d7ecad6dd02be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a62aa1817863880fd340aab54d5b86aa4f8b1e53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 07:19:27 +00:00
Thiago Macieira
2ae0c1c390 QDeadlineTimer: add a few missing default template parameters
I don't think any of these make a difference because the Duration is an
implied parameter because of the time_point arguments, but this makes
the code match QDeadlineTimer::deadline<T>.

Change-Id: Ieec322d73c1e40ad95c8fffd17468a41182944ab
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ec2c27d59635e123a3c159fd30d90ec30a6d63cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 03:18:42 +00:00
Thiago Macieira
98bb68addd QElapsedTimer & QDeadlineTimer: use NSDMI for their two fields
Change-Id: Ieec322d73c1e40ad95c8fffd174654d643c05097
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 81783d02e89ee5ad49559bd9f0d7119180e86188)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 03:18:31 +00:00
Ivan Tkachenko
86aa3d8f3b Doc: Fix typo in word mnemonic
Change-Id: I7e667e29742d4672c445f8f42a04d81579112213
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aa111ada0809d7d60d333d7c6479f859c81c3af3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-27 00:01:48 +00:00
Allan Sandfeld Jensen
61b8e334d2 Add special thread pool for Qt Gui
To avoid gui slowdowns due to global pool being blocked.

Fixes: QTBUG-109511
Change-Id: I4e8d91e8fb0bd2e395072a082e992a3c5d3464ad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 93047c71e8e6dd4ac28e1e59dcb561df11c759eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-26 17:43:15 +00:00
Sharaf Zaman
c1c201025e Android: Set TMPDIR to point to cache dir rather than a persistent dir
Otherwise the app size keeps increasing. This is consistent with
QStandardPaths::TempLocation.

Fixes: QTBUG-98502
Change-Id: If4f0bd7a84443fe80a026b5f4443a38c32a7c836
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b8d51001f7d1c40cced642b4a1d990c90244706f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 15:45:20 +00:00
Antti Määttä
6ab021190c Do not add trace_location meta-data by default
Instead document the meta-data and let the user set it.

Change-Id: I13c9cd0129ffeef7b72635f46f53cf3dbfcf6684
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit eb85a5eee7632b0f798abbb9b9428ad27f53bec1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 15:25:30 +00:00
Ivan Solovev
cd090868f0 Add QtConcurrent Examples page
The QtConcurrent examples were only discoverable from the
"All Qt Examples" page, which was very inconvenient.

This patch adds a separate page for all Qt Concurrent examples, and
links to it from the module's main page.

Change-Id: Iecabd9e21033605c1ec74232ce4f3d68b0c78d82
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit 2a4c64cbedad0db25c057456491df6ce86beeee7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 12:51:16 +00:00
Nicholas Bennett
e68a5e272b Update android deploy qt command line argument documentation
The qdoc file now quotes from that main.cpp file, so this
means the help information only needs to be maintained in
main.cpp.

Fixes: QTBUG-109178
Change-Id: I5bb633f66d92c36593ec6b0aaf9cacd57d4ce352
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 32ad980014484819ec33d2eaa97c096077e4c49a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-02-24 12:51:16 +00:00
Ville Voutilainen
5da099ecea androiddeployqt: make --help documentation-friendly
Change-Id: I08558d23230ec162928fea2c413ae8e2498617d7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 1ebf8c529d6894afca156d7e27863d2582c4cab2)
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-02-24 12:51:15 +00:00
Joerg Bornemann
c766788155 windeployqt: Remove hard-coded information about modules and plugins
Windeployqt now reads modules/*.json and translations/catalogs.json to
determine the available Qt modules, Qt plugins and their corresponding
translation catalogs.

This patch removes the hard-coded information that was used before. Now,
we don't have to update windeployqt anymore to teach it a new Qt module.

Fixes: QTBUG-109841
Task-number: QTBUG-106342
Change-Id: Ib7b7f44ca7d40d0c73d717d8494367af412ebdbe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3c66def23fd8069835c8aba7710ec7f7cad68aa7)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-24 09:06:46 +01:00
Marc Mutz
e23f88bac2 QVarLengthArray: fix UBs in insert(it, n, v) ([basic.life], invariants)
In the same vein as e24df8bc726d12e80f3f1d14834f9305586fcc98 for
emplace(it, v) and insert(it, rv), this patch addresses the identical
issues in insert(it, n, v). The solution is unsurprisingly the same:
q_rotate() after a resize(size() + n, v).

The 6.2- code will need to look different, because resize(n, v) didn't
exist there.

Change-Id: I1ce91969abc20f2a1e5d05a8545b009a2e0994f6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fed5f2445480f7cf045e93761dc902f771cbf3da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 08:02:34 +00:00
Marc Mutz
6cd37869ca QVarLengthArray: Extract Method QtPrivate::q_rotate()
It seems like we'll need this in lots of other places, too.

Change-Id: I767495c2eb02a2fc85b6f835ad9003fa89315c7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 147dd6e82f41778060bdadf9b2a792bd11e1bc1e)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-24 08:02:31 +00:00
Fabian Kosmale
96baa991be Avoid accessing deleted binding data in grouped updates
This fixes a use-after-free in QPropertyDelayedNotifications::notify.

Before this patch, evaluateBindings or a notify from a property index
might have caused the originalBindingData to become reallocated.
However, at that point, we've already restored the original bindingData
in evaluateBindings, so we won't track updates, and thus won't adjust
originalBindingStatus, which will then point to already freed data.

To remedy this, we no longer do the notification with data fetched from
originalBindingData, but instead use the information we have in the
proxyData.
We also need to enure that referenced bindings do not get deleted; for
that we keep the PendingBindingObserverList alive for the whole duration
of the endPropertyUpdateGroup.

As we now have the PendingBindingObserverList, we use it for the
notification logic, and only notify change handlers in
QPropertyDelayedNotifications::notify. That will allow a follow-up
cleanup of QPropertyObserverPointer::notify, and aligns the logic for
grouped updates with the logic for "nornal", non-grouped updates.

Amends f1b1773d0ae636fa9afa36224ba17566484af3cc.

Task-number: QTBUG-110899
Change-Id: Iae826e620d9614b7df39d86d8a28c48c8a5c4881
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7a415a051a464ee3145c11b4ff44dbb16010323e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 04:51:25 +00:00
Allan Sandfeld Jensen
cc473646ec Warn that computational time follows length of text input
We have no reliable way of cutting the text shorter without side-
effects, so leave that to the users.

Task-number: QTBUG-109838
Change-Id: I280d2dec9d6e0cd6b4d57edac231ae99420d8569
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit bea15cdfa4de5fb9fa1614ef93b54df7139423fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 04:51:25 +00:00
Yuhang Zhao
0d6a02bb78 Fix qtbase build when all deprecated code are disabled
Adjust the callers to use the non-deprecated APIs.

Change-Id: I8e96f25684a2d613bc400a8626dc9e3af2bb8dcf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f7fd5eaf95c964956b2b353784105c89950ffff2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 04:51:25 +00:00
Joni Poikelin
591415a2f5 Fix crash with removed menus
Fixes: QTBUG-111388
Change-Id: I9c9f0ad5cc02293197d7e77eeeec3ffa9d72a4af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8dfca2ee717289b334b7ec7a5a9cc9a3d8e9654a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 04:51:25 +00:00
Joerg Bornemann
dd7575b5f0 CMake: Fix position independent code linker flags not being set
We set CMAKE_POSITION_INDEPENDENT_CODE to ON and require CMake 3.16.
This sets CMP0083 to NEW and should pass -fPIE to linker calls as well.

However, the PIE-enabling flag is not passed to the linker unless we
call check_pie_supported(). This behavior is documented in CMake's
CMP0083 documentation page.

[ChangeLog][CMake] Qt tools are now built with position independent code
even with Unix toolchains where this is not the default, for example
clang.

Change-Id: I1d98e0ea7063a76e3fddc94d6555c6eaf14c7885
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4183768d9bc6f80ac7b86c3dbf93e6b251369ae4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 04:51:25 +00:00
Thiago Macieira
8b2a4fb5a1 QHash: fix GrowthPolicy::bucketsForCapacity
It was confusing entry capacity with the bucket capacity. The value
maxNumBuckets() returned was the maximum number of entries. This issue
was harmless: we would just fail to cap the maximum to an allocatable
size. But the array new[] in the Data constructors would have capped the
maximum anyway (by way of throwing std::bad_alloc).

So instead of trying to calculate what the maximum bucket count is so we
can cap at that, simplify the calculation of the next power of 2 while
preventing it from overflowing in our calculations. We continue to rely
on new[] throwing when we return count that is larger than the maximum
allocatable.

This commit changes the load factor for QHashes containing exactly a
number of elements that is exactly a power of two. Previously, it would
be loaded at 50%, now it's at 25%. For this reason, tst_QSet::squeeze
needed to be fixed to depend less on the implementation details.

Change-Id: I9671dee8ceb64aa9b9cafffd17415f3856c358a0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1d167b515ef81ba71f3f47863e66d36ed6d06c1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 02:19:53 +00:00
Thiago Macieira
eca3d0902a tst_qmessagehandler: fix QtTest warnings about duplicate row names
Change-Id: Ieec322d73c1e40ad95c8fffd17464fcb2ca96f5f
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit e836c4776fd74d9f48997f5c9314f204709e2cf1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 02:19:42 +00:00
Thiago Macieira
481f1ed519 Logging: fix crash when decoding a symbol that isn't a function
Saw this on my FreeBSD VM. The backtrace() function thought the nearest
symbol to something was "_ZTSNSt3__110__function6__baseIFbPvS2_EEE",
which decoded to

 typeinfo name for std::__1::__function::__base<bool (void*, void*)>

The function pointer type inside parameter threw the decoder for a loop
and caused it to crash with the failed assertion in qbytearray.h:

 inline char QByteArray::at(qsizetype i) const
 { Q_ASSERT(size_t(i) < size_t(size())); return d.data()[i]; }

I noticed this
 - because tst_qtimer hung
 - because qFormatLogMessage deadlocked acquiring QMessagePattern::mutex
 - because the logging recursed
 - because qCleanupFuncinfo failed an assertion while formatting the
   backtrace (my QT_MESSAGE_PATTERN has %{backtrace})
 - because QTimer::~QTimer -> QObject::killTimer printed a warning
 - because tst_QTimer::moveToThread produces warnings

Change-Id: Ieec322d73c1e40ad95c8fffd17464f86e9725991
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 644c06b48f45aeabcd594df4dcf25a44ea02f132)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 02:19:40 +00:00
Marc Mutz
46872238ea QCryptographicHash: move SmallByteArray out of Private
Rename it to QSmallByteArray, and make the maximum size a template
argument. Initialize m_size to 0, to avoid a partially-formed
default-constructed objects (default-constructed containers should
always be in the empty state).

As a drive-by, fix placement of some {'s.

Don't move it into a header of its own, yet, as it lacks a lot of
features expected of a generally-reusable class. Maybe one day.

This is in preparation of re-using the class to hold the key in
QMessageAuthenticationCode.

Change-Id: Iee77e03e50afdf2ebc5889feeead344bef8ab3e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 29050fa65b7c755ec3238ff0cc238c626832bc8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 00:10:57 +00:00
Marc Mutz
d90ad97e8b QCryptographicHash: move result.clear() to beginning of reset()
... from the end().

It was lonely down there, and prone to be overlooked when performing
early returns in the #ifdef'ery above, as witnessed by the early
returns in the OpenSSL3 code.

Amends 1fe74c3bd3f727551b8168ee9f3e642d42233d55, itself amending
633c1365966eda89fc883c039683a727d0a0813e.

Change-Id: I8c941ecb5c4755d8823b2161544cf6f7fe75a239
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a18ca59ffc93b6e4b18a64c624ab396e3976f60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 00:10:50 +00:00
Thiago Macieira
6d971d01b3 QFileSystemWatcher/Win: remove the pre-QFileInfo path normalization
It's completely unnecessary, since QFileInfo will query the file system
anyway and that has a much better view of what is normalized and what
isn't. More importantly, this fixes the mistake in failing to normalize
properly in removePaths(), which removed the ending slash of a root
directory such as "C:\\". That caused the path to become "C:", which
QFileInfo interprets as "current path on drive C:".

[ChangeLog][QtCore][QFileSystemWatcher] Fixed a bug that prevented
removePaths() from removing the root of a drive on Windows.

Fixes: QTBUG-110986
Change-Id: I9671dee8ceb64aa9b9cafffd17419b6d69670876
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6d1769791348e9387e0c5f29d970131895888814)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 20:41:00 +00:00
Thiago Macieira
814d639b66 qmath: add qNextPowerOfTwo(unsigned long) - for size_t
This completes the triad uint/ulong/qulonglong, ensuring that one of
them will be size_t and one of them will be uintptr_t (size_t and
uintptr_t don't have to be the same type). The signeds ensure one of
them will be ptrdiff_t too.

Change-Id: I9671dee8ceb64aa9b9cafffd17415a0bfcbd68b7
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 85c69f023fe281b7f16e1a93e61be4432f7fef9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 18:03:39 +00:00
Marc Mutz
c42a22e15e QCryptographicHash: make narrowing in addData(QIODevice*) explicit
QIODevice::read(ptr, n) returns qint64, not int. The returned values
are, however, confined to the interval [-1,1024], so no harm
done. Make the narrowing explicit, though.

Change-Id: I5f95292ca6e05f0f402e7258e590593eff361255
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 303caa40da6cee296ffcee3ae13b88d788a2e225)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 17:59:34 +00:00
Marc Mutz
0f3c62ab2a QCryptographicHash: Extract Method finalize() from resultView()
This brings the code in line with the sibling code in
QMessageAuthenticationCode, which now has a simiar split between
finalize() and finalizeUnchecked().

Change-Id: I10701d59d56617ab32fae0df47371f0464e9cc77
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a77e9d671d3ff056a7989f31305c9351d89f111c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 17:59:33 +00:00
Marc Mutz
9a289b7271 QMessageAuthenticationCode: apply the QCryptographicHash::hash() optimization
... of creating a Private instead of the public class on the stack.

This avoids its memory-allocation, as well as the overhead of the mutex
in finalize().

Task-number: QTBUG-111347
Change-Id: I4d144fcfadc0b8c9ba78d395ff7279b2d5d7b050
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d32d2137b7d513f38450d3a5e07a997c3bc90aa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 17:59:33 +00:00
Amir Masoud Abdol
2f7e6b3448 Fix a typo
Change-Id: I13c344113c2e924dbe43995affe9b1aa3647f2aa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a1782c149215623c8db3e429112385ea60ec23c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 17:59:33 +00:00
Marc Mutz
f28275617f QMessageAuthenticationCode: fix result() non-re-entrancy
While QMessageAuthenticationCode is not copyable, result() is
nevertheless const, so a user could prepare a
QMessageAuthenticationCode object with setKey() and addData(), pass it
by const reference to two threads, which each just call result() on
it. This should be safe, but because result() performed lazy
evaluation without being internally synchronized, this would cause
data races.

Fix in the same was as b904de43a5acfc4067fc9e4146babd45c6ac1138 did
for QCryptographicHash. See there for a detailed discussion of the
solution.

Fixes: QTBUG-111347
Change-Id: I1feb380973c480ad6268349a0a46ac471b9ca0f7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 2449af142fa3d8ccb114262e994f308043ef6d70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 17:59:33 +00:00
Thorbjørn Lindeijer
e206e50d63 Fix QStatusBar::removeWidget to hide the right widget
`QStatusBar::removeWidget` was hiding the wrong widget (the next one),
since the `removeAt` call changed the item that the `item` variable
is referencing.

This fixes a regression in Qt 6.3.0 (7166a82844500238a4dad91857384479c7).

Change-Id: I9977b47e6208f8d451ff1037bcb9f4e8414cb431
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
(cherry picked from commit 3e7226f10702828eaaf2fa939efc2ac476e8a2b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 15:25:58 +00:00
Jarek Kobus
61448d6c1c QThreadPool: Protect the access to internal data with mutex
The class claims to be thread safe, however, when e.g.
one thread is calling setMaxThreadCount() and the second
is calling maxThreadCount() at the same time for the same thread pool
instance, the latter may receive rubbish data.
Protect all public setters/getters with a mutex.

Change-Id: Ief29d017d4f80443fa1ae06f6b20872f07588768
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0627ab17277ad5fa83fe6fcab5af5cd2748162a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 08:24:21 +00:00
Marc Mutz
0f212adbd3 Rename QBA::{to,from}Uint8Array() → {to,from}EcmaUint8Array()
Found in API review: from/toUintArray() is too generic a name, make
sure its name gives enough context.

Change-Id: Ie10ff06ae11a5e168c4c91b60a9698a41d0429fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7db28fb4bd4f328cef3c722e4e9c00305f830858)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-23 07:24:18 +01:00
Vladimir Belyavsky
b0d395e27c Text: fix Soft hyphen rendering in QTextLayout::glyphRuns()
When calculating the position offset of QGlyphRuns, either
when fetching substrings or when applying fallback fonts,
we would include the advances of non-printable glyphs,
such as the soft hyphen. This was an oversight, and the
other code which calculates the advance (like in
QFontEngine::getGlyphPositions()) does this correctly. We
apply the same logic as there and only include the advance
if the dontPrint flag is unset.

[ChangeLog][QtGui][Text] Fixed an issue where spaces would
sometimes be shown in soft hyphen positions in a string.

Fixes: QTBUG-46990
Fixes: QTBUG-62620
Fixes: QTBUG-67038
Fixes: QTBUG-102483
Change-Id: I4e583fb74f7a51424f14917d7cc0894beefec48b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 0fe6f818d23495f07100f82c12e4232b8e56daf4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 19:39:45 +00:00
Christian Ehrlicher
9e39458a0c SQL/OCI: Fix QSQLDriver::record() when tablename is a synonym
Fix the statement when the tablename is a synonym by not appending the
where clause for the table name to the initial statement used for
tables and synonyms later on.

Fixes: QTBUG-111339
Change-Id: Ie18a858427d124e80462048b1a9c5e2afa327546
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 78f7a8c418bc887ebb5bd75f63e35a2b8108f107)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 19:24:23 +00:00
Thiago Macieira
e736818cef qalgorithms.h: fix mistake that MSVC has constexpr bitops in C++17 mode
<bit> exists in C++20 and is properly both constexpr and optimized. But
in C++17 mode, we don't have constexpr bitops and instead elect to have
performance at runtime instead. But somewhere along the line, either
when they were added, when C++20 <bit> support was, or in any of the
bugfixes for other compilers, the nesting of #ifdef got messed up and we
declared that we had constexpr builtins for MSVC in C++17 too.

The macro QT_HAS_CONSTEXPR_BUILTINS isn't supposed to be used by anyone
else... but we ended up not being able to use it ourselves either. So
I'm renaming it to a more precise label.

Change-Id: I9671dee8ceb64aa9b9cafffd1741b9b4060c9753
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e69d80e14d24001f93442ab59b8babb7e9df0092)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 19:07:00 +00:00
Marc Mutz
f59731b4fb qstrncpy: NUL-terminate even when src is nullptr
The goal of this function is to ensure that dst is _always_
NUL-terminated. The only exception is if there's no space to write
even one NUL byte, of course, but not when src is nullptr but dst
would have space.

Update the docs to the new behavior and make them more precise.

Fix a test that assumed qstrncpy() would not write to dst for
(dst, nullptr, 10).

[ChangeLog][QtCore][qstrncpy()] Now NUL-terminates the target
buffer even when the source pointer is nullptr, provided the
target buffer has space for at least one byte.

Change-Id: I7806d8c71e260f8f02b79af7b6ce94f23599dd69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 05f913d57d6557d1c540894651cc83a5b1ec7cf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 18:24:43 +00:00
Marc Mutz
ad70a5c682 QMessagePattern: don't use strncpy()
When Qt is configured to return nullptr from isNull() QStrings
(QT5_NULL_STRINGS != 1), then we'd be feeding a nullptr src into
strncpy(), which is UB. I couldn't rule the case of a null QString
lexeme out with local reasoning, seeing as the code is in the else
branch of an if (lexeme.startsWith(~~~) && lexeme.endsWith(~~~)), so
it might be null.

Instead of porting to qstrncpy(), which can deal with a nullptr src
(albeit up to recently, badly), note that the strncpy + the char[]
allocation is a qstrdup(), so use that instead. This also does away
with the queasiness of taking the size() of a UTF-16 string to limit
strncpy() for the L1-recoded version (which, in this instance is safe,
as toLatin1().constData() is NUL-terminated, but in some other
instances was not).

As a drive-by, make sure we don't leak the strdup()'ed string if the
emplace_back() fails.

Amends be98fa32c7d56ea91359b647a329356fa44eca04.

Qt 5 is not affected, as constData() never returns nullptr there.

Change-Id: I178d356e560d2749cd6ce0b9364c710a2d117304
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4a9e918d4ebdd9f7ea641e2b0f12a48c5f619acb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 18:24:37 +00:00
Marc Mutz
709db15455 qt_inIsoNametoLCID: protect against a nullptr name
The only user of the function, QCollatorPrivate::init(), passes
QLocalePrivate::bcp47Name().constData(). bcp47Name() may return a
default-constructed QByteArray (e.g. for QLocale::AnyLanguage), so
constData() may be nullptr (QT5_NULL_STRINGS != 1). Passing nullptr to
strncmp() or strncpy() is UB, though.

Instead of using the nullptr-hardened q... versions of these
functions, check name for nullptr once, at the top of the function,
and avoid all the lookup code that follows and is known to fail
(because windows_to_iso_list does not contain empty entries).

This way, we take advantage of the std functions' UB for performance
reasons (fewer repeated nullptr checks), instead of being taken
advantage of.

Qt 5 is not affected, as constData() never returns nullptr there.

Change-Id: I980dace2bca1e983ac526e89fadeb92239ab5f11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9f5a687ffebbc93ce5f8f25c544aa9129c6366c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 18:24:30 +00:00
Marc Mutz
d1a7e9f493 QMessageAuthenticationCode: Extract Methods finalize{,Unchecked}() from result()
This brings the code in line with its sibling code in
QCryptographicHash and prepares for a static hash() optimization and
the fixing of the result() re-entrancy issue (QTBUG-111347).

Task-number: QTBUG-111347
Change-Id: I3d0c0cd2a37c2bbeb60974307ff138e26b82bf69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ac9d25340aec5c165db5e58a3d8b869967c5ff97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 18:24:27 +00:00
Assam Boudjelthia
2e94481c51 Android: avoid duplicate paths from QStandardPaths::standardLocations()
Don't return duplicate path entries from calling
QStandardPaths::standardLocations() and as a pass by no empty entries
either.

Task-number: QTBUG-104892
Change-Id: If05b20d2c07d75428cb572d9549a39cf21bdef99
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 30014ed850bbe62005b4aa789586b01c1281cab4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 02:03:19 +00:00
Alexey Edelev
3562a06809 Add the QT_INTERNAL_CONFIGURE_FROM_IDE option
This switch should help switch off some time consuming operations
that make sense only whe configuring Qt project from IDE.

The switch is INTERNAL and depends on environment variables defined
by IDE application when running cmake:
- Qt Creator, detected by QTC_RUN environment variable
- CLion, detected by CLION_IDE environment variable
- Visual Studio Code, detected by VSCODE_CLI environment variable

Change-Id: I44086376109a8af8ebb7ecd8bf64dc34f0631527
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d1d80d7be5a6c08cbbb1c86af2ad22d22ba95864)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 23:49:05 +00:00
Friedemann Kleint
f594bc5afe qdoc: Add *.webp as an default image suffix
qdoc does ignore image directories if no file with 'known' suffix
is found.

[ChangeLog][qdoc] *.webp has been added to the list of default image
suffixes.

Change-Id: I49524ea13d14dd7e246401dec7deb2ba4e66cb07
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit bb2ff8a69f8bec057c944610f8c4c97009e27ed1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 21:04:25 +00:00
Lorn Potter
359ebe5720 wasm: fix error in 'cut' synthesized key
Change-Id: Idca32c8cedb60563f8f1054d6634ab0411c07d9b
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit f3951eb5d0e7b11adfe18491a77b216fa412e5e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 21:04:25 +00:00
Tim Blechmann
8737178d53 corelib: silence -Wcomma with clang-12
clang-12 warns with -Wcomma

warning: possible misuse of comma operator here [-Wcomma]
{ return Q_ASSERT(i >= 0), Q_ASSERT(i < size()), QLatin1Char(m_data[i]);
}

Change-Id: Ice8a809c8ac9069e55aedefa71faf06385e97789
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c24f4d2c32b475a24250ff4bed15837615f33ef0)
2023-02-22 00:48:40 +08:00
Friedemann Kleint
30f5da17b5 Windows QPA plugin: Remove some duplicated declarations
Task-number: QTBUG-109394
Change-Id: Ic132495da4bfc12ecf303d018fb4d9ba1c8a1128
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 71c2c03477bdfed9542f06bf89494b65d8b214c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 16:48:40 +00:00
Amir Masoud Abdol
2442be2918 Fix for a duplicate macro definition
ALIGN was conflicting with a system macro,
/SDKs/MacOSX13.1.sdk/usr/include/arm/param.h.

Task-number: QTBUG-109394
Change-Id: Ia460ee781f8bd1a1cdcff0371efab784c9eebb57
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ec082fdea6243d71cdfeef7562812f332911f288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 16:48:40 +00:00
Friedemann Kleint
3cc4b5725a Direct2d QPA plugin: Add exclusions for Unity builds
Similar to the Windows QPA plugin.

Task-number: QTBUG-109394
Change-Id: I8e094e4ec49574441d3fd73e7ac2cc6fe3b5fd5f
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 269f44aebc4adf938405b9c08c5c043bad392448)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 16:48:40 +00:00
Antti Määttä
82e124b7a9 CTF: Create directory ust if it doesn't exist
Change-Id: I046c045a21a30eb0b6f0e883aa5b49e953f0a586
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
(cherry picked from commit ce4a7d607c1c848913fa96fdb44cfbecbb19fd71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 16:48:39 +00:00
Alexey Edelev
8fdb3ff39d Revert "Add the NO_CMAKE_PACKAGE_REGISTRY option forwarding to qt_find_package"
This reverts commit 3715cc356153bd8bc384ce4badfe6baece3d3768.

Reason for revert: Adding NO_CMAKE_PACKAGE_REGISTRY doesn't resolve the initial issue. So reverting this change as redundant.

Change-Id: Ifdb6e1b68e112f727a7e83bfa0d2665c49b5e20e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-02-21 13:52:27 +00:00
Mårten Nordheim
1e20d73073 Torrent example: Fix use-after-free crash
The crash would sometimes happen shortly after removing a torrent
since the RateController would still try to use it even though
it had been deallocated.

Task-number: QTBUG-110622
Change-Id: Icad1531ea58560a3a3157a3ed8c0e6b283573196
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit 32098963f2af064cce42fd5477f2a3137a315aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 12:05:10 +00:00
Mårten Nordheim
44eabe2f93 Torrent example: Fix some stack overflow issues
Because of the .size() used as part of the expression it
ends up copying sizeof(qsizetype) bytes to the array,
instead of the (rationally) expected 4 bytes.

Amends 69c31f6f68a1399c1fc1e545e318eaa40966fe85

Task-number: QTBUG-110622
Change-Id: I732e3f4bb5934ff3860087baa91f9bebbf044a7f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit f3de92cdad7642e6c3425712823e1491768f2e56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 12:05:05 +00:00
Amir Masoud Abdol
f97235c459 Set 32 as the default batch size for unity build
Task-number: QTBUG-109394
Change-Id: I4497d1abc85578649f03fc8ae4916f56e4f1f351
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 6d0c774c5147b5ae410b524a61f0709ed932c253)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 12:05:00 +00:00
Mårten Nordheim
a1383e57d1 Torrent: simplify QBitArray usage
There is specific API for counting number of 0-bits

Task-number: QTBUG-110622
Change-Id: Ifa33862ff7b98a59f362bc52c492e8a037799835
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d3c14454198d126a8d92c51a917fff556bdd596c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 12:04:58 +00:00
Friedemann Kleint
c86ea25b60 QtCore: Add more exclusions for Unity builds
Removed `_DEFAULT_SOURCE` as it was not consistent, and possible didn't
work in the first place, and was masked by the exclusion of
`io/qfilesystemengine_unix.cpp`.

Amends fc3a9ee60159b2391cba2320cfdeeddb94d781f8.

Task-number: QTBUG-109394
Change-Id: I8036e66d29d5ec88608d284436b4e8719144f06d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3c1bea178c3e23719dd98d931c056e34a680ff3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 08:37:20 +00:00
Friedemann Kleint
5d705f0f94 QtDBus: Fix declaration of helper qDBusGenerateMetaObjectXml()
Add export to be consistent with the declaration in
qdbusxmlgenerator.cpp.

Task-number: QTBUG-109394
Change-Id: I08c915a7ee737617388db4c0d1a3d116cb8bc3a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 465438e1b1476864c1e952c3bff69fe8252d835c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-21 08:37:11 +00:00
Amir Masoud Abdol
beae44ed9d QReadWriteLock: Resolve a redefinition issue
This collides with a similarly name struct/object in qmutex.cpp.

Task-number: QTBUG-109394
Change-Id: I29404f092db523e21f310b4e5b3cd8cc35170e4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 950e9dad0e7f1fafb45b7cbb6aa6673af613cd07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 19:58:24 +00:00
Tasuku Suzuki
dd76ed90ed Fix build with -no-feature-formlayout
Change-Id: I9f552942c206f16ef5e8b96cbf7255a54ff83470
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 34a0f2251a4041e9a77e65383fa97daa07294f19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 19:58:24 +00:00
Rami Potinkara
85a8d986e7 Android: SKIP cases failing on Android 12 CI with 16GB RAM
SKIP tst_QRhi::tessellation(Vulkan)
SKIP tst_QOpenGLWidget::reparentHidden()
SKIP tst_qvulkan cases

Task-number: QTBUG-108844
Task-number: QTBUG-111235
Task-number: QTBUG-111236
Task-number: QTQAINFRA-5391
Task-number: QTQAINFRA-4733
Change-Id: Id227367477173b6ad4cf9433af8eab5976596e70
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit eb0d7b5dcf834c856d58637ada8745aee2b040ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 19:58:24 +00:00
Edward Welbourne
a5adab4aa8 Update Valgrind to its 3.20.0
It now generates its valgrind.h from a valgrind.h.in, but there were
only two @...@ tokens to substitute, so that was easy enough.

From reading the diff, important changes:
* Added x86 support on FreeBSD (32- and 64-bit)
* Added nanoMIPS support on Linux
* Inline assembly fixes for S390
* Added VALGRIND_CLO_CHANGE request

Task-number: QTBUG-110999
Change-Id: I66990c958cf40c34e7d58dd60b1e11984303fb64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit daceee6a9004565cee6ccd50c6a96216066b4f29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 19:58:24 +00:00
Tang Haixiang
ac6ec5b1fa Add Q_UNUSED to avoid compilation errors
Variable unused causes compile error or warning, use Q_UNUSED to eliminate it.

Change-Id: I6efbc3150cef962fa45ccbbed0dc04794db3cbbe
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 1f4a085df537839eb9223826ef8d7f1ff9a159df)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-02-20 18:26:09 +01:00
Fabian Kosmale
41e036ec72 QObjectBindableProperty: Avoid use-after-free in notifyObservers
We so far refetched the first observer after evaluating bindings, as
binding evaluating might change the list of observers.
However, that approach did not take into account that the 'this' pointer
might no longer be valid after binding evaluation: In case of a
QObjectBindableProperty (or a QObjectCompatProperty), binding evaluation
might cause a reallocation of the binding storage, and consequently the
invalidation of the QPropertyBindingData.
Fix this by refetching the QPropertyBindingData from the storage (if a
storage has been provided, which is always the case for the affected
classes).

Fixes: QTBUG-111268
Change-Id: Ie7e143a0bbb18f1c3f88a81dd9b31e6af463584f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b124171309b259d429bd064fe3bfdec148869ef4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 17:07:25 +00:00
Friedemann Kleint
db6b607cae Windows QPA plugin: Move palette helper function to qwindowstheme.h
This avoids the duplication of helper functions.
Amends a2518b4140ed88a674bf4a4fcf4576e35c698bb9.

Task-number: QTBUG-109394
Change-Id: If969a6497aed3b3662621cf723772c87eb66fd23
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9ac0742d3699bdce7015abeecec8aa23abea47d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 17:06:43 +00:00
Tor Arne Vestbø
efe740e03b examples: Connect Quit action to QCoreApplication::quit, not QWidget::close
Change-Id: I44ca7b61a4a261a7d3aad0dfeb870eb927ee768d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 850ef55fc57e62b70bab72705038e671002ca86e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 15:51:07 +00:00
Ahmad Samir
8bcf236daa QString: build tst_QString::arg() without ASCII casting [13/13]
Drive-by change: use UTF-16 instead of UTF-8 for Eastern Arabic
Numerals, both are not human-readable but UTF-16 is one code point
instead of the two for UTF-8, less \x.

Change-Id: I721f3989b7d776ddc4f9d337b21dca9d398fcc0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 360f69b74b5e28ea1cfb0ed1ead624d0323dfe09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 15:51:06 +00:00
Rami Potinkara
7650d6ee93 Android: Increase Android 12 emulator RAM size to 16GB at CI
Increase to 16GB from 3.5GB. Increase to 6GB was not enough.
Increase to 16GB fixed tst_QByteArrayLarge cases failures.

Task-number: QTQAINFRA-5391
Task-number: QTBUG-108832
Change-Id: I97e263fbc2caa7908c706d1c683a4fa868afa7b6
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
(cherry picked from commit cd197104d8028828176191c4ec01940ae63cbc6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 15:51:06 +00:00
Ahmad Samir
096e934e5b QString: build tst_QString::contructor() without ASCII casts [12/13]
Constructing from const char* etc is already covered by
constructorQByteArray.

I took a guess that the "// b(10)" comment is about testing constructing
a QString from a QChar[] that has an explicit \0 charcater. I tried
finding what the initial intent was but the trail went cold at the
"Initial import from the monolithic Qt" commit.

Change-Id: I15bcdb24e55286eb6cd3056af0714a1eed581635
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ff7848318f565a55b914cd4ac79651f3650efaad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 15:51:06 +00:00
Morten Sørvig
561b48c76b wasm: don't call dlopen() on static builds
Make QLibraryPrivate::load_sys() return false on static
wasm builds.

Emscripten does not support dlopen() in this configuration;
calling it will abort the program. By returning false
we give QLibrary users an opportunity to handle the
error.

Task-number: QTBUG-109076
Change-Id: I32d1fde04cc54d1622e0743712b6372b023aa006
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 490c4558f79ff4ca95a1ff1ccbe5a3d956786e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 12:05:36 +00:00
Tor Arne Vestbø
e59faa2798 Fix QString from ASCII warning in qoperatingsystemversion_darwin.mm
Introduced in d05f2fb2d567.

Change-Id: Ifa308be3be9c817c6304f634a53da62e631f54af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9416012523e75b8b73bb9a8c02e5bbeb30aafac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 12:03:02 +00:00
Tor Arne Vestbø
4c6882d30c mainwindow example: Don't assume toolbar parent is main window
Adding the toolbar to the main window leaves it up to the main window
how to handle ownership and placement of the toolbar.

Change-Id: Id429cbad9d5973931a86fcb899684e3651694fbb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f99df426466c048c16c3af0a89e7923c0db23818)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 12:03:01 +00:00
Tasuku Suzuki
abb25d681f Fix build with -no-feature-egl
qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h:12:10: fatal error: QtGui/private/qt_egl_p.h: No such file or directory
   12 | #include <QtGui/private/qt_egl_p.h>

Change-Id: Ie243fc05e165524afebb10ec979b5f72de8681ce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit c9df9f3976d969dc1f829a596016a377f1e619f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 12:03:00 +00:00
Shawn Rutledge
066b639906 Revert to existing QPointingDevice::grabChanged signature until Qt 7
There is concern about string-based connect() source compatibility in
the case that a signal argument has a different type name.
Amends bc857f466d297e5656fadad4987f218900d6b1a6

Change-Id: I2618b8c5f62b39717e4f7043d07168e808390b1d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a3b90360884dd11d896c43c74d64ff8d8f047052)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 09:11:05 +00:00
Antti Määttä
24e2e15b81 Trace: Use includes instead of forward declarations
Some platforms do not work with forward declarations, mainly android.

Change-Id: Ie34a30ecb8554d77c1bea4b65a752d63ba819af9
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit e3fdd9715fa220d909689def10e9b72c14083e09)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-02-20 06:39:24 +00:00
Antti Määttä
c3af4a2180 tracegen: Add support for QSizeF and QRectF types
Change-Id: Ie19523b84026312c3d5a597914abc2622dba3f68
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 0510307ea1bfe2a1788738acb61890587e75dd5e)
2023-02-20 06:39:15 +00:00
Antti Määttä
b3f77d25aa tracegen: Fix handling enumerators with duplicate values
Aggregate the names of the same value enumerators. The values can also
be hexadecimal so handle them also.

Change-Id: I89693d7e3b8f6c051b298401dcbe8a9f5c0a38aa
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 83effb3a3f6bf73e682f7a9ccedebf4073ade776)
2023-02-20 06:39:07 +00:00
Friedemann Kleint
1f23ed3c85 tests: Remove remains of qmake conversion from CMakeLists.txt files
Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 97bfacf1e218c6cbb38290957953cb608baaf696)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-02-19 11:15:49 +01:00
Alexey Edelev
4c96abdcc0 Fix syncqt.cpp build warnings
Remove the deprecated timeStamp argument from the parseHeader function.
Fix signed/unsigned comparison between file size and buffer size.
User the correct oder when initializing variables.

Change-Id: I483cc175c9aaf42917053b6731833e1b4f5cad3a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2a69f96e162544686d7c2a31439b3ea69095162f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-18 20:54:27 +00:00
Tor Arne Vestbø
4034cc7c19 Resolve actual macOS version despite process running in compatibility mode
If the application executable was built against a pre-macOS 11 SDK, macOS
will report its version as 10.16 on every OS from macOS 11 and up, for
compatibility reasons.

From Qt 6.2 and up, we require at least Xcode 12 with the macOS 11 SDK
to build Qt applications, so normally this should not be an issue, but
in the case where the Qt 'app' is a plugin library hosted by a third
party host application, the host application determines the behavior,
and we might end up in the compatibility situation after all.

However, since the Qt app was built against at least the macOS 11 SDK,
we know that it can/should handle the new version number scheme, and
we can resolve the real version number for QOperatingSystemVersion.

We do that by launching the sysctl binary with the SYSTEM_VERSION_COMPAT
environment variable set to 0, which is the supported way of disabling
the compatibility mode.

Now that we have the real version number we can use that for the
deployment target check via qt_apple_check_os_version(), but we
still need to account for possible failures in reading the plist
file.

We can also simplify the QOperatingSystemVersion::MacOSBigSur
definition, now that we always know the app the should be able
to handle major versions above 10.

Task-number: QTBUG-111114
Change-Id: I2a2756381c31b195f7b8800c5008a87b37114080
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d05f2fb2d567617730d7d4757fff39ddc3e903ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-18 19:10:04 +00:00
Volker Hilsheimer
39ab982844 QGesture: make sure we copy timestamp value for event clones
Otherwise, double-click recognition will fail.

Use QEvent::clone when possible, or set the timestamp explicitly when
not.

As a drive-by, remove some long-dead code in affected code lines.

Fixes: QTBUG-102010
Change-Id: I882bf6e8090bf6f182b7a0a3c62aa3a4c8db2e14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fb09c82a2c7c44d41a0a36d8fe6d6d22e792668a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-18 04:57:38 +00:00
Ahmad Samir
2508037e26 QString: build count/contains() unittests with no ASCII casting [11/13]
Drive-by change: Test more count/contains() overloads.

Change-Id: Ife3afe9aab68e18cc1587c11108a18a413c339c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5a2ebc9f40ac018b6dac1c975d5fc0c02f602e94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:04:07 +00:00
Ahmad Samir
a2e9045875 QString: change test data to compile with QT_NO_CAST_FROM_ASCII [9/13]
Change-Id: I20dcf2d69c1446faef79bd24a78b1b86feec4ccb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2ade07b39ef4f8833bf2b5f0dd7959f2fbf994fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:04:07 +00:00
Ahmad Samir
de52563f9a QString: change test data to compile with QT_NO_CAST_FROM_ASCII [3/13]
Change-Id: I5127831d5f9dcf200d0892b1ab58760180dda610
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4f1d3426acbb080d52941b3e2a44a9cf91c5573a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:04:07 +00:00
Volker Hilsheimer
c7205b6526 QScroller: use categorized logging
Replace local built-time enabled macro with a logging category.

As a drive-by, move QDebug streaming operator into the anonymous
namespace to prevent external linkage, break some excessively long
lines, and remove dead code.

Task-number: QTBUG-102010
Change-Id: I49d212ee4a66a3eabfa5567f6c8d9674ffbb8880
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 5edb1bed3fc360276aec3e678f8b46cb40dd5d26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:04:06 +00:00
Ahmad Samir
bbe34d1788 QString: change unittests to compile with QT_NO_CAST_FROM_ASCII [7/13]
I.e. the second arg to QCOMPARE isn't what's being tested.

Drive-by changes:
- More _L1 usage, less blocky and easier to read
- QCOMPARE's second arg can be a View, it is smart enough and can
  compare them just fine
- Replace a "//15 chars" comment with a QCOMPARE check

Change-Id: I4f4b84b16b543df37b0ba2f9dd781b045b2ed397
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eb4641210c9132e736d666bd39408a5e5ead8c61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:04:06 +00:00
Tor Arne Vestbø
38e986f7e6 macOS: Pick up QWizard background from keyboard assistant via NSBundle
As of macOS 10.14 the keyboard assistant background is shipped as part
of the compiled asset catalog of the app, so looking it up via a URL
will fail.

Instead we look it up via NSBundle's dedicated image lookup function,
which handles both cases.

The logic has also been moved to qwizard.cpp, since the additional
plumbing via QPlatformNativeInterface was unnecessary.

The keyboard assistant itself no longer shows the background image
as of macOS 12, so we might consider doing the same, but the design
of the assistant has also changed significantly, so as long as our
QWizard layout looks like the old keyboard assistant we keep the
background as well.

Change-Id: I7d42dd79b285f3518837458864bca6bc353b3b6d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c26c91b2088a05bbe1ed3b529a4b0fc0ea9d3a92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 20:34:06 +00:00
Alexey Edelev
0fae9692b9 Add extra documentation about QT_ANDROID_EXTRA_LIBS
Document the potential issue caused by using QT_ANDROID_EXTRA_LIBS from
the project build tree.

Inspired by QTBUG-111173.

Change-Id: I39fcda6e19b15eb13a390978230944dad41ec8d1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c4d177897c74fa657e57df51f335a0a621b9c081)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 20:34:06 +00:00
Tor Arne Vestbø
a6d6710569 Darwin: Ensure encrypted library is loaded before parsing plugin metadata
Application delivered via the macOS or iOS App Store might have their
libraries encrypted, in which case we can not read any of the sections
of the binary until it has been dlopened.

This was causing issues for our plugin loading code, which assumed we
could read the .qtmetadata section of a yet to be loaded plugin to
determine its suitability, before loading it.

We now detect whether a library is encrypted during the Mach-O parsing,
and propagate this back to QLibraryPrivate::updatePluginState(),
which can handle the case by explicitly loading the library before
continuing with metadata validation. We still ensure that the library
has a .qtmetadata section, so that we don't need to dlopen any random
library in our path.

This does mean that we will potentially load more plugins than we
need, and since the Qt version validation happens as part of meta
data validation, we might dlopen() incompatible plugins, but it's
expected that in an App Store deployment scenario you control both
the versioning and set of shipped plugins, so this should not be
an issue in practice.

As encrypted libraries are only produced for apps that are fully
published to the App Store, and then deployed via MDM, VPP, or
Apple Configurator 2, we don't have an easy way to test this,
but the existing code paths should be unaffected, and hopefully
this patch improves the situation for the encrypted library case.

Change-Id: Iff733505f7067ce5571854ea978bc95e8376e347
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 667aec810f71ac378a618032846df4bb6d76c647)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 20:34:06 +00:00
Amir Masoud Abdol
8a49b5f2ef Add -unity-build, and -unity-build-batch-size to configure
If -unity-build-batch-size is not given, we default to CMake's default
which is 8. In QtSetup.cmake, we explicitly set the default to avoid
having it set to OFF in case it is missing, just to make sure that we
don't get any unintended behavior.

Task-number: QTBUG-109394
Change-Id: I19849e9baa507b64fb23847c740e20a7adc61b8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ed26352a1009ce37fe792c023af9e5d6259ea6d4)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-02-17 21:34:05 +01:00
Ahmad Samir
44a2a2d643 QString: split toNum unittests
- Port macros to QTest data rows in separate unittests
- Move DOUBLE_TEST-related data to toDouble() unittest
- Drop one redundant unittest:
    QTest::newRow("const-charstar") << (const char*)0;

Change-Id: Ie809895e9f5d58c2d3ec419689f409b55e24fcf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4499600fc78fb7226388db554f9fa95bd59161c4)
2023-02-17 19:17:08 +02:00
Ahmad Samir
1ff2debb68 QString: unittests: clean-up creating a QChar[]
Change-Id: I3864d145c05ae4268fe576f84723acc5eba3c2cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fdf112fd1d023e16cc862d47c789d46a62e56b08)
2023-02-17 19:17:04 +02:00
Mårten Nordheim
c7375ed4c2 TLS[openssl]: Use optional<> for CA cert we are fetching
The QSslCertificate ctor is somewhat expensive, especially when we are
shutting down. By using optional<> we simply reset() it and no longer
need to create a new, valid, certificate.

Task-number: QTBUG-102474
Change-Id: I514433b0d380dd3ceabbed3a6164f7e3efc490c7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit 61bfe87a64ca322de0ebf9bf61a0a0a81ee5bf7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 13:16:12 +00:00
Ahmad Samir
becc245395 QString: change test data to compile with QT_NO_CAST_FROM_ASCII [6/13]
Change-Id: Ib747bd69f15c3e1d2deaa5a0168fcbcddbbb8f8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 19b52ad2e5ee38b54644d8a5605d3ed10b9be9c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 08:36:15 +00:00
Ahmad Samir
6f3abc4572 QString: split some double/Nan/Inf unittests
And switch to using test data rows (rooting out two macros in the
process).

Change-Id: Ib31e6b59f90f0983c0efc4bef7cb246aedfcab5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fcb9ef50622a40bf35f24e833a9d135a65ee3f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 23:58:48 +00:00
Ahmad Samir
a6f2c8579e QString: change test data to compile with QT_NO_CAST_FROM_ASCII [4/13]
Change-Id: I086d20547912da45282b88e290fdae9d2029c6bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4f30d4f4560781cd1a970995f421817cbdd55c04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 21:39:10 +00:00
Ahmad Samir
cc24ce78a9 QString: change test data to compile with QT_NO_CAST_FROM_ASCII [5/13]
Drive-by change: change C-style cast, (qlonglong)0, to C++ style cast
qlonglong(0).

Change-Id: Ie7a36c17ac9c14f0606fcb4b112eba3f0180232e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5c56fc6d2cab01af9d0a8c0ea218761469857264)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 21:39:10 +00:00
Ahmad Samir
79e3bad162 QString: change test data to compile with QT_NO_CAST_FROM_ASCII [2/13]
Change-Id: If3b5eaf9964b3834c116522bc9a6bb89cd5b1626
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6542f4174e0f380b022da6e7545b3bbcc8c959b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 21:39:10 +00:00
Ahmad Samir
ec1878bc4b QString: change test data to compile with QT_NO_CAST_FROM_ASCII [1/13]
Change test data to compile with NO_CAST_FROM_ASCII uncoditionally where
casting from ASCII isn't what's being tested by a unittest.

The goal is to add a variant of tst_qstring that is compiled with
QT_NO_CAST_FROM_ASCII so that the unittests cover that code path too.

The commits are split into smaller chunks (where there is a common
link between changed code, that code is put in a commit, otherwise I
kept the number of changed lines below ~150) to make reviewing them
easier.

Change-Id: I14256f1bde7749a3023753dbb7ed8be72cb6bc14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6e5c6ef739565829039b4de7845e4b71b11b4c10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 21:39:09 +00:00
Tor Arne Vestbø
82d9086caf macOS: Remove machinery for attaching NSToolBar to QWindow
It was only used by QMacToolBar in QtMacExtras, which no longer exists
in Qt 6. Attaching a toolbar can be done manually via the NSWindow of
the NSView retrieved from winId(). There are no public uses of the native
interface in GitHub outside of Qt.

Improvements we want to make to toolbars in QtWidgets and QtQuick in the
future, possibly backed by native toolbars, would be done behind the
scenes and would not need this API.

This effectively reverts e8fd6b9604bac334404dc52daa63b9e6d9cd71d8.

Change-Id: I33b090fa19f9f3af029ae8c269efcf739a4b1b22
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 5d13e05651af04d471f110c782cbce85f54d1cb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 18:39:08 +00:00
Marc Mutz
43a43e1377 QVarLengthArray: protect against aliasing in resize(n, t)
Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a.

Change-Id: I3fa6183466715555530d4042006049e286897343
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0cfaa6e8964a0458cca20ce686b6a399293ad4cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 18:39:08 +00:00
Friedemann Kleint
e5598520b4 Add some exclusions for CMake Unity (Jumbo) builds
Add exclusions for issues that are likely not fixable
(3rd party code, X11 define clashes, etc) in 3rd party,
tools and plugins.

Task-number: QTBUG-109394
Done-with: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I698c004201a76a48389271c130e44fba20f5adf7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 64dc6fe87d05aaad3ce516747ad6dbd048f388cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 18:39:08 +00:00
Volker Hilsheimer
ff6d1d3a00 QAbstractItemView: don't start editing on Ctrl-Click
Amends 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f, after which dragEnabled
item views toggled selection on click rather than on press. If the edit
trigger included SelectedClicked at the same time, then Ctrl-Clicking a
selected item would start editing the item, instead of toggling
selection.

Fix this by ignoring clicks with modifier when evaluating whether
editing should start.

Extend the mouseSelection test case by including a column for the
editTrigger, and cover the respective combinations.

Fixes: QTBUG-111131
Change-Id: I9605f9b3d5a49e292551a34c3c4c7a5f9ecb2a89
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 557dcd8a87c6c6c77ccc71a85b1ec349c69eb4c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 18:39:07 +00:00
Mårten Nordheim
d3b9f9cdcd Delete references to deleted examples
The bearer code hasn't been in Qt for some years.

Change-Id: Id69ad1ce5035a0970f3507d4b6ba4a5549bf1d6c
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d5e98cde1a1da17df1c82e697ce786878e71511c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 15:59:16 +00:00
Marc Mutz
cc4a392450 QVarLengthArray: fix UBs in emplace()/insert() ([basic.life], broken class invariant)
There are two problems in emplace_impl() (the same code exists as
rvalue insert() since 5.10):

First, the old code updated size() at the end of the function.

However, if, after constructing the new end element, one of the
subsequent move-assignments fail (throws), then the class invariant
that size() be the number of alive elements in the container is
broken, with the immediate consequence that the QVLA dtor would not
destroy this element, but surely other unpleasantness (UB) that the
C++ lifetime rules decide to throw our way.

Similarly, in the trivially-relocatable case, the memmove() starts the
life-time of the new end object, so if the following placement new
fails, we're in the same situation.

The latter case is worse, though, since here we leave *b in some weird
zombie state: the memmove() effectively ended its lifetime in the
sense that one mustn't call the destructor on the source object after
trivial relocation, but C++ doesn't agree and QVLA's dtor will happily
call b->~T() as part of its cleanup.

The other ugly thing is that we're using placement new into an object
that C++ says is still alive. QString is trivially relocatable, but
not trivially copyable, so we can't end a QString's lifetime by
placement-new'ing a new QString instance into it without first having
ended the old object's lifetime.

The fix for both of these is, fortunately, the same: It's a rotate!™

By using emplace_back() + std::rotate(), we always place the new
object in a spot that didn't contain an alive object (in the C++
sense) before, we always update the size() right after doing so,
maintaining that invariant, and we then rotate() it into place, which
doesn't leave zombie objects around.

std::rotate() is such a fundamental algorithm that we should trust the
STL implementors to have optimized it well:
https://stackoverflow.com/questions/21160875/why-is-stdrotate-so-fast

We know we can do better only for trivially-relocatable, but
non-trivially-copyable types (ex: QString), so in order to not lose
the memmove() optimization, we now fall back to std::rotate on raw
memory for that case.

Amends dd58ddd5d97f0663d5fafb7e81bff4fc7db13ba7.

Change-Id: Iacce4488ca649502861e0ed4e084c9fad38cab47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e24df8bc726d12e80f3f1d14834f9305586fcc98)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-16 11:20:45 +01:00
Marc Mutz
790a0e824d QVarLengthArray: use new q20::construct_at instead of raw placement new
The former is much safer to use in the presence of overloaded operator
new, and forms a tiny step towards a fully C++20-constexpr QVLA in the
future.

Change-Id: If1b31c06296a60c39f1c9f9da523e208ecb1248b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 230bc059ae50a16346700a47090dcb97d239e8c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 06:30:53 +00:00
Assam Boudjelthia
ac88e82e98 Android: use test QFileInfo fileName() instead of completeBaseName()
using fileName is more correct in this case.

Task-number: QTBUG-98974
Change-Id: I7c547bfc1c2321d4817dc087d3e962dbc2a0b7fd
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit df47d7d1ff2ac45ab5c6cdade89e5e1857f12479)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 01:31:01 +00:00
Tor Arne Vestbø
584bf149a3 Remove QCocoaWindow::setContentBorderThickness
Its only client was QMainWindow, but that use was removed in
3b8b47db6aaeb333f106cff57cc712b01d828302 and replaced with a
call to setContentBorderEnabled.

This effectively reverts 0caaf9966a8e4ea1e83de866020e61fd5ffaec1a.

Change-Id: Iaba4d5fd9256632b4a3b935e3fb30d7f5c39851e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 19fc78e9672f4350a06790a9a0f0edba75244875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 22:09:07 +00:00
Tasuku Suzuki
96636de2d7 Fix build with -no-feature-mdiarea
qmainwindowlayout.cpp:(.text+0x2976): undefined reference to
`_q_tb_tabBarShapeFrom(QTabWidget::TabShape, QTabWidget::TabPosition)'

_q_tb_tabBarShapeFrom is implemented in qmdiarea.cpp which is not
compiled when the feature mdiarea is disabled.

Change-Id: Ib0c6447b9381b8ce01542fabf831a9db7f5e6675
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7346de649195d7fed39fa31ab1b11f42cd62f3a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 21:55:35 +00:00
Rami Potinkara
32bc25d03f Update Gradle to 8.0 and Android Gradle Plug-in (AGP) to 7.4.1
Gradle 8.0 and AGP 7.4.1 are the latest versions at Feb 2023.

Fixes: QTBUG-110875
Change-Id: Ia13b9e7859a873d2aade8782c279266d0982da21
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6968eea88ed901ee139a56bb7d0ec2ec7daad49a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 21:55:35 +00:00
Alexey Edelev
3715cc3561 Add the NO_CMAKE_PACKAGE_REGISTRY option forwarding to qt_find_package
Allow forwarding the NO_CMAKE_PACKAGE_REGISTRY option to the
find_package call from qt_find_package.

When we look for host tool packages the package dependencies are
recorded in the cmake package registry. This leads to the situation
when the lookup retry will use the package that is already found in
host path instead of looking the right one in target paths.
Adding the 'NO_CMAKE_PACKAGE_REGISTRY' to the qt_find_package calls
suppresses records in cmake package registry and starts a clean search
using target paths.

Task-number: QTBUG-111140
Change-Id: I97ce1755b2f8e3413f1b0276fe26568b2f5efe33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 545400addd7935c87ec79596ac3010b4f9016a84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 17:34:30 +00:00
Joerg Bornemann
e2d1c5d139 Revert "CMake: Fix configure -no-rpath"
This reverts commit 854986836a581da694d169744e5487c5ce5f44bf.
This reverts commit 392d9a54194d06e96bfebdaf081aa6c9787e33ab.

Turns out that enabling this option is now breaking the Qt build,
because tools that are called by the Qt build cannot run anymore due to
the lack of rpaths.

Before, QT_DISABLE_RPATH was simply turning off Qt's additional rpaths
but left CMake's rpath defaults intact.

To implement a working -no-rpath switch we must add Linux and macOS code
paths to _qt_internal_generate_tool_command_wrapper and set
LD_LIBRARY_PATH/DYLD_LIBRARY_PATH and friends.

Fixes: QTBUG-110816
Change-Id: I021d5e6cd775cbe5b2411d6771ab2545cb04f799
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2af494c93076cd2acf4493501e472147422a7670)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 17:34:28 +00:00
Andreas Eliasson
b8eeb2d68a Doc: Fix member name in code snippet
QstyleOption has no init() member, only initFrom().

Fixes: QTBUG-107770
Change-Id: I00ff0b980fbfac813f113a7052bd3df32c7912b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d6bdc5e9b6bcc9324c506c194bc168cdb6ec1da7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 17:34:28 +00:00
Ivan Solovev
dba4d78441 QFuture: fix continuation cleanup
Not clearing the continuationData could lead to use-after-free when
there is an attempt to cancel an already finished future, which belongs
to an already-destroyed promise.

This patch fixes it be explicitly resetting continuationData to nullptr
in the clearContinuation() method, which is called from the QPromise
destructor.

Task-number: QTBUG-103514
Change-Id: I6418b3f5ad04f2fdc13a196ae208009eaa5de367
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b34bea5e96370986ea5dfc499fc2ec6366fda627)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 14:12:23 +00:00
David Edmundson
390ce392c8 Fix connections in QWidgetWindow
A recent update moved handleScreenChange out of being a private slot.
Porting to the new syntax fixes the warning and moves to a compile-time
check.

Change-Id: Ibd85c6caf7dca051d669250a94a82fbddbd3435d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ec8e6ed20034a5ea7d32bdc62b3b9dc91ce68d36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 14:12:21 +00:00
Tor Arne Vestbø
c22cf6dc07 Rename Qt::Appearance to Qt::ColorScheme
Based on discussions in the 6.5 API review, where we concluded that
'appearance' is too general. Instead, we follow the CSS standard
and use the term 'color scheme'.

Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 32749c913b32e89e2027227233794f2296166cc6)
2023-02-15 11:43:49 +01:00
Timur Pocheptsov
9a7a12692f QIosFileDialog - properly handle QUrl for assets-library
For QT_PLATFORM_UIKIT 'PicturesLocation' manually appended by "assets-library://".
When converted to QUrl, such a path becomes a valid url, having empty path
and scheme "assets-library". Later in QIOSFileDialog we convert this
path (options()->initialDirectory()) calling QUrl::toLocalPath, which
gives us an empty string and thus we erroneusly select document picker
dialog, not an image picker. So let's also check a scheme, not path
only.

Fixes: QTBUG-107844
Change-Id: If4dd453549b37933cba07b5d7af6e45f2504dd29
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 402a526b2a87cbf6b7466bacb9dd3d8b7c71d9b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 09:50:55 +00:00
Yuhang Zhao
a71251dc2b Cleanup QGtk3Theme
1. Remove unused include.
2. Replace unnecessary null checks with asserts.
3. Remove dead code after the cleanup.

Change-Id: Ia3c01ae8a1fb491d513071c09f8095c93e35c292
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 09141ebad7109b90e5dfdbf3b065543b8be14641)
2023-02-14 23:23:03 +00:00
Fabian Kosmale
bfea12b88e QObject: Handle pointers to incomplete types in auto-connections
The code for the QMetaMethod queuedConnectionTypes overload relied on
QMetaMethod::parameterMetaType and QMetaType::flags() to detect whether
we're dealing with a pointer (and then use the VoidStar metatype instead).
However, if the type was incomplete when the slot was defined, and the
type was not registered when connect was called, we would not find a
metatype for the argument.
However, in that case we might still be able to handle the method, by
checking whether the type name of the arguments ends with a "*".
This patch does that, fixing a regression from 5.15.

Fixes: QTBUG-108537
Change-Id: I54cc48a3343444480ab9094fe1ebaaa5aa75cee0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9483fcd68aef250c56a74556258dc80d9cc58220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 18:24:34 +00:00
Mårten Nordheim
815e4f57c7 Torrent example: Convert some timeouts from int to chrono
Using seconds because then they all have the same type, even if
all-but-one could use minutes.
Delete one unused interval value.

Task-number: QTBUG-110622
Change-Id: I66b456de8a4b867859e9e2b13ce72e8ec691c79a
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3fc26dbb2cfe07d1ae0acf4e18b6c94b64e56662)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 17:50:04 +00:00
Mårten Nordheim
a2511182f5 Torrent example: delete unimplemented functions
That's not fit for an example...

Task-number: QTBUG-110622
Change-Id: Ib196d61867f95f3ff2e45841509d49df9360ad25
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 22fc1d08bb666bb91470ad3759b91256a56ef4fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 17:50:03 +00:00
Mårten Nordheim
baac15a69e Torrent example: Remove manual little-big endian conversion
... and use QtEndian instead.

The conversion would be done even on a big-endian system, so the
example would not work correctly on such machines.

Task-number: QTBUG-110622
Change-Id: I6a660ff68fa5a8d9b4c1faf9e264d937c605c47e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 69c31f6f68a1399c1fc1e545e318eaa40966fe85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 17:49:55 +00:00
Edward Welbourne
00f0dabd71 Route QTimeZone::setSecondsAheadOfUtc() via setDurationAheadOfUtc()
... rather than the other way round. This ensures that the latter's
check for value-in-range is correctly handled.

Task-number: QTBUG-109580
Change-Id: I21c2e7c1787c8f57e6893353e42261c013b648f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ff7d5809f1c8b27d62201c77fd1ea556a4fe3cc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 17:27:22 +00:00
Assam Boudjelthia
0b48506202 Fix few QFileInfo and QDir calls
Return the file engine impl of QFileInfo::completeBaseName() and
QDir::absolutePath() and QFileInfo::fileName() (based on
QAbstractFileEngine::BaseName) if the file engine impl is valid.

Amends f77668ffec48d8aaad7c74069c6f3e770a305ae1.

Task-number: QTBUG-98974
Change-Id: I28a8c75a6f25e30012b0791c12dbde51bfe8f62c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 249d613a60aa6a1347ebc1c29902049247b93324)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-14 16:50:20 +00:00
Laszlo Agocs
b6b218c680 rhi: d3d11: Do not ignore storage buffer offset in the UAV
Change-Id: If6ef0345903b71adfc7b5633f1abcead9ca07c72
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit bf6cc9a4e2825ecc1b64955dd6341a8ec758dacc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 16:48:26 +00:00
Mårten Nordheim
ea51c14fac Delete googlesuggest
As a networking example it doesn't contribute much. But it has some
interesting uses of widget/events

Change-Id: I194d32e6a304ae41819c20751e9f1ee1d9b5abdb
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 21453410713650a97a074a8f3d78afbb4c70e6b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 16:48:23 +00:00
Laszlo Agocs
c63e57872e rhi: gl: Skip the vertex-fragment interface check with more stages
Once tessellation and geometry shader support is added, the check
makes no sense when there are additional stages between the vertex
and fragment stages.

Change-Id: I3d3c0a5b338f5fe191c072a13a8699924f7a6a1b
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5476973325288e399f99af004e53184e41892282)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 16:48:20 +00:00
Morten Sørvig
01b14f431b wasm: fix to/from Uint8Array documentaton
Functions generally don't have a \brief section. The
Uint8Array conversion functions were introduced in 6.5.

Change-Id: I1d366d7506327128f7eedd71310e570ade6fc66c
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 062b919047a97f20499785cedbf8acc98548efa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 13:25:50 +00:00
Antti Määttä
216bf7b704 Update qtrace_p.h comments
-Update supported types
-Add how to autogenerate metadata.

Change-Id: I1a88ff137760f7d348b841275cc00a2c63771927
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit e4562157a14dfa07a56c364203c159cada330269)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 12:59:33 +00:00
Yuhang Zhao
cbee4d6ff2 QStyleHints: code tidies
1. Use Q_D and Q_Q instead of d_func() and q_func().
2. Use early return.
3. Remove unnecessary semicon.
4. Add one new line to separate two unrelated functions.

Change-Id: Ie6171c857f00ca171e97723a0d517d2295bbbbd1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 528f28f380e3f0c55b9a305f6b208dc1a2db73d6)
2023-02-14 12:39:16 +00:00
Volker Hilsheimer
377abfcb5e QAbstractItemView: don't access invalid indexes on copy-key
When pressing the copy key the view tried to access the model's data for
the currentIndex() without checking whether the index is valid. This
resulted in debug output to the console, and might break models that
didn't check incoming indexes for validity (or asserted validity).

Fix this by checking whether the currentIndex() is valid before reading
the model's data for that index.

Fixes: QTBUG-106569
Change-Id: Ide75fbdfdbd1451ab6d48f07b22136553c5b2468
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 3a0c33da3d913431391c5b7f4f0e93ea9d2221dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 21:11:19 +00:00
Edward Welbourne
ac0dc01c4e Accept full-width parentheses in removeMnemonics()
QPlatformTheme::removeMnemonics() removes any match to /\s*\(&[^&]\)/
from the text it is given (a menu entry). It transpires that
translators are apt to use the full-width parentheses (compatible with
some far-eastern scripts) instead of the plain ASCII ones. This leads
to their translated mnemonics don't match the same pattern unless we
treat the full-width parentheses as a match for the ASCII ones;
consequently, they don't get removed, which this function exists to
do. So teach it to recognize the full-width versions, too.

In the process, break out the pattern-matching (aside from the leading
space) to a lambda to make it easier to read and document.

Fixes: QTBUG-110829
Change-Id: I7335d0bd8dbba66e1fe58fc3eec93caaaf6ec140
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 86b930f073b6b75790a6af8d021f4daa00f80aae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 20:14:05 +00:00
Volker Hilsheimer
927ce8c4fe QMenu: guard for destruction when emitting action signals
If a slot connected to a QMenu-action destroys the QMenu, then
we must not touch data members in subsequent code, and instead return
immediately.

We cannot use QBoolBlocker here, as that would reset the data
member of QMenuPrivate even when trying to return early.

Fixes: QTBUG-106718
Change-Id: I6b5ea471b1bf1f9864e1384382100f8f6c01346f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 52ce4d2d29db8a44fa2fa817cab9ebe969db082e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:49:30 +00:00
Timothée Keller
56909fb936 Windeployqt: add custom qml output directory command line option
Added the qml-deploy-dir option, which deploys imported qml files to
the directory passed as an argument. If no option is given, a "qml"
directory is created, and files are deployed there.

[ChangeLog][QtTools][Windeployqt] Windeployqt's default behavior is
now to deploy qml imports to a "qml" directory inside the deploy
directory, rather than directly to the deploy directory.

Task-number: QTBUG-99516
Change-Id: I49262a38c4a42ef20b05b603f5eb5393fe9cc218
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0b4286ff28748ae1e47d8750f1899df2eb85357e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:49:29 +00:00
Matthias Rauter
f14704177e Fix build issue in manual example qtabbar/stylesheet
Change-Id: Ibeb1a83ea74bea53e76990d7448552e33f3d875a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a2dab1bda9b0e49a745b9070bd96bbe0d3a11ffc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:02:13 +00:00
Morten Sørvig
81cf3c7922 wasm: don't set window states for child windows
Child windows can't be e.g. fullscreen independently
of their parent window. They should probably be allowed
to take the WindowActive state though, so let that
one trough.

Change-Id: I857029f680d2fb274ba38705f6b687be45f46761
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b7046ec2ac74e92a37b40e162108e78119b0a3b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 14:52:09 +00:00
Juha Vuolle
5efec4016c Adjust permissions.prf plist path handling
Few tweaks:
- Remove extra closing parenthesis
- Use absolute paths as the exists() checks & other plist path
  uses are relative to the permissions.prf location
- Use the plist path with PlistBuddy instead of the variable
  from .pro file

Change-Id: I27c7f1e7044a55ff7fbd78ef1dd79c92b17e8018
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7c186422444458f30ec7f7e59060c900e845536b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 13:42:00 +00:00
Eirik Aavitsland
d656fde77e Update bundled libjpeg-turbo to version 2.1.5
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.5

Task-number: QTBUG-110336
Change-Id: Ifc08ad7f1a3c5b3e66b11e5a51d523b091288790
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 94efcf9be4c5e46dff463806e278fcee90ff4d53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 12:00:22 +00:00
Marc Mutz
0cbc91d65d QVarLengthArray: clear() is not resize(0)
The latter needs the value_type to be default-constructible, which
shouldn't be required to clear() a container.

Use std::destroy_n() instead.

[ChangeLog][QtCore][QVarLengthArray] clear() no longer requires the
value_type to be default-constructible.

Change-Id: I806de8f3826b50c0bd38156892c3afeb15f13ac9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fbfee2d7c59a7c6cd17ae7a3f63f983b9f3316f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 12:00:22 +00:00
Marc Mutz
e29d578066 q20::construct_at(): fix various issues
Fix several issues in 72c2cdbc572f8b8b45a57a451e2bc19bb1c53b0c,
which I was too slow to review before it went in:

- use the correct feature macro, not __cplusplus
- use the correct signature (return T*, not void)
- don't make the function static
- add a comment mentioning the material difference to std::construct_at
- drop unneeded <qxptype_traits.h> include

Task-number: QTBUG-109394
Change-Id: I39d1908f565b1c1a31d5741924ac173447ec9057
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 67ed712235375fa1d1b9ea0e5c71755886f65f83)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-13 10:05:03 +01:00
Christian Ehrlicher
e4ef4fd3a6 ODBC/MySQL: fix compilation with MySQL < 5.7.9
MYSQL_TYPE_JSON was introduced in MySQL 5.7.9 but our documentation
states that we still support 5.6 so we have to define this value by
ourself for the older versions.

Fixes: QTBUG-109832
Change-Id: I935edb14495d162ed58109610946b2805d37bbc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5bc61ec5d028d57640b9c4cd515ed7dfebac945c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-12 21:29:32 +00:00
Volker Hilsheimer
091160a9af macOS: map Qt::Key_Return to NSCarriageReturnCharacter in menus
On macOS, key combinations with the Return key do not get delivered
through NSView::keyDown, but they are seen by the
QCocoaNSMenu::menuHasKeyEquivalent override. We already use that
override to check whether any menu item uses a matching shortcut, and
give Qt's focus object a chance to override the shortcut. The key
mapper used the NSNewlineCharacter '\n' for Qt::Key_Return.

However, the character we get from macOS for the return key is the
NSCarriageReturnCharacter character, '\r'. This makes the lookup
fail, and shortcut overrides are not delivered for shortcuts using
Qt::Key_Return.

To fix this, map Qt::Key_Return to NSCarriageReturnCharacter. The
inverse mapping maps both NSCarriageReturnCharacter and
NSNewlineCharacter to Qt::Key_Return, and there are no other users
of this function in Qt.

Fixes: QTBUG-107526
Change-Id: I716190adf3cd94697e2b3ad1afc25b95d8ebde25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0835537c3c3a8b7991b7a6e4a877a13f165a66e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-12 01:14:42 +00:00
Tasuku Suzuki
3bb565bb90 Fix build with -no-feature-action
/home/tasuku/io/qt/code/qt/qt5/qtlite/qt5/qtbase/src/plugins/platformthemes/gtk3/qgtk3interface.cpp:640:59: error: return type ‘class QIcon’ is incomplete
  640 | QIcon QGtk3Interface::fileIcon(const QFileInfo &fileInfo) const

Change-Id: I2936a3d7ae4cca200f946103b97659819775a8da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e7e1515ead9cef1d4d502986de4dd7c66810baa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-12 01:14:40 +00:00
Sebastian Beckmann
2e898a6a52 QAbstractItemView: Don't unselect on click on empty area in SingleSelect
dfb4697e4a4828acd47292a89207b3975ec6766e made a change to selection
behavior that resulted in a regression where clicking on an item view
but not on an item would cause the current item to get unselected.
Changes the behavior to not update in this case.

Added a new test that specifially checks for this scenario and ensures
that the current item is still selected, even after the user clicks on
empty area.

Fixes: QTBUG-105870
Change-Id: I191c3878819b99897083039fba0ab43908da5429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f11e5435c776deddf27f7759180c1d41f64b8cce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-11 14:57:01 +00:00
Friedemann Kleint
e36aa1a225 src: Remove remains of qmake conversion from CMakeLists.txt files
Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 08c201070817be73c17fa7e4e790ba08e94532c6)
2023-02-11 13:40:59 +01:00
Ahmad Samir
3204c9837a QtMiscUtils: fix return type of two helpers, should be bool
Pointed out by Oswald Buddenhagen.

Change-Id: I3e38e0aee4555a1f37b8dbade38b6a0b3428f74c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 310f5e955f3a27fbcba6d30f3ad6b8f7c39c8788)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-11 05:48:23 +00:00
Eirik Aavitsland
b11608fa80 Fix Qt 6 performance regression when painting outside device
Painting wide lines and filling would be clipped to cliprect (by
default, the device rect) only if the bounding rect coordinates
exceeded QT_RASTER_COORD_LIMIT. In Qt 6, that limit was raised from
2^15 to 2^23, so a lot of time could be spent on rasterizing elements
that would anyway be outside the rendering area.

Fix by instead clipping whenever the path to be painted overshoots the
cliprect by a significant margin. At this point, the path is already
flattened to straight lines, so clipping is quick and precise. Testing
indicates that this solution improves performance a lot when large
portions of the elements to be painted fall outside the cliprect,
while not causing significant performance hits otherwise.

As a side effect, it is then no longer necessary to test the bounding
rect explicitly against QT_RASTER_COORD_LIMIT, since we already make
sure that the clip rect we check against is within that limit.

Fixes: QTBUG-110595
Change-Id: Iaf1afbb481c2d7059405f334278796ad46f5bcb6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ce7b4c734b78d24b75ecb389cf799ce85d0cc3bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-11 05:48:23 +00:00
Marc Mutz
6208cec1f8 tst_qvarlengtharray: fix MyBase trackers for swap()
I don't begin to understand the semantics of the trackers here, but
whatever they are, they break with the fallback std::swap() 3-moves
implementation and lose track of alive objects, so provide an ADL swap
that does the right thing.

Amends dd58ddd5d97f0663d5fafb7e81bff4fc7db13ba7 (I think).

Change-Id: I1cd49c95dca2d103a26c2c7ac0a896929135a6c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 49fca96d88c308bc22cd898a8d202228d185654e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:37 +00:00
Amir Masoud Abdol
e6fc599ad5 Remove "Configuration summary shown below" statement when it is not true
Cleanup the generated message regarding the configuration summary. Also
moved the flushing into the helper function.

Change-Id: I45728ac5b43613f002b6d5b07b9ad037416c4fff
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bb42e8e2c66cb4bd2b56c2e1df2e7e77cf98e501)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:37 +00:00
Tasuku Suzuki
3c92abff0d Fix build without abstractslider
qtbase/src/widgets/styles/qcommonstyle_p.h:102:53: error: field ‘animations’ has incomplete type ‘QHash<const QObject*, QStyleAnimation*>’
  102 |     mutable QHash<const QObject*, QStyleAnimation*> animations;
      |                                                     ^~~~~~~~~~

Change-Id: Ib7b4a5031c1447248f4db1f4ea6629a31d610bcb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 86d8d67146e20ac9d342a9d8c6901b35c899427e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:37 +00:00
Antti Määttä
78ef28b45f CTF: Fix minor problems in the implementation
- Check if trace location is writable
- Call fclose only if file is opened
- Convert metadata to QByteArray in one place.
- Add constraint to array operator.

Change-Id: Id01998fe8e754dab7a4b7d8ce1361ac822d01390
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
(cherry picked from commit 1d0da1d683cc71ea14cfd85f5e9aa227d7f75762)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:31 +00:00
Ahmad Samir
967609ad49 QtMiscUtils: add some more character helpers
isHexDigit, isOctalDigit, isAsciiDigit, isAsciiLower, isAsciiUpper,
isAsciiLetterOrNumber.

This de-duplicates some code through out.

Rename two local lambdas that were called "isAsciiLetterOrNumber" to not
conflict with the method in QtMiscUtils.

Change-Id: I5b631f95b9f109136d19515f7e20b8e2fbca3d43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 498f3452285aa44580e1d03baeec126d475f8401)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-10 23:47:31 +01:00
Christian Ehrlicher
19db73bd8b SQL/MySQL: Fix retrieving a datetime for libmysql >= 8.0.27
Somewhere between libmysql 8.0.18 and 8.0.27, the MYSQL_TIME structure
gained an additional member which increased the struct size by 4 bytes.
This makes an internal check for the correct size of the structi go fail.
Since it can now happen that the plugin is linked against a new libmysql
and used with an old and the other way round, duplicate the old
MYSQL_TIME struct to use this in our code

Fixes: QTBUG-110967
Change-Id: I5bc631179a0a1be47a5966954e757f27a72f1592
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c67cc6d5706fa732ee78e286e0142f97f5b9d61f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:30 +00:00
Christian Ehrlicher
ff2cdec545 SQL/ODBC: add handling for SQL_SS_TIME2
MSSql Server sometimes returns SQL_SS_TIME2 instead SQL_TIME. Since this
value is non-standard, we have to define it by ourself.

Fixes: QTBUG-109206
Change-Id: I40a4b32590d877ebfdc4b2f1d9080d8cdb2ae7a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ebac2081244bc1f075bc16da6ce59cbd5122c7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:30 +00:00
Mårten Nordheim
2ea02032b3 double-conversion: Update to 3.2.1
Retrieved from/changelog here:
https://github.com/google/double-conversion/releases/tag/v3.2.1

Task-number: QTBUG-110333
Change-Id: I3e1af9adca37d89ce91812d594e9dd222d35ba8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 132de92c1b4f9cd64cd1c21e9b378a6c452384e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:47:30 +00:00
Antti Määttä
5d2bcf3f3d Trace: Autogenerate metadata in qtgui module
Change-Id: I300ecb9d25f0ecb7208c643704adf66bdf0a4b56
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit c6ba34c7f82653fffbc43bc9b4a93442c75359ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 16:03:59 +00:00
Antti Määttä
90dc58ab1e trace: Remove unused tracepoint files
These can be removed now that the modules use tracepointgen tool.

Change-Id: I265e019f99e1ccc557a284ff53b110073066e530
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 48f0d458a941574ebb6b1ca6fd2ef5c8676726ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 16:03:54 +00:00
Antti Määttä
4af8eef9b0 CTF: Move event metadata generation to the wrapper
This fixes the metadata generation when cross compiling. The metadata
needs to be generated based on the type info of the target. Currently
the metadata is generated in the tool based on the host type info.

Task-number: QTBUG-110270
Change-Id: Ibcdcbd690620afc532d6007cf036229342bdcc31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c5d4c9345bc5a8d146592a7b933242fcf22358ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 16:03:53 +00:00
Antti Määttä
c290537cd5 CTF: Fix plugin cleanup
Handle cleanup of the CTF plugin correctly. The cleanup causes recursive
trace event so the plugin needs to handle this.

Change-Id: Id6f4c6efe95e51332a8be97fecdf7886ba173e43
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
(cherry picked from commit b652d9753bb474b3bc6c881dcb4b40a5a01ddcff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 16:03:44 +00:00
Tasuku Suzuki
93b15be524 Fix build with -no-feature-textedit
qtbase/src/widgets/styles/qstylesheetstyle.cpp: In function ‘quint64 extendedPseudoClass(const QWidget*)’:
qtbase/src/widgets/styles/qstylesheetstyle.cpp:2577:1: warning: control reaches end of non-void function [-Wreturn-type]
 2577 | }

Change-Id: Id53d637d43a8d530a7bdfbd7d5b823162d1399b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 29e739f93852dcf3d431bd944b3ec7ac5c7bf3fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 15:34:22 +00:00
Tasuku Suzuki
680a7259e1 Fix build with -no-feature-gestures
Disable xcb touchpad gesture when gestures is not available

Change-Id: Idd2fec38646fad4cbda20ab1e560949c8e8844ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 79b8bf983dc86bc423ec8016d9e3fd5588a3cbed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 15:34:21 +00:00
Tasuku Suzuki
96574333cf Fix build with -no-feature-toolbutton
Change-Id: Id583165602e84ea0fae972c377ced30e4a4d96cb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3932417dc9b81c7ffcf9f4156c7645d04f8f4971)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 15:34:20 +00:00
Eskil Abrahamsen Blomfeldt
a44b695026 Don't do font merging for PUA characters
The "Private Use Area" are subsets of Unicode which are not
considered regular characters, but reserved for fonts to provide
custom glyphs.

If these were used and the main font did not have support for them,
we would look them up in other fonts and sometimes display an
arbitrary selection of glyphs, based on whatever existed on the
platform. This is unexpected and different from how native apps
work on Windows, for instance.

[ChangeLog][QtGui][Text] Font merging (automatic assignment of
alternative fonts) is no longer applied for characters in the
Private Use Areas of Unicode.

Fixes: QTBUG-110502
Change-Id: Id2c63786aafda59bf170e0d7263eb78a391fe46d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fc33fea999365c36ed446eee0db0d59d94be306b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 13:56:46 +00:00
Liang Qi
e31cbbaefc fbconvenience: use smart pointer for QFbCursor
Fixes: QTBUG-110785
Change-Id: Id82fc300c5716ce68a2609b7fb36195f2d37e322
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit bb84232b0540ba834747459b68458054b7107541)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 13:56:44 +00:00
Matthias Rauter
3851964388 Return transparent background color if no brush is set
Fixes: QTBUG-110751
Change-Id: I6fa33ba22b0209da6c9e1022851f84c892a5ae5f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 9086bc7fd3dbe619fe28871690de2f70162af643)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 13:11:22 +00:00
Antti Määttä
0b279438b2 Trace: Convert qtwidgets module to use tracepointgen tool
Change-Id: Iaa993387ecbaeab66c1bd226a85c9ab6d876b157
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 63b164aa2f9ae2b9c15133f290013006d4ffc4f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 10:40:10 +00:00
Antti Määttä
ce2c12be41 Trace: Convert qtopengl module to use tracepointgen tool
Change-Id: I441455a4d49a559fb591ea5c8cffb97af66fb2b1
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 4d359e2bec96507a1bc698525f4b5eda57b4a48f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 10:40:09 +00:00
Antti Määttä
22dad3f83c Trace: Convert qtcore module to use tracepointgen tool
Change-Id: I379896280a16cd0b94d7ee9d0cfcca4afe64b9fe
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 4ce1c1d93252c0fbe8224faf7416b8e5a5a21d76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 10:40:08 +00:00
Antti Määttä
0fd4dd9f68 Tracepointgen: Parse metadata from include files
The tracepointgen tool needs to know the enumeration/flag names
and values in order to generate metadata for the tracepoints
in order to pass this information when tracing.

Currently the metadata needs to be provided to the tracepointgen by
hand. This implements metadata parsing from header files.

Task-number: QTBUG-110598
Change-Id: Ibb2cc6e724fd2defca4e301af2285b0fdbe8e7f7
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
(cherry picked from commit 59aa9e86c6424234d1898c216dcd9c03ea4ac0d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 10:40:00 +00:00
Friedemann Kleint
8f146e109e QtCore: Add exclusions for Unity builds
Task-number: QTBUG-109394
Change-Id: I055fbc29e85cbb58af9c5a423f6f7be4fbb0c40a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fc3a9ee60159b2391cba2320cfdeeddb94d781f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 19:12:52 +00:00
Tor Arne Vestbø
29c6d4ac90 Prepare for replacing Qt::Appearance with Qt::ColorScheme
Based on discussions in the 6.5 API review, where we concluded that
'appearance' is too general. Instead, we follow the CSS standard
and use the term 'color scheme'.

This patch is a first step, only introducing the new API, so that
submodules can port over. The next step will be to remove the old
API and transition the docs and platform themes.

Change-Id: I43cdb6bb1ccb49c535c06b1897821467fd83ca60
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 92f5836fe8611d6f7a70efcc3b0dd5db262ba175)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 17:55:49 +00:00
Mårten Nordheim
730c668612 QSysInfo: Work around erroneous warning output from Windows
gethostname is in no way labeled deprecated, but it _tries_ to query
some deprecated functionality, thus some warning like this is printed:

""
LogHr(1) tid(6e14) 8007277C No such service is known.
The service cannot be found in the specified name space.
""

By using GetComputerNameEx we work around that. Bonus side effect is
that it gives us UTF-16 right away so we save a conversion.

Fixes: QTBUG-110468
Change-Id: I3a370354d9cce50e3d89d125ce61fc9b619294cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0f50145e433d2ac4ad2f4371ce627d2e0c2e0efd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 17:55:48 +00:00
Alexey Edelev
744aac988b Expose files locating in QT_ANDROID_PACKAGE_SOURCE_DIR to IDE
"GLOB_RECURSE" files in the QT_ANDROID_PACKAGE_SOURCE_DIR directory
if it's specified and expose them to IDE.

Fixes: QTBUG-110810
Change-Id: I3c4d4fdf0dff8965fd277672ef9d77453839b4cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 478a5248f329172a9c371947ca4b24cfe60e8c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 14:57:46 +00:00
Alexey Edelev
f491016c4c Use the existing imported location for syncqt in developer builds
In developer builds we don't install tools, so syncqt executable is
located in its RUNTIME_OUTPUT_DIRECTORY but not by install path. This
works fine in general case, but in multi-config builds the
RUNTIME_OUTPUT_DIRECTORY path doesn't match the install path. So syncqt
target points to wrong location in this case. It makes sense to use the
existing IMPORTED_LOCATION of syncqt executable directly if Qt is not
supposed to be installed. Also check if the syncqt executable exists at
the expected location before creating the imported target.

Fixes: QTBUG-109864
Change-Id: I0de647b2a73169a0d48bd88edeb7ff00975fa774
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2bf54da75ae77ca4f660dc23ef9c917e5eb86a9d)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 13:34:47 +01:00
Alexey Edelev
7e198c8fa2 Change the RUNTIME_OUTPUT_DIRECTORY for configure-time executables
Set the RUNTIME_OUTPUT_DIRECTORY for configure-time executables so
executable will be located inside the QT_BUILD_DIR. This allows to
re-build syncqt and make sure ithat ts binary is replaced and located
in the libexec directory.

Comment on how to rebuild syncqt. Configure-time tools reserve the
original tool name for the imported executable. To re-build syncqt use
'syncqt_build' target.

Task-number: QTBUG-109792
Change-Id: Id7d912b1d75d18d82cb2a69fbd62b89440120d78
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6f7d09677a0759328bd27388c320ff60b45c6aff)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 13:34:44 +01:00
Amir Masoud Abdol
56214249a5 Remove the extra quote, now that we use cmake_parse_arguments(PARSE_ARGV
The extra quote enforces the arguments to be string, and stops the
COMMAND_EXPAND_LISTS within
QtDbusHelpers.cmake::qt_create_qdbusxml2cpp_command from expanding it
as a list.

Fixes: QTBUG-110459
Fixes: QTBUG-110450
Task-number: QTBUG-99238
Change-Id: Ifddd6570c7bf8f2d1757f275d9445ce2924a93f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 897579edabfadd8309581659b578752b3c3bca0f)
2023-02-09 13:34:41 +01:00
Amir Masoud Abdol
dd03b22d10 Fix the broken test after the retirement of qt_parse_all_arguments
As we are now processing the arguments with
cmake_parse_arguments(PARSE_ARGV, we don't need to pass the escape
characters anymore.

Task-number: QTBUG-99238
Change-Id: Iea9cda4fe0ae56043cc4d7db29ce53d9d737d645
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 90aafa0470570d873292633ef7072fb02783cc06)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 13:34:39 +01:00
Amir Masoud Abdol
bc66951940 Retire the qt_parse_all_arguments
This replaces the qt_parse_all_arguments macro with the built-in
`cmake_parse_arguments(PARSE_ARGV`. In addition, a new function,
_qt_internal_validate_all_args_are_parsed, can be used to check whether
any _UNPARSED_ARGUMENTS have been passed to the function.

Fixes: QTBUG-99238
Change-Id: I8cee83dc92dc6acdaaf747ea6ff9084c11dc649b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7e82577680fb20413cdcfd93a982c52e9d9d095e)
2023-02-09 13:34:36 +01:00
Amir Masoud Abdol
814ae99a25 Replace the impl of qt_configure_file with qt_configure_file_v2
The new version uses PARSE_ARGV which deals with semicolons better.

Task-number: QTBUG-99238
Change-Id: Ie9276219400326a67ffa9cf5fc456ae7de0bbcd2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dc00369c56f5768bcbed06d6179ddb3f68fdfaf8)
2023-02-09 13:34:33 +01:00
Kai Köhne
01ff86c190 Doc: Mark new QShortcutEvent constructor with \since
Change-Id: I32580a29e3d5bbeca2832c421e07cec094e9576d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8fef0f04008f36694262499de748ff5163f9715d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 11:48:35 +00:00
Joerg Bornemann
4f4db96f63 CMake: Fix directory scoping issue for qt6_generate_deploy_script
Consider a Qt target created in a subdirectory and a call to
qt6_generate_deploy_app_script(target) in the parent directory.

Once qt6_generate_deploy_script (called by
qt6_generate_deploy_app_script) is run, the target has already been
finalized. However, qt6_generate_deploy_script needs to run before
finalization, because:
- qt6_generate_deploy_script marks the target as to be deployed
- the finalizer generates plugins information only if the target was
  marked to be deployed

Fix this in qt6_generate_deploy_script by checking whether the target
was already finalized. In that case, generate the plugin deployment
information right away.

Fixes: QTBUG-109741
Change-Id: Idf60f9e21f038c1a33843177d9299230857ee70b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6c28528e40bc0e730ef3828595b4ef83a373a697)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 10:42:43 +00:00
Antti Määttä
53ce8ebfbd Add Q_TRACE_LOCATION to android support
This is needed for tracing android devices.

Change-Id: Ic04e15b43b426bdb1232e671acb4163165eab666
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 5ae8417c4f6348ab9f78a93fbb83e0c27c57d288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 10:42:42 +00:00
Friedemann Kleint
1fa935d93e Short live q20::construct_at()!
Move the helper from qsystemsemaphore.cpp to q20memory.h
to prevent clashes in CMake Unity (Jumbo) builds.

Manual conflict resolutions:
  - file-local construct_at doesn't exist in 6.5

Task-number: QTBUG-109394
Change-Id: Id0127af1f0d51c87a5887090cc90ab232eff8093
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 72c2cdbc572f8b8b45a57a451e2bc19bb1c53b0c)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-02-09 07:19:43 +00:00
Lorn Potter
db26a9c397 wasm: fix multitouch processing
Not all touch points are changed as per emscripten event, so we
do not need to remove or add them to the touch event

Fixes: QTBUG-110941
Change-Id: I4799ef0c05750a36361836698eb83e5bf844ece8
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 56068f3a36a2f8e23a2a5e43a28e463a5aa6b400)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 07:17:15 +00:00
Volker Hilsheimer
02cade3337 Move findfiles example into manual tests
The example follows bad and outdated practices:

- running time consuming and I/O heavy workload in the GUI thread
- calling processEvents to keep the UI responsive
- showing results only at the end of a search rather than continuously

Perhaps this example can be rewritten at some point to apply modern
practices (at least use a thread and emit signals), but it seems
to have low overall educational value.

Moving it to be a manual test for now.

Fixes: QTBUG-111002
Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 3fe0bf6e1bd3713543a5b763d3bfcee0c03faf4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:04 +00:00
Volker Hilsheimer
17f0590e0e Examples: move widgets/codeeditor into manual tests
It's not a very well written example, using (largely unneed) hacks to
implement what it does. It's also misleading - the syntaxhighlighter
example is a better showcase for building a useful code editor.

Move it to manual tests.

Fixes: QTBUG-111025
Change-Id: I405d41688235bf3e9a08373e716769f26d02fec6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 48a1a5564f89e1e8f0b6f4a28398e4ae0b3f751c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:03 +00:00
Volker Hilsheimer
5daf2da55a Turn elidedlabel example into a code snippet
The example is 90% boiler plate for subclassing QFrame and providing
a bit of GUI to change the size of the label using sliders. The
interesting bit is a block of 25 lines of code, so turn those into a
snippet and add that to the QTextLayout overview documentation.

Fixes: QTBUG-111011
Change-Id: I6e97b2ea47b553c8d998ad185cfac006721ef7ee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 55f2b448b0aec4e9a8fd3896b2a40f37e939ecb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:03 +00:00
Amir Masoud Abdol
913d6e1c53 Add some utilities for UNITY_BUILD
- The following commands accepts NO_UNITY_BUILD, and
  NO_UNITY_BUILD_SOURCES arguments to opt out of the unity build, and
  to exclude some source files from unity build, respectively.
  - qt_internal_add_executable
  - qt_internal_add_module
  - qt_internal_add_plugin
  - qt_internal_add_tool
  - qt_internal_extend_target
  - qt_internal_add_common_qt_library_helper
  - qt_internal_add_cmake_library
  - qt_internal_add_simd_part
- Unity build is disabled by default in these:
  - qt_internal_add_test
  - qt_internal_add_test_helper
  - qt_internal_add_benchmark
  - qt_internal_add_3rdparty_library
- qt_update_ignore_pch_source also excludes the files from unity_build

Task-number: QTBUG-109394
Change-Id: I5d0e7df633738310a015142a6c73fbb78b6c3467
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 31518f1a4e3c4a7c77ae2e008e903a849ba75dd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:03 +00:00
Christian Ehrlicher
46f6a10663 Fix QVariant(QString) <-> enum conversion
A QVariant(QString) was not convertible to an enum not registered with
Q_ENUM() which worked fine in Qt5.
The same problem exists for QVariant(enum) to QString.
Fix it by not bailing out when no metatype for the enum was found and
try to convert it to a qlonglong instead (which is then correctly
converted to the enum type).

Fixes: QTBUG-109744
Change-Id: Ie7bb016a860455b69508f0f46b36474c9c294f3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66a1a71f1f92156548da487739129fb0f494c895)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:03 +00:00
Volker Hilsheimer
ce89ab80da Clean up QUtiMimeConverter API
Based on header review comments, make the internal constructor private
and declare classes that need it as friends.

QFlag-ify the HandlerScope enum, as it is a list of flags, and adjust
code accordingly.

Change-Id: I1d8843265e49e696d463e9eea8306f4dbae75c78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1dc5e20c16353476ee4b449343a8fbe78a9ac7d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 00:02:03 +00:00
Laszlo Agocs
0134e56859 Avoid glDrawBuffers on ES 2.0 / WebGL 1
Fixes: QTBUG-111007
Change-Id: If1d84df56ad47ac89ea43ad5091392416fe9fc5f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 8f1d8139c40d8b050ac606c3d62eee7f1f37410f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 20:27:39 +00:00
Friedemann Kleint
83b2d0292f QtGui: Add a header declaring the Windows image conversion functions
The declarations with default parameters cause
conflicts in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: Icf48193498d70dfacadf1b2499cb3359169f72c0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 65cda1f06aa24d9b75e81b37a5c23dcedbc53b92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 20:13:20 +00:00
Volker Hilsheimer
2670f7dcf1 Silence some qdoc warnings
\internal needs to be on its own line, otherwise qdoc doesn't know what
\a means.

Change-Id: Ie7bd2fd779540b8d7ea92f9d1dd94e73a771d2b6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d3dfe5a3b7e657b088f4e77e36b8d57229a13733)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 19:07:51 +00:00
Marc Mutz
0a6db5eb7b savegame ex.: fix include order [2/2]: game.h
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.

This example didn't follow that guideline. Fix.

Amends 88e8094f18e6581f2b652eb3d82f514ecf687046.

Task-number: QTBUG-108857
Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ac6e8b3b21c2ae25e7a4fe483b604ea6ddecd3ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:35 +00:00
Marc Mutz
53dd3ff490 savegame ex.: make Level ctor explicit
A QString is not a full representation of a Level, so the
Level(QString) ctor should be explicit.

Task-number: QTBUG-108857
Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fa55d46e1f09ddf45dbe5700d4637b003363c559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:28 +00:00
Ulf Hermann
ef609e0c23 Revert "Don't include qnetworkproxy_generic.cpp for iOS"
This reverts commit ce955d1907ac57d25571e82f57cd94f5abe883e1.

Reason for revert: There is no qnetworkproxy_darwin.cpp in 6.5. This
shouldn't have been picked back.

Fixes: QTBUG-111010
Change-Id: Ic58b3e1a2893cc1e42cba806701f4db7b98302f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-08 07:58:41 +00:00
Marc Mutz
e1257fdd5b savegame ex.: fix include order
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.

This example didn't follow that guideline. Fix.

Task-number: QTBUG-108857
Change-Id: I42727ff8bdef5336368cde349cbcb8d10bb6289f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 88e8094f18e6581f2b652eb3d82f514ecf687046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
4eafbe2a5e savegame ex.: use NSDMI, =default the default ctor
Modernizes the code.

Task-number: QTBUG-108857
Change-Id: I6ddf1de3699506ffc0fc4b1034ab48defafcf174
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 35b94f8b4349581c548b7aac2e858750072efa19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
c0f5c0a926 savegame ex.: use ranged instead of indexed loops
Modernizes the code, and fixes qsizetype/int mismatch.

Task-number: QTBUG-108857
Change-Id: Id4262ee0bcb673d62135a81c30976903eef3e5e2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 44933343937d7a6d9f6afe1f8e0b0f93a387b100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
7bb8bf9f57 savegame ex.: fix extra ';' after Q_GADGET
Fixes compiler warnings.

Amends 1ff52e478bab33f3aaba5ec185295411a0e6867d.

Task-number: QTBUG-108857
Change-Id: Id8b81c67e55baf490aabd0483b5800b3e61965ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 06a9b85f8fec8d039aa0e63cea0e16037611bf79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Marc Mutz
a14c8b4540 Qt::Appearance: don't assign values to enumerators
The compiler does that for us. This makes the enum look like an enum
again. A non-flags enum shouldn't have intializers of the form 0xNNNN,
as that makes it looks like flags.

Found in API review.

Change-Id: If49e94cdad719b7dc9e8a7b17f6883dc789e62d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ee1bd7decd2c3e55245f89afb710543c95424221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:57 +00:00
Thiago Macieira
310f666615 qdbusxml2cpp: invert Q_DECL_DEPRECATED and inline in the output
Commit 93dad2bf91d414a41c6e2c7db6c75171b4917d4d (6.0) changed
Q_DECL_DEPRECATED to use the [[deprecated]] attribute, which must appear
before inline and other keywords.

To keep it next to Q_NOREPLY, I also moved the "inline" into the next
string.

Added missing tests for both.

Fixes: QTBUG-110979
Change-Id: I9671dee8ceb64aa9b9cafffd1741656e86f40453
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f67b32e735cbbed6848b5d40a61329f71f54a14d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 03:47:50 +00:00
Thiago Macieira
8737086956 tst_qdbusxml2cpp: test the old-style QDBusReply interface output too
Change-Id: I9671dee8ceb64aa9b9cafffd17416487c07f148a
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 0128c3742e92cd38e6bb5fadddae57f31cd01690)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 03:47:42 +00:00
Tor Arne Vestbø
d0783c2c0c macOS: Skip deployment target runtime check when detecting compat version
When the main executable is built with a pre-macOS 11 SDK, the macOS
kernel and system libraries will enable a compatibility mode for
reporting the system version, reporting 10.16 instead of 11/12/13 etc.

This happens at at such a low level that even manually reading the
version from /System/Library/CoreServices/SystemVersion.plist is
intercepted.

Working around this by temporarily setting the SYSTEM_VERSION_COMPAT
environment variable is unfortunately not possible, as it's only read
on process creation/initialization.

The same goes for the kern.system_version_compat sysctl, as once it's
set it can not be changed back to its original value, and it's not
clear whether this sysctl should even be touched.

As long as we have no reliable way of reading the actual current
operating system version, we need to bail out of the deployment
target verification, to avoid false negatives where a plugin or
library, built with a deployment target of say 11.0, is loaded
into an application built with a pre-11.0 SDK, but running on
macOS 11+.

Change-Id: I9c757a276726175c5dda694ffc1b88f1681d00fb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit bac93ce5eba10ae1e5d165b464a7a9e3b4dd6561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 02:51:40 +00:00
Tor Arne Vestbø
49326b8135 permissions: Replace deprecated location permission usage key
And add the macOS specific key.

Change-Id: I1e0446a1927ef530322388417b9300ae287752c3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit a3697f2b84e87590a451664c3fe9328a8e2087bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 02:51:40 +00:00
Ahmad Samir
80a6048ab1 QStandardPaths/unix: ignore relative paths in all $XDG_* env vars
This is a continuation of commit 5c9d671bfb5b511106.

[ChangeLog][QtCore][QStandardPaths] Improved conformance to the
Freedesktop basedir spec by ignoring any relative paths in XDG_*
environment variables.

Fixes: QTBUG-58043
Pick-to: 6.4 6.2
Change-Id: I7c34143ced97d6d3de6ecbf13bccf9e935462d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d4f72b4de63fe0622908c7657f9724bad359574e)
2023-02-08 00:51:40 +02:00
Fabian Kosmale
c01296e5f1 Fix proxy-data handling
This addresses two different issues:
- Firstly, we were casting the resolved binding data pointer to
  QPropertyProxyBindingData, instead of the d_ptr of
  QPropertyBindingData. Fix this by introducing a helper function,
  and consistently using it to access the proxy data.
- Secondly, we were not resetting the originalBindingData when the
  pointed to object was destoyed. Fix that, too.

Task-number: QTBUG-110899
Change-Id: I7691c9df5cc26e761f6b0e5f16d152f7f2183208
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 55ca636180db2b7870b5b519c4163487b672a9f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 22:34:37 +00:00
Albert Astals Cid
157c2d46ad dbus: Register QDBusObjectPath
Fixes: QTBUG-108822
Change-Id: Ib6d1a9cfc449df80cb7e5ad6211b07bdfd556093
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d619a952cdcdf0a0ca163e8513f0843f8bc9c2dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 22:34:37 +00:00
Amir Masoud Abdol
ea2c76147d Rename Qt CMake policies argument names
We decided to go with REQUIRES/SUPPORTS_UP_TO.

Task-number: QTBUG-96233
Change-Id: Ia82d22618d31c06b5260a632ba079eeba7a506e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 04a3e411ec0b961f2561a749f9e8f27a498c954c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:44 +00:00
Mate Barany
b66a83b74e Update CLDR to v42
New languages (and one local for each) added with v42
- Haryanvi
- Moksha
- Northern Frisian
- Obolo
- Pijin
- Rajasthani
- Toki Pona

It also appears that Canada has changed its date format. Modify the
relevant test case to reflect this change.

Task-number: QTBUG-110333
Change-Id: Ia8975c2866cd54c9e565543d05bacd52f4987909
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9a8b9473d5f0fd4639193481ba9b344d91f3f00a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:44 +00:00
Topi Reinio
970acb6e4c Doc: Update copyright year in the template
Fixes: QTBUG-110271
Change-Id: I70ce5356941d2499a219ab9fb1875df23acda3dc
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 275d510ce322a2cbacaa7879bc3d90fdf785cef3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:44 +00:00
Tor Arne Vestbø
a015038806 macOS: Reduce verboseness of NSUserNotification deprecations
Task-number: QTBUG-110998
Change-Id: I8fe252a9f6798e38f77c96b715f334427ffd062e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 364c462d806b63a7840706d7a436e09930d35314)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:44 +00:00
Pino Toscano
733263d848 Add/enable Alpha detection
- uncomment the Alpha detection defining Q_PROCESSOR_ALPHA, which is
  already used/documented in few places
- set the right machine type in QElfParser for Alpha ELF files

Change-Id: I072bdee8b73ad3c86591c764aa7075c114967fd9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
(cherry picked from commit eeb66b99df521c4a32b8eda1d889f615319355a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:44 +00:00
Giuseppe D'Angelo
5486628918 XCB: do not use reserved identifiers
Any identifier starting with underscore followed by a capital letter is
reserved for the implementation in C++, so don't use them. Rename the
entries in the Atom enumeration by adding an "Atom" prefix to them.

Change-Id: I059e2093149f39cc9324cd1159c0d9e076eda93a
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3d72e8829fb9ebcd3b1179b54ad4053de05368ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:43 +00:00
Yuhang Zhao
557ee37b8f Use qt_winrtbase_p.h workaround in more places
This patch addresses the following issues:
(1) some places are still using the original workaround, replace
them with the new qt_winrtbase_p.h workaround.
(2) add more comment to let people know how to workaround other
cppwinrt issues (it was a common issue for many years and may be
fixed upstream recently, but let's at least document it in case
the user is still using old version cppwinrt).

Amends commit b2c1237b4512480a17009afe1981af02c2a9869e

Change-Id: Ife676f41739bbe69d9fb23bf5758be4b1fab4855
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit ad7227ada177dec4e61e8bbc51dd70f00a6e3d15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:43 +00:00
Amir Masoud Abdol
21362fd244 QtGui: Fix some macro clashes
Macro Q_FIXED_POINT_SCALE in qpathssimplifier.cpp clashes with
the macro with similar name in qtriangulator

Task-number: QTBUG-109394
Change-Id: I02732ae62238e8b7fae0630764fdd33b6203afe3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 34519d44ffd0327a676f6af41f63191912b583e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Fabian Kosmale
3192d46c39 QMetaObject: Fix version check for deprecated methods
We don't want them in Qt 7.0.0, either.
As a drive-by, also guard the implementation with the same check.

Change-Id: I21b181e5563ebc2b247d6c5ad005bb76224f0daf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 115a38613c0ed0ea1d6c82d927809074cb69f385)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Jan Arve Sæther
1bfa58f11c Remove "Analog Clock Window Example"
This is almost exactly the same as the "Analog Clock" (widget) example.
"Analog Clock Window Example" demonstrates:
* How to render to a QWindow (covered by RasterWindow example)
* QPainter and transformations (covered by Analog Clock example)
* How to use QTimer (covered by Analog Clock example)

Change-Id: I7f20a29798830ed6345eca250e4139cb314cab84
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit f7db1cfa92896135534f6ab140d1470e56a5d677)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Alexandru Croitor
7cda805338 CMake: Show a message when configuring examples
This somewhat indicates the progress of configuring a specific
repo and the slower period of time when configuring examples
in-tree.

Change-Id: I643536c4ebc865933730b7af2a1d0c56bbbf2912
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4a4c3296870ef5fbeefddd1022a0eefa8bb6f5e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Matthias Rauter
742f497bae Use plain text to calculate expire time of tooltips
Fixes: QTBUG-110735
Change-Id: I3f0db04f3be9707167f7c19507ebbb5a9c4466d2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 285c326ef4070b768f7a6ef7a38fb2c2976fe572)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Amir Masoud Abdol
2c8d77ff3b QtGui: Remove double default definition
In all the cases below, the parameters are defined in the
qtestsupport_gui.h as well.

Task-number: QTBUG-109394
Change-Id: I3311d6c23b3a811dbe20286bd4534ca1ed7cd7f3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit edc62595f27ad820b2edfe2d6158925676131590)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 18:51:42 +00:00
Ahmad Samir
668560f8bd QStandardPaths/Unix: fix logic in xdgDataDirs() function
This method correctly ignores relative paths (as per the XDG basedir
spec), but checking the list of dirs is empty should be moved to after
splitting the env var, because even if the env var is not empty, if the
paths in it are all relative the resulting list will be empty.

Drive-by change: Split some code to a static helper, which will be
used in xdgConfigDirs() too.

Pick-to: 6.4 6.2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: If894751ba68b24ccc214f9a4bb2099be3f0e4349
(cherry picked from commit ee515dd842d79fa4543568ed82bd7c949923e438)
2023-02-07 20:51:41 +02:00
Ahmad Samir
f4eacea72b QStandardPaths/Unix: minor cleanup
- Better readability by returning early
- Make a QRegularExpression static const so that the regex pattern is
  compiled only once

Pick-to: 6.4 6.2
Change-Id: Ic0d6bd4b068624c4ff60c6e71d09f20393adaa64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 482a75fef9643220366029862dbf636a88bccb82)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2023-02-07 15:59:18 +00:00
Tor Arne Vestbø
27761744b6 permissions: Set explicit bundle identifier for permissions example
It's needed for location permissions to work.

Change-Id: Iffb5d92f863ab79434b4071d5896b349010f87fb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0c2ee11f41a8768ff796f6d63a34d099c00d01d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:29 +00:00
Tor Arne Vestbø
1517e5ff0a iOS: Report PermissionStatus::Denied when detecting accuracy mismatch
There's no way to upgrade an Approximate accuracy permission to Precise,
so once we have a known status we report the lacking accuracy as Denied.

Change-Id: Id49af825335ff09669aa7f2285caaa744a5a4d24
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e2030e366b73f5af9e60c987e498f21f9c985f68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:29 +00:00
Joerg Bornemann
5b9b2d8f3f CMake: Warn about double qt6_finalize_target for plugins and libs
qt6_finalize_target warned about double invocations on executables
already. For libraries and plugins this situation wasn't detected.

Make the warning consistent for qt6_add_executable, qt6_add_library and
qt6_add_plugin. The internal property _qt_executable_is_finalized has
been renamed to _qt_is_finalized and applies to all targets that can be
finalized.

Change-Id: I06821d08042e1453f3e058ed90a13e90a4f06640
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 19c32e7ee70bd6ad291fb76f7db015b712fe8981)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:29 +00:00
Tor Arne Vestbø
ffd312d565 permissions: Handle relative paths to Info.plist file
Change-Id: I5fb6bd7da37392bb4a44309b4545fe158a60b3e3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 14649404bc9e30d67bbe39c698806e5846f46ac7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:29 +00:00
Tor Arne Vestbø
b99f9c50c0 iOS: Disallow upgrading QLocationPermission::WhenInUse to Always
This is technically possible on iOS, but the system doesn't give us
a callback unless the user accepts the upgraded permission level,
and we need a deterministic callback in both cases so that we can
report the result back to the permission request callback.

  https://tinyurl.com/requestalwaysauthorization

Change-Id: Id006dbbb2f6fad4b831742e4d3e904525aaa8a2a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8dc3ee03a42ccb1b047c2a8f34b5bce4e663c9d9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-07 13:14:29 +00:00
David Faure
ac0238478a Fix QDir benchmark to do meaningful things
* Include the creation of the QDir inside QBENCHMARK, otherwise
  the it can hit the cached code path where subsequent runs return
  results much faster.

* Same for the opendir()/readdir() test: if opendir() isn't called
  again, readdir() will just return null right away.

These two issues led to nonsense results like 0.00025 msecs per
iteration, doing nothing is really quick.

While at it, port the cleanup code to QDir::removeRecursively()

Change-Id: Ic1bdd92d41efe1f6d0eaaa33eca066cb7d19fc93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eae031d5c3b02ad1d0ffe3377b252acae9294877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:29 +00:00
Santhosh Kumar
a06980b999 Avoid multiple transformation of the clip path
The painter saves existing paint engine state in the stack and restore
back to the previous state after performing required paint operation.

The clip path stored as part of paint engine state is getting
translated more than once during save and restore operation. This
multiple transformation of the same clip path causes incorrect
translation within the plane.

To fix this issue, during restore, remove translation of clip path
with redirection matrix.

Fixes: QTBUG-109518
Change-Id: I1509bc7fa4965f2802bce62c1ed27cdb90da617a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4e4d37f0472c58ff6c98e9852691b1ccda8beffb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:28 +00:00
Amir Masoud Abdol
dd92e01f45 Make qt6_extract_metatypes respects the AUTOGEN_BUILD_DIR, if set
If AUTOGEN_BUILD_DIR is set, _qt_internal_get_target_autogen_build_dir
returns that; otherwise, the default builddir/${target}_autogen will be
returned.

Task-number: QTBUG-110696
Change-Id: I028058bd0176c25bc4bc66be8abcae4f7e43a0f2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 86295c8d89d738b8cb2acffe2dbf5dc050cc1beb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:28 +00:00
Mikolaj Boc
00bb651919 Streamline reading of js DataTransfer object
qwasmclipboard.cpp and qwasmdrag.cpp had the same logic that read
the js DataTransfer object implemented twice with small differences.
Use a single implementation in both.

This also introduces a clearer memory ownership model in the reader
code, and fixes a potential race condition by introducing a cancellation
flag.

Removed the useless QWasmDrag type which was in essence a SimpleDrag
and made the m_drag in QWasmIntegration a smart pointer.

Fixes: QTBUG-109626
Change-Id: I5b76dd3b70ab2e5a8364d9a136c970ee8d4fae9c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 16bf899557febb8c0762e64ce88acf21bc84e334)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-02-07 14:14:28 +01:00
Friedemann Kleint
4ab04b35ab uic: Generate string-based connections for QLCDNumber::display()
There are still ambiguous overloads of display(), which cause PMF-syntax
to fail.

Task-number: QTBUG-110952
Change-Id: I0887a5a06b026e4d5a20ef732d5892c8ac7fb6db
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 94c16517b3f8f01309a89598e698931ef77d60db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 13:14:28 +00:00
Jörg Bornemann
ee2d72f4b3 Revert "Revert "coin: Build qmake examples in non-qtbase repos""
This reverts commit 0f5af511eaca89d1b50c4772481bf3bdca9d45bc.

Reason for revert: Examples build locally with qmake.

Task-number: QTBUG-109383
Change-Id: Ief37cda919c32f8a6275ed7d8a5f1d38dc1b9ed9
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f00dbe103584d61dc585022cb303c42dd6ce699c)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-06 08:40:49 +00:00
Marc Mutz
27422d5f4d Fix narrowing in Qt::endPropertyUpdateGroup()
decltype(QPropertyDelayedNotifications::used) is qsizetype, not int,
so don't use int to count from 0...used.  The notify() and
evaluateBinding() functions use their int argument only for pointer
arithmetic, so this is completely self-contained.

Amends fdedcb6ec650236bef4a8c8f005b5dd24ef7d77a.

Task-number: QTBUG-103532
Task-number: QTBUG-110710
Change-Id: I765a06628d330fbb57a2fbecc96d66690bb62f13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d257a56c93e58028031c41daf90d3d4e8f317846)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-06 01:26:20 +00:00
Christian Ehrlicher
0c50cf2691 SQL/ODBC: Pass correct length to SQLColAttribute()
This ensures the tst_QSqlQuery::record() test passes when checking the
tablename.

Change-Id: I146f9f627ea366c6813af61ce48b930ca1041b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9ea00c70fbbe61d4c2da98c3d9390bfbada157bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-04 19:49:29 +00:00
Assam Boudjelthia
5171131fee Android: bump minimum sdk build version QT_ANDROID_API_VERSION to 33
To allow using Android 13 APIs.

Change-Id: Ic805f1e0500ce9dee25ba28fb4ef65c7afacad65
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 63f9da73b50359c28ac770a1487562910906eb91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-04 09:43:00 +00:00
Axel Spoerl
ccd730dba4 Remove redundant include statement from qgtk3theme.cpp
QSettings was included but not needed.
This patch removes the include.

Change-Id: I9da146312f26f87eb863d6409b90988603cf46d3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4804dc9fc7b22e6e103f68c602c55e876892d5c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-04 03:09:53 +00:00
Friedemann Kleint
9df96b3e09 QtGui: Disambiguate static variables
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I3c51fb41d29e5c649537b999dced7e2d413b26a7
Done-with: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 438096371c32ea6fdcd31d6d4ad2b6d3f29fab71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 20:48:28 +00:00
Roland Pallai
1d378b87cb QXcbConnection::getTimestamp: do not return stale timestamp
The problem is `PropertyNotify` event generated by
`xcb_delete_property()` at return could be reported as an actual
timestamp at next call due to a missing `state` filter.

Because `PropertyNotify` is generated even if an unchanged property
value is set we can get rid of this delete event easily.

This issue causes observable problems in kwin_x11 (KDE project)
too.

Fixes: QTBUG-56595
Change-Id: Ice6cfa934e3769d86e9f7264e369dc5918c8542a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
(cherry picked from commit 03ac8c7397b9f070a8ef5f33b4675411293b0723)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 20:10:57 +00:00
Axel Spoerl
c64ac301ef Unblacklist stable tst_QWidgetRepaintManager
Failing test functions fastMove, moveAccross, moveInOutOverlapped seem
to be stable in the meanwhile. This patch removes the blacklisting.

Task-number: QTBUG-109036
Change-Id: I9a2b015572e4d8a4eac196d3985c052030fd84e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b464119dd497771d5c1fb0e4a35faae45641bf79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 18:49:04 +00:00
Morten Sørvig
a4891f76ca wasm: convert a11y coordinates to window coordinates
The html accessibility elements are positioned relative
to the window a11y container. Convert the global (screen)
coordinates we get from QAccessibleIntreface::rect() to
window coordinates.

Change-Id: Ifd4eb671def296b1eb418789b7ca85afa365e546
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit bf5dbc61b357e0897cafaca04f78ee4c093d5606)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 18:49:04 +00:00
Morten Sørvig
577364b0e8 wasm: fix accessibility crash on null parent
The code was a assuming that an a11y interface always
has a parent, which is not the case for the root interface.
Also factor out to a getWindow() function, to prepare
for re-use later on.

Change-Id: I52a841bf94c712deb9603e8b9c2c878820c5f117
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 34c36821578f39e9c7f99e1dd0e7887a52418b9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 18:49:04 +00:00
Morten Sørvig
79ffb2eb33 wasm: set contenteditable on canvas
We don't want to make the top-level screen contenteditable,
since that interferes with accessibility. Instead, make
the canvas contenteditable and install clipboard event
handlers there.

Also move follow-up settings which counters some of the
effects contenteditable (outline: none and inputmode: none),
and move aria-hidden.

Change-Id: Ibe73d8d097acd948ba8920c781a2003db0a14f3d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 2443f2be07607e44ec483278873702eb0f57ab26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 18:49:04 +00:00
Edward Welbourne
192291bb08 Call _tzset() before localtime_s() in qtLocalTime()
Experiment reveals that we needs to, despite hints in localtime_s()'s
docs that seem to indicate it shouldn't be needed.

In the process document that POSIX mandates that plain localtime()
behaves as if it did call tzset(), since its branch of the #if-ery is
now the odd one out.

Fixes: QTBUG-109974
Change-Id: Ic57753f246f14e183d2a56f131e8bed7347d2e20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9d1a3582f33a0820a4f0f5b7fe84a22a8c8d967b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 16:30:59 +00:00
Friedemann Kleint
5e42375127 QtWidgets: Fix CMake Unity (Jumbo) builds
Remove clashing enumeration value ColumnCount and exclude
file in snippets.

Task-number: QTBUG-109394
Change-Id: Ibd8a72d9d87e3dcbbb221c364d6b4c4f59b315df
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e73389874d6f8dbfc4743c51eb3d3889dd2da7fb)
2023-02-03 16:30:59 +00:00
Thiago Macieira
b3d5a49062 QMimeDatabase: add a test to ensure we can detect Unix specials
Change-Id: I570832c9ac8b4e03bde8fffd173f7e743f42f22b
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 9d2f3e63b86b48fd402aa126569746c9111f5ccc)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-03 05:51:33 -08:00
Mårten Nordheim
cb05ef5c76 Update the public suffix list
Task-number: QTBUG-110333
Change-Id: I741feee3a19d0a104496f543d35a1f311a7228d6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 78c5ca4c85aee9f4eed07b4144943d18985c5f49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 13:51:32 +00:00
Friedemann Kleint
abd0301c7e QtCore: Disambiguate static variables
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I5f1fbee07872a742a78adc9864fe00c710ca24d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d3f8d7fd4140b269532e2daca8eb5cbfe28ed465)
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-02-03 12:11:03 +01:00
Tasuku Suzuki
0e834f6cd7 Fix android build with -no-feature-settings
Add QT_FEATURE_SETTINGS to the android deployment conditions.

Change-Id: I7721a06733becba65b6d1e8112fa8afb0b64e120
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f54fab6125d79903ebabae1b52423ac984800d26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 02:37:12 +00:00
Andreas Eliasson
d6486bcd9a Doc: Only list qt core classes in qt core io group
The group page for Qt core classes related to I/O include classes from
other modules. Remove these classes from the group; it may confuse
the reader.

Fixes: QTBUG-110020
Change-Id: If7df85523ce6b3aa09605bd89d9899ce308d2671
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 76ecff6aebb35f4e39439aab8d18d828c3c8a1fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:52:06 +00:00
Marc Mutz
2f2cc8a49b Q_APPLICATION_STATIC: add missing std::launder()
Unlike Q_GLOBAL_STATIC, a Q_APPLICATION_STATIC can be destroyed and
re-created multiple times (if QCoreApplication is, too). This means
we're basically in the std::optional case and require std::launder()
to avoid UB when the payload type has either of the following:

- a const member
- a reference member
- a vtable and different derived classes might be occupying the same
  space at different times

While we can probably exclude the latter, because we always construct
the same type, PlainType, in the storage, the first two can easily
happen.

Fix by adding the missing std::launder().

As a drive-by, remove the uneeded casting (and now launder()ing) of
&storage when passing to innerFunction(), which anyway takes its
argument as void*.

Amends 81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8, which changed
Q_APPLICATION_STATIC to use inline aligned_union storage instead of
the original implementation's unique_ptr.

Change-Id: I065bd33812a40195109bf11d5bc79975f2f87cd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c53fdcb5ee15c309ba68717fa6564dc1ff4b8618)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:45:41 +00:00
Thiago Macieira
88689368d9 QMimeDatabase: don't stat() something that isn't a local file
We must check that the path is an actual file on the filesystem before
using native APIs. This regression was introduced by commit
047d8f36de45ebb318726167f941b0dbc64754ba.

[ChangeLog][QtCore][QMimeDatabase] Fixed a regression from 6.4.0 that
made certain QMimeDatabase functions that inspected file contents to fail
on Unix systems, if the file was not a native file (e.g., a Qt resource).

Fixes: QTBUG-110707
Change-Id: I570832c9ac8b4e03bde8fffd173f7b4c6b164192
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 40dd38813cba4bc8425e846f220e358ffb0d19ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 21:01:27 +00:00
Tor Arne Vestbø
55e6278e3d Apple: Detect missing bundle identifier when using location permissions
The location permissions database in /var/db/locationd/clients.plist
ties the location permission to the bundle identifier (among other
things), so a missing bundle identifier will result in the app asking
repeatedly for the location permission, as the permission is never
saved.

Change-Id: I64ab5b8f8762804869c0f97debd97da817787808
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit ad42833d3373604eec885702f1bc4719593d7dcf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 21:01:27 +00:00
Mårten Nordheim
cd16380e09 HTTP example: Reflow QMessageBox usage in if-statement
It gets hard to read like that.
And update mentions of 'SSL' to 'TLS' in the message while we're there.

Task-number: QTBUG-108874
Change-Id: Ia7b27bfb3d99391b14ed396ca9a6400621022bf6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7df8ef0a107ebd0f7394784366ea02b0b3956669)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 21:01:27 +00:00
Jan Arve Sæther
901ac91765 Fix analog clock example to adhere to guidelines
Guidelines: https://wiki.qt.io/Qt6/Example-Guideline

Change-Id: I12c65ae11e7906fd2e9dfb449072199560488aed
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit fd65f709748a7026428cc3a8828784cbb8421a03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 16:51:44 +00:00
Laszlo Agocs
13a885d044 Modernize the VK_EXT_debug_utils callback
...as suggested by review comments.

Switching to std::function implies that we cannot easily
do the install-remove pattern anymore as there is no way to
compare an std::function to something other than null. Instead
of making it more complicated by returning a key or something
like that, change the remove function to a clear (that now clears
both the legacy VK_EXT_debug_report and the new VK_EXT_debug_utils
callback lists).

Also add a missing call that registers the new-style callbacks that
are installed before create().

Change-Id: I66c1dd8e8dcc8eee0f5eb9671f94c2c80319dcaf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 0b20f243f7efbd612d41bab8c2000e6c9fcb13e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:57:30 +00:00
Santhosh Kumar
451995ba5e Reset dark palettes for widgets to light in windows style
Windows theme in dark mode set dark palettes for checkbox,
radiobutton, menu, menubar explicitly. The fix added as part of
a2518b4140ed88a674bf4a4fcf4576e35c698bb9 (to use light palette for
windows style) overrides only system palette and widget specific
palettes are still with dark palettes.

In this patch, the windows style overwrite dark with light palette
for widgets that are explicitly set with dark palette in windows
theme.

Fixes: QTBUG-110432
Change-Id: I2af0e517d62981f062244eeab8f1b5e5442cc451
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9a1b7c7fa59a5033344dd0b67b28de3531c92d69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:57:28 +00:00
Sze Howe Koh
a70ebbc670 QAnyStringView: fix MSVC warning C4702
The previous fix attempt at 8ba8d1346a562347c398bdd0529d34f94f2ac698
does not work when C++20 mode is enabled.

MSVC optimizes away the "else" block but triggers warning C4702 on
"return true". Moving the return line into the "else" block ensures that
it is optimized away too.

Change-Id: I9ef02cd3631ff78091530b6fb2b91c2eddcbab5d
Fixes: QTBUG-104836
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
(cherry picked from commit 4bfdf6a3d156184579e9fc66224754a6e66159dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:53:40 +00:00
Marc Mutz
89d6884fd4 Q{Contacts,Calendar}Permission: bool readWrite → enum AccessMode
The fact that read-access is always included makes a bool readWrite
property a little awkward to document and explain. An AccessMode enum
with values ReadOnly and ReadWrite is much easier, and will also lend
itself more easily as a constructor argument than a boolean.

Found in API review.

Change-Id: I4f20dbe9f19c7bdb52248a6e544e36d731d5a2ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3f33ed249bd1ae9d7c8b161792328a6696603076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:31 +00:00
Marc Mutz
f46bc118cc Q<Typed>Permission: add alignment checks for future BC changes
Ensure that the classes using ShortData have the same size (already
done) and alignment (this patch) as classes that just have a
d-pointer.

Change-Id: If30352a0bc4beb4b505d6e0eab5077c9c16456ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 2d254afead50ab0d323f562ac820f876474f3961)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:29 +00:00
Marc Mutz
bde41bcb73 QLocaleData: fix AlphaCode::op== for C++20
The old function,

   bool AlphaCode::operator==(AlphaCode code) const noexcept

is not symmetric: the LHS argument is passed by cref and the RHS one
by (non-const) value. I didn't test, but this asymmetry might actually
make the operator ambiguous with its reversed version in C++20.

Fix by making a hidden friend. Even if it doesn't fix anything, hidden
friend relational operators are still where we want our code base to
migrate to, eventually (QTBUG-87973).

Change-Id: Icb74c24802a3fe6c2987c1db86880c0d72a7abdf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7b9f4aa0fc85e8c1950f0bdc2d3802f935e25f30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:28 +00:00
Marc Mutz
05d6e3c876 QCryptographicHash: fix UB (data race on concurrent result()) [2nd try]
The previous attempt at fixing QTBUG-110058,
ccad719d2e935306e601b0f6af5ff2acb7cd272e, was incomplete:

- the if (result.isEmpty()) check at the beginning of finalize() was
  not protected, so it raced against the assignment at the end of
  finalize(), which was protected

- because the mutex was not locked during the finalization of the hash
  algorithm, two threads could perform this operation simultaneously,
  which isn't such a bad idea in principle, as it can reduce latency,
  but for that to work, the losing thread needs to throw away its own
  work and adopt the work of the other thread, but that wasn't done:
  both threads would write their result to 'result', just one after
  the other, but that's still a data race, since the eventual _reader_
  of the result cannot be protected (is outside the class). Besides,
  we don't even know whether the algorithm-specific finalization
  functions are ok with being called from separate threads on the same
  context object

- in addition, the mutex wasn't necessary when finalize() was called
  from the static hash() function, as no sharing could possibly take
  place there (the state is function-local)

Fix all of the above by largely reverting the first attempt, dragging
the result.isEmpty() check out of finalize() and into resultView() and
instead simply holding the mutex over these two calls in
resultView(). To see why this is sufficient, consider that
resultView() is now idempotent again: the result is written once, the
next thread waits and then finds the work done. All following accesses
to the result are then reads, which happen-after the write at the end
of finalize().

The accesses to 'result' from reset() need no protection, as reset()
is a mutable function, and calling a mutable function on a shared
QCryptographicHash object is already UB. Only two const functions may
be called that way.

Fixes: QTBUG-110058
Change-Id: Ia8ac095b785519682090801c1012e9dded6d60b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b904de43a5acfc4067fc9e4146babd45c6ac1138)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:18 +00:00
Marc Mutz
b52a10dc92 QPaintEngineRaster: port from QSharedPointer to std::shared_ptr
Compared to std::shared_ptr, QSharedPointer requires 2x the atomic
operations per copy, and does not support QSharedPointer<void>.

Port to std::shared_ptr, and drop the Pinnable kludge.

Add an optimistic std::move() when we insert into QMultiHash.

Change-Id: I2ab004b7e8fa36d9e777cd787ffded4076d2880f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 5ba25903882222a556a3e7558e6455e2a203569d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:18 +00:00
Marc Mutz
9656e4fda6 Q<Typed>Permission: use move-and-swap, not pure-swap, for move-assignment
While PURE_SWAP is the correct one today, this is inline code, so when
we activate the d-pointer, we may have fields that hold non-memory
resources, but it would be too late change existing binary users to
MOVE_AND_SWAP, so do it already now.

Change-Id: I18976cffe30eb4e37aa6d471cc6e75015e9b1ee7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit c2cdd7c371d7b9405728c1a30046ab3f257ee235)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:15 +00:00
Marc Mutz
88f28bbbc3 Q*Permission: un-Q_GADGET classes w/o Q_ENUMs
We can always add it back later, but for now, it's pointless overhead
(no Q_PROPERTYs, no Q_INVOCABLEs).

Found in API review.

Change-Id: I1e30fbda997e6576a3e94cbae0387a3188c27728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c307cbea90a885b3981d0d7d661e19084c6134d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:34:13 +00:00
Friedemann Kleint
63692b40e8 QtNetwork: Split out QNativeSocketEnginePrivate
The aim is to have fewer files including <windows.h>.

Task-number: QTBUG-109394
Change-Id: Id9cc08f54b5daf6d7e317fad27036dc2efaacbb8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 441c152d85e3576d109e99ad30c43003a673532e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:14:01 +00:00
Samuel Mira
652652f3ce Android: fix height calculation
The application height calculation relied on the Display.getMetrics to
obtain the size of the current app window. It works properly on stock
android and Samsung devices, but not on some Huawei and it's unknown on
other vendors. This patch changes the way the height and weight are
calculated by using the provided values.

Task-number: QTBUG-107604
Task-number: QTBUG-109268
Task-number: QTBUG-97503
Task-number: QTBUG-107923
Task-number: QTBUG-109351
Task-number: QTBUG-110501
Change-Id: I0b0d1a0e4688f10530054afd26e34f55a92ea2da
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 48ebd4e318d5fb2d7ffe4b8215cd16cf5638215e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:14:01 +00:00
Marc Mutz
9a33c5d008 SQL/ODBC: fix some users of toSQLTCHAR() to not assume identical UTF-8/16/32 string lengths
We already fixed the implementation of toSQLTCHAR() in
66767eea46bea0f19f8ae5ad6ebc641d86867701 to not assume that a UTF-8 or
UTF-32-encoded string has the same number of code points as the
equivalent UTF-16 string, but it turns out that users of the function,
as well as other code, also failed to account for this.

This patch fixes callers of toSQLTCHAR() to use

    const auto encoded = toSQLTCHAR(s);
    ~~~ use encoded.data(), encoded.size() ~~~

(except we can't make `encoded` const, because the SQL API isn't
const-correct and takes void* instead of const void*) instead of the
anti-pattern

   ~~~ use toSQLTCHAR(s).data(), s.size() ~~~

As a drive-by:
- Extract Method qt_string_SQLSetConnectAttr()
  - skipping an unneeded .utf16() call (a NUL-terminated string is not
    required for calling toSQLTCHAR())
- de-duplicate some code in exec()
  - and make a comment there slightly more informative
- replace
  - NULL with nullptr
  - size() == 0 with isEmpty()
  - C-style with constructor-style casts

Change-Id: I3696381d0a93af8861ce2b7915f212d9e5e9a243
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 46af1fe49f7f419dc1b3231de9860e2da0ea48f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 10:16:10 +00:00
Jan Arve Sæther
3a8a57aa61 Remove wiggly example
It demonstrates timerEvent() and some QFontMetrics
There are other examples that demonstrates this

Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e08575a18ace251161cc813cfe48db68b8b15eee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 10:16:10 +00:00
Thiago Macieira
2df508a41d QRegularExpression: fix count() when the RE matches a surrogate
When the match finds a surrogate pair as the first true Unicode character,
then we need to skip both code units of the pair in order to restart the
search. PCRE2 does not allow us to search for individual UTF-16 code
units.

That actually means that counting "." gives us the count of Unicode
characters.

Fixes: QTBUG-110586
Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b22ae069ac193cfa0479d0bc258a860ef00816b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 07:38:34 +00:00
Mårten Nordheim
e070aebb1f Replace cargo-cult winrt snippet with unified header-include
Change-Id: Ide9ec7e4d6c31220fa445d8acb63f7eeca60ab7c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 4cd0716c39d0251d97a268f7851b770440b09691)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 07:38:34 +00:00
Marc Mutz
7daf30ad6a ODBC SQL driver: fix conversion of QByteArray to QVLA<SQLTCHAR>
The QByteArray is assumed to contain an SQLTCHAR string (so, either
UTF-8, UTF-16 or UTF-32-encoded). Only in the UTF-8 case would the
size of the byte array be the same as the size of the SQLTCHAR string
in codepoints, yet the size in bytes is what the code passed to the
QVLA<SQLTCHAR> append() call, causing it to read past the QByteArray
buffer in the UTF-16 and UTF-32 cases.

Fix by properly calculating the string size from the size-in-bytes and
then memcpy()ing into the QVLA. We use memcpy() and not
QVLA::append(T*, n) because the QByteArray buffer need not be aligned
on an alignof(SQLTCHAR) boundary (certainly not since it gained the
prepend "optimization").

Change-Id: If3838c3dee89e6aca65541242642315b8e1fa6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c445ef0bae8b36ec4a742552f0ebd81a1a90723)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 07:38:34 +00:00
Marc Mutz
523419a306 QPermission: replace T data<T>() with std::optional<T> value<T>()
As discussed in API review, the default-constructed T() returned from
a mismatched data<T>() call is indistinguishable from a real T with
default state.

To make them distinguishable, return optional<T>. Call the new
function value<T>(), mimicking QVariant::value<T>(), and suggested in
API review, because data() is usually used to return raw pointers, not
values.

Remove the qWarning() on requestedType and actualType mismatch, as the
new function can be used in std::get_if/dynamic_cast-like if-then-else
chains, in which failure is part of the normal operation, and a
warning message misplaced:

  if (auto loc = perm.value<QLocationPermission>())
     ~~~ use *loc ~~~
  else if (auto con = perm.value<QContactsPermission>())
     ~~~ use *con ~~~
  ~~~ etc ~~~

Change-Id: I799a58e930307323ebce8f9ac50a42455e9c017f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ce104cac500096734a94e6d132e342d07d7e8af0)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-02 08:38:34 +01:00
Antti Määttä
3e0a7bf4f4 tracegen: Give warning if flag value is npot2
Flag values can have mask values, which have multiple bits set.
Give warning instead of panic if a flag value is not power of two.

Change-Id: Ie67a5d820203219ce2eb91faf5dea8d6051a5e08
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 3bffd2e01b9b2a7114e66830f49f7f0bd7752a34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 07:38:34 +00:00
Tor Arne Vestbø
c988a7eeb6 iOS: Fix build with -no-opengl
Change-Id: I014fa1772f629ef4224ac98bfc30eb5a86f38fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ae92c571a36703f6ab95d98b55d070cc57023376)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:44 +00:00
Friedemann Kleint
b9ed727556 Examples: Fix CMake Unity (Jumbo) builds
Disambiguate variables and add some exclusions.

Task-number: QTBUG-109394
Change-Id: Ie72b3caab9fd571c3fb6f7d8606584885bc09e66
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 93af309a707ea2ab133e281d837ac37b1351fb47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:42 +00:00
Konrad Kujawa
6cde2907d2 Migration from int to qsizetype of QAnimationGroup
QAnimationGroup, QAnimationGroupPrivate uses now qsizetype instead of the int.

Task-number: QTBUG-103530
Change-Id: I96053a609bc4fad32adce5616eef1af9a86f4e27
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 30344aaa49ec495912fc6ce1fd9aa9bbc8585521)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:40 +00:00
Axel Spoerl
0c8335575a Add right and middle mouse button to tst_QLabel::mouseEventPropagation
The test function used only the left button to test mouse event
propagation.

This patch adds the right and middle buttons to the test data.

Task-number: QTBUG-110055
Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 593ffd3859b2c80c498baf5323906a348de22b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:38 +00:00
Tor Arne Vestbø
2ce888d22f rhi: Remove manual release of autoreleased NSString
The [NSString stringWithUTF8String:] function returns an autoreleased
object, so we don't need to manually release it. Doing so results in
a crash when the surrounding autorelease pool is drained.

Change-Id: I3dca01e2771d4010e582c2bf770f3d2281343dc3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 780813d9b6bfc58aa45571c367071c3a44fb2b44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:21 +00:00
Axel Spoerl
2aef2eb522 Map toolbar drag delta from native pixels
The delta (drag distance) for dragging a tool button with in a tool
bar was calculated by subtracting the global mouse press position from
the drag event's global position.

This has lead to a miscalculation when dragging the button across
screens with different resolutions. The new relative position within
the tool bar became negative, which eventually has lead to resizing of
other tool buttons in the same tool bar.

This patch calculates the delta based on native pixels, which ensures
a correct value in all cases. It falls back to the existing calculation
if no window handle can be established from the tool bar.

Fixes: QTBUG-103720
Change-Id: I09168b597f6c43a119041d00f5b07e1895fdf4b3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit ff83fc75901527c0c14c481dbe9929129942c5b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:19 +00:00
Giuseppe D'Angelo
ffe98c9b51 Fix the focus frame on Mac
The Mac style uses focus in/out events (sent by QApplication) in order
to update the focus frame. If a proxy style is installed, these events
never reach the Mac style object.

Amends 5d8a7652b995124495ef4f4a43fd8cf461367d62 , by making the
forwarding limited to the events for which we want it to happen, and not
just *any* event.

Fixes: QTBUG-109375
Change-Id: I6df49aa81d6ebb8dbaf00b9ba99e2a7c006e1181
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bb055d8ab045def265bb9b3eb4e7dff1874a093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:17 +00:00
Timur Pocheptsov
4b40d70700 QWidgetTextControl: deal with empty formats list properly
Do not call first on it. A regression was introduced by
56f0ebfe860e440dcbba8997f44836debc901119.

Fixes: QTBUG-110070
Change-Id: I7c969da889b6c7ad3a67149fe99ca47830683073
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0cd153b2681437b91f07315a27238446cc24363f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:14 +00:00
Marc Mutz
69c85f2dd5 Q<Typed>Permission: don't use external state
There's no point in using the full implicit sharing machinery when the
type's state consists of two enums, a bool or, indeed, if the type has
no state at all. QRect has more state and isn't implicitly shared.

To remain extensible in the future, all that is required is that the
type contains space for an eventual d-pointer and that all access to
members (except swapping, and, as a consequence, the move SFMs, but
including the copy SMFs, ctors and dtor) is confined to out-of-line
functions.

So define a ShortData (name stolen from QDateTime) nested struct in
each of the stateful Q<Typed>Permission classes, of the same size as a
pointer, holding the trivially-relocatable fields we currently have.

If, in the future, fields are added such that the reserved[] space in
any given class' ShortData no longer suffices to hold them, or said
fields are not of Q_RELOCATABLE_TYPE, then the full d-pointer pattern
(with an actually defined Private, and detach()ing) can be implemented
_for that one class_.

The new-style classes are externally indistinguishable from the
implicitly-shared old-style ones, just a lot more efficient.

Inline the move-ctor, now that we can. This doesn't break
encapsulation, even when we eventually activate the d-pointer.

As a drive-by, drop the noexcept on the dtors - dtors are implicitly
noexcept, anyway.

Change-Id: Id90a39227277c6554ddd5895e8205485da1e39ca
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cde904b38ab6ef1ddcc9a0cbcae766cf42d58d81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:12 +00:00
Andreas Eliasson
3c929d9618 Doc: Fix broken link
Also, adjust line length to be < 80 columns and make link
parenthetical.

Fixes: QTBUG-107026
Change-Id: I5f7efa5d572103a6fb432d79a52a57363efd9dd7
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit b556d6227f848d42a10d4f0fc5424bd094e56288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 05:01:09 +00:00
Antti Määttä
0c0ba0cff0 Fix comparison sign missmatch warning
Change-Id: Id266add0a2c203c31ae76bd3dc20e625e86e5a13
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a1d43b8334f71055da606b3546d482cbcff08170)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Tor Arne Vestbø
6952cfa95b permissions: Don't try to read usage descriptions from non-existing plist
Task-number: QTBUG-110356
Change-Id: I8078556fbe67e98af2fcfe8222a8ce097df69f08
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 457300ff60a0f9067fd99ce020b00dd3c0cedb02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Eskil Abrahamsen Blomfeldt
52a074ada4 Update Harfbuzz to version 6.0.0
Note: This requires an update to the tst_qtextlayout test, because
the test assumed that the Arabic string would always yield a run
of two glyphs. This was a side effect of how Harfbuzz handled
Qt's test font, which has zero font tables and cannot be used for
shaping. With the Harfbuzz update, the Arabic text here yields a
single cluster instead, which actually makes more sense, so the
test has been made a bit more robust to support both cases.

Task-number: QTBUG-110338
Change-Id: I93d4cf8e3046dc93224e144d4c81d86bef4918d1
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bfe080debbe764d341babfa37b471efb07575847)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Volker Hilsheimer
1510b2d395 API review: disable copy for new mime converters classes
These classes are polymorphic, so shouldn't be copyable.

Change-Id: I80b6b3de5f5594e00c4011f64846841e3344c152
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 80cb1426aa325a440993741ba48dd3275f90b2e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Oliver Wolff
0feaf976de Introduce qt_winrtbase_p.h
Due to a bug in earlier Windows SDKs developers have copy paste
a workaround whenever they are including winrt/base.h. In addition to
that our usage winrt API also forces them to include
qfactorycacheregistration_p.h whenever they include that file. To make
things easier all that magic can now be done with one single include of
qt_winrtbase_p.h.

Change-Id: Ic6a80d6d3723af381cf0ecc0f0ab43c2e6839a7d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b2c1237b4512480a17009afe1981af02c2a9869e)
2023-02-01 22:58:09 +00:00
Friedemann Kleint
762afd33ad Examples: Add missing include guards
Task-number: QTBUG-109394
Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ddb94dd7927126978fc2a620ebd91954e2f96862)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Friedemann Kleint
7231ac6753 QtWidgets: Fix errors about fields from anonymous namespaces (-Werror=subobject-linkage)
Move types to QtPrivate, fixing errors like:

error: QCalendarWidgetPrivate’ has a field
QCalendarWidgetPrivate::m_model whose type uses the anonymous namespace [-Werror=subobject-linkage]

The error appears in CMake Unity (Jumbo) builds apparently
due to multiple anonymous namespaces per file.

Task-number: QTBUG-109394
Change-Id: Id678af4db5633b1b2267425c7751f1312935d5d5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit bd5589de658a91676b0cf36e154c19985fb7be88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Friedemann Kleint
1e07d027fb QtGui: Remove define Q_TEST_QPIXMAPCACHE
It causes clashes in CMake Unity (Jumbo) builds.
Change the function to be Q_AUTOTEST_EXPORT'ed helpers.

Task-number: QTBUG-109394
Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I2e4032e07e1c39432cae1eb2dfff94be33846c09
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1fad7aa73ef371bb15bf929c161e542aac687101)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:09 +00:00
Nicholas Bennett
6a4990a942 Docs:Android: Add docs notes about support for content Uris
Add some details about the support of Qt apis (QFile, QDir, QFileInfo)
for Android content uris.

Fixes: QTBUG-99664
Task-number: QTBUG-98974
Change-Id: I4b884623702ccad116d47049e34ccddfe21f83ca
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a0ca5f433fdc45e97e461ece2d9839eebd3c7ea0)
2023-02-01 22:58:08 +00:00
Friedemann Kleint
113f91229a uic: Add option for absolute Python resource imports
Add option that generates an absolute Python import.

import resources.rc_resources

from a path like

../resources/resources.qrc

assuming the project root is .. .

Add an additional option to specify the import paths, from which
the project root can be determined.

Task-number: PYSIDE-2191
Change-Id: Ib444eb666217b8c010dba0079b0ffe9ddbaa3414
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 814d66d55860a1eb204b804871d579da95eabd8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:08 +00:00
Inho Lee
23c49af8a3 Free the GLX framebuffer configurations
Adds missing XFree for a glXChooseFBConfig

Change-Id: I4c30341f90666170dac5d90b0c65d1deff4e0818
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit da898fca026f629be0ed234f0a89a99bc662385d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 22:58:08 +00:00
Axel Spoerl
600a5c2035 Revert "Fix tst_QWidgetRepaintManager on XCB"
This reverts commit 0b94530a310f3d5224dbee61b5774e0eb1500f27.

Reason for revert: Intended fix didn't work

Change-Id: Ib7b3caf4130ac92acce4d12b2ed0004c06cdacc4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-01 20:17:34 +00:00
Tor Arne Vestbø
ce955d1907 Don't include qnetworkproxy_generic.cpp for iOS
We already have the necessary machinery in qnetworkproxy_darwin.cpp

Change-Id: I01d99c825ed794f1ff5ba229e64f9963b819228c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ffd6a4264b43b651cf8038b94b849086645ed8c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 19:25:18 +00:00
Tor Arne Vestbø
8f6b9f1d3e permissions: Finalize permission example at end of CMakeLists.txt
Otherwise the finalizers won't know which libraries we're linking to.

Change-Id: I886c46443b7289d6e2c7d824767ed5e34a0a1fbf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1f1380b79cc63349da353052e8b6c5c923059975)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 19:25:17 +00:00
Tasuku Suzuki
c30c8ac526 Fix build with -no-feature-dialogbuttonbox
Change-Id: Ia6ac9e6acffda80794a5949793fddc3ab849a98a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c65834279c658f0f0d931e4a6ba94f2bf9acb840)
2023-02-01 23:31:22 +09:00
Alexandru Croitor
d6e900d9bc Revert "Add support for MultiABI with custom install dir of the android-build"
This reverts commit 474ad27c63afcb073d24c22a616c8e53bb45987a.

Reason for revert: Caused QTBUG-110836

Task-number: QTBUG-110836
Change-Id: I28d4b2aefbe3632d1ef665200edf85d8047eb198
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-01 09:49:41 +00:00
Mitch Curtis
284d420448 Doc: explicitly mention C++ when discussing linking to C++ libraries
Fixes: QTBUG-108325
Change-Id: I7282c8a8df0bf8f403a4e7a9d4512e7bdf6c9979
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f2b22a2945e19b191a2299bc7d0ebcf4b2bf2c69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 05:45:00 +00:00
Friedemann Kleint
5083ab72c7 QtNetwork/Windows: Add exclusions for CMake Unity (Jumbo) builds
The "interface" define in windows.h causes clashes with
variables named "interface". It cannot be undef'ed
since the winsock headers also uses it.

Task-number: QTBUG-109394
Change-Id: Id2daedfd6c57aae39a1fdfe92482f17884b68ef5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0fc1f8174f3a899d3c3ee969596a0ad260a7bb8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:22 +00:00
Jani Korteniemi
d0f13e420e Fix ContextInfo example crashing on Android
Disabled desktop OpenGL renderer on android

Task-number: QTBUG-91627
Change-Id: I61ec7cc768d46c368dc0187714bd0bd085257a67
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4b4873359d18c769bbcb3396e5e0803fdaceb45d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Ilya Fedin
a0ef0ad153 jpeg handler: log error message on fatal error
Original libjpeg's handler has output_message call.

As Qt doesn't have it, it logs non-fatal error, but skips the fatal ones
which are likely more important to be logged than the non-fatal ones.

Change-Id: Iebb94db4d56705322e7569445d240ca4a7ed8f4a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit fe90f8aa45e792c386b1cba7121e58e3402a9a5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Kai Köhne
15e4a175d0 Doc: Do ignore \since 5.x
We only support Qt 5.15 since a while, so the detailed information in
which Qt 5 version a particular class, function, or enum was introduced
is becoming less and less relevant.

Change-Id: I39bd579f23abc0ac84879e9bd22e6a97651ef7c3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit d53607225a2560e419043794d87e4710e9c7475b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Friedemann Kleint
b5c903c142 QtCore: Disambiguate QCalendar locale data
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: Ib86442c2d1b9abe57d3536b7a73a5e0ce78ce18d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8b1bb45566d55172ee248a2469e1357c3a9c843f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Friedemann Kleint
4a8ea3e5b2 QtCore: Fix some macro clashes
The macro decode() in qurlquery.cpp clashes with the static helper
function decode() in qurlrecode.cpp. The macro encode() in
qurlquery.cpp clashes with QStringEncoder::encode().

Macro CBOR_ENCODER_WRITER_CONTROL is defined with various values
in 3rdparty/tinycbor and qcborstreamwriter.cpp.

Task-number: QTBUG-109394
Change-Id: I8fdf696863e5b1e6fb0c5607b2dd5b46427b9104
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dc678299c8d38c11d1aa3f531e5d62dc2685bfa7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Friedemann Kleint
e60a50286c QtNetwork: Disambiguate static variables
They causes clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: Ifd0539c3b56dc395a860de927736f60ad766224a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 25537f5fdc9a19e54ad639bdec80e8a1b5805fdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
David Edmundson
cb9ae6ace2 dbus: Fix path to moc file in generated qdbusxml2cpp
qdbusxml2cpp takes a filename to use for generated output. It may be in
the form 'name.cpp' or just 'name'.

For the moc file we need to convert this from a path to a name of a file
in the same relative folder. It's not uncommon for this name to contain
dots as sometimes a dbus interface name is used directly.  For the cases
where a suffix is not provided the whole name should be used.

Fixes: QTBUG-110744
Change-Id: I3bf4ae8b2b9121184c2786009e8b5abcc5e3e410
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c7425aa2950bfd47fdf390478616d1a383528886)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-31 19:45:21 +00:00
Edward Welbourne
2de82be7f1 Improve documentation of data-driven tests
Mention addRow() as well as newRow(), even though the example only
uses the latter. Link the best-practice section to the fuller story.

Fixed a minor grammar glitch in the manual while I was about it.

Change-Id: Ib1c52cd8d2b6a04ea944d24d9d26c901b6cdf4e7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 24f3e0f21cd3971939945c18c6b9895609a01875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Edward Welbourne
755d1b2948 Rewrite the QtTest best practice guide on testing for warnings
It previously only covered ignoring them; we can now turn them into
errors. Expand the section to include some motivation for why it is
best practice to purge warnings from test output. That prepares the
scene for how to suppress what's expected and make errors of the rest.

Change-Id: Ieb4b14b2b048d1db2fead004ee7471b82507722f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 2d73cc2b1df03df716e6a76f9dca7761c1363368)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:21 +00:00
Edward Welbourne
ddde19129c Object to creating duplicate entries in a test-data table
Tero Heikkinen caught tst_QQuaternion() using a duplicated test data
tag and was surprised that testlib let it get away with that. That
seems like a reasonable thing to discourage. While I'm at it,
duplicate columns should be discouraged.

[ChangeLog][QtTest] Duplicate data tags are now warned about. Every
call to QTest::newRow() or QTest::addRow() should result in a distinct
data tag. If they do not, a warning is produced. Likewise, duplicate
column names are forbidden; each call to QTest::addColumn() should use
a distinct name.

Fixes: QTBUG-107185
Change-Id: Idfdb7cdfdd71e1fe3db5cadb243eeecc83032922
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 2d1fd400fc34843690e889d0cae7e75c12abd1e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Volker Hilsheimer
4e0dd6da82 Merge "undo" and "undoframework" examples
The "undo" example didn't show anything that the "undoframework"
example doesn't, and the latter is more comprehensive and properly
documented. "undoframework" also uses QGraphicsView instead of
inventing its own diagram widget.

However, the "undo" example created a nicer UI with toolbuttons,
icons, and the undo view in a dock widget, so reuse those elements
in the "undoframework" example instead.

Update the documentation quoting tags accordingly, and clean up
a bit.

Change-Id: I3c91feecbd5fe3e5900838b0b51f9fe7bd190280
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit cb0bf5ad683b72d4ecb0d21dafde3a5acdaac800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Volker Hilsheimer
66b21ce676 QUtiMimeConverter: document as public and fix \since
It's a new public API, so don't document it as internal. Fix the \since
to 6.5 - it's an old class under a new name, and make a small language
improvement in related documentation.

Change-Id: I57bfa868f19aa293c01d6a1f8bbbff1bebe7541a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit b36f126668f5d7c0ac58f2d058861680df176ca2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Allan Sandfeld Jensen
708a48a0b0 Avoid unneccessarily long text scans
Limit the scans to the processed length.

Fixes: QTBUG-109838
Change-Id: If4b19bf6f97d788d0a227af3a80962bef26016fd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7c84550f3bfdf93cb8a071e6bb23d54d57109e84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Friedemann Kleint
adc269f40a QtCore/Windows: Fix inconsistent linkage of helper qAppFileName()
MSVC is complaining about inconsistent linkage in CMake Unity (Jumbo)
builds since the export is not declared.

Since it is neither used nor declared in any header, remove the export.

Task-number: QTBUG-109394
Change-Id: Ie6dbad0188b7fa42c0abd40c48cb50129badb38e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a14dcc7ad12cd5d0bfdca2b9134cf6a5642799ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Friedemann Kleint
8ce6b61ef7 QtCore/QCalendarRegistry: Move helper CaseInsensitiveAnyStringViewLessThan out of anonymous namespace
It causes a warning in CMake Unity (Jumbo) builds:

src/corelib/time/qcalendar.cpp:46: warning:
QtPrivate::QCalendarRegistry has a field QtPrivate::QCalendarRegistry::byName whose type uses the anonymous namespace [-Wsubobject-linkage]

Task-number: QTBUG-109394
Change-Id: Ie9598c3e87dd835b06cafe5392766bddc258b5ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e63278bb38fc518e1dd7db8a86f689abb8a11b20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Friedemann Kleint
89023ded0b QtGui: Disambiguate static variables in markdown code
It causes clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I7d8c7a15dd8d3b7198b5ac1924a0f2bcf4415e06
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 960430556c7814b003e7c1f03a78d6221dde4f98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Friedemann Kleint
51d6782cc9 QtGui: Remove superfluous macro qreal_to_fixed_26_6()
It appears to be unused in qpaintengine_raster.cpp and causes
clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I51585153ff99812b6539b6268e337e410f2ecc76
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 6c5939b1677a896a5abecd80bbecd2f70051d9e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 19:45:20 +00:00
Joerg Bornemann
f1110e7633 Fix macOS build for CMake < 3.18
We must explicitly set the GENERATED property on source files we
generate.

This amends commit f0a7d74e1dd2c1d802aa09d7b8c144599f4a54ce.

Change-Id: Ifab405cd98deece49a1566ae04220e2b5d576429
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a707ae094def527d06d23878fa578591d632d738)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-31 19:45:19 +00:00
Kristoffer Skau
02e9e4212f Add missing underlying type and Q_ENUM to QOpenGLWidget enums
The enums are QOpenGLWidget::UpdateBehavior and
QOpenGLWidget::TargetBuffer. The latter is a new addition to 6.5.

Change-Id: I9e73413a944bf4b55e8e308055d79e560ac8668d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ce9d708d514011db1ab45630c95222d2a30c7550)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:24:19 +00:00
Thiago Macieira
12326702e5 QSystemLocale/Win: use LOCALE_RETURN_NUMBER to get numbers
Instead of parsing from a QString, which actually recurses back into
QSystemLocale.

Change-Id: I3c79b7e08fa346988dfefffd171f9b78e1d8d6ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 05e7d09eb373454c67219cc8f7e4b7226ec7f52e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:14:13 +00:00
Jan Arve Sæther
78d3fa1036 Adhere to https://wiki.qt.io/Qt6/Example-Guideline
* Remove "Example" suffix in title

Change-Id: I5da311850ab8f725da363969d7a8d8a1a85f8d70
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 2db23e151f5be3f35f0ba683ad7dc341dda806a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:13:51 +00:00
Mikolaj Boc
2d43775a4b Disable the process feature on WASM
Processes are unsupported. processenvironment is kept intact.

Change-Id: Ic2023be408adff9f8b034e9184bed620397be9bf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 7d7de4b2e8e49b89d87478c4aeaec1ffbb0218b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:13:32 +00:00
Edward Welbourne
2302fc9d35 Use case-insensitive comparison to compare codec with UTF-8 and utf8
Given that the two candidate "counts as UTF 8" values for codec differ
in case, it seems prudent to use a case-insensitive comparison, in
case we hit UTF8 or utf-8.

Change-Id: I279f83eafa90dd2685c306144c99ec97177d1d3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 75ae8869fb171493e4d5163910ef3a2034902c7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:13:05 +00:00
Eirik Aavitsland
21053b0b31 Support the scaling factor of some Windows pdf print devices
The printer drivers of some pdf printers allows the user to set a
global scaling factor, scaling up or down the number of device pixels
available for the same paper size and dpi. Make sure to update the Qt
print device metrics accordingly so that QPainter will see the entire
page, and not more than the page.

Fixes: QTBUG-106659
Change-Id: Icb90c1aa742f56b2a2043ef7070530beebe541d5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b44f222dbe7886b9504a4af9f09521132d2262b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:12:52 +00:00
Tasuku Suzuki
1552262510 Doc: remove {{ }} for an enum value
https://doc.qt.io/qt-6.4/qurlquery.html#encoding

Change-Id: I328274d37182d3884bc65b8bccfec5052c1dce8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b33016a4927e0b7df2b4183583b0b57719060e6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:12:20 +00:00
Jani Heikkinen
1b739a6aa6 Revert "Revert "Add binary compatibility file generated against 6.4.0""
This reverts commit cebcb7991a26fdb583d216b9c18b8b51d1cabf5f.

Reason for revert: We need to enable BIC tests again

Change-Id: Ibabe2c50547972d040d933a1027833426b018e81
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 2fa21f482182608508a5f937ea0be3f1c7cc38eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 15:11:13 +00:00
Amir Masoud Abdol
f013f9a125 Update qt_policy and add documentation
- If no version specified, policy version is set to 6.0.0, therefore
  warnings will be shown, encouraging users to set a policy.
- Update qt_policy() documentation
- Update qt_standard_project_setup() documentation
- Update the policy warning message
- Added the missing comment to clarify the extra_code region

Task-number: QTBUG-96233
Change-Id: I8358fdeb880a34c96f13fc2a6cbef6afe048c4d6
(cherry picked from commit 95ba368806dc46f9e9efd5381c593f02dfc8da95)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-31 11:21:37 +01:00
Kai Köhne
d18124f65d Doc: Fix spelling of QT_TARGETS_FOLDER
Change-Id: Ibbbf5629893e7f6b3e4f8dbea7d42deb388c8861
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d1a92a8f2d28ce7b4eda78eea778cff648eb6671)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 07:19:44 +00:00
Edward Welbourne
b7157f170c Cross-reference newRow() and addRow() in QTest docs and improve wording
Mitch helpfully pointed out, in review of my change to the "Data
Driven Testing" doc that the two functions didn't \sa each other, so I
added that. Which naturally prompted a review of their language.
Also, split a long line in the code.

Change-Id: I5f3e973052e0107bd5bdaeecaebe218e043380ff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 9a756e3e0186a254ad27111874facdf8e825e285)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-31 03:47:10 +00:00
Christian Ehrlicher
2376f6a2c4 QToolButton: Elide text when constraints prevent from showing whole text
Follow-up of b2a282d7c7b8f49819bbc86ed705980438ecb04b - elide the text
also when the QToolButton has no icon (=text only)

Fixes: QTBUG-64132
Change-Id: If4d3758452f37df411931a6628846988a3418d8e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 021906f6c985b838461d28c7f121d4c3bc7e6499)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Edward Welbourne
503058abc3 Remove QResourceGlobalData::resourceSearchPaths
The means to add entries to this QStringList were deprecated in 5.13
and removed in Qt 6, so the list is always empty and the one place
that still references it only needs to check the empty path it adds to
the list.

Change-Id: Ie1b3f13b33c04458bd03a4a1e3db0e33a76e89f6
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 21cb05bef7e852480975b92026e196c3fbf24228)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Friedemann Kleint
5bdca47789 QtNetwork: Remove duplicated QT_DECL_METATYPE
It causes conflicts in CMake Unity (Jumbo) builds:

qnetworkreplyimpl_p.h:161:1: error: specialization of QMetaTypeId<QSharedPointer<char> >after instantiation
  161 | QT_DECL_METATYPE_EXTERN_TAGGED(QSharedPointer<char>, QSharedPointer_char, Q_NETWORK_EXPORT)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
qtbase/src/network/access/qnetworkreplyimpl_p.h:161:1: error: redefinition of struct QMetaTypeId<QSharedPointer<char> >
qtbase/src/corelib/kernel/qmetatype.h:1711:1: note: previous definition of struct QMetaTypeId<QSharedPointer<char> >
 1711 | QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER)

Task-number: QTBUG-109394
Change-Id: I91d13a99dd0f5602ba8d4d8f3baf7659cf63aeef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f4e212b9c430c7300e07ec896116f090cf2d8610)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Mårten Nordheim
dbe7f136aa Torrent example: Use QByteArray toPercentEncoding
The hand-rolled loop produced incorrect output and was subsequently
rejected by trackers.

The torrent example doesn't support modern features though, so it's
still a bit hit-or-miss whether a torrent will work. E.g. downloading an
Arch iso does not work since it relies on DHT, PeX and HTTP seeds.

Fixes: QTBUG-109798
Task-number: QTBUG-110622
Change-Id: Ica40fb9205f09d135407a160a28a45d06a418176
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 39daa368d47bc676efb19a8e7478ef1c270ae959)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Mikolaj Boc
07f2ca775c Quasi-support for offscreen surface on WASM
Since context sharing is not currently supported with WebGL, offscreen
contexts have a limited usability on Qt for WASM.

If a context is shared, use the same underlaying WebGL context so that
the two can actually share resources. This is not full-blown context
sharing by any means but it makes e.g. the Open GL widget work as the
readback texture for it is 'shared' between the virtual Qt contexts.

If no sharing is desired, we use an OffscreenCanvas and actually create
a separate WebGL context.

Fixes: QTBUG-107558
Change-Id: If57e44739ddb57c167d5f8881a74d8dee52531f6
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 0eea2238f37a5eaa83ada6cd262eceaed20e415c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Ilya Fedin
841efd0779 Pass short time format to GetTimeFormat from GetLocaleInfo
TIME_NOSECONDS doesn't really switches to short time format,
just removes the seconds from long time format

Fixes: QTBUG-110627
Change-Id: Ie799958f3942c657f00bc8196588258661ddc1d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 763884cfb7be0cadd353cfa3b9b760d521851718)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Mårten Nordheim
e918efcd75 Torrent example: don't try to announce to an empty URL
Task-number: QTBUG-109798
Task-number: QTBUG-110622
Change-Id: I3603232eb094387388da6421bf5525a3ba54fe03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6c90c04fb94ea229a5b7d2328fe1b6b3da99d2ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 21:10:59 +00:00
Vladimir Belyavsky
c662fb0be8 Windows: fix warning on opening FileDialog after changing filters
Destroy native file dialog on Windows as soon as it closes.
Currently the instance of native file dialog on Windows may stay live
even when a FileDialog control was closed and won't be opened anymore
in the app session. At the same time, when the FileDialog is opened
again, the instance of native file dialog is recreated so we don't
need to keep previous instance, because this may lead to situation
when QQuickFileDialog configures old instance of the native dialog,
which is causing problems.

Fixes: QTBUG-61042
Fixes: QTBUG-77211
Change-Id: Ia537264e8494b83dec7d5139744838242b281f1f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de704b633d4f9469a868e86fc22b8d99ef61eacb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 18:35:40 +00:00
Fab Stz
474ad27c63 Add support for MultiABI with custom install dir of the android-build
Right now, "multi abi builds" of android projects works only if the
android-build installation doesn't use custom install dirs
(INSTALL_PREFIX, INSTALL_BINDIR...)

At the same time, it fixes QTBUG-106533. The patches are the same as the
ones in that bugreport.

Add new items to android-*-deployment-settings.json:

    qtDataDirectory
    qtLibsDirectory
    qtLibExecsDirectory
    qtPluginsDirectory
    qtQmlDirectory

Update androiddeployqt to be able to get files from their install location

BTW (fixes QTBUG-106533):
    Install src/android/templates into INSTALL_DATADIR
    Install src/3rdparty/gradle into INSTALL_DATADIR
    Install src/android/java files into INSTALL_DATADIR
    Install all jars into INSTALL_DATADIR

Add missing path to target_qt.conf
    Update target_qt.conf to have all path. Otherwise qmake wouldn't have
    the path when installing the android-build with custom install dirs
    like INSTALL_LIBDIR & friends

Add support for a new cmake variable that can be set at build time of the
android projects: QT_ANDROID_PATH_CMAKE_DIR_${abi} (Name chosen as
brother of QT_HOST_PATH_CMAKE_DIR)

Fixes: QTBUG-106533
Fixes: QTBUG-107207
Change-Id: Ia3751362ab1b5f877ecafbe02f263feac167119c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 979a21dc4ee0c6f483c6b55e9242a153d659ab6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 15:38:03 +00:00
Shawn Rutledge
e9f4efe563 Make tst_QFocusEvent::checkReason_ActiveWindow pass on macOS
It seems that on macOS 13.2 and newer, it requires explicit activation,
just as on the offscreen and minimal platforms.

Task-number: QTBUG-110703
Change-Id: I519eec872505ea3673111ae300c2494113f85c36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 78ba5056e63c4fc6f61346807197920fb5049924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 15:38:02 +00:00
Kai Köhne
5e28b5a9ec Doc: Use \keyword for alternative name of CMake command
\target will let the browser jump right below the title. Instead,
open the page from the start.

Change-Id: Ia58664aa2696aca4f299d57b8dbaa9b6cda90f27
Reviewed-by: Pranta Ghosh Dastider <pranta.dastider@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 958dc5c1cd314358d6af3d7184c01ad62847b82d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 15:37:58 +00:00
Peter Varga
29f11d6290 xcb: Fix QXcbCursor for secondary screen
QXcbCursor is created for each screen in a multiscreen setup. Make sure
xcb cursor context is created for all QXcbCursor instances otherwise
xcb can't load cursor for non-primary screens.

Amends commit 012132c60d625b2de0039bdda3c22a0a8fe2dfe5

Fixes: QTBUG-110434
Change-Id: I85da73a1069b681437b29c3e272d85f5d2dde130
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit a61d537f0535308fe30494e7a8fa283dba13d72d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 15:35:22 +00:00
Antti Määttä
7280f5876b CTF: Remove irrelevant comment
Remove comment about lttng not relevant to ctf backend.

Change-Id: I4d4432b1075a27d024db38a3cdd7807a1e94e7ec
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 86398b477bd38d35a411b4439f9da59c10f30eef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-25 09:01:54 +00:00
Marc Mutz
e69e111a39 ODBC SQL driver: deal with different sizes of SQLTCHAR correctly
Neither the UTF-32, nor the UTF-8 recoding of a UTF-16 string is
necessarily of the same length as the input. The UTF-32 version may
be shorter, if surrogate pairs were encountered. The UTF-8 version
will be longer whenever the string contains non-US-ASCII characters.

Split toSQLTCHAR() into three functions, templated on sizeof(SQLTCHAR),
and use QVLA's range-append instead of manual memcpy()s.

This patch specifically doesn't use constexpr-if, as that's not
available until C++17, which Qt 5 doesn't require.

Change-Id: I0bfcb66eb321598908ef00ac34c888fdbccf9316
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66767eea46bea0f19f8ae5ad6ebc641d86867701)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-25 08:46:24 +00:00
Mårten Nordheim
6eee180946 HTTP Example: Add proxy handling
If a proxy is configured on the system then we will request credentials
if needed.

Task-number: QTBUG-108874
Fixes: QTBUG-106245
Change-Id: Icbea491492cde4634421b1a1e722a3768d56dec8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5006fddd33c32eb972f1bdc6b72acc43a3741e23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 19:12:18 +00:00
Mårten Nordheim
74157a63b5 HTTP example: Fix missing translation and improve others
As a drive-by: print the path with native separators

Task-number: QTBUG-108874
Change-Id: I73164acb159d1a45960e16d5f57996e8c27257f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit c89c37b52f31e10a82cae2ecfac957184f9dab51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 19:12:12 +00:00
Mårten Nordheim
f2451fb04b HTTP example: remove needlessly unset-ing window flag
In Qt 6 it is unset by default.

Task-number: QTBUG-108874
Change-Id: I35af9d7c1517fd393710b7b1b978d3f39c61acf0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d18b5195c1b0442f7fb6c01c3e9a8fb499da3d48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 19:12:12 +00:00
Mårten Nordheim
7daa1acc8c HTTP example: rename to HTTP Client
It can do more than HTTP but let's keep the naming simple. Most people
likely aren't looking to do file: or data: or qrc: in this example.

Task-number: QTBUG-108874
Change-Id: I8a822640f4a8015ebf6c56cb6a614d6426e8a912
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7c90881a8e0402c6d6970539087c7b9632e51e23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 19:12:05 +00:00
Mårten Nordheim
ebe3229ddf Fortune* Example: Rename and add category/tags
Task-number: QTBUG-108875
Change-Id: I8eeff88187be4f85514d9871eb5009c51ad6de64
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 5bc644c951dd8fcee88109a2c37eb0cf9c575588)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 19:12:04 +00:00
Edward Welbourne
65f8f50b10 Restore Android-conditioning on nl_langinfo() definition
QCoreApplicationPrivate::initLocale()'s check that the selected locale
is UTF-8-based was added with an initial work-around for Android,
specific to NDK <= 15, which Qt 5.15 did not support.

Later the Android-specific #if-ery was changed to test for Qt taking
UTF-8 for granted, for a given reason having to do with QNX; and later
the #if-ery for that was removed. However, we still support versions
of Android that lack nl_langinfo(), so restore the Android #if-ery.
It presently seems that NDK 26 (Android 8) does contain nl_langinfo(),
so we should be able to drop the nl_langinfo() kludge for this and
later versions. That way we'll at least use the real nl_langinfo()
where we have it.

In the process, fix the indentation of #if-ery.

Change-Id: Ie9e83c3397955c24cea1e9a9ff6bb0187e47dda2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 10117f78d72498e19683e69b439ca7c931532261)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:30 +00:00
Sze Howe Koh
e3daea6f17 Doc: Fix usages of deleted QVariant constructors
Finish the job started at 879d30394a41b7b7124fc8139e787a9bdbe0dfee

Change-Id: I217a4830ac8e17d5d1f8900e2d3134fbabf8b9a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a97dbbd1a023fb4a0b7a518fad0ad9edbf1f23f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:28 +00:00
Joerg Bornemann
94f40ba267 Fix configure -no-rpath for CMake < 3.18
We must not set rpath-related properties on INTERFACE libraries. Move
the code that sets the properties below the bail out for INTERFACE
libraries.

This amends commit 392d9a54194d06e96bfebdaf081aa6c9787e33ab.

Fixes: QTBUG-110513
Change-Id: Ie395f1482245c4522917f982d2f3bc745c0b2abc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 854986836a581da694d169744e5487c5ce5f44bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 17:55:07 +00:00
Laszlo Agocs
6385e154db QOpenGLContext: Handle versionFunctions like other data
While probably not common, it is not unthinkable that one does
a destroy() - create() on a QOpenGLContext while relying on the
versioned function wrappers. This is likely broken at the moment
since the internal data is not released on destroy(), only when
the QOpenGLContext is deleted. This differs from any other similar
data (the portable function resolvers, QOpenGLTexture backing data,
etc.) which are all dropped and nulled out in destroy().

Also remove the bizarre comment in the dtor which must be something
from Qt 4 / QGLWidget times.

Note that this does not fix the associated problem since that only
relies on the standard mechanism that leads to fully destroying
and then recreating the QOpenGLContext when the window changes.

Task-number: QTBUG-109171
Change-Id: Id265a1d208ffae3792a0608c29324e840ce690dc
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 3bad6d597071186be51d537d2cda786caf879a6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 15:01:24 +00:00
Assam Boudjelthia
3b6a6b36e8 Android: add build dirs/files of Android templates to .gitignore
Those files/dirs are only build time generated by IDEs like Android
Studio or gradle builds, so ignore them.

Change-Id: Ib4785f9cc75412825d5be4cb5fe206587f37d193
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b49e2bb0849ed423e68398d5a10a3cc079bff589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 15:01:16 +00:00
Laszlo Agocs
61d142e9ae Sanitize the order of things in QOpenGLContext destroy()
Amends e08fe78b2335046934abae970e59fe0156178b95 (in a way).

While touching this function in the other patch, it becomes
obvious that the order in which things are cleaned up and
invalidated is somewhat odd: the native context is in fact
gone _before_ invoking helper callbacks or tearing down the
OpenGL API wrappers. This only works because likely nothing
relies on the context still being usable when destroying
those objects and when the texture/vao helper callbacks
run.

Reorder this to: 1. emit the about-to signal 2. invoke
callbacks and null out helpers 3. destroy the function
resolvers 4. only then start tearing down the platform
(and so the underlying native) context objects.

Change-Id: I9067463b8f6ce1f656129594c347c1428439ca5e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit f045ef4ab6f72b2024119d15da8476a26e3b2242)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 15:01:15 +00:00
Antti Määttä
8ea25d4a82 CTF: Fix static constant types and names
- Convert defines to static const
- Use camel case in the constants
- Use size_t as type in sizes.

Change-Id: I06d2588bfa5211a7825f068b2c4f33bbbd2065c4
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit f766e6051904f6755753d7d604fa8f19dbebb81b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 14:13:51 +00:00
Marc Mutz
e4e4084e0a qcompilerdetection.h: add Q_COMPILER_MANGLES_ACCESS_SPECIFIER
This is similar to Q_COMPILER_MANGLES_RETURN_TYPE, except that the
other such compiler, SunPro CC, at least by my cursory reading of

https://archive.org/download/SunWorkshopVol5No1/Sun%20WorkShop%E2%84%A2%20for%20Solaris%202.x%20Volume%205%20Number%201.iso/SPROmrcpl%2Freloc%2FSUNWspro%2FSC4.2%2FREADMEs%2Fmangling.ps

doesn't appear to mangle the access specifier. So it's only MSVC. It's
still better to have a properly-named macro for this than to work with
Q_CC_MSVC and, hopefully, an explanatory code comment.

May come in handy to maintain BC when we find the need to change an
access specifier in the future. The original use-case, in QtPositioning,
was fixed differently. If nothing else, let's have it to raise awareness
of the issue.

Change-Id: Ia8b789d2713ec19487a21c6bb0a12cf285e6ba83
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c155216917ff583bcab3d0ec5b59099af3fbea0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 07:30:50 +00:00
Marc Mutz
6669446150 tst_QUrlQuery: fix Clang 15 -Wself-move
Says Clang 15:

  tst_qurlquery.cpp:193:11: warning: explicitly moving variable of type 'QUrlQuery' to itself [-Wself-move]
    moved = std::move(moved);
    ~~~~~ ^           ~~~~~

It's amazing how little it takes to throw this warning off guards:
just use an alising reference instead of the same variable. Makes you
wonder whether the time spent on detecting such trivialities in the
compiler is really well spent.

Amends fc8dad2f10e7976cfa778ca7d75e651012629b21.

Task-number: QTBUG-109842
Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 577276d12c7b40d97a113a9daadcbd1f321b686f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 07:30:40 +00:00
Yuhang Zhao
4776260a45 windeployqt: a little readability improvement
Break the long sentence to improve the logic readability a bit.

Change-Id: I3d0227e616a3c47e14ae7b5cfe4b47a39d778e5e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 21baa7623025308a39577e7582c023b1d3ae11d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 00:37:56 +00:00
Yuhang Zhao
838d0b17e9 Windows QPA: also consider window flags when judging frameless or not
It's possible that the window has the WS_THICKFRAME flag but the
Qt::FramelessWindowHint is enabled at the same time. That usually
indicates the user is customizing the window, but it will also
confuse QPA's current logic. We can make the logic more roboust
by reading the Qt window flags as well.

Change-Id: I9894e312a92ef7f5fc0aa93974f216b67fe2cf29
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 17ab11ce493477f891916351b6ac0f0a8ad28ca6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 00:37:39 +00:00
Friedemann Kleint
776dcfd331 QTestlib: Disambiguate static functions
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I2920cc3f36ad60be1ee618c16653df5bc259019a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 69e478480a782a663b8dd176ca4d917a09c91341)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-23 19:55:13 +00:00
Friedemann Kleint
6e436003ae uic: Refactor options parsing
- Use modern string literals and initializer lists
- Move the Python-specific parts into if block

Task-number: PYSIDE-2191
Change-Id: I529f461b330de72dba465ece2c03fa55819a575e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 97a7e7b2d024f024c02003a2002ab0bb0a99b103)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-23 19:54:49 +00:00
Eskil Abrahamsen Blomfeldt
f6911de0e5 Fix assert when resizing text table with percentage widths
Since Qt 6.3.x, qBound() has started asserting that max > min.
This caused a crash in the QTextDocumentLayout code for assigning
widths to table columns that were sized using percentages, which
depended on previous qBound() behavior of just snapping to the
minimum size if max < min.

There are some specific conditions for this to happen: First
of all, the available width in the table must be too small to
fit all minimum widths (which is calculated based on content).
In addition, the requested widths have to be given as
percentages of the table width, and these have to add to
something lower than 100%. With these conditions, you may get
a case where the calculated percentage width of a column is
larger than the minimum width, but lower than the remaining
width in the table, causing the assert in qBound().

We simply accept the minimum width as the rule in these cases,
which matches behavior without the assert and which looks
correct when resizing the window to be smaller than the table.

Fixes: QTBUG-108183
Change-Id: I16d18dd9b2e7a77fe86d1a353b426075b5050b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 84a68ef75ce8a8e5b90d799c90905cc998c7c2f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-23 09:12:43 +00:00
Axel Spoerl
5baf644660 QWidgetTextControl: Ignore unconsumed mouse release events
QWidgetTextControlPrivate::mouseReleaseEvent() has early returns
implemented, e.g. when link has been right clicked or no selection
anchor has been found. These early returns, however, still consume
the event.

This leads to events getting lost instead of getting propagated:
As an example, a QLabel with rich text uses QWidgetTextControl. While
it propagates mouse press events back to its parent, mouse release
events get lost. A QLabel with plain text propagates both events
back correctly.

This patch adds QEvent::ignore() to the early return.
Since no test class exists for QWidgetTextControl, it adds a test in
tst_QLabel.

Fixes: QTBUG-110055
Change-Id: I950f8c3f135793b01c59832835bb429db2282169
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7689d4ad2f673317af432aae498da74d13703126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-22 18:27:39 +00:00
Christian Ehrlicher
bb6fba1834 SQL tests: Fix for PostgreSQL 12 and above
The 'WITH OIDS' was deprecated some time ago and removed with
PostgreSQL 12 so we have to adjust our test table creations. Don't know
why it was used in the first place at all.

Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 87662bcf107e65c04f933f212f4c8cad6692f948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:20:35 +00:00
Assam Boudjelthia
312912b3a0 Fix build errors in manual tests
various fixes like missing includes, linking, obsolete API usage, etc.

Change-Id: I786bff396933b87cd39559ac8964d386ef368df1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a375f2e2754b4f458358663ffafb009daa715b43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:20:35 +00:00
Assam Boudjelthia
47dfdc2c61 Android: print jni exceptions from Qt instead of ExceptionDescribe()
This makes the exceptions prints tagged with the app's name/tag,
and also can allow QTest::ignoreMessage() to handle exceptions as now
it cannot filter messages out because they're printed by the Android
system.

Change-Id: I9f5132b9ec5b5cd8fb35707eaaf68aa517f417ec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dbb622a38d6ce4fbd7fba010aea238e5f9552c67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:20:35 +00:00
Marc Mutz
7216a936bc QVarLengthArray: fix off-by-size() bug in growBy()
The growBy() function takes the _increment_ of the size(), so needs to
add size() to increment for the call to realloc().

Add a test which hangs (vanilla build) or explodes (valgrind build)
without the fix.

Amends 26b227e128475da3f88a6b34921a08994bf71cf4.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Fixes: QTBUG-110412
Change-Id: I7ea91342fdcb779825c88013a3f86ba6d90ef530
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 51e5a2376a8a2956665ff4c3a0e86c8cd9d0847d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:20:34 +00:00
Marc Mutz
620af5f2aa QtCore removed_api.cpp: fix missing instruction comment in 6.5 block
Thanks to Ahmad for noting.

Amends 6bc227a06a0d1392d220aa79ddb1cdc145d4f76e.

Change-Id: Ie6191bfc21d69f88a9a135f0d5f6b4fa8b09e8ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8d5ff757744c35e9c96d379ef5600cfbfaab609a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:20:34 +00:00
Thiago Macieira
0c5ece1301 tst_QUrlQuery: replace a few QVERIFY(~~ != ~~) with QCOMPARE_NE
Change-Id: I69ecc04064514f939896fffd17376aae3b8072b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 8772005a4b340a944587e35d90d83cb0939d717e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 07:57:49 +00:00
Thiago Macieira
03635c2677 QUrlQuery: add missing move constructor
It wasn't added when this class was created in 5.0 because we couldn't
add move constructors and still keep the ability to compile Qt with
C++98 compilers. We've forgot to correct this shortcoming since 5.6.

Fixes: QTBUG-109842
Change-Id: I69ecc04064514f939896fffd17376b8243b73c52
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit fc8dad2f10e7976cfa778ca7d75e651012629b21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 07:57:48 +00:00
Thiago Macieira
b1684da6ec QUrlQuery: fix operator== for emptied object case
If an object had elements and then was emptied, it will have a non-null
d pointer, which wasn't taken into account in the comparison.

Fixes: QTBUG-109840
Change-Id: I69ecc04064514f939896fffd17376aa18184653c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3d584b1093cdb6245b02eda996db2927ffaf09ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 07:57:48 +00:00
Thiago Macieira
7d13a405d2 Fix build with GCC 13: target specific option mismatch
range_access.h:274:5: error: inlining failed in call to ‘always_inline’
‘constexpr std::size_t std::size(const _Tp (&)[_Nm]) noexcept [with _Tp
= short unsigned int; long unsigned int _Nm = 34]’: target specific
option mismatch

qsimd.cpp:367:35: note: called from here

Change-Id: Ide4dbd0777a44ed0870efffd1739097c71991822
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d298ec3a6f4634254c6685398d49b1ba4dfa8e6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-19 22:48:53 +00:00
Marc Mutz
765c54420a Optimize QXmlStreamWriterPrivate::doWriteToDevice(QLatin1StringView)
Use a stack buffer, and perform the recoding from L1 to U8 in chunks.

Solves the L1 case of

Task-number: QTBUG-109284
Change-Id: Ia9ac7d8b27fd452d24d9e27f0575f9fc83b6dcbc
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e3f230e7be445b9cabaf1c8556bb97994813e205)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-19 11:55:33 +00:00
Mate Barany
b220b0a0a1 [doc] Warn users about data races regarding qt_ntfs_permission_lookup
qt_ntfs_permission_lookup is a non-atomic global variable that is prone
to data races. Make a remark about this in the documentation.

Task-number: QTBUG-105804
Change-Id: If7c64f3ab7d2c3b1487fe56204a4e66c420b0604
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 696ad54e5d76dd063cbb02d0c288fdece6ee75d0)
2023-01-18 21:51:46 +00:00
Marc Mutz
e1292c2ec0 QXmlStreamReader: fix spelling of PrivateConsructorTag
Found in API review.

Change-Id: I347ae3cc6a51095dddaba617adc2f63612578ef3
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
(cherry picked from commit 7ca8cb89e618faf01481187af848b5c3856d295e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:58 +00:00
Marc Mutz
26bef6ec2e QHttp1Configuration: fix UB (inactive union member access)
Any QHttp1Configuration object created has 'ShortData data' as active
member. std::exchange()ing or qt_ptr_swap()ping 'Private *d', then, is
accessing the inactive member of the union, and that's UB.

Fix by swapping and copying the whole union, as opposed to any of its
members, and, in the move constructor, activating Private *d.

This is now safe, as assigning to 'd' ends 'data's life-time and
starts 'd's. Even if we assign a well-formed object to a moved-from
object, we either swap or copy the whole union, so SEP. For
self-move-assignment in the moved-from state (Hinnant Criterion),
we're using std::swap() on the whole union, so SEP.

In addition, activating `Private *d` in moved-from objects means that
a future ~Public's use of unconditional 'delete d' won't invoke UB,
either.

Thanks to Peppe for insisting on fixing this.

Change-Id: Ic1323b8416d6b17ae21768c625de1daba0944133
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 47abdabe2cfd20715b0186b9c257bc32db9315bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:57 +00:00
Edward Welbourne
c2e1d4a791 Inline two move-constructors in qtimezone.h
The move-constructors for QTimeZone and QTimeZone::Data are trivial so
can be inlined. Requested by Marc Mutz in 6.5 API review.

Change-Id: Id59dc95e0da061187d9db8cf0a5ab82fcece1694
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f805db7c61c646024bfec7cc0de3a1e9bb800792)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:57 +00:00
Edward Welbourne
f60bfc90e6 Correct #if-ery on a pair of qtimezone.h forward declarations
The {CF,NS}TimeZone declarations are only used when backends are in play.

Change-Id: I17fd3fc90ce96f35bcb8f81b862cc5d3752e37e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c2b0287a4439aaab4c434330ce1744635c29f3fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:57 +00:00
Edward Welbourne
6fe36e874d Tidy up in qtimezone.h
Remove a #include that's no longer in use.
Add a long-overdue Copyright header line.

Change-Id: Idf23b1402bc94756095a28d6886f42cdef714975
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3586cb28eb627373101ffd1cb3345a2907782ac9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:57 +00:00
Tor Arne Vestbø
2877f076dd Respect custom QWSI event handler when delivering synchronous events
Fixes: QTBUG-110268
Change-Id: I25195904cfc18d593db1be713b6e899e55eb922f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2813e2814e185bf8d2426c5eb3d6b2c243ee72c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 18:24:57 +00:00
Assam Boudjelthia
af1aa812b3 Android: use signature-less jni syntax for AndroidContentFileEngine
Task-number: QTBUG-98974
Change-Id: I1e8e102282af2877bbbe6e8018b7649fac66804e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit ba3db0cacdea95ca91d0b3984b4e65c43a17a9bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 15:08:08 +00:00
Amir Masoud Abdol
21f71e7f26 Remove GENERATE_METATYPES
It doesn't seem like that it is being used anymore, except an instance
in pro2cmake which I replaced by NO_GENERATE_METATYPES.

Change-Id: I135cf47e6041e98b354fb684f0079dad30689dea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b171abe69533a83c5b6fea51807da3ad45a1d3f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 15:08:08 +00:00
Joerg Bornemann
d061b3108b CMake: Store whether a module is internal in module json files
Change-Id: Ic7e5e3b69a41a7723643332bebbde76854966b89
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 85d235877d9da5725841bd53db4e2c1c858a2d94)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-18 16:08:08 +01:00
Joerg Bornemann
827c0b2e87 Make qmake and qtpaths report Qt version baked into the binaries
QMake and qtpaths used qVersion() to report Qt's version number. This is
problematic if those tools are run in an environment where a different
Qt version is loaded (e.g. by setting LD_LIBRARY_PATH).

This reverts commit a783c3d574a1400c4dfdd32975fc511f095df8b2, which
changed the use of the QT_VERSION define to a qVersion() call in qmake.
Additionally, we use QT_VERSION in qtpaths too for consistency.

Change-Id: I6c8a1aa6ee6169becd7c685a98ce23c22c3864c7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 98a3634299e29104dee391145728dbad9797d7b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 15:08:07 +00:00
Marc Mutz
3c282ca27c QLocationPermission: make enums have explicit underlying type
They can be smaller than an int, so use quint8. In a world of BC
guarantees, pinning the underlying type of enums is best practice.

Found during API review.

Change-Id: I0c31fe4565329982c81173e3a265f73758aad257
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3b0439379f31aa80bb7a08b2cb17c11311122759)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 12:11:00 +00:00
Marc Mutz
0ec20060bd [doc] QCalendarPermission: fix cut'n'paste error
These docs are for Q_Calendar_Permission, not for QContactsPermission.

Change-Id: Ifbffa568b510ef035270082d1926e35d8d5cf241
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7a1bf4c628e4b90d1b5f96b6018c80070222088c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 12:10:27 +00:00
Marc Mutz
d16035a412 tst_QPermission: add more tests
The new test:

- checks the properties of stateful Q<Typed>Permissions work

- ensures that piping a Q<Typed>Permission through QPermission
  maintains state

- also ensures that assignment of a Q<Typed>Permission to a
  QPermission works (via QPermission(Type) + move ctor)

Change-Id: I340e49b1ecc665702ccab26d9050ca158b0e7885
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8f8d8f71dd5d24d2d6f6075bd05ef2e5955d5678)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 12:10:14 +00:00
Amir Masoud Abdol
51f4810fb7 Replace $<CONFIGURATION> with $<CONFIG>
$<CONFIGURATION> is deprecated from CMake 3.0

Change-Id: I1b19507a8cb3325095440e0a22fc54f9fde77e9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b71169005983f6eb9ac2e6eeb25533bf72a715d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 11:20:41 +00:00
Kai Köhne
97420b076d Doc: Simplify description of QKeySequenceEdit::maximumSequenceLength
Main purpose is to limit the number of keys a user can enter, so
let's be explicit about this. 'Truncation' seems to happen only if
the program programmatically sets a longer sequence to the edit,
which is arguably a programming error and also shows up as a
warning in the logging API.

Change-Id: I7b2b74e8dab44c5ad16ffefc25c5610708139353
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
(cherry picked from commit a4579121ca97522db18904cc46f520d263b3bd0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 10:34:29 +00:00
Ahmad Samir
8b0f8ab96a QString: add note about isNull() vs. isEmpty() to more methods
Namely compare() and operator==().

Change-Id: I7e404f2f1df5b93614f7e266bdbebe909e4e7623
Fixes: QTBUG-54505
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d0b338f4dec7bf457605a87330917818525d4b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 03:53:31 +00:00
Thiago Macieira
6de07b38df QUrl: restore empty-but-not-null for components that are present
This got lost during the QStringView port that happend in Qt 6.0
(commit 548dcef08976649c820054f3db1ad108c72439cd) because
QString::operator+=(QStringView) does not copy the nullness of the right
side, whereas QString::operator+=(const QString &) does.

Fixes: QTBUG-84315
Change-Id: Ide4dbd0777a44ed0870efffd17399b772d34fd55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a14a3a5487675a231b912e9a5ae575357d1c2cf8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 01:38:16 +00:00
Thiago Macieira
36236a66fe Suppress GCC 13's -Wmaybe-uninitialized in q_uninitialized_relocate_n
Its objective is to copy uninitialized content and that's fine.

qcontainertools_impl.h:73:25: error: ‘~~~’ may be used uninitialized [-Werror=maybe-uninitialized]
   73 |             std::memmove(static_cast<void*>(out),
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
   74 |                          static_cast<const void*>(first),
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   75 |                          n * sizeof(T));
      |                          ~~~~~~~~~~~~~~

Change-Id: Ide4dbd0777a44ed0870efffd173917092b671dd0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a26d25be7b782d35a0b03b38dd0785188e1228e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 01:38:16 +00:00
Assam Boudjelthia
1e7ec8620b Android: pass EXTRA_INITIAL_URI to native FileDialog
Allow setting the initial directory where the file dialog
will be opened.

Change-Id: I1395b367c74d28fb2890ac53a90456c3ac4c1b05
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 609e14724edfd8d8cef23c5f30ad7812a359ed8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 01:38:16 +00:00
Amir Masoud Abdol
3e3f508f6d Add the ltcg flag to .pri files
QT_FEATURE_ltcg is TRUE if either of
CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON or
CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>=ON are passed to the
configure, or the cmake command.

Change-Id: Ibaece67de6cc6f89e505038fd02fb50008c47d48
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9c90cd7fb969f8907a68ec330a3dbd27842a928a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 20:28:19 +00:00
Joerg Bornemann
49c6a2e554 CMake: Fix configure -no-rpath
The -no-rpath configure switch had no effect.

Change-Id: I306ec33249a219066ce94d18da5f1ca3d92905e1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 392d9a54194d06e96bfebdaf081aa6c9787e33ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 20:28:18 +00:00
Amir Masoud Abdol
f07994e7a0 Remove an obsolete TODO item
__GlobalConfig_install_dir translates to lib/cmake/Qt6/ and 3rdparty
modules will be in lib/cmake/Qt6/3rdparty which seems to be a logical
place for them.

Change-Id: I90c715b9502b0dfc666bb3202a838f20ba6110cf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 20821877bba5c2a685098fcf42c9ee48d7b285a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 20:28:16 +00:00
Ievgenii Meshcheriakov
2b5ffaf1d4 QUnicodeTools: Use QVarLengthArray in Thai support code
This replaces an ad-hoc solution.

As a drive-by, remove a check that was always true.

Change-Id: I72166ee75a2c474dc91bc699c790f256b78b3b7a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 42f555f861bbc7daaf211bc83fd57795f45f7a86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 19:24:19 +00:00
Fabian Kosmale
20a69a0c84 qproperty.h: Make ctors explicit
Addresses comments from API review.

Change-Id: I859079cc918aa67dffe0c780f6d0b9712652bb4a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit aaa198cb5cd8bfcf366a09982a19c0c1c8d1f7a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 18:22:35 +00:00
Fabian Kosmale
157126fa57 qarraydataops.h: Pass initializer_list by value in copyRanges
initializer_list is supposed to be cheap to copy, and passing by value
will avoid one further indirection (though the compiler can probably see
through it, anyway).

Change-Id: I8ffbf5de4d8cf2c85f4cff76ef63d6cdeac4db5a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1d43cbfede7d39fefecb39a8a5dbb74a23d7383a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 18:22:33 +00:00
Peter Varga
761d22bb07 Update description of topleveldomain feature
qTopLevelDomain() is misleading in the configure summary. The function
has been removed by commit 50b3097683

Also clean up the topleveldomain files.

Change-Id: Ib577962909a83f4f41d1660a26fd80b37803ae18
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 56d72d36bf7df8f9c87177e364096f0120876810)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:32 +00:00
Tor Arne Vestbø
eb5a495fa5 permissions: Take PlistBuddy exit code into account when reading Info.plist
Otherwise we might conclude that we found a usage description when
PlistBuddy outputs "Error Reading File: /tmp/Info.plist" to stdout.

For CMake this is not an issue as we pipe stderr to a separate variable,
that contains "Cannot parse a NULL or zero-length data" in this case.

Fixes: QTBUG-109967
Change-Id: I9d819b6de405b88bb7d1d75c22b6f5187f26e553
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ada434e417568457df252b6069ec51f6ba8335c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:32 +00:00
Mårten Nordheim
359a7d1b79 Fortune* Example: Bump QDataStream format version
One of the examples were using a different version than the others.
Though QString's formatting probably didn't change since then so
it was no problem.

Anyway, pretend like we're releasing it now for the first time and
set 6.5 on all of them

Task-number: QTBUG-108875
Change-Id: I28b496ab3d8ff54c503a032ba15882cdf3d5eccf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 71cd3bc074b4eea3158ba037ae2fe1c5b922ff3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:32 +00:00
Mårten Nordheim
1ec87cc886 Fortune* Example: convert simple for-loop to ranged-for
Ends up shortening the loop, making it easier to read at a glance.

Task-number: QTBUG-108875
Change-Id: Ia12a994259b00e9b57f2de48124be9cb38553bf5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 605eec7b55516291fe0fc92401947e80b2d8e425)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Mårten Nordheim
53d52cf1e1 Fortune* Example: remove needless unset-ing of window flag
It's unset by default in Qt6.

Task-number: QTBUG-108875
Change-Id: I3f1c6e4e6de54e9ca0ed8892f9da1d346d16d4c7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 2fe69dbeb88c79012ff9f8c22b380ca3aa9a8a67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Mårten Nordheim
29e2b322ff Threaded Fortune Example: update example to use qintptr for descriptors
Task-number: QTBUG-108875
Change-Id: Ie635a3d2c4c61a59547e8fed0ec84da8538968a3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 45717db7a59b6041c907e011e51782922fbccff3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Amir Masoud Abdol
50871fbd3a Remove an obsolete TODO
There was a plan to invert the API, but since the TODO, we are settled
on the non-inverted name, ie., GENERATE_CPP_EXPORTS.

Change-Id: I84f531d870965e0b7d0d821d1ff08606ab8054ab
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 1b4aba0a59abeb27e3ef21391a39ca2093e4ca46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Alexey Edelev
614c5ca4cc Restrict the minimum supported ICU version to 50.1
ICU 50.1 was released May 11th, 2012. Despite of the restriction, all
currently supported operating systems will continue to be supported.
All mismatches described in QTBUG-99715 are fixed in this version.
Restricting to 72.1 (latest version as per January 2023) or 63.1 (2018)
would still exclude e.g. RHEL 9.0, which ships version 56.1.

Task-number: QTBUG-109505
Change-Id: Ic5cd7927d6f5fb60a89423c305796a9ed311bfa2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3002816d77d2ee5adfc040176582f3b95116ccfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Jan Arve Sæther
08b022bf44 Painting examples: Don't mix const_iterator and non-const iterators
Reported by Clazy

Change-Id: I80fce912b1e5390f0056b1fa9ae0d3cfcf39d045
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 0280b7eb96d82815c4f60e7300183ccb14c5d6f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Marc Mutz
30ad6769cd [doc] QPermission: some fixes
- QPermission_s_ -> QPermission

- add a comma to make a text piece clearer

Change-Id: I08469cca9a05b08772d101fdab4eccd6b9cfcab8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cc236d5e0c38d01ce8b24ba9ac161886b60a6ed9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Marc Mutz
c1c740c0b6 QStringView: remove pointless Q_ASSERT in toString()
QString and QStringView have the same size_type these days.

Change-Id: I59ffe78f51e06ccc130562b1682fb4a672c3ec22
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8ef22183d67e0e7a8ad00bc0ea48c41510eb84ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 17:25:31 +00:00
Jan Arve Sæther
81bb1a90e3 Compile easing curve example with -Weverything
As a consequence, also had to add some suppressions:
-Wno-padded         (this warning should almost never be responded to)
-Wno-c++98-compat   (we want to use c++17 features)
-Wno-weak-vtables   (IMO not worth fixing for an example)

Change-Id: I28ae4456c0221ad2370879a691f6343affff138b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 1e790fb4dbd82c9a4e668c630e21a27eb23d3a37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 14:02:03 +00:00
Eskil Abrahamsen Blomfeldt
6c22f88112 Remove redundant scope for glyphRuns() default parameter
Noted in API review: Improves formatting and readability.

Change-Id: I3a8f769899031410d00397a885f115adcca82f3b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 02effb2c37c8439baf2aaabe24fa635326fb6399)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 14:02:03 +00:00
Tasuku Suzuki
d5ce480b1d Fix build with -no-feature-menubar
Change-Id: I72bd07dbdcfe07badaadce9f19949ee3e352b13e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d369eabc30c0294f954933dd5440b280331de5ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 14:02:03 +00:00
Eskil Abrahamsen Blomfeldt
db97cdf7e9 Explicit type for new enum type
Noted in API review.

Change-Id: I98ec47f4c934156990d67363b69ccd33617661de
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6975dd38c14a2473d7997dd65c3789b843078409)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 14:02:03 +00:00
Amir Masoud Abdol
a0f953f019 Slow Deprecation of FILENAME_VARIABLE, replacement by OUTPUT_SCRIPT
As discussed in the latest CMake API Review, we are deprecating the
FILENAME_VARIABLE variable name everywhere, and replacing it with
OUTPUT_SCRIPT.

[ChangeLog][CMake] The FILENAME_VARIABLE option of
qt_generate_deploy_script and qt_generate_deploy_app_script is now
deprecated, use OUTPUT_SCRIPT option instead.

Change-Id: Ic8be33eefbc48540166ea0fcf1d1948b052d4b8a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2b2065bf35768cfbef833c588c8d93d5a09a76ba)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-17 14:02:03 +00:00
Marc Mutz
d980be646a QWindowsMimeConverter: fix copyright year
Noted in API review.

Change-Id: I08a5cb5cec1d7a13d96c22b69c7999eccfb4f932
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8a96dee4cb94b45ab5a7b182e66f2ce1e7a4cb81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 09:10:44 +00:00
Axel Spoerl
d9d1deb89f QCommonStyle code cleanup
Consistently use int (instead of uint) type for alignment/text
formatting flags passed to QStyle::drawItemText (and overrides).

Clean variables in QCommonStyle::sizeFromContents
- use self-explaining variable names
- rename misleading variables
- define one variable per line
- use consts whereever possible
- insert new lines to make code easier to read
- correct wrong indentations
- use auto in qstyleoption_castis to respect maximum of 100
characters per line

Change-Id: Ie145c089606436213c813227154fac29962825d0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit c84f3fd370ef7b4d532e5bf6db7b4be819d676ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 07:56:54 +00:00
Volker Hilsheimer
1fcfb6dd4b Remove mousebuttons examples
The example didn't show anything useful, and seemed more like a
manual test case.

Change-Id: Ia71f39b26943aab04b6895e63b6eed50dd084bfd
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 2951f72584e70ddf31c1ef644f7eb8643da0084b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:10 +00:00
Tasuku Suzuki
d93e748a88 Fix build with -no-feature-buttongroup
.../qabstractbutton.cpp: In member function ‘virtual void
QAbstractButton::keyPressEvent(QKeyEvent*)’:
.../qabstractbutton.cpp:1010:58: error: incomplete type
‘QGuiApplicationPrivate’ used in nested name specifier

Change-Id: Ia71bb481d125087aa813c891f9508755f435f4d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ca772a8ffa2fdde4238ff0af325997dd78dbfe83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:10 +00:00
Tasuku Suzuki
27fa63a430 Fix build with -no-feature-draganddrop
Change-Id: I88ecd9a84d7fb9f6cb78027cc51e34089e211ff2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 010a8987710f4aafcd34ce2359464cfab10dad46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:10 +00:00
Tasuku Suzuki
79fac7527c Fix build with -no-feature-menu
Change-Id: Ie18d896799dd99c74dcdf00cd43c2aedcd9b8d1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cff65c860f8bcc4ae8611ba10f563fe58454d878)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:10 +00:00
Tasuku Suzuki
0ce7784e11 Fix build with -no-feature-imageformat_png
Change-Id: Ib742665b2c379ff600b6a99432c89567a3f7765b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7774c1b07936e302f15337f924874dcb63117c12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:09 +00:00
Tasuku Suzuki
d72d38daf7 Fix build with -no-feature-messagebox
Change-Id: I4c34f6aa2106afc528f182d7925442acf82b7000
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1613975d954f0d88ca8cdde59b34c13d72e9d140)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:09 +00:00
Ievgenii Meshcheriakov
2f96d72f4d QUnicodeTools: Use a global static to manage libthai state
Move all libthai symbol resolution and state management into a single
class. Create a single global static instance of this class. This allows
freeing of the state on program exit.

Task-number: QTBUG-105544
Change-Id: I2610863f85f49f88e83f1fdaa200ea277c88c0ef
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5679f9f82c0dc19963edafe86d181dd9241fda2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 05:51:09 +00:00
Marc Mutz
89672efd58 QVarLengthArray: cope with vector<unique_ptr>'s copyability
Despite being move-only, std::vector<unique_ptr> advertizes
is_copyable:
  https://quuxplusone.github.io/blog/2020/02/05/vector-is-copyable-except-when-its-not/

Our combined reallocation and resizing function, reallocate_impl(),
runs afoul of this when it uses std::is_copyable in a constexpr-if to
implement resize(n, v) without running into problems with move-only
types: the trait is true, but actual instantation runs into a
static_assert in the STL implementation.

To fix, move the problematic resize functionality out of
reallocate_impl() and into the resp. resize_impl overloads. The shrink
functionality remains in reallocate_impl(), because there are many
more users, and it only requires destructible<T>, which isn't
constraining at all.

Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a.

Fixes: QTBUG-109745
Change-Id: Ibc5b9cf5375108eb3d8f6c8a16d4fd02dadd73b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 800ebd84f57092ccba24984f3888f97bb5433d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 01:12:37 +00:00
Tasuku Suzuki
3edf3d0730 Move QApplication::autoSipEnabled() to public scope
The method is not meant be a slot.

warning: getter QApplication::autoSipEnabled possibly mismarked as a
slot [clazy-const-signal-or-slot]

[ChangeLog][QtWidgets][Potentially Source-Incompatible Changes]
bool QApplication::autoSipEnabled() is no longer a slot. Code such as
using QObject::connect() to connect to it as a slot or accessing it
through meta object system will have to be rewritten.

Change-Id: I892a51120478f3c90e5834c8e3e00bc836b84c52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 03ed57afa0c5af5076583dd4e415e54983e7e0a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 21:44:39 +00:00
Tasuku Suzuki
bc362f807d Fix build with -no-feature-toolbar
Change-Id: I9a76ff0896545dff0e945daaec0aeae2236c1e42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b4efc552d8822e0ac5cbb40d85129b5d29ed7caa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 19:04:05 +00:00
Peter Varga
e33ed8e2f7 Pass flags with dash to rc.exe when auto-generating win32 rc files
Fixes clang-cl build:
  clang-cl: error: no such file or directory: '/c65001'

Change-Id: I9f134f866f17d1eeb12a28b72580151c409a98f6
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 67fc186f9ca919db77cc2c058e29cda2bc8b041c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 19:04:05 +00:00
Tasuku Suzuki
8c17fa89d3 Fix build with -no-feature-shortcut
qplatformtheme.h complains about Q_GADGET without <QtCore/QKeySequence>

Change-Id: I7561bd3e2484c44842cd25ab12aacb9c00ebedfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e0a5915f88a780ba0791bce5ed042e92036a4900)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 19:04:05 +00:00
Tasuku Suzuki
7c43c13455 Fix build with -no-feature-cssparser
Change-Id: I146ac61f92acdcd22c46ca27a1fca48c47817e3c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ce1506355fdc9dd9df809963ee88c1f30524ceff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 19:04:05 +00:00
Jan Arve Sæther
be95bb0358 Don't use file dialog in the address book example
On small screen devices such as iPhone targets, the save file dialog is
using a non-native dialog, and it doesn't fit the screen real estate to
the extent that the [Ok] button is clipped away.

In addition, the open file dialog and the save file dialog doesn't
cooperate very well on platforms such as iOS without more plumbing.
Since using the file dialog is out of the scope for this example we
remove all usages of it.

Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4dbb07f614c914e78437aacf7a1716f632da5e8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 19:04:05 +00:00
Kai Köhne
61f7b89e6f Doc: Move documentation for QAI::selectionInterface to source file
qdoc doesn't allow documentation in headers.

Change-Id: I25686572aa15395bb3eb94dd637e4674e7310afe
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0d596bf53d4728c2c6faf0dd0560e210faabbf01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 16:33:13 +00:00
Joerg Bornemann
facf9f9a34 CMake: Store the plugin types in the module json files
This will be read by windeployqt.

Change-Id: I8dfebae755ef61967e924db3c5631af5cc4e2440
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0b92502de28f5ecfd9622a222c92211b6325ae84)
2023-01-16 17:33:13 +01:00
Joerg Bornemann
6fc1214133 CMake: Fix exposing sources with absolute path to IDE
_qt_internal_expose_deferred_files_to_ide must add the source files to
the target exactly as they were passed to
_qt_internal_expose_source_file_to_ide. Otherwise, CMake might be fooled
into thinking that we're adding a new file here, and source file
properties would not be readable.

Instead of back-calculating the relative paths from the absolute paths,
we use the already existing list of relative paths.

Fixes: QTBUG-109678
Change-Id: I81510f37eacb409eb5c03e3ff032926c3ca25a1f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c146d25a87bcb94ed4eefae749a96ed3550b7af2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 11:11:59 +00:00
Kai Köhne
4d5c470f1c Doc: Mark qRegisterTestCase as new in Qt 6.5
Also remove reference to QTestCaseEvent loop class, which
is not documented.

Change-Id: Ic09b3b102db535dfb090b9a4072ad29515a911ae
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 9ae91ac318009cd424465236c4f276df625c52ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 10:57:34 +00:00
Jan Grulich
26d9896ec4 QCryptographicHash: no need to store return values just to ignore them
There is no benefit from storing return value from some OpenSSL calls as
the only thing we do is to ignore them. There is also no difference when
we would be returning earlier.

Change-Id: I76c742016a2532c65ffdcd913aafc74a2d1a9623
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a48bbbaa50860507d7b738d2095adf794eb552d5)
2023-01-16 11:57:34 +01:00
Mårten Nordheim
5ef1bdcd60 Move QMetaMethod ctor back into a private section
Its symbol changed once it was changed to protected, so even if
it's unlikely to have been imported in any application let's just
change it back to private.

Change-Id: I21b4a471caedb8edc8e1a04f706eae541b3c12fd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 36619181fb0e507d4a092d74d7ad31c513ddaead)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 10:57:34 +00:00
Ievgenii Meshcheriakov
ed739a5c42 QUnicodeTools: Use thread-safe libthai API
Use th_brk_new()/th_brk_find_breaks() instead of non-thread-safe
th_brk(). The new API is available in libthai since version
0.1.25 released on 2016-06-28.

[ChangeLog][QtCore] Correct line wrapping of Thai text now requires
libthai version 0.1.25 or above.

Fixes: QTBUG-105544
Change-Id: I723050bef9f4e6445c946125c74c99e50addadef
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 19ca03c21c2cf69fdec4dd8d6a03b92eb96314ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 10:57:34 +00:00
Amir Masoud Abdol
e344e887de Use the Windows path separator in a Batch file
Patching inconsistent path separator in Batch file. This at some point
may lead to something similar to the mentioned task.

Task-number: QTBUG-109857
Change-Id: I36c05dc7a0b7daf3dc5dced61f3c3f7d90eb59e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 07a978c756cba6953bf81497fa3a386793652242)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-16 08:29:51 +00:00
Mikolaj Boc
6501b85d38 Handle the mouse events in the window itself
It is now not the screen that handles all of the events and relays
them to individual windows, but the window elements themselves.

This allows us to get rid of manual window targeting logic and let
the browser do its job.

Fixes: QTBUG-107217
Change-Id: I4dc5a74b1343f027f72c1da4623b99cd28bfbb38
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit c15a8750bcce3d4dabeebcc8bb4c15db31c7f637)
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-01-14 18:29:24 +01:00
Antti Määttä
8fbf5a8bc4 Add CTF tracing backend
Implement platform independent tracing backend in Common trace format.
This allows tracing in platforms without own/existing backend and
analysing all platforms with the same tooling. The backend is the basis
for further work in application level profiling area.

The backend is implemented as a plugin that is loaded immediately when
the application starts in order to process all trace events. The backend
avoids using Qt classes so that it doesn't generate trace events
itself. Adds plumbing to configure the new backend.

Modifies the tracegen and tracepointgen tools to support the new
backend.

Task-number: QTBUG-106399
Change-Id: I80711be52d4d48e1acbc72edffbdf3f379fce52a
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit e3458aac6406e5b624cd54e28b5784fb09f07bc3)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-01-14 17:02:51 +02:00
Tor Arne Vestbø
346dbc361d QStyleHints: Fix Q_PROPERTY declaration for keyboardAutoRepeatRateF
Change-Id: I21d3280176d6c52daab0b3abfdafb404d42db9d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 50218659a4488d6e5717ad358d289b6d5e79173b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-14 10:45:47 +00:00
Antti Määttä
667fb09398 Add tracing metadata to QEvent and QImageFormat
Modify qtcore and qtwidgets to use the new tracing metadata features.
This allows showing the event types and image formats used in traces
as text instead of just numbers.

Task-number: QTBUG-106399
Change-Id: I267d03a696dc95e8b1d36657d7339dd09d92de3b
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit a37a59eea8b010c45da1722a005946a2450363b3)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-01-14 10:45:47 +00:00
Antti Määttä
26c363820b Add metadata support to tracegen and tracepointgen tools
Adds ability to add textual metadata for enumerations and flags
to the traces so that they provide more information to the user
instead of just numbers. Implement these for both existing backends.

Task-number: QTBUG-106399
Change-Id: Ibab00dd370d019891cf9ad6e65e6f9d868e32dce
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit a2bcb7d8adb7bb59087cd2df2396539e2baf5b7d)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-01-14 12:45:47 +02:00
Friedemann Kleint
b30fdad16a QtWidgets: Disambiguate static functions/variables and defines
They cause clashes in CMake Unity (Jumbo) builds.
Properly prefixing the childWidgets() function also prevents
it from cluttering static builds.

Task-number: QTBUG-109394
Change-Id: Idd2b1ec748f33cfae8f3213847c43b3fb0550377
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f5b1dbb8f6966bea54799480e3c16e23f0d06d42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-14 08:26:26 +00:00
Marc Mutz
6b7c5d2daf QPermission: don't hide SFINAE constraints
Like done elsewhere (e.g. in QStringView), formulate the constaint in
if_x<T> = true from, and let qdoc see it. Then document the constraint
in prose, too.

As a drive-by, use C++17 variable templates instead of
std::bool_value, and document that data() returns a
default-constructed T on failure (which is indistinguishable from a
successful call that happens to return a default-constructed T, so we
should probably return an optional<T> here, but that's orthogonal to
the change at hand).

Change-Id: I0584ce3f4febd619d3966afeb6244b11b167cd42
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6ac9d46a36f1b6b921efdcb47d7b7241d2396897)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:17 +00:00
Volker Hilsheimer
9d14e35e7b QFormLayout: don't access out-of-bounds layout data
When rows are hidden (implicitly or explicitly), then their layout data
does not get fully updated. If rows get hidden after the layout data has
been calculated once, then we must make sure that their indices are
reset. Otherwise we might access array indices that are out of bounds
when the layout data structure gets resized to fit only visible rows.

For good measure, skip entirely over hidden rows when accessing the
layout data when arranging the widget.

Fixes: QTBUG-109237
Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c3a5fe2fd7a1b8a6b6133c938ffe6b3f30181bf0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:17 +00:00
Marc Mutz
0c7643bcd5 QPermission: fight template bloat in data()
Extract the type-independent code into an out-of-line data_impl()
private method, leaving data() containing only the
QMetaType::fromType<T>() call as well as T copy- and
default-constructor calls.

As a drive-by, use categorized logging (consistency with the rest of
the permissions code) and printf-style qWarning() (expands to less
code).

Change-Id: Ie23b83cb3fc537c9cff15f853ceee2888bf63124
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 66235481043d85e4f51a216cf2ad3bb895ea7842)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:17 +00:00
Alexey Edelev
b2f0931359 Add the 'QT_INTERNAL_AVOID_OVERRIDING_SYNCQT_CONFIG' flag
The flag avoids overriding of the default CMake build config when
building syncqt.

Add extra checks to the make sure that configure-time tools use the
correct build type.

Fixes: QTBUG-109792
Change-Id: I572fed60c58e59297fa559aea6eb86af94b979b7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4e4cd7416af3f84e6a7c7dee03a2e50864e9cacc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:16 +00:00
Alexey Edelev
2d52076b28 Set GenerateDebugInformation to true in vcproj if at least /DEBUG is set
If the command line option contains /DEBUG without the following
argument, GenerateDebugInformation remained 'false' because the
DebugInfoOption contained the initial value.

Set GenerateDebugInformation to 'true' if the /DEBUG option is found and
reset to 'false' only if option is set to 'none'.

Amends commit 6a6b27940d497b29672ff65ff242fe0211603f22.

Fixes: QTBUG-110068
Change-Id: I792d7335d8b9536d4beed54cabfd70dcf54f09ac
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e3ef4111271761ede6cbbeb3b0fa075a483085e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:16 +00:00
Marc Mutz
c6380f3fac Add minimal QPermission auto-test
To be extended as neeeded.

Change-Id: I57d2f55f67de073fe3e4916b7ba655342cf661dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a478d730f896e89fce83483c8b056b47ae973736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:49:15 +00:00
Eskil Abrahamsen Blomfeldt
78416e0ca4 Fix infinite layout loop with negative line width
Setting a negative line width does not make much sense, but in
earlier Qt versions, this work the same as if the line width was 0
(just give you the minimal layout given wrapping constraints).

But since 991c056438b311566bc4ea543af0f33dfd5dffbb, we check if
current width > line width at an earlier point, and because 0 > -1,
we would exit immediately before adding any characters to the text
line.

To restore the behavior in earlier versions, we set the minimum
possible line width to 0.

Fixes: QTBUG-109474
Change-Id: Iceadd5135681f61b30de8221853834983941c5a4
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit 49a63d375972079ae3000c8b7d512d58d4de32bb)
2023-01-13 14:49:15 +01:00
Mikolaj Boc
c613c5ce22 Return to the two-step destruction in compositor
The two-step destruction we used to employ is needed as destroying
a screen which contains a window crashes.

Change-Id: I722828be5408a7f079d66e845eeee34ed19cbf34
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 644036b597137306959d875127cc819612ee9217)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 14:49:15 +01:00
Mikolaj Boc
33895a9b6d Move the window through the title bar element itself
The compositor is redundant in the process of moving the window.
Have the title bar react to move all by itself.

Additionally, a clearer structure in the window was introduced.
The non-client area has been extracted into a separate class, as
was the icon store and free DOM functions used across files.

Since it was now easy, made the window maximize/restore on double click
on the title element.

Fixes: QTBUG-107626
Change-Id: Iba7f207e46806ae7162656965892ae5a48ac5ebe
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 32666691c21cc91a3d7c7585dad711dc9743fdce)
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-01-13 14:49:14 +01:00
Kai Köhne
a9e16b24b9 Doc: Document further GUI API as new in 6.5
Change-Id: I83402aec120a2f6a78b245029b94d3519f94d7f3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit cb534ec58fa2a11de2cffd2a52382e68c14f74e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:49:50 +00:00
Kai Köhne
6e690151d0 Doc: Show signatures of typedef's
qdoc doesn't do this by default.

Change-Id: Idd4885be2fdac951b2ed555088f9b3f7989157ab
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1c62e821bab505730d4f8bb88a3404fb789a5359)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:49:30 +00:00
Kai Köhne
8062b073c0 Doc: Mark new QGlyphRun methods as new in Qt 6.5
Change-Id: I5e977a6c7e5356dcdca245f424abd920403c6a72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit fbf0c88d04116946c6d9bfd8364a42971874e930)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:49:23 +00:00
Antti Määttä
cc3743a579 Add find package for lttng library so that it gets added to target
Add it globally so that each module using tracepoints don't have to
add it themselves to each modules configure.cmake.

Change-Id: Id58cfaff5cd715b2667da2470001d646117f9f28
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bab65d70dcaf08e85113d5203056a4b8dd2c1fa7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:44:11 +00:00
Antti Määttä
314b678a1a Add tracepointgen tool and convert qtgui to use it
Allows automatically generating tracepoint files by scanning source
files for instrumentation macros.

This makes it easier to add tracepoint support to modules and also
ensures that the tracepoint files do not get out of sync with the
functions they are tracing.

Q_TRACE_INSTRUMENT generates entry/exit tracespoints for a function
it is set. Q_TRACE_PARAM_REPLACE is used to change a function parameter
for these functions to convert it to supported parameter type.
Q_TRACE_POINT can be used to create a standalone tracepoint.
Q_TRACE_PREFIX can be used to add prefix for generated tracing backend
for example to add includes for types used in the trace points..

Task-number: QTBUG-107238
Change-Id: Ib395b80838434ceb72683dac0545ca20c4d09455
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 9bdf74a4f23d009777f1cbdb0078aa70060a3da5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:44:09 +00:00
Antti Määttä
4133fc792f Fix array handling in tracegen tool
Remove the array field type. We need to know the basic datatype as well
for future backends. Use the arrayLen instead. Add the missing array
handling for etw backend.

Task-number: QTBUG-106399
Change-Id: I97c38240bd1c79c0e61d268a7d780016b341f110
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit f488c657216115d33753429e8500b99b6e8e7c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:44:00 +00:00
Friedemann Kleint
b2789fd47c QtOpenGL: Disambiguate class name QTextureBinder
It occurs twice, causing a clash in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I39341af72cfa406d80c598a56db9e02f80c61a9b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 135a792940ed3a7ed2cfc632e2b11477edea7706)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 09:20:39 +00:00
Ulf Hermann
b23437a215 Gui: Always declare qt_memfill{32|64} as function pointers on x86
Having the declaration of a function depend on compiler flags is a
fundamentally bad idea since you can compile different compilation units
that all include the header with different flags. This leads to
undefined symbols.

Fixes: QTBUG-109159
Change-Id: I0aede280988e4f10c42d5b1824ad9c96a1e10854
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9615e7f9e538af4ad212f4f71d1364c64b18542d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 23:45:00 +00:00
Marc Mutz
e292187789 Move q20::remove_cvref to q20type_traits.h
The original is defined in <type_traits>, not <functional>.

Change-Id: I596e56f64d2eed609ad2f7e6f03ae006afaa2fa9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit def2a3de3741410bbf7ab31b59afc27b0777e09b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:25 +00:00
Friedemann Kleint
9676e0de6c QtPrintSupport: Disambiguate static functions
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: If3029d5b99499fd0e216fc080ade9842c2d11ea4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c1e390f16c5c40c2d8115d1c731df67a1cc67384)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:25 +00:00
Marc Mutz
934764a7bb QVarLengthArray: Extract Method growBy()
Separates the actual reallocation use-cases from the resizing ones
when calling reallocate_impl, in preparation for fixing QTBUG-109745.

Task-number: QTBUG-109745
Change-Id: Iee0c3e56569ec7877beda8db3a645e2bbb6b4d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 26b227e128475da3f88a6b34921a08994bf71cf4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:24 +00:00
Marc Mutz
54a82ed48a QVarLengthArray::resize_impl: don't default argument, overload
Separates the resize(n) and resize(n, v) code paths in preparation for
fixing QTBUG-109745.

Task-number: QTBUG-109745
Change-Id: I49808ce4dc2f1de0de6af120990b2e00edb47728
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7c5ff43ea322422f03f6b87768d825f2df6f1652)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:24 +00:00
Thomas Senyk
af85a5c965 Add QEGLContext::invalidateContext
QEGLContext::invalidateContext will mark that egl context is invalide
and trigger SceneGraph to destroy it, create a new one and re-create
and re-upload all resources (e.g. textures) associated with the current
state of the SceneGraph

In addition this change also improves
QEglFSWindow::invalidateSurface() and
QEglFSContext::eglSurfaceForPlatformSurface(..)

Where QEglFSWindow::invalidateSurface() will now destroy the
corresponding EGLSurface via eglDestroySurface, including "unbinding"
it from the current thread via eglMakeCurrent and
un-setting the screen's EGLSurface in case it's the same resource.

QEglFSContext::eglSurfaceForPlatformSurface(..) will now call
QEglFSWindow::resetSurface() in case of getting a EGL_NO_SURFACE
from the QEglFSWindow (which happens if above invalidateSurface()
was called before) - therefor re-creating the resource if
it was destoyed via QEglFSWindow::invalidateSurface()

Change-Id: I37badd1fc11e993c395fb1502e9bd27ebe18b821
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 17a59f661398bf56aeaba4187f55d07eea09c578)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:23 +00:00
Friedemann Kleint
013a05a937 QtSql: Disambiguate typedefs
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I3f94044671cdbd0a1bb0964bf291e36508223b50
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit d9d74723cc4b369f41530aff5b500d93779d5e32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 21:02:23 +00:00
Marc Mutz
5e42f44691 Q{Contact,Calendar}Permission: rename isReadOnly → isReadWrite
The typed permission classes' properties, insofar as they have any,
should default to the least-intrusive capabilities.

QLocationPermission implements it that way, but these two typed
permissions defaulted to read-write access instead of read-only. This
was fixed in an earlier commit. However, default values of properties
are most natural when they're equal to the default-constructed value
of the property's type, and this was no longer the case for
isReadOnly.

By renaming the property to isReadWrite, defaulting to false, this
relationship is restored, and code using the classes looks more
natural:

  - p.setReadOnly(false);
  + p.setReadWrite(true);

Found in API review.

Change-Id: I4efa4c0326b5a54181c96f477709b0686c963e90
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 1b6883146d4a3b022434fac1a4bda579a6767986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:40 +00:00
Marc Mutz
9e4a8fa163 Q<Concrete>Permission: unexport classes
Non-polymorphic classes should not be exported wholesale, because MSVC
exports inline API in such classes, too, which has caused numerous
problems over the years.

Only export individual functions.

Change-Id: I8be55c1fcdb21d143a02bb62498caeea6ebca068
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ceb4140b59428a805d11c036ef223f46d83653ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:39 +00:00
Marc Mutz
f83d2f913b QPermission: add missing \since 6.5
The Q<Typed>Permission classes get their \since via \include
permissions.qdocinc permission-metadata, but using that for
QPermission will break the \annotatedlist permissions trick used all
over the permission docs, because QPermission would then be included
in the list. The use of this mechanism needs more thought; QPermission
shouldn't really be excluded from being \ingroup permissions.

Change-Id: I33207ffb39c04c23fb479c173e97dc0adb60691f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 49cdfb0c61521f843046e473d759149ab4878ce3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:39 +00:00
Friedemann Kleint
da36ac3c35 Add missing header guards
Task-number: QTBUG-109394
Change-Id: Idc5b0057d41186c8dfd7e752fe819ebebc6f8859
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit aa29b3ef523d3f9d3e52942464d82cd58283c783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:38 +00:00
Jan Grulich
f025428d5b QCryptographicHash[OpenSSL]: allow to get intermediary result
OpenSSL doesn't allow to add additional data when the hash has been
finalized. To fix that, we just make a copy of the current context
and call EVP_DigestFinal_ex() on the copy so we can still later add
additional data.

Change-Id: If76d4ec56f8846d6ef55ed7ec7cbab440d43edd0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 698c7696ebff4868c695bb6d7ca66ed17b5c2f3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:38 +00:00
Joerg Bornemann
0700f561b0 CMake: Add switch for allowing missing Qt6*Tools packages
Consider a cross build of Qt with qtbase, qtshadertools and
qtdeclarative. If a user projects only links against QtQml without
creating an actual QtQuick module, no host tools from qtdeclarative are
needed.

Normally, find_package(Qt6Qml) pulls in Qt6QmlTools and errors out if
it's not found. By setting QT_ALLOW_MISSING_TOOLS_PACKAGES when
configuring Qt, one can disable the error and build a user project such
as the one outlined above.

Fixes: QTBUG-109547
Change-Id: I45e727713912d19e6007a7fbf3d61533f82b71d9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
(cherry picked from commit 94e474b48e9d3c6434339afe166c2329f8c36ea2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 17:40:38 +00:00
Morten Sørvig
a288f9f2ba wasm: add accessibility container to QWasmWindow
Add accessibility (a11y) container QWasmWindow. This
container should underlap the canvas with identical
geometry but ordered below.

Change-Id: I7b91e3e69e3b1afa1b03ef7f7b7336e48f1a1594
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit f4dd67461d9873cdbfe7bef970477366047924d7)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-12 18:40:37 +01:00
Nicolas Fella
1d0494c248 Add xdg-activation support to QGenericUnixServices
This is needed to transfer focus to the receiving application if that
is already running

It uses the new native interface for QWaylandWindow to access the
existing xdg-activation support of QtWayland.

The received token is passed in the options map for portal calls
(as defined in the portal spec) or passed via env variable when
launching the relevant helpers

Change-Id: I524bc58d88033af914e8af2c6db26b1a86afb863
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit fbfaf5d38b3455bb561e739271986be91a7c7169)
2023-01-12 15:30:48 +01:00
David Skoland
b5feb21742 Set WASM platform default to synchronous window event handling
Based on existing code, it appears that it's always
preferred in wasm to use synchronous delivery
(<QWindowSystemInterface::SynchronousDelivery>),
however, we can simply define this as the default mode
of operation, which will make these unnecessary.

Change-Id: Ia4c78593333e314f91efb266268917317794e2f5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 4b1229e5235412062a5240410ec49e358019507c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 11:09:32 +01:00
Shreya Pattani
053666d093 wasm: Work on wasm accessibility elements and events
Implement a11y support by adding html elements (Checkbox, Radio Button,
TabView,Spinbox, ScrollBar, Slider, Event for Button) and events of
the appropriate type and/or with the appropriate ARIA attribute
behind the canvas.

Change-Id: I52902eae2bd4ac7a125815e1d2dd3077211fc118
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 040b4a4b21b325995c49772a86a061249f16851c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-12 11:08:41 +01:00
Sharad Sahu
c8513c8188 wasm: Work on wasm accessibility elements and events
Implement a11y support by adding html elements (Toolbar, Menu,
DialogBox) and events of the appropriate type and/or with the
appropriate ARIA attribute behind the canvas.

Change-Id: If9c9fbff9a451b44e57de5d8834f4a78f33f41bc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 13c3fd959ed400396ee770d3e300778cf20a50a9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-12 11:08:40 +01:00
Morten Sørvig
e7c88aa5a8 wasm: add end-user accessibillty opt-in
We want to make support for screen readers available
incrementally to avoid destabilizing existing functionality.

Accomplish this by initially adding a single "enable
screen reader" button only. When pressed, this button
will remove itself and populate the page with the actual
accessibility elements.

Change-Id: I65036d249c408d4dc1fa75e8c807d9b7300e4722
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 42d4619967688e4f313f5508de7594f0c0c976ff)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 11:08:40 +01:00
Morten Sørvig
56cbab3b12 wasm: add accessibility container to QWasmWindow
Add accessibility (a11y) container QWasmWindow. This
container should underlap the canvas with identical
geometry but ordered below.

Change-Id: I7b91e3e69e3b1afa1b03ef7f7b7336e48f1a1594
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit f4dd67461d9873cdbfe7bef970477366047924d7)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-12 11:08:39 +01:00
Kai Köhne
d0dd51d661 Doc: Show signatures of typedef's
qdoc doesn't do this by default.

Change-Id: Idd4885be2fdac951b2ed555088f9b3f7989157ab
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1c62e821bab505730d4f8bb88a3404fb789a5359)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 10:08:39 +00:00
Kai Köhne
6a5c41b603 Doc: Document further GUI API as new in 6.5
Change-Id: I83402aec120a2f6a78b245029b94d3519f94d7f3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit cb534ec58fa2a11de2cffd2a52382e68c14f74e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 10:08:39 +00:00
Kai Köhne
82e2404fd1 Doc: Mark new QGlyphRun methods as new in Qt 6.5
Change-Id: I5e977a6c7e5356dcdca245f424abd920403c6a72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit fbf0c88d04116946c6d9bfd8364a42971874e930)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 10:08:38 +00:00
Marc Mutz
0aac98504e Add minimal QPermission auto-test
To be extended as neeeded.

Change-Id: I57d2f55f67de073fe3e4916b7ba655342cf661dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a478d730f896e89fce83483c8b056b47ae973736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 10:08:37 +00:00
Ville Voutilainen
c19c6aa11e Fix dangling references
These were found with the help of -Wdangling-reference, which is
new in GCC 13.

The one in qtpaths.cpp is a false positive: parseLocationOrError()
returns a reference, so there's nothing for the full expression to
destroy. Moreover, it returns a reference to a static object, so
there's no destruction inside the function either.

The other two aren't, but are also harmless. QDBusMessage::arguments()
and QVariant::toList() return a stored QVariantList by value, so
QList's COW mechanism means at() returns a reference that will not be
destroyed. However, the compiler has no way of knowing that. And
since it depends on the implementation details, change the code to
not depend on that.


Change-Id: If53aa16fcc24586d752ffc76c193c81e43dc9d95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 18def77d27f88ce26b6af29fe56a80429fed555d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 06:24:08 +00:00
Thiago Macieira
72baf058be QCryptographicHashPrivate: repack, by moving the enum to the end
QCryptographicHashPrivate::SmallByteArray is a 65-byte type, so there
were 7 bytes of padding at the end of QCryptographicHashPrivate anyway.

Change-Id: Ide4dbd0777a44ed0870efffd17394e1d5431e052
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 92a7c360208c6ab7504e8ff9e091fede73839fb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 04:28:58 +00:00
Thiago Macieira
7913965c39 QCryptographicHash: add a mutex to writing to the results
QCryptographicHash::result() and resultView() are const, therefore two
threads can call them on the same object. Given that the finalization of
the hash is not a trivial operation but doesn't modify the state, let's
do it without a locked mutex, onto a temporary stack buffer. Then we lock
the mutex to copy said result to our cached value.

Fixes: QTBUG-110058
Change-Id: Ide4dbd0777a44ed0870efffd17394bf72785eabb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ccad719d2e935306e601b0f6af5ff2acb7cd272e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 04:28:58 +00:00
Thiago Macieira
ea42f36c90 QCryptographicHashPrivate: standardize on quint8
So we don't have to do these reinterpret_cast everywhere, as most of the
APIs we're calling take unsigned chars themselves. The reinterpret_casts
will be removed in the next commit, which needs to modify those lines
anyway.

Change-Id: Ide4dbd0777a44ed0870efffd17394f9f25062122
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2d7a27b918ff576dbd8ec8b3aecaa45f8c78fa5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 04:28:57 +00:00
Thiago Macieira
072c2ddbf3 tst_QAlgorithms: don't use random numbers in the test row names
Just describe the row instead. We'd lose the original input in case of
failure, so I added a class to print that value on destruction. Example:

FAIL!  : tst_QAlgorithms::countLeading64(0) Compared values are not the
same
   Actual   (qCountLeadingZeroBits(value)): 63
   Expected (expected)                    : 64
   Loc: [tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp(374)]
QWARN  : tst_QAlgorithms::countLeading64(0) Original value was 0x1

Fixes: QTBUG-109958
Change-Id: I69ecc04064514f939896fffd1738b1119cd80cf8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d0408b5f13f811f73cf2485b5b31d5ec4b7f2b62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 21:28:44 +00:00
Thiago Macieira
384528cbdb QtGui: fix build with GCC 13's support for FP16
Conversion must be explicit from float, but doesn't need to be from int.

qimage.cpp:1915:33: error: converting to ‘qfloat16::NativeType’ {aka ‘_Float16’} from ‘float’ with greater conversion rank [-Werror]

Change-Id: Ide4dbd0777a44ed0870efffd17390a0e86f1fd7e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 03b72188f45e72d313f8af2e16cb7067b6084f99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 21:28:43 +00:00
Marc Mutz
636fe7beb6 Q{Calendar,Contact}Permission: invert default state of isReadOnly
The QLocationPermission properties default to the least-intrusive
capabilities: Availability::WhenInUse (not: Always) and
Accuracy::Approximate (not: Precise).

Logically, QCalendar- and ContactPermission's readOnly property should
then default to read-only access, not read-write.

Orthogonally to this change of default value, it might make sense to
invert the name of the property, too: isReadWrite() or
hasWriteAccess().

Change-Id: I9359c82051b1a6735feca8b2f06b9891acef650f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fae85282ba81a3f294b990f9e416a46680bfbe88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 18:36:51 +00:00
Marc Mutz
706ed459ff QPermission: unexport, make fully inline
Non-polymorphic classes should not be exported wholesale, because MSVC
exports inline API in such classes, too, which has caused numerous
problems over the years.

Inline the last two remaining out-of-line functions, as they're
trivial.

Change-Id: Ibc415b840b93a7350683e02433108270e1bd6bfd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit afb4e244b0554562c7904fa641114a8d1dd1b69f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 18:36:44 +00:00
Eirik Aavitsland
fdb6be72d6 Fix deletion order also for QImageReader/Writer::setDevice()
Avoid dangling or incorrect device pointer during handler
destruction. This was recently fixed in the destructors, fixed here
also for the setDevice() functions.

Change-Id: I85b64726cd88d2c8e63eee59d5b4f2ae488df61b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 5633cb69f68ca3d3b82476f9025d863f804e76c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 18:36:42 +00:00
Marc Mutz
e033aef749 Rename manual tst_qpermissions to tst_manual_qpermissions
To make space for a tst_qpermissions auto-test.

Change-Id: Ic9ead8afa7ecd035fd5ed56c756f0156828c6705
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c63f9e81dde6a7a615f1e1363574857ec6c76f59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 18:36:38 +00:00
Liang Qi
23f194a763 qxcbwindow.cpp: Fix sign-compare and another warnings
qsizetype(int32 on 32bit, int64 on 64bit) vs uint32.

qxcbwindow.cpp: In member function 'virtual void QXcbWindow::setWindowIcon(const QIcon&)':
qxcbwindow.cpp:1300:30: warning: comparison of integer expressions of different signedness: 'qsizetype' {aka 'int'} and 'uint32_t' {aka 'unsigned int'} [-Wsign-compare]
 1300 |         if (icon_data.size() > xcb_get_maximum_request_length(xcb_connection())) {
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
qxcbwindow.cpp:1301:53: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'qsizetype' {aka 'int'} [-Wformat=]
 1301 |             qWarning("Ignoring window icon: Size %llu exceeds maximum xcb request length %u.",
      |                                                  ~~~^
      |                                                     |
      |                                                     long long unsigned int
      |                                                  %u
 1302 |                      icon_data.size(), xcb_get_maximum_request_length(xcb_connection()));
      |                      ~~~~~~~~~~~~~~~~
      |                                    |
      |                                    qsizetype {aka int}

This amends ebdaf8ef9cea6f3669fc73bc3395acf2e497f7fc.

Fixes: QTBUG-109610
Change-Id: I2c9b5ad27881658463dd0870639c42d3ea8e7aba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ec787ce14363c843f9c1149bad8045ff6acbcf1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 18:03:53 +00:00
Ben Fletcher
086de2f4b4 RHI: Metal tessellation fixes
This patch fixes four issues with Metal tessellation.

a) Shader resource binding
The Metal tessellation implementation assumes identical SPIRV-Cross
native Metal resource binding mapping for vertex, tessellation control,
and tessellation evaluation shaders.  These mappings are independently
generated by SPIRV-Cross for each shader stage, and may not always be
identical.  This patch allows for different resource bindings for each
of the vert/tesc/tese stages.

b) Tessellation evaluation vertex descriptors
The Metal tessellation evaluation render pipeline vertex descriptor
generation code contains a bug where attribute offsets and built in
variable locations could be calculated incorrectly if the tessellation
control shader output variables are not provided in ascending location
order.  This patch fixes this by sorting the variables by location
before processing.

c) Render pass descriptor
Metal tessellation draw ends the current render pass encoder to perform
tessellation compute tasks on a compute pass encoder.  When the compute
pass is completed, a new render pass encoder is created to continue
rendering.  A bug exists where the new render pass encoder uses a render
pass descriptor that clears the color, depth and stencil attachements.
This patch fixes this bug by changing the render pass descriptor color,
depth and stencil attachment load actions to MTLLoadActionLoad when
appropriate.

d) drawIndexed
A bug exists where when drawIndexed is called, the Metal tessellation
vertex as compute stage input descriptor buffer layout step function
gets set to MTLStepFunctionThreadPositionInGridX rather than the indexed
version MTLStepFunctionThreadPositionInGridXIndexed.  This patch fixes
this by selecting the appropriate step function.

Change-Id: I122c67394719ad6b4801cd7643043839fd186bf2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 0d7401d51bedecb1b84b78aedb50839928a0cc7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 15:07:58 +00:00
Timothée Keller
4897ea9c6b Windeployqt: Multiple directory use warning
Added a warning for when windeployqt is used with multiple binaries
which are in different directories.

Change-Id: Ic43aa9847eb2bf6927cebf5d457595eed6b16b5a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit a67607480d7cddf604d885532c4359b8c041fd11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 15:07:57 +00:00
Jan Grulich
1cf359def7 QCryptographicHash[OpenSSL]: do not resize result when adding data
This is unnecessary and basically doesn't have any effect.

Change-Id: I6b63e989c43bdcd55bf83d2c0756da2de1ab49df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a647d18df22d3aa8bfa3f4c1dbb1340095f0d200)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 15:07:56 +00:00
Friedemann Kleint
b326ef7343 Documentation: Port code snippets to new connection syntax
Task-number: PYSIDE-2182
Change-Id: I5f800cf3a4a7afefbc36a79372fc35449fa953f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8fccba0e63f9484866398e77a7e8ee54ed80a0a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 14:20:16 +00:00
Amir Masoud Abdol
c2bc42d64b Disable PkgConfig for Android
We decided that it's better to disable PkgConfig for Android, as it is
unlikely that someone uses them.

Task-number: QTBUG-110007
Change-Id: I6ae1059ddd05feeec047fbb906c7dba1586e816b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e6693163e5e40668bc4cc5155003c173eea83273)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 12:48:58 +00:00
Giuseppe D'Angelo
f8c481e7e5 Moc: avoid double underscores in a generated identifier
In order to generate metadata for a class `NS::Class`, moc will
"mangle" its name by turning the colons into underscores. This
however makes the generated name have a double underscore, and
all names with double underscores are reserved.

Instead, replace double colons with another string ("SCOPE").

We are then going to use this mangled name to create other identifiers.
To do so, underscores may get appended and prepended to the mangled name
(e.g. "qt_metadata_" + mangled_name + "_t"). This means that a leading
or trailing underscore in the mangled name would also be problematic;
avoid that as well.

Fixes: QTBUG-109851
Change-Id: I01391a57920545fc75f78ef4bfefaf6d3dd7b447
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e816f915411a0f517021769abd8919a423f635c3)
2023-01-11 00:57:39 +00:00
Giuseppe D'Angelo
b4b80e0794 QTimerInfo: re-pack the members
0148c6925ec3b6b9a9d2f57ae44fea292a6625e1 added support for qint64
intervals in the abstract dispatcher. Changing the `int` interval
to `qint64` causes padding in the QTimerInfo struct.

On X86-64:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */

	    /* XXX 4 bytes hole, try to pack */

	    qint64                     interval;             /*     8     8 */
	    enum TimerType             timerType;            /*    16     4 */

	    /* XXX 4 bytes hole, try to pack */

	    struct timespec            timeout;              /*    24    16 */
	    class QObject *            obj;                  /*    40     8 */
	    class QTimerInfo * *       activateRef;          /*    48     8 */

	    /* size: 56, cachelines: 1, members: 6 */
	    /* sum members: 48, holes: 2, sum holes: 8 */
	    /* last cacheline: 56 bytes */
    };

On ARM32:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */

	    /* XXX 4 bytes hole, try to pack */

	    qint64                     interval;             /*     8     8 */
	    enum TimerType             timerType;            /*    16     4 */
	    struct timespec            timeout;              /*    20     8 */
	    class QObject *            obj;                  /*    28     4 */
	    class QTimerInfo * *       activateRef;          /*    32     4 */

	    /* size: 40, cachelines: 1, members: 6 */
	    /* sum members: 32, holes: 1, sum holes: 4 */
	    /* padding: 4 */
	    /* last cacheline: 40 bytes */
    };

Change the order of the members, so we remove the padding:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */
	    enum TimerType             timerType;            /*     4     4 */
	    qint64                     interval;             /*     8     8 */
	    struct timespec            timeout;              /*    16    16 */
	    class QObject *            obj;                  /*    32     8 */
	    class QTimerInfo * *       activateRef;          /*    40     8 */

	    /* size: 48, cachelines: 1, members: 6 */
	    /* last cacheline: 48 bytes */
    };

Change-Id: Ia1cc56e497f87611fa411a19361f8ebb13ff1f67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f1d3c09c9620d6aa5c7c94429e0e2a10a82b6d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 21:52:54 +00:00
Kai Köhne
2e4613184f Doc: Fix qt_attribution.json files using Path for files
Since qttools commit 39fdcb8e7a, qtattributionsscanner fails
if 'Path' is not a directory. Use the 'Files' attribute instead.

Fixes: QTBUG-110002
Change-Id: I65fecdcb852ce9abea55f168cd939804bae9ae80
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2c78c5d4569d89c204857ab007f9e260b219d624)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 19:15:57 +00:00
Marc Mutz
cfd7a5adb7 QPermissions: remove extra ';'
Change-Id: I68f5e1cfc780061365c6d3d75e51eda2b39c8ace
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4ec8a6e2cb1cc732c3d17c43fda3ddccc6bfa16d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 19:15:57 +00:00
Kai Köhne
30a3a7bcab Doc: Fix snippet in Applications Permissions page
Change-Id: I05b7145053f040852765f533f396e25d484f9ac0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 042c7e58e2c6cdfeaddc38f7f5378247525a6b81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 19:15:56 +00:00
Joerg Bornemann
2b8ff57071 Rename the 'module_name' key in module description JSON files
...to 'name'.
It's clear from the context that this is the name of a module.

Change-Id: I07700a4413ceb12695c153e16d0a2dcded615d11
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d756f4753eaf87755624a53c1e361d11f571fbd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 20:15:56 +01:00
Tor Arne Vestbø
599335411f macdeployqt: Don't remove rpaths more than once
In a universal build the tool will find multiple duplicated rpaths,
but the install_name tool doesn't like it if we try to remove it
more than once.

Fixes: QTBUG-109738
Change-Id: I4a8bea0ad3e47b28e6384ceead551edc83e30d26
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9a2198f9cdd5df482c64a52cb5d1e372ac24610c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 15:21:22 +00:00
Juha Vuolle
165b18506a Adjust the SDK/API version check for getInsetsController()
The function is introduced in API level 30, causing an error
on a 29 device

Amends: eda4049a0142029c192e1690bafffbb98ee4ff99

Change-Id: I5f4e2301d04a0a2e0e2f4037e4c371efd2fef352
Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 40cb7434afe28c4dbe434a35b659e1af5299a3d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 13:35:45 +00:00
Tor Arne Vestbø
ee1e0d256b macOS: Include text in key events triggered by insertion key-bindings
In 705665957baf16f9ec4d256dd4d2fad98788314b we started relying on the
input method to decide whether a key event should include the resulting
text or not, based on the assumption that text insertion would happen
via the insertText:replacementRange: selector.

But the NSStandardKeyBindingResponding protocol includes several other
commands for inserting content, including insertTab:, insertBacktab:,
and insertNewline:.

  https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding

We explicitly handle the latter, but for any command we didn't handle,
we concluded that the input method didn't want us to insert text, and
sent the key event without text, which broke tab character insertion
in text edits.

As long as we're not handling these commands explicitly, we adjust
the logic to treat any command starting with "insert" as an unhandled
request to insert text, and forward it as a key event with the text
included, as before 705665957baf16f9ec4d256dd4d2fad98788314b.

Fixes: QTBUG-109754
Task-number: QTBUG-106393
Change-Id: I4a164bc809c3606b43f267514a66ff017efeb4af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7e7bae35f758acba45257d1cb4229d5bc43b07ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 13:08:28 +00:00
Tor Arne Vestbø
969ba5e368 Don't override QDialog::setVisible() to implement native dialogs
Clients who called the base-class implementation in QDialog would
as a result start hitting the canBeNativeDialog code path at the
start of QDialog::setVisible(), which would show the native dialog,
but without updating the QWidget visibility state.

To keep things 100% compatible, we shuffle the implementation of
QDialog::setVisible() into QDialogPrivate, which allows us to
override it in QMessageBoxPrivate and QErrorMessagePrivate.

The existing subclasses of QDialog that override setVisible have
been left as is, to not cause any unintended behavior change.

Change-Id: Icafe31a7b84a75049365e4e04b80492de08614d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e0bb9e81ab1a9d71f2893844ea82430467422e21)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-10 13:06:48 +00:00
Tor Arne Vestbø
1da8787f93 permissions: Improve error when building example on non-supported platform
Change-Id: I02f4fc087d49d21541b1e415db411c09db981278
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c0967bd288b4376e31c183438448e00065c66b75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 12:16:15 +00:00
Joerg Bornemann
eca9aeb3b7 windeployqt: Remove support for QtQuick1
This module is long gone.

Task-number: QTBUG-105135
Change-Id: I58bb2dd04a278830a34747267c6c6058614b7342
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 8aa15f060dd01061592b5e45a0647a97f69a540f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 10:30:13 +00:00
Axel Spoerl
0b94530a31 Fix tst_QWidgetRepaintManager on XCB
Due to an XCB library change, QXcbBackingStore::toImage() cannot be
safely assumed to return an image identical to QWidget::grab().
The test functions fastMove(), moveAccross() and moveInOutOverlapped()
relied on QXcbBackingStore::toImage() and failed.
They were backlisted on Linux/XCB.

This patch obtains a screen shot instead of an image from the backing
store on XCB platforms. It processes events until the screen shot
matches QWidget::grab(). It makes the test fail only if the comparison
times out.
The patch also removes the BLACKLIST file, containing only the test
functions mentioned above.

Fixes: QTBUG-109036
Change-Id: I26dd5b89dc62b313db066a285f6ad7d4d92baaf2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4096667d6601dcbc5e713e6b0fd5b5218453c4cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 10:24:31 +00:00
Marc Mutz
65d011fe68 Move QTypeInfo<std::pair> from qpair.h to qtypeinfo.h to avoid ODR violation
First off, this doesn't cost us anything, because std::pair is defined
in <utility>, which qglobal.h unconditionally includes in C++ TUs.

More importantly, it prevents ODR violations: when a TU includes only
qtypeinfo.h, it will find std::pair<int, int> to be of Q_COMPLEX_TYPE,
in constrast with a TU which includes qpair.h, which will find it to
be of Q_PRIMITIVE_TYPE instead.

[ChangeLog][QtCore][QTypeInfo] The QTypeInfo for std::pair/QPair will
now be correct even if qpair.h hasn't been included, fixing an
One-Definition-Rule (ODR) violation.

Change-Id: I51f579c123183af25aac9f0ffcf077f752848fb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f6b026eed1a4a3441ba9b1b92a9eaf2c17d69253)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 03:10:12 +00:00
Marc Mutz
c5c703d719 tst_QSqlRecord: replace manual memory management with unique_ptr
Also replace the C array with a std::array and (some) indexed loops
with ranged-for loops. Most loops need the index in one way of
another, so can't easily be converted to ranged.

Change-Id: I7fa05f22de9df6c68ec5797c9583476a3881532c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 70e070ecbd4d334598aed140a3825887733c3c59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 21:21:22 +00:00
Volker Hilsheimer
cd0c0010a1 QKeySequenceEdit: fix typo in parameter name
Amend 1ea0d399b3787d486d6fc59aaaf498cbf6bd66b2.

Change-Id: I0762beb1da201006ddffc6c05ac204b710055d3f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c5e6615c7edaf71f6b6c8b208dff04b5d2feb6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 20:05:35 +00:00
Liang Qi
4732c9300b QOffsetStringArray: fix -Werror=type-limits
GCC complains:

  qoffsetstringarray_p.h:85:27: error: comparison is always false due to limited range of data type [-Werror=type-limits]
     85 |     if constexpr (Highest <= (std::numeric_limits<quint8>::max)()) {
        |                   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix by casting the RHS (of limited-range type) to size_t, the type of
the LHS.

Fixes: QTBUG-109875
Change-Id: I494ea544b8b3bfd877443119eebc160eb2f8e063
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit cf145a34b494e08a10271de277f6c4e62b54ea4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 19:38:13 +00:00
Volker Hilsheimer
60a2136533 tst_Gestures: Don't accumulate global state
(Un)Register the custom recognize in init() and cleanup() instead of
initTestCase() and cleanupTestCase(), so that a new recognizer is used
for each test function.

In the test functions, use a scope guard to unregister the locally
registered recognizers to make sure that in the case of a failing test
and early return, the recognizer is removed.

Change-Id: I4fe9509f35474514ef55191d799e6707199fe853
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 58afdea1b32899cc4ee8bf2062596ed523bbdffe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 19:38:05 +00:00
Ivan Solovev
3acc8fa9d3 QPromise: improve documentation snippet
The multi-thread snippet in the documentation, when copied as is,
could actually crash because of the race condition between the main
thread and the thread that generate results for the promise.
This is fixed by explicitly calling QPromise::start().
Actually, the underlying snippet already has this call, it just was
not included in the documentation.

This patch modifies the documentation snippet to include calls to
both QPromise::start() and QPromise::finish().

Fixes: QTBUG-109230
Change-Id: Ic25f31a6b3b16ba6bc06a0b199289c8c5d50bab6
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
(cherry picked from commit a8261e327d6316d944cfcc312a1b2e71bd4e5d27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 18:10:34 +00:00
Topi Reinio
181688d57d Doc: Fix linking to 'Drag and Drop' topic
Linking to 'Drag and Drop' target will link to a page local to Qt
Widgets with that section title. The intention is to link to the
topic page located in Qt GUI module.

Add a descriptive keyword to the correct target page and use that
for linking.

Fixes: QTBUG-109289
Change-Id: Ib6a39b43f9080cf5bb72fb07ab163e75eefb4da9
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 8a30b22930d3a3d15fba97ff7aec7f812721869e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 18:10:31 +00:00
David Edmundson
ba110e0497 Avoid qt keywords in installed headers
Change-Id: I14f3e02d2b568ae16beb07c8920df37981f3d0da
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8e218c11c0dd3ab6baa66c151620a00fde24d898)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 18:10:28 +00:00
Tor Arne Vestbø
8c42d4373e Fix QErrorMessage test when using native dialogs
When the test is showing the error message over and over, it's not
waiting for the native dialog to actually become visible, and as
a result, hiding it has no effect and won't result in a call
to processResponse, where we got rid of the native dialog.

To fix this we explicitly release the native dialog when
encountering this corner case.

Add logic to QErrorMessage to test both native and non
native dialogs.

Change-Id: I19ac3f463997aed1e66f646fdfcbb4d2459116d1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 349fda471e0df473f38f59c2baae688959d6d273)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 18:10:27 +00:00
Paul Wicking
c6f986d717 Doc: Drop link to deleted page
The standard accelerators page was deleted, drop the link to it.

Change-Id: I2fa9a94200d0e5f8895bb8c6981c73b3e9dd159e
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f10ae4b887f6652dcad95516ded43f2e2994e88f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-08 18:50:25 +00:00
Jaishree Vyas
b60af51ada Link update for Data Input Output in the save game example
Change-Id: I2a886766d59b9e75f42e401fca9c258fcbe02809
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit aae855bd6f87533590b5f91ab7104276d58763ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-08 18:50:25 +00:00
Ahmad Samir
d468e77af2 QFileInfo: use currentDateTimeUtc()
Instead of the more verbose currentDateTime(QTZ::UTC).

Change-Id: Ie759f4270b12fca39c458bf85c8296f5342033db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 26b5325767a4084ca51f485b99ac58477246e062
with #include <QtCore/QTimeZone> added to tst_qmimedatabase.cpp)
2023-01-08 18:00:59 +02:00
Ahmad Samir
603388c465 Docs: adjust docs after the QLatin1String to QLatin1StringView rename
Unify wording as "{Latin-1,UTF-16} string viewed by \a str".

Drive-by change: Fix a grammatical error, it's "a US-ASCII", not an
(because it's pronounced by the letter name "U" which is pronounced
like "you", so "a" not "an").

Task-number: QTBUG-108711
Change-Id: Iff763f4008341c35317bb3d7a2a228767ff6a648
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit a608744c9021a2ca26801bd4086c4360c9ded5f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 20:06:03 +00:00
Kaj Grönholm
8aa212137c Support serializing the QShader for qsb version
Support serializing shaders with specific qsb version. The default
behavior remains the same, using the latest version.

Task-number: QTBUG-101062
Change-Id: I090a88c1ccb3be4ac5eee1da4058afaa8bf3111c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit df00f9ea860d2d171d0132e2a49f6bdacc919100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 17:32:03 +00:00
Volker Hilsheimer
a8e6733dd2 Dark windows: use background/foreground colors for tooltips
That follows what File Explorer on Windows 11, or the system UI does for
tooltips in modern UI elements (the tooltip for the "minimize" button in
a titlebar still shows the yellow-colored tooltip). Using the accent
color makes the tooltip pop a lot more, but doesn't look native.

Also make the toolTipPalette helper function do something useful in dark
mode.

Change-Id: I2b07abd72eee50508f19f46aaec3408183c27100
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit eac9e74d9271f793f2a49af6ba776dd444875844)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 17:32:03 +00:00
Friedemann Kleint
a505baf4a5 Documentation: Clarify the meaning of the precision parameter for double formatting
Move it to the table for QLocale::toString() to make it more prominent.
Explain the meaning for QTextStream::realNumberPrecision().

Change-Id: Ic2da22ff6bea09e79e17f19b4636cef35dc3a615
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fe4cc2793f80e285be66c36bc1ec6903ddcd312e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 15:05:44 +00:00
Yuhang Zhao
1fc4b47d8d Update the documentation of QScreen::name()
Task-number: QTBUG-109569
Change-Id: I24ed586e9094e7cd2277c6289ffbd4210dd6e430
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9af5a70c55c9ec85113303fb48af405304335d1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 12:00:50 +00:00
Volker Hilsheimer
c4e7e453c6 QListView: Prevent infinite loop when wrapping text of item with null-icon
If an item in a list view has a null icon, then the decorationSize gets
calculated as -1, -1. The style would then try to wrap the text to a
lineWidth of -1, ending up in an infinite loop in viewItemTextLayout.

To prevent that, don't set the HasDecoration flag of the style option
when the icon is null, and don't fall back ot the decorationSize unless
the flag is set.

Add a test for this particular item configuration. This also fixes the
widget baseline test with styles that don't provide all standard icons.

Change-Id: I691db6abede9a9b2ad300f3ee7fbfdae5fb6097f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit fb8701cb8b1972d5ca6ffc383a436786bc170d16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-07 00:56:29 +00:00
Alexey Edelev
39c600acae Remove QT_USE_SYNCQT_CPP
Option has not effect anymore.

Change-Id: I199ff15ac68b785ba1787d44494c0b2dff3b1ad0
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 0a746a30a58f122931208047b908f21f1a070128)
2023-01-06 22:09:47 +01:00
Thiago Macieira
8a3983d115 Fix improper ELF versions of two more classes
They got marked as Qt6_PRIVATE_API because of these ARE private classes,
however their pointers are used in user code. For QMutexPrivate, because
we manipulate the pointer in inline code; for QPostEventList, because
it's used in a virtual member function's parameter list.

Fixes: QTBUG-109605
Change-Id: I69ecc04064514f939896fffd1736d1fa8d3f1768
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a2fe33203344e5c47da4da7d1083909e472ca2cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:28 +00:00
Thiago Macieira
6e011cd19d QUrl/doc: explain that the scheme-less URL is probably not intended
It is a valid URL reference, which is not what people may want.

Fixes: QTBUG-109855
Change-Id: I69ecc04064514f939896fffd173783ce2228c1d2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ce8fc1e88eef63308781d601dd10f694622abf95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:28 +00:00
Thiago Macieira
4ed94a237d syncqt: add some debugging to the ELF version script parsing
Drive-by fix spelling-grammar.

Task-number: QTBUG-109790
Change-Id: I69ecc04064514f939896fffd1736d3bb49e73ee1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dd7931d580de2d2af5411e0621a61af7345f188b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:27 +00:00
Morten Sørvig
0c10be1859 wasm: sync pointer button state on pointer down
We may get PointerDown events with "no buttons" as the button
state in some cases such as for tap events on Apple trackpads.

Make sure the mouse button which caused the pointer down
event is in the mouse buttons set for the event.

Fixes: QTBUG-108639
Change-Id: I0a49abc398308bbfed657b99fc74f60c16e05a59
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 1d3d7bfbbcfde475804db31747c3a4b42d3bfc9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:27 +00:00
Johannes Kauffmann
96aeba6bb1 CMake: Unify usage of pkg_check_modules
According to the CMake documentation, IMPORTED_TARGET should be
specified before the moduleSpec, and after QUIET.

Additionally, double-quote the moduleSpec everywhere, since before, it
was only quoted in some cases.

While this is not required for pkg_check_modules to work, it unifies the
coding style.

Change-Id: Ic8ad708a8146f9b39ee40e9a719412441e231452
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 029e118a4e014c3751c4a8f6bcc41f85b78286d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:27 +00:00
Morten Sørvig
b8cc131784 wasm: Fix secondary thread event processing
Fix test failure in WasmEventDispatcherTest::postEventSecondaryThread()

Revert to using qGlobalPostedEventsCount() for determining
pending events state, but move the final check to after
sending posted events. Also remove a superfluous check.

This partially reverts/amends cc60d706.

Task-number: QTBUG-109066
Change-Id: If4f437ce9379282c3d60b0272845a975794883de
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit daba0b8c19284fb68493cb8350804277b94b79ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 19:19:26 +00:00
Eirik Aavitsland
72c850347e Fix potential corruption with image format conversion on arm neon
For tiny scanline lengths, even the initial offset to align on 16
bytes may overflow.

Fixes: QTBUG-109477
Change-Id: I198c6fa5a2551a951893515f905bb7cc35479608
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7eccd7ac1c98e0c15c0b4a13d036a5ef46896d8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 15:51:41 +00:00
Sona Kurazyan
a11a2ac132 Fix crash when cancelling a QFuture that has continuation with context
To support cancellation of continuations attached via the parent future,
we store a pointer to continuation future's data in parent. This
requires preserving the lifetime of continuation future's data while the
parent is still alive (see 24dedaeaa1a94bfe9ade2da2a2c9aa112241b07a).
This is achieved by capturing the promise in the continuation's lambda,
which is only cleaned up after the parent's data is destroyed. This is
already the case for continuations without context, but was overlooked
for continuations with context: they transfer the ownership of the
continuation promise to lambda passed to QMetaObject::invokeMethod(),
which destroys the lambda's context after it's run. As a result, the
continuation's promise (and data, if there are no other copies of it)
is also destroyed, leaving the parent pointing to deleted continuation
data.

To fix this, capture a copy of continuation future's ref-counted data in
the continuation's lambda. This will guarantee that the continuation
data remains alive until the parent is destroyed and the continuation
is cleaned up.

Fixes: QTBUG-108790
Change-Id: Ief4b37f31e652988d13b03499505ac65c7889226
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9e61cc4f72a4fe86fa97f64238f1e3d940a7746b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 14:03:23 +00:00
Kai Köhne
2555dced63 Fix deprecation of QApplication:setActiveWindow()
The method is now deprecated in Qt 6.5, not Qt 6.4.

Also, keep the documentation for now, but mark it as
deprecated there, too.

This amends  2436e259ced3.

Change-Id: Iff3e2c170a8fdb8834c0283de9554b503ed3aca4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit eeb469869e4fe7fd873bb9e8a0185ec7afc6d332)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 14:03:23 +00:00
Andy Shaw
db61f95a31 SQLite: Update SQLite to v3.40.1
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.40.1

Change-Id: Ic17019f65083b24238025fe6ea6ee9872ac783fe
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit cac325fdc11a409473bd13a758de608eb3df1540)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 14:03:22 +00:00
Alexey Edelev
009d4fdc27 Avoid full optimization of syncqt if QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS is set
Skip adding full optimization flags when compiling syncqt if
QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS is set.

Task-number: QTBUG-109792
Change-Id: I585a459f3ca014cbeb3398b4f55d1da393c3c7d1
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fdeaf3054c93c9ead8d6f0f4539858ab025b20ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 14:03:22 +00:00
Leon Zhang
eb3a68ad5a Add resetTransform to see also of setTransform in QGraphicsView
Change-Id: I4a38d44f2109f8b92069651c23717da02f5b3091
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0d251afddafe3a5f88af048868b89bcc56aeff06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:27 +00:00
Alexey Edelev
257f142b86 Move '--sign' argument to the end of the androiddeployqt command
The '--sign' argument may and may not accept two follow arguments
to specify signing path and alias from the command line. This
functionality breaks the parsing of command line arguments that
follow the '--sign' argument and expect that '--sign' is used with
no follow arguments. It does make sense to check if the arguments
passed after the --sign staring with '--' to make sure that '--sign'
with no arguments is meant to be used.

Fixes: QTBUG-109619
Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9c56a77027db2fedfc2b50f96ceaee5003a7d383)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:27 +00:00
Alexey Edelev
72fcfba1d5 Check if "-stagingDir" is passed from the command
Check if "-stagingDir" is passed from the command line before trying
to copy files to it.

Change-Id: Id39882e4e955bd54328c8e747377b9d49f977378
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f071421558c751dc03c338f3271546c459ed9209)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:27 +00:00
Alexey Edelev
1ee479c66d Avoid breaking version script generator state
Pass every line to parseVersionScriptContent to not break the
version script generator state. The parser doesn't collect characters
from comment block, so the line containing the 'ignore-next' ELFVERSION
tag produces empty buffer for the further parsing process. Call the
parseVersionScriptContent function even on empty buffers to make sure
that 'ignore-next' counts lines correcly.

Fixes: QTBUG-109790
Change-Id: I5f77893462d397f6738a5da1af6ed8dd8a2df70a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ad7ad62d17b337671f97fd342148edcff74acaa5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:26 +00:00
Alexey Edelev
fc43973114 Allow specifying CMakeLists.txt as the argument for qt-cmake-standalone-test
qt-cmake-standalone-test uses add_subdirectory call when evaluating the
project. This leads to an error if users try to use path to
CMakeLists.txt as an argument, instead of directory when configuring
standalone tests with qt-cmake-standalone-test. It makes sense to check
if the user-specified path points to CMakeLists.txt and cut the
filename part when calling add_subdirectory.

Change-Id: I6b9ac0ca8323eaf11f219eb1e6bed3057120a231
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 90806123e961d469c36ee3b19ac0960524abb9e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:26 +00:00
Alexey Edelev
16fa77991f Add configure-time tools to the 'host_tools' target
Rebuild configure-time tools within the 'host_tools' meta target.

Task-number: QTBUG-109792
Change-Id: I1bd69c8e71185b6ec236c0f32064ba8f2c9f5ab0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5761f254a01f3fc941b87cbbc9392e7a8a12b6c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 10:25:26 +00:00
Timur Pocheptsov
74a1a05282 TLS backend SecureTransport: properly clear SSLContextRef
Simply calling SSLClose on context is not enough. Properly clear
the context by calling 'reset' member-function.

Change-Id: Ic6a32f6e4193bb19809d1cce184651b78d6273a7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6128a92e07c0c66c29445c2d79c3b6bdbf8efcda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:12 +00:00
Julian Greilich
58e54dcfd1 Android A11Y: Only access the main thread when it is not blocked
When the qtMainLoopThread calls QSGThreadedRenderLoop::polishAndSync(),
it waits for the QSGRenderThread.

In the QSGRenderThread, QAndroidPlatformOpenGLWindow::eglSurface()
calls QtAndroid::createSurface() and waits for the "android main
thread" to return a valid surface.
When the "android main thread" now calls "runInObjectContext" (e.g. by
calling QtAndroidAccessibility::childIdListForAccessibleObject()) it
waits for the qtMainLoopThread and the program is stuck in a deadlock.

To prevent this, we protect all BlockedQueuedConnection from the
"android main thread" to the qtMainLoopThread by acquiring the
AndroidDeadlockProtector.
When QAndroidPlatformOpenGLWindow::eglSurface() already acquired the
AndroidDeadlockProtector we abort the current A11y call with an emtpy
or default value.

Note: b8a95275440b8a143ee648466fd8b5401ee1e839 already tried to fix
this by checking "getSurfaceCount() != 0", but there are situations,
where a new surface is being created while an old surface is still
present.

Task-number: QTBUG-105958
Change-Id: Ie40e8654c99aace9e69b0b8412952fa22c89f071
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b832a5ac72c6015b6509d60b75b2ce5d5e570800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:12 +00:00
Axel Spoerl
48e0f52517 Fix unused variable compiler warning in slider example
The example overrides QWidget::resizeEvent() without using the
QResizeEvent * argument. This results in a compiler warning.

This patch marks the argument unused.

Change-Id: I647d0eda7d895e70ed6f232960aec992f5e37b6c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f05aee76288f2cbf021b80ee1b1961bd183cbfbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:12 +00:00
Axel Spoerl
fc789c99ec Document QGtk3Interface
Add internal documentation to header and implementation of
QGtk3Interface.

Change-Id: I3e6e970afa0c2ab26e0ce9efe6285cad1edfdb94
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d18f142062896da855222c92ceb7e4273d2c8375)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:11 +00:00
Axel Spoerl
2b4ce4bc5a Fix checkbox and radiobutton background in QGtk3Theme
The background color for radio buttons and checkboxes was not
correctly read from the current GTK3 theme in light mode.
This has lead to identical colors for indicators and background of
radio buttons and checkboxes for certain GTK themes (e.g. Breeze).

This patch sets the GTK default foreground color to the base color of
palettes for checkboxes and radio buttons.

Fixes: QTBUG-109454
Change-Id: Ic227029f2d366aa826e7bf1c3870428e3b638638
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2c9b7a986d08e8f9b858973a2ad479e1a83adb13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:11 +00:00
Laszlo Agocs
e83eb06a72 rhi: metal: Add enablers for pre-querying window stuff on the gui thread
Task-number: QTBUG-97518
Change-Id: Ia8fb5128149c9f91ebedfa914d1fe3e3d49774dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit f486d1f4d2dd5340c6ca84815abc12618e648c04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 07:50:11 +00:00
Axel Spoerl
311d60147f Document QGtk3Storage
Add internal documentation to header and implementation of
QGtk3Storage.

Change-Id: I8e12dad57c2458dea4446cddc8df1ceef59c070c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 812666fe7c5c6f9209a28402e1d5d4227167e305)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 05:12:06 +00:00
Joni Poikelin
8ce8b616cb Fix a warning about extra semicolon in qstylepainter.h
Change-Id: I104037ff58ade4b2ceffd73687355a5d237ab571
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7584871f4dab0cd8560603025217b7026568d81f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 06:02:04 +00:00
Eirik Aavitsland
1aada3cb3a Fix deletion order in QImageReader/Writer destructors
The device would be deleted before the image format handler, and hence
be a dangling pointer that could easily cause a crash if the handler
or codec would access it on destruction, e.g. for cleanup.

Change-Id: I51d16b1feddc5945955ac75a2e8701233dba7b82
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit f091026be1deb4b4a90f32585b9b22f97209866a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-04 02:13:38 +00:00
Axel Spoerl
5e560c53dc Skip tst_QWidget::optimizedResizeMove and ..._topLevel on wayland
Wayland omits optimizations tested in tst_QWidget::optimizedResizeMove()
and optimizedResize_topLevel() under certain circumstances, e.g. on
Ubuntu 22.04 / Gnome. This makes the test functions fail.

This patch skips the test functions on wayland platforms, if an
omission is detected.

This amends 2ec7a6322f465ad7cce3c48096d8912903196ab2.

Fixes: QTBUG-109746
Change-Id: If0df6b1cf451a7f0dccfc1bb7411e895d7ae29a3
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit df62cefdcb0ea6f644f1560285598ed179bb2bb2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 22:38:31 +00:00
Heikki Halmet
5d37d86a52 Remove blacklisting for OpenSUSE LEAP in gestures
Change-Id: Ia58d906582fa80016578468e6dd85da3c79274bb
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>
(cherry picked from commit ed623e63752af579ee0803669b19eb2c2820b32e)
2023-01-03 22:38:31 +00:00
Axel Spoerl
71e9e2656f Change parsing log output in QGtk3Json from qCDebug to qCInfo
When a palette mapping is imported from a Json file, parsing errors are
logged with qCDebug. This prevents errors from being logged in release
builds.

This patch replaces qCDebug with qCInfo for Json parsing to make errors
visible when the logging category qt.qpa.gtk is activated.

Change-Id: I3f92ecc3ab51f863f62ccef9f9061902320d3c3c
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 49a8311ae5f2fb467d43c8e68ab9490efd2e064e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 17:51:27 +00:00
Marc Mutz
3d386dea2c QWindowsKeyMapper: make the code locale-independent
The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper(i) is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

The latter is clearly wrong. The former might be what is wanted, but
since most locales these days are UTF-8, Í will be unlikely to be
representable in char.

So I conclude that what's intended here is that i gets mapped to I,
even in the Türkiye locale, so use the new QMiscUtils::toAsciiUpper()
instead of <ctype.h> toupper().

Fixes: QTBUG-109520
Change-Id: I6fee2fb15c2facae79f1727455180567698fed80
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 7a6016aec4fdb446bd4f515fe7c08e1496cd2a7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 17:51:27 +00:00
Kai Köhne
b2e1bd7d5e Remove cmake output about module major/minor/patch version
I don't quite see the relevance of this. We have explicit warnings
if versions don't match a bit below.

Change-Id: I08253fb99313896adb2c13d193ed3ec3954fb0b0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5de97970b85df747916831c97fb3a4f1fd912594)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 17:51:27 +00:00
Jonas Kvinge
fbeba5bb6f QFileSystemEngine: URL encode path in trash info, use relative path
According to the specifications, the path in .trashinfo should be URL
encoded.

The path can be relative when possible, otherwise changing the
mountpoint will break restoring files from trash.
But don't do that for root (/) and home.

For more info, see.:
https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html

Change-Id: Id8271a893a007f4cb5c10611f2b1bc71c1ff4860
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 314a4d121f55a7a6cd8335c9953d105574efab76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:41:55 +00:00
Liang Qi
98a96ec378 ibus: support high dpi for cursor rectangle
on both X11/xcb and Wayland.

Following similar approach in QFcitxPlatformInputContext::cursorRectChanged()
https://github.com/fcitx/fcitx5-qt/blob/master/qt5/platforminputcontext/qfcitxplatforminputcontext.cpp#L490-L532

Tested with following configurations:
* GNOME on xorg, 100%/125%/150%/200% scale, 1 and 2 monitors
* KDE/Plasma X11, 100%/150%/200% scale, 1 monitor
* GNOME on Wayland, 100%/200% scale, 1 and 2 monitors

Enable fractional scale on GNOME:
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Fixes: QTBUG-103393
Change-Id: Idfd3153e4cd9f9530b4db6f089830ec47451a19e
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Weng Xuetian <wengxt@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3790821b220ff6ab3c51a5c0b35581c00bc4e84d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:08:05 +00:00
Liang Qi
d142933b69 ibus: add SetCursorLocationRelative in InputContext.xml
Task-number: QTBUG-103393
Change-Id: I90c48a0d698636ed289d6f6c1485875e2e91fb34
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Weng Xuetian <wengxt@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 54002671bd68b1c59b61a630c9333b2aab286483)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:07:57 +00:00
Liang Qi
513248e5a9 tests: skip tst_QComboBox::cancelClosesPopupNotDialog() on Wayland
QWindow::requestActivate() is not supported.

This amends c95de359b4fe7bc03f7defdb057ebbe79c51b3dd.

Task-number: QTBUG-107153
Change-Id: I45f53b5e9de85049ca41cc139a78a82450f53bed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f09f516ac149a723d3b00b8ecc746c12eb970465)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:07:55 +00:00
Kai Köhne
06e7ad49fe Doc: Fix snippet for Q_DECLARE_EXPORTED_CATEGORY
The name argument must be a C++ variable name, not a string.

Change-Id: I6bc45bc9a57fd8429cf033aa118eebff0fcfc4a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7a37114af92fcaa6f8ed2eb17a4632b4880c8bbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 10:42:57 +00:00
Axel Spoerl
679ad1d22e Stabilize tst_QSpinBox::sizeHint()
The test function used to flake on Linux occasionally.
8e6ede7cd131682161180bfab0cc46686674709b provided a fix. While it
seemed to work, further analysis has shown that the root cause is
event sequence in case of multiple paint events.

This patch re-engineers the test function:

1. Allocate test widget on the stack instead of the heap.
2. Send layout requests posted by QHBoxLayout constructor and
QLayout::addWidget() before showing the widget.
3. Remove calls to QCoreApplication::processEvents().
They are unnessecary, because
- the size hint request counter is supposed to increase (by any number)
- QTRY_VERIFY processes events anyway until the counter increases or it
times out.

Change-Id: I54998483725cbdd4899ba6f5469d7dae0980ab1d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 71e67dec957d41d55ae03f32613a80394c928352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 09:57:35 +00:00
Laszlo Agocs
9579e7581b rhi: metal: Use scale from the layer we already have
...so that we do not need to call devicePixelRatio() again, which means
one less UI Thread Checker warning in Xcode.

Task-number: QTBUG-97518
Change-Id: I01d54ea113788cd0b141e124a47940f5cd3efabb
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8e5806b6807df0d39f3bbd2a1c0ed590426e1aa0)
2023-01-03 09:56:34 +00:00
Tor Arne Vestbø
755d7af3eb Don't use var-args for Q_DECLARE_EXPORTED_LOGGING_CATEGORY
MSVC should deal just fine with a single argument macro, and this
prevents the silent mistake of passing a single argument to
Q_DECLARE_EXPORTED_LOGGING_CATEGORY which would result in
no error or warning, but without exporting the category.

Change-Id: I4190027f8914ad1ef3957759f8e8c0e6cbd8ba97
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 9bf42425f1cfaca990e37200960615d819b31886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 02:58:45 +00:00
Alexey Edelev
80f9966c90 Replace syncqt arguments with rsp file
syncqt arguments contain full paths and may exceed the supported
command line size on some platforms. Use a single rsp file to pass
all arguments to syncqt.

Added the missing end-of-line terminators for error messages.

Change-Id: I60ad0f6770458d5256e67f042a63a3c16cd5ecb5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 947dd880cc2c1fc7973c0439ff8393e0f63f96a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 22:16:41 +00:00
Kai Köhne
e9479d2a22 Examples: Do not wrap custom types in Qt namespace
The Qt namespace should be used for types defined in the Qt library,
not for user types.

Change-Id: I6df0ca054888f4a65b19a9cb44324321d1dcfad8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 25c67c608a7a6e8673eee27a105b11d723f9a9b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 22:16:40 +00:00
Tor Arne Vestbø
15b35c7dab Don't use native dialogs for tst_QApplication::closeAllWindows()
The test shows an application modal QMessageBox, but assumes that doing
so will be non-blocking, which for macOS is not the case (yet). Instead
of making the dialog window-modal, which would potentially affect the
logic of the test, we disable native dialogs. This should be fine, as
the purpose of the test is to test the is_closing logic of
closeAllWindows, which lives on a layer above the native dialogs.

Change-Id: I6d627984a6ca452b876f34404b669fce41a00851
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit ad31b5f4c700fc7a66032fe14becc66b44c9d584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 22:12:39 +00:00
Tor Arne Vestbø
f7962fad4c macOS: Stop using the deprecated [NSWorkspace openFile:] API
We can use openURL instead, which also opens local files in the
associated application.

Change-Id: Ieddc6fb68d6b9e64195ed261953b9fffb6b0b73e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 351d3e50f993014ca6b17817c87d12153ca2f617)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 22:10:25 +00:00
Doris Verria
bede6b3db9 iOS File Dialog: Allow picking files if name filter is '*' (all files)
Name filters may be not empty and include all files ('*'). We should
not add any file type limitations in this case. Ammends commit
ce20b81070c8283a7895e46dd79d560fb0b81462

Change-Id: I3983e576a0ada4b7b40837c5c797359114b1ae02
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit af0f13b46053254c7b2416a1f71a95d141247600)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 10:57:35 +00:00
Morten Sørvig
665c99b6c2 wasm: support setting Emscripten configuration
Support passing Emscripten configuration options to
the QtLoader constructor using the "moduleConfig"
key.

Previously, it was possible to set Emscripten config options
on the global Module object. However, recent versions
if Qt has switched to using the MODULARIZE=1 build setting,
in which case there is no global object.

Fixes: QTBUG-107979
Change-Id: Ie99b772ddbb1d9f5464c868a43c821bae01519e0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit a594e95c9a2faef247a284983ef3ece277917d15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 02:17:17 +00:00
Ahmad Samir
9efeed01fd Use more documentation snippets for QString and its siblings
Change-Id: Ia569806b586923473f68b9fe1d98a3628ba46a58
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 5d76c49e9cf6b7f7fb15857ca184541b6044a220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-01 14:49:15 +00:00
Giuseppe D'Angelo
9634579408 QTypeInfo: fix pointer detection
Although redudant, people are allowed to use Q_DECLARE_TYPEINFO on a pointer
type. There's no reason to mis-detect the isPointer trait in that case.

Change-Id: Ic116f24397c91f5a3d31f5d8ee9fa2e587823257
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 114b94c26e990c792f2735b1104dd094ada714f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-30 12:38:26 +00:00
Giuseppe D'Angelo
6ed299f724 QMetaType: fix value-initialization in a corner case
If a type is trivially default constructible, QMetaType (and QVariant)
think that it can be built and value-initialized by zero-filling a
region of storage and then "blessing" that storage as an actual instance
of the type to build. This is done as an optimization.

This doesn't work for all trivially constructible types. For instance,
on the Itanium C++ ABI, pointers to data members are actually
value-initialized (= zero-initialized, = initialized to null) with the
value -1:

https://itanium-cxx-abi.github.io/cxx-abi/abi.html#data-member-pointers

This means that a type like

  struct A { int A::*ptr; };

is trivially constructible, but its value initialization is not
equivalent to zero-filling its storage.

Since C++ does not offer a type trait we can use for the detection that
we want to do here, and since we have also decided that Q_PRIMITIVE_TYPE
isn't that trait (it just means trivially copyable / destructible), I'm
rolling out a custom type trait for the purpose.

This type trait is private for the moment being (there's no
Q_DECLARE_TYPEINFO for it), and limited to the subset of scalar types
that we know can be value-initialized by memset(0) into their storage
(basically, all of them, except for pointers to data members).

The fix tries to keep the pre-existing semantics of
`QMetaType::NeedsConstruction`. Before, the flag was set for types which
were not trivially default constructible. That included types that
aren't default constructible, or types that cannot do so trivially.
I've left that meaning unchanged, and simply amended the "trivial" part
with the custom trait. A fix there (to clarify the semantics) can be
done as a separate change.

Change-Id: Id8da6acb913df83fc87e5d37e2349a4628e72e91
Fixes: QTBUG-109594
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e8f5f20319ce5f75180c531b6e26e648ce55619c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-30 12:38:24 +00:00
Thiago Macieira
ed82950776 Fix improper ELF versions of certain symbols
They got marked as Qt6_PRIVATE_API because of these private header
defining classes that don't follow Qt's naming convention ("mutex",
"condition_variable", "ControlElement"). We have an exclusion for
classes whose name start with Q.

Introduced by 5d903a64aca37ee7c2836e479e175336e9b7ca87 in the old Perl
syncqt and ported over.

Fixes: QTBUG-109605
Fixes: QTBUG-109604
Change-Id: I69ecc04064514f939896fffd173369623c960bcc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 41b38c802b2b6251bdd65f8bf0d2031c304d70f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 22:33:47 +00:00
Morten Sørvig
4b736cb7ad wasm: avoid LocalStorage past-the-end access on clear()
We were looping over all keys and removing the Qt keys
using an integer index. However, removing one key shifts
all other keys at higher indexes down one step such that
the loop eventually indexes past the end.

Fix this by getting the keys first in a separate step,
and then remove keys without relying on a stable iteration
order (which is also not guaranteed by the standard).

Change-Id: I8bc577d1831d6931ebca2b2e04faf65c9affb429
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 8a20a278fa5f1e2890f88a69d8b5f96873a67ac9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 19:33:14 +00:00
Axel Spoerl
28dd79dc49 Fix size calculation of unplugged dock widgets
When unplugging a dock widget, it still grows by the separator size
when dragged upwards or to the left. The unplugged dock widget's size
can become too small to drag it or to access window handles.

This patch corrects the size offset for all drag directions. It expands
the target size to a minimum size, making sure that title bar and
window handles can be accessed after unplugging.

Fixes: QTBUG-106531
Change-Id: Ie771a9338ebfb4c0eafd3b3b4205de730cbd20ac
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit e29ffd3bd13dbc1e808cfc4f7764878f855d1a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 16:29:46 +00:00
Axel Spoerl
572f80d32f Use minimum size for in tst_QDockWidget::createTestWidgets
tst_QDockWidget::createTestWidgets did not set a minimum size for
test widgets. Upon unplugging, that can lead to a size correction in
connection with 8687c3f938cac56c4a2518576a5c9fac150d8de1, if the widget
gets too narrow to correctly display window handles. Test functions
checking the size after unplugging can fail in that case.

This patch sets a minimum size to each test widget created. The minimum
size corresponds to QStyle::PM_TitleBarHeight.

Task-number: QTBUG-106531
Change-Id: I3e552b37416d57d8ed30e0b9de4eec55f07ea158
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit c69e727274adae7d3943587091254696c46fb75b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 16:29:37 +00:00
Marc Mutz
e4ccda5ba9 tst_QStringApiSymmetry: fix a typo and deal with the fallout
Turns out we don't support QStringView/QUtf8StringView comparison, and
the only reason the corresponding test succeeded was because it
contained a typo (QStringView instead of QUtf8StringView).

Fix the typo and disable the now-failing test.

Change-Id: I2210a247aac66743851e53578172a563ee1e96f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 92e913a5414ea3a7fb002a139251bb8ae53c467c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 13:38:40 +00:00
Morten Sørvig
0f43a04de7 wasm: fix up new configure options
Make options for enabling "simd128" and "exceptions" public:

    -feature-wasm-simd128
    -feature-wasm-exceptions

Make sure both appear in the config summary and feature
list. Move the exceptions code so that they are next to
each other in the cmake file.

Change-Id: I3975b56703f40f7ffff270754535bc2eb5bfe488
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit ce560d28c8b426d3cb797fa04e9e78d980fc8501)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 15:57:58 +00:00
Giuseppe D'Angelo
22c48a4e02 Wait conditions example: fix an incorrect condition variable usage
3a449bbb69c9a3c3a5bc6a052f2de98ab79be7e9 amended the code to remove
acquiring a lock when waking up a condition variable. It is fine to
not have a lock associated when waking a condition variable; what I
misunderstood was the scope of the lock, which (and this underlines
the importance of commenting _what exactly_ a lock protects, for
each and ever lock) protected both the buffer as well as the counter
of the buffer. This made my reasoning flawed: it is necessary to keep
the lock while notifying, otherwise the counterpart could verify the
condition isn't satisfied and wait (e.g. see numUsedBytes==0), missing
the wake from the other thread (which could arrive between the check and
the wait).

Amends the previous commit.

Change-Id: If7db2d045331f1b33b976fb6bf6aa9117c41678f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit fddeec60cba806b88c5eb0e4758c3951457518a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 14:10:54 +00:00
Morten Sørvig
b444b792ad wasm: align QWasmLocalFileAccess API with 6.4
This API is undocumented, but by keeping unchanged makes
it easier to use from external projects.

openFile(): Copy the accept/filter list parsing function
from 6.4. It makes sense to implement this behind the
API, so that user code doesn't have to reimplement it.

saveFile(): Slightly more complicated; the new variant which
takes a QByteArray is better since the implementation can
then keep a reference to the data for as long as it needs,
without copying the data. Add the const char * variant to
keep existing code going for now.

Adjust the calling code in widgets.

Change-Id: I1899ebffdb90e40429dcb10313ccc5334f20c34f
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit fbf2a318dd3f1e0f9fc8dadb68d47923dff3d672)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 13:21:50 +00:00
Axel Spoerl
747a4de311 Detect appearance by colors unless GTK theme name contains "dark"
QGtk3Theme detects the appearance property by theme name: If the name
contains the keyword "dark", the theme is considered to be dark and
otherwise light.

This detection logic fails, when the GTK theme is dark without
containing the "dark" keyword, e.g. the dark theme "Adapta-Nokto".
While QGtk3Theme imports the right colors in that case, it wrongly
identifies a light theme.

This patch adapts the detection logic: If the theme name contains the
"dark" keyword, it is considered a dark theme without further checks.
If it doesn't, the current GTK3 theme's default background and
foreground colors will be read. If the foreground is lighter than the
background, the theme is considered dark. If the background is lighter
than the foreground, the theme is considered light. If both colors are
identical, the appearance will be Qt::Appearance::Unknown.

Task-number: QTBUG-93955
Change-Id: I0e0f4870a1397b6a7918331a852284bb1c91199e
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 7b64eb71c0fe68540d97eb22492b4d0b0a647e9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 11:01:59 +00:00
Paul Wicking
26e593872c Document max size for QFont::setPixelSize
Fixes: QTBUG-102989
Change-Id: I9a63a2ab8ac6eadf1b5a5865a0a084700d9e85d2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8165750af85e324055b89f69d2e359e40f043bfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 08:17:37 +00:00
Mikolaj Boc
49cfc516e6 Fix the handling of dead keys on WASM
1) Do not attempt to take the first character of event.key when the
key is a dead key - this always returns D as in Dead
2) Do not attempt to immediately modify the pressed key with the dead
key as the dead key itself will be modified

Fixes: QTBUG-109629
Change-Id: Ic66536b8b27df23c2f1c4ebf1c02e713990e62ef
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 988c7bfcae5f69f7918f4dacf74e8b1ad2bee9c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 23:19:00 +00:00
Marc Mutz
f255960f97 QTextDocumentPrivate: de-inline {add,remove}Cursor()
In a 'ninja qtdeclarative' build, the addCursor() function alone is
compiled 458x for a total of almost 10s cumulative compilation time.

This makes it one of the top-20 template instantiations in a Clang
-ftime-trace build.

The removeCursor() function doesn't show up quite as much, but
de-inline, too, while we're at it.

Task-number: QTBUG-97601
Change-Id: I37b920a8b364861efab78f736d71642dc82d8982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 436501d87754ed61bc2d9f574b97be84c30a3f05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 14:30:43 +00:00
Assam Boudjelthia
7cfc729f41 Android: Fix deprecations AlertDialog.setButton()
https://developer.android.com/reference/android/app/
AlertDialog#setButton(java.lang.CharSequence,
%20android.content.DialogInterface.OnClickListener)

Change-Id: I470acba581b7226b2d4a56754cf6372baa167eb4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 40b42ac517c45beff3caf5e991c84739ac014912)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 11:55:12 +00:00
Assam Boudjelthia
42af56bf61 Android: fix deprecations for getDrawable() on QtMessageDialogHelper
Change-Id: Icd359663af11f44b4bcf0cd4e4f1f7f5a51242e4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 31a0d99fa565d39bf39f0c3ae5ed00859679a969)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 11:55:12 +00:00
Morten Sørvig
35c0af3367 wasm: update emscripten to 3.1.25
Qt 6.5 will require emscripten 3.1.25. This is not the
most recent version (3.1.27 at the time of writing),
however .26 and .27 make changes to stack layout and size
which require further investigation.

Change-Id: Ibe285ef160d450d6b2c63a7fb71d3561b0032e37
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-27 10:04:05 +01:00
Axel Spoerl
f6313dbc73 Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()
The test function places a QSpinBox in a QHBoxLayout, which has a
QWidget parent. The spin box is expected to be shown with the widget.
While the widget is the layout's parent, the layout is not explicitly
set. That makes the test function flaky in some cases.

This patch adds QWidget::setLayout() to explicitly set the layout on
the widget.

Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 8e6ede7cd131682161180bfab0cc46686674709b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 00:24:20 +00:00
Marc Mutz
662db241dd runOnAndroidMainThread(): optimize shared pointer use
- port from QSharedPointer to std::shared_ptr (one instead of two
  atomic ops per shared-pointer copy)

- port to std::make_shared (one instead of two memory allocations for
  shared-pointer + payload creation)

Change-Id: Idecef5732d181a63e6936f54204eeb7ecbdc4a0f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit dbcbadb7ac6620fabadd173b54d292bbadcb5b58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-26 13:02:26 +00:00
Laszlo Agocs
9b3848c5d0 windows: gl: Fix WGL_SAMPLES reduction
The logic for writing 0 and false to the keys and values
is off by one.

While we are at it, unify the naming between the two settings
that are possible to reduce (samples and sRGB).

Amends d64f776a9a41a8d1144397b7b62efbdee8d24857

Fixes: QTBUG-109453
Change-Id: I97f3a3c7175bcb555c70967056ab2de45b077f48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3e619aff308dad02ee3d54aeda85a2bbaae77063)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-24 11:19:44 +00:00
Marc Mutz
cea3c2ce02 Fix UB (reference to local variable leaving scope) in runOnAndroidMainThread()
The QAndroidApplication::runOnAndroidMainThread() function creates a
task on QThreadPool::globalInstance() to wait for a timeout and cancel
the QFuture representing the task.

It does so by passing a lambda to QThreadPool::start(std::function)
that captures the future, a local variable, by reference. This is UB
when the lambda is ever executed, because the local stack variable's
lifetime will have ended.

To fix, simply capture the future by value, not by reference. Since
QFuture::cancel() is not const, we need to make the lambda mutable.

Fixes: QTBUG-109586
Change-Id: Icacfb0dc76bcd3a145f90126f535e7c0f4b5ef6a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 3642d5680df8a1b70e4a1a111347005e08555070)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:34 +00:00
Marc Mutz
de2840675a QAndroidNaticeInterface: replace a pair with a struct
Nicer member names make the code using the type more readable. It also
allows to add other members later.

Change-Id: I69f1f97673a8f1ad8eb73e4f1e5323eccf929413
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b6fdf34dfca20c8312feeb28efd3288700ad4b3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:28 +00:00
Marc Mutz
55bef5d260 runOnAndroidMainThread(): Use QThreadPool::start() instead of QtConcurrent::run()
The latter is in a module (QtConcurrent) that depends on QtCore. Don't
make QtCore depend on QtConcurrent...

The code doesn't use the QFuture returned from QtConcurrent::run(),
anyway, so QThreadPool::start(function<void()>) is more than an
adequate replacement.

Task-number: QTBUG-109586
Change-Id: Id00a42525c3d7454a1fa2d4812de634dbbea1035
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 500e161987af24e2e10d46011d776258d5c0e47a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:22 +00:00
Marc Mutz
f9e9dd19cc runOnAndroidMainThread(): Don't block QThreadPool::globalInstance() with timout awaiters
A waiting task on QThreadPool::globalInstance() will block the worker
thread that it was scheduled on, making it unavailable for productive
work. That's why one should only put CPU-bound tasks onto
QThreadPool::globalInstance(). When blocking nonetheless, use the
releaseThread()/reserveThread() trick to avoid deadlocks caused by the
pool running out of workers.

So, do that here.

Task-number: QTBUG-109586
Change-Id: Ia2660c69e1f23b5df0c308576301aac6e05d4725
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c0496013484c35ab9b1a29ffb0f1eb687ef6db78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:15 +00:00
Marc Mutz
db7d301f97 Don't create a QRunnable in QAndroidApplication::runOnAndroidMainThread() w/o timeout
Creating a QRunnable is expensive business, incl. setting up
QThreadPool::globalInstance() if it wasn't set up already, so don't do
it for a no-op task.

Somewhat mitigates, but doesn't fix, QTBUG-109586.

Task-number: QTBUG-109586
Change-Id: If2043134414d68adc9188e5bb7650ca08046b4aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 26ea6157e6429a6ba0794272df195c0bc591cda9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:08 +00:00
Oliver Wolff
69b469138b QWindowsContext::setProcessDpi[V2]Awareness check current value before setting it
Our previous assumption was that the right value was used if we ran into
an "access denied" error. That error only states that the function has
been called before though. The warning should be omitted if the right
value has been set before.

Change-Id: I1379242f68e2f09bc6a25dd322fe3634622d8e8e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit c3f8198d07c04cd8962637f134a9c78fbb5760c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 14:11:24 +00:00
Giuseppe D'Angelo
56ae42964e PCRE2: upgrade to 10.42
Upstream released 10.41 and 10.42 in quick succession.

[ChangeLog][Third-Party Code] PCRE2 has been updated to 10.42.

Change-Id: Iadec8e64e9ce7ddad17afb075157719af76379bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 05e72d53a6b0546d67dc699f922811790a896fb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 14:11:24 +00:00
Kai Köhne
13f2dfff7d Doc: Replace QTemporaryFile with QSaveFile for QFileDevice motivation
QTemporaryFile is derived from QFile, so it's not a reason why
QFileDevice should exist. Instead, mention QSaveFile.

Change-Id: I1de3a32746a313ec57323f3f8ae42e326f11d147
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit c9d9b43b10509020be706629060f83fa3091c4c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 14:11:24 +00:00
Kai Köhne
be6cd144d3 Doc: Reorder QFile overview
Move the paragraphs dealing with encodeName()/decodeName() and Unix
special files to 'Platform Specific Issues'.

Change-Id: I076191e041ef238556aab28b5ad5d51974f8f7ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8b0818235d512c9085ce0fd0ea2490f1653a6c36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 14:11:24 +00:00
Kai Köhne
086b41349a Improve QFile::encodeName(), QFile::decodeName() documentation
Make it explicit that the local 8 bit encoding is UTF-8 on all
platforms but Windows.

Change-Id: Icaabfd28689a71ee5cc2957f058f9388405496d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ac6e61d867d76d0a24449f82c0f484a513fec184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 14:11:23 +00:00
Laszlo Agocs
6ff96b2dce rhi: vk: Fix up some legacy queue (family) index inconsistencies
Relevant mainly if we want to consistently expose these as the
theoretically correct uint32_t/quint32 from Qt Quick's
QSGRendererInterface. (not that int is not sufficient for
indexing the typical 3-4 families and 2-16 queues per family)

Some checks are not actually needed since the family index
must always be valid after create().

Task-number: QTBUG-108895
Change-Id: I474ccea51a81e7a096281604ff79b7db4cdd2484
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 4d36a83b6d665f5b022cf46e4a5349f8974c1fdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 11:02:42 +00:00
Thiago Macieira
5036562bd2 tst_qlogging: Skip backtrace tests under ASan
ASan inserts a lot of function calls in between our calls, so they end
up in the backtrace and cause unexpected results.

Similar to c672f148dbf179f2e0ac94dfac7d329d50a3e4a3.

Fixes: QTBUG-109559
Change-Id: I69ecc04064514f939896fffd1732dd2bc0317ae4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e68b4d838f35b75cbf1a79863b52f43d08defe9)
2022-12-23 03:23:27 -03:00
Topi Reinio
8680d45bac Doc: Remove incorrect CMake instructions for QtCore-private
Drop the use of \qtcmakepackage for the module page that results in
incorrect instructions, and replace it with a snippet with the correct
commands to use.

Fixes: QTBUG-109214
Change-Id: I936910ddb9e4118f931d85e4b096ad52006dcc32
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 8844c6ef379f466a12a5f4981c78bdb990d92db8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 03:55:38 +00:00
Volker Hilsheimer
8df8214600 QTextImageHandler: Resolve Nx images correctly for file or qrc URLs
The qt_findAtNxFile helper in qicon.cpp expects a local file name that
can be probed with QFile::exists. If the src attribute of an <img>
element specifies the location of the image as a file:/ or qrc:/ url
rather than as a local file name, then we need to strip the scheme
off the file path, and in the case of a qrc URL leave the :/ prefix
before calling the qt_findAtNxFile helper.

Amends, and partially reverts, 760df7256588e76d082ea959399af36d7ba80a86.
We can't avoid testing whether the source in the HTML is provided as a
URL before interpreting it as a file name.

Fixes: QTBUG-109212
Change-Id: I7ea7a5bfde79bab90a8025c42e754129813dd0fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2d87c4d881b74619fef966ffb0d7a00cb4ccea50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 18:20:37 +00:00
Samuel Mira
94b37db0ac Android: Fix UI is scaled smaller than before
The 413593183bbb1137fdc784d98c171d67a167bb32 patch changed the way
how the display metrics are retrieved. By doing so, it was found that
the previous way retrieved the scaledDensity always equal to density.
It is intentional for scaledDensity to be dependent on the font scale
chosen by the user. However, this change altered not only the font scale
but also the layout. This patch will make the layout dependent on the
density instead of the scaledDensity and normalize the way the display
metrics are retrieved among Android versions.
Currently, the fontScale is ignored, QTBUG-109566 will track future
developments.

Fixes: QTBUG-109026
Change-Id: I6adacd17583cbe9bee368af35c50b780872ab222
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 99893a914a821567e10935ffb8be24df7147ccd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 18:20:37 +00:00
Ville Voutilainen
c389fdef1c Skip QProcess tests when run under ASan
These tests exhibit weird crashes when run under ASan, but sometimes
they fail sometimes they don't. Pending more insight, just skip this
test under that configuration.

Fixes: QTBUG-109329
Change-Id: I49d940de419f7166aab0da0b8c2b44297c4b6d74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c672f148dbf179f2e0ac94dfac7d329d50a3e4a3)
2022-12-22 18:20:36 +00:00
Assam Boudjelthia
7873cda9f8 Android: handle move operation with content uris
Allow moving content uris if the destination is provided
a full content uri with a parent that's different from the
source content uri (i.e. different folders).

Note: since the underlaying Android APIs don't always know about
the parent of a uri, we do some step to deduce that, but that's
not always guaranteed to work.

Task-number: QTBUG-98974
Change-Id: If21954e5963f4eb0b96c7ccd983943ea2cab5b24
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c203ec2720b694fd877512da531a227e0f3310cb)
2022-12-22 12:48:06 +00:00
Assam Boudjelthia
361ebe6d21 Android: handle rename() operation with content uris
Allow renaming content uris if the destination is provided
as a direct fileName (i.e. not full content scheme path),
and if the destination has the same trailing path (or parent)
which means a rename in the same folder structure.

Task-number: QTBUG-98974
Change-Id: Ibc4973366807dd5284c19912ab04ff90f2a573cb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c1fa5d602c541b06e3e2fc2d02f5d62060c84504)
2022-12-22 12:48:02 +00:00
Assam Boudjelthia
cec1aff0b7 Android: Add facilities to handle more content URIs operations
Use DocumentFile and DocumentsContract to support more operations
on content URIs, such as:
* listing files and subdirectories with usable content uris
* mkdir, rmdir
* creating non-existing files under a tree uri
* remove

And since dealing with content URIs require some level of user
interation, manual tests were added to cover what's been implemented.

Note: parts of the code were from from BogDan Vatra <bogdan@kdab.com>.

Task-number: QTBUG-98974
Task-number: QTBUG-104776
Change-Id: I3d64958ef26d0155210905b65daae2efa3db31c1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e5d591a0d09032d1870e47d1bf59c9069ea0a943)
2022-12-22 14:47:57 +02:00
Mikolaj Boc
524a7c5931 Avoid mutual ownership in qstdweb's File::stream
The mutual ownership of chunkCompleted<->fileReader caused both not
to be freed, which resulted in a memory leak. Resolve this by
introducing the ChunkedFileReader class which owns itself until file
read is finished.

Also, resolve a similar issue in qwasmlocalfileaccess.

Fixes: QTBUG-109436
Change-Id: Ieec4cde15a893fa6a2e21a62d3bb6637374c5364
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit cc60d70699019030a8cba777de5c46b4f4b8b31a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 11:16:21 +00:00
Marc Mutz
6098859538 QXBMHandler: use QtMiscUtils, not <ctype.h>
The latter are locale-dependent, and while that doesn't produce wrong
results here¹, it means they need to be out-of-line, whereas
QtMiscUtils functions are inline constexpr.

¹ isdigit could give a false positive on non-US-ASCII-digits, I
suppose.

As a drive-by, rely on the QtMiscUtils::fromHex() returning a negative
value when a non-hex character was encountered, to avoid the extra
isxdigit() checks. This property is preserved through the bit
manipulations: ORing together negative values yields a negative number
iff either or both operands were negative (in two's complement, which
Qt requires). The caller also checks the array bounds before calling,
so the isxdigit() calls didn't act as an implicit bounds check
(returning false if they encounter '\0'), either.

Task-number: QTBUG-109235
Change-Id: I4cd734468e223f1047a53afd264d077b28cb5f1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 115b1eab86d0395dc29f90d271bfdd29d425442e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 11:16:21 +00:00
Marc Mutz
9a20ca1fe2 tst_QString: test with QT_RESTRICTED_CAST_FROM_ASCII, too
QtBase didn't contain any checks for QT_RESTRICTED_CAST_FROM_ASCII, so
a recent addition to the QString::append/insert/prepend overload set
made calls with C string literal arguments ambiguous without the CI
noticing. We had a similar problem with QString::multiArg.

To increase test coverage, we now run tst_qstring two times:

- without any define
- with QT_RESTRICTED_CAST_FROM_ASCII (lots of changes necessary)

Most removals are expected, because they disable tests that check the
implicit conversions from QByteArray and const char*, but the
relational operators with QLatin1String objects might warrant fixing.

In some places, when the conversion wasn't the functionality under
test, replaced C string literals or QByteArrays with QLatin1String.

We should also test with QT_NO_CAST_FROM_ASCII, but that's even larger
surgery.

QString doesn't have a ctor from std::nullptr_t, so QString s =
nullptr; doesn't compile in C++17 mode, but does in C++20 mode, due to
the const char8_t* ctor.

Change-Id: I0c5a31719a4b8dd585dd748e0ca0d99964866064
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8420d3e0b205d0ef2367224afd3040c68e28bcc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 11:16:18 +00:00
Marc Mutz
076297eeee QFuture: port from QSharedPointer to std::shared_ptr
Compared to std::shared_ptr, QSharedPointer requires 2x the atomic
operations per copy, and this code uses _a lot_ of copies.

Port to std::shared_ptr. The uses are all in inline, non-exported
code, so there's no BC or SC issue here. Old code will happily
continue to use its QSharedPointer-based code, while recompiled code
will enjoy the transparent efficiency gain.

This also helps prepare QtCore for an eventual QT_NO_SHARED_POINTER
(which QtCore will not be able to set on itself, because QPointer is
still not ported away from QWeakPointer, but which should affect as
few headers as possible).

Change-Id: I8159c38d93f3bcfc22a236c8c26541ab5ee4e6d0
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 85b15b101c70b962fd0030c26159ef7b1b50a1f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 10:40:59 +00:00
Marc Mutz
9f532ede5b [doc] QSharedPointer: add some missing docs
Added docs for
- move-ctor, -assignment operator
- move-construction and -assignment from QSP<X>
- qHash()

There's more stuff missing, but I declare 'twas enough qdoc wrangling
for this round.

The texts are taken from other smart pointer docs, esp. QESDP, so
they're consistent.

Fixes: QTBUG-83134
Fixes: QTBUG-63700
Change-Id: Iff980d043e1635ed6cfdd3113c68bc23f3a0bad7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5dc0f52e7047ca5927e6741fda554cb090184b71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 10:40:52 +00:00
Thiago Macieira
e762d8a29f tst_qlogging: don't skip all tests under static builds
We only need to skip the backtrace ones, because there's no library
called "Qt6Core".

Change-Id: I69ecc04064514f939896fffd1732dd680058ba6e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b242457d345132083512ff56ecc4980fada2352e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 02:23:18 +00:00
Thiago Macieira
90d340a071 tst_qlogging: fix preprocessor directives
Reorganize them and fix the comment.

Change-Id: I69ecc04064514f939896fffd1732dd57203cb21f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5aa66034c2c81e62bdd159e32a3226f8971089a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 02:23:09 +00:00
Volker Hilsheimer
5b938f7725 QTextImageHandler: Add test coverage for resources and URLs
If an image source in HTML is specified via local file name or resource
path (i.e. without qrc prefix), then the correct image is loaded.

With file:/ or qrc:/ schema however, the image is either not loaded at
all, or the 2x image is not loaded. The qt_findAtNxFile helper in
qicon.cpp gets a URL path, but expects a file path (that can be tested
with QFile::exists).

Task-number: QTBUG-109212
Change-Id: Ibcf687c69b3e53a10f21d718d28c8177a02d6be6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c9cf4037cafe22aa20cfea6efe1c6a4c7211d21f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 01:05:54 +00:00
Volker Hilsheimer
17d4582b9a Enable and fix the test for QTextImageHandler
Amends 52ce0c177e80c2d5b70b38d429abb3689b3da51e, which added the test
without adding it to the parent directory.

Refactor the test code to be data driven, add the image files as
external test data files, and adjust the test code to find the files.

Use the QTextImageFormat from the document rather than a manually
crafted one, as otherwise we don't test a real usecase.

This also makes the test more flexible for adding qrc, resources, and
file URLs.

Task-number: QTBUG-109212
Change-Id: Id0771037b961d95ec3cadd0cd6467d2448f22884
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit d8e213a9e6b3013f768cbf4d94878cd2a0f7bb79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 01:05:53 +00:00
Bartlomiej Moskal
4d90db1f1d Android: Do not close the keyboard for NO_ENTER_ACTION
After commit cc9144b4f39923dfb9ee17f951f93f257aa2d221, virtual keyboard
is hiding after clicking the done button. This is expected behavior,
but not in case when imOption is set to IME_FLAG_NO_ENTER_ACTION[0]

This commit removes hiding keyboard in mentioned case.

[0]https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_ENTER_ACTION

Fixes: QTBUG-107662
Change-Id: Id280c4a67e3940fce5045724f77284a77c886f06
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit abe3bc1c432e670fc1244a643b720c1b6a2d56f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 18:56:42 +00:00
Jaishree Vyas
9e193893db Doc: Increase Test Function Timeout
Documentation on QTEST_FUNCTION_TIMEOUT environment variable

Fixes: QTBUG-88652
Change-Id: Ib851eb2312088cf6b9ab277faa571757f4076ad4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 46d2b45d2c33b066ee4ef31f5a44ee5c6b8bae73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 17:12:20 +00:00
Joerg Bornemann
6d75c0dea6 CMake: Avoid repeating DESTDIR when deploying Qt libs and plugins
Let CMAKE_INSTALL_PREFIX be "/usr/local", and consider a project with a
call to qt_generate_deploy_app_script.

Installing the project with DESTDIR set to "/tmp/bla" would install the
project targets to "/tmp/bla/usr/local" but the Qt libraries to
"/tmp/bla/tmp/bla/usr/local".

That happened, because we used QT_DEPLOY_PREFIX as DESTINATION in
file(INSTALL). QT_DEPLOY_PREFIX starts with $ENV{DESTDIR} and
file(INSTALL) also prepends DESTDIR.

The value of QT_DEPLOY_PREFIX is controlled by CMAKE_INSTALL_PREFIX. Use
the latter as DESTINATION in file(INSTALL) calls.

Task-number: QTBUG-109553
Change-Id: I8f06d81968fa0de4f17c4f8bc9b17cc052da4c12
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 1f142d903835a86996a00c2ee32689c7fb10c1e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 17:12:20 +00:00
Marc Mutz
43f6e10a7c tst_QByteArray/tst_QString: use new QtMiscUtils::toAsciiUpper()
... in lieu of <cctype>'s toupper(), which is locale-dependent, and
out-of-line.

The code doesn't run into the toupper(i) issue in the Türkiye locale,
because we don't run tests in that locale and because 'i' is not a
valid format specifier, but don't let the next reader of the code
guess when the use of toAsciiUpper() provides unambiguous guidance.

Task-number: QTBUG-109235
Change-Id: I8988f5190441e1ae5cb57370952cda70ca6bb658
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 78db5cb6439070f43422cbda3a562b46c8fc5cf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 13:39:20 +00:00
Volker Hilsheimer
10772b6f7b Android input context: don't connect to non-existing signal
Not all focus objects have a cursorPositionChanged signal, so don't
connect unless there is one. The code should perhaps not show the
software keyboard at all unless the focus object responds to the input
method query with cursor positions, but that's for a different patch.

Change-Id: I0e01da42e96eb579d260b9158f005ad3215d0c26
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f21c4500a6d4787d679d13e859b34d6c6a7a8c0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 13:39:19 +00:00
Bartlomiej Moskal
9929a83183 Android: Close the keyboard after clicking Done
The keyboard was not hiding after clicking the done button.
This commit changes this behavior. If KeyCode is other than
IME_ACTION_PREVIOUS/IME_ACTION_NEXT the keyboard closes automatically.

Fixes: QTBUG-107662
Change-Id: I3449aa6898b826bfa03104275c7224329f24ed9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit cc9144b4f39923dfb9ee17f951f93f257aa2d221)
2022-12-21 10:21:37 +01:00
Bartlomiej Moskal
d43d16f9ab Android: Fix for low contrast status bar
After we start to use THEME: Theme_DeviceDefault_DayNight, status bar
icons have low contrasts on some devices.

That is why we need to set APPEARANCE_LIGHT_STATUS_BARS[0] in case when
Status bar color is too bright.

[0]https://developer.android.com/reference/android/view/WindowInsetsController#APPEARANCE_LIGHT_STATUS_BARS

Fixes: QTBUG-108365
Change-Id: I38a31cfb0a3a1b912b86ed1b302c567e14a7ffcc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit eda4049a0142029c192e1690bafffbb98ee4ff99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 13:08:01 +00:00
Doris Verria
b8833ccc31 Metal rhi: Cast layer bounds to int before multiplying by scale factor
In qrhimetal, we were setting the current pixel size by multiplying
the width/height of the CAMetal layer bounds, which are floats, with
the scale factor, and then rounded these to the nearest integers by
converting from QSizeF to QSize.

This caused problems, namely a crash when trying to resize a modal view
controller on iOS, because Metal expected the height of the render pass
to be equal to (int)height * scaleFactor. So looks like we were relying
on the truncated rather than rounded value of the height for this.

To fix, cast the layer width/height to int before multiplying with the
scale factor, to be consistent.

Change-Id: I02f4f48db3dcc3802dd56aa816988847fc5d4603
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit f0e98e35a1a0eb842548d008c1524a1e436bc934)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 13:08:01 +00:00
Marc Mutz
db51321ce6 QString: use new QUtf8StringView overloads
... to prepend/append/insert QByteArray and const char*, instead of
the old inline QString::fromUtf8(), which litters the call sites with
temporary QString objects.

Can't use qToUtf8StringViewIgnoringNull() for QByteArray parameters to
avoid the extra isNull() check, because some QString tests depend on
whether we append/prepend/insert null or empty.

Fixes: QTBUG-109092
Change-Id: Ibf7b99aad844d0c2219ccc1c30f6666c5dfc7758
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 451dbca16c9ec4ef5a03a71b7b71a22291cf8a4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 13:08:01 +00:00
Tor Arne Vestbø
fe386e808b iOS a11y: Ensure parent elements are stacked below their children
The accessibility system on iOS does not support elements that are both
accessible themselves, and act as a container for other elements. You
either return YES from isAccessibilityElement, which allows you to
report accessible properties for the element, or NO, in which case
you can implement the informal UIAccessibilityContainer protocol
to report child elements. This was confirmed in Apple Q&A session
on accessibility December 14.

As Qt's accessibility system allow elements that are both containers
and have properties of their own, we can't build a hierarchy of elements
and containers, with only the leaf elements being accessible. Instead,
we let each UIView act as a UIAccessibilityContainer, and report the
entire child hierarchy as a single level of sibling accessible elements.

In doing so, we include elements such as the Window or Dialog that
root all the accessible elements. And apparently the order that we
report these elements back to iOS determine the z-order of the
elements, so we need to ensure "container" elements are behind
their children. Otherwise assistive technologies such as Voice Control,
or the Accessibility Inspector, will not be able to target the child
elements.

Fixes: QTBUG-108848
Change-Id: I5234bab2f14d5f368ae8c2672b051efcb80aa77d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 095604c9af90989957c974549bafdb0518c2ed3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 13:08:00 +00:00
Assam Boudjelthia
38c3bbeec9 Return the QFileInfo::baseName/QDir::dirName() from fileEngine impl
Get those values from the file engine instead, this is relevant
especially on Android for content uris.

Task-number: QTBUG-98974
Change-Id: I65fe4c59e5f1feed0dcf14cc8988b4a40d9d979e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f77668ffec48d8aaad7c74069c6f3e770a305ae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 08:34:44 +00:00
Ville Voutilainen
5bed8322eb Autoclose a FILE* if we open it
Task-number: QTBUG-105736
Change-Id: I2bc10b54b77436cad914ec21fd85678c54de4305
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f7559904d0e8f7966e726fd04801cb58a1bd4a2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 07:51:23 +00:00
Ville Voutilainen
1ae9caec79 Skip tst_qconcurrentrun completely if running under an emulator
Task-number: QTBUG-106906
Change-Id: I1836f5be42528c71470c2cd6509f7125feb47691
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 413798cc01a3a2499c1f7683acdb68fd3466aae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 07:51:05 +00:00
Kai Köhne
29e6bca233 CMake: Fix AUTOMOC warning in QtGui
Fixes warning
  AutoMoc: C:/dev/qt/dev/src/qtbase/src/gui/kernel/qplatformwindow_p.h(0:1): note: No relevant classes found. No output generated.
on Windows

Change-Id: Ib3ebec15dca419386f75a91c576930a65bc30d80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2acd0078598ed87a76b5ea66b042e8b096ac222f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 14:25:24 +00:00
Marc Mutz
59e03152a9 QXmlStreamWriter: fix a thinko in doWriteToDevice(QSV)
Check for state.remainingChars to signal an encoding error only after
the last chunk has been processed. Splitting surrogates at chunk
boundaries is normal operation, not an error. Only if this happens at
the end of the whole input should we raise an error.

Amends fa2153bd10057d7adbc5f5ededa1fd97c4a68161.

Change-Id: Id92e37becaed25bbc11e0c22dedc4d41fb23f92a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4ccb10dc918c3d4d01afa1ad718a24eb5fa49a3c)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-19 15:25:24 +01:00
Marc Mutz
af15f9d8de Extend tst_qxmlstream::readBack() to all Unicode characters
... not just those in the BMP.

The use of char32_t makes the isValid helper function easier to
read. Its passing to write() is enabled by the recent port to
QAnyStringView, which has a char32_t ctor.

Split into per-plane executions of the test function to avoid
running into timeouts on asan builds down the road.

As a drive-by, replace use of QPair with a proper struct, and
make the intervals symmetrically inclusive the bounds.

Change-Id: I2c6858d7e6a88f448eac1b1e124d7d7b82828d4c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6b5419f43505867949016685fe40d17d81ff2646)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-19 15:25:24 +01:00
Marc Mutz
90384f4d86 QTest::WatchDog: fix missing timeout resets on test function change
Since e0cad1aab53119a0e47467f2236f019ce8d6da2a, the code suffered
from an ABA problem where the TestFunctionStart expectation is set
in testFinished(), but by the time WatchDog::run() gets around to
examining the state when returning from condition_variable::wait()
in waitFor(), the next beginTest() has already set the expectation
back to TestFunctionEnd.

There are several known solutions for ABA problems. Embedding a
generation count into the expectation state seemed to be the most
straight-forward fix, and can be done without DWCAS support, because
the state is just 2 bits, leaving the other 30 or 62 bits for the
generation counter, so do that.

[ChangeLog][QTestLib] Fixed a bug which caused
QTEST_FUNCTION_TIMEOUT to be applied to the whole test execution,
as opposed to each test function.

Fixes: QTBUG-109466
Change-Id: If71ade932330407b85d204d45c74350c651325fe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 26c190f57ea336106aeceffe1191a0314bb4443c)
2022-12-19 15:25:24 +01:00
Mårten Nordheim
f4f2a99e06 Bootstrap: Fix compilation of decl/def with different conditionals
By making their conditionals the same

Change-Id: I2f1663480103fdfb0c156fc3da2da8d69651824a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 24e4fb34cdabf1d1d1d25b79edac03740b274549)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-19 14:25:23 +00:00
Leena Miettinen
78adb1eded Doc: Add link to Tools Examples from the Qt Widgets module front page
The example docs were difficult to find.

Change-Id: Id7003b140275e722dad2c41767eabc24fef728e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d77b5fbcf1225381c78cadf3c1d925f98ca93937)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 14:25:23 +00:00
Piotr Mikolajczyk
9167e86270 Add handling of screen hotplug
When a display is connected to an Android device
a notification is sent to the platform layer of the
application. The QAndroidPlatformIntegration will create
a platform screen and add it to QWindowSystem.

Task-number: QAA-1257
Change-Id: Id2cf6b47363630c3b5c93c0bc778e2058d8372b3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9ce8d4890fdeaa02cc8a7687158d7453bbc7fd49)
2022-12-19 10:52:34 +00:00
Marc Mutz
9c63b9fda6 QtMiscUtils: add missing toAsciiUpper(), use it in moc
... to make moc code locale-independent.

The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper('i') is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

Both results are wrong for the present use-case.

Fix by adding QtMiscTools::toAsciiUpper(), complementing existing
toAsciiLower(), and using that. It's private API, but moc.h, despite
the name, is not a public header.

Task-number: QTBUG-109235
Change-Id: Iaf071ba2113b672aa0aed3da6a4e1d47fb659365
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b8c2a0c18a0676595946b5543ff88492a5fc7876)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 10:52:34 +00:00
Thomas Senyk
27747feb59 Remove QEglFSCursor's inheritance of QOpenGLFunctions
As QOpenGLContext can be destroyed
it's a bad idea to store QOpenGLFunctions
(which are QOpenGLContext bound)

This change remove the inheritance and replaces it with
querying the functions per call.

Change-Id: I2f3104b62f395f3e65337a15d0a0835383b66e16
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 6160635c9d0616882ae826c6166d1d583d66827b)
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-12-19 11:52:34 +01:00
Eskil Abrahamsen Blomfeldt
124a8b6cdb windows: Fix vertical metrics with GDI engine
In Qt 6 we consolidated vertical font metrics across all
platforms (see f761ad3cd9ad1252f24b76ae413298dc7bed8af3
and follow-ups). However, a couple mistakes were made.

First of all, when we use the winAscent/winDescent values
from the OS/2 table, we would also set the leading to the
line gap value from the HHEA table. However, the line gap
is actually built into the winAscent/winDescent, so we
ended up adding this twice to the line spacing, increasing
it with some older fonts. When using the Windows legacy
metrics, we now set the line gap to 0 instead to reflect
that this is baked into the height.

In addition, since we now calculate the values ourselves,
we would not round them to nearest integer like the GDI
engine does. We now round these values to make it clear that
the GDI engine does not support any fractional metrics.

[ChangeLog][Windows][Text] Fixed an issue where the line
gap of some fonts would be included twice in the font's
leading.

Fixes: QTBUG-109400
Change-Id: I02ab7447b5e82d9f4474f9bca581f82acee85ff3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 8892819d0c89d0434c94f0c0951458719cba5c2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 10:52:34 +00:00
Juha Vuolle
7520feb8f1 Fix minor permission doc typo
Change-Id: I4af4f2859940bd121cdd0a42eab52f94f3cbc673
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 67d7d8746c97e0230728495b9cf615ef84c154bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 10:52:33 +00:00
Axel Spoerl
fe4955c2f9 Fix QWidget::restoreGeometry when restored geometry is off screen
If a widget's geometry is restored to a screen, which is smaller than
the one it was saved from,
- the widget could appear (partly) off screen
- the widget's title bar and resize handles could be inaccessible

This patch refactors and documents checkRestoredGeometry.
In a first step, the restored geometry's size is checked against
a given screen size. It is corrected if necessary.
In a second step, the restored geometry is moved inside the screen,
if necessary.
It makes the function a static member of QWidgetPrivate in order to
expose it for auto testing and adds a respective test function to
tst_QWidget.

Fixes: QTBUG-77385
Fixes: QTBUG-4397
Task-number: QTBUG-69104
Change-Id: I7172e27bfef86d82cd51de70b40de42e8895bae6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5edb71c6d4cb0051d27d023ddcd180c5f59f2725)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 05:30:02 +00:00
Alexandru Croitor
69c75ebbd8 qmake: Document that QMAKE_PRE_LINK does not work with Xcode
When generating an Xcode project using qmake that's targeting the new
Xcode build system, QMAKE_PRE_LINK does not work properly.
It generates rules that conflict with the default linker rules.
This is a limitation of the new Xcode build system which does not have
any known workaround.

Document the limitation.

Fixes: QTBUG-99601
Change-Id: Ie4e6bcb0603ced85f786e9f7f407172e84a00d83
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5fe52a0420a50e0d0e78bb7ff5d7625443a43673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-18 21:46:27 +00:00
Alexandru Croitor
61a3a8ea19 CMake: Deprecate some android public APIs
Deprecate usage of:
 - qt_android_add_apk_target
 - qt_android_apply_arch_suffix
 - qt_android_generate_deployment_settings

when used by user projects directly. Instead, projects should use
qt_add_executable / qt_add_library.

Show a deprecation warning when the commands are used directly.
The deprecation warnings can be silenced using cmake's
-Wno-deprecated command line option.

To detect non-direct usage from inside our own function
implementations, we set some target properties which are then read to
decide whether to show the message.

Fixes: QTBUG-108508
Change-Id: Ib039cc5f3a01c2276173abb1e43f4eed216d0170
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b43a39977b9eeea344eea5ee4e71a6586d512fb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-18 21:46:25 +00:00
Alexandru Croitor
24a88bddcd CMake: Remove direct qt_android_generate_deployment_settings call
in our tests.

They are not needed anymore since
d20f4ae706559fb7de8db9dd4845f7ce3936061a got merged and the
QT_ANDROID_PACKAGE_SOURCE_DIR property is read at generation time
rather than configure time.
This means the
qt_internal_add_test ->
qt_internal_add_executable ->
_qt_internal_android_executable_finalizer ->
qt_android_generate_deployment_settings
calls take care of generation the right value for the property even
with CMake 3.16.

Remove the direct qt_android_generate_deployment_settings calls,
in preparation for their deprecation in public api.

Task-number: QTBUG-88506
Task-number: QTBUG-88840
Task-number: QTBUG-108508
Change-Id: Ief1d0f9f620bd37beeedde26dedb66f728fa4a6f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5e00c0c5e55c5a87b19655947d97ca6192e02e1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-18 21:46:22 +00:00
Christian Ehrlicher
4b2f5a9abc Widgets: Deactivate effect on destruction
If a QGraphicsEffect is active during destruction, the corresponding
widget does not inform it's parent about this change which leads to
artefacts of the old effect. Therefore trigger an update through
effectBoundingRectChanged() if the graphics effect source changes.

Fixes: QTBUG-109165
Change-Id: Ib3fd9bec2134ed61f098c4ce6629ebcc5df90787
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2946447f50bc03ae5c9b5b9668d43ca7223a53c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-18 12:02:04 +00:00
Jan Grulich
1a4eca9e88 Add QCryptographicHash::supportsAlgorithm() to check supported algorithm
Adds QCH::supportsAlgorithm() method which returns whether the selected
algorithm is supported and we guarantee to get a result when generating
hashes. OpenSSL will be responsible for providing us this information.
Returns TRUE if OpenSSL is not used as a provider.

[ChangeLog][QtCore][QCryptographicHash] Add supportsAlgorithm() method
that can be used to query OpenSSL and check whether the selected
algorithm is supported.

Change-Id: I0d94e02b8c70beb79520150fab6c32bdd1da3fca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0657b0734ef78cbaeb5f9d800df79647790d3163)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 18:57:07 +00:00
Marc Mutz
844f338a11 tst_qmlstream: re-use QBuffer instance in readBack()
This improves the runtime of this particular test function by
almost 17% on my machine.

Change-Id: Icd77cdda92374b92121988c99e56787d405fa2d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7fa6670fa4ff5a916477f14d5754f9337ec9f1a8)
2022-12-17 14:49:24 +00:00
Marc Mutz
567765ff52 QLatin1/String/View: don't decay the arg() arguments
This turns const char[] arrays into const char* pointers and
therefore prevents the implicit conversion of string literals
to QString in QT_RESTRICTED_CAST_FROM_ASCII.

Fix by avoiding the decay.

Also simplify the template magic.

Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba52b29d336cc32a462306d9011b75e9948c7040)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 14:03:38 +00:00
Yuhang Zhao
9fdb2b48e1 GTK3 theme: simplify code
There's no need to first convert to QString and then convert back to
QByteArray.

Change-Id: Idedcf3143f44c640a9259f16e364dfe76ecf4c0d
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit e86a5f5f8b184562b5cde0da8882a2d8ebce84d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 11:25:53 +00:00
Marc Mutz
cf573f97fc QTest::WatchDog: Extract Method setExpectation()
Keeps the code DRY and enables a follow-up commit to fix QTBUG-109466.

Task-number: QTBUG-109466
Change-Id: I2b904ea7b38286b07049524ba63c2c5028e680bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 17a7e5cfddcbf33ef0fd1c2b7acc65b85159194e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 11:25:53 +00:00
Marc Mutz
c2118a461a tst_qxmlstream: swap WHEN and THEN in readBack()
WHEN writing an invalid character, THEN we expect the writer to report
an error.

The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.

The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.

Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 7d0f08094a2318b753ea7d69b71c0abe0a46b3d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 07:21:25 +00:00
Marc Mutz
10b3dddcf5 QBuffer: test and document open() behavior
QBuffer::open() was only documented as \reimp, so its behavior
regarding WriteOnly was never actually described.

Add a test and document the outcome.

Change-Id: I75c49cd3f6a1961bcaece4a92a4e479bb3300d36
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c262a1805a062fd99abc890f58ea951da80ff0af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 07:21:19 +00:00
Marc Mutz
7a850fc00c QT_INLINE_SINCE: never inline for static Qt builds
Static Qt builds are not covered by BC guarantees, but since all
'libraries' are linked into a single executable, we face in all users
of the library the same ODR violation that we faced within the
implementation DLL: we can't define the same symbol as inline in some
TUs and out-of-line in others.

In the past, we decided to always inline in static builds, but that
breaks users which, by Hyrum's Law, have come to depend on the
non-existent BC guarantees for static Qt builds.

By switching to never inline¹ in static builds, we restore BC for such
users. The performance issues should be minimal, since LTO will anyway
inline whatever it wants, independent on how it was declared.

¹ except when the deprecation point has passed over the Qt version the
  API was inlined (-disable-deprecated-up-to configure switch).

[ChangeLog][QtCore] Restored binary compatibility for static Qt
builds broken by the QT_INLINE_SINCE mechanism. Qt still does not
guarantee BC for static build configurations otherwise.

Fixes: QTBUG-109449
Change-Id: Ie3fa62621b74dc5e9dac301b9882c0e3c3999eaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8602a224b6ade5680329270d8d573b786a7a81a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 07:21:13 +00:00
Shawn Rutledge
806acc65b8 Add eglfs touch logging in qt.qpa.input.events
We have this logging category on xcb and ios already.

Task-number: QTBUG-103620
Change-Id: I70153c4ea9d62316d0e05550559010d85e2f9d85
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit b3750e815f3b8b4dd68b4425014b7b8dfa9b985f)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-16 20:06:38 +00:00
Mikolaj Boc
6415730b98 Fix event dispatching on WASM
1) Check only for the events that the dispatcher is able to process,
otherwise it enters an endless loop
2) Take care to run the correct wake up callback with
Asyncify.handleSleep

Fixes: QTBUG-109066
Change-Id: I10d29d18962c3e438e56712e1f43ecadedb6205c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 8f04c50cffe5d6b3963a29715b2dd2d37269d5de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 19:51:21 +00:00
Andy Shaw
7f6e5d4748 SQLite: Update SQLite to v3.40.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.40.0

Change-Id: I7beb0bc9c1256f273d6011567c5ef3975ada5060
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit eac9f395175d7a80603ccf7ca9b431f1a4c7932f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 18:29:25 +00:00
Tor Arne Vestbø
11ed1f643f iOS: Don't assume screens will not be connected before QIOSIntegration
When an external screen is connected to an iPad, and the application is
starting up on that screen, we will get a connection notification about
that screen as part of the initial bootstrap of UIApplicationMain,
before we call the user's main().

Since we initialize and add all available screen on QIOSIntegration
creation, we can just ignore the early connection notification.

This avoids a crash, but the window will not show anything on the
external screen, which is a separate issue.

Fixes: QTBUG-106701
Change-Id: I9e0a9736bf602277316bd004e0d01c640feaf319
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dd49793bc3b4dd3808f0f24b717c442a5095db14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 18:29:21 +00:00
Mårten Nordheim
0ef6a30790 Schannel: Don't emit error when peer performs graceful disconnection
Change-Id: Ie19a31fc61223d954badc704324adf4f5f7d361e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3ff8629a0fbdf432086a47a1047d03ad457118c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 14:10:01 +00:00
Doris Verria
9d4bd2c6d0 iOS File Dialog: Support setting name filters
Fixes: QTBUG-93624
Change-Id: I2e1b522d572fd36f58a3de90f0a685f5d22dfeeb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ce20b81070c8283a7895e46dd79d560fb0b81462)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 14:09:32 +00:00
Kai Köhne
6eea834f71 Doc: Ensure qt_policy has a title
Change-Id: Ia8319627943294b163b10c52e76fedeb3ce3e3b0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 054ea5dfd57617e5faa5940b9aadd25cdc247b49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 07:57:45 +00:00
Volker Hilsheimer
2c45fba697 QJniObject: fix binary compatibility breakage
Amends 601dbd64993fcbbb2ce6aaa95ef153ffd4f852b9, which changed the
signature of the private callVoidMethodV function. However, that
function got called in a public template member function, so callsites
depended on the private function to be present. By changing the function
signature, we broke binary compatibility.

Bring the original function back and implement the variadic overload
through it.

Fixes: QTBUG-109428
Change-Id: Ie2297e120fbeb146089c0fbe8f91f8b8d3c79713
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f2b49789b2f9f9145d318a00868d2f054052aee4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 07:31:33 +00:00
Jan Grulich
d124386e2a QCryptographicHash: clear the result in QCH::reset() when using OpenSSL
OpenSSL implementation did not clear the previous result when
calling QCH::reset(). This could lead to not generating new hashes.

Change-Id: Ic83e6382038a2f8808af950b88e57316b90ef2bc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1fe74c3bd3f727551b8168ee9f3e642d42233d55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 07:23:02 +00:00
Eskil Abrahamsen Blomfeldt
d37ef31674 Don't hide object replacement char except in rich text
The object replacement character (U+FFFC) is used to represent
inline objects such as images in rich-text. To enable this,
we have special handling of it in QTextEngine. For classes
where inline images are not supported, it will just be hidden
from the visual text, which is unexpected.

Instead of always special-casing it, we make this dependent
on whether the document layout has registered any object handlers.
If they have not, then there will be no visual representation of
the object, and it is better to show the glyph for it.

For anything based on QTextDocument, there will always be the
image handler, so U+FFFC will still have special handling there,
but for non-rich labels and plain text editors the glyph will
be shown instead.

Note that there was also a bug in QLineEdit, where the object
replacement character was always replaced by a space. This was
introduced in 2007, in a patch which replaced a !ch.isPrint()
with a check for "the most obvious non-printable characters"
to reduce the number of characters that were not shown. However,
U+FFFC is a printable character and would thus not have been
filtered by the !isPrint() condition, so I think this was a
mistake at the time. However, due to the special-casing of
the character in Qt, it would not have had any effect until
now.

This also changes the QTextLayout::cursorToXForInlineObject()
test to actually test proper inline objects, as this was
previously using a hack which depended on the inline object
code to be used even for plain QTextLayouts with no handlers
for these.

[ChangeLog][Text] The object replacement character (U+FFFC)
is now only filtered out in rich text controls, where they
represent inline objects. In other controls, its glyphs will
be shown as with other text.

Fixes: QTBUG-101526
Change-Id: I7fcaf2b10918feb41589e1098016efbf79a0e62d
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ca64365e3a7245f6ef0f8f6962db3c1b85421cef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-15 13:44:04 +00:00
Mårten Nordheim
70b6896a82 QDom: Don't reuse a moved-from object
Code checker doesn't like that we simply assign to the moved-from
object's member, so create a separate object to be nice.

Change-Id: I07c83cb051d87b33cc2d4f34078c50805c312ea6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit b949f65f60829e98d2c413080daa0e485936665c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 11:41:53 +00:00
Yuhang Zhao
39a47329a4 HiDPI: fix wrong window size after DPI change
Current code doesn't take the custom margins into account,
it will cause windows with custom margins have wrong size
after DPI change.

Amends commit 2cfca7fd1911cc82a22763152c04c65bc05bc19a

Change-Id: I80b01c030a63d02cf66f105785df7c3f590481b5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 67284763e7ce0d12650b652e92dfd022a8affb1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 02:08:54 +00:00
Amir Masoud Abdol
d14be072cb Remove the incorrectly added extra .bat
The .bat extension was already handled for, __qt_cmake_private_path,
and adding the extra one was causing an issue where
qt-cmake-standalone-test was calling qt-cmake-private.bat.bat!

Amends 8aae821b5aa2bd0ac919683dcb3cb62913ca9063

Change-Id: I9c374440c89c617e31f369fde8f041e5c1d17a03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5d4768000377d6f4240198a2dc1cd00d7ef89de2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-13 20:26:23 +00:00
Thomas Senyk
7732e042f3 eglfs-kms/gbm: fix segfault and add qScopeGuard
As framebufferForBufferObject has a code-path which returns a nullptr,
it's vital to check on that and return early in that case.

As this is the third segment in this function that does gbm_surface_release_buffer,
a qScopeGuard was introduced to reduce code duplication.
This also makes this function saver/easier to maintain long term.

The platform on which this segfault was reported is QEMU

Change-Id: I5ee1ad4073712349b7475bce3a7978961fea2344
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ad2aca113daccb4d0e9299b7c37d61f2d9b1f930)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-13 20:08:00 +00:00
Amir Masoud Abdol
c3688e23a0 Return qt-configure-module to bin/
We agreed that qt-configure-module needs to come back to bin/ as it's
user-facing.

Amends d77ce33082516234fd7bbb5335401a1f3af8ca27

[ChangeLog][CMake] Upon further consideration, qt-configure-module
was deemed user-facing, and was thus moved back to ./bin on
all platforms.

Task-number: QTBUG-107621
Change-Id: I1f7874436e5b3988242091fc0303ea828f29d5c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9773f0175cfe87b0c90db044ae20ddee3aae9ada)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-13 10:25:05 +00:00
Volker Hilsheimer
4b818747fc Silence compiler warnings about unused variables
Change-Id: I02e51868f762292b0a6b57d38a5bd25335b19621
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 70b3df00f946f1ad278aa6c51eaba170eb9fd271)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-13 07:22:16 +00:00
Lu YaNing
c0f756da3f Add static_cast for QKeyEvent
Use static_cast to convert a QEvent to a QKeyEvent,
replacing (QKeyEvent*)e

Change-Id: I52ac3f46aec42600251cf737db2e71c04f2b45c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 223cf01cc6700c08c1a0e44a1aaa82f04b1f615b)
2022-12-13 07:22:13 +00:00
3195 changed files with 127545 additions and 81703 deletions

View File

@ -32,6 +32,3 @@ set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC "3.21")
# in sync.
set(QT_MIN_NEW_POLICY_CMAKE_VERSION "3.16")
set(QT_MAX_NEW_POLICY_CMAKE_VERSION "3.21")
# Use cpp-based syncqt
set(QT_USE_SYNCQT_CPP TRUE)

View File

@ -6,5 +6,5 @@ set script_dir_path=%~dp0
set cmake_path=@CMAKE_COMMAND@
if not exist "%cmake_path%" set cmake_path=cmake
set toolchain_path=%script_dir_path%/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake
set toolchain_path=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
"%cmake_path%" -DCMAKE_TOOLCHAIN_FILE="%toolchain_path%" @__qt_cmake_extra@ %*

View File

@ -34,4 +34,5 @@ echo "$arg" >> "$optfile"
done
cmake_script_path="$script_dir_path/@__relative_path_to_cmake_scripts_dir@/QtProcessConfigureArgs.cmake"
"$script_dir_path/qt-cmake-private" -DOPTFILE=$optfile -DMODULE_ROOT="$module_root" -DCMAKE_COMMAND="$script_dir_path/qt-cmake-private" -P "$cmake_script_path"
qt_cmake_private_path="$script_dir_path/../libexec"
"$qt_cmake_private_path/qt-cmake-private" -DOPTFILE=$optfile -DMODULE_ROOT="$module_root" -DCMAKE_COMMAND="$qt_cmake_private_path/qt-cmake-private" -P "$cmake_script_path"

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(ATSPI2 atspi-2 IMPORTED_TARGET)
pkg_check_modules(ATSPI2 IMPORTED_TARGET "atspi-2")
if (NOT TARGET PkgConfig::ATSPI2)
set(ATSPI2_FOUND 0)

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(DirectFB directfb IMPORTED_TARGET)
pkg_check_modules(DirectFB IMPORTED_TARGET "directfb")
if (NOT TARGET PkgConfig::DirectFB)
set(DirectFB_FOUND 0)

View File

@ -2,9 +2,9 @@
# SPDX-License-Identifier: BSD-3-Clause
find_package(PkgConfig QUIET)
pkg_check_modules(PC_GSSAPI QUIET krb5-gssapi)
pkg_check_modules(PC_GSSAPI QUIET "krb5-gssapi")
if (NOT PC_GSSAPI_FOUND)
pkg_check_modules(PC_GSSAPI QUIET mit-krb5-gssapi)
pkg_check_modules(PC_GSSAPI QUIET "mit-krb5-gssapi")
endif()
find_path(GSSAPI_INCLUDE_DIRS

View File

@ -7,7 +7,7 @@ set(__gtk3_required_version "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}")
if(__gtk3_required_version)
set(__gtk3_required_version " >= ${__gtk3_required_version}")
endif()
pkg_check_modules(GTK3 "gtk+-3.0${__gtk3_required_version}" IMPORTED_TARGET)
pkg_check_modules(GTK3 IMPORTED_TARGET "gtk+-3.0${__gtk3_required_version}")
if (NOT TARGET PkgConfig::GTK3)
set(GTK3_FOUND 0)

View File

@ -13,7 +13,7 @@ endif()
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(Libb2 libb2 IMPORTED_TARGET)
pkg_check_modules(Libb2 IMPORTED_TARGET "libb2")
if (TARGET PkgConfig::Libb2)
add_library(Libb2::Libb2 INTERFACE IMPORTED)

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(Libproxy libproxy-1.0 IMPORTED_TARGET)
pkg_check_modules(Libproxy IMPORTED_TARGET "libproxy-1.0")
if (NOT TARGET PkgConfig::Libproxy)
set(Libproxy_FOUND 0)

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(Libsystemd libsystemd IMPORTED_TARGET)
pkg_check_modules(Libsystemd IMPORTED_TARGET "libsystemd")
if (NOT TARGET PkgConfig::Libsystemd)
set(Libsystemd_FOUND 0)

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(Libudev libudev IMPORTED_TARGET)
pkg_check_modules(Libudev IMPORTED_TARGET "libudev")
if (NOT TARGET PkgConfig::Libudev)
set(Libudev_FOUND 0)

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(Mtdev mtdev IMPORTED_TARGET)
pkg_check_modules(Mtdev IMPORTED_TARGET "mtdev")
if (NOT TARGET PkgConfig::Mtdev)
set(Mtdev_FOUND 0)

View File

@ -43,7 +43,7 @@ if(NOT DEFINED MySQL_ROOT)
find_package(PkgConfig QUIET)
endif()
if(PkgConfig_FOUND AND NOT DEFINED MySQL_ROOT)
pkg_check_modules(PC_MySQL QUIET mysqlclient)
pkg_check_modules(PC_MySQL QUIET "mysqlclient")
set(MySQL_include_dir_hints ${PC_MySQL_INCLUDEDIR})
set(MySQL_library_hints ${PC_MySQL_LIBDIR})
set(MySQL_library_hints_debug "")

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(Tslib tslib IMPORTED_TARGET)
pkg_check_modules(Tslib IMPORTED_TARGET "tslib")
if (NOT TARGET PkgConfig::Tslib)
set(Tslib_FOUND 0)

View File

@ -22,21 +22,21 @@ if (unofficial-brotli_FOUND)
else()
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(libbrotlidec QUIET libbrotlidec IMPORTED_TARGET)
pkg_check_modules(libbrotlidec QUIET IMPORTED_TARGET "libbrotlidec")
if (libbrotlidec_FOUND)
add_library(WrapBrotli::WrapBrotliDec INTERFACE IMPORTED)
target_link_libraries(WrapBrotli::WrapBrotliDec INTERFACE PkgConfig::libbrotlidec)
set(WrapBrotli_FOUND ON)
endif()
pkg_check_modules(libbrotlienc QUIET libbrotlienc IMPORTED_TARGET)
pkg_check_modules(libbrotlienc QUIET IMPORTED_TARGET "libbrotlienc")
if (libbrotlienc_FOUND)
add_library(WrapBrotli::WrapBrotliEnc INTERFACE IMPORTED)
target_link_libraries(WrapBrotli::WrapBrotliEnc INTERFACE PkgConfig::libbrotlienc)
set(WrapBrotli_FOUND ON)
endif()
pkg_check_modules(libbrotlicommon QUIET libbrotlicommon IMPORTED_TARGET)
pkg_check_modules(libbrotlicommon QUIET IMPORTED_TARGET "libbrotlicommon")
if (libbrotlicommon_FOUND)
add_library(WrapBrotli::WrapBrotliCommon INTERFACE IMPORTED)
target_link_libraries(WrapBrotli::WrapBrotliCommon INTERFACE PkgConfig::libbrotlicommon)

View File

@ -32,7 +32,7 @@ endif()
if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_HARFBUZZ harfbuzz IMPORTED_TARGET)
pkg_check_modules(PC_HARFBUZZ IMPORTED_TARGET "harfbuzz")
if(PC_HARFBUZZ_FOUND)
set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ")
set(__harfbuzz_find_include_dirs_hints

View File

@ -22,7 +22,7 @@ if(NOT __pcre2_found)
list(PREPEND WrapSystemPCRE2_REQUIRED_VARS PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_PCRE2 QUIET libpcre2-16)
pkg_check_modules(PC_PCRE2 QUIET "libpcre2-16")
find_path(PCRE2_INCLUDE_DIRS
NAMES pcre2.h

View File

@ -40,7 +40,7 @@ if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared)
endif()
else()
find_package(PkgConfig QUIET)
pkg_check_modules(PC_ZSTD QUIET libzstd)
pkg_check_modules(PC_ZSTD QUIET "libzstd")
find_path(ZSTD_INCLUDE_DIRS
NAMES zstd.h

View File

@ -3,7 +3,7 @@
find_package(PkgConfig QUIET)
pkg_check_modules(XKB_COMMON_X11 "xkbcommon-x11>=0.4.1" IMPORTED_TARGET)
pkg_check_modules(XKB_COMMON_X11 IMPORTED_TARGET "xkbcommon-x11>=0.4.1")
if (NOT TARGET PkgConfig::XKB_COMMON_X11)
set(XKB_COMMON_X11_FOUND 0)

View File

@ -4,7 +4,7 @@
find_package(PkgConfig QUIET)
if(NOT TARGET PkgConfig::XRender)
pkg_check_modules(XRender xrender IMPORTED_TARGET)
pkg_check_modules(XRender IMPORTED_TARGET "xrender")
if (NOT TARGET PkgConfig::XRender)
set(XRender_FOUND 0)

View File

@ -1,6 +1,7 @@
{
"module_name": "${target}",
"version": "${PROJECT_VERSION}",
"name": "${target}",
"repository": "${lower_case_project_name}",
"version": "${PROJECT_VERSION}",${extra_module_information}
"built_with": {${extra_build_information}
"compiler_id": "${CMAKE_CXX_COMPILER_ID}",
"compiler_target": "${CMAKE_CXX_COMPILER_TARGET}",

View File

@ -4,6 +4,7 @@ macro(qt_internal_get_add_library_option_args option_args)
STATIC
MODULE
INTERFACE
NO_UNITY_BUILD
)
endmacro()
@ -14,12 +15,12 @@ endmacro()
# Everything else is just prepation for option validating.
function(qt_internal_add_common_qt_library_helper target)
qt_internal_get_add_library_option_args(option_args)
qt_parse_all_arguments(arg "qt_internal_add_common_qt_library_helper"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_args}"
""
""
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_SHARED)
set(arg_SHARED SHARED)
@ -49,7 +50,18 @@ function(qt_internal_add_common_qt_library_helper target)
set(arg_MODULE STATIC)
endif()
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
_qt_internal_add_library(${target} ${arg_STATIC} ${arg_SHARED} ${arg_MODULE} ${arg_INTERFACE})
if(arg_NO_UNITY_BUILD)
set_property(TARGET "${target}" PROPERTY UNITY_BUILD OFF)
endif()
qt_internal_mark_as_internal_library(${target})
endfunction()
@ -67,12 +79,12 @@ function(qt_internal_add_cmake_library target)
${__default_public_args}
)
qt_parse_all_arguments(arg "qt_add_cmake_library"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_args}"
"${single_args}"
"${multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
qt_remove_args(library_helper_args
ARGS_TO_REMOVE
@ -98,6 +110,12 @@ function(qt_internal_add_cmake_library target)
)
endif()
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
qt_internal_extend_target("${target}"
SOURCES ${arg_SOURCES}
INCLUDE_DIRECTORIES
@ -119,6 +137,8 @@ function(qt_internal_add_cmake_library target)
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
${arg_NO_UNITY_BUILD}
)
endfunction()
@ -141,12 +161,12 @@ function(qt_internal_add_3rdparty_library target)
${__default_public_args}
)
qt_parse_all_arguments(arg "qt_internal_add_3rdparty_library"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${library_option_args};${option_args}"
"${single_args}"
"${multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
qt_remove_args(library_helper_args
ARGS_TO_REMOVE
@ -240,6 +260,7 @@ function(qt_internal_add_3rdparty_library target)
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD
)
if(NOT BUILD_SHARED_LIBS OR arg_INSTALL)
@ -349,12 +370,13 @@ function(qt_internal_add_3rdparty_header_module target)
set(multi_args
EXTERNAL_HEADERS
)
qt_parse_all_arguments(arg "qt_internal_add_header_module"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_args}"
"${single_args}"
"${multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
qt_internal_add_module(${target}
INTERNAL_MODULE
HEADER_MODULE

View File

@ -4,12 +4,12 @@
# This function creates a CMake target for a Qt internal app.
# Such projects had a load(qt_app) command.
function(qt_internal_add_app target)
qt_parse_all_arguments(arg
"qt_internal_add_app"
cmake_parse_arguments(PARSE_ARGV 1 arg
"NO_INSTALL;INSTALL_VERSIONED_LINK;EXCEPTIONS"
"${__default_target_info_args};INSTALL_DIR"
"${__default_private_args};PUBLIC_LIBRARIES"
${ARGN})
)
_qt_internal_validate_all_args_are_parsed(arg)
set(exceptions "")
if(arg_EXCEPTIONS)

View File

@ -61,7 +61,8 @@ endfunction()
# This function adds or removes additional AUTOGEN tools to a target: AUTOMOC/UIC/RCC
function(qt_autogen_tools target)
qt_parse_all_arguments(arg "qt_autogen_tools" "" "" "${__default_private_args}" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "${__default_private_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_ENABLE_AUTOGEN_TOOLS)
foreach(tool ${arg_ENABLE_AUTOGEN_TOOLS})
@ -94,7 +95,7 @@ function(qt_manual_moc result)
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" outfile)
list(APPEND moc_files "${outfile}")
set(moc_parameters_file "${outfile}_parameters$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>")
set(moc_parameters_file "${outfile}_parameters$<$<BOOL:$<CONFIG>>:_$<CONFIG>>")
set(moc_parameters ${arg_FLAGS} -o "${outfile}" "${infile}")
foreach(dir IN ITEMS ${arg_INCLUDE_DIRECTORIES})

View File

@ -263,6 +263,7 @@ qt_copy_or_install(FILES
cmake/QtPostProcess.cmake
cmake/QtPostProcessHelpers.cmake
cmake/QtPrecompiledHeadersHelpers.cmake
cmake/QtUnityBuildHelpers.cmake
cmake/QtPriHelpers.cmake
cmake/QtPrlHelpers.cmake
cmake/QtPlatformTargetHelpers.cmake
@ -357,7 +358,6 @@ if(QT_WILL_INSTALL)
endforeach()
endif()
# TODO: Check whether this is the right place to install these
qt_copy_or_install(DIRECTORY "cmake/3rdparty" DESTINATION "${__GlobalConfig_install_dir}")
# In prefix builds we also need to copy the files into the build config directory, so that the

View File

@ -60,9 +60,11 @@ endif()
# to each destination, and sets the computed install target destination arguments in OUT_VAR.
# Defaults used for each of the destination types, and can be configured per destination type.
function(qt_get_install_target_default_args)
qt_parse_all_arguments(arg "qt_get_install_target_default_args"
"" "OUT_VAR;CMAKE_CONFIG;RUNTIME;LIBRARY;ARCHIVE;INCLUDES;BUNDLE"
"ALL_CMAKE_CONFIGS" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"OUT_VAR;CMAKE_CONFIG;RUNTIME;LIBRARY;ARCHIVE;INCLUDES;BUNDLE"
"ALL_CMAKE_CONFIGS")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CMAKE_CONFIG)
message(FATAL_ERROR "No value given for CMAKE_CONFIG.")
@ -457,6 +459,7 @@ set(__default_private_args
DISABLE_AUTOGEN_TOOLS
ENABLE_AUTOGEN_TOOLS
PLUGIN_TYPES
NO_UNITY_BUILD_SOURCES
)
set(__default_public_args
PUBLIC_LIBRARIES
@ -485,6 +488,7 @@ set(__qt_internal_add_executable_optional_args
DELAY_RC
DELAY_TARGET_INFO
QT_APP
NO_UNITY_BUILD
)
set(__qt_internal_add_executable_single_args
CORE_LIBRARY
@ -518,6 +522,7 @@ include(QtModuleHelpers)
include(QtNoLinkTargetHelpers)
include(QtPluginHelpers)
include(QtPrecompiledHeadersHelpers)
include(QtUnityBuildHelpers)
include(QtPkgConfigHelpers)
include(QtPriHelpers)
include(QtPrlHelpers)

View File

@ -118,8 +118,15 @@ function(qt_configure_print_summary_helper summary_reports force_show)
# current log level.
if(force_show)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
# Need 2 flushes to ensure no interleaved input is printed due to a mix of message(STATUS)
# and message(NOTICE) calls.
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
message(STATUS "Configure summary:\n${summary_reports}")
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
endif()
message(STATUS "Configure summary:\n${__qt_configure_reports}")
endfunction()
function(qt_configure_print_build_instructions_helper msg)
@ -140,39 +147,32 @@ function(qt_configure_print_summary)
# Show Qt-specific configuration summary.
if(__qt_configure_reports)
# We want to show the the summary file and log level messages only on first configuration
# or when we detect a feature change, to keep most reconfiguration output as quiet as
# possible. Currently feature change detection is not entirely reliable.
# We want to show the configuration summary file and log level message only on
# first configuration or when we detect a feature change, to keep most
# reconfiguration output as quiet as possible.
# Currently feature change detection is not entirely reliable.
if(NOT QT_INTERNAL_SUMMARY_INSTRUCTIONS_SHOWN OR features_possibly_changed)
message("")
set(force_show_summary TRUE)
message(
"\n"
"-- Configuration summary shown below. It has also been written to"
" ${CMAKE_BINARY_DIR}/config.summary")
message(
"-- Configure with --log-level=STATUS or higher to increase "
"CMake's message verbosity. "
"The log level does not persist across reconfigurations.")
endif()
# Need 2 flushes to ensure no interleaved input is printed due to a mix of message(STATUS)
# and message(NOTICE) calls.
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
# We want to show the configuration summary only on first configuration or when we detect
# a feature change, to keep most reconfiguration output as quiet as possible.
# Currently feature change detection is not entirely reliable.
if(NOT QT_INTERNAL_SUMMARY_INSTRUCTIONS_SHOWN OR features_possibly_changed)
set(force_show_summary TRUE)
else()
set(force_show_summary FALSE)
message(
"\n"
"-- Configuration summary has been written to"
" ${CMAKE_BINARY_DIR}/config.summary")
endif()
qt_configure_print_summary_helper(
"Configuration summary:\n${__qt_configure_reports}"
"${__qt_configure_reports}"
${force_show_summary})
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
file(APPEND "${summary_file}" "${__qt_configure_reports}")
endif()
@ -313,9 +313,11 @@ function(qt_configure_add_summary_entry)
endfunction()
function(qt_configure_process_add_summary_entry)
qt_parse_all_arguments(arg "qt_configure_add_summary_entry"
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"ARGS;TYPE;MESSAGE" "CONDITION" ${ARGN})
"ARGS;TYPE;MESSAGE"
"CONDITION")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_TYPE)
set(arg_TYPE "feature")
@ -472,8 +474,11 @@ function(qt_configure_add_summary_section)
endfunction()
function(qt_configure_process_add_summary_section)
qt_parse_all_arguments(arg "qt_configure_add_summary_section"
"" "NAME" "" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"NAME"
"")
_qt_internal_validate_all_args_are_parsed(arg)
qt_configure_add_report("${__qt_configure_indent}${arg_NAME}:")
if(NOT DEFINED __qt_configure_indent)
@ -505,9 +510,11 @@ function(qt_configure_add_report_error error)
endfunction()
function(qt_configure_process_add_report_entry)
qt_parse_all_arguments(arg "qt_configure_add_report_entry"
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"TYPE;MESSAGE" "CONDITION" ${ARGN})
"TYPE;MESSAGE"
"CONDITION")
_qt_internal_validate_all_args_are_parsed(arg)
set(possible_types NOTE WARNING ERROR FATAL_ERROR)
if(NOT "${arg_TYPE}" IN_LIST possible_types)

View File

@ -577,6 +577,10 @@ macro(qt_build_repo_impl_src)
add_subdirectory(src)
endif()
endif()
if(QT_FEATURE_lttng AND NOT TARGET LTTng::UST)
qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST
MODULE_NAME global QMAKE_LIB lttng-ust)
endif()
endmacro()
macro(qt_build_repo_impl_tools)
@ -600,6 +604,7 @@ macro(qt_build_repo_impl_examples)
if(QT_BUILD_EXAMPLES
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
AND NOT QT_BUILD_STANDALONE_TESTS)
message(STATUS "Configuring examples.")
add_subdirectory(examples)
endif()
endmacro()

View File

@ -18,5 +18,14 @@ else()
set(absolute_project_path "${QT_STANDALONE_TEST_PATH}")
endif()
if(NOT IS_DIRECTORY "${absolute_project_path}")
get_filename_component(filename "${absolute_project_path}" NAME)
get_filename_component(directory "${absolute_project_path}" DIRECTORY)
if(filename STREQUAL "CMakeLists.txt")
set(absolute_project_path "${directory}")
endif()
endif()
# Add the test project path as a subdirectory project.
add_subdirectory("${absolute_project_path}" "build_dir")

View File

@ -103,6 +103,10 @@ set(QT_BUILD_EXAMPLES_AS_EXTERNAL "@QT_BUILD_EXAMPLES_AS_EXTERNAL@" CACHE BOOL
# Propagate usage of ccache.
set(QT_USE_CCACHE @QT_USE_CCACHE@ CACHE BOOL "Enable the use of ccache")
# Propagate usage of unity build.
set(QT_UNITY_BUILD @QT_UNITY_BUILD@ CACHE BOOL "Enable unity (jumbo) build")
set(QT_UNITY_BUILD_BATCH_SIZE "@QT_UNITY_BUILD_BATCH_SIZE@" CACHE STRING "Unity build batch size")
# Propragate the value of WARNINGS_ARE_ERRORS.
set(WARNINGS_ARE_ERRORS "@WARNINGS_ARE_ERRORS@" CACHE BOOL "Build Qt with warnings as errors")

View File

@ -38,25 +38,22 @@ endmacro()
# output-file is relative to ${CMAKE_CURRENT_BINARY_DIR}
#
# This function is similar to file(GENERATE OUTPUT) except it writes the content
# to the file at configure time, rather than at generate time. Once CMake 3.18 is released, it can
# use file(CONFIGURE) in its implementation. Until then, it uses configure_file() with a generic
# input file as source, when used with the CONTENT signature.
# to the file at configure time, rather than at generate time.
#
# TODO: Once we require 3.18+, this can use file(CONFIGURE) in its implementation,
# or maybe its usage can be replaced by file(CONFIGURE). Until then, it uses
# configure_file() with a generic input file as source, when used with the CONTENT
# signature.
function(qt_configure_file)
qt_parse_all_arguments(arg "qt_configure_file" "" "OUTPUT;INPUT;CONTENT" "" ${ARGN})
qt_configure_file_impl()
endfunction()
# The fixed version of qt_configure_file that uses the cmake_parse_arguments variant with PARSE_ARGV
# to handle arguments with semicolons correctly.
# TODO: This implementation should replace the previous one, but first need to fix all places where
# the previous imlementation is used.
function(qt_configure_file_v2)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "OUTPUT;INPUT;CONTENT" "")
qt_configure_file_impl()
endfunction()
# A version of cmake_parse_arguments that makes sure all arguments are processed and errors out
# with a message about ${type} having received unknown arguments.
#
# TODO: Remove when all usage of qt_parse_all_arguments were replaced by
# cmake_parse_all_arguments(PARSEARGV) instances
macro(qt_parse_all_arguments result type flags options multiopts)
cmake_parse_arguments(${result} "${flags}" "${options}" "${multiopts}" ${ARGN})
if(DEFINED ${result}_UNPARSED_ARGUMENTS)
@ -64,6 +61,14 @@ macro(qt_parse_all_arguments result type flags options multiopts)
endif()
endmacro()
# Checks whether any unparsed arguments have been passed to the function at the call site.
# Use this right after `cmake_parse_arguments`.
function(_qt_internal_validate_all_args_are_parsed prefix)
if(DEFINED ${prefix}_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown arguments: (${${prefix}_UNPARSED_ARGUMENTS})")
endif()
endfunction()
# Print all variables defined in the current scope.
macro(qt_debug_print_variables)
cmake_parse_arguments(__arg "DEDUP" "" "MATCH;IGNORE" ${ARGN})
@ -120,8 +125,7 @@ endfunction()
# Parameters:
# out_var: result of remove all arguments specified by ARGS_TO_REMOVE from ALL_ARGS
# ARGS_TO_REMOVE: Arguments to remove.
# ALL_ARGS: All arguments supplied to cmake_parse_arguments or
# qt_parse_all_arguments
# ALL_ARGS: All arguments supplied to cmake_parse_arguments
# from which ARGS_TO_REMOVE should be removed from. We require all the
# arguments or we can't properly identify the range of the arguments detailed
# in ARGS_TO_REMOVE.
@ -135,7 +139,7 @@ endfunction()
# bar(target BAR.... WWW...)
#
# function(foo target)
# qt_parse_all_arguments(arg "" "" "BAR;ZZZ;WWW ${ARGV})
# cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "BAR;ZZZ;WWW")
# qt_remove_args(forward_args
# ARGS_TO_REMOVE ${target} ZZZ
# ALL_ARGS ${target} BAR ZZZ WWW

View File

@ -8,7 +8,9 @@ if(QT_NO_PACKAGE_VERSION_CHECK)
set(__qt_disable_package_version_check TRUE)
endif()
# Extra CMake code begin
@extra_code@
# Extra CMake code end
if((NOT PACKAGE_VERSION_COMPATIBLE) OR PACKAGE_VERSION_UNSUITABLE)
set(__qt_package_version_incompatible TRUE)

View File

@ -6,6 +6,7 @@ set(packages "@packages@")
set(defines @defines@)
set(compile_options @compile_options@)
set(link_options @link_options@)
set(output_directory @output_directory@)
foreach(package IN LISTS packages)
find_package(${package} REQUIRED)
@ -14,6 +15,7 @@ endforeach()
add_executable(@configure_time_target@ @win32@ @macosx_bundle@ @sources@)
set_target_properties(@configure_time_target@ PROPERTIES
INCLUDE_DIRECTORIES "@include_directories@"
RUNTIME_OUTPUT_DIRECTORY "${output_directory}"
)
target_compile_options(@configure_time_target@ PRIVATE ${compile_options})

View File

@ -3,7 +3,12 @@
# helper to set up a qdbusxml2cpp rule
function(qt_create_qdbusxml2cpp_command target infile)
qt_parse_all_arguments(arg "qt_create_qdbusxml2cpp_command" "ADAPTOR;INTERFACE" "BASENAME" "FLAGS" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 2 arg
"ADAPTOR;INTERFACE"
"BASENAME"
"FLAGS")
_qt_internal_validate_all_args_are_parsed(arg)
if((arg_ADAPTOR AND arg_INTERFACE) OR (NOT arg_ADAPTOR AND NOT arg_INTERFACE))
message(FATAL_ERROR "qt_create_dbusxml2cpp_command needs either ADAPTOR or INTERFACE.")
endif()
@ -55,6 +60,7 @@ function(qt_create_qdbusxml2cpp_command target infile)
"${header_file}:${source_file}" "${absolute_in_file_path}"
DEPENDS "${absolute_in_file_path}" ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND_EXPAND_LISTS
VERBATIM)
target_sources("${target}" PRIVATE

View File

@ -12,11 +12,11 @@
# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publicly
# linked to the executable target by default.
function(qt_internal_add_executable name)
qt_parse_all_arguments(arg "qt_internal_add_executable"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${__qt_internal_add_executable_optional_args}"
"${__qt_internal_add_executable_single_args}"
"${__qt_internal_add_executable_multi_args}"
${ARGN})
"${__qt_internal_add_executable_multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if ("x${arg_OUTPUT_DIRECTORY}" STREQUAL "x")
set(arg_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}")
@ -110,6 +110,12 @@ function(qt_internal_add_executable name)
"removed in a future Qt version. Use the LIBRARIES option instead.")
endif()
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
qt_internal_extend_target("${name}"
SOURCES ${arg_SOURCES}
INCLUDE_DIRECTORIES ${private_includes}
@ -119,15 +125,17 @@ function(qt_internal_add_executable name)
${arg_PUBLIC_LIBRARIES}
Qt::PlatformCommonInternal
${extra_libraries}
DBUS_ADAPTOR_SOURCES "${arg_DBUS_ADAPTOR_SOURCES}"
DBUS_ADAPTOR_FLAGS "${arg_DBUS_ADAPTOR_FLAGS}"
DBUS_INTERFACE_SOURCES "${arg_DBUS_INTERFACE_SOURCES}"
DBUS_INTERFACE_FLAGS "${arg_DBUS_INTERFACE_FLAGS}"
DBUS_ADAPTOR_SOURCES ${arg_DBUS_ADAPTOR_SOURCES}
DBUS_ADAPTOR_FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
DBUS_INTERFACE_SOURCES ${arg_DBUS_INTERFACE_SOURCES}
DBUS_INTERFACE_FLAGS ${arg_DBUS_INTERFACE_FLAGS}
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
LINK_OPTIONS ${arg_LINK_OPTIONS}
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
${arg_NO_UNITY_BUILD}
)
set_target_properties("${name}" PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}"
@ -374,8 +382,14 @@ function(qt_internal_add_configure_time_executable target)
set(configure_time_target "${arg_OUTPUT_NAME}")
endif()
set(target_binary "${configure_time_target}${CMAKE_EXECUTABLE_SUFFIX}")
set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIRECTORY)
set(install_dir "${arg_INSTALL_DIRECTORY}")
endif()
set(output_directory "${QT_BUILD_DIR}/${install_dir}")
set(target_binary_path
"${target_binary_dir}/${configuration_path}${target_binary}")
"${output_directory}/${configuration_path}${target_binary}")
get_filename_component(target_binary_path "${target_binary_path}" ABSOLUTE)
if(NOT DEFINED arg_SOURCES)
@ -385,7 +399,7 @@ function(qt_internal_add_configure_time_executable target)
# Timestamp file is required because CMake ignores 'add_custom_command' if we use only the
# binary file as the OUTPUT.
set(timestamp_file "${target_binary_path}_timestamp")
set(timestamp_file "${target_binary_dir}/${target_binary}_timestamp")
add_custom_command(OUTPUT "${target_binary_path}" "${timestamp_file}"
COMMAND
${CMAKE_COMMAND} --build "${target_binary_dir}" ${config_build_arg}
@ -468,15 +482,11 @@ function(qt_internal_add_configure_time_executable target)
IMPORTED_LOCATION "${target_binary_path}")
if(NOT arg_NO_INSTALL)
set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIRECTORY)
set(install_dir "${arg_INSTALL_DIRECTORY}")
endif()
set_target_properties(${target} PROPERTIES
_qt_internal_configure_time_target_install_location
"${install_dir}/${target_binary}"
)
qt_path_join(target_install_dir ${QT_INSTALL_DIR} ${install_dir})
qt_copy_or_install(PROGRAMS "${target_binary_path}" DESTINATION "${target_install_dir}")
qt_install(PROGRAMS "${target_binary_path}" DESTINATION "${target_install_dir}")
endif()
endfunction()

View File

@ -5,9 +5,11 @@ include(QtFeatureCommon)
include(CheckCXXCompilerFlag)
function(qt_feature_module_begin)
qt_parse_all_arguments(arg "qt_feature_module_begin"
cmake_parse_arguments(PARSE_ARGV 0 arg
"NO_MODULE;ONLY_EVALUATE_FEATURES"
"LIBRARY;PRIVATE_FILE;PUBLIC_FILE" "PUBLIC_DEPENDENCIES;PRIVATE_DEPENDENCIES" ${ARGN})
"LIBRARY;PRIVATE_FILE;PUBLIC_FILE"
"PUBLIC_DEPENDENCIES;PRIVATE_DEPENDENCIES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_ONLY_EVALUATE_FEATURES)
if ("${arg_LIBRARY}" STREQUAL "" AND (NOT ${arg_NO_MODULE}))
@ -46,9 +48,11 @@ function(qt_feature feature)
qt_feature_normalize_name("${feature}" feature)
set_property(GLOBAL PROPERTY QT_FEATURE_ORIGINAL_NAME_${feature} "${original_name}")
qt_parse_all_arguments(arg "qt_feature"
cmake_parse_arguments(PARSE_ARGV 1 arg
"PRIVATE;PUBLIC"
"LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${ARGN})
"LABEL;PURPOSE;SECTION"
"AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF")
_qt_internal_validate_all_args_are_parsed(arg)
set(_QT_FEATURE_DEFINITION_${feature} ${ARGN} PARENT_SCOPE)
@ -412,7 +416,11 @@ endfunction()
function(qt_feature_config feature config_var_name)
qt_feature_normalize_name("${feature}" feature)
qt_parse_all_arguments(arg "qt_feature_config" "NEGATE" "NAME" "" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 2 arg
"NEGATE"
"NAME"
"")
_qt_internal_validate_all_args_are_parsed(arg)
# Store all the config related info in a unique variable key.
set(key_name "_QT_FEATURE_CONFIG_DEFINITION_${feature}_${config_var_name}")
@ -472,7 +480,11 @@ endfunction()
function(qt_feature_definition feature name)
qt_feature_normalize_name("${feature}" feature)
qt_parse_all_arguments(arg "qt_feature_definition" "NEGATE" "VALUE;PREREQUISITE" "" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 2 arg
"NEGATE"
"VALUE;PREREQUISITE"
"")
_qt_internal_validate_all_args_are_parsed(arg)
# Store all the define related info in a unique variable key.
set(key_name "_QT_FEATURE_DEFINE_DEFINITION_${feature}_${name}")
@ -528,7 +540,11 @@ function(qt_evaluate_feature_definition key)
endfunction()
function(qt_extra_definition name value)
qt_parse_all_arguments(arg "qt_extra_definition" "PUBLIC;PRIVATE" "" "" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 2 arg
"PUBLIC;PRIVATE"
""
"")
_qt_internal_validate_all_args_are_parsed(arg)
if (arg_PUBLIC)
string(APPEND __QtFeature_public_extra "\n#define ${name} ${value}\n")

View File

@ -11,12 +11,12 @@ function(qt_internal_add_linker_version_script target)
return()
endif()
qt_parse_all_arguments(arg "qt_internal_add_linker_version_script"
cmake_parse_arguments(PARSE_ARGV 1 arg
""
"PRIVATE_CONTENT_FILE"
"PRIVATE_HEADERS"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_PRIVATE_CONTENT_FILE AND arg_PRIVATE_HEADERS)
message(FATAL_ERROR "Both PRIVATE_CONTENT_FILE and PRIVATE_HEADERS are specified.")
@ -526,13 +526,11 @@ endfunction()
# LANGUAGES - optional list of languages like 'C', 'CXX', for which to remove the flags
# if not provided, defaults to the list of enabled C-like languages
function(qt_internal_remove_known_optimization_flags)
qt_parse_all_arguments(
arg
"qt_internal_remove_known_optimization_flags"
cmake_parse_arguments(PARSE_ARGV 0 arg
"IN_CACHE"
""
"CONFIGS;LANGUAGES"
${ARGN})
"CONFIGS;LANGUAGES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CONFIGS)
message(FATAL_ERROR
@ -566,13 +564,12 @@ endfunction()
# specified.
# REGEX enables the flag processing as a regular expression.
function(qt_internal_remove_compiler_flags flags)
qt_parse_all_arguments(arg
"qt_internal_remove_compiler_flags"
cmake_parse_arguments(PARSE_ARGV 1 arg
"IN_CACHE;REGEX"
""
"CONFIGS;LANGUAGES"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
if("${flags}" STREQUAL "")
message(WARNING "qt_internal_remove_compiler_flags was called without any flags specified.")
@ -627,13 +624,11 @@ endfunction()
# LANGUAGES - optional list of languages like 'C', 'CXX', for which to add the flags
# if not provided, defaults to the list of enabled C-like languages
function(qt_internal_add_compiler_flags)
qt_parse_all_arguments(
arg
"qt_internal_add_compiler_flags"
cmake_parse_arguments(PARSE_ARGV 0 arg
"IN_CACHE"
"FLAGS"
"CONFIGS;LANGUAGES"
${ARGN})
"CONFIGS;LANGUAGES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CONFIGS)
message(FATAL_ERROR
@ -670,13 +665,11 @@ endfunction()
# LANGUAGES - optional list of languages like 'C', 'CXX', for which to add the flags
# if not provided, defaults to the list of enabled C-like languages
function(qt_internal_add_compiler_flags_for_release_configs)
qt_parse_all_arguments(
arg
"qt_internal_add_compiler_flags_for_release_configs"
cmake_parse_arguments(PARSE_ARGV 0 arg
"IN_CACHE"
"FLAGS"
"LANGUAGES"
${ARGN})
"LANGUAGES")
_qt_internal_validate_all_args_are_parsed(arg)
set(args "")
@ -716,13 +709,11 @@ endfunction()
# It is meant to be called in a subdirectory scope to enable full optimizations for a particular
# Qt module, like Core or Gui.
function(qt_internal_add_optimize_full_flags)
qt_parse_all_arguments(
arg
"qt_internal_add_optimize_full_flags"
cmake_parse_arguments(PARSE_ARGV 0 arg
"IN_CACHE"
""
""
${ARGN})
"")
_qt_internal_validate_all_args_are_parsed(arg)
# QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS disables forced full optimization.
if(QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS)
@ -778,13 +769,11 @@ endfunction()
# LANGUAGES - optional list of languages like 'C', 'CXX', for which to replace the flags
# if not provided, defaults to the list of enabled C-like languages
function(qt_internal_replace_compiler_flags match_string replace_string)
qt_parse_all_arguments(
arg
"qt_internal_replace_compiler_flags"
cmake_parse_arguments(PARSE_ARGV 2 arg
"IN_CACHE"
""
"CONFIGS;LANGUAGES"
${ARGN})
"CONFIGS;LANGUAGES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CONFIGS)
message(FATAL_ERROR
@ -819,13 +808,11 @@ endfunction()
# CMAKE_<LINKER_TYPE>_LINKER_FLAGS_<CONFIG> cache variable.
# e.g EXE, MODULE, SHARED, STATIC.
function(qt_internal_add_linker_flags)
qt_parse_all_arguments(
arg
"qt_internal_add_linker_flags"
cmake_parse_arguments(PARSE_ARGV 0 arg
"IN_CACHE"
"FLAGS"
"CONFIGS;TYPES"
${ARGN})
"CONFIGS;TYPES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_TYPES)
message(FATAL_ERROR
@ -866,13 +853,11 @@ endfunction()
# CMAKE_<LINKER_TYPE>_LINKER_FLAGS_<CONFIG> cache variable.
# e.g EXE, MODULE, SHARED, STATIC.
function(qt_internal_replace_linker_flags match_string replace_string)
qt_parse_all_arguments(
arg
"qt_internal_replace_compiler_flags"
cmake_parse_arguments(PARSE_ARGV 2 arg
"IN_CACHE"
""
"CONFIGS;TYPES"
${ARGN})
"CONFIGS;TYPES")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_TYPES)
message(FATAL_ERROR

View File

@ -16,9 +16,9 @@ macro(qt_internal_get_internal_add_module_keywords option_args single_args multi
NO_ADDITIONAL_TARGET_INFO
NO_GENERATE_METATYPES
NO_HEADERSCLEAN_CHECK
GENERATE_CPP_EXPORTS # TODO: Rename to NO_GENERATE_CPP_EXPORTS once migration is done
GENERATE_METATYPES # TODO: Remove once it is not used anymore
GENERATE_CPP_EXPORTS
GENERATE_PRIVATE_CPP_EXPORTS
NO_UNITY_BUILD
)
set(${single_args}
MODULE_INCLUDE_NAME
@ -127,12 +127,12 @@ function(qt_internal_add_module target)
module_multi_args
)
qt_parse_all_arguments(arg "qt_internal_add_module"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${module_option_args}"
"${module_single_args}"
"${module_multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
set(is_internal_module FALSE)
if(arg_INTERNAL_MODULE)
@ -563,6 +563,12 @@ function(qt_internal_add_module target)
qt_internal_add_repo_local_defines("${target}")
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
if(NOT arg_EXTERNAL_HEADERS)
set(arg_EXTERNAL_HEADERS "")
endif()
@ -598,6 +604,8 @@ function(qt_internal_add_module target)
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
PRECOMPILED_HEADER ${arg_PRECOMPILED_HEADER}
NO_PCH_SOURCES ${arg_NO_PCH_SOURCES}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
${arg_NO_UNITY_BUILD}
)
# The public module define is not meant to be used when building the module itself,
@ -657,6 +665,11 @@ set(QT_VISIBILITY_AVAILABLE TRUE)")
set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
endif()
# Store whether find_package(Qt6Foo) should succeed if Qt6FooTools is missing.
if(QT_ALLOW_MISSING_TOOLS_PACKAGES)
string(APPEND qtcore_extra_cmake_code "
set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endif()
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in"
@ -691,23 +704,16 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
endif()
# Generate metatypes
if(${arg_GENERATE_METATYPES})
# No mention of NO_GENERATE_METATYPES. You should not use it.
message(WARNING "GENERATE_METATYPES is on by default for Qt modules. Please remove the manual specification.")
endif()
if (NOT ${arg_NO_GENERATE_METATYPES})
if (NOT target_type STREQUAL "INTERFACE_LIBRARY")
set(args "")
if(QT_WILL_INSTALL)
set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes")
list(APPEND args
__QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}")
endif()
qt6_extract_metatypes(${target} ${args})
elseif(${arg_GENERATE_METATYPES})
message(FATAL_ERROR "Meta types generation does not work on interface libraries")
if (NOT ${arg_NO_GENERATE_METATYPES} AND NOT target_type STREQUAL "INTERFACE_LIBRARY")
set(args "")
if(QT_WILL_INSTALL)
set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes")
list(APPEND args
__QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}")
endif()
qt6_extract_metatypes(${target} ${args})
endif()
qt_internal_get_min_new_policy_cmake_version(min_new_policy_version)
qt_internal_get_max_new_policy_cmake_version(max_new_policy_version)
configure_package_config_file(
@ -1025,6 +1031,17 @@ the different base name for the module info variables.")
"${${result}_install_interface_qpa_include_dir}" PARENT_SCOPE)
endfunction()
function(qt_internal_list_to_json_array out_var list_var)
set(result "")
foreach(item IN LISTS ${list_var})
if(NOT "${result}" STREQUAL "")
string(APPEND result ", ")
endif()
string(APPEND result "\"${item}\"")
endforeach()
set("${out_var}" "[${result}]" PARENT_SCOPE)
endfunction()
# Generate a module description file based on the template in ModuleDescription.json.in
function(qt_describe_module target)
set(path_suffix "${INSTALL_DESCRIPTIONSDIR}")
@ -1033,10 +1050,27 @@ function(qt_describe_module target)
set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in")
set(descfile_out "${build_dir}/${target}.json")
string(TOLOWER "${PROJECT_NAME}" lower_case_project_name)
set(cross_compilation "false")
if(CMAKE_CROSSCOMPILING)
set(cross_compilation "true")
endif()
set(extra_module_information "")
get_target_property(target_type ${target} TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
get_target_property(plugin_types ${target} MODULE_PLUGIN_TYPES)
if(plugin_types)
qt_internal_list_to_json_array(plugin_types plugin_types)
string(APPEND extra_module_information "\n \"plugin_types\": ${plugin_types},")
endif()
endif()
get_target_property(is_internal ${target} _qt_is_internal_module)
if(is_internal)
string(APPEND extra_module_information "\n \"internal\": true,")
endif()
set(extra_build_information "")
if(ANDROID)
string(APPEND extra_build_information "

View File

@ -22,7 +22,8 @@ endmacro()
# Create a Qt6*.pc file intended for pkg-config consumption.
function(qt_internal_generate_pkg_config_file module)
# TODO: PkgConfig is supported under MSVC with pkgconf (github.com/pkgconf/pkgconf)
if((NOT UNIX OR QT_FEATURE_framework) AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20")
if((NOT UNIX OR QT_FEATURE_framework)
AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
return()
endif()
if(NOT BUILD_SHARED_LIBS)

View File

@ -36,7 +36,7 @@ function(qt_get_android_sdk_jar_for_api api out_jar_location)
endfunction()
# Minimum recommend android SDK api version
set(QT_ANDROID_API_VERSION "android-31")
set(QT_ANDROID_API_VERSION "android-33")
function(qt_internal_sort_android_platforms out_var)
if(CMAKE_VERSION GREATER_EQUAL 3.18)

View File

@ -8,6 +8,7 @@ macro(qt_internal_get_internal_add_plugin_keywords option_args single_args multi
EXCEPTIONS
ALLOW_UNDEFINED_SYMBOLS
SKIP_INSTALL
NO_UNITY_BUILD
)
set(${single_args}
OUTPUT_DIRECTORY
@ -43,12 +44,12 @@ function(qt_internal_add_plugin target)
set(single_args ${public_single_args} ${internal_single_args})
set(multi_args ${public_multi_args} ${internal_multi_args})
qt_parse_all_arguments(arg "qt_internal_add_plugin"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_args}"
"${single_args}"
"${multi_args}"
"${ARGN}"
)
_qt_internal_validate_all_args_are_parsed(arg)
# Put this behind a cache option for now. It's too noisy for general use
# until most repos are updated.
@ -305,6 +306,12 @@ function(qt_internal_add_plugin target)
endif()
endif()
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
set_property(TARGET "${target}" PROPERTY QT_DEFAULT_PLUGIN "${_default_plugin}")
set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES "QT_PLUGIN_CLASS_NAME;QT_PLUGIN_TYPE;QT_MODULE;QT_DEFAULT_PLUGIN")
@ -336,10 +343,10 @@ function(qt_internal_add_plugin target)
PUBLIC_DEFINES
${arg_PUBLIC_DEFINES}
FEATURE_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
DBUS_ADAPTOR_SOURCES "${arg_DBUS_ADAPTOR_SOURCES}"
DBUS_ADAPTOR_FLAGS "${arg_DBUS_ADAPTOR_FLAGS}"
DBUS_INTERFACE_SOURCES "${arg_DBUS_INTERFACE_SOURCES}"
DBUS_INTERFACE_FLAGS "${arg_DBUS_INTERFACE_FLAGS}"
DBUS_ADAPTOR_SOURCES ${arg_DBUS_ADAPTOR_SOURCES}
DBUS_ADAPTOR_FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
DBUS_INTERFACE_SOURCES ${arg_DBUS_INTERFACE_SOURCES}
DBUS_INTERFACE_FLAGS ${arg_DBUS_INTERFACE_FLAGS}
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
PUBLIC_COMPILE_OPTIONS ${arg_PUBLIC_COMPILE_OPTIONS}
LINK_OPTIONS ${arg_LINK_OPTIONS}
@ -347,6 +354,8 @@ function(qt_internal_add_plugin target)
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
${arg_NO_UNITY_BUILD}
)
qt_internal_add_repo_local_defines("${target}")
@ -567,6 +576,9 @@ function(qt_internal_add_darwin_permission_plugin permission)
"
CONDITION "${separate_request_genex}"
)
if(CMAKE_VERSION VERSION_LESS "3.18")
set_property(SOURCE "${separate_request_source_file}" PROPERTY GENERATED TRUE)
endif()
target_sources(${plugin_target} PRIVATE
"$<${separate_request_genex}:${separate_request_source_file}>"
)

View File

@ -19,7 +19,9 @@ endfunction()
function(qt_update_ignore_pch_source target sources)
if (sources)
set_source_files_properties(${sources} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
set_source_files_properties(${sources} PROPERTIES
SKIP_PRECOMPILE_HEADERS ON
SKIP_UNITY_BUILD_INCLUSION ON)
endif()
endfunction()

View File

@ -323,7 +323,9 @@ function(qt_generate_module_pri_file target)
list(APPEND module_internal_config staticlib)
endif()
# TODO: Add the value 'ltcg' to module_internal_config if LTCG is turned on.
if(QT_FEATURE_ltcg)
list(APPEND module_internal_config ltcg)
endif()
list(JOIN module_internal_config " " joined_module_internal_config)

View File

@ -135,6 +135,13 @@ while(NOT "${configure_args}" STREQUAL "")
list(POP_FRONT configure_args version)
is_valid_qt_hex_version("${arg}" "${version}")
push("-DQT_DISABLE_DEPRECATED_UP_TO=${version}")
elseif(arg STREQUAL "-unity-build")
push("-DQT_UNITY_BUILD=ON")
# QT_UNITY_BUILD_BATCH_SIZE will be set to 8, CMake's default.
elseif(arg STREQUAL "-unity-build-batch-size")
list(POP_FRONT configure_args unity_build_batch_size)
is_non_empty_valid_arg("${arg}" "${unity_build_batch_size}")
push("-DQT_UNITY_BUILD_BATCH_SIZE=${unity_build_batch_size}")
elseif(arg STREQUAL "--")
# Everything after this argument will be passed to CMake verbatim.
list(APPEND cmake_args "${configure_args}")

View File

@ -70,7 +70,7 @@ macro(_qt_internal_find_tool_dependencies target target_dep_list)
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
)
if (NOT ${__qt_${target}_pkg}_FOUND)
if (NOT ${__qt_${target}_pkg}_FOUND AND NOT QT_ALLOW_MISSING_TOOLS_PACKAGES)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \

View File

@ -416,7 +416,24 @@ function(__qt_internal_collect_plugin_targets_from_dependencies_of_plugins targe
set("${out_var}" "${plugin_targets}" PARENT_SCOPE)
endfunction()
function(__qt_internal_generate_plugin_deployment_info target plugin_targets)
# Generate plugin information files for deployment
#
# Arguments:
# OUT_PLUGIN_TARGETS - Variable name to store the plugin targets that were collected with
# __qt_internal_collect_plugin_targets_from_dependencies.
function(__qt_internal_generate_plugin_deployment_info target)
set(no_value_options "")
set(single_value_options "OUT_PLUGIN_TARGETS")
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 0 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
__qt_internal_collect_plugin_targets_from_dependencies("${target}" plugin_targets)
if(NOT "${arg_OUT_PLUGIN_TARGETS}" STREQUAL "")
set("${arg_OUT_PLUGIN_TARGETS}" "${plugin_targets}" PARENT_SCOPE)
endif()
get_target_property(marked_for_deployment ${target} _qt_marked_for_deployment)
if(NOT marked_for_deployment)
return()
@ -447,8 +464,8 @@ function(__qt_internal_apply_plugin_imports_finalizer_mode target)
return()
endif()
__qt_internal_collect_plugin_targets_from_dependencies("${target}" plugin_targets)
__qt_internal_generate_plugin_deployment_info(${target} "${plugin_targets}")
__qt_internal_generate_plugin_deployment_info(${target}
OUT_PLUGIN_TARGETS plugin_targets)
# By default if the project hasn't explicitly opted in or out, use finalizer mode.
# The precondition for this is that qt_finalize_target was called (either explicitly by the user

View File

@ -53,7 +53,7 @@ endfunction()
function(__qt_internal_get_emcc_recommended_version out_var)
# This version of Qt needs this version of emscripten.
set(QT_EMCC_RECOMMENDED_VERSION "3.1.14")
set(QT_EMCC_RECOMMENDED_VERSION "3.1.25")
set(${out_var} "${QT_EMCC_RECOMMENDED_VERSION}" PARENT_SCOPE)
endfunction()

View File

@ -17,7 +17,11 @@ function(qt_internal_add_resource target resourceName)
return()
endif()
qt_parse_all_arguments(arg "qt_add_resource" "" "PREFIX;LANG;BASE;OUTPUT_TARGETS" "FILES" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 2 arg
""
"PREFIX;LANG;BASE;OUTPUT_TARGETS"
"FILES")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_process_resource(${target} ${resourceName}
PREFIX "${arg_PREFIX}"

View File

@ -88,7 +88,12 @@ function(qt_apply_rpaths)
return()
endif()
qt_parse_all_arguments(arg "qt_apply_rpaths" "RELATIVE_RPATH" "TARGET;INSTALL_PATH" "" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 0 arg
"RELATIVE_RPATH"
"TARGET;INSTALL_PATH"
"")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_TARGET)
message(FATAL_ERROR "No target given to qt_apply_rpaths.")
else()

View File

@ -119,6 +119,10 @@ endif()
## Position independent code:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Does the linker support position independent code?
include(CheckPIESupported)
check_pie_supported()
# Do not relink dependent libraries when no header has changed:
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
@ -179,6 +183,16 @@ if(PROJECT_NAME STREQUAL "QtBase")
"A path to the source tree of the previously configured QtBase project." FORCE)
endif()
# QT_INTERNAL_CONFIGURE_FROM_IDE is set to TRUE for the following known IDE applications:
# - Qt Creator, detected by QTC_RUN environment variable
# - CLion, detected by CLION_IDE environment variable
# - Visual Studio Code, detected by VSCODE_CLI environment variable
if("$ENV{QTC_RUN}" OR "$ENV{CLION_IDE}" OR "$ENV{VSCODE_CLI}")
set(QT_INTERNAL_CONFIGURE_FROM_IDE TRUE CACHE INTERNAL "Configuring Qt Project from IDE")
else()
set(QT_INTERNAL_CONFIGURE_FROM_IDE FALSE CACHE INTERNAL "Configuring Qt Project from IDE")
endif()
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
@ -331,6 +345,13 @@ if(QT_USE_CCACHE)
endif()
endif()
option(QT_UNITY_BUILD "Enable unity (jumbo) build")
set(QT_UNITY_BUILD_BATCH_SIZE "32" CACHE STRING "Unity build batch size")
if(QT_UNITY_BUILD)
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE "${QT_UNITY_BUILD_BATCH_SIZE}")
endif()
# We need to clean up QT_FEATURE_*, but only once per configuration cycle
get_property(qt_feature_clean GLOBAL PROPERTY _qt_feature_clean)
if(NOT qt_feature_clean)

View File

@ -16,8 +16,12 @@
# SIMD compiler flags. This is mostly relevant for fat / universal builds
#
function(qt_internal_add_simd_part target)
qt_parse_all_arguments(arg "qt_add_simd_part" "" "NAME;SIMD"
"${__default_private_args};COMPILE_FLAGS;EXCLUDE_OSX_ARCHITECTURES" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 1 arg
""
"NAME;SIMD"
"${__default_private_args};COMPILE_FLAGS;EXCLUDE_OSX_ARCHITECTURES")
_qt_internal_validate_all_args_are_parsed(arg)
if ("x${arg_SIMD}" STREQUAL x)
message(FATAL_ERROR "qt_add_simd_part needs a SIMD type to be set.")
endif()
@ -94,7 +98,9 @@ function(qt_internal_add_simd_part target)
${arg_COMPILE_FLAGS}
)
endforeach()
set_source_files_properties(${arg_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
set_source_files_properties(${arg_SOURCES} PROPERTIES
SKIP_PRECOMPILE_HEADERS TRUE
SKIP_UNITY_BUILD_INCLUSION TRUE)
target_sources(${target} PRIVATE ${arg_SOURCES})
else()
if(QT_CMAKE_DEBUG_EXTEND_TARGET)

View File

@ -134,34 +134,33 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
list(FILTER module_headers EXCLUDE REGEX
"(.+/(ui_)[^/]+\\.h|${CMAKE_CURRENT_SOURCE_DIR}(/.+)?/doc/+\\.h)")
set(module_headers_rsp "${binary_dir_real}/${target}_module_headers")
list(JOIN module_headers "\n" module_headers_string)
qt_configure_file_v2(OUTPUT "${module_headers_rsp}" CONTENT "${module_headers_string}")
set(module_headers_generated_rsp "${binary_dir_real}/${target}_module_headers_generated")
list(JOIN module_headers_generated "\n" module_headers_generated_string)
qt_configure_file_v2(OUTPUT "${module_headers_generated_rsp}" CONTENT
"${module_headers_generated_string}")
set(syncqt_staging_dir "${module_build_interface_include_dir}/.syncqt_staging")
set(syncqt_args "${common_syncqt_arguments}")
list(APPEND syncqt_args
${common_syncqt_arguments}
-headers ${module_headers}
-generatedHeaders ${module_headers_generated}
-stagingDir "${syncqt_staging_dir}"
-knownModules ${known_modules}
${framework_args}
${version_script_args}
)
list(JOIN syncqt_args "\n" syncqt_args_string)
set(syncqt_args_rsp "${binary_dir_real}/${target}_syncqt_args")
qt_configure_file(OUTPUT "${syncqt_args_rsp}" CONTENT "${syncqt_args_string}")
add_custom_command(
OUTPUT
${syncqt_outputs}
COMMAND
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
${common_syncqt_arguments}
"@${syncqt_args_rsp}"
${build_time_syncqt_arguments}
-headers "@${module_headers_rsp}"
-generatedHeaders "@${module_headers_generated_rsp}"
-stagingDir "${syncqt_staging_dir}"
-knownModules ${known_modules}
${framework_args}
${version_script_args}
COMMAND
${CMAKE_COMMAND} -E touch "${syncqt_timestamp}"
DEPENDS
${module_headers_rsp}
${module_headers_generated_rsp}
${syncqt_args_rsp}
${module_headers}
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
COMMENT
@ -178,13 +177,17 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
# available for qdoc.
# ${target}_sync_headers is added as dependency to make sure that
# ${target}_sync_all_public_headers is running after ${target}_sync_headers, when building docs.
set(syncqt_all_args "${common_syncqt_arguments};-all")
list(JOIN syncqt_all_args "\n" syncqt_all_args_string)
set(syncqt_all_args_rsp "${binary_dir_real}/${target}_syncqt_all_args")
qt_configure_file(OUTPUT "${syncqt_all_args_rsp}" CONTENT "${syncqt_all_args_string}")
add_custom_target(${target}_sync_all_public_headers
COMMAND
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
${common_syncqt_arguments}
-all
"@${syncqt_all_args_rsp}"
DEPENDS
${module_headers}
${syncqt_all_args_rsp}
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
${target}_sync_headers
VERBATIM
@ -223,12 +226,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
execute_process(
COMMAND
${syncqt_location}
${common_syncqt_arguments}
-headers "@${module_headers_rsp}"
-generatedHeaders "@${module_headers_generated_rsp}"
-stagingDir "${syncqt_staging_dir}"
-knownModules ${known_modules}
${framework_args}
"@${syncqt_args_rsp}"
RESULT_VARIABLE syncqt_result
OUTPUT_VARIABLE syncqt_output
ERROR_VARIABLE syncqt_output

View File

@ -31,7 +31,9 @@ function(qt_internal_extend_target target)
return()
endif()
set(option_args "")
set(option_args
NO_UNITY_BUILD
)
set(single_args
PRECOMPILED_HEADER
)
@ -45,12 +47,12 @@ function(qt_internal_extend_target target)
NO_PCH_SOURCES
)
qt_parse_all_arguments(arg "qt_extend_target"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_args}"
"${single_args}"
"${multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
if("x${arg_CONDITION}" STREQUAL "x")
set(arg_CONDITION ON)
@ -66,7 +68,7 @@ function(qt_internal_extend_target target)
qt_create_qdbusxml2cpp_command("${target}" "${adaptor}"
ADAPTOR
BASENAME "${arg_DBUS_ADAPTOR_BASENAME}"
FLAGS "${arg_DBUS_ADAPTOR_FLAGS}"
FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
)
list(APPEND dbus_sources "${adaptor}")
endforeach()
@ -75,7 +77,7 @@ function(qt_internal_extend_target target)
qt_create_qdbusxml2cpp_command("${target}" "${interface}"
INTERFACE
BASENAME "${arg_DBUS_INTERFACE_BASENAME}"
FLAGS "${arg_DBUS_INTERFACE_FLAGS}"
FLAGS ${arg_DBUS_INTERFACE_FLAGS}
)
list(APPEND dbus_sources "${interface}")
endforeach()
@ -207,6 +209,7 @@ function(qt_internal_extend_target target)
qt_update_precompiled_header("${target}" "${arg_PRECOMPILED_HEADER}")
qt_update_ignore_pch_source("${target}" "${arg_NO_PCH_SOURCES}")
qt_update_ignore_unity_build_sources("${target}" "${arg_NO_UNITY_BUILD_SOURCES}")
## Ignore objective-c files for PCH (not supported atm)
qt_ignore_pch_obj_c_sources("${target}" "${arg_SOURCES}")
@ -226,6 +229,10 @@ function(qt_internal_extend_target target)
set_property(TARGET ${target} APPEND PROPERTY
${sources_property} "${arg_CONDITION_INDEPENDENT_SOURCES}")
endif()
if(arg_NO_UNITY_BUILD)
set_target_properties(${target} PROPERTIES UNITY_BUILD OFF)
endif()
endfunction()
function(qt_is_imported_target target out_var)
@ -568,17 +575,32 @@ endif()
get_target_property(is_configure_time_target ${target} _qt_internal_configure_time_target)
if(is_configure_time_target)
get_target_property(configure_time_target_install_location ${target}
_qt_internal_configure_time_target_install_location)
# For Multi-config developer builds we should simply reuse IMPORTED_LOCATION of the
# target.
if(NOT QT_WILL_INSTALL AND QT_FEATURE_debug_and_release)
get_target_property(configure_time_target_install_location ${target}
IMPORTED_LOCATION)
else()
get_target_property(configure_time_target_install_location ${target}
_qt_internal_configure_time_target_install_location)
set(configure_time_target_install_location
"$\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}")
endif()
if(configure_time_target_install_location)
string(APPEND content "
# Import configure-time executable ${full_target}
if(NOT TARGET ${full_target})
set(_qt_imported_location \"${configure_time_target_install_location}\")
if(NOT EXISTS \"$\{_qt_imported_location}\")
message(FATAL_ERROR \"Unable to add configure time executable ${full_target}\"
\" $\{_qt_imported_location} doesn't exists\")
endif()
add_executable(${full_target} IMPORTED)
set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${default_cfg})
set_target_properties(${full_target} PROPERTIES IMPORTED_LOCATION_${uc_default_cfg}
\"$\\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}\")
\"$\{_qt_imported_location}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_GLOBAL TRUE)
unset(_qt_imported_location)
endif()
\n")
endif()
@ -592,10 +614,10 @@ endif()
string(APPEND content "
# ${full_target} is not built by default in the Debug configuration. Check existence.
get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_DEBUG)
if(NOT EXISTS \"$\\{_qt_imported_location}\")
if(NOT EXISTS \"$\{_qt_imported_location}\")
get_target_property(_qt_imported_configs ${full_target} IMPORTED_CONFIGURATIONS)
list(REMOVE_ITEM _qt_imported_configs DEBUG)
set_property(TARGET ${full_target} PROPERTY IMPORTED_CONFIGURATIONS $\\{_qt_imported_configs})
set_property(TARGET ${full_target} PROPERTY IMPORTED_CONFIGURATIONS $\{_qt_imported_configs})
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION_DEBUG)
endif()\n")
endif()
@ -622,12 +644,12 @@ endif()\n")
string(APPEND content "get_target_property(_qt_imported_soname ${full_target} IMPORTED_SONAME_${uc_release_cfg})\n")
endif()
endif()
string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
if(write_implib)
string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
if(write_soname)
string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
foreach(config ${configurations_to_export} "")
string(TOUPPER "${config}" ucconfig)
@ -645,18 +667,18 @@ set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${ucc
endif()
string(APPEND content "
if(_qt_imported_location${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\\{_qt_imported_location${var_suffix}}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\{_qt_imported_location${var_suffix}}\")
endif()")
if(write_implib)
string(APPEND content "
if(_qt_imported_implib${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_IMPLIB${property_suffix} \"$\\{_qt_imported_implib${var_suffix}}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_IMPLIB${property_suffix} \"$\{_qt_imported_implib${var_suffix}}\")
endif()")
endif()
if(write_soname)
string(APPEND content "
if(_qt_imported_soname${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\\{_qt_imported_soname${var_suffix}}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\{_qt_imported_soname${var_suffix}}\")
endif()")
endif()
string(APPEND content "\n")
@ -709,7 +731,7 @@ function(qt_internal_create_tracepoints name tracepoints_file)
set(header_filename "${provider_name}_tracepoints_p.h")
set(header_path "${CMAKE_CURRENT_BINARY_DIR}/${header_filename}")
if(QT_FEATURE_lttng OR QT_FEATURE_etw)
if(QT_FEATURE_lttng OR QT_FEATURE_etw OR QT_FEATURE_ctf)
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/${provider_name}_tracepoints.cpp")
qt_configure_file(OUTPUT "${source_path}"
CONTENT "#define TRACEPOINT_CREATE_PROBES
@ -723,6 +745,8 @@ function(qt_internal_create_tracepoints name tracepoints_file)
target_link_libraries(${name} PRIVATE LTTng::UST)
elseif(QT_FEATURE_etw)
set(tracegen_arg "etw")
elseif(QT_FEATURE_ctf)
set(tracegen_arg "ctf")
endif()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
@ -745,6 +769,77 @@ function(qt_internal_create_tracepoints name tracepoints_file)
endif()
endfunction()
function(qt_internal_generate_tracepoints name provider)
cmake_parse_arguments(arg "" "" "SOURCES" ${ARGN} )
set(provider_name ${provider})
string(PREPEND provider_name "qt")
set(tracepoint_filename "${provider_name}.tracepoints")
set(tracepoints_path "${CMAKE_CURRENT_BINARY_DIR}/${tracepoint_filename}")
set(header_filename "${provider_name}_tracepoints_p.h")
set(header_path "${CMAKE_CURRENT_BINARY_DIR}/${header_filename}")
if(QT_FEATURE_lttng OR QT_FEATURE_etw OR QT_FEATURE_ctf)
set(absolute_file_paths "")
foreach(file IN LISTS arg_SOURCES)
get_filename_component(absolute_file ${file} ABSOLUTE)
list(APPEND absolute_file_paths ${absolute_file})
endforeach()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
qt_path_join(tracepointgen
"${QT_HOST_PATH}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
"tracepointgen")
else()
set(tracepointgen "${QT_CMAKE_EXPORT_NAMESPACE}::tracepointgen")
endif()
add_custom_command(OUTPUT "${tracepoints_path}"
COMMAND ${tracepointgen} ${provider_name} "${tracepoints_path}" "I$<JOIN:$<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>,;>" ${absolute_file_paths}
DEPENDS ${absolute_file_paths}
VERBATIM)
add_custom_target(${name}_${provider_name}_tracepoints_file DEPENDS "${tracepoints_path}")
add_dependencies(${name} ${name}_${provider_name}_tracepoints_file)
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/${provider_name}_tracepoints.cpp")
qt_configure_file(OUTPUT "${source_path}"
CONTENT "#define TRACEPOINT_CREATE_PROBES
#define TRACEPOINT_DEFINE
#include \"${header_filename}\"")
target_sources(${name} PRIVATE "${source_path}")
target_compile_definitions(${name} PRIVATE Q_TRACEPOINT)
if(QT_FEATURE_lttng)
set(tracegen_arg "lttng")
target_link_libraries(${name} PRIVATE LTTng::UST)
elseif(QT_FEATURE_etw)
set(tracegen_arg "etw")
elseif(QT_FEATURE_ctf)
set(tracegen_arg "ctf")
endif()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
qt_path_join(tracegen
"${QT_HOST_PATH}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
"tracegen")
else()
set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen")
endif()
get_filename_component(tracepoints_filepath "${tracepoints_path}" ABSOLUTE)
add_custom_command(OUTPUT "${header_path}"
COMMAND ${tracegen} ${tracegen_arg} "${tracepoints_filepath}" "${header_path}"
DEPENDS "${tracepoints_path}"
VERBATIM)
add_custom_target(${name}_${provider_name}_tracepoints_header DEPENDS "${header_path}")
add_dependencies(${name} ${name}_${provider_name}_tracepoints_header)
else()
qt_configure_file(OUTPUT "${header_path}" CONTENT "#include <private/qtrace_p.h>\n")
endif()
endfunction()
function(qt_internal_set_compile_pdb_names target)
if(MSVC)
get_target_property(target_type ${target} TYPE)

View File

@ -9,12 +9,12 @@ function(qt_internal_add_benchmark target)
message(WARNING "Benchmarks won't be batched - unsupported (yet)")
endif()
qt_parse_all_arguments(arg "qt_add_benchmark"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${__qt_internal_add_executable_optional_args}"
"${__qt_internal_add_executable_single_args}"
"${__qt_internal_add_executable_multi_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
qt_remove_args(exec_args
ARGS_TO_REMOVE
@ -37,6 +37,7 @@ function(qt_internal_add_benchmark target)
qt_internal_add_executable(${target}
NO_INSTALL # we don't install benchmarks
NO_UNITY_BUILD # excluded by default
OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory
${exec_args}
)
@ -92,52 +93,7 @@ endfunction()
# the binary is built under ${CMAKE_CURRENT_BINARY_DIR} and never installed.
# See qt_internal_add_executable() for more details.
function(qt_internal_add_manual_test target)
qt_parse_all_arguments(arg "qt_add_manual_test"
"${__qt_internal_add_executable_optional_args}"
"${__qt_internal_add_executable_single_args}"
"${__qt_internal_add_executable_multi_args}"
${ARGN}
)
qt_remove_args(exec_args
ARGS_TO_REMOVE
${target}
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
ALL_ARGS
"${__qt_internal_add_executable_optional_args}"
"${__qt_internal_add_executable_single_args}"
"${__qt_internal_add_executable_multi_args}"
ARGS
${ARGV}
)
if(NOT arg_OUTPUT_DIRECTORY)
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
qt_internal_library_deprecation_level(deprecation_define)
qt_internal_add_executable(${target}
NO_INSTALL # we don't install benchmarks
OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory
${exec_args}
)
qt_internal_extend_target(${target}
DEFINES
${deprecation_define}
)
# Tests on iOS must be app bundles.
if(IOS)
set_target_properties(${target} PROPERTIES MACOSX_BUNDLE TRUE)
endif()
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for manual tests
qt_internal_undefine_global_definition(${target} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
qt_internal_add_test_finalizers("${target}")
qt_internal_add_test(${ARGV} MANUAL)
endfunction()
# This function will configure the fixture for the network tests that require docker network services
@ -254,6 +210,9 @@ function(qt_internal_get_test_arg_definitions optional_args single_value_args mu
LOWDPI
NO_WRAPPER
BUILTIN_TESTDATA
MANUAL
NO_BATCH
NO_INSTALL
PARENT_SCOPE
)
set(${single_value_args}
@ -361,7 +320,9 @@ function(qt_internal_add_test_to_batch batch_name name)
LINK_OPTIONS ${arg_LINK_OPTIONS}
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS})
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD # Tests should not be built using UNITY_BUILD
)
foreach(source ${arg_SOURCES})
# We define the test name which is later used to launch this test using
@ -422,16 +383,19 @@ endfunction()
# to ON. This is helpful if you want to use internal CMake tools within tests, like memory or
# sanitizer checks. See https://cmake.org/cmake/help/v3.19/manual/ctest.1.html#ctest-memcheck-step
# Arguments:
# BUILTIN_TESTDATA the option forces adding the provided TESTDATA to resources.
# BUILTIN_TESTDATA
# The option forces adding the provided TESTDATA to resources.
# MANUAL
# The option indicates that the test is a manual test.
function(qt_internal_add_test name)
qt_internal_get_test_arg_definitions(optional_args single_value_args multi_value_args)
qt_parse_all_arguments(arg "qt_add_test"
"${optional_args};NO_BATCH"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${optional_args}"
"${single_value_args}"
"${multi_value_args}"
${ARGN}
)
_qt_internal_validate_all_args_are_parsed(arg)
if (NOT arg_OUTPUT_DIRECTORY)
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
@ -451,7 +415,7 @@ function(qt_internal_add_test name)
"removed in a future Qt version. Use the LIBRARIES option instead.")
endif()
if(NOT arg_NO_BATCH AND QT_BUILD_TESTS_BATCHED AND NOT arg_QMLTEST)
if(NOT arg_NO_BATCH AND QT_BUILD_TESTS_BATCHED AND NOT arg_QMLTEST AND NOT arg_MANUAL)
qt_internal_add_test_to_batch(name ${name} ${ARGN})
set(setting_up_batched_test TRUE)
elseif(arg_SOURCES)
@ -486,6 +450,7 @@ function(qt_internal_add_test name)
MOC_OPTIONS ${arg_MOC_OPTIONS}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD # Tests should not be built using UNITY_BUILD
)
qt_internal_add_repo_local_defines(${name})
@ -493,13 +458,16 @@ function(qt_internal_add_test name)
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for tests
qt_internal_undefine_global_definition(${name} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
# Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
# assumptions about the location of helper processes, and those paths would be different
# if a test is built as a bundle.
set_property(TARGET "${name}" PROPERTY MACOSX_BUNDLE FALSE)
# The same goes for WIN32_EXECUTABLE, but because it will detach from the console window
# and not print anything.
set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
# Manual tests can be bundle apps
if(NOT arg_MANUAL)
# Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
# assumptions about the location of helper processes, and those paths would be different
# if a test is built as a bundle.
set_property(TARGET "${name}" PROPERTY MACOSX_BUNDLE FALSE)
# The same goes for WIN32_EXECUTABLE, but because it will detach from the console window
# and not print anything.
set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
endif()
# Tests on iOS must be app bundles.
if(IOS)
@ -597,63 +565,65 @@ function(qt_internal_add_test name)
endif()
endif()
if(setting_up_batched_test)
qt_internal_get_batched_test_arguments(batched_test_args ${testname})
list(PREPEND extra_test_args ${batched_test_args})
endif()
qt_internal_collect_command_environment(test_env_path test_env_plugin_path)
if(arg_NO_WRAPPER OR QT_NO_TEST_WRAPPERS)
if(QT_BUILD_TESTS_BATCHED)
message(FATAL_ERROR "Wrapperless tests are unspupported with test batching")
if(NOT arg_MANUAL)
if(setting_up_batched_test)
qt_internal_get_batched_test_arguments(batched_test_args ${testname})
list(PREPEND extra_test_args ${batched_test_args})
endif()
add_test(NAME "${testname}" COMMAND ${test_executable} ${extra_test_args}
WORKING_DIRECTORY "${test_working_dir}")
set_property(TEST "${testname}" APPEND PROPERTY
ENVIRONMENT "PATH=${test_env_path}"
"QT_TEST_RUNNING_IN_CTEST=1"
"QT_PLUGIN_PATH=${test_env_plugin_path}"
qt_internal_collect_command_environment(test_env_path test_env_plugin_path)
if(arg_NO_WRAPPER OR QT_NO_TEST_WRAPPERS)
if(QT_BUILD_TESTS_BATCHED)
message(FATAL_ERROR "Wrapperless tests are unspupported with test batching")
endif()
add_test(NAME "${testname}" COMMAND ${test_executable} ${extra_test_args}
WORKING_DIRECTORY "${test_working_dir}")
set_property(TEST "${testname}" APPEND PROPERTY
ENVIRONMENT "PATH=${test_env_path}"
"QT_TEST_RUNNING_IN_CTEST=1"
"QT_PLUGIN_PATH=${test_env_plugin_path}"
)
else()
set(test_wrapper_file "${CMAKE_CURRENT_BINARY_DIR}/${testname}Wrapper$<CONFIG>.cmake")
qt_internal_create_test_script(NAME "${testname}"
COMMAND "${test_executable}"
ARGS "${extra_test_args}"
WORKING_DIRECTORY "${test_working_dir}"
OUTPUT_FILE "${test_wrapper_file}"
ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST" 1
"PATH" "${test_env_path}"
"QT_PLUGIN_PATH" "${test_env_plugin_path}"
)
endif()
if(arg_QT_TEST_SERVER_LIST AND NOT ANDROID)
qt_internal_setup_docker_test_fixture(${testname} ${arg_QT_TEST_SERVER_LIST})
endif()
set_tests_properties("${testname}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}" LABELS "${label}")
if(arg_TIMEOUT)
set_tests_properties(${testname} PROPERTIES TIMEOUT ${arg_TIMEOUT})
endif()
# Add a ${target}/check makefile target, to more easily test one test.
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
add_custom_target("${testname}_check"
VERBATIM
COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\" ${test_config_options}"
COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$" ${test_config_options}
)
else()
set(test_wrapper_file "${CMAKE_CURRENT_BINARY_DIR}/${testname}Wrapper$<CONFIG>.cmake")
qt_internal_create_test_script(NAME "${testname}"
COMMAND "${test_executable}"
ARGS "${extra_test_args}"
WORKING_DIRECTORY "${test_working_dir}"
OUTPUT_FILE "${test_wrapper_file}"
ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST" 1
"PATH" "${test_env_path}"
"QT_PLUGIN_PATH" "${test_env_plugin_path}"
)
endif()
if(arg_QT_TEST_SERVER_LIST AND NOT ANDROID)
qt_internal_setup_docker_test_fixture(${testname} ${arg_QT_TEST_SERVER_LIST})
endif()
set_tests_properties("${testname}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}" LABELS "${label}")
if(arg_TIMEOUT)
set_tests_properties(${testname} PROPERTIES TIMEOUT ${arg_TIMEOUT})
endif()
# Add a ${target}/check makefile target, to more easily test one test.
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
add_custom_target("${testname}_check"
VERBATIM
COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\" ${test_config_options}"
COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$" ${test_config_options}
)
if(TARGET "${name}")
add_dependencies("${testname}_check" "${name}")
if(ANDROID)
add_dependencies("${testname}_check" "${name}_make_apk")
if(TARGET "${name}")
add_dependencies("${testname}_check" "${name}")
if(ANDROID)
add_dependencies("${testname}_check" "${name}_make_apk")
endif()
endif()
endif()
@ -814,11 +784,12 @@ function(qt_internal_add_test_helper name)
"OVERRIDE_OUTPUT_DIRECTORY"
)
qt_parse_all_arguments(arg "qt_add_test_helper"
cmake_parse_arguments(PARSE_ARGV 1 arg
"${qt_add_test_helper_optional_args};${__qt_internal_add_executable_optional_args}"
"${__qt_internal_add_executable_single_args}"
"${__qt_internal_add_executable_multi_args}"
${ARGN})
)
_qt_internal_validate_all_args_are_parsed(arg)
qt_remove_args(forward_args
ARGS_TO_REMOVE
@ -845,7 +816,9 @@ function(qt_internal_add_test_helper name)
endif()
endif()
qt_internal_add_executable("${name}" NO_INSTALL ${extra_args_to_pass} ${forward_args})
qt_internal_add_executable("${name}" NO_INSTALL
NO_UNITY_BUILD # excluded by default
${extra_args_to_pass} ${forward_args})
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for test helpers
qt_internal_undefine_global_definition(${name} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)

View File

@ -37,7 +37,12 @@
# linked to the executable target by default.
function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
set(option_keywords NO_INSTALL USER_FACING INSTALL_VERSIONED_LINK EXCEPTIONS)
set(option_keywords
NO_INSTALL
USER_FACING
INSTALL_VERSIONED_LINK
EXCEPTIONS
NO_UNITY_BUILD)
set(one_value_keywords
TOOLS_TARGET
INSTALL_DIR
@ -48,9 +53,12 @@ function(qt_internal_add_tool target_name)
EXTRA_CMAKE_INCLUDES
PUBLIC_LIBRARIES
${__default_private_args})
qt_parse_all_arguments(arg "qt_internal_add_tool" "${option_keywords}"
"${one_value_keywords}"
"${multi_value_keywords}" ${ARGN})
cmake_parse_arguments(PARSE_ARGV 1 arg
"${option_keywords}"
"${one_value_keywords}"
"${multi_value_keywords}")
_qt_internal_validate_all_args_are_parsed(arg)
qt_internal_find_tool(will_build_tools ${target_name} "${arg_TOOLS_TARGET}")
@ -85,6 +93,12 @@ function(qt_internal_add_tool target_name)
qt_internal_library_deprecation_level(deprecation_define)
if(arg_NO_UNITY_BUILD)
set(arg_NO_UNITY_BUILD NO_UNITY_BUILD)
else()
set(arg_NO_UNITY_BUILD "")
endif()
qt_internal_add_executable("${target_name}"
OUTPUT_DIRECTORY "${output_dir}"
${exceptions}
@ -110,6 +124,8 @@ function(qt_internal_add_tool target_name)
TARGET_DESCRIPTION "${arg_TARGET_DESCRIPTION}"
TARGET_COMPANY "${arg_TARGET_COMPANY}"
TARGET_COPYRIGHT "${arg_TARGET_COPYRIGHT}"
NO_UNITY_BUILD_SOURCES "${arg_NO_UNITY_BUILD_SOURCES}"
${arg_NO_UNITY_BUILD}
)
qt_internal_add_target_aliases("${target_name}")
_qt_internal_apply_strict_cpp("${target_name}")
@ -616,7 +632,7 @@ endfunction()
# Specifies the module this tool belongs to. The Qt6${TOOLS_TARGET}Tools module
# will then expose targets for this tool. Ignored if NO_INSTALL is set.
function(qt_internal_add_configure_time_tool target_name)
set(one_value_args INSTALL_DIRECTORY TOOLS_TARGET)
set(one_value_args INSTALL_DIRECTORY TOOLS_TARGET CONFIG)
set(multi_value_args)
set(option_args NO_INSTALL)
cmake_parse_arguments(PARSE_ARGV 1 arg
@ -639,13 +655,26 @@ function(qt_internal_add_configure_time_tool target_name)
set(extra_args "INSTALL_DIRECTORY" "${install_dir}")
endif()
if(arg_CONFIG)
set(tool_config "${arg_CONFIG}")
elseif(QT_MULTI_CONFIG_FIRST_CONFIG)
set(tool_config "${arg_QT_MULTI_CONFIG_FIRST_CONFIG}")
else()
set(tool_config "${CMAKE_BUILD_TYPE}")
endif()
string(REPLACE "\\\;" "\\\\\\\;" unparsed_arguments "${arg_UNPARSED_ARGUMENTS}")
qt_internal_add_configure_time_executable(${target_name}
OUTPUT_NAME ${name}
CONFIG ${tool_config}
${extra_args}
${unparsed_arguments}
)
if(TARGET host_tools)
add_dependencies(host_tools "${target_name}_build")
endif()
if(NOT arg_NO_INSTALL AND arg_TOOLS_TARGET)
qt_internal_add_targets_to_additional_targets_export_file(
TARGETS ${target_name}

View File

@ -0,0 +1,8 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(qt_update_ignore_unity_build_sources target sources)
if (sources)
set_source_files_properties(${sources} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
endif()
endfunction()

View File

@ -35,13 +35,13 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
endif()
# wasm exceptions
if (QT_FEATURE_wasm_exception)
if (QT_FEATURE_wasm_exceptions)
target_compile_options("${wasmTarget}" INTERFACE -fwasm-exceptions)
target_link_options("${wasmTarget}" INTERFACE -fwasm-exceptions)
else()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s DISABLE_EXCEPTION_CATCHING=1")
endif()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s DISABLE_EXCEPTION_CATCHING=1")
if (QT_FEATURE_thread)
target_compile_options("${wasmTarget}" INTERFACE "SHELL:-pthread")
target_link_options("${wasmTarget}" INTERFACE "SHELL:-pthread")

View File

@ -76,10 +76,10 @@ function(qt_internal_create_wrapper_scripts)
__relative_path_to_cmake_scripts_dir)
if(generate_unix)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-configure-module.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-configure-module" @ONLY
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-configure-module" @ONLY
NEWLINE_STYLE LF)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-configure-module"
DESTINATION "${INSTALL_LIBEXECDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-configure-module"
DESTINATION "${INSTALL_BINDIR}")
endif()
if(generate_non_unix)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-configure-module.bat.in"
@ -118,7 +118,7 @@ function(qt_internal_create_wrapper_scripts)
endif()
if(generate_non_unix)
set(__qt_cmake_private_path
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake-private.bat")
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake-private")
endif()
endif()

View File

@ -73,6 +73,8 @@ The following table describes the mapping of configure options to CMake argument
| | | custom build steps for moc, uic, and rcc. |
| | | This lacks support in CMake. |
| -ccache | -DQT_USE_CCACHE=ON | |
| -unity-build | -DQT_UNITY_BUILD=ON | |
| -unity-build-batch-size <int> | -DQT_UNITY_BUILD_BATCH_SIZE=<int> | |
| -make-tool <tool> | n/a | |
| -mp | n/a | |
| -warnings-are-errors | -DWARNINGS_ARE_ERRORS=ON | |
@ -98,7 +100,7 @@ The following table describes the mapping of configure options to CMake argument
| -android-javac-source | -DQT_ANDROID_JAVAC_SOURCE=7 | Set the javac build source version. |
| -android-javac-target | -DQT_ANDROID_JAVAC_TARGET=7 | Set the javac build target version. |
| -skip <repo>,...,<repo_n> | -DBUILD_<repo>=OFF | |
| -submodules <repo>,...,<repo_n> | -QT_BUILD_SUBMODULES=<repo>;...;<repo> | |
| -submodules <repo>,...,<repo_n> | -DQT_BUILD_SUBMODULES=<repo>;...;<repo> | |
| -make <part> | -DQT_BUILD_TESTS=ON | A way to turn on tools explicitly is missing. If tests/examples |
| | -DQT_BUILD_EXAMPLES=ON | are enabled, you can disable their building as part of the |
| | | 'all' target by also passing -DQT_BUILD_TESTS_BY_DEFAULT=OFF or |

View File

@ -16,8 +16,9 @@
# define Q_@module_define_infix@_EXPORT
#endif
#if !defined(QT_BUILD_@module_define_infix@_LIB) || defined(QT_STATIC)
#if !defined(QT_BUILD_@module_define_infix@_LIB) && !defined(QT_STATIC)
/* outside library → inline decl + defi */
/* static builds treat everything as part of the library, so they never inline */
# define QT_@module_define_infix@_INLINE_SINCE(major, minor) inline
# define QT_@module_define_infix@_INLINE_IMPL_SINCE(major, minor) 1
#elif defined(QT_@module_define_infix@_BUILD_REMOVED_API)

View File

@ -12,7 +12,7 @@ instructions:
instructions:
- type: EnvironmentVariable
variableName: CONFIGURE_EXECUTABLE
variableValue: "{{.InstallDir}}{{.Env.INSTALL_DIR_SUFFIX}}{{.Env.CI_PATH_SEP}}libexec{{.Env.CI_PATH_SEP}}qt-configure-module"
variableValue: "{{.InstallDir}}{{.Env.INSTALL_DIR_SUFFIX}}{{.Env.CI_PATH_SEP}}bin{{.Env.CI_PATH_SEP}}qt-configure-module"
disable_if:
condition: property
property: host.os

View File

@ -21,7 +21,11 @@ instructions:
- condition: runtime
env_var: COIN_CMAKE_ARGS
contains_value: "QT_BUILD_EXAMPLES=ON"
# covers all cases for UseConfigure configs
# host case
- condition: runtime
env_var: COIN_CONFIGURE_ARGS
env_var: CONFIGURE_ARGS
contains_value: "-make examples"
# target case
- condition: runtime
env_var: TARGET_CONFIGURE_ARGS
contains_value: "-make examples"

View File

@ -140,6 +140,10 @@ Build options:
Force use of the GNU ld, GNU gold, LLVM/LLD or mold
linker instead of default one (GCC and clang only)
-ccache .............. Use the ccache compiler cache [no] (Unix only)
-unity-build ......... Enable Unity (Jumbo) build
-unity-build-batch-size <int>
Maximum number of source files used by the unity build
to create unity source files [8]
-warnings-are-errors . Treat warnings as errors [no; yes if -developer-build]

View File

@ -109,6 +109,8 @@ SSL_free(SSL_new(0));
qt_find_package(WrapZSTD 1.3 PROVIDED_TARGETS WrapZSTD::WrapZSTD MODULE_NAME global QMAKE_LIB zstd)
qt_find_package(WrapDBus1 1.2 PROVIDED_TARGETS dbus-1 MODULE_NAME global QMAKE_LIB dbus)
qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev MODULE_NAME global QMAKE_LIB libudev)
qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST MODULE_NAME core QMAKE_LIB lttng-ust)
qt_add_qmake_lib_dependency(lttng-ust libdl)
#### Early-evaluated, Linker-related Tests and Features
@ -929,23 +931,26 @@ qt_feature("arm_crypto" PRIVATE
qt_feature_definition("arm_crypto" "QT_COMPILER_SUPPORTS_AES" VALUE "1")
qt_feature_config("arm_crypto" QMAKE_PRIVATE_CONFIG)
qt_feature("wasm_simd128" PRIVATE
qt_feature("wasm-simd128" PUBLIC
LABEL "WebAssembly SIMD128"
PURPOSE "Enables WebAssembly SIMD"
AUTODETECT OFF
)
qt_feature_definition("wasm_simd128" "QT_COMPILER_SUPPORTS_WASM_SIMD128" VALUE "1")
qt_feature_config("wasm_simd128" QMAKE_PRIVATE_CONFIG)
qt_feature_definition("wasm-simd128" "QT_COMPILER_SUPPORTS_WASM_SIMD128" VALUE "1")
qt_feature_config("wasm-simd128" QMAKE_PRIVATE_CONFIG)
qt_feature("wasm-exceptions" PUBLIC
LABEL "WebAssembly Exceptions"
PURPOSE "Enables WebAssembly Exceptions"
AUTODETECT OFF
)
qt_feature_definition("wasm-exceptions" "QT_WASM_EXCEPTIONS" VALUE "1")
qt_feature_config("wasm-exceptions" QMAKE_PRIVATE_CONFIG)
qt_feature("posix_fallocate" PRIVATE
LABEL "POSIX fallocate()"
CONDITION TEST_posix_fallocate
)
qt_feature("wasm_exceptions" PRIVATE
LABEL "WebAssembly exception handling"
AUTODETECT OFF
)
qt_feature_definition("wasm_exceptions" "QT_WASM_EXCEPTIONS" VALUE "1")
qt_feature_config("wasm_exceptions" QMAKE_PRIVATE_CONFIG)
qt_feature("alloca_h" PRIVATE
LABEL "alloca.h"
CONDITION TEST_alloca_h
@ -1172,7 +1177,11 @@ qt_configure_add_summary_entry(ARGS "precompile_header")
qt_configure_add_summary_entry(ARGS "ltcg")
qt_configure_add_summary_entry(ARGS "intelcet")
qt_configure_add_summary_entry(
ARGS "wasm_simd128"
ARGS "wasm-simd128"
CONDITION ( TEST_architecture_arch STREQUAL wasm )
)
qt_configure_add_summary_entry(
ARGS "wasm-exceptions"
CONDITION ( TEST_architecture_arch STREQUAL wasm )
)
qt_configure_add_summary_section(NAME "Target compiler supports")

View File

@ -3,7 +3,7 @@
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
dita.metadata.default.copyryear = 2022
dita.metadata.default.copyryear = 2023
dita.metadata.default.copyrholder = The Qt Company Ltd
dita.metadata.default.audience = programmer
@ -19,8 +19,8 @@ ignorewords += \
WebSockets \
OpenGL
# Omit \since information for items introduced before Qt 5
ignoresince = 5.0
# Omit \since information for items introduced before Qt 6
ignoresince = 6.0
sourcedirs += includes $$BUILDDIR
exampledirs += snippets

View File

@ -3,7 +3,7 @@ outputencoding = UTF-8
sourceencoding = UTF-8
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css *.glsl"
examples.imageextensions = "*.png *.jpg *.gif"
examples.imageextensions = "*.png *.jpg *.gif *.webp"
headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"

View File

@ -78,7 +78,7 @@ HTML.footer += \
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2022 The Qt Company</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2023 The Qt Company</a></li>\n" \
" </ul>\n" \
"</div>\n" \
"</div>\n" \

View File

@ -8,7 +8,7 @@ HTML.footer = \
"</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2022 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2023 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners.<br/>" \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -18,9 +18,10 @@
//! [using qt module]
//! [using the c++ api]
Using a Qt module requires linking against the module library, either
directly or through other dependencies. Several build tools have dedicated
support for this, including \l{CMake Documentation}{CMake} and \l{qmake}.
Using a Qt module's C++ API requires linking against the module library,
either directly or through other dependencies. Several build tools have
dedicated support for this, including \l{CMake Documentation}{CMake} and
\l{qmake}.
//! [using the c++ api]
//! [using the qml api]

View File

@ -19,7 +19,7 @@
# manifestmeta.filters = highlighted sql global
#
# manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example" \
# "QtWidgets/Analog Clock Example"
# "QtWidgets/Analog Clock"
# manifestmeta.highlighted.attributes = isHighlighted:true
#
# manifestmeta.sql.names = "QtSql/*"
@ -40,11 +40,9 @@ manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"QtBluetooth/Bluetooth Scanner Example" \
"QtBluetooth/QML Bluetooth Scanner Example" \
"QtCharts/*" \
"QtConcurrent/QtConcurrent Progress Dialog Example" \
"QtDataVisualization/Audiolevels Example" \
"QtDataVisualization/Qt Quick 2 Scatter Example" \
"QtDataVisualization/Qt Quick 2 Surface Multiseries Example" \
"QtGui/Analog Clock Window Example" \
"QtGui/OpenGL Window Example" \
"QtGui/Raster Window Example" \
"QtLinguist/Arrow Pad Example" \
@ -89,12 +87,16 @@ manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"QtQuick/Threaded ListModel Example" \
"QtQuick/TabWidget Example" \
"QtQuick/UI Components*" \
"QtQuickControls/*" \
"QtQuickControls1/Qt Quick Controls 1 - Calendar Example" \
"QtQuickControls1/Qt Quick Controls 1 - Gallery" \
"QtQuickControls1/Qt Quick Controls 1 - Styles Example" \
"QtQuickControls1/Qt Quick Controls 1 - Table View Example" \
"QtQuickControls1/Qt Quick Controls 1 - Touch Gallery" \
"QtQuickControls/Qt Quick Controls - Attached Style Properties Example" \
"QtQuickControls/Qt Quick Controls - Chat Tutorial" \
"QtQuickControls/Qt Quick Controls - Contact List" \
"QtQuickControls/Qt Quick Controls - Event Calendar" \
"QtQuickControls/Qt Quick Controls - Flat Style" \
"QtQuickControls/Qt Quick Controls - Gallery" \
"QtQuickControls/Qt Quick Controls - Imagine Style Example: Automotive" \
"QtQuickControls/Qt Quick Controls - Imagine Style Example: Music Player" \
"QtQuickControls/Qt Quick Controls - Text Editor" \
"QtQuickControls/Qt Quick Controls - Wearable Demo" \
"QtQuickDialogs/*" \
"QtQuickExtras/*" \
"QtSCXML/Qt SCXML Calculator QML Example" \
@ -151,7 +153,6 @@ manifestmeta.android.tags = android
manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtCore/Mandelbrot Example" \
"QtCore/Queued Custom Type Example" \
"QtGui/Analog Clock Window Example" \
"QtGui/OpenGL Window Example" \
"QtGui/Raster Window Example" \
"QtNetwork/Loopback Example" \
@ -175,7 +176,6 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Blur Picker Effect Example" \
"QtWidgets/Fade Message Effect Example" \
"QtWidgets/Lighting Effect Example" \
"QtWidgets/Anchor Layout Example" \
"QtWidgets/Basic Graphics Layouts Example" \
"QtWidgets/40000 Chips" \
"QtWidgets/Colliding Mice Example" \
@ -184,8 +184,7 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Embedded Dialogs" \
"QtWidgets/Graphics View Flow Layout Example" \
"QtWidgets/Simple Anchor Layout Example" \
"QtWidgets/Weather Anchor Layout Example" \
"QtWidgets/Address Book Example" \
"QtWidgets/Address Book" \
"QtWidgets/Basic Sort/Filter Model Example" \
"QtWidgets/Chart Example" \
"QtWidgets/Custom Sort/Filter Model Example" \
@ -212,7 +211,7 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Completer Example" \
"QtWidgets/Custom Completer Example" \
"QtWidgets/Undo Framework" \
"QtWidgets/Analog Clock Example" \
"QtWidgets/Analog Clock" \
"QtWidgets/Calculator Example" \
"QtWidgets/Calendar Widget Example" \
"QtWidgets/Character Map Example" \
@ -225,7 +224,6 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Sliders Example" \
"QtWidgets/Validators Example" \
"QtWidgets/Window Flags Example" \
"QtWidgets/Wiggly Example" \
"QtQuick/Qt Quick Examples - Animation" \
"QtQuick/Qt Quick Examples - Canvas" \
"QtQuick/Qt Quick Examples - Drag and Drop" \
@ -240,7 +238,8 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtQuick/Qt Quick Examples - Text" \
"QtQuick/Qt Quick Examples - Touch Interaction" \
"QtQuick/Qt Quick Examples - Views" \
"QtQuick/Qt Quick Examples - Window and Screen"
"QtQuick/Qt Quick Examples - Window and Screen" \
"QtQuickControls/Qt Quick Controls - To Do List"
manifestmeta.ios.tags = ios
@ -252,9 +251,7 @@ manifestmeta.thumbnail.names = "QtCore/Contiguous Cache Example" \
"QtCore/JSON Save Game Example" \
"QtCore/Semaphores Example" \
"QtCore/Wait Conditions Example" \
"QtConcurrent/Map Example" \
"QtConcurrent/QtConcurrent Word Count Example" \
"QtConcurrent/Run Function Example" \
"QtConcurrent/Word Count" \
"QtGui/Raster Window Example" \
"QtNetwork/Network Download*" \
"QtWidgets/Dynamic Layouts Example" \

View File

@ -5,7 +5,7 @@
HTML.footer = \
" </div>\n" \
" <p class=\"copy-notice\">\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2022 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2023 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners. " \
" The documentation provided herein is licensed under the terms of the" \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -22,11 +22,10 @@ qt_add_executable(permissions
set_target_properties(permissions PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
MACOSX_BUNDLE_GUI_IDENTIFIER "io.qt.examples.permissions"
QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android"
)
qt_finalize_executable(permissions)
target_link_libraries(permissions PRIVATE
Qt6::Core
Qt6::Gui
@ -43,3 +42,5 @@ if(APPLE AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
add_custom_command(TARGET permissions
POST_BUILD COMMAND codesign -s - permissions.app)
endif()
qt_finalize_executable(permissions)

View File

@ -46,12 +46,12 @@
<string>Testing HealthShare</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Testing HealthUpdate</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Testing LocationAlwaysAndWhenInUse</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Testing LocationAlways</string>
<key>NSLocationUsageDescription</key>
<string>Testing Location on macOS</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Testing LocationWhenInUse</string>
<string>Testing Location when in use on iOS</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Testing Location always and when in use on iOS</string>
<key>NSMicrophoneUsageDescription</key>
<string>Testing Microphone</string>

View File

@ -8,7 +8,10 @@
#include <QtWidgets/qlayout.h>
#include <QtWidgets/qmessagebox.h>
QT_REQUIRE_CONFIG(permissions);
#if !QT_CONFIG(permissions)
#error "This example requires the permissions feature, which is not enabled on this platform"
#endif
#include <QtCore/qpermissions.h>
class PermissionWidget : public QWidget

View File

@ -19,7 +19,7 @@
static CborConverter cborConverter;
static CborDiagnosticDumper cborDiagnosticDumper;
static const char optionHelp[] =
static const char cborOptionHelp[] =
"convert-float-to-int=yes|no Write integers instead of floating point, if no\n"
" loss of precision occurs on conversion.\n"
"float16=yes|always|no Write using half-precision floating point.\n"
@ -207,7 +207,7 @@ Converter::Options CborConverter::outputOptions()
const char *CborConverter::optionsHelp()
{
return optionHelp;
return cborOptionHelp;
}
bool CborConverter::probeFile(QIODevice *f)
@ -314,7 +314,7 @@ void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
}
fprintf(stderr, "Unknown CBOR format option '%s'. Valid options are:\n%s",
qPrintable(s), optionHelp);
qPrintable(s), cborOptionHelp);
exit(EXIT_FAILURE);
}
//! [4]

View File

@ -7,7 +7,7 @@
#include <QDebug>
#include <QTextStream>
static const char optionHelp[] =
static const char dataStreamOptionHelp[] =
"byteorder=host|big|little Byte order to use.\n"
"version=<n> QDataStream version (default: Qt 5.0).\n"
;
@ -143,7 +143,7 @@ Converter::Options DataStreamConverter::outputOptions()
const char *DataStreamConverter::optionsHelp()
{
return optionHelp;
return dataStreamOptionHelp;
}
bool DataStreamConverter::probeFile(QIODevice *f)
@ -209,7 +209,7 @@ void DataStreamConverter::saveFile(QIODevice *f, const QVariant &contents, const
}
fprintf(stderr, "Unknown QDataStream formatting option '%s'. Available options are:\n%s",
qPrintable(option), optionHelp);
qPrintable(option), dataStreamOptionHelp);
exit(EXIT_FAILURE);
}

View File

@ -11,7 +11,7 @@
static JsonConverter jsonConverter;
static const char optionHelp[] =
static const char jsonOptionHelp[] =
"compact=no|yes Use compact JSON form.\n";
static QJsonDocument convertFromVariant(const QVariant &v)
@ -45,7 +45,7 @@ Converter::Options JsonConverter::outputOptions()
const char *JsonConverter::optionsHelp()
{
return optionHelp;
return jsonOptionHelp;
}
bool JsonConverter::probeFile(QIODevice *f)
@ -96,7 +96,8 @@ void JsonConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
} else if (s == QLatin1String("compact=yes")) {
format = QJsonDocument::Compact;
} else {
fprintf(stderr, "Unknown option '%s' to JSON output. Valid options are:\n%s", qPrintable(s), optionHelp);
fprintf(stderr, "Unknown option '%s' to JSON output. Valid options are:\n%s",
qPrintable(s), jsonOptionHelp);
exit(EXIT_FAILURE);
}
}

View File

@ -13,7 +13,7 @@
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
static const char optionHelp[] =
static const char xmlOptionHelp[] =
"compact=no|yes Use compact XML form.\n";
static XmlConverter xmlConverter;
@ -416,7 +416,7 @@ Converter::Options XmlConverter::outputOptions()
const char *XmlConverter::optionsHelp()
{
return optionHelp;
return xmlOptionHelp;
}
bool XmlConverter::probeFile(QIODevice *f)
@ -454,7 +454,8 @@ void XmlConverter::saveFile(QIODevice *f, const QVariant &contents, const QStrin
} else if (s == QLatin1String("compact=yes")) {
compact = true;
} else {
fprintf(stderr, "Unknown option '%s' to XML output. Valid options are:\n%s", qPrintable(s), optionHelp);
fprintf(stderr, "Unknown option '%s' to XML output. Valid options are:\n%s",
qPrintable(s), xmlOptionHelp);
exit(EXIT_FAILURE);
}
}

View File

@ -6,10 +6,8 @@
#include <QMetaEnum>
#include <QTextStream>
Character::Character() :
mLevel(0),
mClassType(Warrior) {
}
Character::Character()
= default;
Character::Character(const QString &name,
int level,

View File

@ -11,7 +11,7 @@
//! [0]
class Character
{
Q_GADGET;
Q_GADGET
public:
enum ClassType {
@ -37,8 +37,8 @@ public:
void print(int indentation = 0) const;
private:
QString mName;
int mLevel;
ClassType mClassType;
int mLevel = 0;
ClassType mClassType = Warrior;
};
//! [0]

View File

@ -158,5 +158,5 @@
human-readable JSON files, but you also have the option to use a binary
format if it's required, \e without rewriting any code.
\sa {JSON Support in Qt}, {CBOR Support in Qt}, {Data Storage}
\sa {JSON Support in Qt}, {CBOR Support in Qt}, {Data Input Output}
*/

View File

@ -121,8 +121,8 @@ void Game::read(const QJsonObject &json)
QJsonArray levelArray = json["levels"].toArray();
mLevels.clear();
mLevels.reserve(levelArray.size());
for (int levelIndex = 0; levelIndex < levelArray.size(); ++levelIndex) {
QJsonObject levelObject = levelArray[levelIndex].toObject();
for (const QJsonValue &v : levelArray) {
QJsonObject levelObject = v.toObject();
Level level;
level.read(levelObject);
mLevels.append(level);

View File

@ -4,12 +4,12 @@
#ifndef GAME_H
#define GAME_H
#include <QJsonObject>
#include <QList>
#include "character.h"
#include "level.h"
#include <QJsonObject>
#include <QList>
//! [0]
class Game
{

View File

@ -35,8 +35,8 @@ void Level::read(const QJsonObject &json)
QJsonArray npcArray = json["npcs"].toArray();
mNpcs.clear();
mNpcs.reserve(npcArray.size());
for (int npcIndex = 0; npcIndex < npcArray.size(); ++npcIndex) {
QJsonObject npcObject = npcArray[npcIndex].toObject();
for (const QJsonValue &v : npcArray) {
QJsonObject npcObject = v.toObject();
Character npc;
npc.read(npcObject);
mNpcs.append(npc);

View File

@ -4,17 +4,17 @@
#ifndef LEVEL_H
#define LEVEL_H
#include "character.h"
#include <QJsonObject>
#include <QList>
#include "character.h"
//! [0]
class Level
{
public:
Level() = default;
Level(const QString &name);
explicit Level(const QString &name);
QString name() const;

View File

@ -1,10 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "game.h"
#include <QCoreApplication>
#include <QTextStream>
#include "game.h"
//! [0]
int main(int argc, char *argv[])
{

View File

@ -13,17 +13,17 @@
\image mandelbrot-example.png Screenshot of the Mandelbrot example
The heavy computation here is the Mandelbrot set, probably the
world's most famous fractal. These days, while sophisticated
programs such as \l{http://matek.hu/xaos/doku.php}{XaoS} that provide real-time zooming in the
Mandelbrot set, the standard Mandelbrot algorithm is just slow
enough for our purposes.
The heavy computation here is the Mandelbrot set, probably the world's most
famous fractal. These days, while sophisticated programs, such as
\l{https://xaos-project.github.io/}{XaoS}, provide real-time zooming in
the Mandelbrot set, the standard Mandelbrot algorithm is just slow enough
for our purposes.
In real life, the approach described here is applicable to a
large set of problems, including synchronous network I/O and
database access, where the user interface must remain responsive
while some heavy operation is taking place. The \l
{Blocking Fortune Client Example} shows the same principle at
{Blocking Fortune Client} example shows the same principle at
work in a TCP client.
The Mandelbrot application supports zooming and scrolling using

View File

@ -75,16 +75,13 @@
that the condition \c bufferNotEmpty is true, since \c
numUsedBytes is necessarily greater than 0.
The QWaitCondition::wait() function accepts a
We guard all accesses to the \c numUsedBytes variable with a
mutex. In addition, the QWaitCondition::wait() function accepts a
mutex as its argument. This mutex is unlocked before the thread
is put to sleep and locked when the thread wakes up. Furthermore,
the transition from the locked state to the wait state is atomic,
to prevent race conditions from occurring.
Accesses to the \c numUsedBytes variable do not need mutex
protection, as that variable is a QAtomicInt; atomic variables
do not participate in data races.
\section1 Consumer Class
Let's turn to the \c Consumer class:

View File

@ -2,7 +2,6 @@
// Copyright (C) 2022 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QAtomicInt>
#include <QCoreApplication>
#include <QMutex>
#include <QMutexLocker>
@ -18,13 +17,12 @@
constexpr int DataSize = 100000;
constexpr int BufferSize = 8192;
QMutex mutex; // protects the buffer
QMutex mutex; // protects the buffer and the counter
char buffer[BufferSize];
int numUsedBytes;
QWaitCondition bufferNotEmpty;
QWaitCondition bufferNotFull;
QAtomicInt numUsedBytes;
//! [0]
//! [1]
@ -43,14 +41,17 @@ private:
for (int i = 0; i < DataSize; ++i) {
{
const QMutexLocker locker(&mutex);
while (numUsedBytes.loadAcquire() == BufferSize)
while (numUsedBytes == BufferSize)
bufferNotFull.wait(&mutex);
}
buffer[i % BufferSize] = "ACGT"[QRandomGenerator::global()->bounded(4)];
numUsedBytes.fetchAndAddRelease(1);
bufferNotEmpty.wakeAll();
{
const QMutexLocker locker(&mutex);
++numUsedBytes;
bufferNotEmpty.wakeAll();
}
}
}
};
@ -72,14 +73,17 @@ private:
for (int i = 0; i < DataSize; ++i) {
{
const QMutexLocker locker(&mutex);
while (numUsedBytes.loadAcquire() == 0)
while (numUsedBytes == 0)
bufferNotEmpty.wait(&mutex);
}
fprintf(stderr, "%c", buffer[i % BufferSize]);
numUsedBytes.fetchAndAddRelease(-1);
bufferNotFull.wakeAll();
{
const QMutexLocker locker(&mutex);
--numUsedBytes;
bufferNotFull.wakeAll();
}
}
fprintf(stderr, "\n");
}

View File

@ -32,7 +32,6 @@ qt_add_dbus_adaptor(chat_SRCS
qt_add_executable(chat
chat.cpp chat.h
chatmainwindow.ui
chatsetnickname.ui
${chat_SRCS}
)

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include <QInputDialog>
#include <QMessageBox>
#include "chat.h"
@ -9,110 +10,69 @@
#include "chat_interface.h"
ChatMainWindow::ChatMainWindow()
: m_nickname(QLatin1String("nickname"))
{
setupUi(this);
sendButton->setEnabled(false);
connect(messageLineEdit, &QLineEdit::textChanged,
this, &ChatMainWindow::textChangedSlot);
connect(sendButton, &QPushButton::clicked,
this, &ChatMainWindow::sendClickedSlot);
connect(messageLineEdit, &QLineEdit::textChanged, this,
[this](const QString &newText) { sendButton->setEnabled(!newText.isEmpty()); });
connect(sendButton, &QPushButton::clicked, this, [this]() {
emit message(m_nickname, messageLineEdit->text());
messageLineEdit->clear();
});
connect(actionChangeNickname, &QAction::triggered,
this, &ChatMainWindow::changeNickname);
connect(actionAboutQt, &QAction::triggered,
this, &ChatMainWindow::aboutQt);
connect(qApp, &QApplication::lastWindowClosed,
this, &ChatMainWindow::exiting);
connect(actionAboutQt, &QAction::triggered, this, [this]() { QMessageBox::aboutQt(this); });
connect(qApp, &QApplication::lastWindowClosed, this,
[this]() { emit action(m_nickname, tr("leaves the chat")); });
// add our D-Bus interface and connect to D-Bus
new ChatAdaptor(this);
QDBusConnection::sessionBus().registerObject("/", this);
org::example::chat *iface;
iface = new org::example::chat(QString(), QString(), QDBusConnection::sessionBus(), this);
//connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString)));
QDBusConnection::sessionBus().connect(QString(), QString(), "org.example.chat", "message", this, SLOT(messageSlot(QString,QString)));
connect(iface, &org::example::chat::action,
this, &ChatMainWindow::actionSlot);
auto connection = QDBusConnection::sessionBus();
connection.registerObject("/", this);
NicknameDialog dialog;
dialog.cancelButton->setVisible(false);
dialog.exec();
m_nickname = dialog.nickname->text().trimmed();
emit action(m_nickname, QLatin1String("joins the chat"));
using org::example::chat;
auto *iface = new chat({}, {}, connection, this);
connect(iface, &chat::message, this, [this](const QString &nickname, const QString &text) {
displayMessage(tr("<%1> %2").arg(nickname, text));
});
connect(iface, &chat::action, this, [this](const QString &nickname, const QString &text) {
displayMessage(tr("* %1 %2").arg(nickname, text));
});
if (!changeNickname(true))
QMetaObject::invokeMethod(qApp, &QApplication::quit, Qt::QueuedConnection);
}
ChatMainWindow::~ChatMainWindow()
void ChatMainWindow::displayMessage(const QString &message)
{
}
m_messages.append(message);
void ChatMainWindow::rebuildHistory()
{
QString history = m_messages.join( QLatin1String("\n" ) );
if (m_messages.count() > 100)
m_messages.removeFirst();
auto history = m_messages.join(QLatin1String("\n"));
chatHistory->setPlainText(history);
}
void ChatMainWindow::messageSlot(const QString &nickname, const QString &text)
bool ChatMainWindow::changeNickname(bool initial)
{
QString msg( QLatin1String("<%1> %2") );
msg = msg.arg(nickname, text);
m_messages.append(msg);
auto newNickname = QInputDialog::getText(this, tr("Set nickname"), tr("New nickname:"));
newNickname = newNickname.trimmed();
if (m_messages.count() > 100)
m_messages.removeFirst();
rebuildHistory();
}
if (!newNickname.isEmpty()) {
auto old = m_nickname;
m_nickname = newNickname;
void ChatMainWindow::actionSlot(const QString &nickname, const QString &text)
{
QString msg( QLatin1String("* %1 %2") );
msg = msg.arg(nickname, text);
m_messages.append(msg);
if (m_messages.count() > 100)
m_messages.removeFirst();
rebuildHistory();
}
void ChatMainWindow::textChangedSlot(const QString &newText)
{
sendButton->setEnabled(!newText.isEmpty());
}
void ChatMainWindow::sendClickedSlot()
{
//emit message(m_nickname, messageLineEdit->text());
QDBusMessage msg = QDBusMessage::createSignal("/", "org.example.chat", "message");
msg << m_nickname << messageLineEdit->text();
QDBusConnection::sessionBus().send(msg);
messageLineEdit->setText(QString());
}
void ChatMainWindow::changeNickname()
{
NicknameDialog dialog(this);
if (dialog.exec() == QDialog::Accepted) {
QString old = m_nickname;
m_nickname = dialog.nickname->text().trimmed();
emit action(old, QString("is now known as %1").arg(m_nickname));
if (initial)
emit action(m_nickname, tr("joins the chat"));
else
emit action(old, tr("is now known as %1").arg(m_nickname));
return true;
}
}
void ChatMainWindow::aboutQt()
{
QMessageBox::aboutQt(this);
}
void ChatMainWindow::exiting()
{
emit action(m_nickname, QLatin1String("leaves the chat"));
}
NicknameDialog::NicknameDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
return false;
}
int main(int argc, char **argv)

View File

@ -7,7 +7,6 @@
#include <QStringList>
#include "ui_chatmainwindow.h"
#include "ui_chatsetnickname.h"
class ChatMainWindow: public QMainWindow, Ui::ChatMainWindow
{
@ -16,29 +15,16 @@ class ChatMainWindow: public QMainWindow, Ui::ChatMainWindow
QStringList m_messages;
public:
ChatMainWindow();
~ChatMainWindow();
void rebuildHistory();
private:
void displayMessage(const QString &message);
signals:
void message(const QString &nickname, const QString &text);
void action(const QString &nickname, const QString &text);
private slots:
void messageSlot(const QString &nickname, const QString &text);
void actionSlot(const QString &nickname, const QString &text);
void textChangedSlot(const QString &newText);
void sendClickedSlot();
void changeNickname();
void aboutQt();
void exiting();
};
class NicknameDialog: public QDialog, public Ui::NicknameDialog
{
Q_OBJECT
public:
NicknameDialog(QWidget *parent = nullptr);
bool changeNickname(bool initial = false);
};
#endif // CHAT_H

View File

@ -2,7 +2,7 @@ QT += dbus widgets
HEADERS += chat.h
SOURCES += chat.cpp
FORMS += chatmainwindow.ui chatsetnickname.ui
FORMS += chatmainwindow.ui
DBUS_ADAPTORS += org.example.chat.xml
DBUS_INTERFACES += org.example.chat.xml

View File

@ -1,149 +0,0 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>NicknameDialog</class>
<widget class="QDialog" name="NicknameDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>396</width>
<height>105</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Set nickname</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>New nickname:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nickname" />
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>131</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okButton" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>NicknameDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel" >
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>NicknameDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel" >
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Some files were not shown because too many files have changed in this diff Show More