Compare commits

...

846 Commits
dev ... 6.1

Author SHA1 Message Date
Liang Qi
cb4026f636 opengl: fix a typo in QOpenGLPaintDevice::dotsPerMeterY()
Fixes: QTBUG-95005
Change-Id: I88ab9b757a5cfee520e07ac6280e31f9211342f0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 85831bcfe6ce36740c524d641ada79c65aadd89b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-26 06:40:30 +00:00
Sona Kurazyan
0f013d3c02 Fix compilation error with MSVC 2019 and C++20
Fixes: QTBUG-97425
Change-Id: Id327e3494d1deae852f953211c0409a80beafe88
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 64e931246484eb36b2b921cdec38263b21167523)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-11 22:51:37 +00:00
Laszlo Agocs
2fc4a1b530 gl: Try the local CacheLocation when the shared one fails
We prefer the shared cache path, because there is no reason to give up
benefitting from sharing the content between applications. If that path
is not QFileInfo().isWritable(), we fall back to the local cache path.

However, there are reportedly systems with security solutions such as
AppArmor where the writable check passes and yet attempting to create a
file still fails. Then there is no cache in effect, because nothing ever
gets written out.

Handle this better: if writing the file fails and we still use our first
choice, the global cache location, fall back to the secondary choice
(the app-local path) and try again.

Fixes: QTBUG-96789
Change-Id: Ifea32e9af0cf85aa70f3069256ed3d6a7e2fbe90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dalton Durst <dalton@ubports.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 46e6a9a759ae89f905107ccad191ca5ddf442e53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-08 09:07:25 +00:00
Eskil Abrahamsen Blomfeldt
e45db3ddeb Revert "Support family names that end/start with space"
This reverts commit 7fd9ed32012bd9001e78ad692a4802e0e3366e44.

While trimming the font name worked for cases with application fonts,
it actually introduced an assert for system fonts that ended with a
space, because enumerating these failed. So the original assumption
that all Windows APIs also trimmed the family name was wrong.

The original bug was that the font with the trailing space could
not be selected, but when using setFamilies(), it can. So there is
a perfectly fine way around the original bug when using a font that
has this problem. Therefore, no additional fix is needed for that.

[ChangeLog][Windows] Fixed an assert that happened when the system
had a font with a trailing or leading space in its name.

Fixes: QTBUG-93885
Task-number: QTBUG-79140
Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 4d47b18c81f74ae6855e16197a12b69a6bcfe68a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-07 10:35:15 +00:00
Doris Verria
ae1921b0ea Cocoa: Don't call makeKeyAndOrderFront for native app-modal dialogs
We show non-modal and Qt::WindowModal native  dialogs as modeless
panels by calling  makeKeyAndOrderFront on the panel. When we exec()
a dialog on the other hand, we start a modal event loop by calling
runModalForWindow. This method will display the dialog and make it a
key window before running the modal event loop. So we don't need to
and shouldn't call makeKeyAndOrderFront explicitly before that.
Doing so will make Cocoa lose the reference to the previous active
window (as it maintains only one level of previous active window) and
wrongly choose the main window as key after the dialog closes. Avoiding
the call to showModelessPanel for Qt::ApplicationModal dialogs fixes it.

Also, in order to display a modal when show() is called and app modality
is set via setModality, display it as a modeless dialog as well. This
keeps the same behavior we have currently, but it is still not the right
way to handle it as we don't respect the modality set by the user.
A clean-up of that logic to come in a follow-up commit.

Fixes: QTBUG-42661
Change-Id: I8f33e3866b191d775a64a5d9ec3dd65736114e62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7c26d7f482b9c15cc6ff850d5954151031010226)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-24 10:10:22 +00:00
Alex Trotsenko
4a6618ca68 QProcess: do not emit aboutToClose() twice
This signal is emitted by the QIODevice itself, so we don't have to
emit it from QProcess::close().

Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-19 09:48:47 +00:00
Richard Moe Gustavsen
7b930750b1 QPlatformWindow: fix isAncestorOf not breaking recursion
The current implementation got stuck always asking for
the parent of the same child

This patch will make sure we actually walk up the
parent chain.

Change-Id: I9f67f6305e0143526f53952a563d496e760ac2e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f06f39779c11cabc9b4fc281f38c80edb65bd86a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-13 18:22:46 +00:00
Edward Welbourne
ee23accac7 Make clear why QTestLog::addB?XFail() don't add to counters
This reverts commit 904617dfb83f39a6a379635b64fea6fcd00f241a and makes
clear to future readers why that wouldn't be a sensible change.
Update the test's data, eliminating a case of duplicate counting that
was caused by the reverted commit.

Task-number: QTBUG-95661
Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7af79ba09148dbfe5c1fc8b130d564dcca7ae4b3)
2021-09-13 17:19:18 +02:00
Alex Trotsenko
c5a79d6dbc Allow destruction of QWinEventNotifier in its signal
Avoid use-after-free issue in QProcess.

Fixes: QTBUG-96285
Fixes: QTBUG-96359
Change-Id: I953d7a8ecaf301ec3a27db37e13748f905c3d097
Reviewed-by: Christoph Cullmann <cullmann@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 4e0082a9cacfdfd0c43e6105274bc0d41dd18801)
2021-09-11 19:41:07 +03:00
Eskil Abrahamsen Blomfeldt
866ceb7eb4 Fix querying font aliases that share name with other fonts
a332f3fabc29f796526202648eddf35a24f1cb67 disabled resolving all fonts
on the system for every font lookup, which was a significant startup
time improvement. But it also caused a regression: When a font has
an alias which shares the name of a proper font, then this would
not be resolved correctly.

This is fairly typical on Windows/GDI due to backwards-compatibility.
Instead of being collected under a shared typographical family, fonts
are disambiguated by adding the style name to the family name. The
proper typographical name is still available, but this is not
enumerated by the system.

So "Segoe UI" for instance, will be available as "Segoe UI",
"Segoe UI Light", "Segoe UI Bold" etc.

When we populate family aliases, we register that "Segoe UI Light"
is actually "Segoe UI" with Light weight, and prior to
a332f3fabc29f796526202648eddf35a24f1cb67 this would be done implicitly.

But after the optimization, we would only populate family aliases once
we stumbled over a font request for a non-existent font. For "Segoe UI",
we would simply return the regular weight font as the best imperfect
match.

The fix is to populate font family aliases not only when the family is
non-existent, but when the match is imperfect, e.g. if we are asking
for a Light weight font and only finding a regular one. User code can
still avoid this somewhat expensive operation by using the full
family names on Windows.

This also requires a fix to a test. When removeApplicationFont() is
called, we invalidate the font database, so it will be reset to a state
that does not contain the family aliases. Therefore we cannot guarantee
that it is identical to what it was before the test started, since this
depends on what has happened previously in the application.

[ChangeLog][QtGui][Text] Fixed an issue where some font styles and weights
would not be selectable. This was especially noticeable on Windows.

Fixes: QTBUG-94835
Change-Id: I892855edd1c8e3d3734aace396f6000d897d2ec4
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 e0ad2cee55193696285cc84bf5c4922bb7247e9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-11 14:21:52 +00:00
Mårten Nordheim
7c5c548869 tst_http2: Fix flaky authentication test
The h2 server is running in a separate thread, so while the previous
test was finished and the server was deleted, it could still emit
and have a queued emission in-flight which would be picked up by
the next running test.

Change-Id: I26b1bc711df7473032d6078f35f8aca37c40137e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c942bae4ebf903a60a8bd3da9500f7733c71b04d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-10 22:38:36 +00:00
Mårten Nordheim
1fa6f1dcf6 qdevice.pri: Use cmake separators for the path
Because otherwise we may end up with trailing backslashes

Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a2653331330340c4f44457c49005f4c7226b8316)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-10 19:13:11 +00:00
Mårten Nordheim
fa9759db45 OpenSSL: Let people opt-in to use TLS 1.3 PSK callback
It's a workaround for the workaround...

If TLS 1.3 was explicitly chosen and the PSK callback is set then
without this patch the callback is never called since, with TLS 1.3, PSK
would only be queried once at the start of a connection.

It can now be re-enabled with an environment variable. A new API should
be added to address the new requirements of PSK with TLS 1.3:
For session resumption the connection MUST use the same hash algorithm
as in the original session. For new sessions the hash algorithm must be
decided ahead of time, or a default will be used (as defined by the
standard). A user can also pass along multiple identity+key pairs and
the server will pick one it recognizes. This is not something we can
currently do with the preSharedKeyAuthenticationRequired callback.

[ChangeLog][Network][QSslSocket][OpenSSL] When using TLS 1.3 we
suppress the first callback from OpenSSL about pre-shared keys, as it
doesn't conform to the past behavior which
preSharedKeyAuthenticationRequired provided. With this update you can
opt-out of that workaround by setting the QT_USE_TLS_1_3_PSK environment
variable

Task-number: QTBUG-95670
Change-Id: Ia7454bbbf394cbcb859de333b371d0890b42a1c3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e520f29a73fe4c3432a992d41c33220736a0d65)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-10 14:18:47 +02:00
Sona Kurazyan
b9be95b070 Skip tst_QReadWriteLock::multipleReadersLoop on QEMU
The test is randomly failing in the CI on QEMU. Couldn't reproduce it on
the actual armv7 hardware, so most likely it's not a Qt bug.

Fixes: QTBUG-96103
Change-Id: I60b7264c6ce44b3b327fdd0dbcede006717c65a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ba8d1da4a971a6351318e86fc613f74843bb2c49)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-10 09:53:51 +02:00
Liang Qi
99dfbca5c4 xcb: update connection time when possible
At least we try to do it with all events triggered by user.

Change-Id: I28b399a2517600f7da2c91a50fecdf58b9d81fb6
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 25feb2fe3e393dd1820bb4ee8c4105fb088de045)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-09-09 18:55:58 +02:00
Sona Kurazyan
280b55111f Fix QtConcurrent::blockingMapped to work with non-template sequences
The code for deducing the type of output sequence was assuming that the
input sequence is always a template class and was trying to use the
corresponding container type for the output sequence. Fixed the
deduction code, to assume that the output sequence has the same type as
the input sequence, when it's not a template class. Also added tests to
verify that all QtConcurrent functions support non-template input
sequences.

Fixes: QTBUG-30617
Change-Id: I486fe99f3207cfff5dcceb3712cc7de863067edb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 28e194d3b25f5fc6e17cce8dddba7f7e16002c43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-08 13:05:43 +00:00
Doris Verria
f1244e54e5 Cocoa: Make sure we can display multiple sheets for the same NSWindow
On macOS, to display a modal with Qt::WindowModality set, or of type
Qt::Sheet, we call beginSheet:completinHandler:. However, this method
won't display the specified sheet unless the current active one is
dismissed, which is a different behavior than what we expect for
this case. Use beginCriticalSheet:completionHandler: whenever we
already have an active sheet attached to the NSWindow, which allows
us to display multiple sheets for the same window.

Fixes: QTBUG-91059
Change-Id: I86bdbcbd63758edbbc48a8aade0178917dcb0e5b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f3bc1f850046341745d42e2d6739724321634891)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-07 18:56:21 +00:00
Sona Kurazyan
ba5d797d07 Fix compilation for recursive Qt containers
The operator checks cause compilation errors when trying to check for
their existence for recursive containers. This happens because of trying
to check for the operators on the template parameter type(s), that
inherit from the container itself, which leads to compilation errors.
Introduced alternative versions of the operator checks (with _container
suffix), that first check if the container is recursive, i.e. any of its
template parameter types inherits from the given container, and skips
the operator check, if that's the case.

The fix is done for all Qt container types that had the problem, except
for QVarLengthArray and QContiguousCache, which don't compile with
recursive parameter types for unrelated reasons.

Fixes: QTBUG-91707
Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9f13842fe61541cb8ab9822174ea963e418b5537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-07 14:28:58 +00:00
Zhang Hao
8a2f866247 QPaintEngineEx: solve compile error
Use the same variable name in function
Amends 6869d2463a2e0d71bd04dbc82f5d6ef4933dc510

Change-Id: If710a53993e84d048f9052f4fcf92eb57635f585
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit cca8ed0547405b1c018e995ad366ba0ab4c2a0e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-07 12:01:08 +00:00
Giuseppe D'Angelo
ff2e145a9d QObject: cleanup the orphaned connection lists on destruction
When a signal/slot connection is broken, it gets added to the
sender's list of "orphaned connections", to clean up later.
This cleanup happens when the sender gets destroyed or as soon as
it emits any signal.

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

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

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

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

Original-patch-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Task-number: QTBUG-88248
Task-number: QTBUG-87774
Change-Id: Id25f67a45dff49f740132a44d36e88740eb12070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit c2839843f23fb5c289175cb9577981d48dd273fc)
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-06 10:59:40 +02:00
Milla Pohjanheimo
d4b4bed8b8 Add binary compatibility files for 6.1
Binary compatibility files added.

Pick-to: 6.2 dev
Change-Id: Ie575c774b13b3eae24412e535fa68be8c0ff5fb6
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-09-03 07:24:33 +00:00
Fabrice Fontaine
0217200c88 Fix build on riscv32
riscv32 fails to build because __NR_futex is not defined on this
architecture:

In file included from thread/qmutex_linux.cpp:45,
                 from thread/qmutex.cpp:804:
thread/qfutex_p.h: In function 'int QtLinuxFutex::_q_futex(int*, int, int, quintptr, int*, int)':
thread/qfutex_p.h:116:30: error: '__NR_futex' was not declared in this scope; did you mean '_q_futex'?
  116 |         int result = syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3);
      |                              ^~~~~~~~~~
      |                              _q_futex

Fixes: QTBUG-96067
Change-Id: Ib6a9bcc496f37e69ac39362cb0a021fccaf311f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 035dc537bee26e3b63a211b2835d8560439e161f)
2021-09-02 18:27:41 +02:00
Edward Welbourne
87b5d77aea Fix corner case in QTimeZonePrivate::dataForLocalTime()
If the local time for which we want data is after the last known
transition, the two transitions we get to bracket it are the last
known and an invalid one. The code checked the former was valid, but
neglected to check the latter, leading to nonsense arithmetic later in
the function. In this situation we unequivocally want the last known
transition, so the problem is easily solved.

Fixes: QTBUG-96152
Change-Id: I6fc830ce538e8a572093cd8dfe832e10689bf904
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b656cea5deccab352b7c4c56d7023f5108578654)
2021-09-02 09:58:06 +02:00
ChunLin Wang
ef0f04d1da Fix QListView assert when the last row is moved in IconMode
After the last row is moved, 0 will be returned when obtaining
row and column data. At this time, QListView::doitemslayout will
not call d->doitemslayout, so the QBspTree data structure will
not be cleaned up, leaving a stale tree structure behind. This
will trigger an assert during paintEvent handling if QListView is
set to IconMode

In QListView::ListMode the test for a valid model index doesn't
use an assert.

Call QListViewPrivate::clear explicitly if the column count is 0
so that the QBspTree and other data structures are cleared.

Add a test case that simulates this scenario by implementing a
model that returns a 0 column count for an index after the model
structure was changed through a move of rows.

Done-with: Volker Hilsheimer
Fixes: QTBUG-95463
Change-Id: I36419be5459b8ced930c619f538482ea1db4ad03
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ca69e5aeef2fef540e687475ac00a4f332fdc5f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-01 16:03:26 +00:00
Luca Di Sera
eddf2adb29 Doc: Replace the example for QFileInfo::setFile
The example in the documentation of `QFileInfo::setFile` made no use
of `setFile` and only showed a use of `QDir::setCurrent`.

The example was replaced with a new example showing how `setFile`
changes the file that the information are retrieved from.

The old example was moved under the documentation for
`QDir::setCurrent` as it shows its working.

Fixes: QTBUG-87128
Change-Id: I8227876cfcb4d582040bda9b4b7f3f7debea1e07
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit a2abb0145174a8ed82572a06e537f550a6777b08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-28 07:41:23 +00:00
Shawn Rutledge
f906f1d1ce Fix deprecation of QMouseEvent::source() and flags()
Amends 53496e67f0b78645c6080e9218c7a36bc5a9d76d:
- move flags() out of the QT_DEPRECATED_SINCE block in the header
- add QT_DEPRECATED_SINCE block around source() implementation

Change-Id: Id52fa6b04a13efbede3e6ac440060f90b283e773
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ba8f9d8d92ba4fd9aaf6e0885b56b56e25acfc45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-27 18:31:30 +00:00
Giuseppe D'Angelo
626418ad13 QToolButton: reimplement the fix for QTBUG-95255
The code in 188d739400e10fc8571bbf2ec86d5cd338b04a5d uses a connect() to
a lambda, passing UniqueConnection to avoid establishing the connection
more than once. The problem is that UniqueConnection does not work
with lambdas; it works only with "regular" PMFs to QObject subclasses.

Re-do the same fix, but without a connection: use the checkStateSet()
virtual from the base class that will notify us if setChecked() is
being called on the tool button, and from there synchronize the state
of the default action.

Change-Id: Id512812c562cd6d20bc1a489753b33c269919d32
Fixes: QTBUG-95255
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c9830c2fb902f26dc8b2df61dfadc2d7a7d2b30e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-27 13:45:37 +00:00
Volker Hilsheimer
25b257d5fc QGraphicsProxyWidget: forward Window(De)Activate events
The nested widget might be a QGraphicsView as well (documented to be
supported), and QGraphicsScene maintains it's own activation status by
counting Window(De)Activate events. We need to make sure that the
embedded widget is informed about its activation status so that deeper
nested children can receive focus.

Forward WindowActivate/Deactivate events to the nested widget, which
will pass it on to all its children. Add test case, which without this
fix fails when verifying the inner scene's isActive state, or later
when testing that focusInEvent is delivered to the embedded widget.

Fixes: QTBUG-94091
Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 01aeb5f7e4fd977e9698fffdc7650897664ecb82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-26 21:20:50 +00:00
Volker Hilsheimer
c50313b712 Forward touchEvents to children inside QGraphicsProxyWidget
Just sending the event to the embedded widget is not enough, we
have to perform hit-testing for the different touch points, and
send the event to the child widget under the point. Fortunately,
QApplicationPrivate::translateRawTouchEvent provides the logic
that generates multiple events for groups of touch points.

Since that helper always sent events spontaneously, add an
optional parameter to allow sending of non-spontaneous events.

Add a test case that simulates touch events to different widget
configurations inside a QGraphicsProxyWidget.

Fixes: QTBUG-67819
Task-number: QTBUG-45737
Change-Id: Iffd5c84c64ee2ceadc7e31863675fdf227582c81
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 1ecf2212fae176b78c9951a37df9e33eb24d4f2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-26 14:14:32 +00:00
Alexandru Croitor
aaa79cf735 CMake: Fix automatic iOS bundle id extraction
If no Xcode preferences file was found,
_qt_internal_get_ios_bundle_identifier_prefix accidentally assigned
the error output of running PlistBuddy to the bundle id property.

That resulted in a bundle id called
'${team_id}.Doesn't Exist, Will Create: /Users/qt/Library/Preferences/com.apple.dt.Xcode.plist\n.app'

Check that the error variable is empty before assigning.

Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e

Task-number: QTBUG-95838
Change-Id: I3a7241528590ae3e9986cfa1f3e91ac983ef54f6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5a437d2590765a80236efad82e79654ebb3b4469)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-24 19:24:52 +00:00
Giuseppe D'Angelo
dfb1f8d293 Unicode: fix the grapheme clustering algorithm
An oversight in the code kept the algorithm in the GB11 state, even if
the codepoint that is being processed wouldn't allow for that (for
instance a sequence of ExtPic, Ext and Any).

Refactor the code of GB11/GB12/GB13 to deal with code points that break
the sequences (falling back to "normal" handling).

Add some manual tests; interestingly enough, the failing cases are not
covered by Unicode's tests, as we now pass the entire test suite.

Amends a794c5e287381bd056008b20ae55f9b1e0acf138.

Fixes: QTBUG-94951
Change-Id: If987d5ccf7c6b13de36d049b1b3d88a3c4b6dd00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d48058f1970a795afb4cedaae54dde7ca69cb252)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-24 14:27:26 +00:00
Eirik Aavitsland
136e5fc206 Painting: handle large and negative dash offset values
The mapping of the dash offset into the dash pattern was susceptible
to int overflow.

Change-Id: I254ed40b323ef516d10abc8e6008b14cfc23d2a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ca604964f651b71f2b2a45a65e741167f520b714)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-24 09:37:30 +00:00
Eirik Aavitsland
97a96c26dd QDashStroker: cap the number of repetitions of the pattern
Since the dashing is computed even outside the clipping and device
area, painting very long dashed lines could consume unexpected amounts
of time and resources. Fix by placing a limit on the dashing, and fall
back to solid line drawing if hit.

Fixes: QTBUG-95594
Change-Id: Ida05ecd8fe6df402c9e669206fd5cec4a9f5386a
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 279a434c1c8689f00b1ab8ed571f8732a803a7eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-24 09:37:21 +00:00
Eskil Abrahamsen Blomfeldt
52743057d4 Fix default line thickness for fonts
When we are unable to get the line thickness from a font, we
fall back to calculating this based on pixel size and weight.
But the font weight scale has changed in Qt 6, causing the
calculated font weight to be 10x as thick as it should.

This happened e.g. for Titillium Web, but only when using 100%
UI scaling, because the GDI engine was unable to get the correct
line thickness from the font, whereas the DirectWrite engine
succeeded.

[ChangeLog][Windows] Fixes an issue where underlines and other
decorations would be too thick for some fonts.

Fixes: QTBUG-94529
Change-Id: Id2c88f0a145776151be0399ee646f28b3bdf9072
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 1971250de5729386d2ac4ebb1b99c4b84d195a6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-23 15:49:17 +00:00
Assam Boudjelthia
538c7855e7 Android: guard getStateCount() with correct VERSION.SDK_INT
The call getStateCount() was introduced in 29, so cases for
lower API should be handled.

Change-Id: I7f58541c0b16fed91835e6f390afa89378a7af3e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 760e24e8676d52e2851ef8556770194a97eae831)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-23 12:40:00 +00:00
Zhang Hao
09cae81bf7 QLineEdit: account for the placeholderText when computing lineRect
If in a QLineEdit the placeholderText uses e.g. Tibetan language, then the
height of font as reported by QFontMetrics might be less than the height
of the boundingRect calculated for the placeholderText. This can cause the
placeholderText to display incompletely.

Fix this by using QFontMetrics::boundingRect instead of QFontMetrics::height
when computing lineRect.

Fixes: QTBUG-95341
Change-Id: I9eef35fd89c5c1d79f6dd703355634d6905ca967
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d2670601890a188e2d083460b6e65f9df1e8f6fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-23 12:39:59 +00:00
Martin Storsjö
6fc081a8d4 tst_QPluginLoader: Simplify creating a fake pointer in fakeplugin.cpp
When assigning multiple variables to a specific section, both GCC
and Clang legitimately error out if those variables wouldn't end
up in the same section (e.g. if one of them is going to a read-only
section while the other one is going to a read-write section).

In C++, when a seemingly const variable needs dynamic initialization,
it needs to be stored in a read-write section.

Clang 13 changed internals for how some constants are materialized.
Now, when a variable is initialized with an expression containing
plain old fashioned casts, it is considered to be potentially
runtime initialized (at the point when section assignment conflicts
is evaluated). Therefore, Clang 13 errors out on fakeplugin.cpp
with errors like:

    fakeplugin.cpp:36:39: error: 'message' causes a section type conflict with 'pluginSection'
    QT_PLUGIN_METADATA_SECTION const char message[] = "QTMETADATA";
                                          ^
    fakeplugin.cpp:32:40: note: declared here
    QT_PLUGIN_METADATA_SECTION void *const pluginSection = (void*)(0xc0ffeec0ffeeL);
                                           ^

See https://bugs.llvm.org/show_bug.cgi?id=51442 for discussion
on the matter in Clang.

To simplify things, just initialize the fake pointers as regular
uintptr_t instead, avoiding the whole matter. This produces the
exact same contents in the section as before.

For what it's worth, the actual manually constructed metadata in
fakeplugin.cpp doesn't seem to have any effect on running the
QPluginLoader tests on either ELF or MachO right now.

Change-Id: Ib84a2ceb20cb8e3a1bb5132a5715538e08049616
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 70df6052d8e651d0d84e026ca113c654e89c6cc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-20 19:20:09 +00:00
ChunLin Wang
f4093e0513 Fix QScroller::scrollTo failing in QGraphicsView with movable item
When forcing software scrolling through QScroller::scrollTo,
it will start from (0, 0). QGraphicsViewPrivate::canStartScrollingAt
should consider the locationof points, not just the flags of item.

Fixes: QTBUG-70255
Change-Id: Iebdd5568baa3bdb41c705204dadb2895cfe9c0e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9ba4c6beeff394d8526503b43ba471d82c27df9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-20 13:52:47 +00:00
Richard Moe Gustavsen
3283d6e816 QCocoaTheme: add ButtonText color to standard palette
The standard palette had no value set for ButtonText. The
result was the we drew button text in QtQuickControls2
using Text color instead, which would be wrong in dark
mode, and result in a dark color instead of white.

Note: Widgets hardcode the color "white" directly
in the mac style, and was not affected by the
missing value.

Fixes: QTBUG-89177
Change-Id: Ie2d99bfac9fcc70d45e5bd40ea45becf3fd70d87
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b7150d22c8ea6349b5d1fd61d5059e0fbe2745ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-20 13:52:47 +00:00
Eirik Aavitsland
14e7813f12 Improve lancelot test of dashed line painting
Add painting of sets of lines, both connected and unconnected, that go
outside the device area.

This prepares for fixes & improvements in the painting code.

Change-Id: I9cffc760524e9ade42362c9a04949270ac24180f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 587fe1a95ad2789c2f284fb1384f19b7f5b09917)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-20 11:50:36 +00:00
Volker Hilsheimer
91d53ba22e macOS: close popups on mousedown within the window frame
On macOS, we close active popups when handling mouse-down events in the
NSView, but not for such events in the window frame. This allows users
to close a window that has a context menu open via the window's close
button, which then leaves open popups behind.

Factor the popup-closing code out into a dedicated method that we can
call from within the NSWindow::sendEvent implementation for mouse down
events.

Fixes: QTBUG-30522
Change-Id: I9c354efc449cfefff3ed84fa34b1cd8a0da3b4a7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 70b94eea10d7af83cced09296755a8af28e167b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-19 23:49:22 +00:00
Edward Welbourne
e0e64df0de Attempt to unwedge tst_QThread::wait3_slowDestructor()
When the test failed, it never released the blocking slot, so the
tested thread remained blocked indefinitely. Blacklisting doesn't
rescue that: the test run gets killed by Coin's watchdog.

Use a QScopeGuard() to release the clocked slot on failure.
replacing the release that was happening only on success.

As drive-by clean-up, smarten up the code a little and remove an
unused enum.

Change-Id: Ie035dafe6e4b1d82aea5de38ceb31c0f7fcf81d7
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 2684deaf26e7c7af1ac504f562231a4cc4fbd733)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-19 14:24:04 +00:00
Edward Welbourne
ff344e647f Use a scope-guard to take care of process deletion in a test
Doing the deletion at the end of the block only works if the test
passes. Drive-by: remove spurious braces from single-line bodies of
single-line controls. The QTest macros are done properly.

Change-Id: I83002547dba49ab9792f4db44d73151b1c036900
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 4ccbd751f1eee5c27ce5d4c9868d65092630d991)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-19 14:24:04 +00:00
Eskil Abrahamsen Blomfeldt
6a2b565b5b Fix bug with NoFontMerging when font does not support script
When using NoFontMerging, no fallbacks should be resolved. If the
font does not support a specific character in the text, we should
display a box instead of merging it with another font.

But in practice, Qt would still apply the fallback mechanism for
one specific case: If the font itself does not support the script
of the text, we would get no match and do a search for a fallback
instead. Since NoFontMerging is set, we would then force this
as preresolved for *all* scripts in the QFont's private data
(logically, the match should only have a single response for
NoFontMerging).

The end result was that if you set the font family before updating
the text, you would get broken rendering. This can happen e.g. in
Qt Quick, where you could update the font family of a text label
while it contains characters which are not supported by the new
font. Qt would then pick a fallback instead. When you subsequently
update the text, the fallback would already be preresolved for
whatever script this is. If it does not support the updated text,
we would then see boxes, even if the requested font actually would
have supported it.

The fix is simply to do an additional pass if NoFontMerging is set
and we were not able to match with the specified script. Since
the same family might be available in different foundries, with
different writing system support, we still want to do a pass first
to see if we can match the exact script of the text.

Note that QRawFont::fromFont() exploited the bug by using
NoFontMerging for getting the fallback font for a specific
writing system. To keep this working without having to rewrite
fromFont() and risk introducing regressions, we add an argument
to make the findFont() function behave as before. It isn't
super-pretty, but since it is private API it is hopefully fine.

[ChangeLog][QtGui][Text] Fixed an issue with NoFontMerging and
changing font families dynamically, where boxes would be seen in
place of the correct text.

Done-with: Andy Shaw
Fixes: QTBUG-81770
Change-Id: Ide9a36d7528a1040172c5864fa99e7a82eac4e83
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 43a63901f4eb61ad8a29f4cc7a1700685f88ec35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-19 14:24:04 +00:00
Giuseppe D'Angelo
eb14ce098c QRegularExpression: fix matching over null/empty QString(View)
An empty QString(View) is allowed to have nullptr as its data pointer
(of course, only if its size is 0). This wasn't properly
checked in QRegularExpression, which passed such nullptr to
PCRE, and that resulted in PCRE raising an error (PCRE_ERROR_NULL).
Detect this case and pass a dummy pointer to keep PCRE happy.

Fixing and testing this in turn exposed a problem with QStringView
support in QRegularExpression when used over a null QString: the
code is supposed to use the QStringView(QString) constructor and NOT
qToStringViewIgnoringNull. That's because QRE distinguishes null
and empty subjects; when using qToStringViewIgnoringNull over
a null QString, one gets a non-null QStringView (!). Again, this in
turn exposed a problem with a QRegularExpression autotest that assumed
that a null match could only mean "no match" (instead, it can happen at
position 0 of a null QString(View)).

Change-Id: Ifb3cf14dec42ce76fcdbcb07ea1d80784d52ef65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f0d1f50e0294e5a55a0e450993e0810bd4dbf63d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-19 10:06:44 +00:00
Sona Kurazyan
bcc7a9dd7a QtConcurrent: fix examples of overloaded methods in docs
Wrap the overloaded methods in qOverload(), to make the examples
compile.

Also remove the extra whitespaces when declaring nested templates.

Change-Id: If438caa6d705d9036dae45278fb26e080918da89
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8aefbe67bf445d51f41c16ec00bc5ce3ec18ded5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 21:42:50 +00:00
Laszlo Agocs
88373a370a rhi: metal: Make base vertex and instance support optional
Like we do for OpenGL. Conveniently enough the QRhi feature flags are
readily available.

This should prevent errors such as:

MTLValidateFeatureSupport:3901: failed assertion `Base Vertex Instance
Drawing is not supported on this device'

on the iOS Simulator. It is not clear since which version or SDK this
became a fatal problem, but the base vertex/instance support is indeed
an optional feature according to the Metal Feature set tables, so not
calling the drawIndexedPrimitives variant taking baseVertex and
baseInstance when the reported iOS GPU family is too low is the right
thing to do regardless.

Fixes: QTBUG-95795
Change-Id: I47c54a77a66a0410b86b8d4e5a1863dc730490f4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 213755a86622ae8b3ed3d7ad34a6aecd051b2b03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 21:42:49 +00:00
Luca Di Sera
c9c545eb4c Doc: Add missing links to methods to QSet documentation page
Some internal links to `QSet` methods were missing from the
documentation. In particular, all methods that were written with one
attribute.

It seems that QDoc might automatically recognize method/function
links only if they have zero parameters, such that the identifier is
followed by `()` directly.

To avoid this problem while keeping the current parameter-containing
form of the text; each function of the form `functioname(\a
parametername)` was changed to `\l {functionname()} {functioname(\a
parametername)}.

Furthermore, one of those text instances was modified to use `\a` for
the parameter name, instead of the previously used `\e`, to enhance
consistency.

An instance of `operator<<()` was not recognized as a link.
To resolve this it was marked with the `\l` command.

Fixes: QTBUG-95389
Change-Id: I16b2a7a2fbaf4785c2c6bfa5017a3db46d9db2f4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit fd86939eaf73c5e58e12b7eb2cd0563c03d33ba9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 21:42:49 +00:00
Volker Hilsheimer
6caa4e3aa0 QTabBar: don't overwrite data, fix refactoring error for vertical tabs
Amends 359616066e64eed947c6c91cb8902285ed79dd0d, which incorrectly
changed

-            tabList[i].minRect = QRect(0, miny, sz.width(), sz.height());
+            tab->data = QRect(0, miny, sz.width(), sz.height());

in the code laying out verticals tabs (correct done for the horizontal
case).

Since QDockWidget uses the user data for tabs to maintain the mapping
between tabs and dock widget, this broke the layout logic.

Fixes: QTBUG-95841
Change-Id: Ie785e1205b426bbc4954b965f619f4c603490f76
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 7188e650775ffd2bf4f2574094b6472c86468fba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 17:27:42 +00:00
Sona Kurazyan
4d94255149 QtConcurrent::run: support non default-constructible return types
The QtConcurrent::RunFunctionTask class keeps a variable to store the
result of QtConcurrent::run when it becomes available, so that it can be
reported afterwards. This requires the result type to be
default-constructible. However there's no need in storing the result, it
can be reported immediately after it becomes available.

Fixes: QTBUG-95214
Change-Id: I95f3dbff0ab41eaa81b104a8834b37d10a0d193a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 642b9fce81b46e23b35b17e8284bd81bdba57fdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 17:16:40 +00:00
Kai Köhne
89760e0115 Pick up *Tools components also from host Qt
Let find_package(Qt6 COMPONENTS LinguistTools) for a cross-compiled
Qt fall back to search LinguistTools in the host Qt.

Use the same trick as in QtModuleDependencies.cmake: Prepend both
CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH with the QT_HOST_PATH
(respective ${QT_HOST_PATH}/lib/cmake).

Furthermore adding ${QT_HOST_PATH}/lib/cmake to PATHS argument
makes sure that find_package will work even with NO_DEFAULT_PATH.

Make sure not to match ShaderTools and Tools packages.
ShaderTools is the cross-compiled package, the host package name is
ShaderToolsTools.
Tools is the cross-compiled module from qttools.

Allow an opt out via a QT_NO_FIND_HOST_TOOLS_PATH_MANIPULATION
variable in case that we accidentally match more packages ending in
Tools that are actually cross-compiled packages.

Fixes: QTBUG-95602
Change-Id: Ib0a787716fa529e36f22356da069e705d9eed5fa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d2359b2d4e5db6c42158d536d6e2a2af5ea1e59c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 16:38:27 +00:00
Marc Mutz
7b47e68089 QVarLengthArray: add missing default-ctor documentation
Was lost when we un-explicit'ed the default ctor in
c34242c679aaea6ee1badf6c1e5f274f925f5f50.

Change-Id: Ifb4943b9e9647ae59c1cc6d5fc5076e8620b73ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 874c8c56a4883383e49a1e59262113f8eb29486f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-18 16:16:02 +00:00
Tor Arne Vestbø
d3ac94e2b7 macOS: Don't wipe NSWindowStyleMaskFullSizeContentView if set manually
The NSWindow may have style masks set by the user via winId(). We don't
want to wipe those just because we're recomputing the style mask.

Fixes: QTBUG-69975
Change-Id: Ibca8388d45b623f4cdfaff4b256c4eb012e2ffac
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d627d351bedb96c727aa6e3b7cb2cc2d678c5606)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-17 10:20:33 +00:00
Assam Boudjelthia
5b0c1561ad Fix Style java code format and warnings
The code had many bad formating and syntax or API usage warnings,
as well as some unused methods or classes which are fixed with this
patch.

Task-number: QTBUG-71590
Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit dc9075554135160bb07aa54708aba69d127160e2)
2021-08-17 07:42:59 +00:00
Alexandru Croitor
4d0db58c20 CMake: Replace usage of WIN32 with CMAKE_HOST_WIN32 in qconfig.cpp
The workaround of adding a drive letter to
QT_CONFIGURE_PREFIX_PATH_STR should be done when running on any
Windows host, not only when targeting Windows.

Amends 59c3be711728ab0aa644bfdf50e91a1b020f95bb

Task-number: QTBUG-87580
Change-Id: Ic6ca50aa58a4a54fb483e90fe61a907fe86cb002
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6ef3d070a8bad0cfba98fa241a8676401f21371f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-17 02:29:14 +00:00
Volker Hilsheimer
e8add0a655 Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidget
For high-precision wheel scrolling sequences, the widget that gets
the first (typically ScrollBegin) event grabs the wheel. Qt directs
all future wheel events within the same sequence (i.e. until ScrollEnd)
to that widget.

QGraphicsView passes wheel events through to the item under the mouse,
and QGraphicsProxyWidget implements wheelEvent to forward a synthesized
QWheelEvent to the embedded widget. Since QGraphicsView's viewport has
already grabbed the wheel, any forwarded event would end up back in
QGraphicsView, resulting in infinite recursion (if the assert doesn't
fail first in debug builds).

The correct fix requires that QGraphicsProxyWidget knows that this is
a high-precision wheel event, allowing it to adjust the wheel grabber
temporarily to the embedded widget. However, QGraphicsSceneWheelEvent
doesn't provide this information.

To fix the infinite recursion, mark the generated event as synthesized
by Qt (but still send it spontaneously to enable propagarion within
the proxy widget hierarchy). In QApplication's notification routine,
interpret such events then to override the wheel grabber.

Add a test case for the various scenarios. This 6.1 compatible fix
does not pass all situations. A follow up commit that introduces the
missing APIs to QGraphicsSceneWheelEvent then fixes those as well.

Task-number: QTBUG-95552
Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4982c872efef7ce8673ed257dce24b971e456a08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-17 02:29:14 +00:00
Volker Hilsheimer
e510a6eefa Accept the QWheelEvent before each propagation step
Input events in Qt are accepted when constructed, and ignored by the
default event handler (so overriding the event handler is enough to
accept an event).

Since we use the same QWheelEvent instance for each propagation step,
we need to reset the event to be accepted before each delivery so that
an earlier child ignoring the event doesn't result in the event being
ignored without explicit acceptance.

Amends the refactoring of wheel event delivery in
92df790f46b3a8b17aec2f385d6472fd3f8647f6.

Task-number: QTBUG-95552
Task-number: QTBUG-79102
Task-number: QTBUG-67032
Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 1653ae13db69a2e703a1b44d3e67b55e927a5eca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-17 02:29:14 +00:00
Tor Arne Vestbø
f4fc178316 macOS: Don't treat null-key as potential shortcut key
When mapping virtual keys and modifiers to their corresponding characters
via a keyboard layout we may hit combinations that do not produce any
characters. This can happen if there's no <key> element defined for the
virtual key, or if the output attribute of the element is empty (despite
the spec saying there should always be one UTF-16 code point in the output).

 https://developer.apple.com/library/archive/technotes/tn2056/_index.html

When that happens QAppleKeyMapper::keyMapForKey() will map the combination
to a null-QChar, resulting in the "key" being 0. We do not want to propagate
this back to the QShortcutMap machinery, as QShortcutMap does not validate
the keys coming out of QKeyMapper::possibleKeys(). In particular, it doesn't
check the isEmpty() or count() of the QKeySequences it creates. And even if
it did, QKeySequence itself seems to treat Qt::Key(0) + Qt::SomeModifier
as a non-empty sequence, so passing on 0-keys would still give weird bugs.

The user-visible result of passing back 0-keys is that QShortcutMap will
treat it as a partial match for any incoming key combination (as long as
some modifier is pressed that triggers the QShortcutMap machinery), which
resulting in eating the key press. This compounded the issue in QTBUG-95471.

Regression after fab3dfff7d53d496a31c5d2df972ddacfe861a4d.

Task-number: QTBUG-95471
Change-Id: I2e51ec86f4df2a708e1757be827ab74859be3c8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 99a4419647df14bf81d1837d22c9636957fd6257)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-16 22:42:27 +00:00
Tor Arne Vestbø
225105185d macOS: Map dead keys directly to their terminator when building key map
When a key press comes in we may end up in QAppleKeyMapper::possibleKeys()
as part of checking whether the key press should trigger a QShortcut.
The function builds on QAppleKeyMapper::keyMapForKey(), which provides
a map from the given virtual key to all the possible Qt::Keys that can
be produced by applying different modifier key combinations.

The map is built using the Carbon function UCKeyTranslate, that takes
the current keyboard layout, virtual key, and modifiers, and produces
the resulting characters. The function also maintains a running dead
key state via one of the arguments. When mapping a dead key, the state
variable will be updated to the current dead key state, which then
affects the next call to the function (for the next key press).

The problem is that we're not calling UCKeyTranslate for each key press.
We are calling it in a loop, for a single key press, to build up a map
of all the possible characters produced by varying the modifier keys.
And in doing so, we are passing on the dead key state from one call
to the next, even if these are for different modifiers. The result is
that the first call, for the dead key, results in mapping to \0, as
UCKeyTranslate produces no output, it only modifies the dead key state.
And then the next call, for the next modifier key combination, results
in mapping to a character that incorrectly incorporates the dead key
state (resetting it in the process).

What we really want is to directly map the initial modifier combination
to the dead key terminator character, if one is defined. This is the
character produced if the dead key state is cancelled, for example by
pressing a key that's not defined in the dead key state.

To achieve this we pass kUCKeyTranslateNoDeadKeysMask as the translate
options to UCKeyTranslate, and always reset the dead key state before
every call. Another common way to achieve the same result would be to
call UCKeyTranslate a second time when detecting that the first call
produced a dead key state, for example with a synthetic space key, to
trigger the terminator output. But this can potentially fail if the
space key actually has a defined output in the dead key state.

Fixes: QTBUG-95471
Change-Id: Icdae7639fd9a641a86c9d6615679bd93d380ff5c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 853c350cca4e00d2f890672ad8144a55ad75541e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-16 22:42:25 +00:00
Cathy Park
f7550a4bc4 Fix button type to update coordinates when dragging
A move position (x,y) can be delivered to the MouseArea only if
button is Qt::NoButton during mouse move (dragging). Otherwise
mouse move does not cause positionChanged in MouseArea.

Task-number: QTBUG-95453
Change-Id: I298943dc4f6f30714e940f4029c62dd52c176b93
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3727683bd5f57666926603b84bccdf24d3839c98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-16 12:45:33 +00:00
Assam Boudjelthia
0c8dcb4b11 Fix hidden API access for Android style
Use public API and attributes to retrieve part of the Android
style values instead of using reflection to access hidden or
private fields. This latter method, was throwing lots of warnings
or exceptions at the start of apps making it big annoyance to deal
with.

This patch doesn't handle drawables though, so the "full" and
"default" Android style will be somehow broken still for now.
For that reason, the default style extraction method is set to
minimal to avoid getting warnings about it, and Fusion style
could be used for Widgets apps, and for QML apps, it's recommended
to use the Material style from Quick Controls 2.

Task-number: QTBUG-71590
Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit b5b9c264ddff6c6eebb08038d9d3f2282df5c0ec)
2021-08-13 09:26:47 +00:00
Nico Vertriest
4bcc6bdd4a Doc: Ensure deprecated APIs in Qt Sql are documented as such
Added \deprecated where needed

Fixes: QTBUG-94585
Change-Id: Id6d1fee1bbb6f8194e90a494673edef34530482b
(cherry picked from commit fbf836657f06f2f302aaaf6bb6416f19d979f2aa)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-13 06:33:05 +00:00
Volker Hilsheimer
93b2535256 StyleSheet: Use rule for ComboBox in embedded QLineEdit
An editable combobox uses an embedded QLineEdit as an implementation
detail. That lineedit should use the rules that are set for the combobox
to render itself, similar to what was already implemented for the lineedit
used in a QAbstractSpinBox.

The containerWidget helper function provides the logic for identifying
the container of the rendered widget, returning the QAbstractSpinBox or
the QComboBox for an embedded QLineEdit. Use that method rather than
duplicating the logic.

Fixes: QTBUG-95631
Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit adafa5ee1f37739f33f6417f27c8ee7308aaad9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-12 13:01:59 +00:00
Nico Vertriest
de0c62421a Doc: Ensure deprecated APIs in Gui are documented as such
Fixes: QTBUG-94521
Fixes: QTBUG-95310
Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5
(cherry picked from commit 111115bf8862b7cd1197c2ef8a4b475c882776d4)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-12 12:30:49 +02:00
Alexandru Croitor
610a375710 CMake: Warn when using CMake 3.21.0 due to issue in AUTOMOC/AUTOUIC
There can be cases where trying to incrementally rebuild an already
built Qt will cause a ninja dependency cycle error due to incorrect
dependency information created by AUTOMOC and AUTOUIC.

Example error when building qtscxml tests

ninja: error: dependency cycle:
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp
->
auto/scxmlcoutput/default/ids1.h ->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen ->
auto/scxmlcoutput/default/CMakeFiles/tst_scxmlcoutput_default_autogen
->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp

Example error when building Qt Creator

ninja: error: dependency cycle:
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h ->
src/shared/help/shared_help_autogen/timestamp ->
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h

Warn and advise to use a different CMake version instead.

Change-Id: I6f529ba6a526663bc6ed699b1bfe8a9094129887
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 06c2400f5d439ce1f1945833d9b1895eff843855)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-11 19:04:06 +00:00
Robert Löhning
77672e6c16 Fix memory leak if eXIf has incorrect crc
Change eb6767 from upstream repo.

Fixes oss-fuzz issue 23376.

[ChangeLog][Third-Party Code][libpng] Fix for possible memory leak in
libpng was backported.

Change-Id: Id0c2f8b8bd60438ae8b5a61c83b6e50d55c6eb65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 76e2409cc908d1fa6ee6c7ff61b699594244bf6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 22:15:53 +00:00
Timur Pocheptsov
d2afb5bdd3 tst_QSslSocket - replace an old certificate
Helped quite a lot with OpenSSL 3 not accepting some old algorithms.

Task-number: QTBUG-95123
Change-Id: If4894fa86eba7b002465fa661d436ae6ea751989
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 33de5f6502254ffe51960714404b6330dab224d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:58:17 +00:00
Liang Qi
bc60541d9f xcb: add a timeout control when reading INCR property
For the first call of QXcbClipboard::clipboardReadProperty()
inside of clipboardReadIncrementalProperty() in getSelection(),
it will get a XCB_NONE reply before the contents arrived via
property change. Then we give a chance to read more.

Manually tested with following setups:
* examples/widgets/mainwindows/application with gvim(gtk3)
* examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on
gtk2) and GIMP 2.99.6(based on gtk3 via flatpak)

Fixes: QTBUG-56595
Done-With: JiDe Zhang <zhangjide@uniontech.com>
Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 02248eea5562c1df39ee23f195011afacc6759b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:58:17 +00:00
Tianlu Shao
d692bb4a84 QCompleter: QCompleter unexpectedly changes QLineEdit text
When qcompleter and qlineedit are used together, the currentcompletion()
of qcompleter is its first item by default. Therefore, when qlineedit
makes the initial value, then selects the text and enters, qcompleter
will modify the default first item to qlineedit text. The judgment that
completionprefix() of the completer is not empty is modified and added
here, because completionprefix() is always empty when there is no match.

Fixes: QTBUG-20894
Change-Id: Id47f7f4da0a93d03a4e7b056ec731615b0803d13
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tianlu Shao <shaotianlu@uniontech.com>
(cherry picked from commit 0ef190fcc429405200d9f6063851726fcfb75637)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:58:17 +00:00
Alexandru Croitor
09838d9cbd CMake: Fix build with CMake master / 3.22
CMake master / 3.22 introduced a behavior change in how conditions are
evaluated in the while command. It is now consistent with how if()
evaluates conditions.

This caused an issue in Qt code where a "(" opening parenthesis was
evaluated as part of the condition rather than as a string.

Fix this by wrapping the evaluation of the variable in quotes.

Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
(cherry picked from commit eb2282605734152440e840777d1f8a0576e3c7a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:58:17 +00:00
Sona Kurazyan
2c5de45781 Improve docs for QFuture continuations
Replace phrases like "future has been running", "parent" with more
precise descriptions.

Fixes: QTBUG-95273
Change-Id: Ibd5a464007d41cc437da49ba250b9ea0a46078c6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d61820e5ab3176818b8a2326fa25d05a9f135244)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:58:17 +00:00
Eirik Aavitsland
851ed7cd3f Refix for avoiding huge number of tiny dashes
Previous fix hit too widely so some valid horizontal and vertical
lines were affected; the root problem being that such lines have an
empty control point rect (width or height is 0). Fix by caculating in
the pen width.

Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 84aba80944a2e1c3058d7a1372e0e66676411884)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 10:00:28 +00:00
Tor Arne Vestbø
6f34bf0d67 macOS: Fix leaked NSMutableArray in applicationActivationChanged
The +[NSObject new] method is a combination of alloc and init.

Fixes: QTBUG-95619
Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ab70aa362ee5dd5b1375b198dcd6d6445ab2daeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-08 15:22:16 +00:00
Timur Pocheptsov
8ccfdfbf98 tst_QSslCertificate::verify - remove QSKIP
And re-generate certificates.

Fixes: QTBUG-95429
Change-Id: Id970a0a9315d146d6dd1e66c9cff9b7d75657e2d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e7ab17ade170a8fbc5061fffe5334b26cdc54ed3)
2021-08-06 18:48:13 +02:00
Marc Mutz
e0c6f50849 QXpmHandler: actually limit characters-per-pixel to four
The following code assumed, and all comments indicated, that the cpp
variable was limited to a max of 4. Yet, as coded, cpp could be five,
in which case the XPM would be corrupt, as the header suggested five
characters-per-pixel while the data was formatted in only four.

Add a warning and error out when we encounter this situation.

[ChangeLog][QtGui][QImage] Instead of writing a corrupt file, rejects
to write XPM files with more than 64^4 colors (more than four
characters per pixel) now.

Change-Id: I458873cf7d179ab2e2dacd4c17dc837d640591a9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 71334c324e702c434d446e5fc329294c97b8516d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-06 11:50:50 +00:00
Marc Mutz
36760514a9 QXpmHandler: fix re-entrancy bug in xpm_color_name
The xpm_color_name() function returned a pointer to a function-static
buffer. This is infamously non-reentrant, and an actual problem,
because we explicitly allow QImage operations (incl. saving to an
.xpm) from non-GUI-threads.

Fix by using the CSS pattern (Caller-Supplied Storage; also used in
the QAnyStringView(char32_t) and QAnyStringView(QStringBuilder) ctors)
to force the caller to allocate storage in its own stack frame. As a
consequence, we re-gain re-entrancy, but the returned pointer is now
only valid until the end of the full-expression, which necessitated
simplifying one caller (sorry!).

To see why said simplification is valid, observe that xpm_color_name()
writes a (now-explicit) NUL into returnable[cpp] and the old code read
max(cpp, 4) characters from xpm_color_name()'s result.

NB: cpp can be 5, even though the code comments say otherwise! :(

[ChangeLog][QtGui][QImage] Fixed a race condition when concurrently
writing .xpm files.

Change-Id: I36d7173d53839a52f5cdf58324474c1b32c71f33
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 73fabadcee71af858388fb245fccf4e96d4ead4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-05 04:33:20 +00:00
Mårten Nordheim
aa23eb493c QLibraryInfo: Add MSVC 2022
Change-Id: Ie66effde6832152ee2903c467269a2822ded6653
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 11476e5403c0f0ed997f0ecc9e5a82501441a667)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-04 23:16:33 +00:00
Giuseppe D'Angelo
bc904c8524 QFileSystemModel: cache the name filters regexps
In order to filter out file names based on the user's settings,
QFileSystemModel used to have a loop that tested if a given file
name matched one of the filters. The problem is that each filter
(a wildcard) was converted to a QRegularExpression _inside_ the loop.
This causes a quadratic behavior (number of files * number of filters).

Instead, build the regexps once when the filters are set (or the case
sensitivity is changed, as that affects the filtering), and simply
_use_ them in the loop.

Simplify and correct some related code as a drive by.

Done-with: Jean-Michaël Celerier
Fixes: QTBUG-95383
Change-Id: I6bc336364c145bb05793a8f867545d7715d35832
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 07057188e3e42246cf006b43963d0bdcdaa159f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-04 12:03:30 +00:00
Timur Pocheptsov
216488231e doCrypt() - check the error codes
Disabled (moved into the legacy provider) DES-CBC results in a crash,
when setting key length.

Change-Id: Ie0b49424f11d8042ebecebfd3b6346263f730551
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b4942f7f0c56f2c5dcd783760a8c915463e8e744)
2021-08-03 09:30:53 +02:00
Andy Shaw
31afbef68c Allow dragging of a floating dockwidget on macOS with a custom titlebar
This amends 3224c6d7d150164241c13ccf7d47377a39c0a6bb to account for the
case when the dockwidget is already floating.

Task-number: QTBUG-70137
Change-Id: If8b345565b11b44beb3fb4b697cfe812c29c6396
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ba3e1fe09b7d921985e21d857a1d566465095e69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-02 17:06:20 +00:00
Tor Arne Vestbø
a609761b71 macOS: Stop relying on balanced CGDisplay reconfiguration callbacks
We were using CGDisplay callbacks to determine when a screen reconfiguration
had happened, and when it had propagated to changes in NSScreen.screens,
so that we could update our QScreen view of the world.

Unfortunately the CGDisplay callbacks were not deterministic enough to
use as a signal for when a reconfigure had completed.

Since we can't rely on NSApplicationDidChangeScreenParametersNotification
either (it comes in too late), we're now resorting to updating our QScreens
at every chance we get:

 - On every CGDisplay reconfiguration ending
 - On QCocoaWindow::windowDidChangeScreen() as a result of AppKit
   moving the window.
 - On NSApplicationDidChangeScreenParametersNotification
 - On QCocoaScreen::get() as a last resort

Since the result of these updates are only reflected as QScreen property
updates or QGuiApplication signals if a change actually occurred, it should
be safe to update early and often.

Task-number: QTBUG-77656
Fixes: QTBUG-80193
Change-Id: I98334a66767736d94ad2fcb169e65f0d8bc71a30
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 6e250179229ebe7e2a056ba0e363592f4d1f6972)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-02 12:16:36 +00:00
Jani Heikkinen
89872d0852 Bump version
Change-Id: I2ba0fdc4eb1259c623eeaf6014a71fa9dcc46439
2021-08-02 11:49:35 +03:00
Alex Trotsenko
d3b5c3c964 QLocalSocket: do not emit aboutToClose() twice
This signal is emitted by the QIODevice itself, so we don't have to
forward it from the internal socket.

Change-Id: I85745f36d7a27d92f339a9184de3b6e5d46f6f34
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 21f3ff65b8df777b5726a68b09bbee39f1a893ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-01 14:53:22 +00:00
Alex Trotsenko
ccb0792a24 QIODevice: fix converting OpenMode flag in debug output
Suppress error:

src\corelib\io\qiodevice.cpp(791): error C2440:
 '<function-style-cast>': cannot convert from 'QIODeviceBase::OpenMode'
  to 'quint32'

Change-Id: I6b6e94790942d3af62bc2f38afad97c0b3c80817
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 6e3897b9fa0e03c8fbb1e97341fd4109c5a31658)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-31 15:01:23 +00:00
Ivan Solovev
5f7b48fd0f Fix QString test compilation without QRegularExpression
The QString itself can be compiled without QRegularExpression, but
the tests do not check if they are supported or not.
This patch fixes the issue by introducing the proper #ifdef guards.

Task-number: QTBUG-91736
Change-Id: I797691f78a34d4f78a86af99c78bf06e26e846d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 59df5dacd55b607ec1b59864cfcc8ab86d38d537)
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-07-30 10:06:51 +02:00
Ivan Solovev
70dabe6bff QByteArray: extend unit tests
This patch introduces some test improvements to check the calls of
different methods on an empty default-constructed string.
Apart from that, many other tests are added to extend code coverage.

Task-number: QTBUG-91736
Change-Id: If86ef3d8611a678798b1bcc60a1a4f5598fd2179
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 08a1bcfa9b6672d0b71f5b3de0d6c58a8f549ea1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-29 13:00:54 +00:00
Ivan Solovev
69461206c9 QByteArray: fix indexOf/lastIndexOf
This patch fixed two bugs in indexOf/lastIndexOf:
1. The lastIndexOf(char, qsizetype) overload was crashing with an empty
   QByteArray. It was unconditionally calling lastIndexOfCharHelper()
   which assumes that this QBA is not empty. An explicit check for
   the empty case is added.
2. The indexOf(QByteArray, qsizetype) overload was behaving incorrectly
   while searching for an empty QByteArray. In this case it
   unconditionally returned its second parameter (from). However, from
   can be negative, or even exceed the size of this QByteArray. This
   patch handles this cases properly.

As a drive-by: this patch adjusts the QByteArray::indexOf(char, qsizetype)
and QByteArray::lastIndexOf(char, qsizetype) overloads to match with the
QByteArrayView implementation. This is done to have similar code paths
in both cases and avoid tricky bugs in future.
Ideally we had to adjust the QByteArrayView implementation, but it's
fully inline, so can't be changed without breaking BC.

Task-number: QTBUG-91736
Change-Id: Iaef2fdc5b99cce6aa342cca2d17544a1ad7ca677
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e150bcfe4d5514b2a2960234049c514bc558adee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-29 13:00:45 +00:00
Timur Pocheptsov
3267f4e9fc tst_QSslCertificate::verify - skip auto-test
as a temporary fix for suddenly expired certificates situation (to
be regenerated).

Task-number: QTBUG-95429
Change-Id: I00ad11cfd8824eeeffa2991dfcda6a7899726953
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8d0e4a2e5c3627e2fd88f14ccc8b349668012685)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-29 10:36:25 +02:00
Alexander Volkov
a25e184478 Doc: Fix typo Ctr -> Ctrl
Change-Id: I89c9526aa74b312dd67a6d194395b3298bbc31fe
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0a8aa8c23e84ef5918dda15a9af9d582d5bfd9a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-28 18:49:14 +00:00
Nicolas Fella
99c6aae8b4 [qgenericunixservices] Consider kde-open5 for opening URLs
When xdg-open is not found the KDE-specific kfmclient is considered.
That however is part of Konqueror and may not be present as well.
Plasma offers another option, kde-open5, which should be considered
before falling back to webbrowsers.
This is particularly for non-http URLs like tel: where opening in a
webbrowser is not wanted.

Change-Id: I2b606562e21568fbe43f4593de67a1d467918cc4
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 74a91773afa395ee0cefcdcd25bb3947b60a0b63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-28 14:37:20 +00:00
Ivan Solovev
448674a68d QHash/QSet: fix squeeze() for default-constructed container
QHash::squeeze() was unconditionally calling reserve(0), which is
always allocating memory (even for 0 size).
This was leading to a confusing situation when calling squeeze() on
a default-constructed container with 0 capacity() actually allocated
memory. This is very misleading, as squeeze() is supposed to free
unneeded memory, not to allocate more.

This patch adds a check for non-zero capacity. As a result, nothing
is done for default-constructed container.

Note that this patch also affects the QSet::squeeze() behavior, because
QSet uses QHash as its underlying data type.

Task-number: QTBUG-91736
Change-Id: Ib1c3c8b7b3de6ddeefea0e70b1ec71803e8fd3b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit b095d268788343b67a3995db7148dcc3af9bde1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-27 21:30:18 +00:00
Sona Kurazyan
d54f9df1bd Don't report results when the results list is empty
When inserting items into the result store, a ResultItem is created,
which stores a pointer to the results list and their size. If the size
of the ResultItem is set to 0, it means that a single result is stored.
In case of trying to report results via an empty list, the size is 0, so
result store treats it as a single result.

Added checks before storing the results to make sure that the result
list isn't empty. Note that empty lists are allowed in some cases for
the filter mode, because ResultStoreBase::addResults() knows how to
handle those cases correctly.

Task-number: QTBUG-80957
Change-Id: I399af4c3eef6adf82fea5df031fe9a9075006b1f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 08de1fb28153d8170b592796a84032897afa4206)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-27 18:25:44 +00:00
Eirik Aavitsland
1ca02cf287 Improve fix for avoiding huge number of tiny dashes
Some pathological cases were not caught by the previous fix.

Fixes: QTBUG-95239
Change-Id: I0337ee3923ff93ccb36c4d7b810a9c0667354cc5
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 6b400e3147dcfd8cc3a393ace1bd118c93762e0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-27 16:11:59 +00:00
Marc Mutz
84e1fa3800 QCryptographicHash test: remove the moreThan4GiBOfData(SHA512) check from the CI
It timed out the other day on the CI. Even the SHA-1 check took 137s
(with a 300s timeout). Skip the SHA-512 test on the CI, but keep it
for manual runs.

Change-Id: I49792ac9bcab6512e1803f66cd986b2830e634c0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c6e092a5f84b7fc72556897b50c7697152967925)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-27 18:11:59 +02:00
André de la Rocha
3bc70954ee Windows QPA: Fix coordinates reported through UI Automation
Conversion to/from native screen coordinates was incorrect and could
fail for non-primary screens. This could cause a control's bounding
rectangle to be incorrectly reported, or a search for a control based
on its position within the window to fail, causing incorrect behavior
with accessibility tools and other software interacting with the
application using UI Automation.

Fixes: QTBUG-91459
Change-Id: I5d56584ff26d977cdd34d35af46644e32aa11e7c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 0235c0217883bc9d0ca83c7533e9c0286901bb3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-27 13:54:25 +00:00
Ivan Solovev
03b3969521 QVarLengthArray: extend unit tests
This patch introduces some test improvements to check the calls of
different methods on an empty default-constructed container.
Apart from that, many other tests are added to extend code coverage.

Task-number: QTBUG-91736
Change-Id: Icc1f1342738603c9bed065b2a36c72ea60b48962
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 7d49dc2222ddfd442face88c2243e28f5d26165f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-27 13:54:25 +00:00
Marc Mutz
3fa9c19481 QCryptographicHash: don't present the same data over and over again
Need to decrement 'remaining' (check), but also increment data (meep).

Testing is a bit complicated, as most algorithms are just too slow to
fit into the 5min QTestLib timeout.  Picked the fast ones and Sha512
(which completes here in < 17s, with threads), at least.

Amends e12577b56396cca0df05f88f8787706a3a12c82d.

[ChangeLog][QtCore][QCryptographicHash] Fixed a bug where presenting
more than 4GiB in a single addData() call would calculate the wrong
result().

Change-Id: Ic72916ebc33ba087d58225af6d8240e46e41f434
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 35453446a511366e1250858b249e36c80b6ad044)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-27 13:23:20 +02:00
Jaeyoon Jung
b26f39b946 CMake: Keep public include header locations for internal module pri
Amends f254d62cb1807d5bd9ee2e23ef64d4ca2d1b6809.

Task-number: QTBUG-95303
Change-Id: Ica8d2850fe427b780d62cd9a9528f387a7ea1b79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c89a9ccbccdd7d6ceec669e7effec5786eb3f642)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-26 11:46:51 +00:00
Li Xinwei
c230fa69d3 CMake: Use namespaced variables in Qt6*Dependencies.cmake
Change-Id: I166988020cfd9750a4d58e519742215d0c03ad3e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit bd594f945773f713ca493fd7b040fde8a12bdf87)
2021-07-26 16:35:37 +08:00
Alex Trotsenko
bb6c9b368c QLocalSocket/Unix: fix aborting the socket
According to the documentation, calling abort() should immediately
reset the socket to its initial state. This includes:

  - closing the file descriptor;
  - closing the QLocalSocket as an I/O device;
  - canceling a pending outgoing connection, if it exist;
  - reseting 'serverName' string.

So, adding a call to close() resets the state entirely.

Change-Id: I9c604b5187c6300b437d7aa4c2d06db03edacf21
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d9c0af92bd893e1f6a0b4c627300ea96a73aba55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-24 11:12:00 +00:00
Edward Welbourne
9d07711bfd Make QSqlRecord benchmarks non-fatuous
Because QBENCHMARK re-runs its block repeatedly, to get sensible data,
the block needs to actually do something when repeated. Since these
tests had blocks that looped while (qry.next()), they left qry at its
end state, so such repeats tested nothing. Use seek(0) at the start of
each cycle to actually do the work repeatedly when the block is
repeated. As a drive-by, split a long line.

Task-number: QTBUG-91713
Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 432eab3bc09bd4c6e6904905fae53f64227a1518)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 18:35:22 +00:00
Edward Welbourne
a690703d39 Halve the data-set size of tst_QSqlRecord::benchmarkRecord()
At 1000, the set-up was taking longer than the five minutes
QtTestLib's WatchDog allows, so the test got killed.

Task-number: QTBUG-91713
Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 346bdc6143dfe79a4b02a5fc410a8963b3d0c1f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 18:35:15 +00:00
Edward Welbourne
655374529c Don't slow down a QMap benchmark by growing a megabyte-long string
Change a += to simple assignment where it's string arithmetic (a
hundred thousand concatenations of "Hello World" add up to more than a
megabyte, in an incremental growth that's going to dominate the QMap
operations we were meant to be benchmarking) and the only reason for
it is to avoid an unused result warning. Accumulating int values is
harmless, but strings are another story !

Task-number: QTBUG-91713
Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 2e24ee02af30821200876bcc0c308ee844155aec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 14:34:11 +00:00
Alexandru Croitor
90351e40fd CMake: Fix incorrect default plugin conditions on Windows
The correct variable to check is WIN32 rather than WINDOWS.
This affects which plugins get automatically linked in a static
Qt build.

Amends a3b58a7844f77bd416fad8307f8333ff7c0efacf

Fixes: QTBUG-95283
Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 91cc4fd6994701c87329de866333eb0bda0e37ef)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-23 14:34:10 +00:00
Edward Welbourne
372391285d Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range i
Follow-up to commit 915be6606ead25f4fbbbcb2687b33cf22a955177, catching
some benchmarks that took for granted they can assign an arbitrary int
to QChar. Since 6.0 this has triggered an assertion.

Given the choice between limiting the range (from 100000 to 0x10000)
and actually handling the out-of-range values as UCS-4 data, the
latter seemed like a more interesting test.

At the same time, take the construction of the strings out of the
loop, as that's not a QMap performance matter, it's a QString one.

Task-number: QTBUG-91713
Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit b5950f6aff9ca646c55e640dd3d67105f56070e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 10:13:59 +00:00
Sona Kurazyan
c4012ff5f0 Make QFutureWatcher::isFinished() consistent with the watched QFuture
All the getters of QFutureWatcher are consistent with the getters of the
corresponding QFuture, except for the isFinished() method, which returns
'true' only after the finished() signal is delivered. This behavior
might be unintuitive for the users. In particular, isFinished() returns
'false', even if it's called immediately after waitForFinished().

[ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The
QFutureWatcher::isFinished() method now indicates if the related
QFuture is finished, instead of indicating if the finished() signal was
delivered. This makes it consistent with the future that is being
watched.

Fixes: QTBUG-91048
Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 53e4a50c6b3c7359b9afc24f30c9517abdf9561a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 09:58:34 +00:00
Ivan Solovev
5ad344231c QSet: extend tests
Extend tests to explicitly check the behavior of empty
default-constructed container.
Also add some missing tests to increase the code coverage.

Task-number: QTBUG-91736
Change-Id: Ie57b5d13fad9a846c29c87be4985c87e69bba305
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 29017f1395b1bc52e60760fa58c92f6fa4ee4f60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-23 08:40:05 +00:00
Volker Hilsheimer
f3138e9d53 Sync default action when checking tool button programmatically
QAbstractButton::setChecked is not virtual, so QToolButton cannot
override to synchronize the default action's checked state. This resulted
in button and default action not being in sync when the checked state
of the button was changed programmatically, while changing the checked
state on the action kept the button in sync.

Connect to the button's own toggled signal instead to keep the state of
the default action in sync. Make it a unique connection to allow multiple
calls to setDefaultAction, which are used by QToolButton to keep the
button updated if properties of the default action change.

Add a test that confirms that button and action are synchronized both
ways, and that we only get single signal emissions when changing either
programmatically.

Fixes: QTBUG-95255
Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 188d739400e10fc8571bbf2ec86d5cd338b04a5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-22 18:40:21 +00:00
Ivan Solovev
4a2c3d1183 QSet::erase - extend docs
Explicitly specify that calling this method for an empty set or with
an invalid iterator results in undefined behavior.

On a debug build an assert is triggered in such case, but on a release
build it will access the incorect index of an array.

Task-number: QTBUG-91736
Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e5ec09ba868685ab2f943b39732a3cac018fedad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-22 12:28:08 +00:00
Volker Hilsheimer
c0acb7b957 Update deprecated NSAccessibility method
accessibilityEnabledAttribute is replaced with isAccessibilityEnabled.

https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc

Fixes: QTBUG-95293
Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fe1085e9aebd3b669a18bd889fc007b1fc1c1e5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-21 13:54:04 +00:00
Volker Hilsheimer
0d9b37493f Scale image with MDI icons using the correction factor
The buffer might be large than needed and contain a lot of uninitialized
pixels. Scaling it down to the requested size is wrong, we need to scale
it by the correction factor.

Amends e56b8e1e59b6df7c7abd48b163abe6846849eb7a.

As a drive-by, make the correction factor helper function static.

Fixes: QTBUG-94733
Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 5d7a58ea45ed834655220e05012ff17ac235131a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 20:13:28 +00:00
Timur Pocheptsov
6774992368 H2: emit encrypted for at least the first reply, similar to H1
Fixes: QTBUG-95277
Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c23b7886348dc313ccec1a131850a7cce1b429de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 17:15:13 +00:00
Mårten Nordheim
d31118fa0e QNetworkDiskCache: Fix tracking of size during storeItem()
If the file already existed we simply removed the old one without
adjusting the size. So use the removeFile() function which takes care of
that.

Additionally, if the current size was non-null we previously increased
the size (presumably meant to be temporarily but wasn't) and called
expire() which would either:
1. not do anything and return currentCacheSize, if it was not greater
than the max size. This would mean that the size of the file would be
counted twice.
or,
2. discard currentCacheSize, measure the size of the items, and then
remove some items if the total size surpassed the max cache size

Neither of those branches need us to (temporarily) increase
currentCacheSize. It also doesn't attain the (presumed) goal of trying
to keep below the max cache size after having added the new item.

Fixes: QTBUG-95009
Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d9f80502f6450f0bc8e6d7ca13e1c912ad485599)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 17:15:13 +00:00
Ivan Solovev
5b27736c87 QHash, QMultiHash: extend tests
Extend tests to explicitly check the behavior of empty
default-constructed containers.
Also add some missing tests for the existing methods
(mostly for QMultiHash) and correct some end()s to cend()s
in comparisons.

Task-number: QTBUG-91736
Change-Id: Ic9e1b86ef67f6bca2751a65a8589b2f7e0ebb5ea
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit af000203359d7a0df2dc4901db605c4e18511e99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 17:15:13 +00:00
Ivan Solovev
0968580d62 QList: extend tests
This patch mostly introduces some test improvements to check the
calls of different methods on an empty default-constructed
container.
Apart from that some other tests are added to extend test
coverage.

Task-number: QTBUG-91736
Change-Id: If2bc96158462292bbdf8504942141af94568c729
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 3ee587f8fa4086b0cc9ba85f08c26ee646344177)
2021-07-20 19:15:13 +02:00
Sona Kurazyan
aa78b2037c Skip tst_qthreadonce test on QEMU
The test causes frequent failures in the CI. Couldn't reproduce on
actual arm64 hardware, so it's likely to be a QEMU bug. From the
available logs it seems that all the test cases are flaky (there's a
failure even after cleanupTestCase() is called), so disable all of them.

Fixes: QTBUG-94737
Change-Id: I783ec2179ba779a2c8d93351a78e8472a4f7a907
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f3bccd2f4fb583d2f36d41d233c7ad2deb7a7ca2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 17:15:13 +00:00
Edward Welbourne
160daf5d63 Fix quadratic performance hit in Q(Multi)Map::insert() with hint
The insert() overloads that took a const_iterator started by calling
std::distance(begin(), pos) - which has a cost linear in how far pos
is from begin() - in order to, after detach()ing, obtain an iterator
at the same offset from the new begin(), using std::next() - also
linear. This leads to quadratic behavior when large numbers of entries
are added with constEnd() as the hint, which happened to be tested by
tst_bench_qmap. That wasn't running, due to some assertion failures,
but once those were fixed the hinted tests timed out after five
minutes, where their unhinted peers completed comfortably within a
second.

Check whether detach() is even needed and bypass the std::distance() /
std::next() linear delay when it isn't. This brings the hinted tests
down to running faster than their unhinted equivalents.

Task-number: QTBUG-91713
Change-Id: I6b705bf8fc34e67aed2ac4b3312a836e105ca2f2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 33c916577389fa6607b0b2f6a78da4a0eb485000)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 13:56:00 +00:00
Alexandru Croitor
a83cf2c10e CMake: Fix qt6_extract_metatypes json file generation rule
Change the copying of
  ${CMAKE_CURRENT_BINARY_DIR}/${target}_metatypes.json
to
  ${prefix}/lib/metatypes/${target}_metatypes.json
to happen as part of the command generating the file, rather
than copying the file as part of a separate custom target or
POST_BUILD event.

This ensures that the custom commands in qt6_qml_type_registration
that use those files as dependencies will cause them to be
generated before the qml type registration happens, thus eliminating
errors like

Error 5 while parsing
 qtbase/lib/metatypes/qt6quick_metatypes.json: illegal value

Fixes: QTBUG-94942
Change-Id: Idddd73786d1a622984965c60ac9b4c3bc2c13ab5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bcca14a1933de9f188950a9a2d3a450a0772d479)
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-20 13:00:15 +02:00
Edward Welbourne
8c1210c745 QFile benchmark: only set up and tear down the data directory once
None of the tests modify the data, so there's no risk that one test
will cause another to fail via that. We can thus avoid the repeated
cost of that set-up and teardown, which was done repeatedly for each
test function since benchmarks get run repeatedly if they're quick.

Use QTemporaryDir to manage the test data, so that it's tidied away
automagically, instead of trying to tidy up at the end of each test
(which was, of course, skipped if the test failed).

As drive-bys, fix a typo in a QFAIL()'s message, change some C casts
that silently bulldozed const away to reinterpret_cast<>s with the
const qualifier and turn some heap buffers into stack buffers to save
the need to delete [] them at the end of their tests (also skipped on
failure).

Inspired by a kindred change by Andreas Buhr and a suggestion on its
review by Friedemann Kleint.

Change-Id: I6067eb35babfbac02990ef39817b0d5122f563cd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit e1b3a463024b8e243f743cffefc9f1a7e6998a6c)
2021-07-20 13:00:15 +02:00
Edward Welbourne
cdcc4d35db Unify and clean up two identical tst_qfile::*_data() functions
Convert newRow() to addRow() to simplify formatting, use a ranged-for
iteration, take out a common factor of 1024, use QByteArray instead of
roundtripping ASCII via Unicode, and break some long lines.

Change-Id: I052730a71fb74f40a0dbd0695dcc286bc39896fb
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit f1d40ca5e9b635e565bcaba5fb2a95f065478b51)
2021-07-20 13:00:14 +02:00
Edward Welbourne
46423843d6 Move QSKIP()s to _data() functions in QFile benchmark
Skipping once in the data function is the clean way to do this. Saves
setting up dummy data just so as to skip it, or setting up real data
and then skippin on each row.

Change-Id: I1666d134b6f206e8055fbbc5efd2e2116431a9c1
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit 1cabfd168048b6b76b406015cc5a5c28e8f38cf0)
2021-07-20 13:00:14 +02:00
Tang Haixiang
12ef53e0d3 Always update the input method when QLineEdit receives focus
The line edit receiving focus might require different input method
capabilities (e.g. be a password edit), so the input method needs to
be refreshed when focus is received. This implicitly happens on tab
focus when the text is selected or the cursor is moved within an
input mask, but neither of those might happen, and for click-focus
it never happened.

Fixes: QTBUG-86846
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I47c5275d3a9d4d190ebce64269a345431346c17c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d5e8efd8cb02876dc314da0579d33af39ba38495)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-20 07:52:52 +00:00
Volker Hilsheimer
2cfdbd62be Fix placement of placeholder text in QLineEdits with action icons
After dc794f7622bc00f7ca50fab65d6965695d6d2972, side widgets only got
space if they were not fading out, but the logic was not correctly
accounting for side widgets that never fade, such as buttons added via
QLineEdit::addAction.

Fix this to give visible widgets space, unless they are fading out. That
was the intent of the original change. Rename the variable to make its
purpose clearer, and reset it at the end of the fade-out animation.

Add a much-needed test that relies on private APIs to verify that the
effective margins are calculated correctly.

Fixes: QTBUG-94824
Change-Id: If2ee6be52be9e4f9be1e91f72f27681ce27def6d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 0e6b31019f01c72ea3af3de31095f8269c7d7f30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 13:30:27 +00:00
Volker Hilsheimer
f209eb464c macOS 10.15: Fix focus frame for combo boxes
Amends df316963213e765de5b94469622df48b0c9a9e6e to take care
of macOS 10.15 specifically, where the focus ring is a pixel
too high and leaves a gap that's visible on high-dpi displays.

On macOS 10.14 and before, and for editable comboboxes, the focus
frame is correct.

Fixes: QTBUG-94069
Change-Id: I278aa30036808c06f8e71385d4797315e46d8f1d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit eaa48136a39f153b05bb1842734bbe2277191510)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 13:30:27 +00:00
Volker Hilsheimer
66c2f31ec9 Add high-resolution pixmaps for macOS dock widget title icons
The macOS style falls back to the QCommonStyle for those, and that
style loads the macstyle pixmaps. Weird, but cleaning that up is
for another commit.

Fixes: QTBUG-38776
Change-Id: Ie1fe721387e64cb91ee5fc528667a63e6ddd6eed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 550e511ec8a1aa12ac75ebd71079511572840065)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 13:30:27 +00:00
Volker Hilsheimer
664b368ace macOS: fix separator actions not showing in menus
Amends a3f3af8a8fb8f8b09d1685df5ab836244f850a62, which resulted in the
last visible separator always getting hidden.

Don't abuse QCocoaMenuItem::visible property to store whether the native
NSMenuItem is shown, only store whether it should be shown.

Rename the local variables to simplify the logic.

Fixes: QTBUG-94802
Change-Id: I56e8c99a2a46d8cbdf75c4ad6cb714961f28a6a3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6832789bbd1a19499bffd05b1cac400db2bdd948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 13:30:27 +00:00
Kai Köhne
c44cd4097f Doc: Remove mentioning of Qt::MidButton
It's only Qt::MiddleButton in Qt 6.

Change-Id: Ia68bad910c617993e30e3ed1e117192469ec50eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 88b92f76ee977a8d0043134451c55cd28c041d8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 13:30:27 +00:00
Volker Hilsheimer
04cc12e26f Fix rearranging of icons in listview via drag'n'drop
Since 0f1008a5936c903ca9448193df7df6117e2c617b, views record if they
moved the item in the model, and prevent the deletion of the source item
in QAbstractItemView by setting the dropEventMoved private data member.

However, QListView in icon mode is special: it doesn't rearrange the
model, it repositions the icons in the view. While the dropEventMoved
logic was applied to the drag event filter to prevent deletion, the
variable was never set in the filterDropEvent handler. The drop event got
ignored, breaking rearranging of icons.

Fix this by setting the dropEventMoved member in filterDropEvent.

Fixes: QTBUG-94226
Change-Id: I963f5db0f81bcd0d25eef05d9a265be00a5871f6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 14e09ada69fc3f1b09a8ad8228c3b8ebb542b220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-19 10:32:09 +00:00
Volker Hilsheimer
4b42bca209 QListView: don't scroll if selected items are removed
For SingleSelection, removing the selected item will select the nearest
item and, if autoScroll is enabled, ensures that the newly selected
item is visible in the viewport. This may result in scrolling.

For Multi- or ExtendedSelection, this should not happen, as having no
selection is perfectly fine in those modes.
However, QListView still tried to scroll to the current item in response
to the currentIndexChanged signal. Since the currentIndex is at this
point already hidden, the rectangle for it became invalid, and the
attempt to scroll resulted in a one-pixel up-movement of the viewport
(since the invalid rectangle has width == height == -1).

Fix this by not scrolling if the rect for the index is invalid. Note that
the index is still valid at this point, so we can't shortcut the call
stack earlier. Add test that exercises the different combinations of
ViewMode and SelectionMode, and demonstrates the one-pixel
movement without the fix.

Fixes: QTBUG-94788
Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 26bebd2037eb69f7c939c899e3238a3e0f0a2376)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-17 10:24:43 +00:00
Li Xinwei
e54d6459d2 Fix generated pri and prl files
Quote the paths after "-L".

Get MSVC’s implicit link directories from $ENV{LIB}.

Fix some issues cause by Inconsistent case.

Amends 2c49f85380d7ad79d9473e0f42e7afaa36d31af9

Fixes: QTBUG-95198
Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2915921ad2a79a4ce1651dc7297f6571788d1413)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-17 04:01:01 +00:00
Mike Achtelik
2e480cdc6e Android: Fix unnecessary clipboard data access
Android 12 introduced a notification which is shown to the user each
time the app accesses the clipboard via getPrimaryClip.
Currently this notification is triggered, even if we just want to check,
if some clipboard data exists.
So lets not get the actual data and instead use getPrimaryClipDescription
to check for the existence of the correct mime type in the clipboard.

Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5a7f4c1f4964a4bf6595002478fbcd474cedd8a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-16 13:01:16 +00:00
Ivan Solovev
c717a78ab0 QMultiMap: extend unit tests
Extend tests to explicitly check the behavior of empty
default-constructed container.
Also add some missing tests to increase the code coverage.

Task-number: QTBUG-91736
Change-Id: Ib3c3f5bcb967cd1031cb24ffceaa77a146212ffd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit ed9effb62dd2f0d0a283ed783ba1e7c90e33e9d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-16 13:01:16 +00:00
Alexandru Croitor
db0a93c9c2 CMake: Fix bitcode linker flags not to be added on iOS
We shouldn't force add the bitcode linker flags to user projects.
And we don't link anything when building Qt for iOS itself, we only
archive object files into static libraries.

The final decision whether bitcode should be used is up to the Xcode
project. That is controlled by Xcode's ENABLE_BITCODE option.

Bitcode compile flags are still added when building Qt itself.

Amends a0468331761b497992e9d554c210583781308272

Task-number: QTBUG-95199
Change-Id: I04c77f659b82269bb8010ea262b2e51f36e9def3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 616c32be04b8cee16354283d22dfe5cef890d435)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-16 10:42:40 +00:00
Ivan Solovev
442d367c40 QMap: extend unit tests
Extend tests to explicitly check the behavior of empty
default-constructed container.
Also add some missing tests to increase the code coverage.

Task-number: QTBUG-91736
Change-Id: I5b418265fc7cb3e56e44782be7704d642923a8e9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 935861e91a68c49414d8fc5fdb035f32991c135b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 15:07:10 +00:00
Edward Welbourne
8db031cb0f Change QCollator's default locale to QLocale().collation()
This replaces QLocale::system().collation(), which left client code
with no way to change this default. Since QLocale's default is the
system locale initially, the old behavior is retained until the first
call to QLocale;:setDefault(). Addition of a separate collation locale
in 5.14 changed from using the default locale to using the system's
collation locale; the present change restores the ability to override
this.

[ChangeLog][QtCore][QCollator] The default locale used by QCollator is
now the collation locale of the default QLocale. This restores the
ability (lost at 5.14) to control the locale used by
QString::localeAwareCompare(), while retaining the use of a collation
locale when the default is the system locale.

Task-number: QTBUG-95050
Change-Id: I232772bb8f23fffd74573174de70ef2deae372a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 973ca1fac680d8c593645058fae3fe7c84a7fa16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 15:07:07 +00:00
Edward Welbourne
80e1f25f68 Fix qdbusperformance and qprocess benchmarks
The tests failed because they couldn't find the servers they needed to
run. The dbus server wasn't being built, due to mis-configured CMake
config; fixed dbus server CMake config. Once built, the servers werent
at the paths relative to the test binaries that were given in the test
source files, because the test binary was in the test/ sub-directory.
The dbus test just needed a ../ on its path; the qprocess one also
needed its path wrapped in QFINDTESTDATA(), and a ".exe" suffix on MS.

Task-number: QTBUG-91713
Change-Id: I5ace23a5815575bbf88ea88e0b16afc7b8ba6a08
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit bf99c2b62bc3bc2dc10ba8f98bea0496b2026801)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 15:07:03 +00:00
Kai Köhne
bb997f29be QTranslator: Fix loading of meta catalogs from absolute .qm path
In case of

  QTranslator translator;
  translator.load("somedir/file.qm");

and file.qm being a meta catalog file, the sub-catalogs in somedir
couldn't be located, unless "somedir" was set as second argument.

Fixes: QTBUG-95013
Change-Id: I06103244ce2ff9800c2c64cb0c17f9bc7ef0e8de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 85eaae36f6951f03c4aeac50ca826fea5cc088bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 11:23:15 +00:00
Kai Köhne
e90398e3be tst_qtranslator: Simplify extraction of test data
This makes it easier to further extend the test. The overhead this
causes is negligible.

Change-Id: I42941879f55337268bb2914e122a5f573ab7e6f9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 841ce1f938219cb975099a28b720abeb95eea19d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 11:23:07 +00:00
Volker Hilsheimer
8df7212325 Point out that QTreeView's expandAll/expandToDepth don't fetch data
They will only expand what's currently in the model.

As a drive-by, remove superfluous : after the \warning macro.

Fixes: QTBUG-94981
Change-Id: I85d38373fb7edf5a5407622b32870e7bcd5d9aeb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f6bca6261156e8f648bf7d41ba1728ef17cd6889)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-15 04:30:02 +00:00
Volker Hilsheimer
cf52d72515 Use base style when drawing item view item with only indicator styled
The base style should still draw the item and the selection highlighting.

Fixes: QTBUG-83619
Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 1d48572b4ea765cb8d81bf227eabaf907a91e7de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 14:17:46 +00:00
Ivan Solovev
2b699ff4ef QMultiMap::erase - extend docs to specify iterator limitations
Task-number: QTBUG-91736
Change-Id: I7cd58e010af5dd59404e37c55f6ebd91c4631b3f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d1d9caf12d103957dccc867c349c4514a28cfe6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 10:42:44 +00:00
Tor Arne Vestbø
acb24ced07 macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8
QSettings encodes QVariants as @Type(data) strings. If that data contains
a null-byte, we write the string as UTF-8 encoded CFData. When reading it
back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant.

The problem arises then the user writes raw QByteArrays with a @ prefix.
We can detect this situation by checking the result of stringToVariant,
and if it's just a simple conversion of the string into a QVariant, we
know that stringToVariant hit its fallback path due to not finding any
embedded variants.

If that's the case, we return the raw bytes as a QByteArray.

Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3eac6079d9a02fbedd3740186eaaf21134dc45c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 10:42:44 +00:00
Christian Ehrlicher
39817d0f3b QTableView: fix selection with rows and cells in ExtendedSelection mode
QTableView stored the current row/column selection start in an own
variable instead using currentSelectionStartIndex. This leads to an
inconsistent behavior when the selection is done with a click on the
header and then in a cell (and the other way round)

Fixes: QTBUG-92561
Change-Id: I4c8bda3a938de451b6eff2819141e86a6870fbef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e8b3d35a18e7e4cf6543868d89d6060c90314f39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 10:42:44 +00:00
Volker Hilsheimer
e8d39c670e macOS: Don't make frameless tool windows miniaturizable
Amends 556fbbea6e96c07c6cbd552c4179e5717e799acf, which breaks
translucency of frameless tool windows. Possibly a bug in macOS, a
window being made miniaturizable should not have side effects on
background or translucency.

Fixes: QTBUG-95042
Task-number: QTBUG-65637
Change-Id: I651196e3cf8a9c59b250e5f1b4064cc4ded02372
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e71a5d5cc3c0337e7dbd5d571ecee5668baf8b63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 10:42:44 +00:00
Marc Mutz
222e895a39 QDuplicateTracker: reserve() for at least Prealloc elements
We have space for so many elements, so reserve()ing anything less
makes no sense.

Change-Id: I84d692b10a6a491c37661f84aa3fdd9af43d71e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 16db1d21659793909bd1719805d7ff8de6906f88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-14 06:58:59 +00:00
Marc Mutz
1a415af379 QDuplicateTracker: port reserve() from int to qsizetype
Was missed in the int -> qsizetype port for Qt 6.0.

Change-Id: I1ae8190601f2e1a1bc02a736c12230a9c71acb18
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fcfc854def12500658d5d863797169279b698498)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-13 23:01:01 +00:00
Marc Mutz
41a397701c QDuplicateTracker: fix the static buffer size calculation
Instead of just sizeof(T), we, of course, also need to take the
support structure into account, to wit: the bucket list and, in the
node, the next pointer and the stored hash value.

Change-Id: I8227a95c49e316aacf3d4efd8f6170ea3bea1cf0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3c88e12beb22d8ea11b8a7006a71ba9773c6d183)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-13 13:22:59 +00:00
Sona Kurazyan
d95809470c tst_QtConcurrentThreadEngine: fix the threadCount() test
Enable the check, that has been disabled because of instability, which
makes the test-case useless. The reason for instability probably was
that it doesn't always start maxThreadCount number of threads: it could
be less if the workers reuse the thread pool's already created threads
(if possible) instead of creating new one each time. But we can at least
make sure, that we're not starting more threads than expected.

Task-number: QTBUG-94463
Change-Id: I8e498c377d86c49758bde0114fe6f7e0432fe993
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit 42f2a9c5ce8b28186960499ad92754c40aa04ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-13 10:54:31 +00:00
Tor Arne Vestbø
63a670f5d3 macOS: Map QSurfaceFormat color space to NSWindow via ICC data
Instead of special casing sRGB.

Change-Id: I7ad20c4b9600210333d5e44c3a2d20ce7d39dd92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 3c3f6ebdbb48c9c071ef1a34a955b36bdaed4f99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-13 10:54:31 +00:00
Assam Boudjelthia
1e069b5f57 CI: explicitly use -gpu swiftshader_indirect with Android emulator
Force the emulator to use software acceleration to avoid a crash.

Change-Id: I1e73b8bc6485b0854cf83f5d9faa5d5f872a90df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cbd226fffa61342a5d586f031eab89f47547e025)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-13 08:00:16 +00:00
Assam Boudjelthia
264b9b94c9 Block flaky rhi and OpenGL tests on Android
Task-number: QTBUG-87429
Change-Id: I5a09a82b5fd27d9a36563e5270703a32c067d4b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cbaff1370147a7cb0a629008e78495c50520c08f)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-13 08:00:10 +00:00
Tor Arne Vestbø
7bdb824b2f macOS: Don't assume NSEvent charactersByApplyingModifiers: produces character
In cases where the keyboard layout doesn't have a mapping for a given
event and modifier combination the result will be an empty string.

Fixes: QTBUG-90683
Change-Id: Ice06241f0ae71a19cde041410818decc312bc630
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 7c85a45fde5dd3f84eb033261ccb0d54ee72d30c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-12 09:23:50 +00:00
Oliver Eftevaag
952635dabe Fix QTextFormat::FullWidthSelection for right-to-left text layouts
Using the QTextFormat::FullWidthSelection property to select a line
would previously not take into account right-to-left text layouts.

With this patch, the whole line should now be drawn correctly for both
left-to-right, and right-to-left layouts.

Fixes: QTBUG-91125
Change-Id: Ide7b340cd7b4060e7c00e55e0011a86ffdfb5eb4
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a7894855f2f59028bea9cd1aef07ec1e2c713c90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-10 13:52:01 +00:00
Alexey Edelev
c90d5e7420 Fix platform definition directory in top-level build
QT_BUILD_DIR should be used instead of CMAKE_BINARY_DIR as a base
directory for platform definition when building a non-prefixed
build since artifacts are copied to qtbase directory for top-level
build.

Amends 478f5fcde66a49b710c427447916a0ee0e4d9e0a

Task-number: QTBUG-94973
Change-Id: I5cce16fdc7f760b954222ae67a4b85d4beea7f13
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9bbca531ebe498afa10d9a1c02518fcfc54490a2)
2021-07-09 17:00:20 +02:00
Alexey Edelev
943b561c32 Fix the detection of platform definitions directory
Platform definition directory is defined when building qtbase.
Depending on the build type (prefixed/non-prefixed) it should point:
  - To the source directory when building prefixed qtbase.
  - To the installation directory of the prefixed qtbase when building
consumer projects.
  - To the build directory of non-prefixed qtbase when building
non-prefixed qtbase or consumer projects.

TODO: It is desirable to move the logic asssociated with Qt platform
definition to the qt_internal_setup_public_platform_target function.

Fixes: QTBUG-94973
Change-Id: I8530613f9b2029834c66206bbdf02475528a4640
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 478f5fcde66a49b710c427447916a0ee0e4d9e0a)
2021-07-09 17:00:20 +02:00
Ivan Solovev
69c70ace05 QMap::erase - extend docs to specify iterator limitations
Task-number: QTBUG-91736
Change-Id: I4a226e0bbcde91f3149db9a0697981169ec25276
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 74d6c36eb7b80cfdecd80c5e6f8c1f0604f0b496)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-09 12:45:40 +00:00
Alexey Edelev
efe834668d Hide QT_USE_BUNDLED_ CACHE variables from GUI
Make QT_USE_BUNDLED_ INTERNAL to hide them from GUI like QtCreator's
CMake configurator.

Change-Id: Id9dcee31c69b579bbe38611cabb98e46550b0e89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f33d11796ff91bfd0323e6bccd03b4cf16b1f371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-09 09:22:24 +00:00
Marc Mutz
20b805f30f Fix rvalue overload of qobject_pointer_cast for GCC 9.3
The code assumed that any C++ implementation would implement the
resolution for LWG2996 in C++20 mode. While that may be the case in
the future, the current state in GCC 9.3 as shipped in Ubuntu 20.04
LTS is that it doesn't, which leads to tst_qsharedpointer fail there.

Fix by using the safe version of std::move, std::exchange, which
guarantees the state of the src object, no matter what the callee
does.

Change-Id: Icc39b527df4d3a7b398ff2b44bcbdf9082b81f2f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 0632494bd47e924ce7914b6457791d4612599e5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-09 04:33:57 +00:00
Volker Hilsheimer
e474183059 Fix auto completion in QFileDialog on Windows
Amends c0b3c06a7d4f6a2f90742e8dc81c898082a70416.

The QCompleter used by QFileDialog uses starts-with matching of
the path parts, for all parts of the path. It uses the EditRole of the
underlying model for the data to match.

The path parts used for a path on Windows are "C:", "Users", "etc...",
and then finally whatever input has been typed so far. If we try to
match that against a starts-with rule against "Local Disk (C:)", then it
will fail and the completer will never have anything to show.

So, for the EditRole, return just the volume drive letter as we did before
c0b3c06a7d4f6a2f90742e8dc81c898082a70416, not the volume name. Neither
can be edited anyway. This happens to then match the native file dialog
behavior, which doesn't complete "L" to "Local Disk (C:)" if the Computer
contents (ie. volumes) are shown.

Augment the QCompleter test case to cover that scenario (it already has
everything set up for this particular combination, even though we are
actually testing QFileSystemModel returning the correct data).

Fixes: QTBUG-94799
Task-number: QTBUG-78043
Change-Id: I14844d91601e9b16dc07cff2ca48713acb7cdd09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit d2e88b8094db0bda6b3ab89172352861ae18d301)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 22:48:54 +00:00
Ivan Solovev
946e379b85 Fix QMultiHash::keys(const T&) overload
The method was never tested, but it failed to compile after
QMultiHash was introduced as a separate class in 6.0.
This patch fixes it and adds some unit-tests to cover the case.

Task-number: QTBUG-91736
Change-Id: I5dd989d4775efc6a9bb13c5ed1d892e499d95dc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit a8bcf68a5ec91b4ca4209c36310def145c8afe97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 18:41:58 +00:00
Marc Mutz
d2546c4daf tst_QCryptographicHash: make hashLength() data-driven
Change-Id: I44bf73e15b53b8d93d116f4114bc667c4c94b7b4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 09d0fc068d4b32aa9cd00d38171e62fddf82c83a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 16:45:41 +00:00
Sona Kurazyan
0f7b68218f Remove the dead code for blocking methods from QtConcurrent
After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running
QtConcurrent algorithms in the blocking mode aren't used anymore. Since
ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used
externally, it should be fine to remove startBlocking() methods now.

Removed the unused code and adjusted the tests accordingly.

Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 1bf75f2a661c05c7f1126187310d7df3f9704af5)
2021-07-08 14:33:53 +00:00
Ivan Solovev
dc48e368fe QMultiHash::find - prevent detaching shared null
Do not detach when find(key, value) is called on an empty QMultiHash.

As a drive-by: fix return value for QMultiHash::remove() in case of
empty QMultiHash.

Task-number: QTBUG-91736
Change-Id: I1e32f359e7ee9ce8403dae79d02e0b88a20ec4a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 82499f81478032911d8f788aa28e8d780b31c973)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 14:33:53 +00:00
Edward Welbourne
4030fb4292 Fix QDirIterator benchmark to actually find its test data
The benchmark had a hard-coded path on MS and needed an environment
variable set otherwise; neither sounds like a good approach, when
testlib defines a variable that tells us the test's source directory,
a clearly superior way to find things in our source directories.

In the process, replace exit()ing on failure to get a path with a
QSKIP() so that the test at least fails gracefully if it ever can't
find its data. (Using QFAIL() left it with no rows but still trying to
run the test, leading to an assert failure.)

Task-number: QTBUG-91713
Change-Id: I1bd5561971239bb838bcf6c24bcdf1d07c81a657
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 74e9b77f4f3bd823d836a2a1a557b294582bac5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 12:08:01 +00:00
Edward Welbourne
dc70e511a8 QFile benchmark: always use Unbuffered for QFSFileEngine tests
Support for buffered usage with QFSFileEngine was dropped in 5.10;
trying to use it triggers an assert.

Task-number: QTBUG-91713
Change-Id: I5f46e9f793310538344b96bf2efbeba34098de83
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit f74b2e3479751cd9ef86c0c38c8c64172c1129f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 12:07:37 +00:00
Andrei Golubev
b942d3b971 Fix binding functor addressing in QProperty
We create the callable object at sizeof(QPBP) offset from
the beginning of the memory block. However, evaluateRecursive()
uses sizeof() + alignment when fetching that same callable from
the memory

While on 64-bit platforms this is fine due to
sizeof(QPBP) == QPBP::getSizeEnsuringAlignment(), this is broken for
32-bit systems where there's actually alignment bits that follow the
QPBP struct in memory (and thus we cast a random memory location to
an object)
(Note: QPBP is short for QPropertyBindingPrivate)

To fix this, change the offset for creation and destruction of the
callable to the one that uses alignment. This way, evaluateRecursive()
code becomes correct

Fixes: QTBUG-93890
Change-Id: Ief57051846632fa61df4b79b3f054c25062a9498
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 565864090d4ca38768c2268ffd265d2f4b49d1b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-08 06:16:14 +00:00
Eskil Abrahamsen Blomfeldt
f00efd8233 fc: Clean up current config on shutdown
The FontConfig database had a static leak because we never
dereferenced the current config. To make address sanitizer output
less noisy, we clean this up on shutdown.

From FcConfigDestroy docs: "Note that calling this function with the
return from FcConfigGetCurrent will cause a new configuration to be
created for use as current configuration."

So this should be safe even if application execution continues after
Qt shutdown, but it could trigger creation of a new current config
in that case, if FontConfig calls are made.

Fixes: QTBUG-92477
Change-Id: I596055a84edc1a1b06157e2adf6c8627c6802db1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 4f730fc5f13b906d7bb2461f803ecedb4937c16d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-30 20:28:13 +00:00
Eskil Abrahamsen Blomfeldt
f63f4b3e62 Revert "Windows: Add synthesized fonts also when there is a style name"
This is a partial revert of commit
f385b8827a75688b8a2cbd51e8da8a602d7f9567.

This causes issues because we may overwrite genuine styles with
synthetic ones.

Lets say for instance that we register "Roboto Bold" and then later
we register "Roboto Thin". When we register "Roboto Thin" we also
register an alternative font which is called "Roboto" (because this
is the typographical family name of the font) with bold weight, because
we know Windows can synthesize this.

This would work fine, except that on Windows we also store the original
face name of the font as a user-pointer in the database. This contains
the legacy name of the font: "Roboto Thin". This will override the
font that is already stored. When we look up "Roboto" + bold weight in
the database later, we will find this synthetic font, replace
the requested family name with the legacy one "Roboto Thin" and use
this instead.

The right fix for now is to revert the cause of the regression. If we
want to re-fix the original bug, we might be able to reintroduce
f385b8827a75688b8a2cbd51e8da8a602d7f9567 and then make sure we always
prefer the "real" font when there are conflicts (this would mean marking
synthetic fonts in the database).

[ChangeLog][Windows] Fixed a regression where different font styles
and/or weights would not be available.

Fixes: QTBUG-94781
Task-number: QTBUG-91398
Change-Id: I092022b14ebf1d56685eaa3b8efe55f015659adc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d16ee17a39252e06bf3bef08d80b0d116c473ba1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-30 20:28:13 +00:00
Jonas Kvinge
52f93a88eb QDBusMenuConnection: Close open D-Bus connection
Using QSystemTrayIcon::isSystemTrayAvailable() generates a new
connection from QDBusTrayIcon::isSystemTrayAvailable() with a new unique instance ID.
These were never closed, so calling
QSystemTrayIcon::isSystemTrayAvailable() frequently leads to crash when
it runs out of file descriptors.

Fixes: QTBUG-94839
Change-Id: Ib71441a6b680d8633707cc02f9b6081c0f02472b
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2ca19d2dd3137f2c29dcb2b1f2d23b23f3f1b0aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-30 17:39:07 +00:00
Paul Wicking
4d32382976 Doc: Terminate C-comment
Change-Id: I18d3e609781c0f8d518982292279b497dac539a5
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 87249cd8b0fabd9b48226e3467a1b76a6276825e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-30 14:01:58 +00:00
Friedemann Kleint
d6a0d3c660 Documentation: Remove section advertising Amazon
Change-Id: Ibf61cdf4ccb08c00c74c88e66aac200971be62d1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0c09f4489d8a97b8fb47afebf15937398752f23d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-28 18:34:24 +00:00
Marc Mutz
85cd9b144b QVarLengthArray: fix aliasing error in insert(it, n, v)
Taking the copy after the resize is completely pointless: the copy is
there to ensure that `t`, being a reference potentially aliasing an
element in [begin(), end()[ before the resize(), isn't invalidated by
the resize(), so it must be taken before resize().

Add a comment so the next rewrite doesn't cause this to be mixed up
again.

[ChangeLog][QtCore][QVarLengthArray] Fixed an aliasing bug affecting
insertions of objects aliasing existing elements.

Change-Id: I26bc449fa99bf8d09a19147a12a69ac4314cc61d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 6e57e41f9aef5ccfa122c10bc6253d47dafd93d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-28 14:22:57 +00:00
Laszlo Agocs
cfdacecb48 Do not alter a widget's backing window's format once created
Changing anything on a QWindow's QSurfaceFormat has zero and null
effects once the underlying native window has been created. Letting
QWidget update the format is wrong in this case, because we always
expect that the value returned from QWindow::format() reflects
reality.

(reality being the settings with which the underlying native resource
was created, which is typically frozen after QWindow::create(), not
the state of some QWidget attribute. There are certain exceptions to
this, such as when preparing to recreate the underlying native window,
in which case one will want to update all relevant fields of the
format based on the current values of the widget attributes, which is
exactly what QWidgetPrivate::create() implements, and that's good.)

Such a mismatch can have fatal consequences when OpenGL and friends
are involved, but this always depends heavily on the platform and
windowing system. For example, claiming that the alpha buffer size is
0 when the native window was created with 8, or vice versa, can break
OpenGL-related code (both in Qt itself and in applications), that
tries to create a QOpengGLContext configured based on what
QWindow::format() returns. If that format describes settings that are
incompatible with the actual underlying native window, we end up with
the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors.

This is exactly what is happening when a QOpenGLWidget (or
QQuickWidget) is placed in a QDockWidget where one of the ancestors is
forced to native (winId() was called or WA_NativeWindow was set). When
undocking, various code paths in QWidget will try to update the opaque
flag of the widget, which in turn calls updateIsTranslucent. Now, if
this function unconditionally changes the alphaBufferSize in the
QWindow's QSurfaceFormat (even though this is completely futile to do,
it has no visible effect in practice), we get the problem described
above: rendering breaking down due to OpenGL contexts created with a
pixel format incompatible with the native window.

Prevent all this by not touching the format once the QWindow has a
QPlatformWindow. This is the right thing to do, regardless of the bug
in question: a window's (or context's or any other native resource
wrapping class's) format must describe the underlying native resource
and must never deviate, unless we are preparing to create a new native
resource underneath.

When it comes to the autotest, this changes the test added in
555661b625c40f21a6a3e4c73e928a6e8a46db20: the autotest logic is
inverted because what we should test for is that the QSurfaceFormat
stays untouched once the application makes a - futile - attribute
change on the widget.

Fixes: QTBUG-85714
Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e6a969954a9e6865e5f662acd1d949561f8ef3be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-28 09:12:27 +00:00
Paul Wicking
6042cef8aa Doc: Use https for links to unicode.org
* Change all outbound links in user-facing documentation.
* Reflow lines that exceed 100 cols as mandated by clang-format.
* Add unicode.org as a global \externalsite.

Change-Id: I2ba1e434aa913e678406d62c2801f1a8b2d9e4f4
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 7968281444c967628566337ce3493058825cb946)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-25 17:13:38 +00:00
Paul Wicking
1bdd0cb3a7 Doc: Improve QTransform documentation
* Explain QTransform's model of vector/matrix operations.
* Improve snippets used to illuminate QTransform's behavior.

Fixes: QTBUG-83869
Change-Id: I84c3b1a221c139ee992f82c3ee4aebadeef8ee63
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit ae2ef9dbf060ba101e32bae2b5edfed979630e30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-25 17:13:38 +00:00
Alexandru Croitor
3d512d1756 CMake: Fix 'Cannot find source file' error with older CMakes
Configuring a static qtdeclarative with CMake versions older than
3.18.0 fails at generation phase with

CMake Error at cmake/QtExecutableHelpers.cmake:28 (add_executable):
  Cannot find source file:

   some_path/some_target_plugin_imports_Gui.cpp

Marking the generated file as GENERATED explicitly solves the issue.

Change-Id: Ife0eba61a1aab4f988d9fe7e2217d30eb96774a7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e2c6f2ba7ed72195d12e9882c174e59a53317097)
2021-06-25 16:33:49 +02:00
Liang Qi
36ea0aeacc xkb.compose: get locale from user env settings
The setlocale call will only give useful results if the program
had previously set the current locale using setlocale...

See also "Compose Locale" section in xkbcommon doc:
https://xkbcommon.org/doc/current/group__compose.html#compose-locale

Fixes: QTBUG-85529
Change-Id: I65b1ac86ea54445bc3a2e1707df79bd9f732ab46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 73ea9f032864566cc019d286b2f210b78cd70a3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-25 11:44:24 +00:00
Tang Haixiang
9d57bbc25b xcb: fix cursorTheme update issue
Clear the cache when cursor theme changed.

Idealy we should subscribe root window's RESOURCE_MANAGER property
to update cursor theme via Xcursor. KDE already has a daemon
KDE GTK Configurator to sync KDE settings to GTK. Then we can
register the fallback there both for KDE and GTK changes. See also
https://invent.kde.org/plasma/kde-gtk-config

Fixes: QTBUG-94538
Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7311cdc0d2c10d47511e5b4850e3b348ea10e0d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-24 16:56:00 +00:00
Timur Pocheptsov
293d68c263 Document TLS plugin classes (private, internal)
Also, a minor clean-up: isMatchingHostname() overload
was never used, deleted (and it could not be used safely,
since it requires the name to be normalized first).
The file (qtlsbackend.cpp) was re-shuffled, to have
backend on top of the classes which this backend
is factory for.

Fixes: QTBUG-91929
Change-Id: I435c69b167f57f7c3f76e34449c52f665dc6f7c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c771ad8cdfccb2678664d9e7c54669acf82fedaa)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-24 16:23:13 +02:00
Paul Wicking
b8ea431fb1 Extend documentation for QFile:copy()
- Add information about symlinks and file metadata.
- Reflow text.
- Extract text common to both overloads to a .qdocinc file
  for consistency and to avoid duplication.

Fixes: QTBUG-94706
Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cc2fdce35e6a958e021b4d4cdc0ace1a91b06d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-23 18:09:57 +00:00
Tor Arne Vestbø
d1c2ddc8c8 macOS: Unregister screen notification handlers on QGuiApplication shutdown
In the case of a plugin, the plugin might be unloaded, and destroy its
QGuiApplication. We don't want the screen notification handlers to outlive
the application, as that results in crashes.

Fixes: QTBUG-91919
Done-with: Yang Yang
Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 96469ae338c3146f4efea3fabaaae5bc6ecd6a59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-23 12:21:20 +00:00
Ulf Hermann
de51871f99 QString: Respect precision when reading data for %.*s format string
If we disregard the precision we may read a very large string that we
subsequently discard. Furthermore, people use this to read
non-null-terminated strings, which randomly crashes.

Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e99e07cb5c939ca5bbb1dfdeb66c862d6cd4f2f2)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-23 14:21:20 +02:00
Tasuku Suzuki
e69252f39c Doc: bump the OpenSSL minimum supported version to 1.1.1
Change-Id: Ibfc8b64be23eb023dafb875f367da98b7c7bb5f6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 418850d55976ca283f1ad92997379df27bb6028a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-23 12:21:20 +00:00
Edward Welbourne
3e5ccbaace Fix potential double-free in QSqlCachedResult::cleanup()
If d->sql is non-null, it gets freed; later in the same function, it
gets reallocated, unless the query is empty, in which case the
now-freed value was still recorded, so that later clean-up might find
it and mistakenly think it needs to be freed again. Clear when freeing.

Change-Id: I8d37d2ba1fcaa320916eaf30dceaa720bbf62f38
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 0e1da78ad36a0639275b7a0ac8a046f46577452d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-23 09:20:12 +00:00
Edward Welbourne
68ba065602 Fix leak of transaction context handle in QSql's OCI driver
Transaction handles were allocated but nowhere freed. Thanks to Stefan
Latsch for pointing this out and suggesting the fix. Make the handle
yet another member of QOCIDriverPrivate so that close() can free
it. At the same time, also free the service context handle d->svc when
failing do open(); and shuffle the order of frees to be the reverse of
the order of allocations.

Fixes: QTBUG-94246
Change-Id: I45818ada6d884b06028056d28635390a300e2def
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit c42ebd5ba6f1fb861cabdbe44ab10df55b9b3ada)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-23 09:19:38 +00:00
Giuseppe D'Angelo
874cc1e9f6 Disable -Werror=stringop-overflow on GCC >= 10
There's a number of upstream bugs that cause false positives;
do not make them errors.

Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 648e9696d38f9338019d30f297029ba34efb673c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-22 22:24:06 +00:00
Morten Johan Sørvig
68b107f2b8 macOS: Allow programatically minimizing frameless windows
NSWindowStyleMaskMiniaturizable also controls programatic
minimize, in addition to the window decoration button.

Fixes: QTBUG-65637
Change-Id: Iac5fb483433441173d770f4fcfb9e93440b9fe6a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 556fbbea6e96c07c6cbd552c4179e5717e799acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-22 15:57:09 +00:00
Paul Wicking
8118633466 Doc: Add note to Qt::MatchFlags about implementation dependent behavior
Fixes: QTBUG-94374
Change-Id: I7f426c92bf0434998d0793eedd405c1a682a28d9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit c92c3c19e8ba02eeceff882b71571a076bef504d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-21 14:50:57 +00:00
Kai Köhne
85710cf149 Porting Guide: Mention that also QSet is affected by stability of references
QSet is internally implemented by a QHash. Therefore the change in
reference stability affects QSet, too.

Change-Id: If1879d5a027211bca0beeff16ffbc77f2f4fce26
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit c2c15666b76516e5edfbe2a51226740b5a0bb4d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-21 08:10:42 +00:00
Eskil Abrahamsen Blomfeldt
247bd54fd2 Fix right-to-left text with DirectWrite engine + QPainterPath
When QPainterPath was used for RTL text, either directly or because
the target text size exceeds 64 pixels, we would pass true for
"isRightToLeft" to DirectWrite, causing it to do adaptation internally
for this. But the RTL layout had already been handled by Qt, so we
would essentially reverse the layout twice and also move the text
to negative X coordinates.

Passing false instead fixes this, as it will then just use the
positions we pass in blindly.

Fixes: QTBUG-94175
Change-Id: Ie9a47e56e97fc867ede10ab21ac5e3f003ddcacb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 30399fb95cf8b528ac4b45766ac55c6f0a16e2f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-21 08:10:42 +00:00
Nicolas Fella
3eab20ad38 Add missing limits include
The code uses std::numeric_limits but is lacking the appropriate include

Change-Id: I41fa5ac4d8c4e06f35b5b1551ef2ad8417df80bd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 2b2b3155d9f6ba1e4f859741468fbc47db09292b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-21 04:08:18 +00:00
Alex Trotsenko
1489567b3b QEventDispatcherWin32: suppress old {FD_CLOSE|FD_CONNECT} notifications
As with other network events, we must also ignore these notifications
until WM_QT_ACTIVATENOTIFIERS message is received.

Fixes: QTBUG-82835
Change-Id: I0740bf22e8d1cb0e8b4eba7fc1a27ffe669973ff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fe6d84d96e67113846801803c3ba1f20b26e123f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-19 07:03:45 +00:00
Giuseppe D'Angelo
9f23445629 Add GCC 11 and C++20 workarounds
GCC 11.1 has a bug [1] in the preprocessor that leads to
-Wsuggest-override warnings being raised in random places, even under
pragmas that are supposed to suppress it. For some reason, NOT using the
integrated preprocessor fixes it, so add that flag as a workaround.

Also, GCC 11 introduces a family of warnings for C++20's deprecations of
mixed enum arithmetic, which we use all over the place. Avoid a hard
error for those warnings.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796

Change-Id: I3b2aefa385f191f207e7eb876bc1ed0b18fb342b
Task-number: QTBUG-93360
Task-number: QTBUG-94059
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f29ff5dffb7f9321d2bfb6071813d2d8d88186b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 23:54:48 +00:00
Volker Hilsheimer
a1cd0e8c08 macOS 11: Fix positioning of focus frame around combobox
Fixes: QTBUG-94069
Change-Id: I09079726c96a41f628ae55724cfe53dbc225d358
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit df316963213e765de5b94469622df48b0c9a9e6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 21:04:49 +00:00
Sze Howe Koh
7668fdfde2 Doc: Move overrideCursor() from QApplication to QGuiApplication
The transfer occurred in Qt 5

Change-Id: Id3428809d89c804112d9dc02f2a476cb03bd2c98
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d254af915241c6ed5a6b590bfa8d27c7488f8a77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 18:23:26 +00:00
Mårten Nordheim
66aa4c86f4 QHash: Fix erase() edge-case
When the element you want to erase is the last element AND the
next element (element 0), when rehashed, would be relocated to the last
element, this leads to the state below. Which is similar to a test in
tst_qhash for some seeds.

auto it = hash.begin + (hash.size - 1)
it = hash.erase(it)
it != hash.end

By forcing the iterator to increment if we were erasing the last element
we always end up with a pointer which is equal to hash.end

Befriend the tst_qhash class so we can set the seed to a known-bad one

Change-Id: Ie0b175003a2acb175ef5e3ab5a984e010f65d986
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit ea7d87b5b59ded22b145ecbb4dd648ecfd1abbdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 09:49:58 +00:00
Kai Köhne
9f459dee1f Porting Guide: Mention deprecation of QLibraryInfo::location
Change-Id: I998a4575ce7fb56ab51d49715071e682a440360b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit b26988d0b51ac26867258ced00c465324032b855)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 09:49:58 +00:00
Kai Köhne
e6a70978a0 Porting Guide: Mention changed behavior of QCApplication::quit()
Mention change of behavior introduced by 89f7a2759c6b in the porting
documentation.

Change-Id: I3c282362f5852cc7768e6655fc7b3901d68f2b10
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 3cbe11f93475a845e4e7849e1315570ea782e595)
2021-06-18 09:49:58 +00:00
Ivan Solovev
ef3e8d51ca QTextDocumentFragment: fix ifdef range
Move QT_END_NAMESPACE macro out of the #ifdef definition

Change-Id: I26b4e263b5ae0acebf035dbfe8c7e287cd740190
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 0f9695e6da7b40d684d20d55144d020004c2e9ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 09:49:58 +00:00
Alexandru Croitor
2e2c8b8c29 CMake: Handle OPTIONAL_COMPONENTS in qt_find_package
The optional components arguments were not handled before which
caused the recorded package information for static builds to be
incorrect, it only recorded the package name without the component.

Remove REQUIRED_COMPONENTS TODO, there is no such find_package option,
it's already handled by the regular COMPONENTS code path.

Amends 07b6d3367debd8f15974abf0f5cdf48f0fe3a536

Fixes: QTBUG-94501
Change-Id: Ib48a7befcb70e20c3f21315897d51d3064b48134
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b6c5e0667696c1d4abaf37f2224b2121b72cdebd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-18 07:10:56 +00:00
Eirik Aavitsland
4dcedb8ca4 Avoid overflow in text layout
Fixes oss-fuzz issue 34597.

Fixes: QTBUG-94197
Change-Id: Icabcd5a87b809b6a5ae0f1a696ec3b5dd906886b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit e473d96e65e7cf3190c6c16acace6359964d0bee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-17 09:58:37 +00:00
Lars Knoll
e41c100460 Fix crash in concurrent disconnect
This does not fix all data races that we have in the system yet.
One major issue is the virtual disconnectNotify(), that can be
called from any thread and thus is inherently problematic, as it
can collide with the object getting destroyed at the same time
in another thread.

Task-number: QTBUG-88248
Change-Id: I9d841eb363b7e4f0de1657aeb8f5340d0fd55190
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 71b4d4f150bc3c904a5aceec37513ddc3cd1c150)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-17 09:27:47 +00:00
Fabian Kosmale
b6323f0c7b cleanOrphanedConnectionsImpl: Allow to skip locking
This function is/will be used in a few places where we already have a
lock. Temporarily unlocking and relocking invites all kinds of troubles.
By adding a flag we can instead tell the function that we already hold
the lock.

Change-Id: Ibca089de61133661d5cd75290f2a55c22c5d013c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 556fc646cfac4dca43a34f5c4a4f7e6e3ef9104d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-17 09:27:43 +00:00
Fabian Kosmale
32eb742b04 QOrderedMutexLocker: Disable copy and provide explicit dismiss function
Copying a QOrderedMutexLocker is questionable, and would currenly easily
lead to UB. Therefore we delete the copy ctor and copy assignment
operator, and implement well-behaving move operators.
In addition, provide an explicit dismiss method for cases where we don't
want the locker to unlock the mutexes, as they have been manually
unlocked (this could have been implemented previoulsy by using the copy
assignment operator).

Change-Id: If2a888710e1c74277b28fd3e2939ab26fff0c7ae
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 7fefce73284de4204d64c7e4129f39004a13cdad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-17 09:27:30 +00:00
Shawn Rutledge
a0fa1654a7 Fix rendering of text checkboxes when text is selected
Fixes: QTBUG-94532
Change-Id: I4343558dcec6149dcdcc0f7ca32c49fdc67452af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bc30d5624d59d523c4c31473cb64621ee5c43f9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-16 16:33:42 +00:00
Joerg Bornemann
83b90ef261 Expose the "debug" build feature privately
Consumers can now check the "debug" feature to determine whether Qt was
built in the "Debug" configuration.

Change-Id: I225125d38ded508e9792a730ce421b33bceacddf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3ca5b46e5da04672ed0eaeaa6a5b30673705e4c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-16 15:03:21 +00:00
Volker Hilsheimer
d842468685 Windows: Read page size and orientation from setup dialog
PAGESETUPDLG's hDevMode reports the page size and orientation selection
of the user, so read that data to get accurate results.

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

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

Fixes: QTBUG-93764
Change-Id: Ib9a848619e3ba8780264ad76ed43c4fffae6b07f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 6ce44c53c7aa802b817b72d49de88e4da0181488)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-16 11:22:30 +00:00
Richard Moe Gustavsen
51838c964f iOS: cleanup connection when a screen disconnects
The iOS port creates one QIOSViewController per connected
screen. And each view controller listens for changes to
the application state. The problem is that we never
disconnect this connection again. So if a screen is removed, and
the corresponing view controller is deallocated, the
connection is still kept alive. This will cause crashes to
occur when the signal emits, since the slot will then be accessing
deleted memory.

Fixes: QTBUG-76948
Change-Id: I758e51af9297cd62de193aae825f4475a2c7c3e5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d829d54a42393d797c5f6ab3b80e88df35fad1e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-16 11:22:28 +00:00
Kai Köhne
a225719ae8 md4c: Fix MSVC compiler level 3 warnings
Fix various C4244 warnings with the MSVC compiler for 64 bit

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

Change-Id: I2ac1c17febb4fb269ac7244458f4cd90ce8b8e49
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 1591a959876bc5a37aacc817e637400c72bf6623)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 22:40:12 +00:00
Kai Köhne
f9a757ad81 Update md4c to 0.4.8
Change-Id: Ib0e1ef259696aa380aba0819aa4e1d8a12b4a21d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 1759626cd61fbc765d21ce458cc5d472db087f3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 22:40:12 +00:00
Volker Hilsheimer
5671daa487 Stabilize flaky scrollerSmoothScroll test case
This test failed when checking for a pre-condition of the tested scenario,
so skip the test if that condition isn't met, as the test won't test
anything.

Amends b1fdcc8c0fefe0660302494618032342b623e199.

Task-number: QTBUG-64543
Change-Id: I135cd5b45efcae111305b9be338eb5429d3b97d5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 2933e67f4547ec7ae14c9d370d20aff5a99327d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 20:44:27 +00:00
Timur Pocheptsov
39a42035d1 H2 - make integer conversion explicit (signed->unsigned)
Change-Id: I47a3f8f7c39d4179a9a108e81a9c7f409acbc315
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8a034c62b6c87ee8c15b9132392fb7dde01e2a65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 12:18:42 +00:00
Joerg Bornemann
5deb5b042d qmake: Enable response files for WASM on Windows
This fixes the "Command line is too long" error when building a project
with many object files for WASM on Windows.

Fixes: QTBUG-94032
Change-Id: I29251da9795b267c968da86617da0311bf882a64
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 4372cac01cb811b995d3142d8d8e93182937a03d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 12:00:04 +00:00
Volker Hilsheimer
4b4cf09f29 Make dockwidget title bar buttons show again
Amends f61304fc77a622170ef3bbcbcb37c5a90c6f87ea, which renamed the files
but didn't adjust the code.

Task-number: QTBUG-38776
Change-Id: If54dd986975dd28f147a98628317b1369d0c690f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 22571c21c9be10d9ada756c598f519f74273579a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-15 08:56:26 +00:00
Timur Pocheptsov
a6a2c56c96 H2: remove a rather useless limit on the number of streams
SETTINGS for max concurrect number of streams is 'one direction' - this
is how our peer conveys the possible number of streams _we_ can open,
not _them_. If they choose to have it unlimited - let it be so.

It's possible to send 0 as maximum number, also, it's possible to
reduce the maximum compared to initial at some point - then I have
to avoid integer overflows.

Fixes: QTBUG-94470
Change-Id: Ia02247acbaedd70998a4cab02082ba10f45cf78c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 46940ca73791e87e2366b80ac2884b3bcce716ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 21:37:34 +00:00
Mårten Nordheim
635dff376e Update CLDR qt_attribution.json
We updated to v39 in 6235893d54b8fbf5c8bd54e33cd82b55042555f1

Task-number: QTBUG-94410
Change-Id: I73d539d677c9066dc5ceb6b4fc65fb544f39ac7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 20a31b1a39931e06d69e932d2e6890f7c375e20b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 21:37:32 +00:00
Mårten Nordheim
b6a4a5b2b3 Update public suffix list
Task-number: QTBUG-94410
Change-Id: I2ccf717dc7e0e70c4abd66956238ac3cca1d7a5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b5da494b3f3d5dd7d4a82eab761bdbbc4808c222)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 21:37:31 +00:00
Laszlo Agocs
d3ea746b35 Document that WA_TranslucentBackground will not have an effect
...if changed after the widget is shown.

Just documents the current state of things.

Task-number: QTBUG-60822
Task-number: QTBUG-59126
Change-Id: If8281dce4457707a1673aca7a50744d8b231b030
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cf7df972c3015a160986bcd3f1cbd1f01297335d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 14:53:10 +00:00
Paul Wicking
78613566c6 Doc: Fix snippet for QRandomGenerator64 docs
Fixes: QTBUG-94347
Change-Id: Iaf007534214cffc83858833e80dad447df9b297a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b43ec7e9f9d043ee3b82a5207ac124d77ce5afca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 13:02:06 +00:00
Heikki Halmet
cb9bc03e9c Change Android emulator command path
Change-Id: I6e7df6cdf7f0a0a7efea8fb7672be0b3df096d12
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 507499d4b650611ebc8194c2b6b9cd62d6977b26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-14 13:02:02 +00:00
Kai Köhne
fd6f8dc264 Remove outdated INSTALL file
One link was wrong. Also, the %VERSION%/%SHORTVERSION%
syntax seem to be some leftover from pre-git times?

All in all, I doubt the need for this file.

Change-Id: I52e93b056d17e05831f97d6c34232b3265accba7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 329683795d177c0f257f6ab835914bb0b1786d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-12 11:33:26 +00:00
Kai Köhne
8f6d23fc87 Doc: Mention that you cannot order QVariants anymore
Task-number: QTBUG-87263
Change-Id: I3d1332c43e4c06d47b249e4b9adb32685070f56a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1f242e0ab0736c76515b95687858a0f0e9096a7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-12 11:33:25 +00:00
Alexey Edelev
a8dc7b7a1a Replace flags with spaces when removing them
Removing flags based on REGEX may include spaces, so flags might be
glued. Replace flags with spaces to keep at least one space for
the described case.

Fixes: QTBUG-94400
Change-Id: Ice268da36174ef5cf4398d2aee8fcd4731336316
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 523ee5577a3fb1801dc765511c2c76753c10a72e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-12 00:22:25 +00:00
Edward Welbourne
02c7b658f6 Fix date parsing when local time lacks the start of the day
The case where a parsed date-time fell in a transition, but only
because the default value for some field lead it there, only dealt
with the case of parsing a date-time, which is the only time it should
be relevant. However, since the date and time do get combined as a
date-time (even when only one of them is relevant) the same problem
could arise when parsing a date (on which the current time-zone
happened to make a transition at the start of the day) or a time (if
the default date happens to be one on which the current zone had a
transition).

So handle both of those cases, as well as the date-time case.

Fixes: QTBUG-91120
Change-Id: I565d115eb85cd2ee69fa500fcd40b05bcf8f6fff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f9469990d0fb1ae9444d415390ec8be483ec4ab3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 21:57:24 +00:00
Alexandru Croitor
eda9ff2bc4 CMake: Fix Qt tool apks not to be built as part of default all target
The code already checked for QT_BUILDING_QT to decide whether the
'apk' target should be part of the default 'all' target, but it only
worked properly for qtbase.

The 'apk' target was created before the value of QT_BUILDING_QT is set
when building other repos like qttools.

Postpone the decision on whether 'apk' should be part of 'all' to the
first call of qt_add_executable -> qt_android_add_apk_target.
At this point QT_BUILDING_QT will be defined.

Achieve that by relying on an additional 'apk_all' target as an
implementation detail.

Amends 8b8679f73d6cfb513141cc0a9f4925a64ca19455

Fixes: QTBUG-94442
Task-number: QTBUG-94264
Change-Id: I92ff0a7eef2caad244340ab7835e77c9fb3377c0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1d05dcb3ec677a301a5a626384b2bf8003af2663)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 17:57:38 +00:00
Edward Welbourne
71567de75b Remove pure-virtual-signals.h include from tst_moc.cpp
The relevant test is conducted by tst_Moc::warnOnVirtualSignal(),
added in 2009, <quote>

    Fix Warning saying that signal cannot be made virtual

    The test for virtual signal did not work.
    But we cannot make an error right now or it might break existing code
    (exemple in task 210879)

</quote> but without removing the #include, so we do still get a
warning about that when building tst_moc.

Change-Id: I5ea18058f22bbd483d1ff18b0ca7b360f6674ed9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f6f6d06028a62fef3e0d8458903549499fced45a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 17:57:38 +00:00
Edward Welbourne
5c0cb9346b Hangul composition: use < base + count checks, not <= checks
Before Unicode 4.1.0 there was an error in the example code for Hangul
normalization that used <= on the ends of some ranges of values, where
they should have used < tests. This was faithfully copied but the need
for correction has only lately come to light.

Thanks to Ma Lin for pointing this out and providing the fix and
test-cases.

Fixes: QTBUG-71894
Change-Id: I5c7fec1f9fac1f7a25b2d5e9c3109a90a7ff49e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 182afbe335a8bd494a86defc5d32da3ae8ec7920)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 12:33:09 +00:00
Joerg Bornemann
557677186a Prevent overly deep build dir hierarchy on Windows
On Windows, building Qt with Ninja Multi-Config failed in a reasonably
named build dir. The reason for that is our deep build dir hierarchy,
created with add_subdirectory, and long target names like
QNetworkListManagerNetworkInformationBackend within that hierarchy.

Rename said target to QNLMNIBackend, and set AUTOGEN_BUILD_DIR to a
short string that does not repeat the target name.

Fixes: QTBUG-94211
Change-Id: Iea6fee012fa46d9bfb01142b60e6cb5273893c50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d23613acf7bfe37c1c78eb9aadc489e888e34dfb)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-11 14:33:09 +02:00
Fan RuiJie
5c70015950 Fix misplacement of placeholder text in QLineEdit with RTL content
The placeholder text was rendered in the wrong position after clicking
on the clear button in a QLineEdit with right-to-left content. The
button was still taking up space while it was fading out, so the first
paintEvent rendered the placeholder with space reserved for the clear
button. Once the button gets hidden, no new update was issued, so
garbage was left behind.

Fix this by not giving a fading-out clear button any margin space. The
result of this is that the placeholder text is visible underneath the
fading-out clear button. This is preferable to the placeholder text
being first rendered next to the fading-out clear button, and then
popping to the edge when the clear button is hidden (which would have
been the result of issuing a complete update for the line edit at the
end of the fade-out animation).

Fixes: QTBUG-93742
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: Id0429362a60bba6839aa02068b00edb15e3ab8ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dc794f7622bc00f7ca50fab65d6965695d6d2972)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 12:33:09 +00:00
Allan Sandfeld Jensen
9b3bf5126b Fix unaligned specialData formats
Handle the case were a format was applied that does not align with
the fragments.

Change-Id: I27593a50c587a5ec0290ff9d0a7a9767a3981cac
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
(cherry picked from commit d93fac3290bc0890a529886a4f991daa77fd6a6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 12:33:09 +00:00
Volker Hilsheimer
2b5bb740d2 macOS: close visible gap between tab bar base line and tabs
Dock widgets enable the QTabBar::drawBase property, but the clip region
left a gap of 3 pixels on each side between the base line and the tabs.
Correct the size of the hole cut into the clip region accordingly.

Visually tested on macOS 10.15.7 and macOS 11.2.1 using the dockwidgets
and tabdialog example.

As a drive-by, fix a spelling mistake in related documentation.

Fixes: QTBUG-86362
Change-Id: Iada027999467741d0590576ee4508e6f41fb056d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f5d6f8dca0c45f311b19731128a495392884ec8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-11 09:35:16 +00:00
Volker Hilsheimer
8856f4bf82 Correctly support style sheet for toolbutton menus and arrows
QToolButton can show an arrow instead of an icon, and that arrow can, as
per the documentation, styled via the ::down/up/left/right-arrow pseudo
element. This was not working at all, as the implementation confused the
down-arrow with the menu arrow. Implement this correctly for all arrow
types.

A QToolButton can also have different ways to show a menu, either by
using a separate section of the button that can be clicked; this section
can be styled via ::menu-button and ::menu-arrow.
Or by instant or delayed menu popup when clicking the button itself, in
which case the button shows an indicator in the button itelf; that
indicator can be styled via the ::menu-indicator pseudo element.

The old implementation confused the various options, and the name of the
PseudeoElement_ToolButonDownArrow didn't help with that. So rename that
element to PseudoElement_ToolButtonMenuIndicator, and render it when
there is no separate drop down.

Fixes: QTBUG-27640
Change-Id: Ia142a5d7498fa717e70f4e5382305e305b29effa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 2b2e7b2ac50e5b4f6e1888e594f6e32338dd2a80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 23:20:03 +00:00
Zhang Hao
10ecb8ebc1 Check scrollbar ScrollBarOverlap when computing QListView margins
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if QStyle::PM_ScrollView_ScrollBarOverlap
returns true, the text displayed an empty line.

Fix this by not reserving the width of the vertical scrollbar
if the flow is TopToBottom and the vertical scrollbar, and QStyle
returns true for PM_ScrollView_ScrollBarOverlap. Amends
aeef92c3c33e4ebcb7e5d8dd955020f4f4600e84

Fixes: QTBUG-94248
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I4d47c7e86bbb86474cb1a99bb26d8b67f0e8a7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0242be90606b377864c6fd02d5a8e0afaf635acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 16:11:28 +00:00
Kai Köhne
07c87a56f2 Doc: Fix QVariant documentation
Update documentation to not reference API that is obsolete in Qt 6.
Also fix documentation for changed behavior (isNull()), and
fix snippets.

Change-Id: I526efeff63d907bbadd5e8a539ccf237cb992125
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 704f0354998937363162fdb9ed6984a7339bc370)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 13:56:59 +00:00
Paul Wicking
40b0bb1e8b Doc: Add disclaimer about QtPrintSupport not being available on iOS
Fixes: QTBUG-91025
Change-Id: I9f206509a3f3e74e01ae76ae36e275dc79743d11
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fee0a63db9f2fdd6999610c3a72961fadcec01a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 11:16:31 +00:00
Laszlo Agocs
89fc92b9a7 Fix inexplicably changed condition in GL backingstore composition
In a13e8d6660913bec172d1374f78083498c539df0 which provided the move
and decoupling of OpenGL code the !makeCurrent-succeeded &&
!context-is-valid condition got changed to !makeCurrent-succeeded &&
context-is-valid which makes no sense because what we test for is
context lost situations, in which case makeCurrent fails and isValid()
reports false.

Restore the ! that went missing in the above mentioned patch.

Change-Id: I94f84d2853bcbd2965f76ecd665d3614b1f0e746
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit c6c6e01e893b211f51511929b4258f789cdfd428)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 08:17:56 +00:00
Volker Hilsheimer
bed5306eaf Fix scrolling of tab bar when the visible tab is wider than the visible space
When finding the index we need to scroll to, use the one where both start
and end of the tab rect are outside the currently visible section.
Otherwise we wouldn't scroll when the left-most index ends outside the
visible section.

Add test, which requires that the scroll buttons have object names.

Fixes: QTBUG-70498
Change-Id: Id153c77dd5fca146612375e0ff39bd1f3e0536b1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 06b1e404c936847038cc7a371720b05f31532b6a)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-10 08:56:27 +02:00
Volker Hilsheimer
460ad31c7a QTabBar: don't let tab shine through (semi-transparent) scroll buttons
On styles where the tab bar's scroll buttons are rendered semi-
transparently, or where the buttons don't fill their entire rect (for
example have rounded edges), the tab that's covered by the buttons
should not shine through the gaps, or even shine through the button.

Clip the painter so that the area of each button is not painted by the
tabs.

Fixes: QTBUG-50866
Change-Id: Ie81f6d260f36d5a17868822e683745844a6a6b2f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0965cf0f1e49185097b0698e51ea9ad464eaa573)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 06:54:00 +00:00
Mårten Nordheim
93450a6ab2 QHttpSocketEngine: Fix memory leak
The reply needs to be parented or it's not guaranteed to be deleted

Change-Id: I7cbc31682f80dbbd9fb240fff9e6781cb6ca7b36
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d8077a0973f362376b69564a730c74e5c9366f8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-10 06:34:24 +00:00
Volker Hilsheimer
8f3dca4555 QAbstractItemView: block autoScroll from interfering with QScroller
When pressing an index in order to start a flick gesture, QAIV sets
the current index. When QScroller changes state to Dragging, then
QAIV restores the current index to what it was before the press, as
the user is clearly scrolling the view. With autoScroll enabled, this
will produce an ugly jump if the old current index is no longer in
the viewport.

To prevent this, disable autoScroll before restoring the currentIndex.

Fixes: QTBUG-64543
Change-Id: I3e0a18a6a179d80b9d810fce5aa658f0cfff9a29
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b1fdcc8c0fefe0660302494618032342b623e199)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-09 23:28:24 +02:00
Tor Arne Vestbø
0f63509353 macOS: Keep NSWindow alive after handling windowShouldClose callback
Option-clicking the close-button on a window in macOS is a request to
batch-close all the windows. When this happens we get an event in through
the window that was clicked, which in turn results in AppKit calling
windowShouldClose: for each window. We respond to that by explicitly
closing each window (instead of just responding YES or NO), which
results in the window being released and deallocated. This causes
a crash when AppKit then follows up by closing each window after we
responded YES to windowShouldClose.

We work around this by keeping the window alive in the closest auto
release pool, which is typically at the level of the runloop. This
ensures that the window is alive for the duration of the logic that
AppKit has for batch-closing windows.

Fixes: QTBUG-92232
Change-Id: I68b6138eb8325af0576b438ffa011137fec27926
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8a4e274dcf836f58c7417c11737bdded50a84dbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-09 14:14:04 +00:00
Jani Heikkinen
d62daf196d Bump version
Change-Id: Ifd79ce1469266b96862a132ea453c3730cafa9f9
2021-06-09 11:58:53 +03:00
Karsten Heimrich
915dd3166a Unify behavior for long path or UNC prefix removal
Split the code out of QDir::fromNativeSeparator into a separate
reusable function to remove the above-mentioned prefixes. Fixes
and unifies behavior if the prefix was given with slashes instead
of backslashes. Add a couple more test cases.

Fixes: QTBUG-93868
Change-Id: Ibd94ae283e2fb113f9c2db97475fbc7d89522bbf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0564ebdb3641d7325f73dbbf2cbb04e6dca92d83)
2021-06-09 04:37:16 +02:00
Laszlo Agocs
e99a9ff495 windows: gl: Print GetLastError() when makeCurrent fails
This matches the behavior of other implementations, such as
QEGLPlatformContext: doing a qWarning with the relevant error
from eglGetError() or equivalent is helpful when something
goes wrong and should be common among QOpenGLPlatformContext
implementations.

Task-number: QTBUG-85714
Change-Id: Ifa5d22b83808c92ae92efcbcddc8d8c3d3ba34b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 03650696a1fb727a337865d43f068ddc7723a893)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-09 00:22:24 +00:00
Volker Hilsheimer
03cb3405ae Correct examples for int validation in QValidator documentation
QIntValidator::validate documents correctly that any input with "at most
as many digits as the top of the range" returns Intermediate. This is
needed to avoid input deadlocks where one can't go from 9 to 15 if the
range is 8 to 16.

Fixes: QTBUG-94269
Change-Id: I6776e09fc231249fe78f9e6106492f8454b70a03
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 4a23a1fbb5f2317f725fff9df2516335db1fac6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 21:48:48 +00:00
Volker Hilsheimer
3df2c4c992 QListView: add assert for static analyzer
The loop that initializes the item should execute at least once, so the pointer
should be pointing to something valid. The static analyzer doesn't see that,
and warns about unguarded access to the item pointer in report with hash
d008dbef4573afca54be0139e2971a4a. Add asserts for both the condition that makes
the loop run at least once, and for the item pointer not being nullptr.

Change-Id: I94b9f3db3b3ce3d82445cf66788c05854b441aaf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ddc886d670694df9e400ea6f04f76df19d0e1145)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 21:48:47 +00:00
Alexandru Croitor
c5c2ca9e22 CMake: Fix global 'apk' target to actually build all apks
This means calling 'ninja apk' in a user project with multiple android
applications will build all their respective apks.

For user projects, make the 'apk' target part of the global 'ALL'
target, so that a regular 'ninja' call implies the 'apk' target.

We don't do it currently for Qt builds, because certain test
executable apks fail to build.

Add a QT_NO_GLOBAL_APK_TARGET_PART_OF_ALL variable to allow removing
the global apk target from the 'all' target.

Task-number: QTBUG-94264
Change-Id: I171b9da50eb7d670176704bd26dc1c492118b434
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8b8679f73d6cfb513141cc0a9f4925a64ca19455)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 21:48:47 +00:00
Volker Hilsheimer
294b50e1f5 Calculate space requirement of menu items based on widest elements
Since icon, checkmark, text, and shortcut are each rendered aligned
within their own column, we need to take the widest of each element
into account when calculating the size requirement of each item. Otherwise
an item with very long text but no icon will get enough space for the
text, but no space for the icon, resulting in the text running over the
shortcut or edge of the menu.

Fortunately, QStyleOptionMenuItem provides us with the necessary
information.

Fixes: QTBUG-86754
Change-Id: I0cf0e9adfe480d1004106e7475e498e718bf027b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c8cb2409477bdc3bc41d6bbdfc5055441cda084f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 19:10:06 +00:00
Robert Löhning
c58d691938 QIcc: Update test for invalid values
This should have happened when changing the code in
f493d41722fc76a04f699ea26128fdf3d215d913

Fixes oss-fuzz issue 31633.

Change-Id: I7945c3f90651f8fa04df20fbaf0b0c7f68619407
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7661fdce0a1a502b1d2f6a89b0d89234b12aabb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 19:10:06 +00:00
Tor Arne Vestbø
a5273d4e56 qmake: Switch to using Xcode's new build system
Now that inputs (81152194) and outputs (3f0858ed) are explicitly set for
the preprocess stage we can enable the new build system.

Using the legacy build system will produce a build error in Xcode 13,
but the build will succeed:

  error: The Legacy Build System will be removed in a future release.
  You can configure the selected build system and this deprecation
  message in File > Project Settings.

Fixes: QTBUG-71035
Change-Id: I108d2103872255d10de2ff5161eef892065da1c4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3d7bdf0d61699cb7fdfcef7fe7b546e3167723b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 15:28:57 +00:00
Andy Shaw
f09f330ea6 Doc: Add a note about a limitation in QDockWidget on macOS
Change-Id: I3599304d2dab9a6e64f110644b22e65494f3c0a8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e5aada1ba7133dedc7ec00e67c5cca68186b738d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 11:16:50 +00:00
Joerg Bornemann
f8238c302f Add proper dependencies to apk targets
Before, building ${target}_make_apk always re-built the apk, instead of
rebuilding the apk only when inputs changed. This patch fixes that by
moving the creation code from a custom target to a custom command with
proper dependencies.

The androidtestrunner tool now does not check for the existence of an
apk anymore and always runs the make command that is supposed to build
the apk.

The ${target}_prepare_apk_dir target is not needed anymore by the Qt
build but is still used by Qt Creator's Android support. Add a
clarifying comment.

Fixes: QTBUG-93431
Change-Id: I00d65d616fef9511b03b65f879c4bc6cb92dfc30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 76eefab088b64f9ba4e5f5c48612bfdd3552081d)
2021-06-08 13:16:50 +02:00
Edward Welbourne
47134f44c1 Fix augmentation of UI language list
Previously, the augmentation wasn't being applied to the system
locale, due to a mistaken test claiming the locale's name didn't
resemble the string from which it was constructed. The test dates from
before various fixes to likely sub-tag processing that should make it
redundant now. This makes QLocalePrivate::rawName() also redundant
(and its conversion of QLatin1String to QByteArray relied on '\0'
termination which wasn't actually present in the various codes).

Expanded the test of systemLocale() to also test uiLanguages() turns a
single entry into the list we expect; and add two new test-cases.
(The test uses a mock system locale class, making this independent of
the platform backend.)

Fixes: QTBUG-92234
Change-Id: I0cdf6eae152a42dc377f4ea3e62c282ff4be1764
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b2871765ced8059e571d17d4010e8d8ada4e9190)
2021-06-08 10:04:17 +02:00
Jani Heikkinen
f55a7e744d Bump version
Change-Id: Icf1e664266f7d477d5f55265c2b1f5eb54d6fa11
2021-06-08 07:47:34 +03:00
Zhang Hao
b3f84f0a73 Clarify the QLineEdit document of editingFinished signal
QLineEdit gets focus and don't type any character when QLineEdit
lost focus, document say QLineEdit will issue editingFinished signal.
In fact,QLineEdit doesn't issue editingFinished signal.
Fix this by clarify the document.

Fixes: QTBUG-94057
Change-Id: I88eed2ec7a28823598dc46f1df26fd305eb99c1f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8ee2186830d33cf2e0ebc7c9ab59166a27fe81a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 00:51:12 +00:00
Volker Hilsheimer
02a5580292 macOS: allow Qt::AA_DontShowShortcutsInContextMenus overrides
Following the discussion in QTBUG-69452, the resulting change in
cc33dd079796437bafed8f42de7fbf8f17d19ec8, and the documentation of
QAction::shortcutVisibleInContextMenu, the intention is that the
attribute allows the overriding of the platform default.

However, QAction did ask both the attribute and the platform
integration, making the override impossible. Instead, ask only
the attribute, but default the value of the attribute to what the
platform integration provides.

[ChangeLog][QtGui][QAction] The shortcutVisibleInContextMenu property
defaults to the value of the Qt::AA_DontShowShortcutsInContextMenus
attribute, which in turn defaults to the platform integration. To
override the default, set the application attribute after
instantiating QApplication, or override the default for each
QAction instance.

Task-number: QTBUG-73990
Change-Id: Iaba330913555d93d05efe1b3965a6aea39db5554
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 68297195759492594ac4143b7f208e17fe6f594b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-07 15:14:25 +00:00
Fabian Kosmale
5f569ed01b QProperty: Fix source_location feature testing
The presence of the source_location header does not guarantee the
availablility of std::source_location. For instance, if using clang 11
with a modern libstdc++, the source_location header is available, but
std::source_location is not available as it would  require
__builtin_source_location, which clang does not implement.

Consequently, we need to explicitly check the feature test macro
instead, and only use std::(experimental::)source_location when it is
defined.

Task-number: QTBUG-94194
Change-Id: If6fda9a1b98244b1f2944fff6fe1991def30fc0f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 1924f78df68d69fa7c69c394c547307e25dfffe1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-07 15:14:24 +00:00
Paul Wicking
9c2660f685 Doc: Add missing preposition
Fixes: QTBUG-93969
Change-Id: I60e08ab7f17459b6cff969767273228a8406cfc3
Reviewed-by: Johanna Vanhatapio <johanna.vanhatapio@qt.io>
(cherry picked from commit 3bc80defdc0ebd77d7eafe32153693aa44c5f2fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-07 06:02:25 +00:00
Kai Köhne
5d00836c2a doc: Remove vertical space before youtube video links in offline mode
The vspan was originally added for iframes. They are not needed
(and look weird) for normal images/links.

Fixes: QTBUG-92266
Change-Id: I9da2b52234b2e49bc0cdef4bf8f0865fb092bb31
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0078a782548dd25c9bc5f9f30d1719b1e9b039ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-04 15:48:42 +00:00
Kai Köhne
9a186e1da7 Fix license information for libjpeg-turbo
Fix the license metadata in that libjpeg contains parts under three
different bsd-like licenses. Also, do include the IJG, zlib
license texts in the metadata.

[ChangeLog][Third-Party Code] Clarified that libjpeg-turbo is actually
covered by three licenses, not only IJG.

Change-Id: I6c4e3e8577bdf83e7e73474b34b0553cbe1d9b6d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 467b39d52c9ab59b1e7518330fbb51d5543ada50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-04 11:50:59 +00:00
Volker Hilsheimer
cc02da23a8 QAbstractItemView: don't block dragging after double click
After d6551fe12520 it was no longer possible to start a drag with a
double click (where the first click selects an item, and the second
press+move starts the drag). Resetting the pressedItem variable to block
the emission of the clicked() signal had this unwanted side effect.

Instead, use an explicit boolean to store that the next release event
will be the result of a double click, so that the clicked() signal is not
emitted again (preventing the double-emission was the purpose of change
d6551fe12520).

Task-number: QTBUG-77771
Fixes: QTBUG-94087
Change-Id: I082c5169d89eb980dcd7985ef3d302b6ff060fb9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Olivier BARTHELEMY <perso.olivier.barthelemy@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-04 03:35:18 +00:00
Edward Welbourne
03f0a26e84 tst_QDateTimeEdit::editingRanged(): use QScopedPointer
Test would previously have leaked on failure.
While checking for other uses of delete-after-checks, simplify one
place that tested deleting a calendar widget lead to recreation.

Change-Id: I9524902a02dd42793bcf71113c6799dc925ac4a0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 4652da536a5db3608e6026b27dfe808227b721f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 15:30:58 +00:00
Edward Welbourne
7f70b5350a Fix copy-and-paste bug in QDTEP::getMaximum()
It had a copy of a line from getMinimum().
The results were predictably broken.

Change-Id: I3582edb08696bec4311f43fc426f7e54dc069f53
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a15a3fef0b5dae4e83bd94b23dd2418208159d05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 15:30:34 +00:00
Assam Boudjelthia
9152fd9873 Silence misleading exception print in setQtContextDelegate
As I understand it, the call to getDeclaredMethod seems to be just there
to check if a given method is declared under before adding it to the
delegates list, and that's why the getDeclaredMethod is not returning
anything, so we could treat it as a failed check and not print anything.

This is an amendment to 80f7494e8a9f9a70e3b53833a098d74d8c2331d9 which
added this print.

Change-Id: I5f69ed5b4fa655da53ac7fba20d4e07acc75607a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit eaac5bae9838a73d0d70004bcb37b97635d1f2d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 09:47:57 +00:00
Assam Boudjelthia
c55ff0fa0b Android: fix mimetype/namefilters handling for FileDialog
Android file dialog uses setType() to set the main mimetype for the
dialog if no mimetype or multiple (+1) mimetypes are provided, then
the additional mimetypes can be provided via EXTRA_MIME_TYPES flag.
The problem was that the mimetypes deduction from the namefilters was:

* the namefilter used was empty, now we take the first item
nameFilters(), because mimetypes cannot be changed once the dialog is
open anyway.
* The regex extraction was getting a namefilter ending with an empty
char and that was giving a mimetype of any format thus making it show
all possible files.

Fixes: QTBUG-83089
Change-Id: Ifaef40c2186732ad3a604d28e086409c35dafacf
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit ed431caa27672427d28f8ecde667a3a064ddda7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 09:47:57 +00:00
Assam Boudjelthia
45b569071a CMake: Add Android's prepare_apk_dir target to ALL
Since Qt Creator uses androiddeployqt custom commands it still needs a
step to prepare the apk dir before building it, so add this to ALL
to avoid having to call it manually in creator.

Change-Id: I0a2816244589e9b296a326fcc1abf8c08aabfea7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 71348437939e62b0e3b86888e966b300ff1e2855)
2021-06-03 09:47:57 +00:00
Volker Hilsheimer
d3550bce2c macOS: render shortcuts in context menus correctly aligned
On macOS, shortcuts should be rendered along the imaginary line between
the modifiers, and the key. The modifiers are right-aligned on the left
side of that line, the key left aligned on the right side.

Make an exception for multi-chord sequences, render those always left
aligned.

Fixes: QTBUG-73990
Change-Id: Ie03f3f40278700bdfafbfca7aa52075825e20234
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 64a64fd485bd78f44b93beb3d712db67b6d33c05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 07:03:31 +00:00
David Faure
ecbf45a732 QSortFilterProxyModel: create mappings on demand again
Calling create_mapping in setSourceModel as introduced by 8455bfee76ed3f1bd3bba8bd3688a7afa94ae0bb
can lead to an early call to filterAcceptsRow, and some existing applications may crash.
It is also an incomplete solution since it was only done for the
toplevel index but not for child indexes.

Instead, go back to creating mappings on demand.
This means coming up with a different fix for QTBUG-87781 (dataChanged
not emitted for indexes that haven't been mapped yet, i.e. not queried
or shown anywhere).

When this happens, we can't know if the index was previously filtered
out or not (for lack of a dataAboutToBeChanged signal...). Creating
the mapping with the new data only gives us the new state of affairs,
there's no reference state to compare to. Therefore, when the mapping
is missing (during dataChanged handling), create it, but skip all the
logic about row insertion/removal, just forward the dataChanged signal
if the row isn't filtered out.

Creating the mapping might require creating first mappings for parents,
recursively, which wasn't done anywhere in QSFPM yet, hence the new
create_mapping_recursive() method.

In addition to all this, the handling of removed items was incorrect,
remove_source_items did nothing if the parent was gone, and then
source_items_removed was trying to adjust indexes in an incorrect list.
If the parent is gone, clear the proxy_to_source list, so there's
nothing to adjust afterwards. This bug actually doesn't happen anymore
in this version of the patch, but the change still seems right and might
prevent repeating a long debugging session in the future.

Thanks to ChunLin Wang for the unittest in this commit.

Done-with: ChunLin Wang
Change-Id: Id543d0cc98f1a03b5852bda01d2f49b980e06be7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 4ec5622e62e6fd521e1193f1d6084901f09e7e9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-03 01:21:05 +00:00
Assam Boudjelthia
909306fc9e CMake: Add Android's prepare_apk_dir target to ALL
Since Qt Creator uses androiddeployqt custom commands it still needs a
step to prepare the apk dir before building it, so add this to ALL
to avoid having to call it manually in creator.

Change-Id: I0a2816244589e9b296a326fcc1abf8c08aabfea7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 71348437939e62b0e3b86888e966b300ff1e2855)
2021-06-02 17:53:39 +00:00
Assam Boudjelthia
6b136c7781 Android: fix mimetype/namefilters handling for FileDialog
Android file dialog uses setType() to set the main mimetype for the
dialog if no mimetype or multiple (+1) mimetypes are provided, then
the additional mimetypes can be provided via EXTRA_MIME_TYPES flag.
The problem was that the mimetypes deduction from the namefilters was:

* the namefilter used was empty, now we take the first item
nameFilters(), because mimetypes cannot be changed once the dialog is
open anyway.
* The regex extraction was getting a namefilter ending with an empty
char and that was giving a mimetype of any format thus making it show
all possible files.

Fixes: QTBUG-83089
Change-Id: Ifaef40c2186732ad3a604d28e086409c35dafacf
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit ed431caa27672427d28f8ecde667a3a064ddda7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-02 17:53:39 +00:00
Assam Boudjelthia
078559a6ea Silence misleading exception print in setQtContextDelegate
As I understand it, the call to getDeclaredMethod seems to be just there
to check if a given method is declared under before adding it to the
delegates list, and that's why the getDeclaredMethod is not returning
anything, so we could treat it as a failed check and not print anything.

This is an amendment to 80f7494e8a9f9a70e3b53833a098d74d8c2331d9 which
added this print.

Change-Id: I5f69ed5b4fa655da53ac7fba20d4e07acc75607a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit eaac5bae9838a73d0d70004bcb37b97635d1f2d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-02 17:53:39 +00:00
Nico Vertriest
32d4abd3a3 Doc: Fix warnings about wrong snippet path or missing .pro file
Task-number: QTBUG-91147
Change-Id: I6a55b2b713dd70cf1cbb0b93a8d4152e175e2c4d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 3fa50b7b4167940f44fbf30b5a51c54d4f3d9559)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-02 12:30:58 +00:00
Li Xinwei
4428f078e7 CMake: Fix generated prl and pri files for MSVC
In MSVC static build, if we build Qt with 3rdparty library (e.g. zstd),
cmake will add"zstd" (without "-l" prefix) to Qt6Core.prl. Then we
use this Qt to build a qmake project, compilation will fail due to
missing zstd.obj. Without "-l" prefix, qmake will treat "zstd" as an
object file instead of a library.

Library names in qt_module.pri and qt_lib_*_private.pri are also
missing "-l" prefix.

This is because on most compilers, CMAKE_LINK_LIBRARY_FLAG equals
"-l". But on MSVC, it is an empty string. So we should pass
"-DLINK_LIBRARY_FLAG=-l" for MSVC.

Also add "-L/path/to/library" if the library path is not in default
linker search directories. This will write un-relocatable paths to prl
files only when using 3rdparty libraries to build Qt statically. Usually
it's not a problem.

In addition, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is also empty on
MSVC. So The third argument of "$<FILTER>" is empty, it is an invalid
generator expression. This means no include dir will be written to
qt_module.pri and qt_lib_*_private.pri on MSVC. So only use "$<FILTER>"
when CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not empty.

Change-Id: Ib66f95dc09cf920363a4b9338fb97747dd2f8ab7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2c49f85380d7ad79d9473e0f42e7afaa36d31af9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-02 08:25:04 +00:00
Friedemann Kleint
a3b1f4e463 Regular Expression example: Brush up and add a way to preview replacements
- Set a fixed font on text edits so that parentheses stand out
- Rearrange the layout to have the text at the top be prevent
  long texts from being wrapped
- Add a replacement field where one can exercise replacement
  with the \1, \2... placeholders.

Change-Id: I140a62e1fb2cd1c6bfe02a2f01b7f06a6f3b5eb2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 6ac77e81aec0b48a76b385092d9050941fa0e257)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-02 05:39:27 +00:00
Friedemann Kleint
07ff2fcf41 Fix QSettings documentation
QMainWindow::saveGeometry()/restoreGeometry() should be used
to save and restore geometries instead of saving pos/size
since it also works in multiscreen settings.

Change-Id: I27cc5ec13e69266367f035796e208d214f84b043
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c59fbf576d2995f1c4fb52c1b21cf7d29cdf1a50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-02 05:39:21 +00:00
Inho Lee
4a8aa7f62c QtGui/math3d : Fix QQuaternion::getEulerAngles
When rotating M_PI_2 based on x-axis, quaternion to euler conversion
makes NaN for the x-rotation value.  This patch fixes this corner case.

Fixes: QTBUG-93600
Change-Id: Ice321a80ad90dba9cf3ee3a14ec7d3d047c21bd3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 7ea2fbddcf674d49ad7d219cdb8a4b760258360c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-01 20:56:10 +00:00
Joerg Bornemann
de86dac33c Pass OpenGL_GL_PREFERENCE variable to other Qt repos
When building Linux packages, we pass OpenGL_GL_PREFERENCE=LEGACY when
building qtbase. This is done to link against legacy OpenGL libs.

When building non-qtbase repos, we also need to set this variable to the
same value we have in qtbase.

Task-number: QTBUG-89754
Fixes: QTBUG-94040
Change-Id: I567b629d245025d2b1544b91cfc265a9c921725f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 20feedac95c519c71d4db93ab28ad1a110dfbcca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-01 20:56:10 +00:00
Joerg Bornemann
234cabe51b Add QT_CONFIGURE_RUNNING variable for configure.cmake files
configure.cmake files are read twice when using the configure script /
qt-configure-module: First, when configure is running and a second time,
when CMake creates the local build system files.

In the first run, not every function and esp. no targets are
available. Code in configure.cmake that accesses targets or calls
functions unknown to configure will fail at the configure stage.

This patch introduces the QT_CONFIGURE_RUNNING variable that can be used
in configure.cmake files to guard such code:

if(QT_CONFIGURE_RUNNING)
    set(_qt_coord_type double)
else()
    get_property(_qt_coord_type TARGET Qt6::Core
        PROPERTY INTERFACE_QT_COORD_TYPE)
endif()

Change-Id: Iff39924d6a5133379d28c8204d7b7afdf47de5c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 37452051d6b68f20a52c65cffd3cde5cb323156e)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-01 15:23:36 +00:00
Nicholas Bennett
40c0f00ac0 Update the COIN build instructions to also build creator help file
Changed the cmake build target from "generate_docs" to "docs"

Fixes: QTBUG-93174
Change-Id: I244290888f578ccfee4c733cd8f93bb6faed4fda
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 190ef1c23b1b596662020b0b1ef4290c97da781c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-01 11:58:59 +00:00
Giuseppe D'Angelo
47a1e10d63 SQLite driver: fix crash when binding a QByteArray/QString
Passing SQLITE_STATIC to sqlite3_bind_*() means that ownership
of the data stays in the caller, i.e. SQLite itself doesn't make a copy;
such data must be therefore be kept valid until sqlite3_step() is called.

The code in the SQLite driver uses that option to avoid copying byte
array or string data. But, unlike what the comments in the code say, we
do NOT keep the QByteArray/QString alive long enough: they're contained
by a temporary QVariant object which gets destroyed at the end of the
loop that binds each argument.

Luckily the fix is simple: since that QVariant is just a copy of the
QVariants used as bound parameters, and these are held in a container
(which lives long enough), simply create a reference to the container's
elements rather than a copy. This ensures that the data is alive by
the time sqlite3_step() is called.

This problem doesn't normally appear because of implicit sharing of
QByteArray/QString. When the QVariant is copied, the inner element
is just a shallow copy. Getting the pointer to the data, and destroying
the QVariant, does not destroy the data (it's kept alive by the
QByteArray/QString inside the *copied-from* QVariant).

Of course there's a catch: if the *copied-from* QVariant contains a
QString created via fromRawData, then everything blows up. In this case,

1. the copied QVariant is created (which bumps the QString refcount)¹
2. the QString inside of it is accessed directly (via
QVariant::constData)
3. utf16() is called on that string, which detaches it (!)
4. the result of utf16() is passed to SQLite, with SQLITE_STATIC
5. the copied QVariant is destroyed; this destroys the inner QString,
which, being detached, deallocates the data too early.
6. sqlite3_step() is called, kaboom.

(The copied-from QVariant still has the string created by fromRawData.)

¹ Note that QString uses the Small QVariant Optimization, so the QString
object itself into the QVariant is copied, it's not just a *QVariant*
refcount increase.

Change-Id: Idcdb192809f1f8f79b4a901e1247f933eb06e854
Fixes: QTBUG-94070
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 0f38259cb3aee5cce5a2af99af3f69712c9f1123)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-01 00:10:42 +00:00
Igor Kushnir
122455d37e QWidgetTextControl: ignore GroupSwitchModifier for BackSpace
"The keypad and group switch modifier should not make a difference" when matches a QKeySequence, see QKeyEvent::matches() implementation.

Qt(xcb) treats AltGr as GroupSwitchModifier in hard code, which should
come from Qt 4 era. Nowadays, with different xkb setups, Mode_switch
could be different keys. When it is AltGr, Qt will get AltGr as
GroupSwitchModifier. When it is not AltGr, another key like
Less/Greaterkey(details in bug report), GroupSwitchModifier will not
be set in the case.

Fixes: QTBUG-36565
Change-Id: I7251963d41a70d61800d25e43d5012b859693f69
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 4b0b87b5c2173ee70eacfdd7cea08aea8a5164c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 18:17:39 +00:00
Laszlo Agocs
4aae624836 rhi: d3d: Avoid debug layer warning when having no vertex inputs
Fixes: QTBUG-94064
Change-Id: I03237fcff06225ba41c65c0171d77fb6ae75fcd3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 347310eb21facbd03d2168d67d83fdbfd6f6888c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 18:17:36 +00:00
Kai Köhne
f8537be746 blake2: Fix MSVC warning C4804
Change-Id: I392da957b9cc84f55bb8eaeb888ca5dd35ec36f2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 10368c61a97efe9862a73432d0ff3851a12b096b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 10:19:46 +00:00
Alexey Edelev
2f82546d4b Avoid blocking read from stdin when collecting json files
Change the behavior of moc when collecting json files. If argument files
are specified, suppose moc received empty input and skip input from
standard input.

Fixes: QTBUG-93504
Change-Id: I45ec790ed458f1fae543d069555bc8abc6560816
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c4b5e84e9e112fab25301f80806e8c66f418594f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 10:19:45 +00:00
Tang Haixiang
bd73184395 Fix PageDown behavior and PageUP
When the PageDown is pressed, the current's rect cannot be
used to match the item, because we don't know the size of
the rect. Move the rect by the height of the viewport, and
then move the rect upwards until it matches the
button <= viewport's bottom of the item

Fixes: QTBUG-92583
Change-Id: I210edc0e8b942984f3fc20e7752c6e1315152ea1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c77840d734883c91079c942e052cbdc0994c2f01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 04:04:00 +00:00
Volker Hilsheimer
1a081042ab QComboBox: add space for scrollbar if needed after showing popup
QComboBox tests if a horizontal scrollbar is needed before sizing and
showing the popup, but QListView only knows whether a scrollbar is needed
only after laying itself out during the initial show and paint event.

So test whether the need has arisen as part of this initial layout, and
then provide the additional space. Resizing the widget after showing it
is not ideal, but in practice makes no visible difference (and it's
either way preferable to not being able to access the item covered by
the scrollbar).

Fixes: QTBUG-93736
Change-Id: I0bf077e18116ce174ae7f9218cb3b0dfa82964e1
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 11e88eaa6df629a2c23a60815a1f7826dd2ac31a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 01:26:08 +00:00
Giuseppe D'Angelo
8b31023ab6 PCRE2: upgrade to 10.37
New upstream release.

Change-Id: I3a7e6c3d6706c940c0a279e4b63e1bfd96cc242c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4ee4b7a8716dd2ffb7b67032aaa0766bc9b33bdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 01:26:07 +00:00
Volker Hilsheimer
0d97ce82cf QComboBox: propagate style change on widget to internal container
When changing the style of the combobox, the change will not propagate
to the internal container widget, so the changeEvent handler won't be
called. This is correct (as per QWidget::setStyle documentation).
QComboBoxPrivateContainer asks the combobox style for relevant settings,
such as the frame style, which is then used for sizing and positioning.
If the combobox's and container's settings become inconsistent, then the
combobox popup will not get the correct size and/or position.

Move some of the style-dependent changes into a separate function and
call it when the QComboBox::changeEvent handles the style change so that
both widgets have a consistent set of settings.

Add a test case that verifies that the style is asked for the relevant
setting when the style changes.

Note: QComboBox does a lot of style-dependent setup work in different
places, which is quite messy and complex. Trying to consolidate that
further breaks tests though, so this change is doing the minimum
necessary to fix the reported issue.

Fixes: QTBUG-92488
Change-Id: Ia957d504b2d800add26fc0565be727b5c08a5358
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit d36ef40d18b40cfc6f57c1002079f02a15eb41d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-31 01:26:07 +00:00
Assam Boudjelthia
af6ef2345e Fix set*Field JNI template calls
The calls were trying to pass a JNIEnv* from a QJniEnvironment using
conversion operator which was removed, and weren't detected since they
are templates and were missing tests. This fix that and add test cases
for setField() and setStaticField() calls.

Change-Id: I6e1e6b7f557bbc664248ad364c48d63f58b70756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 45daea19c393259297973ce99ce8717965e62224)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-28 11:56:10 +00:00
Assam Boudjelthia
75a887ec1d Add documentation links for some JNI entities
Add doc page link for:
* AttachCurrentThread call.
* Interface Function Table which describes JNIEnv.

Change-Id: I12b41429c40838e5133e58132930aede287e2e71
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit d72067c93833e9787a45aeddee800faab0d2d40a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-28 11:55:47 +00:00
Volker Hilsheimer
b9588c0dfd macOS: don't show invisible separator items
Give QCocoaMenu access to the item's visibility property by adding a
public getter, and respect that state when syncing the separator to the
corresponding QCocoaNSMenuItems.

Fixes: QTBUG-88651
Change-Id: I7e238e5d3be141ec8f4e8f6f3ab22d761094d2d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit a3f3af8a8fb8f8b09d1685df5ab836244f850a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-27 20:18:42 +00:00
Volker Hilsheimer
36bdb82c56 macOS: respect underline attribute in menu item fonts
When we draw menu item text with CoreText instead of QPainter, then we
need to translate QFont::underline() explicitly to an entry in the
attribute dictionary.

Task-number: QTBUG-73990
Change-Id: I7e0c258f7cf80a89b29517fa8122576342654de1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5ac479f5990a4c2b09ea34fb98d10c17d405aa5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-27 16:19:22 +00:00
Aleksei Nikiforov
e6d4a052a6 Qt xcb: remove false detects of Qt::GroupSwitchModifier
In some cases, if X11 is configured with CapsLock as
keyboard language switch key, and CapsLock is toggled
via Shift+CapsLock key combination,
toggled CapsLock is falsely detected as Qt::GroupSwitchModifier
for subsequent key events.

This change fixes this false detect,
but doesn't fix detection of Qt::GroupSwitchModifier
which is likely still broken.

Fixes: QTBUG-49771
Change-Id: I485e2d4f3c654707c62adaba367c1b8afb3fc36c
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 25a7034d78aeb12726a1052d64c0aa3314a1f69d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-27 16:19:22 +00:00
Kai Köhne
9fe4effc44 Silence warning C4996 (use of deprecated GetDesktopDpi)
Silences warnings

   warning C4996: 'ID2D1Factory::GetDesktopDpi': Deprecated. Use DisplayInformation::LogicalDpi for Windows Store Apps or GetDpiForWindow for desktop apps.

Using GetDpiForWindow sounds like the right approach, but it's not obvious
where to get the window handle from here.

Task-number: QTBUG-94043
Change-Id: I2fc005e0c970c8338184f4500b876774ec9d976b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit fd9c2c803363d2036ba497946c2eee58b4c4fe18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-27 12:28:27 +00:00
Eskil Abrahamsen Blomfeldt
62769489e3 minor: Clean up areMetricsTooLarge() conditions
This amends e2bdff3555f8c2a275c7bbcf964d939a5f489100.

The linearAdvance property has some history. First it was
a 16 bit value (allowing for 10.6 fixed point numbers). Then
it was turned into 22 bits to fit the 16 bits of Freetype
integer parts into it (16.6). Then back to 10.6. Then in
b7e436738756b1d5d7a45201b7a7204d7fe128a1 it was turned
back into 16.6 again. But this was accidentally reverted
as part of a bad conflict resolution in
afb326f07109da0035112e6f56e683e37b8a5d72.

Since there was no check for it, we would sometimes overflow
the linearAdvance, but only in the rare cases where the
width and height did not also overflow. Specifically this
is the case for whitespace, which always has a width of 0
regardless of the advance.

This change just moves the linearAdvance condition in
together with the other checks to avoid fragmentation, and
also adds this fun story to the commit log.

Change-Id: Iaac09942f4c50d1aced4a160b6eabb11eb8e6373
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit a5085d7f6ac0ee4e066431ec9a99b7e0f13d2d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-27 08:14:04 +00:00
Joerg Bornemann
ae4dc69d6d Doc: Extend qt_add_resource documentation
Change-Id: Ia76b1e681eb15cc8ad9de04bb80654e35442c82b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7bc91dbe9344b3537cbc786c2ce723b0ddc0885f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-26 08:46:03 +00:00
Fabian Kosmale
9bed8335f7 QSharedPointer: Use matching new/delete
When a weak pointer calls getAndRef and there is no strong reference
yet, getAndRef creates a new ExternalRefCountData. Normally,
ExternalRefCountData is never constructed directly, only its subclasses
are constructed via placement new into a memory buffer.
To that end, ExternalRefCountData has a custom operator delete, which
calls the global operator delete (do deallocate the memory buffer
correctly).
When using operator new directly in getAndRef, gcc notices a new/delete
mismatch with the delete in the same function: global operator new
matched with class operator delete. This isn't actually an issue in
practice, as the class operator delete simply calls the global delete.
But to avoid the warning, we can simply call the global operators
explicitly.
To make it clear that allocation of ExternalRefCountData requires some
care, we additionally delete the class operator new, and only allow
placement new (or usage of global operator new, as in getAndRef).

Task-number: QTBUG-93360
Change-Id: I132d1e4e07520eadc5b8f3f955c06aecec80c646
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5e96c64afb274a3cc4364b1390ce0b776d637dd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-25 23:29:39 +00:00
Andrey Butirsky
80fe72c6ec qxkbcommon: Map Super/Hyper to Meta early enough to have an effect
Super/Hyper keys are detected during a direct mapping phase, but the
function returned before the translation to Meta could take place.

Task-number: QTBUG-62102
Change-Id: I9f7ccfd757fa86dbc648951306deb1b43ccf4167
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
(cherry picked from commit b45b9090c3b66d541f57f8d049c22247f8c115ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-25 23:29:35 +00:00
Kimmo Ollila
ec28a74a1c Add #include <mutex>
Needed for having std::unique_lock

Change-Id: I3665e9e2afab0d9230778b8b36f2b7f0c8f44a2a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 95c6eb2f2e8836e1fdf490560c404654f87d3f9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-25 12:28:42 +00:00
Haoyu Liu
7708565ec2 CMake: fix CMake function qt_commandline_addString
1. a missing '}' breaks CMake
2. the variable "opt" should really be "arg", otherwise it'll be meaningless

Change-Id: If29557998bf7aa786dc5c821e2c55f1195e7922b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c3804ba061ef7ea073dab2855502d35a4d3a67df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-25 12:28:41 +00:00
Friedemann Kleint
192991ae35 QTestlib: Fix formatting of pointers in QCOMPARE
After 1ed8a7bff503aacf55f7f880ddaad461ea15e5e1,
volatile needs to be specified for toString(), else it is not
used by compare_ptr_helper(). Add an overload.

Change-Id: I3c335f324df346233623272d1014c8360ca33160
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6fff7bb2692ecda1cff8624f5eccc0a2528fb693)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-22 22:53:46 +00:00
Joerg Bornemann
142777a608 Support multiple equally named .qrc files in qt_add_big_resources
It is now possible to call qt_add_big_resources with multiple .qrc files
that are in different directories but have the same file name.
Before, this resulted in target name conflict errors.

Fixes: QTBUG-93230
Change-Id: Ic3d9d6974a107163aeb7ada0b6f1fa113fb18de0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 895edcd7cdcf47ec9238d42db742f81c5c2eaeb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-22 20:32:36 +00:00
Zhang Xiang
9433614df2 Fix namespace error of std::source_location under C++20
With C++20 standard, src/corelib/kernel/qproperty.h of Qt Base cannot be
compiled at line 100:

QPropertyBindingSourceLocation(
	const std::experimental::source_location &cppLocation
	)

The reason is that source_location has been merged into namespace std
since C++20, and the header file has also been change from
<experimental/source_location> to <source_location>.

The problem can be avoided by define a constant.

Fixes: QTBUG-93270
Change-Id: I46b4daac6ea20f9623b43746880500d41396afb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 675a4b0cc77a81d92cea6e044200349676f3b117)
2021-05-22 16:22:51 +00:00
Dongmei Wang
5369a28df6 QFileSystemModel fails to locate a host from root's visible children
In QFileSystemModel, in some cases the hostname in a UNC path is
converted to lower case and stored in the root node's visibleChildren.
When QFileSystemModel sets the UNC path as the root path, it tries to
get the row number for the host, but it didn't convert the hostname to
lower case before getting the row number, which resulted in the host
not found in the root node's visible children. As a result, it returns
-1, an invalid row number. Change the behavior to find the node for the
host using the host name case-insensitive and then get the row number.

Fixes: QTBUG-71701
Change-Id: Ib95c7b6d2bc22fd82f2789b7004b6fc82dfcb13b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit e253a30238ed1a93877780428c035d3b7a53e22a)
2021-05-22 13:50:57 +02:00
Nico Vertriest
27ba40b049 Doc: Fix qdoc warnings in qtbase
Fixes: QTBUG-93496
Task-number: QTBUG-90662
Change-Id: I894ed70ca8514cfb0afc7e547c7fe3efadcaad50
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9c6df426b73453d1e5e5dbad40ad38d67f0ba5d0)
2021-05-22 00:16:39 +00:00
Joerg Bornemann
49c5cde24e rcc: Fix error message when temporary file cannot be opened
If rcc cannot open the file passed with --temp, display the path of the
temporary file, not the one of the output file.

Change-Id: I58f8ab2f68ac2f1a19feb6b02974dff9fc8b7ec1
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit c3b5ca129af42056184670e154c5dd17762e41f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-21 21:15:51 +00:00
Tor Arne Vestbø
f3e861819d macOS: Don't wrap key event keys in QChar
Key events have a wider range of possible values than the unicode range,
as they also include all the special keys as defined in Qt::Keys.

Instead of turning the argument to keyMapForKey into an integer,
we can remove the argument completely, as it was only used as a
fallback in the cases where UCKeyTranslate (or in the future,
charactersByApplyingModifiers:), failed to map the virtual key
and modifiers to a character. But in those cases we should not
fall back to the Qt key from the key event, as that doesn't
match what the keyboard layout defines. Most keyboard layouts
explicitly define the base key as the key for these "undefined"
mappings, but if the keyboard layout does not, we should not
produce any input in the application, to match what AppKit does
in this case.

Fixes: QTBUG-90315
Fixes: QTBUG-92891
Change-Id: Ib9ffd9521049ee8e4b103597c1d34cbe3d23dbdf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 6faa33192c99f3432b28591b991918b47bd6fa09)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-21 18:08:10 +00:00
Alexey Edelev
9e908fc57a Enable UNICODE for all Qt targets and Qt consumers by default
After discussion we decided to opt-out the UNICODE definintion
behavior. To disable UNICODE in user projects the
qt6_disable_unicode_defines function could be used.

Amends 5b64e5950cf984abb7d47e0802bcb4b5a21e06fa

[ChangeLog][CMake] Enables the UNICODE and _UNICODE definitions on
WIN32 platforms by default for all cmake projects to reflect the
qmake behavior. Use qt6_disable_unicode_defines function to disable
the default unicode definitions.

Fixes: QTBUG-93895
Change-Id: Id70ff7dcf8c74f660ec851f8b950e1e3b94d9fb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 715041b663ababa8b36f90978d20bdcdd80e3117)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-21 20:08:10 +02:00
Albert Astals Cid
28431c02c2 Make sure _q_printerChanged is called even if only pdf printer is available
Otherwise things like the pagesRadioButton don't get properly disabled

Change-Id: Idc0693b6747f13da5afb22e2187af310a5b454f8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 973700c54678803a2600dfa60112f29f15705197)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-21 12:53:40 +00:00
Allan Sandfeld Jensen
7b3635e013 Avoid mixing atomic futex changes and QAtomic
Either the mix of futex and atomic, or the mix of 32-bit futex and
64-bit atomic doesn't work. In any case, the existing code leads to
bad behavior.

Fixes: QTBUG-92188
Change-Id: Icc6ba28d6e2465c373d00e84f4da2b92c037e797
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2d9cc639a4a7a5e97979a6034364bd67dfa10c23)
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-05-21 10:16:13 +02:00
Eskil Abrahamsen Blomfeldt
562187fc55 Fix memory leak when using small caps font
The small caps version of a font is kept as a QFontPrivate*
which is manually reference counted, but we neglected to
actually delete it when the reference count went to 0.

[ChangeLog][Fonts] Fixed a memory leak when initializing
a small caps font.

Fixes: QTBUG-93068
Change-Id: Icc7fb7a59bf523da84d2e6fa026940a7d1230525
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 11a40defff51dae2476e0da9f2b995a3a0f3bda8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 19:47:07 +00:00
Alexey Edelev
55522636e3 Do not expose Qt internals by the HEADER_MODULEs
HEADER_MODULEs use the INTERFACE visibility to link libraries. This
causes a transitional propagating of the Qt-internal compile definitions
and options to the user targets.

This commit avoids an implicit adding of the Qt::PlatformModuleInternal
library to the HEADER_MODULEs and stops propagation of the Qt-internal
compile definitions and options. If module wants the transitional
propagation of some properties, this needs to be done explicitly.

Amends 8b7894cb637d21d8fa9bd129849cd23462632d28

Fixes: QTBUG-89951
Change-Id: Ia9cecc38bac98eb5bc6e47d288308b49813ab5ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5b64e5950cf984abb7d47e0802bcb4b5a21e06fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 19:47:07 +00:00
Tor Arne Vestbø
4e58b19b0c macOS: Restore logic to set wantsBestResolutionOpenGLSurface
The logic was removed in 1fc7ca091b3fdda52381a383318a3a752ec21132 when
we removed support for surface-backed views, based on the documentation
for wantsBestResolutionOpenGLSurface noting that layer-backed views
ignore the property.

But in some cases, when plugin views are embedded into host views, and
the host was built with a pre-10.14 SDK, AppKit seems to get confused,
and we still need to set this property.

Fixes: QTBUG-93770
Change-Id: Id67f2fcb8c090c0e01c05d00792eaef311146df1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 40878e75176880e95398604d9e63be2138cc642b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 19:47:06 +00:00
Joerg Bornemann
d7ea41ab03 Fix qt6_add_big_resources
The qt6_add_big_resources command was dysfunctional whenever AUTOMOC was
enabled for a target.

We passed multiple object files with the --temp argument of the second
pass of rcc. We must pass exactly one. The spurious object file was the
one that's created by AUTOMOC. Turn off all of AUTOGEN for the C++
source file that's generated in the first pass of rcc.

Enable AUTOMOC for tests/auto/cmake/test_add_big_resource to cover this
situation.

Fixes: QTBUG-85051
Change-Id: I6d2ce4953297db0751913456db0a4a126fe33f14
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9e8f43e5accba52b3df6e202759f5ea9b8620e5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 19:47:06 +00:00
Tor Arne Vestbø
e8a2985650 macOS: Fix warning about comparing different types in QCocoaScreen::isOnline
Change-Id: Ieb70108d22bf254c69665e5b3e3a2988703e26a2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 640eb55c130c6c2c982dc212a8a5bd2b8fb7a225)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 19:47:06 +00:00
Volker Hilsheimer
1b26b5bc2c QXcb: don't dereference pointer before checking
The virtualDesktop pointer is expected to be populated by queryPointer, but
that method handles the case that there either is no reply, or that the
reply doesn't match, in which case the pointer remains nullptr.

Don't dereference it afterwards without checking.

Addresses code checker warning a179d1087759bb6ca9c3380257bd70d6

Change-Id: I5877f26fd3b49327c0de3f2c918bb606bee8ac57
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c2258e85a32b66cf7cbc59a4789e68c31c9955be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-20 16:03:10 +00:00
Alexandru Croitor
3adf4877a4 CMake: Don't do plugin initialization for static libraries
Q_IMPORT_PLUGIN generates a global static symbol that initializes a
plugin. If this symbol is added to a static library and the library
is then linked to an executable, the linker decides that the symbol is
unused (because nothing references it) and discards it.

This means there's no point to compile the Q_IMPORT_PLUGIN containing
files into static libraries.

Change the generator expression we use for plugin propagation via
associated modules to not compile and link the plugin initialization
object file into a static library.

Task-number: QTBUG-80863
Change-Id: Ide32c0124c1e313c352a72280ce32ce9fbe8fff1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5268edf5811251a432fb5096aef6de4ef372f619)
2021-05-20 09:48:48 +02:00
Karsten Heimrich
ad6870a855 Fix QUrl::fromLocalFile with long path prefix
After commit 3966b571 the function was kinda broken already, though
this got unnoticed since it was not covered by an the auto-test.
This commit adds another test case with Windows native separators
and removes the use of QDir::fromNativeSeparators. Instead use the
original code from QDir::fromNativeSeparators to replace the backslashes.

Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 06689a2d7a18882535819ed13ac7248c81330529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-19 22:05:07 +00:00
Tor Arne Vestbø
115016c172 Fix single argument QT_OVERLOADED_MACRO with pedantic warnings enabled
The use of QT_OVERLOADED_MACRO combined with pedantic warnings would
result in

  warning: must specify at least one argument for '...' parameter of
  variadic macro [-Wgnu-zero-variadic-macro-arguments]

when used with a single argument, as the QT_VA_ARGS_COUNT macro would
end up not passing anything to the last ... argument of the helper macro
QT_VA_ARGS_CHOOSE.

To work around this we extend the arguments passed to QT_VA_ARGS_CHOOSE
by one, adding a zero-count, so that the variadic parameter always has
at least one argument.

Unfortunately this doesn't give us a count of 0 if a overloaded Qt macro
is used without arguments, due to __VA_ARGS__ always being treated as an
argument to QT_VA_ARGS_CHOOSE, even when empty, due to the comma after it.
The result is that we end up calling the 1-argument macro for this case
as well.

Getting a correct zero-count, for both MSVC and GCC/Clang, without using
GCC extensions, is quite involved, so we're opting to live with this
limitation. See https://stackoverflow.com/a/62183700 for details.

Fixes: QTBUG-93750
Change-Id: Ib7b26216f36a639642a70387e0d73223633ba6b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0855f6279182af9cb54ac5113ba5c99db8ecb819)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-19 17:32:56 +00:00
Andy Shaw
959ff6ae8e Android: Reset m_usePrimaryClip when clearing the clip data
The variable needs to be set to false when we clear the clip data as
there is no primary clip anymore so we should not try to access it when
setting new data.

Fixes: QTBUG-93831
Change-Id: I309270dc075fcb0457607561ee23e12f7eb6397f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 96982bab0c5ff855100c1dcde23d090348be53db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-19 14:28:03 +00:00
Joerg Bornemann
78a192e58d Fix BASE argument of qt_add_resources
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file.  Before, BASE was merely prepended to every file that
got passed to qt_add_resources.

Old behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "images/button.png")

Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.

New behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "../shared/images/button.png")

The alias is "images/button.png".  No extra QT_RESOURCE_ALIAS assignment
is needed.

The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE.  Qt repositories will be
ported one by one to this new behavior.  Then the old code path can be
removed.

Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 92185d417de43237ae62eae55599c65922cd9a15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 19:11:38 +00:00
Friedemann Kleint
fb9d138e53 Brush up the text edit example
- Use initializer lists
- Use u instead of QLatin1String()
- Fix some clang warnings about else after return, constFirst()
- Streamline code
- Remove slot TextEdit::printPreview() which is not needed
- Rename variable fileName to pdfFileName in filePrintPdf()
  to disambiguate from this->fileName

Change-Id: I377ebfd13487470b6f8eaf568dd5d99354f761f2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 18aad6da87a329ddf7ca7c92bf2371628220fb4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 19:11:38 +00:00
Allan Sandfeld Jensen
6acfb57c1c Cherry-pick upstream patch for non-gcc/clang/msvc compilers
Fix build w/ non-GCC-compatible Un*x/Arm compilers

Fixes: QTBUG-93779
Change-Id: Ib52e9ded6e2814c7998d6cd798e945da0f87f7a1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4341f6763b8a737ebc07bb78ead22bc05a1a515b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 15:53:19 +00:00
Allan Sandfeld Jensen
12c01cd3e0 Blacklist tst_QWidget::multipleToplevelFocusCheck() on SLES 15
Task-number: QTBUG-64446
Change-Id: Ic1f7a1e7b89a9802e4d3103a6755d7df85b1fd81
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 86bf3a4ddb4c6e131752eaac19e780b3207b6783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 12:41:51 +00:00
Giuseppe D'Angelo
37ff9b02e5 qglobal.cpp: build under QT_NO_EXCEPTIONS
The boostrap library is built with exceptions disabled, and its
sources include qglobal.cpp. Therefore, the file must work when built
w/o exceptions.

Amend/partially revert 282b724808ea4524ed09b9f0183055fdffc3c38a with
the necessary fixes.

Driveby, cleanup an unnecessary QT_THROW (just throw, if we do have
exceptions).

Change-Id: I370c295c21edd3d81a9fa670e60909b29d1c68aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8f7873272ac9e5c5f1a83a5204afb512843cf8d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 02:16:31 +00:00
Karsten Heimrich
ad12c3c40b Fix QSaveFile and QTemporaryFile issues with windows network shares
The commit amends commit 3966b571 to take UNC prefix into account as
well. Fixes the weird file name output as reported in QTBUG-74291 and
QTBUG-83365. Replace manual separator normalizing in qt_cleanPath(),
this is another spot where UNC prefix handling needs to be applied.

Also make QTemporaryFile operate on '/' as file separators to fix
creating both file types with native path separators on network shares.

Fixes: QTBUG-74291
Fixes: QTBUG-76228
Fixes: QTBUG-83365
Change-Id: Iff8d26b994bf4194c074cd5c996cda3934297fa5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec9e85656339dbc9e6918a1369c981cece7bc97d)
2021-05-17 21:46:28 +02:00
Andre de la Rocha
a4618c020d Windows QPA: Fix dock widget drag&drop failure
A previous change to fix QTBUG-85431 has caused this issue by emulating
the behavior of the non-enhanced mouse event handler in a particular
case, where mouse move events that did not change position were ignored.
However, some of these events seem to be involved in the dock drag&drop
implementation. This issue is also reproduced in pre-5.15 releases,
predating the QTBUG-85431 fix, by disabling the enhanced mouse event
handler by setting the QT_QPA_DISABLE_ENHANCED_MOUSE env var. However,
the ignored events in the current issue seem to be non-client events
only, while the QTBUG-85431 issue was related to client mouse events.
So we can restrict the test added in the QTBUG-85431 fix and have both
issues fixed.

Fixes: QTBUG-92182
Change-Id: I98c0c8597912c7f4fe58af375a5a560695a82746
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 92198efbd2c696470711e7f24c5b6507bb664ce9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-17 17:11:18 +00:00
Alexey Edelev
9e271fe24c Make qTerminate available when QT_NO_EXCEPTIONS flag is set
It seems that QtCore could only be compiled with exceptions enabled.
Therefore it doesn't make sense to keep conditonal code under
QT_NO_EXCEPTIONS in qglobal.cpp. qTerminate may be called whether
exceptions are enabled or not.

Fixes: QTBUG-93739
Change-Id: Ie49c10f27cfa75360f018e8638603e6a1791450e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 282b724808ea4524ed09b9f0183055fdffc3c38a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-17 08:30:30 +00:00
Joerg Bornemann
ef02470d81 Doc: Add CMake to the "Resource System" documentation
Change-Id: I4c6a7cfb2f6351e9587d47ab6708d92a1a4e42a4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 97228214bd63f37563669049bfa13d33efa97c48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-16 15:05:42 +00:00
Allan Sandfeld Jensen
eca1e5d385 Blacklist tst_qnetworkreply::ioHttpRedirectMultipartPost on Linux
Already blacklisted on the other linux versions, but is failing on
SLES now in 5.15

Change-Id: I267908adf94ede51e5520aa2cb806b394fb0438e
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e381977b212d7f622771aa9e45565dde7698f776)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-15 12:52:16 +00:00
Andy Shaw
98b9dcb993 iOS: Accessibility: Set the correct traits for EditableText
Since the correct accessibility traits for EditableText are not
available as a direct enum value, then we depend on the defaults for a
UITextField to give us this information.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Fixes: QTBUG-93494
Change-Id: If428414aec5ce571f0f8c0ecccffdbaf1c908120
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 08cd5580df382af5ddfe1c0c44bc9dd68e4cd1e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-14 10:49:21 +00:00
Andy Shaw
bb23bb8b1d Allow for arguments that have an equals as part of it
Since you can pass a define to org.gradle.jvmargs that can have the
name=value approach, then we need to ensure that this is accounted for.

Task-number: QTBUG-88989
Change-Id: I2a795bff7ce683eca521b3a987293b3320accb6a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit a8a6558a84471a939d2d23977e394acadd2fcc6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-14 08:12:19 +00:00
Marc Mutz
b552e75561 QPageSize: make PageSizeId ctor non-explicit
A QPageSize::PageSizeId is a faithful representation of a QPageSize,
so the corresponding QPageSize ctor shouldn't be explicit.

[ChangeLog][QtGui][QPageSize] Conversion from a QPageSize::PageSizeId
is now implicit.

Change-Id: I2d32da370c032949686757400cb7c28583d9d8ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit c8f380bd13f077cd797edbdb55723a2524f55c78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-13 19:35:30 +00:00
Li Xinwei
bf1791c562 CMake: add an option to enable or disable versioned hard link
The option is called QT_CREATE_VERSIONED_HARD_LINK. By default, it
is set to ON. Users can set this option to OFF to disable versioned
hard link.

Fixes: QTBUG-93636
Change-Id: I0ffa1ee1c6bae1950df332fcce3152a861b33db0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 320c282488f4ae4cae735b0be027170803d06cd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-12 23:19:32 +00:00
Richard Moe Gustavsen
87b83bf993 QDockWidget, macOS: don't drag on native widgets
When using native dock widgets on macOS, it will currently
fail if you try to drag on a dock widget inside QMainWindow
to make it floating. The reason is that the drag will
basically start as as drag inside one NSWindow (QMainWindow),
but continue as a drag on another NSWindow (QDockWidget).
And this is not handled well by AppKit, especially since the
NSView where the drag was started is reparented into a new
NSWindow (the floating QDockWidget) while the dragging is
ongoing. And there seems to be no practical solution to how
we can support this from the cocoa QPA plugin

This patch will therefore change the logic in QDockWidget to
simply make the dock widget floating if you drag on it, rather
than actually starting a drag (but only for the described case).

Fixes: QTBUG-70137
Change-Id: Ic309ee8f419b9c14894255205867bce11dc0c414
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3224c6d7d150164241c13ccf7d47377a39c0a6bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-12 20:30:37 +00:00
John Zimmermann
7d8475538b Fix typo in FindWrapAtomic.cmake
There was a D missing, we want to set CMAKE_REQUIRED_LIBRARIES

Change-Id: I7a76d60480ef7bff439f298fe85614d3b7e3ae88
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 224fccdaecbabf72caef3cc7996afe7ad3a857f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-12 20:30:37 +00:00
Thiago Macieira
21f32758d4 cmake: FreeBSD has DF_ORIGIN support
Change-Id: I755911ae7d0341f49039fffd167afce7fe6b2b38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d08d456844ba58c977bf83fc8e48085cbc75abfc)
(also cherry-picks fadd87ed15b5f7bf6e7aaed1263e2f2d661a623d)
2021-05-12 17:02:59 +00:00
Eskil Abrahamsen Blomfeldt
c5e6a06305 Windows: Add synthesized fonts also when there is a style name
Since Windows can synthesize certain font traits for us, we
used to register these in the font database so that we could
match against them. But after change
469b13916983aff4625657eecbb7d2399cac901d, this in principle
no longer happens, because we opt out whenever there is a
style name (which there usually is, this could be e.g.
"Regular" for a normal font). The result of this was that
if we looked for a bold variant of a font, we would not find
it.

In cases where a multi-engine was used, the request for bold
would still survive in the multi engine's fontDef, so we would
still pick it up later and apply the synthesis. But when
NoFontMerging was set, then we would override the weight in
the fontDef with the one from the font database.

Since the comment documents that the additional registrations
are there to make sure all the variants that Windows can
synthesize are available for matching, it does not make sense
to skip them just because the font has a style name. So this
is a partial revert of 469b13916983aff4625657eecbb7d2399cac901d.

Note: This exposed an error in QFontDatabase::isSmoothlyScalable().
The style parameter here is not the "styleName" (as in sub-family),
but actually predates that API. Instead it is the "style" as
returned by QFontDatabase::styles(), which may be the style
name, but it can also be the generated description of the style
and weight. In the latter case, we would return false for fonts
that are actually smoothly scalable, which is incorrect. This
caused a failure in tst_QFontMetrics::metrics(). To remedy this,
we add an additional condition, and also match the style if it
matches the generated descripion of the style key.

[ChangeLog][Windows] Fixed an issue where bold/italic would not
be synthesized for fonts if QFont::NoFontMerging was set.

Fixes: QTBUG-91398
Change-Id: Id2166a47ae2d386536cf6e5e27ff09165ae8a23a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f385b8827a75688b8a2cbd51e8da8a602d7f9567)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-12 05:36:32 +00:00
Lars Schmertmann
516d8d22ff Prefer previously used channels in QHttpNetworkConnection
When IPv4 and IPv6 are supported by a server, QHttpNetworkConnection
will start up two connections and pick the network layer of the one
that finish first. In this case the channel with index 1 is used for
IPv6. When IPv6 wins, there is no channel at index 0. This situation
needs to be respected and we should try to use existing channels first
when there is a next request.

This is especially important when TLS session resumption is used.
Creating a new channel will cause to lose the ephemeralServerKey
used in the first connection.

Fixes: QTBUG-93295
Change-Id: Ic9dc6a24ef793a29c2652ad37bc11120e2e6ceef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a120d11cb5506ef0a5535e790f23d49595fb8857)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 21:31:46 +00:00
Friedemann Kleint
e5946f7b18 Windows QPA/Vista style: Fix placeholder color
Bring back the code that was removed by
62c3dd5632b04a7ee2410cc2233c0d0605ad5bd6 to the Windows theme.

Fixes: QTBUG-93635
Change-Id: I066e89d482a584c1719f6bfb6160710ee73e1b81
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 26638dfe3be009e886d5fc0b2ffa1879efee56b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:31 +00:00
Allan Sandfeld Jensen
029a1c5329 Initialize FirstPtBlock.next to make static analysis happy
Could in theory be triggered with a 0 line spanning elipsis.

Change-Id: I2166ee354d2f7488e1fcddfcb8c949c8ca2452fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0bbccfe001e005fb83ae0a9633bf11c4b3e25ce1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:31 +00:00
Luca Beldi
838b1d1b76 Fix QStandardItemModel signals on takeChild
takeItem and takeChild do not signal the change correctly to the
external world, this change fixes the problem

Fixes: QTBUG-89145
Change-Id: Ib4844ace53007068a2cd62eba64df99e6e45fdc0
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 811a6c6b77a94d86e28a0b00079e02a863391108)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:30 +00:00
Piotr Srebrny
aba4da8a0e Do not remove non-widget items when removeWidget() called with nullptr
child->widget() returns null if the layout item is not a widget.
Thus, calling removeWidget(nullptr) will remove all non-widget items
such as layouts or strechers.

Change-Id: I772c1158d0f7e8e2850b6e571b0405a2896f09b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 867c0b8d8a53974074b1fff5b132f3ae9f150066)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:30 +00:00
Allan Sandfeld Jensen
242f8ef985 Avoid potential read of uninitialized clip data
Set clip->count to 0 unconditional not just when hasRegionClip or
hasRectClip is true.

Change-Id: Ib3d1c4dc24373df3d4dbc393241226a8730bb9fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 9d2850bda946fab28f689d284fd670e5cf361d8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:30 +00:00
Robert Löhning
90fe6301ba rhi: Fix memory leak
The leak can be reproduced by running the test project from QTBUG-63557
with asan, although that report is about yet another leak.
[ChangeLog][gui][QRhiGles2] Fixed a memory leak in QRhiGles2

Task-number: QTBUG-63557
Change-Id: Ic4d346abb36a5666feb3ceb881865b029f5a6945
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 1a63217021f35d09c92457fcad9d513f8f90bc4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 19:02:30 +00:00
Morten Sørvig
d77722a799 Make resizeMaximizedWindows() preserve native geometry
Previously, resizeMaximizedWindows() would use the device
independent screen size as the source of truth when
setting window sizes. However this size may have been
rounded, which means that e.g. a fullscreen window may
fail to cover the entire screen.

Instead, use the native screen size as the true screen
size. Set QPlatformWindow geometry, and let the
platform update QWindow geometry via geometry change
events.

Fixes: QTBUG-87334
Change-Id: If6e4852dea46ab03c83e469808c0047bc933ee47
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1e85dfacf3479ebbe5a4502895b8b8d93fbe1477)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 16:39:16 +00:00
Chen Bin
b3d019ac4f Check scrollbar visibility when computing QListView margins
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if the text needs a newline display and the
vbar is not shown, the width of the item was subtracted from
the width of the scrollbar.

In most cases, the listview needs to reserve the size of the scrollbar.
But if the flow is TopToBottom and the vertical scrollbar is not
visible, the width of the vertical scrollbar cannot be reserved.

Fixes: QTBUG-92366
Change-Id: I73cce691099a253d409019dbb3fe9a16e1830bb1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aeef92c3c33e4ebcb7e5d8dd955020f4f4600e84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-11 12:35:40 +00:00
Pekka Gehör
52362abf2c Android: Remove NoSuchMethodException error
CleanUp NoSuchMethodException error(QtActivity.notifyQtAndroidPluginRunning)
appears on application start up.

Fixes: QTBUG-93620
Change-Id: Ic835e00d02af17e1b48c0ff66d82e5957c635deb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 066a1de8e7b198dbe99cdecefeae94d5f0e5f289)
2021-05-11 11:57:22 +03:00
Samuli Piippo
e5dfa8de64 CMake: use additional search paths also for tool package
Use paths configured with QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to search also for the tool packages.

Task-number: QTBUG-93565
Change-Id: I611b275dd7c4e7ecceb073d16643cd225bbb21d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 60c87c68016c6f02b0eddd4002f75a49ab51d4a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 16:58:53 +00:00
Alexandru Croitor
3c3e1c0ae1 CMake: Don't use list(PREPEND) in qt.toolchain.cmake
list(PREPEND) command was added in CMake 3.15+, but so far we claim
support for CMake 3.14 in user projects.

Use set command instead.

This is not the only place where we use list PREPEND in public API,
but it's the first immediate issue that comes up when using CMake
3.14.

Amends 963017f58884dfd929249c5546aadbb0f74501e8

Change-Id: I7ba4507fc7da2dc550317848751502b8b46c298c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c457e65bf40a8cccff283609924078b5ff985709)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 16:58:53 +00:00
Allan Sandfeld Jensen
3801808ade Avoid coverage overflow
We end up excluding more than 65536 from 65536 of rowHeight.

Perhaps better fixed earlier, but I can't figure this logic out right
now.

Change-Id: I5721c469441f15ac112180f971c857cd67edbf96
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 036c13a0f48ea964da36c6ac01b379d9aa52fdc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 14:00:03 +00:00
Marius Kittler
154d4b3fe0 Fix passing QJniEnvironment to ANativeWindow_fromSurface
The function ANativeWindow_fromSurface (as declared by
`$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/native_window_jni.h`
from version r22.b of the Android NDK) takes a `JNIEnv*` so `.jniEnv()` must be used.

This prevents the following compilation error:

```
error: no matching function for call to 'ANativeWindow_f
romSurface'
        m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
                         ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/native_window_jni.h:45:16: note: candidate function not viable: no known conversion from 'QJniEnvironment' t
o 'JNIEnv *' (aka '_JNIEnv *') for 1st argument
ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface);
               ^
1 error generated.
```

Change-Id: I70d75cb7edc5875314fcb8a70d51d0ef40442101
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 590f70a849d85c438385c313fb452f528fd304a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 13:59:57 +00:00
Jan Arve Sæther
d9697f9f5d Improve handling of minimumHeightForWidth()
This also aligns the implementation with QWidgetItem::heightForWidth()

Fixes: QTBUG-92599
Change-Id: I0de68c61ec37a16a8c338575d07ff9e8168a0b98
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 4d4eb11fe340bf0b3a1ce0caae62d9319bf941cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 13:59:57 +00:00
Allan Sandfeld Jensen
a22acb8ba5 Avoid fast transform paint path on values it can't handle
It has a problem with very small targets, and coordinates can't exceed
the same bounds we have on dimensions.

Fixes: QTBUG-93475
Change-Id: If5b3af324f4e525cee3dc448ba41fdd8a91cc880
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit ddc5af9f17474129223c7bbac58b57bb3ed0ff74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 13:59:55 +00:00
Jani Heikkinen
b40453ce12 Bump version
Change-Id: I83046cd265415390dcae9ecaad4560987e383ed0
2021-05-10 09:28:49 +03:00
Andy Shaw
3e971f6fb4 SQLite: Update SQLite to v3.35.5
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.35.5

Change-Id: I7e1f5a4b6eb48d9f6105d7f08b35a2c62fc79660
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 75d8623752e67a39e2ee04e5233dc502e63a17f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-09 21:00:11 +00:00
Andy Shaw
1bd365dacb iOS: Accessibility: Don't cut off the last character from the text value
The second parameter is the position of the first character not to be
returned when calling text(). So it needs to be passed the length of
the text, otherwise the last character is cut off.

Task-number: QTBUG-93494
Change-Id: I7dd8324b3939220de125ba819b7b77588b21bd4b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c29f981fa069907678f961cf58ecefd64bf268b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-09 06:03:43 +00:00
Allan Sandfeld Jensen
b275c5b1ba Allow background inheritance between non-body block elements
Most nested block elements are merged together, so while we shouldn't
do real inheritance we need to do it when block elements are combined.

Fixes: QTBUG-91236
Change-Id: I9e37b15f705db92c79a620d0d772f25d0ee72b8d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit f94b0e1dd999a6bb8dfa4471fd63c395fc8e2302)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-08 13:02:26 +00:00
Friedemann Kleint
70c1f674ca Style sheet example: Fix doc url for Qt 6
Change-Id: I5c66b472b1687eec0ed1109ce2723d747b1a4193
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit e3141d5507ba9276a5f154415e013fd66875c390)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 23:35:53 +00:00
Volker Hilsheimer
68aa09b5bd Add note about the risk of setting min-width/height in a style sheet
Task-number: QTBUG-86677
Change-Id: I1e5e10ee79d80fee40d04afe439489d6ce16a43e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 6fd480142bd253de095c1e4b79c119c9ed7d20a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 15:11:07 +00:00
Doris Verria
be6fce0962 Don't draw focus frame if widget has style rules that affect border
Skip drawing the focus ring if the widget has a custom styled
border, custom focus ring, or any rule that affects the border.
For QPushButton, if the style rule has a background
set, the bevel will be drawn in the Windows style.
Skip drawing the Mac focus frame in that case too.

Fixes: QTBUG-93032
Change-Id: I7c4d4bf6f6ce7bbcd17cd620586c5efa44f2b8d6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 05f7dd5ead5927ef7b3301380b81d7194d9e0593)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 15:11:06 +00:00
Joerg Bornemann
5ee6a0ddda Fix installation of Find*.cmake files in shadow per-repo builds
In shadow per-repo builds we never hit the code that is supposed to
install cmake/Find*.cmake files. This caused problems when statically
building a Qt repo like qtshadertools against qtimageformats which
provides such Find*.cmake files.

Fixes: QTBUG-91538
Change-Id: I1147daee817ac71303d93e8bf368b2769afb0bb4
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 232c70ecc85243205d4cdd62b6d31dcc32dafeba)
2021-05-07 15:11:06 +00:00
Eskil Abrahamsen Blomfeldt
2a2680ea22 macOS: Fix synthesized bold
When a user requested bold and there was no available font for
this (which is quite common with CJK fonts and in fact is the case
for the official Japanese font on the system), we should synthesize
the boldness.

This was done by checking if the requested font weight boldness
matched the one in the font's traits, and if not, we flag the
font boldness to be synthesized.

But when initializing the font, we would first override the requested
weight with the selected font's weight, *before* performing the check
above. So even if there was a mismatch, we would not catch this and
as a result, e.g. the system Japanese font would never be bold.

[ChangeLog][macOS] Fixed an issue where boldness would not be
correctly synthesized for families with no bold variant.

Fixes: QTBUG-85634
Change-Id: I36da59d7689455e29cca283cb0724a0841095918
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 76d3cda88469137050f6aab4bbb8578061fe25f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 11:11:24 +00:00
Allan Sandfeld Jensen
2334a452b9 Apply specialData font capitalization to non-rawFont text
We were not using the capitalization details from specialData in the
regular path of QTextEngine::itemize() causing it to be ignored.

Fixes: QTBUG-90840
Change-Id: I7bb71fad4009f6d0685905a946c36ac1d24d8d3c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5fa80f6cd792d0f7ead782037b9870796de05acb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 07:09:49 +00:00
Eirik Aavitsland
975e693747 Update bundled libjpeg-turbo to version 2.1.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.0

Change-Id: I82a58609120923c18f6031fec7d597138ec473ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 127f617387c00139dddbfc9438ab032e24559566)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 05:52:20 +00:00
Li Xinwei
3a28e12534 CMake: fix build with static Brotli
BrotliCommon is a dependency of BrotliDec and BrotliEnc.

amends 5d2da76c1ee70ffd1f027365c0f3af74b76fd382

Change-Id: I7741d417e95737f8caacd01962985a27dbb7514c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d104d510ea6c4f3a24f5d6105930d57c6aee0cb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 02:58:43 +00:00
Giuseppe D'Angelo
1e792df004 QScopedPointer: remove doc mention of take()
It is deprecated so it shouldn't get mentioned by the ordinary docs.

Change-Id: Ic867fd45396871245d6f5714f6a886c706e99c04
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1c34bf1d6b807ab2340d76819197f3bbfd16a198)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 23:16:45 +00:00
Volker Hilsheimer
25bd96eb80 Silence MSVC warning about int/size_t mismatch
Warning was

qmetaobjectbuilder.cpp(1439): warning C4267: '+=': conversion from
'size_t' to 'int', possible loss of data

Instead of adding another cast in that line, fix the warning by making
the size variable a qsizetype, and remove the now unnecessary
static_cast to int.

Change-Id: Ieff9330501f5a07c4bbe1e851a3ef211f8bf2d24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 718d1f88d7089d6792eea4dcb56875734a09a742)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 20:30:54 +00:00
Volker Hilsheimer
ca4d48595b QTabBar: take a style sheet's font into account when laying out tabs
If a tab has a font assigned to it through a style sheet, then take the
font size into account when calculating the contents rectangle.

Add a test, which hardcodes the windows style to avoid flaky behavior
when e.g. macOS lays tabs out in the center.

Fixes: QTBUG-92988
Change-Id: Ifb0ac97db7647cc25367972737be8878e50f6040
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e3b2b12a912361af309302a4b1fc27c2206322af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 20:30:46 +00:00
Paul Olav Tvete
b721079032 Fix rare integer overflow in text shaping
With extreme painter scaling, linearAdvance may be too large to fit in
an unsigned short.

Fixes: QTBUG-91758
Change-Id: I7bbe6e77ec9bcef4aa5259da1d3000ed1a8eb27a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit e2bdff3555f8c2a275c7bbcf964d939a5f489100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 16:50:32 +00:00
Friedemann Kleint
29dea7f317 QMdiArea: Fix top level window title when using DontMaximizeSubWindowOnActivation
When trying to find the original window title, check for another
maximized sub window and use its title. Protect the calls to
setWindowTitle to prevent the original title from being cleared.

Fixes: QTBUG-92240
Change-Id: I55175382ab261b4cf8b5528304adaaec4fbe2c31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8886462872db9cdab4d7683823fd24fb9f8920c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 13:56:54 +00:00
Eskil Abrahamsen Blomfeldt
3b78f6d94b Windows: Work-around misreporting of Script and Roman
Two legacy bitmap fonts are misreported as TMPF_VECTOR on
Windows: Roman and Script. This causes them to be marked as
scalable, and the automatic fallback to NativeRendering in
Qt Quick does not kick in - causing the text elements to look
empty instead.

To work around this, we exploit the peculiarity that the type
of these two fonts is reported as "0" in the enumeration, which is
not a valid value. No other fonts on the system is reported as type
0, so we simply detect this error case and mark the fonts as
non-scalable, which is the safer choice.

[ChangeLog][Windows] Fixed text in "Roman" and "Script" bitmap
fonts not showing in Qt Quick applications.

Fixes: QTBUG-85826
Change-Id: Id889f0dedb1d529e6dd64c6da9e17e303f4a9d04
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a1e405ce11eb6760ccca13cf1b4e5d20fa3916e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 13:56:54 +00:00
Topi Reinio
3d7bc9ab84 Doc: Fix warnings on qproperty.cpp
Task-number: QTBUG-90662
Change-Id: I91f8b83c68c3692dc620063c93be9ddea64685a6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 4916255445f3b64a57683c0ef6bd5d80ad3b6359)
2021-05-06 15:56:54 +02:00
Andy Shaw
4f5c8fecac Write out the HTML correctly for nested lists
When we are having nested lists then we need to ensure that the HTML is
outputted correctly so that the closing list and item tags are placed
in the right order.

[ChangeLog][QtGui][QTextDocument] The output of toHtml() now handles
nested lists correctly.

Fixes: QTBUG-88374
Change-Id: I88afba0f897aeef78d4835a3124097fe6fd4d55e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 72a5151403f107c445e20cf548ca2e7309c88ce7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 11:12:15 +00:00
Eirik Aavitsland
7bba5a5fc5 Fix read-only pseudo-state in QPlainTextEdit stylesheet
Was implemented for the other text edit widgets, but not for
QPlainTextEdit.

Fixes: QTBUG-92490
Change-Id: Idd2a1b5c743fc030d3f2d4dd24e98f806b58f4d9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f3a042c5ab998c0d283017f3569bb72c392580b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 07:01:20 +00:00
Eirik Aavitsland
f3179ec804 Simplify bundled libjpeg build
Move the config headers of the bundled libjpeg back into its source
directory, where they originally live, to avoid having to trick with
the include path to find them.
The goal is unification across maintained Qt branches, making version
updates simpler.

Change-Id: I5b574446bbd264b0a1cb3efceb4c1cb7203cac7d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 5df88b85c6e61409c5c759e78f32edaac7b2022f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-06 07:01:18 +00:00
Kai Köhne
61f56d9bb7 doc: Mention qmake6 as name of qmake executable on Linux
Task-number: QTBUG-89170
Change-Id: I16c86f04b4c34e7099c220cf028ba1cdb20550e9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit fb56cf449b665aa5c9cfd88a92937279a7dd8a54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-05 18:31:35 +00:00
Joerg Bornemann
fdbff1a8c6 Fix Windows build with CMake < 3.19
file(REAL_PATH) was introduced in CMake 3.19.

Use get_file_name_component(... REALPATH) instead that is available in
older CMake versions.

This amends commit b226e99c71c.

Change-Id: Ibb28ef757228e1a1176ff70c3ec57b7ca751a636
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 33ac3cf7664aa08e3455e516c0d44d923b29955d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-05 10:17:49 +00:00
Liang Qi
10c51cb53b cocoa: move DEBUG_PASTEBOARD into logging category
Change-Id: I8f49c030588122adff3c0eab4189bfa7e6aeff09
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9f8d5bceb47eafa79fdd9c2a5186e6a86be7fecb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-05 10:17:48 +00:00
Timur Pocheptsov
8130fc2468 Fix changes' doc
The name of attribute has a suffix 'Attribute' which was missing.

Fixes: QTBUG-93416
Change-Id: I9ce96efb38caa03957ddbdb13a5e61767e8e74f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3ab7449f125bb9ff68fbbcae283b909c1ecd2076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-05 07:47:15 +00:00
Mårten Nordheim
db1b88e516 tst_moc: fix returning-reference-to-local warning
Although the code is never executed compilers still throw a warning
because it's compiled.

Amends 12b8283f899ebcf401d974927314b9531334a56e

Change-Id: Ib790d4bcb33c4b9f2a55a784b852275b59debde9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 48931167fb5341dc26e27dae03b2112d83daa3b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-04 18:46:14 +00:00
Mårten Nordheim
4fd10b68d4 Moc: parse trailing return type
Fixes: QTBUG-71123
Change-Id: I1c3749f0892fddcc433c9afcb1d6d7c30c97c9d9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 12b8283f899ebcf401d974927314b9531334a56e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-04 09:51:02 +00:00
Morten Sørvig
207b9346f7 iOS: Implement QIOSScreen::logicalBaseDpi()
logicalDpi() and logicalBaseDpi() should return the
same DPI on iOS, in order to make Qt not apply a scale
factor.

Accomplish this by overriding logicalBaseDpi() instead
of logicalDpi(). The default QPlatformScreen::logicalDpi()
implementation will then call logicalBaseDpi().

Fixes: QTBUG-92579
Change-Id: I7a27cf61f0154cef32098069ab3dfb29ad6acf27
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit e3e070e87b3a8036f7200755ba32b57437304ee6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 21:49:14 +00:00
Cristian Adam
9d6245e921 CMake: Allow usage of QtStandaloneTestTemplateProject as package component
Currently in order to compile a Qt6 test standalone one needs to use
the qt-cmake-standalone-test script which will load the
Qt6BuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt project
with the current test source directory to create a complete CMake project.

This commit will allow a test to have these lines at top:

cmake_minimum_required(VERSION 3.16)

if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
    project(a_qt_test LANGUAGES C CXX ASM)
    find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
endif()

and be standalone and work with any IDE capable of loading CMake projects.

Fixes: QTCREATORBUG-25389
Change-Id: If3f878b7e560a8bfbb604a8f1aa30b7962742e66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 0a1256a52d8c6c1b85a10f7dc94dfc34e3540040)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 18:08:33 +00:00
Friedemann Kleint
a76017b565 QSqlTableModel::orderByClause(): Quote the table name
This ensures correct handling of names with special characters.

Fixes: QTBUG-92584
Change-Id: I95c7c54d9c7ee00b221a55f3d07ef1ec3a3bd217
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 21b3b54193b9d90ee377fdfa306e21d2fdfe2837)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 14:33:01 +00:00
Laszlo Agocs
64e1ae71b3 rhi: gl: Sanity check vertex outputs and fragment inputs
Print a warning if the name for a given location does not match. This is
relevant only to OpenGL and only to < 330 GLSL versions: there the
location qualifier is simply not present in the actual shader code and
all matching is name-based. This leads to hard to discover problems in
Qt Quick ShaderEffects for instance, where providing a custom fragment
shader but using a built-in vertex shader is common, and one may be
tempted to use a name other than qt_TexCoord0 for the input variable in
the fragment shader. Unfortunately this breaks, sometimes silently, when
not having location qualifiers. (and we won't, neither in GLSL 120 or
150 which are the standard for Qt Quick)

Make this situation recognizable by printing a warning to the debug
output.

Task-number: QTBUG-92500
Task-number: QTBUG-93370
Change-Id: I0d0bcc135e23a228783f7633f872e39c4e43bb93
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit c28e609ff4b863d5b849749d995d503fba365fb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 14:33:01 +00:00
Volker Hilsheimer
120eb3b48c Document that a toplevel window QSizeGrip doesn't get rendered on macOS
Amends b8947e9194f0f88f464448ac51f6a05113d36a33 which removed the grip's
rendering unless they are in a QMdiSubwindow. This was a deliberate
choice to comply with the macOS HIG. Rather than putting in another
widget attribute, document that another style can be used.

Fixes: QTBUG-90945
Change-Id: Id227fd31d8bafaaab7005e5ff5340da96c0f65b3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 18f5b83e97828dd572eaf67c054a43aa5472a668)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 14:33:01 +00:00
Kai Köhne
de1e66cd8b Disable spurious MSVC warning C4273 in Qt Gui, Qt OpenGL
For optimized/release builds, cl 19.28 produces some false positive
"potential divide by 0" warnings even for code where no valid code path
can lead to such a division.

Fixes: QTBUG-92940
Change-Id: I461f9104d7b9dc2d74839bf30bebb2b9d4cf2db3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 16a1ba69a682fbe7855682448ac0340574a67035)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 14:33:00 +00:00
Edward Welbourne
a58e278a7d Update CLDR-derived data to newly-released v39
Routine update with minor changes to locale data, no new languages,
territories or scripts. Various Spanish locales change m_grouping_top
from 1 to 2, reversing a change to a test of Costa Rica's currency
formatting made in commit bb6a73260ec8272647265f42180963604ad0f755.
Includes updates to time-zone IDs.

Fixes: QTBUG-91478
Change-Id: I78ee161275b3c456c5800a7317a96947c932cf8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6235893d54b8fbf5c8bd54e33cd82b55042555f1)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-03 13:35:43 +02:00
Friedemann Kleint
e6b1d28b57 uic: Fix font family code generation for python
Amend the code introduced by d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8
to generator correct code for Python.

Change-Id: I71fc9a1830d6bd591d32ce08002572c29f02a27f
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit b2ebc64dd9914359fe8acf2bc9960e341e98cf80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 11:35:42 +00:00
Pekka Gehör
aca924f32c Android: Fix Application becomes unresponsive issue
Block key events until the plugin is running.

Fixes: QTBUG-67944
Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2262a9cd2d135d5ea2ade42460496c88d8b2c292)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-03 08:12:03 +00:00
David Faure
fba271339b qdbus: add support for "aay" (QByteArrayList)
(I wish these common mappings were centralized though, so that
annotations in the XML file wouldn't be needed)

Change-Id: Ie3e8731e44b6e0338c8a044408c34160cf0a3a1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 831aea1ce1a3f08188bed005d239e367917acf2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-02 20:50:34 +00:00
Giuseppe D'Angelo
a3aa88d21c QLocalSocket: fix inclusions in namespaced builds
An include statement appeared after opening the Qt namespace, thus
injecting symbols in there. Move it outside.

Change-Id: I8e95e821b36ad4e4ceed5b0645bf8ebf7e531e06
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 99e95a2cc6ddec5ebd7f69489811be2e9aef98b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-02 18:25:51 +00:00
Giuseppe D'Angelo
0825f03615 QRandom: drop a usage of std::is_literal_type
It's deprecated/removed, and indeed doesn't check anything that it's
not also already being checked by the previous line.

Change-Id: Ic80ca43f390dd989ced69f196efa7313069e7c6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6351b5433da083890e47faa62e21fb40fd042c79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-02 12:17:59 +00:00
Shawn Rutledge
14f20bde1c Add grabber context pointers
In Qt Quick we now need to keep track of which QQDeliveryAgent is
responsible when a point is grabbed, either passively or exclusively.
When we re-deliver to that grabber, we need to do it via the same agent,
so that the same scene transform is used, and the grabber will see the
event in the correct coordinate system.  It's easier to track this
mapping here instead of in a separate map in Qt Quick.

(This is an alternative to 40330b8f0a717098982d1f54f34a18a8262b1f55:
it was not possible to use QFlatMap, because we need to keep the passive
grabbers in the same order as they were added.  We don't use a QList of
structs, because QPointerEvent::passiveGrabbers() needs to return a
QList of just the grabbers, and it's not as efficient to construct that
list in the accessor.)

Change-Id: I457114f816736749d2ea5ee48fa03524eb93d2d0
Task-number: QTBUG-92944
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit c8736e8e614066e46bc267356ee7757e42ed6e5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-01 17:40:45 +00:00
Volker Hilsheimer
bced3a2477 ItemViews: don't delete dragged items when a subclass accepted the move
Amends 0f1008a5936c903ca9448193df7df6117e2c617b, which introduced the
dropEventMoved private data member through which the drop-site itemview
can notify the drag-site that the drop handler has taken care of the move
operation.

However, if a subclass of an item view overrides dropEvent to move and
accept the event before calling the default implementation, then the flag
would not be set, as the dropOn helper would return false.
So QAbstractItemView still removed the item, resulting in two items
being removed when one was move-dropped.

Set the dropEventMoved member also when the QTreeWidget::dropEvent
handler is called by a subclass override and the event is already accepted.
This way, overrides don't have to artifically set the accepted action to
"IgnoreAction" to disable the handling in drag site.

[ChangeLog][QtWidgets][QAbstractItemView] Classes overriding dropEvent
for MoveAction events to move data can call accept() on the event before
calling the superclass to prevent QAbstractItemView from deleting the
source item.

Task-number: QTBUG-87057
Task-number: QTBUG-77427
Change-Id: Ibe75fc1b2ca60627c825ad9b9b6d48953577edec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 808a6dedcb4aabcb81f096f03d0b1bb4ae2ea0d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-01 07:01:08 +00:00
Szabolcs David
be2a1c6250 Silence warning in QPrintDialog
Selecting "Print all" at page range options and accepting the
dialog prints a warning message:

"QPageRanges::addRange: 'from' and 'to' must be greater than 0"

This happens because QPrintDialog tries to clear the printer's range
collection by setting 'from' and 'to' to zero - which is an invalid
page number. Avoid the validation method by setting QPageRanges
directly to a clean instance.

Change-Id: I23b66a97b36aa23506904e93688cb60a9d496bfb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9e1b49c53c50f97134515b9a924985a2a709c6f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-01 07:01:07 +00:00
Mårten Nordheim
baae2252d8 Let the h2 test server both send and receive DATA frames
And use this in the authenticationRequired test.

Change-Id: I18e991eb67168214c2c4f829afaca5018568e989
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit deda40b8591a387e634ebfcf48287c14162ef332)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-30 16:24:38 +00:00
Ivan Solovev
8c0dab650d QSFPM: fix filterCaseSensitivityChanged signal emission logic
This patch amends bcbbbdb2d640c059c19e9337c7418b83b1b7e4ea.
It fixes the logic of filterCaseSensitivityChanged signal emission.
The call to QRegularExpression overload of setFilterRegularExpression
could change the filterCaseSensitivity, but the signal was never
emitted.

[ChangeLog][QtCore][QSortFilterProxyModel] A call to QRegularExpression
overload of setFilterRegularExpression now emits a
filterCaseSensitivityChanged signal, if required.

Change-Id: Id4ef04227c1f8ed98153fa5107ec3fbe4c0c77fb
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0d76a5cd2cdc37f9fb4cbd62af4ab6102a0acd7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-30 16:24:07 +00:00
Gong Heng
2a8901bac7 fix: Optimize the performance of the inotify file system monitoring program。
When the ioctl() functions is executed correctly, the value of buffSize may be 0.
In this situation, there is no need to execute the following code.
This modification can solve two benefits:
1. The readFromInotify function runs frequently, and this modification can improve the
efficiency of the program.
2. When the buffSize is equal to 0, "read(inotifyFd, buffer.data(), buffSize)" function will
be stuck.(I have encountered this kind of problem)

Change-Id: I9f85491ec91e336b4a1bec5c99b911835c5c06a5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bb8fc324d16278c27a211093fb47bafcc4fe7874)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-30 09:37:18 +00:00
Eirik Aavitsland
d4d9b4875e QVnc: clip requested screen region to available screen image
Avoid potential oob memory access.

Fixes: QTBUG-91770
Change-Id: I34fff1cf8dec5275572a027288b0e8310359d9f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c494c1e8754ed13b409133196d9db00bf7e0f2b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-30 09:37:14 +00:00
Alexandru Croitor
1873301ced CMake: Fix reconfiguration when using a static top-level build
... and configuring another repo using qt-configure-module.

It's possible to configure a top-level Qt with a subset of repos and
then afterwards configure additional repos with qt-configure-module.

We didn't define QT_REPO_DEPENDENCIES in that case, which caused all
plugin config files to be loaded on reconfiguration, thus causing
duplicate target errors.

Move the QT_SUPERBUILD check to be done every time in
QtBuildInternals.cmake rather than when configuring qtbase/qt5.

Amends 98e8180e56322ce065e39cc1ef1d65b54caa8c25

Fixes: QTBUG-86670
Fixes: QTBUG-91887
Fixes: QTBUG-92578
Change-Id: I975835ffa02f702799a3c9f68a5e059d2763a951
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e1c1558218168529ea3fd1ab2e8b775c152ef7ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 22:58:26 +00:00
Friedemann Kleint
5a7d1b2a03 uic/Python: Add comments for mypy to ignore star imports
Amends 2f975b39a967cd2ac1c234a200eb6b9c11d8b5b2.

Fixes: PYSIDE-1404
Change-Id: I534d78bdf44eb02bf80831a3d6c1d080a4e08698
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit ac95326ad46fbff310ad25baaf96262d851509c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 20:58:50 +00:00
Shawn Rutledge
2afad7c8ee Revert "Add grabber context pointers"
This reverts commit 40330b8f0a717098982d1f54f34a18a8262b1f55.
It was a bad idea to use QFlatMap here, because it is a sorted map, but
we need to keep the passive grabbers in the same order as the grabs happened.
So need to go back to an earlier version of the patch that uses two parallel QLists.

Change-Id: I9e6013c2565986fe1eb9fd754f8259766f83bee5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 2ecd0f4194dd23dd0917df81007c933cfcd4e6a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 18:43:47 +00:00
Edward Welbourne
a9ef91537b Fix mix-guided use of const reference variable
It needs to be a mutable value variable to be std::move()d.

Change-Id: I9d78b2975f8964e7a7eb06771b0069d9b9e6661e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8ec07b4afc93160e15c1aaa746fd027f2d37f70e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 16:22:16 +00:00
Mårten Nordheim
2ac6738be1 HTTP/2 authentication required
With Qt 6 we made HTTP/2 default, which exposed missing handling of
401 Unauthorized (and 407 Proxy Authentication Required).

In HTTP/1.* we would handle this after the response had finished, while
handling the status code. For h2 this path isn't used since it is
heavily reliant on the structure we have for HTTP/1.* (one request per
channel). So we must handle the status code and header directly.

Having that part fixed exposed another issue - when resetting/rewinding
uploaded data we were not resetting the 'totallyUploadedData' counter in
the reply (this, in turn, exposed another small issue). Because of that
we did not actually send any data on the retry, only sending the
content-length followed by no data.

Finally, the small issue mentioned in the previous paragraph was how we
check if we have uploaded all our data. It was only checking if the
byte-device was atEnd(), which it was. But only because it had not yet
prepared any data for us.

Fixes: QTBUG-91284
Change-Id: I798d105b02688b18a02897cc476f19f57a47f98f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 52a0eb4791727157a7b385f7e022faad28da4821)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 11:11:06 +00:00
Andy Shaw
14544cc5ec macOS: Don't override action set during drop handling
When the drop has been handled, the target might have accepted a specific
action by calling QDropEvent::setDropAction. Don't override that with
the operation received by the OS if the drag'n'drop operation takes place
within the same application. If the operation comes from outside, we have
no choice but to trust the OS.

This way the drag-site will get the action accepted by the drop-site when
QDrag::drag returns.

Fixes: QTBUG-77427
Change-Id: I0e4c86adeeea66b345966a03a3251fa62263b3e8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a014300898bd3bd574ef19bba7123d4b5a07789b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-29 08:55:55 +00:00
Shawn Rutledge
c69bee2073 Add grabber context pointers
In Qt Quick we now need to keep track of which QQDeliveryAgent is
responsible when a point is grabbed, either passively or exclusively.
When we re-deliver to that grabber, we need to do it via the same agent,
so that the same scene transform is used, and the grabber will see the
event in the correct coordinate system.  It's easier to track this
mapping here instead of in a separate map in Qt Quick.

Task-number: QTBUG-92944
Change-Id: I69f769c694d0da24885cdf4087e5032022bff629
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 40330b8f0a717098982d1f54f34a18a8262b1f55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-28 16:47:41 +00:00
Alexandru Croitor
931e742a82 CMake: Fix tst_qaddpreroutine to work with static builds
DEFAULT_IF needs to be true so that in a static build the
built plugin is automatically linked into the test executable
using the special static plugin per-repo behavior in
qt_internal_add_executable.

The QtPostProcess routines are not executed for this test project
because we don't use qt_build_repo. This means that no
QtFooPluginCMakeConfig.cmake file is generated and thus there's no
point in using qt6_import_plugins because the pulic plugin genexes
won't know about this target anyway.

Explicitly set the CLASS_NAME so that the name expected by the
Q_IMPORT_PLUGIN macro matches the name of the plugin instance that moc
generates in QT_MOC_EXPORT_PLUGIN.

Amends 22e967c3049608f82abd32a0beb0b4b36ee134bf

Task-number: QTBUG-87580
Task-number: QTBUG-90341
Change-Id: I5ef361e7e2cebc46b35310c679f15c84cd61b4a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2fccea3b70d8d88ed49cac1c228362a4cf01bb15)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-28 14:58:03 +02:00
Paul Wicking
c295d9d798 Doc: Remove mention of no longer supported format
Fixes: QTBUG-92826
Change-Id: I35950523e41ceaa1ddc59782c4b527707289013b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 069369d86707c89645d63ff36151065c47e6c0ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 21:43:42 +00:00
Alexey Edelev
e766d66288 Compile resource objects of the static library using same options
Introduce the function that appends the specified properties of the
one target to the another. It's possible to copy the standard
property set that affects a compilation only or pass some specific
properties that need to copy. You may also control the visibily of
properties that need to copy by passing the PRIVATE_ONLY or
INTERFACE_ONLY option.

The function is used to compile the resource targets with the same
property set as the main target. Also link the Qt::Platform interface
library to collect platform specific properties.

Change-Id: I727fd0a4bc52c4f5128f28ce796d7a5f3005bb30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a239045d59ba0c04a28c3ac16fbf9e9dfaa8f13c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 21:43:42 +00:00
Alexey Edelev
bf18741f79 Add versioned alias for the Platform target
It's necessary to have versioned alias of the Platform target to use
versioned target in the installable cmake files.

Change-Id: I79286e1c0642068bdfa5d24c1087ee0c39e48f1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8f238788de8fddd08c63a3437029ddfe19a9ee52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 21:43:42 +00:00
Assam Boudjelthia
2cb397675c Android: unblock passing tests
Those tests don't fail anymore and show in CI as BPASS, so we
can safely, hopefully, unblock them

Task-number: QTBUG-87429
Fixes: QTBUG-68974
Fixes: QTBUG-69166
Fixes: QTBUG-87403
Fixes: QTBUG-87411
Fixes: QTBUG-69083
Fixes: QTBUG-69084
Fixes: QTBUG-87426
Change-Id: I831b955116c0f465319b9c5fc726dd98804d1c00
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 001e9c6a1995662b53405f37cb3538ff80154886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 19:32:15 +00:00
Cristian Adam
a5fa610deb pro2cmake: Add support for standalone CMake test configuration
This patchset adds the bits needed for manual tests to work standalone.

Amends ebaa1c15a101579d9296336491e36c63b979f18d

Task-number: QTCREATORBUG-25389
Change-Id: Ifc70391bda2a3eea3c7492a58353a703cdc3114c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5981d44aec5bc09e092310b93f15134ab165d4bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 17:35:53 +00:00
JiDe Zhang
8f0367ab89 fix: The QtStartUpFunction function may be called repeatedly
Don't call pre routine function in qAddPreRoutine if
the qt_call_pre_routines is not called

Task-number: QTBUG-90341
Change-Id: I0ee70561dc57b857f8b3b1cf42c9dfe0cf45bd49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 22e967c3049608f82abd32a0beb0b4b36ee134bf)
2021-04-27 19:35:31 +02:00
Alexey Edelev
261a248042 Fix plugin SKIP_INSTALL option
If SKIP_INSTALL option is specified for the qt_internal_add_plugin
function the install_directory variable become empty and finalizer unable
to call qt_finalize_plugin, because of lack of the second argument. It
makes sense to use the INSTALL_PATH single argument instead.

Change-Id: I2d4b40c8cf812a834c0e045569b45a649d339508
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 361daa2990ddb70805d356ce5df7d8cfae8e1954)
2021-04-27 19:35:27 +02:00
Volker Hilsheimer
7fd8997268 Remove links to QRegularExpression#Wildcard matching
The topic existed for QRegExp but is not relevant in QRegularExpression.

Change-Id: Ife9d42b5b03163cfefff19725409a3feac1cddb2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit f3719c66f46e1bdda49a108e61c35cb0c0182f09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 13:12:39 +00:00
Joerg Bornemann
aa09c472d4 Fix "qmake -spec foo" call for cross builds
In a cross built Qt, for example Qt for Android, calling "qmake -spec
android-clang" led to an error message:
    "Could not find qmake spec '-qtconf'."

This happened, because:
- the qmake in Qt for Android is a wrapper script that calls
  "qmake -qtconf qt_target.conf -spec android-clang"
- the first stage of command line argument handling in qmake garbled the
  call to "qmake -spec -qtconf qt_target.conf android-clang"

We do not modify the order of arguments anymore.

Instead, we skip the "-qtconf <file>" arguments in the first argument
handling stage that is supposed to determine qmake's modus
operandi (like -project or -query).

This amends commit 661b586a69740bd9a1791622f8b238d290ebe00d.

Fixes: QTBUG-93079
Task-number: QTBUG-85136
Change-Id: I12ec25b17d64c00be2a3904b7c4a975b781500a0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 63a812b85191c9cfe0704d400df86ce7961dea12)
2021-04-27 15:12:39 +02:00
Alexey Edelev
b9cea5d0c0 Skip adding externally added plugins to the plugin meta-sets
Plugin meta-sets are not visible outside of the module build tree, so
there is no point in adding dependencies for externally added plugins.

Change-Id: Ica5b29b57c032f4fc9b128172aaa806392e9e581
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit bbe26a766748c00da5e2241a9c7ec5e714dd76ad)
2021-04-27 13:12:39 +00:00
Alexey Edelev
f5047e785b Switch to target_sources approach for the static library resources
Linking the object resource library to the static library still
causes an issue if the static library contains symbols that are
used in the resource library. The proposed approach creates the
following linker chain:
    executable <- resource objects <- static library <- Qt::Core

For the static qml plugins this means that the qmlcache_loader
object file will state in the linker command line before the
plugin library that implements '::qmlData' and
'::aotBuiltFunctions' functions.

We also need to keep the INTERFACE linking of the resource library
to the targets that it belongs too, to collect all the dependencies
that resouce library supposed to propagate to top-level targets.

Fixes: QTBUG-93002
Change-Id: Ice0aabb6817317724abeb3db3bb8a954905cfad1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ddaa7150d85624ab545ccfe098fe8b2d18241940)
2021-04-27 15:12:39 +02:00
Alexey Edelev
1219dbb9f3 Fix linking order of the resource objects
The generated object resource library depends on the Qt::Core library
because uses the functions defined in qresource.cpp. Dummy linking of
the Qt::Core to an object library has an effect only when the object
library is linked directly to the executable as a target. If we link
the object library as INTERFACE library we miss out all the objects
that need to be linked to the executable. This behavior is explained
here:

    https://bit.ly/3sFWKvI

Thus, the only option to link the object library objects to the
endpoint executable is to use TARGET_OBJECTS property in genex, as
it's already done. But that means we are losing all profits that
target actually has, especially linking the object library dependencies.

The combination of both of the above methods does the job. The only
thing that looks fragile so far is order. Currently, the order we
use in the target_link_library call applies to the linker command line.
This means the object library objects must always appear before the
object library target.

Change-Id: If1f0e35e0445d5e96a1f2249ab44114cd36630e9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4ed9402d7a752c739a371706fd5cd82e4626539e)
2021-04-27 15:12:39 +02:00
Joerg Bornemann
704c99f885 Add QT_ANDROID_TARGET_SDK_VERSION target property
This is the counterpart of the qmake variable
ANDROID_TARGET_SDK_VERSION.

Task-number: QTBUG-86033
Change-Id: Idd64ee06eb94826430e6be5d9d878631db67c949
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7d48b64f41083dde3dcb7fcee8cef0f4db6417f8)
2021-04-27 12:08:17 +02:00
Lars Schmertmann
41d8dc7c59 Fix build error on iOS with the configure option -qtnamespace
qtbase/src/corelib/kernel/qsharedmemory_p.h:62:33: error:
    unknown type name 'QString'; did you mean 'XXXX::QString'?
    int createUnixKeyFile(const QString &fileName);
                                ^~~~~~~
                                XXXX::QString

Change-Id: I455526503f059efc2f496b159b4cb098385dda00
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d81a9206ac528ad7b5093305d7fe0037053468b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-27 07:04:20 +00:00
Joerg Bornemann
d12a395f33 Inhibit CMake generator detection for qt-configure-module
When configuring a Qt module with qt-configure-module, we want to use
the same CMake generator that was used for building qtbase.
That generator is encoded in qt-cmake-private. But qt-configure-module
overrides the generator after trying to detect what generator should be
used. That auto-detection is only useful for qtbase-builds and top-level
builds. Turn it off for repo builds other than qtbase.

Fixes: QTBUG-91405
Change-Id: I07efb4afb51ba69d2f5467d272118fa51637ab54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 52077d4f0193a236eacac98f75994b44a4c30a91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 21:14:06 +00:00
Joerg Bornemann
5b9e896eaa Add QT_ANDROID_MIN_SDK_VERSION target property
This is the counterpart to the qmake variable ANDROID_MIN_SDK_VERSION.

Task-number: QTBUG-86033
Change-Id: I4e1434a794f3a8345f9b4e045ab4366d486221af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d1eeef26256eaf6b8fbcf4a2fbe1b1dfb44f4704)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 21:13:51 +00:00
Joerg Bornemann
c6a4716974 Add QT_ANDROID_VERSION_{NAME|CODE} target properties
Those are the CMake counterparts of the qmake variables
ANDROID_VERSION_{NAME|CODE}.

Task-number: QTBUG-86033
Change-Id: I57534ff04db0c78871fe7ba81bedaf377422054b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 8fdaa081fdf1749fabf23dcb4b9b07e800b785a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 21:12:40 +00:00
Luca Beldi
90ff2d083e Fix QTreeModel calling beginRemoveRows twice
For items that are children of other items, removeRows calls
beginRemoveRows directly and then once again inside takeChild()
The signal blocker that dates back to the monolitic import from Nokia
prevents the model from emitting extra signals
but the persistent indexes are corrupted nonetheless.

Fixes: QTBUG-90030
Change-Id: I5bc4b2598bf13247683b113faeec22471f1f04a4
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 6ec3fa2842b5c4714dc9a3953b2721ef70dd957b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:59 +00:00
Luca Beldi
45ebdae164 Fix QAbstractItemModelTester false positive
When inserting rows to a branch with no columns
the tester should not complain about indexes being invalid

Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit fcea8e7aa8a65de9e80136c2d603478831b246d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:57 +00:00
Andrei Golubev
28b57d70d2 Change QList's insert() and emplace() to always invalidate [pos, end())
Drop the "move left if pos <= size / 2" path in favor of reference
stability of insert and emplace operations

Leave the insert(0, ...) and emplace(0, ...) as special cases for
prepend optimization as invalidating [begin, end()) practically means
that we can reallocate behind the scenes

Doing this also simplifies the code a bit

Task-number: QTBUG-93019
Change-Id: I7c248f96d687e94a6a38f81ade901619ff2b4733
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 5e76c2acff2c70f2893306b16aeba230f3d6114a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:30 +00:00
Andrei Golubev
94e4add5e8 Skip tst_QUrl::testThreading() under QEMU
It usually fails the test with "corrupted size vs. prev_size" message
coming from malloc() or some other memory allocation routine (which
signals about memory corruption probably)

Task-number: QTBUG-93176
Change-Id: I5e34971267c52c63cda2489bef5b09bed739f532
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 6d52d86b999088ec07e58c14197bddda043ef0aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:23 +00:00
Andrei Golubev
e08bf5eb84 Add more tests for QList/QString/QBA
The major part is stability tests for QList operations,
Also added std::shared_ptr to the Custom type. shared_ptr
accesses the memory which does not directly belong to
QList, so using it inside a passed-to-qlist type is
beneficial (e.g. ASan could catch extra issues)

Basic prepend-aware cases added to QString/QBA tests

Task-number: QTBUG-93019
Change-Id: I50e742bdf10ea9de2de66539a7dbb9abc4352f82
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit adb41bbe00b2b853d4dd26cd9ee77ae5ed541576)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:23 +00:00
Andrei Golubev
28fda7d394 Do not shift the data pointer when removing all elements from QList
Because leaving the pointer untouched is a much more expected behavior

The tests for this (and not only) logic can be found in the following commit

Change-Id: Iec9eec9bbce04c9fd90cb6be9627c135cd989b7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 38bba2a87c6c5c2b8100870add6d0d7ad559e669)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:16 +00:00
Andrei Golubev
4eca69b86a Add tests for QtPrivate::q_relocate_overlap_n
Test the relocation logic through the QADP::relocate() method which
basically calls q_relocate_overlap_n inside and then ensures that
the data pointers are in good state

Running these locally in fact revealed a bug in the implementation,
so these tests are definitely good to have

Task-number: QTBUG-93019
Change-Id: I353ed46a31c5c77cd0c5fcacd3dfce46e5cf3e67
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 65d0f6829cc124f6d0d4003a17bedcb74dddf33b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:15 +00:00
Andrei Golubev
9c1e58803c Resurrect data moves in QList
Use the data moves to readjust the free space in the QList,
which ultimately fixes the out-of-memory issues caused by
cases like:
forever {
  list.prepend(list.back());
  list.removeLast();
}

Task-number: QTBUG-91801
Task-number: QTBUG-91360
Task-number: QTBUG-93019
Change-Id: Iacff69cbf36b8b5b176bb2663df635ec972c875c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit a0253f5f0249024580050e4ec22d50cb139ef8d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:47:06 +00:00
Andrei Golubev
e6436af8eb Add q_points_into_range to container utilities
We already used it in QString and QBA. And implicitly in QADP (see
parent commit). Might as well move to a common location and reuse

Change-Id: I694f0f1dbd109f17c134f64b3f3dc28d19556c88
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 10b46e7f0faecc42a94cc2e25ad3edd08ae28083)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:46:57 +00:00
Liang Qi
775a6329c8 xcb: Add more debug info for XCB_INPUT event
Change-Id: I99bba80659a103aa79426ae94cd04db2c5d851d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6a91ad7b5b429a9e277a4eedd7161b052b3acf68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:36:15 +00:00
Niclas Rosenvik
3795e4dda5 Add override to addPaths and removePaths in kqueue filesystem watcher
Add override to addPaths and removePaths in kqueue filesystem watcher
Fixes build break in developer-build with gcc 10 on *BSD

Change-Id: I7d91251d6bcb1614bb9f21c319abc9c2df681cda
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 96f493f3b8ba823dcac8e8385ea1256a22c0a1cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:36:09 +00:00
Alexandru Croitor
a52d97fa08 CMake: Install prl files from all repo build dirs in a top-level build
Previously, in a top-level build we always generated the final prl
file somewhere under QT_BUILD_DIR (which is qtbase_build_dir). After
each repo was processed by QtPostProcess.cmake, we installed the prl
files found in PROJECT_BINARY_DIR.

For qtquickcontrols2 this meant that qml plugin prl files were placed
under qtbase/qml, but we tried installing the prl files from
qtquickcontrols2/qml, which didn't have any prl files.

In a static Qt build, qmake's qt.prf calls qmlimportscanner to
identify which plugins should be linked to the executable. This worked
fine because the plugin .pri files were installed correctly.

None of the qml plugin library dependencies were linked in though.
This is supposed to happen in qmake's C++ code where it tries to
find the associated prl file of a linked library in order to extract
all its dependencies. Because no prl file was found, linking failed
with multiple undefined symbols.

Fix this by installing the prl files from QT_BUILD_DIR rather than
PROJECT_BINARY_DIR.

Note that this will create multiple install rules for certain files,
but it's harmless. An example is imageformats.

We process qtbase plugins, see qjpeg, issue an install rule from under
the qtbase/plugins/imageformats folder. We then process
qtimageformats plugins, see webp, issue another install rule from
under qtbase/plugins/imageformats.
The first install rule will install both qjpeg and qwebp, the second
install rule will merely say all plugins are up-to-date.

Change-Id: I8a4bb67bfafc1d016eab62f4fe66b6ba378ceeb2
Fixes: QTBUG-93021
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 31ee3c84a78afa67eeb4e4b6da5a8181ea62c387)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 17:36:05 +00:00
Alexandru Croitor
21346d17c3 CMake: Allow enabling Apple app extension API in other repos
It's needed in qtconnectivity, but currently the
qt_disable_apple_app_extension_api_only function is defined in
QtInternalTargets.cmake which is loaded only in qtbase.

Move the function to cmake/QtTargetHelpers.cmake.

Amends e189126f1ae1d2fa2ad0f95ee2c4aa72c770a97b

Change-Id: Ia2470e48a91385239394368780f5bbb223000113
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 393f45de907d8c6bca9bdb33d08a6309034c89f5)
2021-04-26 15:42:01 +02:00
Kai Köhne
8abe8384f6 zlib: Disable MSVC warning C4267
Change-Id: Ifc51c1847841bb7172f79067facf0c7e425a042b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 89f51a06809b71a8965de3c70c99664b22d04f57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-26 08:59:40 +00:00
Igor Kushnir
51a63306d1 Optimize quadratic-time insertion in QSortFilterProxyModel
Let N = proxy_to_source.size() before the code modified in this commit.
Let M = (N - proxy_start). Let K = source_items.size(). The algorithmic
complexity of the removed loop is O(N+K+K*M), assuming the number of
O(N+K) reallocations is a constant. The complexity of the QList::insert
and std::copy implementation is O(N+K). This is much faster in practice
when K and M are of the same order of magnitude as N.

For example, this quadratic complexity issue results in noticeable
slowdown in the following scenario:
  * a QSortFilterProxyModel is used only for filtering, not sorting;
  * first set a filter that matches a single item in the middle of a
    huge number of items (about one million) - this is reasonably fast
    (takes about a second);
  * then clear the filter (i.e. set an empty filter so that no item is
    filtered out) and watch your application's UI freeze for a minute.

The "Add QSortFilterProxyModel clear-filter benchmark" commit (with
Change-Id I419a5521dd0be7676fbb09b34b4069d4a76423b1) adds a benchmark
that runs much faster with this performance fix.

Change-Id: Ieaec173e6910f5d21eaee49402087f7711abbedf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 7d92ef63d7c2d9d017d89905a2ee0d1e9226b15c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-24 14:04:07 +00:00
Friedemann Kleint
6e73df64e2 Rewrite the fetchmore example
- Start in root folder so that large directories (/bin/, Windows)
  are easily reachable
- Remove the line edit and navigate by double clicking instead
  since this is more in line with expectations
- Use a QPlainTextEdit for logging
- Make the log message more informative
- Add icons

Change-Id: Ia3cd7fc143efef80772923291f0b711913aa47be
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 2393a40ccd455cc2dca410e8a1830856dbfde12d)
2021-04-24 08:03:13 +02:00
Thiago Macieira
cd3ce03705 QThreadPool: obey the docs that say we always use at least 1 thread
Even if the user (usually accidentally) sets a thread count of zero or
negative. The reporter in the bug report did
QThread::idealThreadCount() - 1 on a 1 CPU system...

Drive-by add to the documentation and the missing #include.

Fixes: QTBUG-93007
Change-Id: I6cdea00671e8479b9c50fffd167807d14e030154
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 885eff053797d56f2e295558d0a71b030fbb1a69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-24 03:28:23 +00:00
Assam Boudjelthia
b484b56922 Fix QJniObject templates implementations
Define the template calls in the header to allow for better type
handling and checking with constexpr and avoid overuse of macros.
Depending on the type provided in the QJniObject's call, the
signatures and the correct JNI function variant is used.
If a type is not supported a static_assert throws a compiler error.

Change-Id: I8a4d3ce85e1ff76ef385633f2a68511fffd12e55
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit f4e23bf3deb69131f78eb78a1cb06da0fe72d9d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 12:43:43 +00:00
Allan Sandfeld Jensen
8e66843087 Do not access internal allThreads data unlocked
Change-Id: I54eb67571fff07ffdbf9d2b77c96bb85e3fae5e0
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ffb5635c1a34d23d85e3cb42310e14a81fa24f6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 12:43:42 +00:00
Jarek Kobus
e51e5c5840 Fix a build when QT_DISABLE_DEPRECATED_BEFORE is set to 6.1.0
Amends: ff8d757e222d0b9b8618b83e6c4186e366e917e9

Task-number: QTBUG-93033
Change-Id: I67b7bda0f63fdb3c4e1864e38c872b96df90a8ae
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 43d6778ce59266067d2fb5adf88a1ba3f73b29ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 12:43:39 +00:00
Andy Shaw
6720519af7 SQLite: Handle tables and fields with a dot in the name correctly
Fixes: QTBUG-91885
Change-Id: Iba76bb50266dd4fb5f50e4ea1549d1d2bb6e3431
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 66acee69a1563488e5950645c171d6be73dd5f70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 09:17:24 +00:00
Allan Sandfeld Jensen
3b8a8d6430 Fix missing CPU feature feedback
Add empty string first like we have for x86.
This fixes offset checks, and reported missing features.

Change-Id: I09f6be05641d5ed9ae5d91fa72f678fef60bdbe7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3b8031059a14dd1d3bc65589a887092c22d2629b)
2021-04-23 08:51:30 +02:00
Fan PengCheng
7a3071c4bc Avoid adding null-objects to the icon cache
When we can't get the icon for the first time, we would use the data
in the cache later, and we will never get the new icon when the system
theme is updated while the application is running.

Change-Id: I839ad9983918561a1dc6bc842f85477bba53f64a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4dc7102c8410f5699af93b6c55ba1c7df7755bc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 03:49:38 +00:00
Thiago Macieira
9b165a3487 QDuplicateTracker: store the current seed in the hasher
It's allowed to change asynchronously by another thread.

Change-Id: I6cdea00671e8479b9c50fffd167836a08a42cc1d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 3458dd2d4773de379ea4c8309096d6e2cfd8a339)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-23 01:17:17 +00:00
Jonas Karlsson
fd01a9fb75 Fix infinite loop in qmake option parsing
If calling 'qmake -qtconf file' an infinite loop occurs.

Bug introduced in 661b586a69740bd9a1791622f8b238d290ebe00d

Change-Id: I3ccc067570308227b605d700b41b299800aa872a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6b1a7341fed4b9456ea6bfa2de7412d45ef56c65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-22 20:03:16 +00:00
Kai Köhne
898af48159 qdoc: Name section 'Getting started with qmake'
Other manuals have a 'Getting started' section too. Better to qualify
it further, so that searching in the Index of Qt Creator Help mode or
Qt Assistant allows to differentiate between the different products.

Change-Id: I7cfdba3c3567bdf49d3fe34307576f88c9f20126
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit bf65abc4ab49bb8511533886842c698631132eb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-22 16:21:59 +00:00
Alexandru Croitor
e3314328f3 CMake: Fix auto-linking of static plugins for non-QML in-tree tests
Certain repositories like qtsvg, qtimageformats and qtvirtualkyboard
build plugins associated with Qt modules from other repositories
(qtsvg's QSvgPlugin associated to qtbase's QtGui).

When configuring in-tree tests in the same build folder as the
repository, the test executables would not automatically link to these
plugins.

Fix this by recording the existence of such plugins in a separate
property of the associated Qt module and only link them when both the
test executable and plugin are from the same project (their
PROJECT_NAME coincides).
This is in addition to linking the plugins associated with the
module where both are built in the same repository.

The logic is a bit tricky and ensures that plugins are not
accidentally initialized twice, so that in-tree tests work for both
top-level and per-repo builds.

As a drive-by, added a TODO explaining why in-tree tests that need to
link to static QML plugins won't work (somewhat unrelated to this
change).

Amends 734d2cdbc4ff6db6b3df8fffbb23dbbb565c076b
Amends b1fcdad9c9b9ad2bddd00f7301c8dd1159d523c2

Task-number: QTBUG-87580
Change-Id: I3e1ff8166864f92dea931ec2ea34b6f56b4eec60
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6969496e0078f9f9df9bef817caad71cf5213e3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-22 16:21:59 +00:00
Alexandru Croitor
09e9fd4f77 CMake: Expose sub-arch test results as features
Needed for QT_FEATURE_foo checks in repos other than qtbase when
building SIMD specific files (e.g. qtimageformats).

Task-number: QTBUG-85447
Task-number: QTBUG-93017
Change-Id: Ibd2200fe24cecbb0b2a092f645ca622baf738601
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8f2795b17fde2a595fbb67f4531c3d49b8b3d2cd)
2021-04-22 15:37:49 +02:00
Samuel Gaist
f4292c10a3 Fix case sensitivity handling QSFPM
This patch fixes the breaking of case sensitivity handling. The removal
of QRegExp killed the wrong code paths which leads to inconsistencies
when changing the regular expression throuh methods like
setFilterWildCard or setFilterFixedString. Changing the case sensitivity
also nukes the original options that were set on the regular expression
if it was set through setFilterRegularExpression.

[ChangeLog][QtCore][QSortFilterProxyModel] Case sensitivity as well as
regular expression options handling have been fixed. The original value
is properly kept when using setFilterWildCard and setFilterFixedString.
The regular expression options are now also properly kept when changing
the case senstitivity through setFilterCaseSensitivity.

Fixes: QTBUG-92260
Change-Id: Ifb4732306f0c7d79ad0b18d3f5437c4523bb40e5
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit bcbbbdb2d640c059c19e9337c7418b83b1b7e4ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-22 08:46:38 +00:00
Friedemann Kleint
6371d623d2 Brush up the mandelbrot example
The example refines the image by running a number of passes
with increasing number of iterations, which is not really
visible to the user. Set an informational text string on
the generated image which provides this information
along with the elapsed time.
The idea is to do the same to the corresponding
Qt for Python example to have some sort of speed comparison
for number crunching.

Add a command line option for the number of passes.

Make the window a bit larger to accommodate the
information.

Change-Id: I2afc1009ab53b580123d82a6aa645d9ffaa63ea2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0e69349f6f8e9445877ea5b2105973115ad79cf7)
2021-04-22 08:36:54 +02:00
Ilya Fedin
32d12a58d0 Don't own unique name for QDBusTrayIcon
Flatpak doesn't allow to own random name with PID. Even after adding
such a permission into manifest, all flatpaked apps have PID 2, so only
one Qt application at a time can have tray icon.

Even though unique name is a part of the spec, no tray hosts really
check it and SNI implementations without unique name run just fine
inside and outside of Flatpak.

This fixes the inability of Qt applications to have tray icon in Flatpak
outside of KDE.

Change-Id: Ieea6dc335b7a74537a51929f6e70ca68c84228fb
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 9db7cc79a26ced4997277b5c206ca15949133240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 22:21:46 +00:00
Alexandru Croitor
5f34b848d0 CMake: Fix auto-linking of static plugins in standalone tests
The change introduced in 98e8180e56322ce065e39cc1ef1d65b54caa8c25
fixes reconfiguration issues for repositories that provide plugins
associated with modules from a different repository
(QSvgPlugin -> QtGui -> qtbase).

It does so by only loading the public Plugin CMake packages of
dependent repositories.

For executables / tests that are built as part of the current
repository, plugins are linked via a different simplified mechanism in
qt_add_internal_plugin and qt_internal_add_plugin in order to prevent
exporting link cycles between plugins and Qt modules.

This works for the majority of in-tree tests, but unfortunately breaks
static standalone tests.

For example in qtbase neither mechanism will link plugins to the
standalone tests:

 - qtbase has no repo dependencies, so the first mechanism (loading of
   public plugin packages) is skipped because we assume we are merely
   reconfiguring the main build of qtbase and we don't want to
   accidentally create duplicate plugin targets

 - because a standalone test configuration does not call
   qt_internal_add_plugin, no association is done between qt plugin
   and module and thus all tests (qt_internal_add_test ->
   qt_internal_add_executable) don't get the simplified plugin
   linking

Fix this by allowing loading of the public CMake plugin packages when
doing standalone tests. It should be safe to do so because we don't
build any plugins in this case, only tests.

Amends 98e8180e56322ce065e39cc1ef1d65b54caa8c25

Task-number: QTBUG-87580
Change-Id: I690a0366c73a24e7f49c65ed13cd70362c273d81
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit be1ee03a0fafa28efa0c0e45f21f9dc684625957)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 18:30:11 +00:00
Alexandru Croitor
51c6e25d09 CMake: Fix build of QJpegPlugin in static Windows build with PCH
Fails with

 C:\Dev\qt\src\qtbase\src\3rdparty\libjpeg\src\jmorecfg.h(242): error
 C2371: 'boolean': redefinition; different basic types
 C:\Program Files (x86)\Windows
 Kits\10\include\10.0.18362.0\shared\rpcndr.h(193): note: see
 declaration of 'boolean'

Don't use the precompiled header for the plugin source file.

Amends f641a0dbcfd52e78e068357d9c66236798e043e8

Task-number: QTBUG-88093
Change-Id: I6a57f791139d866622f7406fec45c11be6b86418
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2e2ef31d412befceb34f901d6ad2ce78a43c67a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 18:30:11 +00:00
Friedemann Kleint
ae62c5717e Documentation: Fix broken links to QIODeviceBase::OpenMode
Previously, QIODeviceBase was not visible in the documentation
and the links from QIODevice::open() were broken.
Fix by fully qualifying the arguments.

Change-Id: I43960ac2ff436251cc3bfad862d82f937b9bd4b1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 1b1844afef81520520ba75146f835a7dbbbb5fd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 14:45:18 +00:00
Mårten Nordheim
3ec6e14771 QNetworkDiskCache: Switch to unique_ptr in most cases
Because take() is deprecated, and these pointers are meant to leave the
scope in some branches.

Change-Id: I5432d91a28f4c5c8c17fadf7ce3bcd41716e216a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 54730b31faa51fcb7973cc465ca981dd7c18e8b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 14:45:18 +00:00
Mårten Nordheim
408a2e8d67 QNetworkDiskCache: Drop the file mmap-ing
Presumably the code at some point would do a
QByteArray::fromRawData-style thing. But now it doesn't do that so
the current code was a bit strange. It would map the content of the file
to memory only to then copy the content into a QByteArray. Then it
reparents the file to the QBuffer, keeping it alive even if its not
needed.

Fixes: QTBUG-92838
Change-Id: I88f8cd1b64e0fd13d08b5cc4df44661e216da340
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c254d73be63033497838807119cb9cb47ca6c1fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 14:45:17 +00:00
Kai Köhne
f803331426 MSVC: Fix size_to to int warning in qhash.cpp
Change-Id: I5da2ae57b0f626bd46b71bab28af668bd1fbc7de
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d0085049e0326c962ffbd50da58107b874de528)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 11:17:43 +00:00
Tang Haixiang
bed3771788 Draw the cursor considering the descent is 0
When the descent of the item is 0, ascent is the
height of the item, base(base = si.ascent)> sl.base.
At this time, sl.descent is not considered. The
calculated y value may be <0.

Fixes: QTBUG-86823
Fixes: QTBUG-92468
Change-Id: I9cf088dec9162595e52ff72aa90ec3153a30fb72
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e99a883bd382ca950192bd66cafb2a1de6394ce7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 02:37:58 +00:00
Eirik Aavitsland
5070d16c33 Remove xcb-native-painting setting from the configure summary
No need to spam the summary with this unsupported feature.

Change-Id: Ie644a7077762d818fd62a22a8b6d3db025f92c81
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 4345056630fcd93bb4f954711b2d417355d0dadf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-21 00:22:06 +00:00
Allan Sandfeld Jensen
64dcf17f94 Fix tst_qicon for fractional dpr
Add rounding one place, and skip addFile for now since
the assumption about rounding dpr up no longer applies.

Change-Id: I0a84dfabb218acf42cb3816ba50ef899c8762523
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b1f956106cf0fc41eb12d76bb3625fae7687e5f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 22:00:15 +00:00
Giuseppe D'Angelo
ac55ee919a tst_qpromise: build fix
The test use aggregate initialization on some classes which however
are no longer aggregates in C++20 (the rules changed again; in C++20
having a user-*declared* constructor makes a class not an aggregate).

Just add a constructor so the code keeps compiling in both 17 and 20.

Fixes: QTBUG-92963
Change-Id: I52371c5ee34c84358987b5ae8bee9ab9c49c8eab
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7cdf77f5e781edb891bcef1c3cf041e2b5519e2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 19:15:42 +00:00
Li Xinwei
83dbe0af20 MSVC: define _CRT_SECURE_NO_WARNINGS for all internal CMake targets
In commit 013abe320680b3dcd3f6d7e4fb4880e590ba10e6, I add
_CRT_SECURE_NO_WARNINGS definition for all Qt internal module targets,
to suppress MSVC warnings like:
warning C4996: 'strncpy': This function or variable may be unsafe.

However, when compiling some internal tools, such as qmake and qdoc,
such warnings also exist. To suppress this kind of warning entirely,
_CRT_SECURE_NO_WARNINGS definition should be added for all Qt internal
targets when using MSVC compiler.

Change-Id: I9c37b20672f9d0f470e3e9ea847e5221f43bfc04
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c7a27678d6916a51848c991fb3ee21acc6a6f8ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 19:15:42 +00:00
Ilya Fedin
20a9f74851 Read DPI from X Settings initially as well
Currently, Xft.dpi from X Resources is read initially,
while changes are monitored for Xft/DPI from X Settings.
These protocols are different and can have different values.
E.g. MATE sets X Resources' Xft.dpi to 96.30859375,
while X Settings' Xft/DPI is set to 197240 at 2x scale.

This results in a very weird bug when Qt can't determine
2x scale initially, but if scale is changed at run time,
Qt changes scale to the right value.

The difference could be checked via xrdb -query and dump_xsettings
(the second is from xsettingsd project).

[ChangeLog] Qt now reads Xft/DPI from X settings at startup,
and will prefer this value over Xft.dpi from X resources.

Change-Id: If6adac0c88198579332ddebc673f1524f324c0e4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 6560778616b090f8cc73700675ec2ef385953fb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 19:15:42 +00:00
Thiago Macieira
9c7a811327 QUtf8StringView: ensure binary compatibility throughout 6.x
We can't depend on whether the user compiles with -std=c++17 or
-std=c++20. So select what we can depend on and make that permanent.

Prior to this change:

 $ cat /tmp/test.cpp
 #include <QtCore/QUtf8StringView>
 void f(QUtf8StringView) {}
 $ qcd include
 $ g++ -S -o - -I. /tmp/test.cpp | grep globl | c++filt
         .globl  f(QBasicUtf8StringView<false>)
 $ g++ -fPIC -std=c++20 -S -o - -I. /tmp/test.cpp | grep globl | c++filt
         .globl  f(QBasicUtf8StringView<true>)

After this change, they're both "false". QUtf8StringView should have
been a concrete class that derived from QBsicUtf8StringView<whichever>
and inherited all its constructors. We'd cause ODR violations in C++20,
but nothing worse than what we usually do for BC reasons.

That solution is too late for Qt 6.x. Let's revisit in 7.0.

Change-Id: I6bcbe88c072a438b8b4efffd166e77199ecb39e3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c7deb3400faa1d9389137fe63ffbffade8203850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 19:15:42 +00:00
Li Xinwei
e5e6ca7836 make FindWrapBrotli.cmake not depend on vcpkg or PkgConfig
Currently, FindWrapBrotli.cmake depends on vcpkg or PkgConfig. But for
users who build Brotli by themselves and don't have vcpkg or PkgConfig,
the Brotli cannot be found.

As a reference, I use following CMake commands to build Brotli:
cmake path/to/Brotli/source -G"Ninja Multi-Config"
-DCMAKE_CONFIGURATION_TYPES=Release;Debug -DCMAKE_CROSS_CONFIGS=all
-DCMAKE_DEFAULT_CONFIGS=all -DCMAKE_DEBUG_POSTFIX=d
-DCMAKE_INSTALL_PREFIX=path/to/install

Change-Id: I2fa8d3293dd55ebc18937e13fac40d144ca4c1e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5d2da76c1ee70ffd1f027365c0f3af74b76fd382)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 16:57:59 +00:00
Alexandru Croitor
a685978723 CMake: Generate better Xcode iOS projects
Add an iOS specific plist file like we do for macOS.

If the user hasn't specified a bundle identifier or a development
team id, do what qmake does and query the Xcode preferences file to
pre-populate those if possible.

This allows running

 cmake -GXcode ./foo

on a Qt example project and building it with xcodebuild on the
command line without having to go through the IDE to set a development
team id or modifying the example project to add a product
bundle identifier.

Note that the change assumes that the development team id has been
previously set / configured via Xcode. If no such id is found, then
the value will not be set and the user will still have to specify it
either in the project file or via the Xcode UI after the project
has been generated.

Amends 3a2fa3fec5a43d30f1a93a8e89e2973f23ee4ef3

Change-Id: Iaab4e57de72c9877fb9035d28f9a879b2c91a33c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 4d838dae5a821e9e5f013ba1d5a494ece1b5180e)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-20 16:21:00 +02:00
Giuseppe D'Angelo
dcc4605bf0 QString: add missing char8_t* constructor / fromUtf8 overloads
Currently we support:

  QString s = QString::fromUtf(u8"foo", 3);

But we don't support

  QString s = QString::fromUtf8(u8"foo");
  QString s(u8"foo");

There's no reason not to have these two functions. Guess what,
we've actually got code _in Qt_ that tries to build a QString out of
a char8_t; that code stops compiling under C++20 (which is supported,
but not CI-tested at the moment, it seems).

Re-add the missing constructor and fromUtf8 overloads.

[ChangeLog][QtCore][QString] Added a constructor and a fromUtf8()
overload taking a `const char8_t *` argument.

Task-number: QTQAINFRA-4117
Task-number: QTQAINFRA-4242
Change-Id: I1f0ae658b3490b9e092941cabcc7fb8fc4c51aa3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b322bfcc14845a4b6a6eef85ef359b1e4591a5ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 08:42:22 +00:00
Qiang Li
6c3d51e053 Re-layout QProgressDialog when setting the cancel button
Setting a cancel button on QProgressDialog more than once caused the layout
to be invalid. The layout was only applied when the dialog resizes or the
style changes, but not when a new cancel button is set.

The solution is to update the layout() before showing the dialog when adopting
new child widgets.

Fixes: QTBUG-19983
Change-Id: Id8fb1ac56e94a9bd97d4559a2e8d4835856fd7d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 777053cfff40570282e861527e0e52e22a359629)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 03:37:59 +00:00
Vincent Baijot
975782483d Correct prefix reported for end element in QXmlStreamReader
Before this change, QXmlStreamReader prefix value was always an empty
string for EndElement when the documentation state : "Returns the prefix
of a StartElement or EndElement."

The error was a missing update of the prefix value when parsing
EndElement.

I updated the tests data which were also wrong because no prefix were
reported even for </a:foo>. No new test is necessary, I think, the test
data already cover the cases of EndElement with a prefix and without one
(unchanged here).

Fixes: QTBUG-86847
Change-Id: I0ad38b9741d760f1ce688a36f969ec14e20a928c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 366bdcde97962cf5804c519e9b605eddb543a592)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-20 01:18:49 +00:00
Allan Sandfeld Jensen
a73ddc23ab Fix ARM and MIPS runtime CPU feature flags
The set values didn't match tested values, as the enum were already
on flag form.

Change-Id: I9e8b0d419682122e8d40cd47bd68d840386c2066
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ccd17fbc57fae0cb2e5c020e00706edc856b13df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 22:47:25 +00:00
Alexandru Croitor
93dbd93809 CMake: Introduce zlib find script to work around hardcoded iOS SDK
Xcode allows building a project targeting either the device or
simulator sysroot in one single build dir, but for the sysroot
switching to work there should be no linker or compiler flags
referencing absolute paths of a specific sysroot.

During CMake configuration of a project targeting iOS, all found
system libraries will be within one single sysroot, either the device
one or the simulator one, whichever one was passed to
CMAKE_OSX_SYSROOT. CMake will then generate the Xcode project
and pass those absolute paths, which makes sysroot switching within
Xcode not work.

To avoid that, the CMake documentation recommends passing linker and
framework flags of the form '-lfoo' and '-framework bar' instead of
absolute paths. Xcode then takes care of setting the correct framework
search path.

Zlib is one of the libraries found in the iOS sysroot and thus passed
as absolute path.
To avoid that, create a new FindWrapZLIB find script. The target it
creates will pass the absolute path to the library on non Apple
platforms and an -lz linker flag on Apple platforms (macOS and iOS).

To avoid issues with target global promotion when system PNG package
is found, ensure that a found ZLIB::ZLIB target is promoted to global
manually in src/gui/configure.cmake.

Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit b25eb6e0bd1e3b91c44dc4892d529b95c8677889)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 20:13:58 +00:00
Luca Beldi
3cdcb53a37 Fix QAbstractItemModelTester false positive
When rows are removed from a model with no columns,
the test should not report a problem if indexes are invalid

Fixes: QTBUG-92886
Change-Id: I7a042dfdb2575f87208a00cbed13db3869807f84
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit fed2c0d23614df1b96dcc8746223501b07597a52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 20:13:58 +00:00
Shawn Rutledge
905c71a434 Avoid divide-by-zero in the gradients example
After 7a738daa97436478a21b5dd31ba2312b2cb2df41 we require
QLineF::setLength() to take a finite length, and this code was probably
always risky when HoverPoints has two points that are both 0,0.
It's probably a transient condition anyway.

Fixes: QTBUG-92908
Change-Id: If81122d2f78761026b0d656ceffe173132751317
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 76537c065aea1cb3926796f6a34eb39eb81f605f)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-04-19 20:13:58 +00:00
Joerg Bornemann
fbf6e77eec Fix DESTDIR handling on Windows for Qt modules != qtbase
On the CI system, we build qtbase with CMAKE_INSTALL_PREFIX set to a
path without a drive letter to support DESTDIR when installing.
Other Qt modules are built without CMAKE_INSTALL_PREFIX set. The
Qt6BuildInternals package provides a default value.

Since commit e6527e2f73663205a0f36feac5a7feda47fba152 this default
prefix is calculated from the current installation location. This
default prefix however has a drive letter, breaking DESTDIR support.

Broken DESTDIR support in this case means for Android that file(INSTALL)
can properly install but stripping will silently fail.

We now compare the "real path" of the original prefix from qtbase and
the calculated prefix. When they're equal, we use the original
CMAKE_INSTALL_PREFIX.

Fixes: QTBUG-92890
Change-Id: I96fb0655e02c5c695722b7e01a32e209cbdea4cc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 15b26935fca4ab14298abdcc70b3cb15b6cca195)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 20:13:58 +00:00
Volker Hilsheimer
ace1489c7b Add documentation for the QtLiterals namespace
Change-Id: I7932de5f91590acd30c8d4c87f760fd47b1fe0b0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 8f429ac92682f13ac3432c9acdce5ca7cac0e68f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 20:13:57 +00:00
Giuseppe D'Angelo
b245d29a77 Unicodetools: compile
Add an #include for a header that was only accidentally included
transitively.

Task-number: QTBUG-92822
Change-Id: Ie29bb0e065f2db712e9cf9539b15124ff0ced349
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fd0c3170c890707c5cea63b11895084d149d991c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 17:53:39 +00:00
Volker Hilsheimer
14b36ae1a2 Assert that engine isn't nullptr before dereferencing
Various checks for "engine" in the previous code suggested that
engine might be nullptr by the time we want to populate the
out-parameters.

This must not be the case, and QFontDatabase::load asserts
already that a valid engine is loaded and returned.

Fix static analyzer warning 7f68daa282c72e8cc172c681eb02f559 by
asserting it here as well.

As a drive-by, change the tested out-parameter to the last one
in the list of optional parameters.

Change-Id: I3d9ff0f5f7c4740014301c073480d14fef54e2fb
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 6c3599460ca9a7eaba728adbb4b7ab3d519f3ffb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 13:18:55 +00:00
Joerg Bornemann
340bd7a2fe Fix top-level build repository targets
The directory-level targets missed the first level of sub-targets.
E.g. `qtbase_qmake` did not have a dependency to `qmake`.

Fix qt_build_internals_get_repo_targets to first grab all targets of the
subdirectory and then recurse.

Change-Id: I3604000caec22fac9a4cc5f5aaf651d550d16793
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 82f8519b827ba7fd89f8168632461f47b09605a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-19 12:42:10 +00:00
Fabian Kosmale
0a9711d668 QTypeInfo: Handle T::value_type being equal to T
Fix operator checks for containers whose value_type equals themselves.
It does  not make sense to recurse on value_type in that case. Thanks to
std::disjunction having short-circuiting semantics, we can avoid that
issue by checking first whether T is T::value_type.

As a drive-by, check for value_type typedef before checking for
begin/end in is_container. This works around an issue in gcc <= 8.1,
which fails to correctly SFINAE the case where begin and end are private
methods.

Fixes: QTBUG-89456
Change-Id: I27305a7cfe050f13a279c07f00bc229c01daa25b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ce83e56cfeb2806181ec1daade9690f4c90b901c)
2021-04-19 07:39:41 +02:00
Alexandru Croitor
edf4e34797 CMake: Warn when using CMake 3.20.1 due to crashes in AUTOMOC
With CMake 3.20.1 AUTOMOC can crash or hang on Windows when used with
a Qt installation that supports moc depfiles due to missing
multi-threaded locking.
Warn and advise to use a different CMake version instead.

Change-Id: I78d2269c48dfc2541bebcd6ab23aaa5595012149
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit aab8a0ac6e5365d97d3c7571b26430776b7b5f49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-17 21:34:34 +00:00
Giuseppe D'Angelo
a3f75608f0 Unicode: fix the extended grapheme cluster algorithm
UAX #29 in Unicode 11 changed the EGC algorithm to its current form.
Although Qt has upgraded the Unicode tables all the way up to
Unicode 13, the algorithm has never been adapted; in other words,
it has been working by chance for years. Luckily, MOST
of the cases were dealt with correctly, but emoji handling
actually manages to break it.

This commit:

* Adds parsing of emoji-data.txt into the unicode table generator.
  That is necessary to extract the Extended_Pictographic property,
  which is used by the EGC algorithm.

* Regenerates the tables.

* Removes some obsoleted grapheme cluster break properties, and
  adds the ones added in the meanwhile.

* Rewrites the EGC algorithm according to Unicode 13. This is
  done by simplifying a lot the lookup table. Some rules (GB11,
  GB12, GB13) can't be done by the table alone so some hand-rolled
  code is necessary in that case.

* Thanks to these fixes, the complete upstream GraphemeBreakTest
  now passes. Remove the "edited" version that ignored some rows
  (because they were failing).

Change-Id: Iaa07cb2e6d0ab9deac28397f46d9af189d2edf8b
Fixes: QTBUG-92822
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
(cherry picked from commit a794c5e287381bd056008b20ae55f9b1e0acf138)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-16 22:01:45 +00:00
Allan Sandfeld Jensen
b3fed16e9b Don't parse XML symbols longer than 4096 characters
It is slow and will use too much memory.

Fixes: QTBUG-91889
Change-Id: I45c5e6038357c87bbb85b1ace17ef39a2a814ea0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 38e111158a38507c63fd70f9ee18b9116b537976)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-16 20:42:31 +00:00
Alexandru Croitor
609d0d4155 CMake: Fix default architecture selection for macOS and iOS
Before this change, we created a CMake toolchain file for iOS and
macOS universal which propagated the initially configured
CMAKE_OSX_ARCHITECTURES values to user projects.

So if Qt was configured with 2 arches, configuring a CMake user
project using the generated toolchain file would also build the
user project targeting those 2 arches.

The reason for this that the same toolchain file is used for
configuring both Qt and users projects and we needed to ensure that
other Qt repos are built with the same set of arches. That
unfortunately led the multiple arches to carry over into user
projects.
This is different from qmake behavior which configured user projects
with 1 arch only.

Instead of the toolchain file explicitly setting
CMAKE_OSX_ARCHITECTURES for all projects, save the initial list of
arches into QT_OSX_ARCHITECTURES.
Then if the toolchain file detects that we're building a Qt repo (by
checking for the presence of QT_REPO_MODULE_VERSION) set
CMAKE_OSX_ARCHITECTURES to QT_OSX_ARCHITECTURES to propagate the
initial list of arches.

For user projects we want to have some sensible defaults.
For macOS projects, leave the decision of the architecture to build
to CMake.
For iOS Xcode projects, leave the decision to Xcode.
For iOS Ninja projects, set the architecture to the first value of the
architectures used when configuring Qt.

As a side note this fixes an issue in our CI where we configured macOS
Qt with 2 architectures and then tried to run CMake build tests for
both architectures on a machine that doesn't have the universal SDK.
This led to build failures.
Because the CMake build tests act as regular user projects, now they
are configured with a single architecture that is automtically
detected by CMake.

Task-number: QTBUG-85447
Change-Id: Id1b7e78d7e67c1796efed10751416e5f857c16d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e379147f9571af8c3af5768b9040e0180819a855)
2021-04-16 14:22:31 +02:00
Alexandru Croitor
65d8a285df CMake: pro2cmake: Use latest project version for qml import version
Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION when setting the
version of a qml module, which extracts the version of the latest
project() call rather than the top-level one.

Using CMAKE_PROJECT_VERSION caused issues in top-level builds where
the qtdeclarative version is 6.2, but the top-level project version is
still 6.1 and hasn't been updated to 6.2, causing qml module import
errors.

This was probably an oversight during initial implementation of qml
support in pro2cmake.
So projects that define qml modules should be adapted accordingly.

Amends cce8ada8141d786c1deda78fdba485b4c67f9687
Amends 28fff4a5519c8e1068450a052cb19fb2149e9726

Task-number: QTBUG-92861
Change-Id: I494784694e997501a5bc4fd0c0eac458ddc248aa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit cf27a23937b108f7f8492a7873f71bc71c368dfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-15 18:29:38 +00:00
Edward Welbourne
2c2cc9ed80 Make POSIX transition rule parser more robust
The POSIX rule parser used by QTzTimeZonePrivate recklessly assumed
that, if splitting the rule on a dot produced more than one part, it
necessarily produced at least three. That's true for well-formed POSIX
rules, but we should catch the case of malformed rules.

Likewise, when calculating the dates of transitions, splitting the
date rule on dots might produce too few fragments; and the fragments
might not parse as valid numbers, or might be out of range for their
respective fields in a date. Check all these cases, too.

Added a test that crashed previously. Changed
QTimeZone::offsetFromUtc() so that its "return zero on invalid"
applies also to the case where the backend returns invalid, in
support of this.

Fixes: QTBUG-92808
Change-Id: Ica383a7a987465483341bdef8dcfd42edb6b43d6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 964f91fd25a59654905c5a68d3cbccedab9ebb5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-15 10:11:01 +00:00
Assam Boudjelthia
db786b4774 Replace conversion operator by operator* in QJniEnvironment
Since conversion operators do implicit conversion that might bring
some potential issues while using the API, let's stick to having
an operator* instead.

Change-Id: Ie7ad5537958944b8d1c11d69fbd30284b4b0344d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 13592385723a9b81b3715b5344bdd04e6a393a12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-15 10:10:46 +00:00
Eirik Aavitsland
ada12ec960 Avoid processing-intensive painting of high number of tiny dashes
When stroking a dashed path, an unnecessary amount of processing would
be spent if there is a huge number of dashes visible, e.g. because of
scaling. Since the dashes are too small to be indivdually visible
anyway, just replace with a semi-transparent solid line for such
cases.

Change-Id: I9e9f7861257ad5bce46a0cf113d1a9d7824911e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f4d791b330d02777fcaf02938732892eb3167e9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-15 10:10:41 +00:00
Alexandru Croitor
0ba9a4f832 CMake: Fix hardcoded iOS SDK when finding OpenGLES
The find script checked for UIKIT which is set during a Qt build
in QtPlaformSupport.cmake but is not set when building a user project.
This casused the find script to skip the iOS specific code that
passed the -framework OpenGLES linker flag.

This broke SDK switching in Xcode.

Check the IOS variable instead which is set by CMake for all projects
that pass -DCMAKE_SYSTEM_NAME=iOS.

Change-Id: I9bd088f317917544ccfeff61fc4ff90f18f0f3d8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ed5543475e614cc1b1eb3fbee6a635805bb6c805)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-15 02:33:57 +00:00
Mårten Nordheim
c735d03d44 QNetworkCookie: Rename sameSite to sameSitePolicy
As suggested in the API review.
Amends 37bd7b5733c7f1a4eb6ac5458fdc46f94a91194a

Change-Id: Ic3e8567f349568dc3b4dbf79be27c304b39480cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a7dac8e35be35462973f2f3f653e5d1986005cb2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-14 22:45:22 +00:00
Mårten Nordheim
4e8e92f640 QNetworkInformation: delete the instance as a post-routine
On Windows, on exit, the backend will deref (and then implicitly start
deletion of) a COM object. This object tries to communicate with an
object in another thread, though it seems this other thread quits before
the main thread in _most_ cases.

To get around this we move the deletion to earlier in the program. While
this is only reported as a Windows issue it makes for more consistent
behavior if all platforms behave the same.

Document and test that recreation of QNI works as expected after the
destruction (and recreation) of QCoreApplication.

Amends: 0875626e22ad4e709ddf505e701a8d699559f5b4

Fixes: QTBUG-92568
Change-Id: Iffc07f38673019aa059efd4d64d2ad706a03f6fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit e875c071ec32ab9aa460c982f25f6c6191e41326)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-14 22:45:22 +00:00
Allan Sandfeld Jensen
a474d8a9be Fix partial pixel coverage calculation
We want right - left, but the numbers we have are (1 - left) and right,
so we need right - (1 - left) = right + left - 1.

Fixes: QTBUG-91957
Fixes: QTBUG-92485
Change-Id: I238cbbe1eebddff1ce56da38127899cdbd21db0e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 004189b2d8e751021f26d9eb28948f753ea8208c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-14 18:51:11 +00:00
Alexey Edelev
71bf10ee5e Add missing compile definitions to the resource object library
The resource object library must be compiled with the definitions
specified in Qt::Core. Missing the required definitions causes linker
problems when QT_NAMESPACE is defined.

Change-Id: If0ca20604e251822279e0d4906c47b94d3b4ceb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9466b3629a391ae93c4f06d3627e3dc9e10bba9f)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-14 13:29:53 +00:00
Tasuku Suzuki
5c8fb37253 Fix build without features.menu
Change-Id: If7947839b8da5abc8ee84aace60cc7de7a053e04
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d84bf703b505db470e5c7916e3cd630c3e456cef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-13 17:09:53 +00:00
Marianne Yrjänä
d8272bcd9f Add QNX qpa to builds
Task-number: QTBUG-91234
Change-Id: I978aff101ce29d2df74ced801911426ccd56e997
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit 9c6721c106cfb593841e99b9670a3ba936254206)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-13 17:09:52 +00:00
Joerg Bornemann
a2a869c563 Fix error when re-configuring an already installed Qt repository
When building and installing a Qt repo that provides plugins for a Qt
module within a different repository (for example, qtimageformats
providing imageformat plugins for QtGui), re-configuring that repository
would result in configuration errors like

"add_library cannot create ALIAS target "Qt6::QTgaPlugin" because
another target with the same name already exists."

This happened, because the find_package(Qt6 COMPONENTS Gui) calls pulled
in the Qt6*PluginConfig.cmake files that create imported targets for the
plugins we want to build.

To fix this, when building Qt, we now load only plugins that are
provided by repositories the currently building repository depends on.

We read the repo dependencies from dependencies.yaml when the
Qt6BuildInternals package is loaded, but only in static builds and only
if we're currently building a Qt repository.

To find out whether we're building a Qt repository, we check whether
QT_REPO_MODULE_VERSION is defined. We cannot check QT_BUILDING_QT,
because that variable is not available for the first find_package calls
in the repository's top-level project file.

In each Qt6*PluginConfig.cmake file, we bail out if the plugin's
repository is not one of the ones in QT_REPO_DEPENDENCIES.

Fixes: QTBUG-86670
Fixes: QTBUG-91887
Change-Id: I8f6c8398032227032742f1ca019e983ff2bcd745
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 98e8180e56322ce065e39cc1ef1d65b54caa8c25)
2021-04-13 13:17:58 +00:00
Eskil Abrahamsen Blomfeldt
6b32d4d18d Adapt to Harfbuzz 2.8.0 update
The Unicode 13 language tags are available since Harfbuzz
2.6.7.

For compilation with earlier versions, also update the
hardcoded tags to match the ones in Harfbuzz (and in
iso-15924):

https://unicode.org/iso15924/iso15924-codes.html

Task-number: QTBUG-90217
Change-Id: I4e2cfdf61a5c4189b8aac51644c9d80c816aeebc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 910ac477f013f2af690b66f1ac41d65ab7527843)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-13 10:34:18 +00:00
Alexandru Croitor
abe4e3d2fb CMake: Fix condition evaluation in plugin's DEFAULT_IF option
Expand the condition without an extra negation.

This fixes incorrect condition evaluation for conditions not enclosed
in parenthesis.

Change-Id: I4923059b6b199676058091c23d51c9368daaebd0
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c1ac201f5c9905751eb35531f26311c8d291f9cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-13 08:15:52 +00:00
Alexandru Croitor
efbcfcc067 CMake: Fix auto-importing of plugins in static Qt qmake projects
Previously the plugin .pri files that CMake generated for qmake
consumption contained an '-' to exclude the plugin from
auto-importing only if the plugin type was generic or a platform
plugin.

Now that plugin projects that should be excluded have a proper
 DEFAULT_IF FALSE
clause, we can simply query for the defaultness of the plugin
to know whether to exclude it in the generated .pri file.

This fixes an issue with Qt static builds and qtvirtualkeyboard.

The vkb plugin was not excluded and thus any simple QtGui app
linked to the vkb plugin in a static qmake project. This led to linker
issues because the vkb plugin also depends on a vkb quick plugin which
is not listed as a dependency.

Augments 76230d98795a2e7a365328eb693ff57f6ddd7f1d
Amends c975c35eaebcca3bd33931fecc3beb513e332292

Fixes: QTBUG-92529
Task-number: QTBUG-87861
Change-Id: I9671f6504374cf0799289bbe19110e01c129402e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b6dd5d7c3b6735ef0f50c7eb068727496bff4abf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-13 08:15:49 +00:00
Alexandru Croitor
0b283ec58a CMake: Fix duplicate symbol errors in Windows static super builds
qt_internal_add_executable has some special logic to link static
plugins in order to avoid issues with link cycles on exported
Qt module targets. This logic does not take into account if a plugin
is a default plugin.

On windows this caused duplicate symbol linking issues in static super
builds, because both qwindows and qdirect2d define a subset of
the same symbols.

Make sure to only link to default static plugins.

This will skip linking to qdirect2d because it's not a default qpa
plugin and thus avoid linker issues.

Amends 5807e1ae8168a5702ad0f6890d2b35223cfebdee

Fixes: QTBUG-92451
Change-Id: I56df2ce0201625088417de53038642518c1d3bbd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ededf3914297aca62e1d257175305cab5dbf6da2)
2021-04-13 10:15:47 +02:00
Volker Hilsheimer
3a02e83e51 Don't disable menu items that belong to the active modal window
A popup/context menu created via QQuickPlatformMenu doesn't belong to any
menubar, so by disabling items in a menu that doesn't belong to the currently
active menubar (5b9f6862b1), we disabled all menu items in a QQuickPlatformMenu
when a modal window was active.

For such unrooted menus, use the QCocoaMenuObject data structure to record
which window it is shown for, and only disable items if that window is not
also the current modal window.

Amends 5b9f6862b1aa474a392203c69f6db678d633cecf.

Fixes: QTBUG-92040
Change-Id: I56b6d579e5e94689b43ca84d4637e35dc2cbeb4c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2bdaf28034541cd57b0aa7c067fda8cfbffa0e94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 21:45:11 +00:00
Volker Hilsheimer
47580de4ea Silence qdoc warning from deprecated enum value
The mis-spelled value doesn't need documentation.

Change-Id: I709abdca1d515902b3a12d3c5a5b62809d1f9a8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3fa778142a8e7de2e3cb74dcef812469aa4bd5af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 18:58:14 +00:00
Mårten Nordheim
6c00b2e8a4 QNetworkInformation: Private the destructor
It wasn't meant to be public.

Change-Id: Ifa7fff48f82b96bdfa277677d3988dc8881b8c2a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b1fe3e3d80cb23dee4de683e03711d1ac0614de2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 18:58:14 +00:00
Mårten Nordheim
e6870c6570 QNetworkInformation: Remove the default argument
And the code for loading whatever backend is sorted first.
Though, looking at the code it would've never returned 'true' anyway.

Change-Id: I7bc2c740e8cb5343e5843cb1d65715d236b92a25
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b67fe6dc7d27f857a4581e583fe25187c673bcaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 18:58:14 +00:00
Mårten Nordheim
b0320700ea QNetworkInformation: make supports(...) not virtual
Change-Id: Ib8d27410e6baa495a7351a57c8c1c1b30a64eb26
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5a60657363a860520215e4740c80b03ecf1f7e78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Mårten Nordheim
9923a90100 QtFuture::connect: disconnect signals first
During reportFinished we may call a continuation which might end up
triggering one of the signals.

Change-Id: I19546fcca12be71cd536e4287eb5eddd9d236830
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit bb85831e4de5e2c4951a0c40003ccf36f57cbd93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Albert Astals Cid
33ae5d2145 doc: Fix typo
Change-Id: Ia4219d06e306b2abd2ac0977cac63ce0492c6397
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 17db162949e2392a6d57eea1e09515c78e166365)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Mårten Nordheim
7a78d9bd17 QtConcurrentIterateKernel: fix warning
src\concurrent\qtconcurrentiteratekernel.cpp(134): warning C5055: operator '*': deprecated between enumerations and floating-point types

Change-Id: I934e767e77e9393e1da3adc390dc8e252e7f5b6a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit b86176abf6a66b20cebbcb53958229590b4c2253)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Christoph Keller
ee9f20ccf3 Explicitly set input files for qtpreprocess
This fixes build errors with Xcode 10.
Xcode 10 build system (a.k.a "New Build System") needs to know the input files
in order to build a correct dependency graph. Especially when a build is not run
for the first time and files changed in-between.

Task-number: QTBUG-71035
Change-Id: If8fbad3a1915add9b35c79131b03cdbe6b7ac06d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8115219407fdbe7c01e97c76ccf3aa48b1fd8f78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Volker Hilsheimer
8efe5f6903 Disable warnings for tests using QSqlQuery assignment
Copying is deprecated as of 14f9f00fdb2dc428610c08e3d9d03e38e9602166.

Change-Id: I235d45ff6769a29a4fdfd888c20dd9fe2fe81346
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 5f31da62bb45303b9a0f37a98c018aa710809158)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 16:28:51 +00:00
Volker Hilsheimer
180e41521c Fix compiler warning on platforms without QRhiNativeHandles
Change-Id: I61254290853cadf3b1edf6e7b0f82bba9e8d2efe
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 019f35524dc5fe317cd5e02a4483f503caaafe7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 11:21:26 +00:00
Craig Scott
38f1cc128c Warn if using CMake 3.20.0 due to potential cyclic dependencies
CMake 3.20.0 can create autogen-related cyclic dependencies that are
only detected at build time by Ninja, which then fails with a build error.
Warn and advise to use a different CMake version instead.

Change-Id: I9bef973ad2efdb69f28d6a9e0584b543be59f17f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6442116078500b0e7c401430b74bd40f32cfafb4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 03:41:44 +00:00
Volker Hilsheimer
da1e10f18d Mark variables that might be unused under some configurations
Silence compiler warnings.

Change-Id: I857cf2ee177eecf305e4fa14f6b69b019ce85468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fa3b672f998486bb7771c8e32ed43c45f55c4e63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-11 20:30:07 +00:00
Volker Hilsheimer
9b808b84bf Fix gcc warnings from having only one of assignment/copy
For example:
warning: implicitly-declared
‘constexpr Complex& Complex::operator=(const Complex&)’
is deprecated [-Wdeprecated-copy]

Change-Id: I7598e821acb7cb7bf17776d693af62778185afc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ed8429495e32537e5f426f5feb5a3b7eb0dca102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-11 20:30:06 +00:00
Volker Hilsheimer
923bb9e158 Fix warnings about lossy double/float conversion in tests
QVectorND, QQuaternion, and QColor all operate on floats rather than
qreal or double, so explicit use float literals in the tests.

Change-Id: If12cc12ddd9cd8219f3d78bf24e1400921e26c2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65e3dc5eac4b790b69e76ad5d2ba5fb5a64b066e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-11 20:29:57 +00:00
Thiago Macieira
ab813eab98 QCoreApplication: improve docs on exit() and quit() thread-safety
Reporter of QTBUG-91771 was confused.

Change-Id: I26b8286f61534f88b649fffd166c4368167a5638
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 183df80b9c1439202ae6b967774123cb313e9097)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-09 21:03:34 +00:00
Thiago Macieira
168855901a QCoreApplication::exit: make it a slot
The documentation even refers to it as such. Instead of refactoring the
documentation to explain that it isn't, just make it a slot.

[ChangeLog][QtCore][QCoreApplication] exit() is now a slot, like quit().

Change-Id: I26b8286f61534f88b649fffd166c43afbb80927f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 2e6c37fe51b5f6073db0c7335c4a4272269d482f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-09 21:03:26 +00:00
Allan Sandfeld Jensen
d58d8d2aea Fix futexNeedsWake() on 64-bit systems
It was mistaking semaphore values over 0 as waiters, regardless of
actual waiters.

Change-Id: Icebd01592ca8bdc1687a29dc569e3b630a262606
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c2348e2c7a4d92be21714deffed9c7a611e1b792)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-09 18:10:08 +00:00
Alexander Volkov
2e8e1f33ee Call statx() with AT_NO_AUTOMOUNT
Otherwise it can be very slow in some cases (e.g. 0.5 sec).
Besides, AT_NO_AUTOMOUNT is used by {l,f}stat() internally.

Change-Id: Iae9c8b46dcdc96d21ac6b114a51c382b4949d3dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9667ac1c2d3b3d48cbd154bece36ec1d41d93a59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-08 21:14:20 +00:00
Volker Hilsheimer
30c9b24a20 Don't judge other people's writing systems
Change-Id: Ifb8265bad4c8c96c6b20f957c376cec47e28f666
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 2c2b34997468a028de9e9c2de54b21c7e0757fbb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-08 13:03:57 +00:00
Milla Pohjanheimo
b8b895cee1 Add binary compatibility files for Qt 6.0.0
Binary compatibility files added.

Change-Id: I89fe7daae970af697ec57a414e3c90b24d4f9a86
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 9224f8e99fd8be0aaf5971783af4e32e3795ca24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-08 08:42:46 +00:00
Fabio Falsini
a6507ed6f4 Add legacy external storage access flag
Since latest version of Qt need Android
target sdk 29 the qt direct storage access
doesn't work because a new scoped storage
access way has been introduced. This flag
allow to have current storage access
way to work again (but is limited to
target sdk 29 only)

Fixes: QTBUG-92239
Change-Id: If0d0af7c171de4b3e8bb8dd9a88fd61b65d1c839
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit ea4868c49de48eb5fbd129e8cb9df0676754ebf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-08 00:23:52 +00:00
Robert Löhning
86729df9d4 QTextHtmlParserNode: Limit colspan to avoid segfault
This fixes oss-fuzz issue 29758.

[ChangeLog][QtGui][Text] QTextDocument::setHtml: column spans are
limited to 20480, an arbitrarily high but reasonable value.


Fixes: QTBUG-92463
Change-Id: Ib759e3e3ac0b0d0d483f8e8ce11002e079db3ace
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7473317b52dbc15878d81291faa33f21c20d6ec6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-08 00:23:52 +00:00
Nikolay Avtomonov
548b915310 Explicitly set output files for qtpreprocess
This fixes build error with XCode 10.
XCode 10 build system (a.k.a "New Build System") requires all the files
that are generated by scripts and used later on build to be explicitly
defined as output files.

Task-number: QTBUG-71035
Change-Id: Ibec39eee53b0cb3acecf592f1ca53c04b9975cad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3f0858ed10d249acb942597b4065080411281b87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 22:04:55 +00:00
Alexey Edelev
165c34fca5 Fix condition that adds resources for each Android ABI
If we already have the list of Android ABI in BUILDS, it's not
necessary to generate extra resource while Qt build.

Amends: 58556afb6960b442f88649b550aaec8e1a04338b

Fixes: QTBUG-88031
Change-Id: I344efe6c477461659a360281da59c4abeae18fc2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 72d1393c1d88a70c337e87c661bbeefe46346d23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 22:04:55 +00:00
Christoph Keller
9317c4889f Only embed launch screen when building an app
Xcode's new build system checks duplicated entries when building. Qmake wants to embed
the launch screen for all types of configurations (static libraries etc.) which makes Xcode bail
out with "Multiple commands produce LaunchScreen.storyboard".

Task-number: QTBUG-71035
Change-Id: I5c028e687f16e046b12156c1a8a89540deba4d3b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9c24ad3b94cb8c67468e947f02dd1f9aaf246085)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 22:04:54 +00:00
Edward Welbourne
51812618e7 Avoid attempting to parse insanely long texts as zone names
There are limits on zone name length and the trial-and-error approach
we're more or less forced to take to parsing gets horribly expensive
if applied to every prefix of a very long string. So apply a loosened
version of the zone-name validity rule that limits the length of the
fragments between slashes and limit the number of such fragments.

Fixes: QTBUG-92275
Change-Id: I83052b1b6888728c81135db22a9c6298ae439375
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0c9fc20e7ff7b4ff0f15e0b2c071ea834625dce9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 19:38:45 +00:00
ChunLin Wang
ae7aabd1b7 Fix get out of bounds index in QSortFilterProxyModel::filterAcceptsRow
Before calling the index function, we need to check the validity of the parameters.

Fixes: QTBUG-91878
Change-Id: I9ec7265fff3f81b8a288c4ba8fae606a2ec808a6
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit b8802071ed00689373da5817fc4824a30b5fcf86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 19:38:45 +00:00
Ilya Fedin
2543120f57 indicator-application hack: fallback to dbus service check
There is a hack to work with Canonical's indicator-application tray
applet. Since it implements the SNI spec partially and doesn't work
with IconPixmap, the icon is broken without the hack.

Unfortunately, this tray implementation is still in active use by
Ubuntu; it's shipped and enabled by default on at least:
* Xubuntu
* Ubuntu MATE
* Ubuntu Budgie
(and maybe even others)

Unfortunately, the check doesn't work in confined environments
providing broken tray icons for snapped & flatpak'ed apps.
Fortunately, snap allows checking all registered services on the host.
It also fixes the check on flatpak if permissions to talk with these
names are given.

Change-Id: Iee5d0bb610c3ff397babee89ef1ee788ac19f477
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0baa26638d7d14b6609dab191c4ea0cc1d3ff50a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 19:38:45 +00:00
Kai Köhne
e8e460535b Remove last trace of licheck
Since we don't feature it for CMake, there's little point in keeping it
for qmake.

Change-Id: I7f17d2536510c0b94dca9767036ceab7ec08e1d8
Reviewed-by: Tino Pyssysalo <tino.pyssysalo@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 337bd058b97d923ff539fa6ec87414761d0d67fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 19:38:45 +00:00
Joerg Bornemann
66598931d8 androiddeployqt: Fix the fallback location of rcc
Now, that rcc lives in libexec, we need to assume the location of rcc to
be "bin" on Windows and "libexec" elsewhere.

Fixes: QTBUG-92245
Change-Id: Idb81a5d02bae9ca3254e7590140a128500572b07
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 20db8dbeeb808edce683e34de10498ee2cdda0fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 14:02:36 +00:00
Volker Hilsheimer
104c7ff649 Fix return type of QMetaType::sizeOf in documentation
Change-Id: I6f5a866fa83f0e2720d62c5170c9283997b31a7f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1e8b085f8c8bce5d69852df4c4b72d30fcffe793)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 14:02:36 +00:00
Alexandru Croitor
bce41e0c41 CMake: Choose better defaults for qt_add_plugin STATIC/SHARED
There was a recent behavior change where the public CMake API
qt_add_plugin API took into account the value of BUILD_SHARED_LIBS
to decide whether the plugin should be a static or shared library.

Instead, use the following new behavior

 - If no explicit option STATIC / SHARED option is passed, default to
   whatever flavor Qt was built as.
   Aka if Qt was configured with -shared, qt_add_plugin defaults
   to creating shared plugins. If it's a -static Qt, create static
   plugins.
 - If an explicit STATIC / SHARED option is set, override the default
   computed value with the given value.

As a result BUILD_SHARED_LIBS does not affect Qt plugins anymore. This
is more in line with Qt expectations.

Add SHARED as a new valid option to pass to qt_add_plugin (it wasn't
before).

Add tests to check for the above behavior.

Amends aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca

Fixes: QTBUG-92361
Task-number: QTBUG-88763
Change-Id: Iae806024ddd5cf10cfe58ddbcebd2818084b0bd7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d0c2425d791edd75e35cce65ddbcfaab9a7f16ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 14:02:36 +00:00
Robert Löhning
f7605d562b Explicitly set enums' type to avoid undefined behavior
Fixes oss-fuzz issue 31022.

Fixes: QTBUG-92159
Change-Id: I8f0dfbe0e198f9ac43754758d18db1f0842d6eae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d15bfba176f7e6c616f299e82adfde148b3f26d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 14:02:36 +00:00
Craig Scott
bde2716f43 Avoid using prohibited target property names with INTERFACE targets
CMake 3.19 removed the restrictions on allowable names for properties
on INTERFACE targets. With earlier CMake versions (back to CMake 3.11),
names for custom properties must begin with either a lowercase letter
or an underscore.

In 5807e1ae81 (Add plugins to Qt tools and executables for static
builds, 2021-03-19), the names QT_REPO_PLUGIN_CLASS_NAMES and
QT_REPO_PLUGINS were used, but in some cases, the targets on which they
were being set are INTERFACE targets. Replace these with names that
are supported with CMake 3.11 or later.

Amends 5807e1ae8168a5702ad0f6890d2b35223cfebdee

Task-number: QTBUG-91915
Change-Id: Ife702a1fb339b190d46a8dafb380253219199ba6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 256dea0df74dc05ded438b33b6be8735048fd402)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 14:02:35 +00:00
Friedemann Kleint
a3316d6c95 standarddialogs example: Fix font handling
The example crashed since it passed the font label text (which
receives the font key) to the QFont constructor taking the family list.
Use QFont::fromString() instead.

Change-Id: I499fc9200b4d817b10c946a7b79ede4e7f7e69af
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit c10159a9a1254992867242897adb19ae1c3c3c35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 09:51:25 +00:00
Topi Reinio
e28b65f868 Doc: Fix various documentation issues
- Document QIODeviceBase
- Document QPointerEvent::points
- Fix linking issues

Task-number: QTBUG-90662
Change-Id: Ib123d5708953b22e01f95c82626b39a49fff95b2
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
(cherry picked from commit 00e10f62b55626097e94a2d70a9214c0062fbcd5)
2021-04-07 11:51:25 +02:00
Alexandru Croitor
37801c6c53 CMake: Build minimal subset of tests in desktop static builds
Add new configure option -make minimal-static-tests and CMake option
QT_BUILD_MINIMAL_STATIC_TESTS. In conjunction with QT_BUILD_TESTS
it will enable building a minimal subset of tests when targeting
a static desktop Qt build.

In qtbase the minimal subset includes all the auto tests of testlib,
tools, corelib and cmake. In particular this will also do cmake build
tests and qmake build tests (tst_qmake)

Adjust CI instructions to enable building a minimal subset of static
tests when a platform configuration is tagged with the
MinimalStaticTests feature.

Fix and skip a few tests that were failing.

Task-number: QTBUG-87580
Task-number: QTBUG-91869
Change-Id: I1fc311b8d5e743ccf05047fb9a7fdb813a645206
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e6c4224f00999d4089d7c2ac462bb5a60a14adc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 06:33:47 +00:00
Eskil Abrahamsen Blomfeldt
c197629f80 Update to Harfbuzz 2.8.0
This updates Harfbuzz to the latest version and also
adds an import script to help with this work in the
future.

Task-number: QTBUG-90217
Change-Id: I23eae7b7bbbd5001df9873e4784a0c4213de5508
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 70af64433f491ee28e8b4ff19ebf413d45960155)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-06 19:07:59 +00:00
Doris Verria
a0def9b90d Fix label margins for pulldowns with custom styled menu indicator on macOS
Don't apply the QMacStyle's pulldownButton titlemargins to the
QPushButton's contents rect if the button has a custom styled menu
indicator. This causes the button's text/icon to be misaligned.

Fixes: QTBUG-86134
Change-Id: I6ef95d51071c1d79f1cc07425a46958f50091b7e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 37f9f2e7afb2539ead355f1115e10835c2df9f92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-06 14:51:25 +00:00
Heikki Halmet
2d5e8bf5af BLACKLIST tst_qfont for Red Hat
Task-number: QTQAINFRA-4363
Task-number: QTBUG-84248
Change-Id: I791aba3bf2b26f9c90201b1dcd67c2a85d28f08b
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit c87847db8781a6846069e0f7e55b8ccc64d9420d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-06 06:56:38 +00:00
Volker Hilsheimer
838029966a Document change to QAbstractItemView::viewOptions in porting guide
We couldn't deprecate and add the replacement in 5.15, so list it
explicitly here.

Amends c501e09efacb8a60deb41f85f3402f6f4c041d95.

Change-Id: I174a7b6214cd8b9579b029ebf57e4d5b2e28e574
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a395372ccf7b6ce5575aeec627b403c4f9af9647)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-04 15:46:24 +00:00
Pekka Gehör
56b54743e0 [Android] Fix select handles misplacement on QDialog
Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangle of anchorRectangle of the selected word/text

Change-Id: I3425104c90f0efe6a1e4337328cf06dc93685b6f
Task-number: QTBUG-90799
Pick-to: 5.15 6.0
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-04-01 07:33:40 +03:00
Volker Hilsheimer
307da60fb0 Remove QEXPECT_FAIL for tests that pass now on Android
Fixes: QTBUG-69214
Fixes: QTBUG-69218
Fixes: QTBUG-69220
Change-Id: I8b780db8d9dad1a877bc16e802e6ae92de0c8f23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 15b0809f069ef29320d13936a1aed7ed422a8b43)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-31 21:09:59 +00:00
Alex Trotsenko
fe979a809f QLocalSocket/Win: fix possible UB in _q_pipeClosed()
We must stop the pipe writer before closing the handle on which it
operates.

Change-Id: I4765dd8393167fe2453653aba76a097b8ace8e3d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 64f02ebf05d88eaa8399a5cff85db5a605ede62e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-31 18:43:17 +00:00
Alex Trotsenko
4e15494dad QLocalSocket: fix signal name in docs
It should be disconnected() instead of disconnectedFromServer().

Change-Id: I2b816e9c92d675ea5a7a26b4752e831c30950ef2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 97877d79487befe050f96aa9ae3b52f20a351e97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-31 18:42:39 +00:00
Volker Hilsheimer
4e94e29aec Remove QEXPECT_FAIL from passing test
The test is blacklisted in dev and 6.1, let it fail properly. We can
watch the history of the test and remove the blacklisting if/when it
passes consistently on supported macOS versions.

Task-number: QTBUG-20984
Change-Id: I3211ecf565995578c83a092c637890c0e8bfd766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 83d4ca3f66aa269ff47ff77e718fcbea594f2179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-31 13:48:37 +00:00
Joerg Bornemann
88886f1932 Fix DESTDIR support on Windows for versioned hard-links
On Windows, we need to strip drive letter and colon before prepending
DESTDIR when creating our versioned hard links.

This fixes CI submodule updates.

Pick-to: dev
Change-Id: I41bc5f27b714ef74d3fadc4a0fb16c3d8b20da1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-31 13:32:51 +02:00
Volker Hilsheimer
68ab295ec3 Add "we mean it" warning to private header
Fix warning from configure.

Change-Id: I12def11a4effb7298ec0501cfac4ffd37b777ff6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c329f023a29f45a1e87c660554c49fee34dae4b)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-31 09:03:37 +00:00
Alexandru Croitor
734d2cdbc4 CMake: Semi-handle non-current repo qt modules when creating plugins
In the recent refactoring of qt_internal_add_plugin, a new target
existence check was added when associating a plugin with a qt module.
That check didn't account for a qualified qt module target name.

This failed configuration of qtsvg which checked for the existence of
a namespace-less 'Gui' in a per-repo build.

Make sure to prepend the Qt namespace to the qt module name and also
handle aliased target names.

As a drive-by, add a TODO item to figure out how to link executables
to plugins who's plugin type belong to a different repo, but both the
executable and plugin are built in the current repo.

Amends aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca

Fixes: QTBUG-92235
Pick-to: dev
Change-Id: I1c0f83672ab00f4702be9bad9a66ccc35e82f5c8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-31 01:09:20 +02:00
Joerg Bornemann
c9fefcf98b Move bin/qt-internal-configure-tests to libexec
Task-number: QTBUG-88791
Change-Id: I78613128760b5820e6db17b0c09462e34f7c7bb2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4ae9922166ba81c9efea5b2af29898eb20a1fd63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 18:47:57 +00:00
Kai Köhne
f7af2325f5 Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH
Allow to set QT_ADDITIONAL_PACKAGES_PREFIX_PATH as both an env
variable and CMake cache variable. Also normalize path and list
separators, so that they can be used similar to CMAKE_PREFIX_PATH.

The environment variable is intended to be set by the conan virtualenv
generator, so that e.g.

  find_package(Qt6 COMPONENTS NetworkAuth REQUIRED)

also works if NetworkAuth is not installed into the Qt prefix.

Fixes: QTBUG-91142
Change-Id: Ia9f9b9fa2b1b051d33073629139640d0f4c7a843
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
(cherry picked from commit 5bbd700124d13a292ff8bae6045316112500e230)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 18:47:55 +00:00
Andy Shaw
474ec0ac9a SQLite: Update to 3.35.2
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.35.2

Change-Id: I1e784627d7ed3a226acfbb28d8379d4c69f91a84
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 022fd8e79cfa25049f262bbd6aef4298f14b4d96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:15:32 +00:00
Tor Arne Vestbø
9b971fe038 qmake: Improve error message when detecting macOS platform SDK upgrade
Task-number: QTBUG-85546
Change-Id: I2bce9d22ad826fa73fa4dbfd03c9b1d404c57859
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fca543bcdeb2cb5c6c478e96a7d75010f637d784)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:15:23 +00:00
Joerg Bornemann
d4a79dba3b Fix qmake user projects for QT_LIBINFIX builds on Windows/iOS
QMake user projects could not be built on Windows or iOS if Qt was
configured with QT_LIBINFIX set. The code that generates
qt_lib_entrypoint_private.pri file did not take into account the lib
infix.

Fixes: QTBUG-91511
Change-Id: Ibc40548a269238320f8f89a710d10e7f639246cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7b4507d0be28d1258d5569182a03e8ead8620f2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:15:11 +00:00
Joerg Bornemann
8e5f2252cc Fix CMAKE_INSTALL_PREFIX when building against installer-provided Qt
When building a module against an installer-provided Qt,
CMAKE_INSTALL_PREFIX would default to /home/qt/work/install, which is
the install prefix of our packaging machines.

Do not hard-code the install prefix in QtBuildInternalsExtra.cmake but
use the one that is calculated from the location of
QtBuildInternalsExtra.cmake.

Fixes: QTBUG-90449
Fixes: QTBUG-91475
Change-Id: I39f214efb18796a89f00a171ef190c547bba5c0a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e6527e2f73663205a0f36feac5a7feda47fba152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:58 +00:00
Eirik Aavitsland
0c41c19a6d lance tool: fix build for Qt 6
Change-Id: I639ffa60609b1e6036252cccc146dd98fded0b3e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 14ccc11194caf0e965c3a61b4f6bec01d5f73eb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:50 +00:00
Andre de la Rocha
7432281cc9 Windows QPA: Fix accessibility focus event for table/tree/list
The focused element within a table, tree or list was not being informed
in the UI Automation focus change events, causing the focused element
to be missed by screen readers.

Fixes: QTBUG-91029
Change-Id: I738502e6871358508b4510763018837c304b618e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f1eccab04e01b3acc1a4b4c6a5fe7b3af3e2dcba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:39 +00:00
Friedemann Kleint
8bed35c07e Prospective fix for flaky test tst_QDoubleSpinBox::setReadOnly()
The test has been observed to fail with:

 FAIL!  : tst_QDoubleSpinBox::setReadOnly() 'QTest::qWaitForWindowActive(&spin)' returned FALSE. ()
 /Users/qt/work/qt/qtbase/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp(863) : failure location

Remove the widget member and use a widget instantiated on the stack instead.
Add a check for top level widget leaks in cleanup() and fix leaking task224497_fltMax()
by instantiating the widget  on the stack.

Change-Id: Idbbb5d859c0df2d9b9f49fb9f69ef6bb7d1ee150
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4b15a8ea8fe0d64b529b859a3dba0de68b92ce85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:25 +00:00
Eskil Abrahamsen Blomfeldt
e7107e9a1d wayland: Remove bogus warning about ignoring WAYLAND_DISPLAY
On Gnome, we will not default to Wayland at the moment, even
if the desktop is run in Wayland mode. In this case, we warn
users that they can still select Wayland manually using
QT_QPA_PLATFORM.

Problem was: We never checked if they had actually explicitly
selected Wayland, so even in the cases where we would end up
using that QPA plugin, people would still see the warning.

This moves the check to the end of the platform selection
algorithm, after we have collected all the information.

Change-Id: I0d734bd0782c5e58d6dc63f69b7d531a479ad942
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 642ed84a2db1ced7373707230d18e9d677277fa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:16 +00:00
Joerg Bornemann
1a1d981b56 Fix build of QTuioTouchPlugin with Makefile generator on macOS
For each plugin, we create a custom target with it's OUTPUT_NAME such
that one simply can do 'ninja qtuiotouchplugin' to build it.

QTuiTouchPlugin has qtuiotouchplugin as OUTPUT_NAME, which is
problematic with Makefile generators on case-insensitive file systems.
See CMake upstream issue #21915 for details.

Work around this issue by not creating the custom target in this
situation.

Fixes: QTBUG-84342
Change-Id: Id9a6cf0a01c179d5c93da4146e393cf00153ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 82d50925f1a7d4ff852e5302fd9e8a3ae18763d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:14:08 +00:00
Joerg Bornemann
f426246474 Error out on attempt to configure framework build with lib infix
Setting a lib infix is not supported with framework builds due to the
nature framework of include resolution: includes like <QtCore/qstring.h>
won't work if the framework is named QtCoreInfix.

The combination framework build and lib infix was agreed on to be out of
scope in the comments of QTBUG-35604.

Change-Id: Ib7c6983f2f64ea1a7cfcd56657d31eeab3f55fe3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e6cee41c53c4057002b70f26888b2dc40fa15047)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:13:52 +00:00
Sona Kurazyan
098701edba Remove the unnecessary template parameter from the class specialization
This seems to cause errors when compiling with gcc-11. Although this is
most likely a compiler bug, specifiying the template parameter type in
this case isn't necessary.

Fixes: QTBUG-91909
Fixes: QTBUG-90568
Change-Id: Ib231257ccb2e16cc533f23ca5840d31e26a66d53
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 659f7a06e91c04b239e3f4c0bcfccbe3581af1c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:13:44 +00:00
Kai Köhne
2d67ce3e75 headersclean: Compile with -std=c++latest, -Zc:__cplusplus on MSVC
c++latest does check that our headers also work with upcoming C++20
support in MSVC. It also implicitly sets -permissive-, which checks for
stricter standards compliance.

Task-number: QTBUG-91117
Change-Id: Iaf1547191969213d570a1b2f59888ad04a7977ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b58ca067da7dad3e151231c58f60238ed01cb65b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:13:33 +00:00
Alex Blasche
84364d8099 Remove qualification for Julian calendar
The given qualification was wrong but also not needed in the first place,

Fixes: QTBUG-92046
Change-Id: Id28347fee2ef11ffcb0df8320b1025568b59de9c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit edfab62cb02781b1c5a5e433f6f64af285dfa0f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:13:16 +00:00
Joni Poikelin
0497f16fa7 Fix removing columns when QSortFilterProxyModel has not been sorted yet
Fixes: QTBUG-91788
Change-Id: Iddcafd3171f0f3703b94893a32b4ccaaeea9e713
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit e287582cba74ddcfc67f83647e72c0b23bd99c36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:13:04 +00:00
Andy Shaw
9053ea563f Return the result we have already when getting an object with no name
This will ensure that something is set for the AutomationId based on
the actual object and the parents that do have object names until it
reaches one without an object name.

Change-Id: I205485bc0ba772e321879e00e64ea8e1d8f1ba91
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 5577cbaac59e7fc198ea2c98c1e4268779fbf0b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:12:36 +00:00
Fabian Kosmale
5c8701aebe tst_qguimetatype: Avoid deprecated methods
This makes the 5.15 and 6.x branches more comparable, as in 6.0 the
preferred way is to use the non-static methods (which avoids an
expensive lookup in 6.x).
As a drive-by, Avoid memory leaks if the test fails.

Change-Id: I95b133342a4ea19dd23c235a408f38089706412b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit a7f24218e3795aa54effc2665e0a505c02b10382)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:12:19 +00:00
Edward Welbourne
c0220acd71 Include minus sign in ImhFormattedNumbersOnly's available keys
UIKeyboardTypeDecimalPad only provides digits and decimal point, no
minus sign, but ImhFormattedNumbersOnly is documented to provide a
minus sign as well. UIKeyboardTypeNumbersAndPunctuation includes
punctuation, which should cover signs as well as decimal separator, so
use that - same as for ImhPreferNumbers. A little more permissive than
we want here, but that's better than more restrictive !

Fixes: QTBUG-91455
Change-Id: I0418946014e0a66d503e61704154fd7798a0b785
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 17bf553b76ebd688e58e4de4271407e2058d89ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:12:09 +00:00
Eskil Abrahamsen Blomfeldt
97ffc571ae Support family names that end/start with space
If the family name starts or ends with a space in the actual font
data, then this would not be selectable by Qt. This is because we trim
the family name before matching it against the contents of the database.

Testing on Windows GDI, it actually does trim the spaces on the
family names (matching a request for "Chibola" with a font called
"Chibola " for instance), but since we read the font data ourselves,
we are not doing this.

To ensure we never have font names that cannot be matched in the
database, we make sure we trim the family names before registering
them.

[ChangeLog][QtGui][Text] Fixed matching against fonts which has a
family name that ends or starts with a space.

Task-number: QTBUG-79140
Change-Id: I9cdb50b78a7da2d2697f992ce462033eb1d7ada7
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 7fd9ed32012bd9001e78ad692a4802e0e3366e44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:57 +00:00
Yang Yuyin
bf89fa82a2 QIcon::setIsMask: delete extra judgment
QIcon::detach can judgment if the d pointer is nullptr

Change-Id: I90fd5f50ed2565a5654b978c4603635e62677953
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2a9c93a3483e60257d2625b70b395cc20dcc88ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:46 +00:00
Timur Pocheptsov
bdf13bf3cb tst_qdtlscookie: use a proper 'enterLoopMSecs' instead of 'enterLoop'
It's a bit weird to calculate timeout in milliseconds and then pass
it as number of seconds ...

Change-Id: I1127163ea06e49ac1b53eea6f60ee8590319bfa1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b262007929e84089dcfecd45948a2005aca79fb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:37 +00:00
Joerg Bornemann
03c1403fc2 Remove fixqt4headers.pl
This script was aiding users to port from Qt 4 to 5 and is considered
to be of little value for Qt 6.

Change-Id: I26fb97d32969463d94e38222e32f241f86ad9193
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e01add5cdbd703f616bc8319e6008ce11558cced)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:35 +00:00
Joerg Bornemann
6aa3122c3b Fix double inclusion of QtAutoDetect.cmake in top-level build
The variable we need to check is called QT_SUPERBUILD, not
QT_SUPER_BUILD.

Change-Id: I8487f491a0a4cebdf08f579519e99e6afe3db8c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 7b6c526ef1857101a0274ff8d945d4ce08c9bd61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:24 +00:00
Huang Jie
da778d7ade Variable is Assigned a never used value in qt_make_filter_list()
Variable 'i' is assigned a value that is never used in qt_make_filter_list()

Change-Id: Id845ecb5231b97a899443bdcb9f49cccb7f20bea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 8a226cd76b96527970b1600f6975c13eccddf109)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:11:14 +00:00
Oliver Eftevaag
f930f6a797 Font style name 'Normal' and 'Regular' have the same meaning
Some popular fonts on linux systems follow a naming convention,
where font styles are named 'Regular', 'Italic', 'Bold' and
'Bold Italic'. Qt so far only accepts the words Italic and Oblique
interchangably, but not with Regular and Normal. This change will
make sure that Regular is interpreted the same as the Normal font
style.

Fixes: QTBUG-90396
Change-Id: Ibbaf086de742c91f4d380c937ca80e846aa32a2e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 426b363761dbb4c95d263df2e4acdfab071c8018)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:46 +00:00
Qiang Li
3dca0aaf09 Fix z-value of QGraphicsItems being ignored during draw
In QGraphicsScene's function draw, don't copy the children into a
const copy (to prevent detaching in the loops), as they might get
sorted. Instead, use a const reference.

Amends e349f787d595aa343ca86af94159b6730d55b8d5, which introduced
the bug by making a copy of the unsorted list.

Fixes: QTBUG-81316
Change-Id: Iab9b87e75178a883806088a9db234c7a2aaa9301
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 269fdef53d98386b714bf6852a1f214e9159faa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:38 +00:00
David Faure
1b1f2b265e QAbstractItemModelTester: fix false positive when model has zero columns
Regression introduced by me in commit 72e0d699cec09458ca9325035d477d4899e8e47b

Fixes: QTBUG-92220
Change-Id: Ic7dd4eda0a1993f9763933882baf928bfc83b08b
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b4aac2af19690917553f93660e3ad760fc15d0b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:20 +00:00
Oliver Eftevaag
117e0a4369 Add nullptr check
Adding a nullptr check before dereferencing in case q is null.

Change-Id: Ia440e2ed41cbaf06a5919930c2e1615bb3916ff3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 57f752b30a0f452e9cc079b5a4ede6134719a769)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:18 +00:00
Zou Ya
fd2fa0e2b0 Redundant condition: tornoff
Redundant condition: tornoff.
'!tornoff || (tornoff && scroll)' is equivalent to
'!tornoff || scroll'

Change-Id: I8339faa4d53360db280173ee489e48eba4883b70
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 712117f8b89cdb2578d6aaa424141da216799fe9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:16 +00:00
Huang Jie
8dbc4d029e Redundant condition: widget
Redundant condition: widget. '!widget || (widget && widget->isEnabled())'
is equivalent to '!widget || widget->isEnabled()'

Change-Id: Ife915bd5ea66f8ccff48a1612f8c78c263075c89
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit d3ec08eea060a9451f06c394bb85a6357504c61e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:14 +00:00
Zou Ya
9ff12dcfe1 The condition 'if(oldChild)' is redundant
Either the condition 'if(oldChild)' is redundant or there is possible
 null pointer dereference: oldChild.

Change-Id: I28971cfa33294679ddd325158669b422b3a1c2eb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b487a7929d0f16c82a95e37d13de4651d92214cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:12 +00:00
Friedemann Kleint
1b349a6df1 Blacklist test QMenu::QTBUG_89082_actionTipsHide() for Windows
Apparently, ba139603925453bf79994eca48b566d8f15b2af0 is not
sufficient.
Amends 3f3d5e6716d9130776b3613ccbd5595de7d4af8d.

Task-number: QTBUG-89082
Change-Id: I80a00abb330bebd3be8667762c279c2eef595c7f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b62725608bbc1a8924209bd733aefe9f0465c3a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 15:10:10 +00:00
Volker Hilsheimer
c55d9c2d90 Make getter const, add const overloads
The supportedApiVersions member is new in Qt 6.1, make it const.

We can't change supportedLayers and supportedExtensions, but we can
add const overloads that call the non-const version for now. This
way, those APIs can also be called on const QVulkanInstance
instances or references.

Addresses header review comment.

Change-Id: Ie99d74f62cad72990b42566e56234b9c686e86de
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 69dcdbc8daa2c40397dd021fc31c47ad528d9d83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 12:19:51 +00:00
Volker Hilsheimer
ee520939c8 Use official names for Android versions
Google ditched the dessert names as of Android "Q". "Q" and "R" were
development names, the released versions are called  Android 10 and
Android 11, respectively.

Task-number: QTBUG-90211
Change-Id: I36225067cc802ebd3ebd1289d509759ae1b2d83d
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 76b3d024e45cc044bde2b6fb4b24849cf96b0012)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 12:19:45 +00:00
Tor Arne Vestbø
e24f882590 Blacklist tst_macgui::scrollBarPainting()
It fails on 10.15 and 11, preventing those from being significant,
and the test is already marked as expect-fail based on QTBUG-20984.

Task-number: QTBUG-20984
Change-Id: I6911166a1c3e9173d6d36f2a3a68b37778fd3406
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit eab286b760bc33e2f90d1f9e94b34d89266d3d74)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-30 14:19:34 +02:00
Assam Boudjelthia
68ed06b17b Rename QJniEnvironment exceptionCheckAndClear to checkAndClearExceptions
Address feedback from header view.

Task-number: QTBUG-90211
Change-Id: Iad2b609598b16f66fd6ab09484fe6e6899981263
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b9f27335e7462a15ac642841bb6d86ebebb349f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 09:24:01 +00:00
Friedemann Kleint
f82b504ef4 Brush up the imageviewer example
- Fix the save as file dialog being in "Open" mode by setting
acceptMode
- Fix clazy warnings about detaching QList by using constFirst()
- Fix clazy warning about passing a context to slot connection

Change-Id: I0c800e9829e118fcec477322aa2a13660e3b51d2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit fe1ef3ebcbfe017bdb01e16480a5c38cad6e39b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 08:54:53 +00:00
Friedemann Kleint
b861f65fab QFontDialog: Fix crash when passing QFont constructed from empty string/stringlist
The standarddialogs example showed a crash when opening the font dialog
due to the empty list.

Amends d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8.

Change-Id: I93191485c72712d9b2d3ea0ae104f5edb9621f0c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e49e5d87be4b30522a85037b5dd81be703882b67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 08:52:59 +00:00
Volker Hilsheimer
5e838e979e Replace QTextDocumentResourceProvider with a std::function
376e3bd8ecf40881685714f6f19e12d68e92127e added the new class for Qt 6.1,
but during header review we concluded that using a class introduces
complexity wrt instance ownership and API design that can be avoided by
using a std::function instead.

The functionality is tied to QTextDocument, so the type definition and
the default provider API is added there.

Since std::function is not trivially copyable, the atomicity of the
previous implementation is not maintained, and concurrent modifications
of and access to the global default provider from multiple threads is
not allowed. The relevant use case can be supported by implementing a
resource provider that is thread safe.

Task-number: QTBUG-90211
Fixes: QTBUG-92208
Change-Id: I39215c5e51c7bd27f1dd29e1d9d908aecf754fb7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit ccf1a1a9536be7b904494f5b3243202d71a33b06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 08:31:21 +00:00
Andy Shaw
516316e9a2 iOS: Protect against a possible crash after the window is deleted
If we are in a case where the original window is deleted before a new
one is shown then we need to make sure that we are not still expecting
that the original one has the focus. So we protect against the crash
by only outputting the address of the object that previously had
focus.

A follow-up patch will be done for inclusion from 6.2 that will fix
the root cause of the pointer being invalid when the only window is
deleted before a new one is shown.

Fixes: QTBUG-92173
Change-Id: Ifdb3fd6b6cb8fb8e8b79d2c325a30c27b298d8a9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b050d4867f68c3d35493221d65d343749504c988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-30 05:47:00 +00:00
Volker Hilsheimer
6466d949da Rename QUrlResourceProvider to QTextDocumentResourceProvider
While the class name is now a bit more than a mouthful, it's purpose
is very narrowly tied to QTextDocument, so don't use a very generic
name for it. That resources are provided based on a URL is to some
degree an implementation detail, and URLs are resource locators so
we don't need that in the class name.

Address code review comment for 6.1. Add documentation and links to
existing APIs with a similar purpose.

Task-number: QTBUG-90211
Task-number: QTBUG-92208
Change-Id: I4f09057cc2f53a5595513c1c9422e6ccaad6ca13
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit c8f6f8a2220ce8fd628c969f19dfae6f38d7311c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-29 16:37:48 +00:00
Laszlo Agocs
ab32956178 Skip a tst_QRhi test case with the Android emulator
Task-number: QTBUG-92211
Change-Id: I63ff17b226d502189bc769b0b28640b849b8d39a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9e662a0baf46253fcb88027688587c06b7112620)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-29 10:56:08 +00:00
Craig Scott
b296202831 Refactor qt_internal_add_plugin() and qt6_add_plugin()
Remove code duplication by calling qt6_add_plugin() from
qt_internal_add_plugin().

Separate out the public and internal arguments for the
variables defined in QtBuild.cmake for these functions.
Provide them via commands instead for greater robustness.
This separation allows other Qt repos to access the appropriate
set of keywords where they define commands that forward
on to *_add_plugin() in their implementations. Retain
the old variables for now to simplify the integration
steps for updating other repos. The old variables can
be removed once there are no more references left to
them in any repo.

Task-number: QTBUG-88763
Change-Id: I0105523afd95995923bd20fc963d245bbb15d34d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-29 10:56:07 +00:00
Giuseppe D'Angelo
4e624996a7 tst_qobject: fix the detection for GCC
Q_CC_GNU is defined on compilers that masquerade as GCC (Clang, ICC),
so using it to work around GCC-specific bugs is wrong. Introduce a
local define for _only_ GCC and use it in place of Q_CC_GNU.

Drive by: version-fence a test we now know it's been fixed upstream,
and correct the link to the corresponding bug report.

Change-Id: I9059d6e6bf86157aca71590ac22afb1a1c114313
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8b9c8d417b8ff2d4f60d83f9cc69c148632d1046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-26 18:50:07 +00:00
Giuseppe D'Angelo
9c12d8e8f7 QPainterPath: fix handling of fill rules
fillRule() contained a major blunder: instead of checking if the
d-pointer was allocated, and return a default value if it wasn't,
it checked whether the path contained any points. This means that

  QPainterPath p;
  p.setFillRule(x);
  Q_ASSERT(p.fillRule() == x);

was failing.

As a drive-by to test this change, fix another mistake in clear():
clear is documented to clear the elements in a path, but instead
it also changed the fill rule.

This commit partially reverses 697910e5fbd382e78bc1bcbac3f5824aded059b4.

Change-Id: Ieb8145694b672439c3380d9ccb87d1206a2dd115
Done-with: Milian Wolff
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0b4ccbf81ee2009051169f2f0918442b56512b20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-26 14:38:28 +00:00
Alexandru Croitor
9d1b1c71b2 CMake: Fix qconfig.cpp embedded prefix in the CI
In the CI on a windows we configure Qt with the following prefix
-DCMAKE_INSTALL_PREFIX:PATH=\Users\qt\work\install

Note the lack of the drive letter.
This is intentional, so that we can abuse CMake's DESTDIR installation
mechanism to install into a custom path.

This causes trouble for static Qt builds in the CI.

Specifically when there is no qt.conf file next to qmake, qmake -query
will report a
  QT_INSTALL_PREFIX:/Users/qt/work/install
and ultimately qmake will fail to locate the module .pri files in such
a path, showing errors like:
  Project ERROR: Unknown module(s) in QT: core gui?

If a qt.conf is placed next to qmake (even an empty one), a differenct
code path is used in qmake to resolve the prefix, which returns a path
with a drive letter.

In a shared build, because the 'relocatable' feature is enabled by
default, a different code path is used and thus the prefix is
also successfully resolved.

So the problem is specific to static Windows Qt builds that have no
qt.conf file next to qmake.

This is the exact scenario that we encounter when running static
Qt tests (tst_qmake in particular).

To circumvent the issue, prepend a drive letter to the prefix
hardcoded into qconfig.cpp. Do that with
get_filename_component(REALPATH) which apparently resolves
to a fully qualified path.

Task-number: QTBUG-87580
Change-Id: I17c885f29bfdee45bec1d6aac7c3b26723e761a3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 59c3be711728ab0aa644bfdf50e91a1b020f95bb)
2021-03-26 13:31:21 +01:00
Alexandru Croitor
33fe70d514 CMake: Get rid of the Core_qobject static library
The Core_qobject target was problematic for a few reasons.

In the very beginning, Core_qobject was an OBJECT library, explaining
its existence with the following comment "requires to spill internals
into users". The object library contained qobject.cpp and
qproperty.cpp and their manually generated moc files.
It was was a dependency of Core.

Afterwards it got converted into a static library instead, presumably
to circumvent some issues with metatype generation.

Unfortunately making it a static library was wrong, because it leads
to linker failures (undefined symbols) in a static Qt build when
trying to link a project that uses only QtCore.
Both Core and Core_qobject refer to each other's symbols, and
whichever library came first on the link line, many of its symbols
were discarded by the linker.

Transforming Core_qobject back into an object library could be an
option, but that leads to trouble with creating proper prl files
(our infrastructure doesn't quite support that for object libraries
yet).
Furthermore, there was some internal discussion and concern
about how to merge the two metatype json file lists (Core and
Core_qobject) into a single file.

Instead of using an object library, move qobject.cpp and qproperty.cpp
to be directly a part of Core again and remove the Core_qobject
target.

In order to do that, we have to circumvent some issues with
AUTOMOC.

First, we have to disable AUTOMOC for qobject.cpp and its headers.

qobject.cpp contains Q_GADGET, Q_NAMESPACE, etc keywords
in its doc comments. That confuses AUTOMOC, because it expects a
qobject.moc file which is not included by qobject.cpp.
See e2ff9e3b9957f844d6530cc92096bed3c16fa46a for some details
on the Q_GADGET + AUTOMOC issue.

We still need to run moc on on qobject.h and compile moc_qobject.cpp,
so we manually run moc on the header file. Because qobject.cpp
directly includes moc_qobject.cpp, we need to adjust the header
include path to the generated file.

Second, we remove the direct inclusion of moc_qnamespace.cpp
in qobject.cpp to prevent duplicate symbol compilation, because
the symbols were compiled both as part of qobject.cpp and
mocs_compilation.cpp.

Finally, because manual moc is used on qobject.h, the generated json
file needs to be explicitly passed to Core's metatype generation
step.

Amends e57a94cbd8f28ccab8b3368afc4365237c533a4f
Amends 3c4c02b3f1cec8ebc0134fd05b0e51f1f771937d

Task-number: QTBUG-87580
Change-Id: I859a7d2f95508eda211a0a0b4ec132540b78bda4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 04df85bbecdc034876d509b9c96a4f17fc990293)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-26 13:31:18 +01:00
Eskil Abrahamsen Blomfeldt
7c3311e196 Fix compilation with experimental x11 paint engine feature
Adding support for vertical subpixel positions in
d79a9b1a4f694a227ce62ccab9b44685a9755916 changed some private APIs
which were used from the xcb-native-painting feature.

This fixes this (it does not implement vertical subpixels but
simply sets the vertical subpixel position to 0). It also
adds a missing "override" which triggered the warnings-are-errors
when compiling for me.

Fixes: QTBUG-92011
Change-Id: If214a0d19a41e623ca9ef8e6215bc145f9846ae9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 70251867a50f9f606a7ceaf2338375a67e413b83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-26 07:39:09 +00:00
Laszlo Agocs
cc3260b37a rhi: vulkan: Prevent a misplaced assert from triggering in debug builds
One place where this popped up was the qrhi autotest (in debug builds).

This check is meant for VkRenderpass objects for texture render targets,
should not bother with it for the "main" renderpass.

Amends 19384f2e8f50bad0a0775f7b2e10aff3372bcbb5

Change-Id: I877a2458fe17fe339b4741d4aa8af3fbda4dabcc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3c85f8e9fc1977cf2a650b17b43d3eac4960155e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-25 21:25:21 +00:00
Andrey Butirsky
9a72beca56 Fix no mapping for SysReq key
XKB_KEY_Sys_Req keysym is currently unmapped to any Qt::Key.
Implication of this it is uncapable to participate in any keyboard
shortcuts.
This patch adds the missing mapping.

Detected by testXkb KWin unit test

Fixes: QTBUG-92087
Change-Id: I2440c218e265c5636fc1d2703f14d8bfe033967e
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
(cherry picked from commit 40193c2b6919875a714e84f5029ba2bcc1f9e258)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-25 17:47:24 +00:00
Volker Hilsheimer
57c7b37482 Fix deprecated macros
The QTextCharFormat::fontFamily  methods are deprecated as of Qt 6.1,
not as of Qt 6.0.

Mark them as obsolete in the documentation and point to the replacement
there as well.

Address API review comment.

Change-Id: Id71ea1ebab6f7a385c8c3f286a35f88ba1177857
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 42e659b3205871649c921873365606b9f7b3f924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-25 13:07:30 +00:00
Mårten Nordheim
5fc0ebf6a7 CMake: Don't attempt to add to a target that doesn't exist
When configuring a benchmark using the standalone-test script the
'benchmark' target is not available, causing a configure error.

Change-Id: I8e480c9e72b47783c0910428187f0092049e89db
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1d6a35c5363944ce59eba114f827b1992f31bde3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-25 10:04:54 +00:00
Joerg Bornemann
c19d957f45 Add a way to install versioned hard-links for tools
Add the option argument INSTALL_VERSIONED_LINK to qt_internal_add_tool
and qt_internal_add_app. For tools/apps with this argument we create an
install rule that creates a versioned hard link. For example, for
bin/qmake we create bin/qmake6.

Note that this only applies to prefix builds.

Apply this argument to qmake.
The qt_internal_add_app change is necessary for qtdiag and in qttools.

Pick-to: dev
Task-number: QTBUG-89170
Change-Id: Id32d6055544c475166f4d854aaeb6292fbb5fbb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-25 10:24:57 +01:00
Edward Welbourne
74b7d5643f Fix warning from syncqt.pl about header inclusion path
After a "QtCore: WARNING:" intro (separated to avoid being mistaken
for a footer) syncqt.pl said:

 .../qtbase/src/corelib/kernel/qjnienvironment.h includes QScopedPointer when it should include QtCore/QScopedPointer

Change-Id: Iaa1f025367b7321af9c5de27196ebf271f9179df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 968f4001a86d4a3321ac41f6b2808ccb3b1271fe)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-25 09:31:40 +01:00
Alexey Edelev
5297a0a2af Rework the failure macros in the Qt CTest kit
The _qt_internal_test_expect_fail macro fails when the test fails
during the configuration step. Rename this macro to
_qt_internal_test_expect_build_fail and add
the _qt_internal_test_expect_fail macro that expects inverted test
result.

Change-Id: I4635e99152f7a32f5c48202e84fec59800453d34
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit fec5b8e81c976b8b0cdf45b459f7d481222e86d7)
2021-03-24 13:48:28 +00:00
Shawn Rutledge
84f0b4df0e xcb: use QXcbScrollingDevice for a touchpad
When using XQuartz on macOS, the virtual pointer device is detected as
a touchpad, not a mouse; but QXcbConnection::xi2HandleScrollEvent()
expects the device to be an instance of QXcbScrollingDevice for storage
of some state. A touchpad that has the scrolling capability must be
that type, not a plain QPointingDevice.

Fixes: QTBUG-91402
Change-Id: I1b82766d4a3f87f656e56c0d8904def26fb0979a
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit f85e70c569f4aa979004889d20de8acec9a790bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-24 12:12:29 +00:00
Edward Welbourne
434c2a6be6 Restore support for reading /etc/timezone for system zone name
This restores one of the two mechanisms removed in
commit b0383cbd388336f698ceeac11a4f50cdff931dd9,
transformed to fit in with the new cached system-zone determination.

Fixes: QTBUG-87326
Change-Id: Ic270acb0d958e17dbc74a0ff93a5a1843c939678
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 824d963700a91294ba4a543ebb486aedbd650284)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-23 15:28:49 +00:00
hjk
e94daf91e0 Make it even more obvious on what to do when tst_toolsupport fails
Triggered by 6778b247.

Change-Id: Ic8e7136cd82eb8d3891450cfa8994f43b7cc09fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8403fc7796aca7b6f45a88ecaef6485f731dc431)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-23 08:14:49 +00:00
Craig Scott
c5859822eb Add plugins to Qt tools and executables for static builds
In static builds, we cannot allow any part of the main build to make a
call to find_package(Qt6...) where such a call may load a
Qt6*Plugins.cmake file. That would add additional dependencies to the
main module targets, setting up a circular dependency in the set of
*Config.cmake files which cannot be resolved. This scenario would be
triggered by per-repo builds or user projects.

But Qt's tools and other executables still need to load some plugins
in static builds. Sometimes a platform plugin may be enough, other
times we may want all supportable plugins (e.g. Qt Designer).
Therefore, add all plugins we can identify as relevant for an
executable that is part of the Qt build, but add them directly to the
executable without affecting the linking relationships between the
main module libraries.

Also remove the now unnecessary check for QT_BUILD_PROJECT_NAME in
top level builds because there should be no difference between per-repo
and top level builds any more (as far as linking static plugins is
concerned).

Examples that build as part of the main build will still build
successfully after this change, but they will not run if they require
a platform plugin. Examples need to be moved out to a separate build
where they can call find_package(Qt6) without QT_NO_CREATE_TARGETS
set to TRUE to be runnable (see QTBUG-90820).

Fixes: QTBUG-91915
Change-Id: I8088baddb54e394ca111b103313596d6743570ba
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5807e1ae8168a5702ad0f6890d2b35223cfebdee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-23 04:30:19 +00:00
Zhang Yu
466177c911 Fix invalid pointer return with QGridLayout::itemAt(-1)
QGridLayout::takeAt() and QLayoutItem *itemAt() only check the upper bound.
If the index < 0, these function will return invalid pointer.

Fixes: QTBUG-91261
Change-Id: Idfb9fb6228b9707f817353b04974da16205a835c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit c47bb4478a4c3a29c0505d7d89755f40601b326f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-23 00:51:53 +00:00
Fabian Kosmale
fa444f9286 QProperty: markDirty should be internal
Change-Id: If69a6f37c32ce0d7f824794a2a1c52bad82d84cc
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-03-22 22:46:46 +01:00
Allan Sandfeld Jensen
80de7801ce Fix alpha handling of QImage::setPixel
It was treated differently depending on format, made it consistently
behave the same for all formats (following the behavior of the primary
formats).

Change-Id: Ie24e19957d076fdf3ebd333074e26ede187489eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c32cd44d34910cfd42e32537578e4a573138a282)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-22 19:26:02 +00:00
Laszlo Agocs
dda9a844f5 rhi: Make unreleased resource warnings available in release builds
...but tie to an environment variable still.

When destroying a QRhi object, it has the ability to print warnings for
each QRhiResource that got created from the QRhi and is still alive.
This includes only QRhiResources that own native objects underneath.

It can be handy to enable this in release builds as well. Therefore,
make this possible by setting QT_RHI_LEAK_CHECK=1. In debug builds this
continues to be always on.

Change-Id: I5283676594284fadf2adf4f123b4fc6adb6db1f7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 8a0dd6191123bc7ec7ea8707908884bc3bfd33b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-22 12:08:56 +00:00
Craig Scott
cade43c87c Remove unnecessary $<BOOL:...> generator expression
The $<NOT:...> genex already guarantees to return a value of 0 or 1,
so there's no need to wrap it with $<BOOL:...>.

Change-Id: Iff4ad64ed8deaa846e1b5bc22d2e5d9dbcd77cc7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit df121fd7f74ecfb3de20867edea1c1f3ebf035c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-22 03:05:28 +00:00
Fabian Kosmale
25fe2c1f29 tst_bench_qmetaobject: Fix test
The code has apparently been broken for quite a while, probably since
the change that made the QObject constructor invokable.

Fixes: QTBUG-91710
Change-Id: I8b7e6c8a579913b3d0e2a364ffdbffe8d404c72b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ed3df88846d3d92baf7110063cc7b82b7c45d1ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-21 17:30:28 +00:00
Andy Shaw
fe7bf854f8 macOS: Don't draw scrollbar handle when there is no range
If the minimum and maximum is set to be the same then we should not
draw the handle. An empty groove should be shown instead.

Change-Id: Ie79f55cd761f9a8f614967c40c23a7f59e700a0f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aac33296e618e617ab9e05b3c71682a13f2d5dfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-20 10:23:55 +00:00
Alexandru Croitor
eb21e8f7d9 CMake: Get rid of the Core_versiontagging object library
We don't currently handle object libraries when creating prl files for
static Qt builds, so it's best to compile files as part of the main
Core target.

Use source file COMPILE_OPTIONS to add the -fno-lto flag to the
global/qversiontagging.cpp source file.

Amends 2d4a40f93fd3f0fd31110ef7d19a12fc56c00967

Change-Id: Iac1d37ecb4caa7c9889d44b3a103a9bdafec49f3
Reviewed-by: Christophe Giboudeaux <christophe@krop.fr>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d68486547aaf05994f39786f8527bcb454c6db3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 22:56:00 +00:00
Volker Hilsheimer
7b9fc295ee Consistently check for nullptr in QGraphicsTextItem::inputMethodQuery
If dd->control is nullptr, then it's nullptr all the way, so don't
dereference it in the calls to dd->controlOffset.

Fixes static analyzer warning 9c33d9bc9b8cf438dccb63aa52afcbe0.

Change-Id: I7a61b6438422373678d4fcb66255b750c550724d
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7edf0fbb9e8cca2e2f2695a1b5dc7a0a143bc211)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 15:46:26 +00:00
Laszlo Agocs
f4110ab1e2 rhi: Make it possible to clone a QRhiRenderPassDescriptor
Task-number: QTBUG-91888
Change-Id: Ib6d2e639e6c24f3e9a733c6563dc8a6d6da47719
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 19384f2e8f50bad0a0775f7b2e10aff3372bcbb5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 13:05:46 +00:00
Wang Yu
67bb730beb QContiguousCache: Remove redundant condition
The reverse condition was already checked three lines before.

Change-Id: I2f78262004871ec2f3730e2a25f26fe22636cde7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 852b070529d2721d2d4e1e7ec1c90d8fe536b088)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 09:28:32 +00:00
Eirik Aavitsland
a441548f42 Update bundled libjpeg-turbo to version 2.0.6
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.6

Change-Id: I3e308d241853edf3c1d616955cda203220a258d8
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ede0082f861146d441df641d93f815dbe63a9076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 05:40:15 +00:00
Eirik Aavitsland
6568c10b9e Avoid undefined color values in corrupt xpm image
Issue reported by Codechecker.

Change-Id: I1a5aa2203fb31e0ce3b630a11e450925aee81fb0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f651e6a26cb59f7b7c7671cded8a10b9f98f5c71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-19 05:40:06 +00:00
Robert Löhning
6deafd6004 QAsn1Element: Avoid overflow in QAsn1Element::toInteger
Fixes oss-fuzz issue 29534.

Change-Id: I51d0b8238c73e5860c40d3b74577ddb8926647a3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 11a3eab1e168256778c45090b56e998e50c08c55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-18 21:04:58 +00:00
Volker Hilsheimer
47a7a595c3 Don't combine enum values from different enum types
Address static analyzer warning dceb66e05690ed1fb2f1455a9eb517f6.

C++20 is deprecating arithmetic operations between unrelated enumeration
types, and not all of the enums involved here are clearly bitmasks.

Change-Id: I61c9dcdc42ccd2b01a6208e067d216107672cc4d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 20639d565bf26b01d915db2e42daedf3f905f399)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-18 13:53:04 +00:00
Shawn Rutledge
c20ad7f101 openssl: fix the build on Linux
qtbase/src/network/ssl/qtls_openssl.cpp:1527:34: error: ‘qScopeGuard’ was not declared in this scope
qtbase/src/network/ssl/qtlsbackend_openssl.cpp:227:9: error: ‘QDirIterator’ was not declared in this scope; did you mean ‘QSetIterator’?
qtbase/src/network/ssl/qtlsbackend_openssl.cpp: In function ‘QList<QSslCertificate> QTlsPrivate::systemCaCertificates()’:
qtbase/src/network/ssl/qtlsbackend_openssl.cpp:387:10: error: aggregate ‘QDir currentDir’ has incomplete type and cannot be defined
tbase/src/network/ssl/qtlsbackend_openssl.cpp:414:13: error: ‘QDirIterator’ was not declared in this scope; did you mean ‘QSetIterator’?
qtbase/src/network/ssl/qtlsbackend_openssl.cpp:415:20: error: ‘it’ was not declared in this scope; did you mean ‘Qt’?
qtbase/src/network/ssl/qtls_openssl.cpp:1527:34: error: ‘qScopeGuard’ was not declared in this scope
qtbase/src/network/ssl/qtlsbackend_openssl.cpp:229:45: error: variable ‘QDirIterator iterator’ has initializer but incomplete type

Change-Id: Ibcf4c7731b04f3f4be59d95130e088114f1536df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-03-18 10:20:37 +01:00
Craig Scott
f058e494c2 Prevent static plugin triggering autogen dependency on reconfigure
A call to file(WRITE) will unconditionally update the file's timestamp
even if the file's contents don't change. The *Plugin.cpp file was
being written using configure_file() which avoids that, but the .cpp.in
file it was configuring from was being written out using file(WRITE)
every time CMake ran. Autogen saw that file as a dependency and then
regenerated the mocs_compilation.cpp file, which in turn results in
unnecessary rebuilds and relinking when nothing is actually changing.

The file(WRITE) - configure_file() dance is no longer needed anyway,
since the generated *Plugin.cpp file is very simple with no
substitutions required. Therefore, we can simplify that file's
generation with a single file(WRITE) that only executes if the file
contents will change or the file is missing.

Change-Id: I2b7d1ff678b85ea7811969d656555592c9b6865f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 63a0d263cf233ddf85a60678829298b50e8d1f26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-18 06:17:07 +00:00
Volker Hilsheimer
4cefb50137 Port away from deprecated QVariant::type
Use QMetaType instead to silence compiler warnings.

Change-Id: Ic28b3406ddcd51935f42779e7708ea8a459d3a9e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5c396be4e3995f8eed2cb54341f3099c35458fa9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-17 21:28:41 +00:00
Timur Pocheptsov
c91ec114b1 Fix qnetworkreply's benchmark
Remove the include of qsslsocket_openssl_p.h, it does not exist anymore.

Change-Id: I5fc0a06fb381204855634b42f43deb02662746b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-17 16:33:24 +01:00
Robert Löhning
a131f01b06 Fix compiler warnings in 32-bit builds
comparison of integers of different signs: 'unsigned int'
and 'qsizetype' (aka 'int') [-Wsign-compare]

Change-Id: Ia27f79ab4abca8b757b65ef5f1d30151842088fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit bc5fecf948f0038032d575d640ad4428ffbe89fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-17 11:52:51 +00:00
Timur Pocheptsov
1a7faeef94 Suppress warning (MSVC, C4250)
This design decision was intentional and reflects the fact that we
cannot have inheritance tree 'linear' as before, since the base
interface is an abstract class without any data-members.
Also, fix a warning about size_t -> int implicit conversion.

Pick-to: dev
Fixes: QTBUG-91866
Change-Id: Icbc73c22d8adf72bbd8949125d4404ea6da69c6d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-17 10:02:03 +01:00
Assam Boudjelthia
583776b0d5 CMake: make sure to collect Android dependencies for plugins
androiddeployqt relies on *-android-dependencies.xml files to know
what dependencies like jar files and permissions a Qt module requires.
CMake create those files under Qt prefix's lib dir but CMake was not
accounting for module plugins.

Fixes: QTBUG-90812
Change-Id: Ib3b2e2bb237159b4851ac0f23dc75f8e56af3f7a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d6367aca869ee30e15a3861b2990baafb9972aa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-17 01:09:02 +00:00
Sona Kurazyan
b106568ec1 Mention QPromise in the QFuture docs
Change-Id: I5f6930116da534dd1dea41c4724c42104de38877
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0477f6b15a2d71d47c39e52b5da140d19aa76f31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-16 17:04:11 +00:00
Timur Pocheptsov
31cc0df760 Stop using QSslConfigurationPrivate inside the plugin code
It was reasonable while backends were a part of QtNetwork.
Now if moving them outside (or just trying to implement
a new backend as a plugin), accessing data-members of
QSslConfigurationPrivate means that any plugin knows
about memory layout actual only for the version of Qt
it was built with/for. Instead, we have to use the
public class. Since it does not have all needed setters
and some data-members have no access at all, we
provide an API in QTlsBackend (which stays a part
of QtNetwork) that knows the actual memory layout.

Task-number: QTBUG-65922
Pick-to: dev
Change-Id: I5ca1de4f982b4b11d9a87c4b40413367dcb83c16
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-03-16 13:41:08 +01:00
Timur Pocheptsov
9391ba5514 Convert QSslSocket(Backend)Private into plugin
All backend-specific code is now separated and removed
from QSslSocket(Private) code. The original code is mostly
preserved to avoid (as much as possible) regressions (and
to simplify code-review).

Pick-to: dev
Fixes: QTBUG-91173
Task-number: QTBUG-65922
Change-Id: I3ac4ba35d952162c8d6dc62d747cbd62dca0ef78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-16 10:41:37 +01:00
Laszlo Agocs
6d3115425c rhi: metal: Stop using BufferOp for no good reason
Do what the Vulkan backend does, and just take the offset
and the QRhiBufferData. There is no reason to store a full
QRhiResourceUpdateBatchPrivate::BufferOp struct within the
backend.

Change-Id: I67528029de40320b3e4f031346d40dfc0bb9ab52
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit adf6ba7eaeba97fb2561394e52ee265d94e1c6e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-15 12:14:43 +00:00
Laszlo Agocs
3467fd99fd rhi: metal: Skip unnecessary writes when updating the entire buffer
Follow the similar Vulkan change in 20eb40bce92c3e5460cd2540547f3c404fe6dccc
and drop the queued up buffer data for a given slot when the current update
covers the entire buffer. This is relevant in particular for Qt Quick 3D
where such dynamic buffer changes are common.

Change-Id: If1e70d78968586b552a5357bc97af10cc61d9611
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 0c6375a346551dbf2effb2ea54e1df7de56f0849)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-15 12:14:42 +00:00
Laszlo Agocs
49c5851054 QOpenGLTexture: Fix typo in enum value
Fixes: QTBUG-91431
Change-Id: I59c37de527f53339130216997402f325d0badb12
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 2cfbce4bc61fd1f450f221e6ce733753f6cabb0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-15 12:14:40 +00:00
Fabian Kosmale
3858d1e913 Fix QMetaType benchmark
The benchmark used to crash because QMetaType::typeName would return an
empty string, which is not a legal value for newRow.

Change-Id: I9e6c6c1cf153943bfa21181cd2cca596a7943ea0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 1316af2f3ed7861d0955793261a18f8ebf237f6f)
Fixes: QTBUG-91711
2021-03-15 08:33:58 +00:00
Thiago Macieira
0f7d433d6d QRandomGenerator: remove dead code previously used by qrand()
Commit 9ee554ac1d1af97e7ad5b4bf78e2779f7d1c405f removed qrand() and
qsrand(), so commit 81896304dc1fb65da3302deb54ab4cfe060625ff removed the
functions accessing QRandEngine, but forgot to remove the actual engine.

Change-Id: I26b8286f61534f88b649fffd166c41aecf55d2b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 420755edb71267f756df4c61955b910099ec9537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-15 05:14:45 +00:00
Andrei Golubev
3c224d1122 Fix QMultiHash::count(key) crash
As QMultiHash uses a pointer for the data, nullptr dereference is a
thing, so check for valid d before doing anything in count()

Fixes: QTBUG-91704
Change-Id: Ia20440cd7bdc03cb09c77f796fb9c5b52765eac5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f226854d256a382a5cc7ff08b10a0d27fbefb0fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-14 20:34:04 +00:00
Alexandru Croitor
0680c87856 Bump Apple platform minimum versions
Includes both minimum deployment targets and minimum sdk
versions.

As per supported Apple platforms versions which was done
in qt/qtdoc at
8807fdedce29cbbd7662fcd745234da30eace3fb

For Qt for iOS 6.0.x we only bump the minimum
deloyment target because applications seem to crash with iOS 12.4+,
and it's better to have a build error than a runtime error.

The minimum required sdk will not be bumped for 6.0.x, so we don't
accidentally break someone's existing build, given that 6.0 is already
released.

Task-number: QTCREATORBUG-23574
Change-Id: I3046384164f2d7fdbd0cfd16dcb85e0d60bc56ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4b2035cd0f9a7c289c7a9e470fde83dae9351092)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-12 14:43:31 +00:00
Craig Scott
e2a11171ab qtdeclarative now directly handles more qml-specific logic
Associated changes in the qtdeclarative repo now ensure that arguments
for qml plugins are handled on the calling side. This reduces the
qml-specific logic needed in qtbase and gives qtdeclarative clearer
control over qml build and install locations.

As part of that work, the INSTALL_LOCATION keyword used in
qt_internal_record_rcc_object_files() has been renamed to
INSTALL_DIRECTORY to make it consistent with the keyword used for the
same concept in other commands.

Change-Id: Iebd319899f63d79fbe15ce965b84ce324c28a508
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 78a64e310efc9f3e91bda855fa8275caf10bea4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-12 10:17:24 +00:00
Paul Wicking
47056c3b23 Doc: Add hyperlink to relevant section
Fixes: QTBUG-91734
Change-Id: I3910c7fcf1625ad08a65e691a8eaf9ed6b61779a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b42df9756a8d72cbdfbf72f15e98385b35148eb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-12 08:00:56 +00:00
Paul Wicking
6db4495929 Doc: Change section titles that cause bad links
Section titles are valid targets for QDoc's autolinker. When
they are identical to other valid link targets, such as for
example a class, these sections may cause invalid links.

Fixes: QTBUG-91141
Change-Id: Ie9a6258d2bf83932335976d8c0b5fc59f2028ae5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 5fa8f5df7bb722c5b7451229f5eecd13bd13326f)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-03-12 06:37:10 +01:00
Volker Hilsheimer
42f364c494 Revert "QPushButton: fix support of style sheet rule for text alignment"
This reverts commit 6269438af95bbd988ead08829fa3bc9dc25891e8, and adds a test.

This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The
code already interprets the textAlignment values from the rule, also if no
icon is set. Adding the same, or some default textAlignment to the text flags
if there is no icon doesn't work.

Fixes: QTBUG-91735
Task-number: QTBUG-86857
Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 674747bac1c8b57d4940de2ee68b6b562dfcad61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-11 23:35:52 +00:00
Robert Löhning
cc6f0a6c35 Limit value in setFontSizeFromValue()
Avoids overflows in QFreetypeFace::computeSize and
QFontEngineBox::boundingBox

Fixes oss-fuzz issue 30290

Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 976fede67ca4a4d322bc8d2c00266a2e2f1a6e3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-11 21:14:21 +00:00
Mårten Nordheim
ba0a105c61 QEventDispatcher(Win): Always honor interrupted status to avoid races
There may be a race where e.g. thread 'B' is woken up by a queued invoke.
At the same time thread 'A' asks 'B' to quit, which will set various
atomics (some important ones are 'interrupt' in the dispatcher and
'exit' in the event loop), but it does _not_ try to send another wake
since there is already an unhandled wake triggered by 'B' itself.
Sadly 'B' reads the 'exit' atomic before 'A' updates it.
Then, slightly before, 'B' sets 'interrupt' back to 0, 'A' write 1 to
it, meaning 'A's interrupt is ignored. Then, since there is no
interrupt, 'B' goes back to waiting for events, leaving the thread alive
and running instead of quitting.

Maybe this has unforeseen consequences (one consequence is that it will
return and re-enter the event dispatcher once more, possible
unnecessarily)

Fixes: QTBUG-91539
Change-Id: Ie6f861f42ffddf4817d5c8af2d764abe9d9103c2
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f274f91cebb0a4fd2ebe37bb3a605c47d6acd404)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-11 14:13:50 +00:00
Assam Boudjelthia
a1b83c3dd8 Android: use libexec path for rcc for Android deployment settings file
Task-number: QTBUG-88791
Change-Id: Ie34278496e0c23a8301e7ab0f2e33e36f393d1d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 15c2a79f19bdc3f0c0700aab1077950c2f99cf25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-11 11:13:17 +00:00
Fabian Kosmale
7dfe36a9a0 tst_qguivariant benchmark: Only use valid QMetaTypes
Otherewise, we hit an assertion because the name is empty.

Fixes: QTBUG-91709
Change-Id: I03a530d64ea8dead3efc5fcb8c00909388a387d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3e46c22d943233554be8897ddda191cdfdb5e44e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 20:04:31 +00:00
Fabian Kosmale
6498e6f76d tst_bench_qguimetatype: only consider valid metatypes
Otherwise the benchmark crashes as the data tag for the row would be
empty.

Fixes: QTBUG-91708
Change-Id: I484ded5b8670571b80012e64d67846d3b8db5320
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 90dc1f9204b8f44302b57392ba2fbfdc3653bdf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 20:04:30 +00:00
Laszlo Agocs
0a7463715a rhi: metal: Avoid unused argument warning on iOS
Change-Id: I4cb729f3d8dbe7703b89153b742ce2874f35cfd2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit dd7087342dc73ee7adf7b24fc96f79d9d1056682)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 17:32:53 +00:00
Laszlo Agocs
ae1869ab63 rhi: metal: Use the layer as the single source of truth
...when it comes to the output size.

This mirrors what all other backends do. For example, with Vulkan
the only source of size is the surface (VkSurfaceKHR), never the
QWindow, even though we'd expect that the surface size equals
to window_size * dpr, and that's almost always true, but there
are exceptions. (e.g. we have seen bugs on Windows with some drivers
in high DPI situations where the Vulkan surface did not fully match
the window size, yet it is the surface, and only the surface, that
matters for rendering, i.e. viewports and such must match the surface,
not the native window)

With Metal we hit a similar problem on iOS: the QWindow's size*dpr
and what we calculate from the CAMetalLayer have a height difference
of 1.

Mitigate this by making QRhiSwapChain::surfacePixelSize() and the
calculation for currentPixelSize() done via the same route (the
CAMetalLayer). Otherwise, if there is a mismatch between what the
QWindow and the layer says, Qt Quick will think that there is a
resize happening (has happened) whenever starting a new frame, and that
has far reaching consequences (suboptimal performance, increased
memory usage by buffers, etc.)

Change-Id: I114df92bf35622c99f2747420fdce401db7705a6
Fixes: QTBUG-91438
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 83fb8fe208ec816df7d04c8247d5696d95f2cab1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 17:32:44 +00:00
Laszlo Agocs
0b490df50f rhi: gl: Fix missing uniform data with certain command lists
Following patterns from the other backends is insufficient with OpenGL
because we do not use real uniform buffers. There is currently a
possibility that a shader program will be bound without following it
with setting uniforms. Correct this by having a second level of tracking
of the associated srb object in the pipelines.

Fixes: QTBUG-91630
Change-Id: I74a012daade826dd22c436bde06381c1233bad11
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 80029e0ca65d4bf4575f7a08d186c781ec6c2f0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 09:07:23 +00:00
Craig Scott
58ac65008e Make qt_get_module_for_plugin() internal and do what its name says
Contrary to its name, this command was also setting a target property.
Since it was only called in one place and that caller can just as
easily set the property instead, rename the command to make clear its
internal nature and refactor it so that the caller is responsible for
setting that property instead.

Also make it an error rather than just a warning if the command is used
for a target that doesn't belong to any module. Since this is now
unambiguously an internal command, we should always expect the target
to belong to a module.

Change-Id: I929a652ddd482653868fc9df887f38f4bc7f35d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c6bbca748659468b99002ec4b71559c65963b950)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-10 00:15:36 +00:00
David Faure
32d00fdfb3 QConcatenateTablesProxyModel: skip dataChanged in hidden columns
When the source models don't have the same number of columns, the proxy
keeps only the smallest number of columns across all source models.
Afterwards, if a source model emits dataChanged in a column past
that number (a "hidden" column), the proxy needs to ignore it rather than
assert.
But also, if the source model emits a dataChanged signal across both
visible and hidden columns, then the last column number needs to be
adjusted so that the signal is correctly processed and forwarded.

Task-number: QTBUG-91253
Change-Id: I939e8ec0faf41370472f86785851292e4372f72c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit f6efbd23b59bcf75866ce47fb762c99f2e4a128a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-09 21:16:45 +00:00
Joerg Bornemann
ebd4d0cbf4 configure: Fix error when turning on/off non-emitted features
Features that are not emitted in the current
configuration (e.g. plugin-manifests on Linux) should not yield an
error. Instead, print a warning message like Qt5's configure did.

Set insignificant feature to OFF.

Remove the now unneeded emit_if parameter from
qt_feature_set_cache_value.

Fixes: QTBUG-88305
Change-Id: I0f2ce152fca5f08417038c9bd2c07639ff6a3df4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-09 18:21:32 +00:00
Joerg Bornemann
e591f14117 Move syncqt.pl to libexec
To not disturb the qmake build we kept syncqt.pl in <src>/bin but
installed it to libexec. This is not necessary anymore.

This also removes the need for having syncqt.pl in both, bin and libexec
in the build dir of qtbase.

Fixes: QTBUG-91076
Change-Id: I44b014ea41e3f00c420e02fd5c76f11169340b8c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 800f7451406d58910568854deb4dbebbca0ee6d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-09 12:16:08 +00:00
Jan Grulich
4581f14ffd FileChooser portal: send window id in hex
We send window id in decimal, however, it is expected to be send in hex.
This causes a mismatch and makes portal dialog to show in background.

Change-Id: Ibd77199bbb4a2ad4782a0457ddc5506c6b5608fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit acaabc9108dfe75530960cf8e3ec4f3602cd82e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-08 21:06:15 +00:00
Qiang Li
13cb272a70 Fix the crashes when animated QTreeWidgetItems are hidden
QTreeView's drawTree implementation performs lazy layouting
when calling itemDecorationAt. If animations are enabled,
this can change the list of items, and invalidate the copy
made earlier.

Don't copy the list of items, use a reference instead so that
code iterating over the items later operates on valid data.

Add an assert in the private itemHeight method, it must not
be called with an index that is out of bounds.

Fixes: QTBUG-42469
Change-Id: Ifdb782881447912e00baffd1c407de10a1d8d0d4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f140ef04a0c54c2c8a699db33433b8d7235d137c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-08 14:39:10 +00:00
Morten Johan Sørvig
667d0eb3c5 High-DPI: Set the minimum scale factor to 1
Avoid painting errors with dpr < 1, also for the PassThrough
mode.

This limits the minimum high-dpi scale factor to 1,
for the code path which determines the scale factor
based on screen DPI.

Task-number: QTBUG-89948
Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ee409e6f0cab4aa051f75f7c7116d4b607d137fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-08 10:47:53 +00:00
Toni Saario
93f46f303e Doc Build: Do not fail if CMakeCache.txt does not exist
If we skip module build the CMakeCache.txt does not exist.

Change-Id: Ic44bddf29f1eef1e6ffc568c871d9d7e7de71f48
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 22d692e9e01bcf486e2b268059c30998ca8b06bc)
2021-03-07 16:56:22 +00:00
Toni Saario
4f923348f5 Allow disabling module build and building of tests per module
This patch enables per module control of the build instructions.
This enables documentation building in modules that are not capable
of building the module itself on linux.

Change-Id: I72b7931c5ffda9bf437a99c27c0bb340665ce927
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 6172f3101e6606d48cca8424c5472af1daeefc17)
2021-03-07 16:56:20 +00:00
Toni Saario
9c0ba50658 Skip globalstatic threadStressTest on QEMU
The test causes frequent failures in the CI. This is the most
subtle fix until it is properly fixed.

Task-number: QTBUG-91423
Change-Id: I6499378dcd3ed1c31275db38d83b572e764366cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit 49e93b6e3928e12507ec7956d66e79a2555c13a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-07 16:56:12 +00:00
Øystein Heskestad
03332d8a00 Make qdecompresshelper archive bomb check only trigger for large files
This is to avoid false positives.
By default files are large if uncompressed size > 10 MB. Only configurable internally.
Also add auto tests.

Task-number: QTBUG-91392
Change-Id: I32258cb7c957f2a23a05157ba4ed5c0af2ba585e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit be73ca7eb1cebcc15064666e647bc337b5c2baa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-07 07:56:21 +00:00
Andreas Buhr
218b7c8a5b Add documentation for Q_OBJECT_BINDABLE_PROPERTY
The duo Q_OBJECT_BINDABLE_PROPERTY and QObjectBindableProperty
can only be documented together. The documentation is now with
QObjectBindableProperty. This patch adds a documentation entry
for Q_OBJECT_BINDABLE_PROPERTY which links the user to
QObjectBindableProperty.

Task-number: QTBUG-90511
Change-Id: I9af4a99d49f4b02ee9645a2cc9a9a024a6a1a552
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 89cc39a894dddaa0347ecf08438ea31b4880961c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-07 07:56:13 +00:00
Joerg Bornemann
542f2036e7 Fix QT_HOST_LIBEXECS for cross-builds on Windows
Like for LibraryExecutables, we must default to "bin" on Windows for
HostLibraryExecutables in our generated qconfig.cpp.

Fixes: QTBUG-91496
Change-Id: Ib5a4b3b3fd6192bd953e615058b482e67ad19462
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 4b9173e3540bd5a80b98be2f41832ae877c2cd1d)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-07 08:56:03 +01:00
Joerg Bornemann
5618d51272 Complete the renaming of qt_add_tool to qt_internal_add_tool
Fix the name in the function's doc comment and error messages.

Change-Id: I918db802a0dbb0508f65d227f7c896d2ad0beeae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 728baba70a389dd13411819a4ec5db6004fb1e97)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-07 08:55:57 +01:00
Joerg Bornemann
94f28c2ed0 Generate information about user-facing applications in build dir
When packaging different Qt versions for Linux distributions (or any
distribution with a common bin dir), Qt tools cannot be installed to
/usr/bin, because the executable names of the different Qt versions
clash.

To solve this conflict, our recommendation is to install Qt's tools to
/usr/lib/qt6/bin and to create versioned symlinks to user-facing tools
in /usr/bin.

User-facing tools are tools that are supposed to be started manually by
the user. They are marked in Qt's build system. Distro package
maintainers can now configure with
  -DCMAKE_INSTALL_PREFIX=/usr
  -DINSTALL_BINDIR=/usr/lib/qt6/bin
  -DINSTALL_PUBLICBINDIR=/usr/bin
and will find a file called user_facing_tool_links.txt in the build
directory after the cmake run. Nothing will be installed to
INSTALL_PUBLICBINDIR.

Each line of user_facing_tool_links.txt consists of the installation
path of a user-facing application followed by a space and the versioned
link name in INSTALL_PUBLICBINDIR.

Example content:
/usr/lib/qt6/bin/qmake /usr/bin/qmake6

To actually create the versioned symlinks, the content of this file can
be fed to ln like this:
  xargs ln -s < build-dir/user_facing_tool_links.txt

Or the package maintainer may decide to do something completely
different as suits their needs.

This patch adds the USER_FACING argument to qt_internal_add_tool to mark
tools as user-facing. In addition, every Qt created by
qt_internal_add_app is treated as user-facing.

The only tool this patch marks as user-facing in qtbase is qmake.

Fixes: QTBUG-89170
Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit b1ad7f938e2f71288e65a8c9a86b732b89a6a345)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-07 08:55:52 +01:00
Thiago Macieira
82f4c5ebe5 QNetworkInterface/Unix: fix DNS eligibility of global addresses
[ChangeLog][QtNetwork][QNetworkInterface] Fixed the reporting the "DNS
eligibility" factor (QNetworkAddressEntry::dnsEligibility) for global IP
addresses. Previously, QNetworkInterface interface erroneously reported
all global addresses as eligible, regardless of whether they had already
been deprecated by the OS or were temporary in the first place.

From the tst_QNetworkInterface::dump output (netmask & broadcast
suppressed for readability, IPv6 prefixes changed to protect the
innocent, but the local part is exactly as found on my system):

   address  0: 192.168.26.33/24  dns-eligible preferred:33546998ms valid:33546998ms
   address  1: 2001:db8::800/128  dns-eligible preferred:264817000ms valid:264817000ms
   address  2: fd00::800/128  dns-eligible preferred:forever valid:forever
   address  3: 2001:db8::2f5b:342c:fc53:b9b2/64  dns-ineligible preferred:12422000ms valid:264817000ms
   address  4: fd00::9351:adff:333d:5c8d/64  dns-ineligible preferred:12421999ms valid:531402999ms
   address  5: fd00::7297:9516:fbb4:17ac/64  dns-ineligible preferred:0ms valid:445585999ms
   address  6: fd00::fdc8:e620:691:3b44/64  dns-eligible preferred:forever valid:forever
   address  7: 2001:db8::ae82:a01:5a8a:e210/64  dns-ineligible preferred:0ms valid:264816999ms
   address  8: 2001:db8::c673:e0a2:8927:2118/64  dns-eligible preferred:264816999ms valid:264816999ms
   address  9: fe80::bd89:b998:4aeb:a5d0%bond0/64  dns-ineligible preferred:forever valid:forever

Prior to this commit, only address 9 was showing as ineligible.

Addresses 1 and 2 come from DHCPv6 and are thus always eligible.
Addresses 3, 4, 5, and 7 are temporary addresses added on account of
RFC 4941 and are therefore ineligible (they have the IFA_F_TEMPORARY
flag set). Note how 5 and 7 have also stopped being preferred. Address 3
is the one I see when I go to ip6.me and address 4 is the one used to
reach the router.

Addresses 6, 8, and 9 are the "permanent" addresses that would normally
be based on the MAC address of the interface, but are actually in
"stable privacy" mode for me (RFC 8064). Address 9 is the link-local
one, which makes it ineligible, leaving the other two stable addresses
eligible.

Addresses 1, 3, 7, and 8 are global, from a DHCPv6-PD delegation from my
ISP, which is why they have finite lifetime. Addresses 2, 4, 5, and 6
are from my local Unique Local Address (ULA) prefix, which is why 2 and
6 are valid forever.

Change-Id: If8b43dc9678c4b4ba9c1fffd1668fdcae873c6bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 83876c025674eba9c932c108d355ba40e7789546)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-07 01:58:38 +00:00
Sona Kurazyan
4387b9ffea Improve docs for Qt Concurrent run with promise mode
For the readers that are new to QtConcurrent, it may be confusing that
unlike the normal usage of QPromise, they don't have to call start() or
finish() when using Qt Concurrent run with promise mode. Be more
explicit about that.

Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit fcc453df5cd03a24dad3328d930cc3ef2a1b05ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 22:36:21 +00:00
Timur Pocheptsov
e4efa00c72 Fix a BIC introduced by extending the namespace QSsl in _p.h files
Renamed the private part of the namespace to QTlsPrivate.

Pick-to: dev
Fixes: QTBUG-91531
Change-Id: Id2d9c458d8d958b35e437eee42889177dad0a7a7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-05 19:35:23 +01:00
Paul Wicking
d23cd35e45 Doc: Fix section titles that confuse QDoc's autolinker
Fixes: QTBUG-91620
Change-Id: I7c407c7158324d1fbbeb78e47d2198e8ddf5daa0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c1c61c3bb468b9db7b3bf1ca49e8b71a146ff780)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 15:35:36 +00:00
Wang Yicun
bb1070e17a Simplify code, remove redundant condition
'clazz || (!clazz && isCached)' is equivalent to
'clazz || isCached'

Done-with: Tang Peng <tangpeng@uniontech.com>
Change-Id: Ie9eab4a94a61be2b360f64980c4666a622f3a209
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a913002f13d8a2faad512ffda6c70f413b8e7ee5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 15:35:35 +00:00
Volker Hilsheimer
d12df462c3 Protect against self-assignment, plug potential memory leak
Fixes static analyzer warning f03d95823e9f1395d64501cc111f0f63

As a drive-by, plug the potential memory leak if the assigned-to
QDockAreaLayoutItem already holds a QDockAreaLayoutInfo object.
The subinfo is deleted in the destructor, QDockAreaLayoutItem
has ownership for the subinfo.

Change-Id: I8546adc6fb0537078eea9dfb45d1bd9967d8d149
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 3ae09debab67eecc48721481b76fa11a9f9a383c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 11:14:19 +00:00
Ville Voutilainen
5a72db7562 Android: make calling exit() conditional on an environment variable
Task-number: QTBUG-82617
Task-number: QTBUG-85449
Task-number: QTBUG-83043
Change-Id: I5ac67b5d57550e5a1f816e5db01f4aab31127283
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6e0ce4ee8005d36ee5d080212b8d83b42ebcae17)
2021-03-05 08:35:10 +00:00
Paul Wicking
634cb4ea7c Doc: Use correct include for QWGLContext
Task-number: QTBUG-91500
Change-Id: If487a2d14dd61d127dc35aa039f9b71915128da1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 15f934dcea2743ceb59d3c9ad840e2b00b39d043)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-03-05 06:55:49 +01:00
Volker Hilsheimer
8b837ad05b QMenu test: turn tooltip animations off
QTBUG_89082_actionTipsHide() is very flaky if tooltips fade in, as the
mouse move might happen while the tooltip is still appearing.

Fixes: QTBUG-91532
Change-Id: I55305927fcf143d99dfff28d0bc70b2e831a139a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d76d8571e2cc9172d2800e4b53f4b6941842dc6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 00:02:51 +00:00
Timur Pocheptsov
6c835796c8 Convert QDtls classes to the new plugin-based design
Essentially, the same code re-shuffled and placed behind
the new interfaces.

Pick-to: dev
Fixes: QTBUG-91174
Task-number: QTBUG-65922
Change-Id: I8f14697f10713f9738c5c7805aed0150c084850c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-04 07:04:45 +01:00
Volker Hilsheimer
dcbaf539ea QLabel: simplify createStandardContextMenu
If control is nullptr in the beginning, then it will be nullptr later as
well, and the function won't do anything. And if the effectiveTextFormat
is Qt::PlainText, then the linkToCopy will be empty, and the function
won't do anything, either.

So we can just handle these cases right away, making the code simplier.

Fixes static analyzer warning 43de3f3125108b4353afd94e94f59926.

Change-Id: I5b8eb94a1e40c2725de6a168298d8f3bcde748eb
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e718818745e6db8df09ea55c4071e116f00851c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:51:13 +00:00
Volker Hilsheimer
8ba766c086 Don't access moved-from object
Clang's static analyzer tooling warns about this access-after-move [1].
While the comment above the function indicated that this was deliberate
and relying on a moved-from QString being valid, it is still bad
practice.

Since 'str' is empty in moved-from state if - and only if - it was a
non-const reference, make a compile-time check of the constness of type
T instead.

[1] https://testresults.qt.io/codechecker/daily_analyses/qtbase/dev/qtbase-dev-20210301-e14ccf0553/qstring.cpp_clang-tidy_b0545db57a2cc5dac67a56f76322ffd0.plist.html#reportHash=209ee3db0b17d21919326a1ad6635318

Change-Id: Iac1813b61b6a3c2ef4053b911a4043c5382f85e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 49113c905d5868e6b76bb6b7b3e0a20b0c56a23a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:50:21 +00:00
Friedemann Kleint
bbdbe26cad Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows, take 2
Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.

Amends ba139603925453bf79994eca48b566d8f15b2af0,
3f3d5e6716d9130776b3613ccbd5595de7d4af8d.

Task-number: QTBUG-89082
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65c6fbea242e150d785ea0a7062188fdc090af32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:50:07 +00:00
Volker Hilsheimer
c72c228717 Add nullptr checks to QGraphicsView classes
The styleInfo parameter defaults to nullptr, and the scene can evidently
be nullptr since we test for it before ungrabbing the mouse.

Fixes static analyzer warnings
fbd03604cc701651595a2ea33c5562b4 and
30fcb05194f3a2d121fc57b05e0ccf10

Change-Id: I8e9d4fe4055115c366ada1cbb22a8f0839ba41da
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 98db99657649d4668c766eaa36b8d29c58d19754)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:49:56 +00:00
Volker Hilsheimer
0f269e2494 QGraphicsWidget: Check for nullptrs in focus chain handling
The while loops terminate if focusAfter becomes nullptr (unless we break
earlier), so don't dereference those pointers without checking first.

Fixes static analzyer warnings 979f2d508db4d5838f6c9b296120ce60 and
481f2ec7b5851bf19414478428f944b7

Change-Id: I60fc5999907fe3b3146d7047ee1eff197719ab31
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 95e34f7fbc0f2e9ca582278f9a772b27ebf93d5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:49:48 +00:00
Volker Hilsheimer
2c42df3034 QGraphicsWidget: don't dereference nullptr
Unlikely that one item is nullptr and the other item doesn't have a
scene, but we do already test for the scene pointer, so don't continue
if it's nullptr.

Fixes static analyzer warning f59576ecf6618447c4f9c7be93fc737f

Change-Id: I6d436bb1211ddd412821d6978bab25192033f5e5
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit d984fd13adf1592646eafa9912bce44ee2158d92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:49:36 +00:00
Volker Hilsheimer
ef34c99077 QMetaType::create: don't leak memory if copy can't be made
QMetaType::construct will return nullptr if a copy is requested but
if there is no copy constructor. In that case, the memory allocated in
QMetaType::create will be leaked.

This case is covered in the unit tests in

template<>
void testCreateHelper<QMetaType::Void>()

so we can't assert in construct that a copy constructor is present if
a copy is requested.

Fixes static analyzer warning 618b1e6877f737df57c39fd35ad91cd4.

Change-Id: Ic439b36b1f120b9d0f888efaeab2801d8acc13de
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 90b51219ddc75c4dd2d171f2dba644e67d1e4a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:49:24 +00:00
Volker Hilsheimer
69951fec45 QHostInfo: simplify assignment operator
The d_ptr is never nullptr. If it could be, then other's d_ptr could
also be nullptr, and we would dereference the null pointer.

Guarding against self-assignment is nevertheless a good practice.

Fixes static analyzer warning
5fc3780532e30c6350a0aa1ad2188a4c.

Change-Id: I07ff808e4c4f5bf07b4d6663f1fb4a3301a0fec7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6e334a85a82f1fedc39f54511a9d1b0c7b512d5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 05:49:15 +00:00
Volker Hilsheimer
5af06405a6 Don't access data in moved-from object
It's undefined behavior, esp since we leave it to the compiler to
implement a move constructor for the ButtonInfo struct. So read the data
that we need first.

Fixes static analyzer warning
de76eedae524c86f89d6369c0f5af8c7.

Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 4daf83a0dc05f944c066237aa95c388f29ce890a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-03 23:35:25 +00:00
Joerg Bornemann
cfe5b1b8dd configurejson2cmake: Add library mapping for libmng
Change-Id: Ic6a45ecf14791cd6e780b7b0cb52c7b7275e968a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 735466ed2bb45c3faeba4cc02f036d4fdf509817)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 14:47:37 +00:00
Timur Pocheptsov
9fc2f1f076 QSsl: fix UB pointer use
Weird macro had inverted notion of type safety: instead of casting
parameters and return values (they are pointers) to work with generic
OPENSSL_sk_xxx functions, it was ... casting a function pointer to an invalid
type to get ... nothing, but UB. Home-brewed (un)'safestack'!!!

Pick-to: dev 5.15
Change-Id: Ib91a7ba4cd472f370836797e422456f91a4385b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-02 15:29:24 +01:00
Allan Sandfeld Jensen
b9992fcf91 Handle desc tags the same way for OOB checks as the other tags
Including one entry of the value in the header is pointless after
the unaligned access rewrite, and a potentially dangerous pattern,
though safe here due to overchecking.

Change-Id: I4c0380040f89920467c309503408f1df6f88423f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 90e9974f1596cb6fd9cf15ddf9e34d15a387bb7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 14:17:14 +00:00
Allan Sandfeld Jensen
c3c76517dd Handle para tags the same way for OOB checks as the other tags
Do not include the first parameter in the main tag anymore. That is
a left over from before unaligned access was added.

Change-Id: I2caf027c6b9930d3e23fe5ec8bdcd45db34835a9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b984689ec881ffb2cf2ee56f98cfaa1e2a4da54a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 09:29:17 +00:00
Timur Pocheptsov
cdf4976b5a Convert elliptic curves and DH params to work with QTlsBackend
The corresponding API is becoming a part of QTlsBackend interface,
since it's too minimalistic and does not require additional
interfaces, unlike certificates or keys.

Pick-to: dev
Fixes: QTBUG-91177
Fixes: QTBUG-91175
Task-number: QTBUG-65922
Change-Id: I44dd0adbdf2427962451998664efe234d59fae24
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-01 17:27:56 +01:00
Allan Sandfeld Jensen
c2e7eaa009 Fix out-of-buffer in ICC curv parsing
After the unaligned ICC profile fix, we could read 2 bytes past the end
of the buffer for curv elements with 0 parameters, though we wouldn't
use or return the data.

Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 840c8b4de2556c22d8b131573a338268dd0107a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-28 19:49:37 +00:00
Volker Hilsheimer
ad8b779cd7 Assert that we have a socketEngine before calling it
If we are connected or bound, then we must have an engine.
Otherwise in code we frequently test for the d->socketEngine pointer,
including in waitForConnected.

Fixes static anlyzer warning 3b37ce4102843c97ceef2b7bb68a409d.

Change-Id: Ib9818282ad2813db97859cbe1f184bcfb5ea4ab4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2af45d0cee253a6bc4e6807076445439cc69c2ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-28 14:21:13 +00:00
Volker Hilsheimer
c286ad4665 QIcon::setIsMask: don't dereference nullptr
QIcon::detach might result in the d pointer being nullptr, and other
code tests for that condition and allocates the d pointer explicitly.

Change the order of the tests in setIsMask as well, fix static analzyer
warning 0a4723ca2d216ec8883a3d412aeded4c.

Change-Id: Idca12f230036362f13cbaee1ae4f0e5ce6726015
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2de7f4f771dc0b903374c213201d5334f1a9316b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-28 14:21:06 +00:00
Volker Hilsheimer
e904f59872 Assert that QWidgetPrivate::create creates a window
Assert the expected side effect of createTLSysExtra, which might not
allocate a window, but must do so in this case (as we have already
returned if the QWidget is not a window).

Fixes static analyzer warning 2f3bbfe8addb586445e96f8906d6769e

Change-Id: I4d5b8651b3510eff8e4a7b25889c0521ba6a4247
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8cc72e0f634f1406a42c74b864914ccdfb3e58f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-28 14:20:55 +00:00
Sona Kurazyan
f89039cbad Improve docs for QFuture::then() with context
Be more precise about attaching a continuation with the default
(QtFuture::Launch::Sync) launch policy after a continuation with
context.

Change-Id: I5b80063df2443e5742033864ba012bf34ed4cdf7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5624b35d6514c5439b9d6dc639dc71228ca7b5ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 08:41:14 +00:00
Sona Kurazyan
d6531d1d14 tst_QFuture::continuationsWithContext: fix the flakiness
When attaching a continuation with the default (QtFuture::Launch::Sync)
policy, it will be launched in the same thread where the parent has
been executing, or in the thread where the parent lives, if the
continuation is attached after the parent has already finished. Fixed
the test-case to make sure the continuations are attached while the
parent is still running, so that they can be resolved in the parent's
context.

Fixes: QTBUG-91373
Change-Id: I82b3b0c47b76d121b44bd512659c08b3b474e351
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5a3bbb55851b84aa6a46c23e5a6fb33b4860edc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 08:41:10 +00:00
Allan Sandfeld Jensen
b74f77bd63 And fix handling and test of QImage::fill(uint) as well
Only RGB444 and RGB666 were treated slighlty different from the rest,
but the test had a few additional mistakes.

Change-Id: I4728b4036affedfffce8bca5c1e7be3869344fbe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c2bec047e281d949015ecd27daf2ba2d51b21526)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 07:36:19 +00:00
Allan Sandfeld Jensen
e8a2ca314b Fix logic problems with table based grayscale ICC profiles
White-point was calculated wrongly and some tables could cause bad
behavior in the tables.

Change-Id: I24e8f5f3cc1306f5f898a4acbf7b008e26bd04e2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit f493d41722fc76a04f699ea26128fdf3d215d913)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 07:36:14 +00:00
Allan Sandfeld Jensen
627bae700f Reduce warnings from ICC parsing
Messages about Qt deficiencies reduced to info, and info set as the
default message level.

Fixes: QTBUG-91401
Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 63152571844a15adfa76db5f8a9e7a505da75412)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 07:36:07 +00:00
Joerg Bornemann
2b809b65c8 Fix qmake's metatype generation feature after moving moc to libexec
This commit amends 1f30bcf33618ca39c47dc1058529b55635e30aef.

Change-Id: I677bd75bffddab6d764108e4fb2826e01c9dcb07
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4da0060ca8022b9b1a7660614545590034843d09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 06:51:33 +00:00
Alex Trotsenko
26e34fcb52 QEventDispatcherWin32: get rid of the hook procedure
Instead of intercepting the WM_QT_SENDPOSTEDEVENTS message in the hook
procedure, we can handle it at receive points, making
qt_GetMessageHook() unnecessary.

Including general performance improvements, this patch fixes the issue
where some applications (e.g. Ableton Live) do not call a chain of
nested hooks for plugins.

Fixes: QTBUG-90949
Change-Id: If8e96848392c6f10d45af2aac0567707d16af673
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Nuno Santos <nunosantos@imaginando.net>
(cherry picked from commit b7e08599cc784777d06d34e49e90c2d408ab629d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-26 06:40:52 +00:00
Allan Sandfeld Jensen
1c02584282 Improve QImage::fill(uint) documentation
Remove paragraph about long gone methods, and rephrase it
as a note on corresponding getters. At the same time
document 64-bit behavior as undefined.

Change-Id: I26ffd95040eb0aea30585aa0fa8526417b0ecc7a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit e3ebbca5406ac02909823a07bfe6ae4db768f3da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-25 23:18:21 +00:00
Timur Pocheptsov
41fc143635 Move QSslCertificate's details and cert-related code to the plugins
Also since we have to properly support 'no-ssl' configure option
(alas, we support QSslCertificate on such builds) - introduce
a minimal crippled QTlsBackendCertOnly, which depends on
X509CertificateGeneric.

Pick-to: dev
Fixes: QTBUG-90954
Task-number: QTBUG-65922
Change-Id: Ib9d62903f16b7c0eaaa23e319a822c24a7631dc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-25 18:44:17 +01:00
Thiago Macieira
0ea39a7c42 QProcess::startDetached/Unix: report which function failed
Like QProcess::start().

Change-Id: Ic90d8429a0eb4837971dfffd1664ef1293a6523d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 5d977b0fd2fa4611571e50378647c09febd49141)
2021-02-24 18:57:27 -08:00
Thiago Macieira
4ffc03d9fd QProcess::startDetached/Unix: simplify handling of the pipes
Use a structure that will automatically close them for us. This doesn't
apply to startProcess() because the pipes there are long-lived (though
each of them in QProcessPrivate could be an AutoPipe...).

The destructor only runs in the parent process, so the child processes
don't need to worry about setting file descriptors to -1.

Change-Id: Ic90d8429a0eb4837971dfffd1664ed98f3d74d1c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit f0ce50d3353e8a684f905e19dc6116dd1b515bf2)
2021-02-24 18:57:24 -08:00
Volker Hilsheimer
d47e2a28b9 Assert that setCurrentAnimation has the assumed side effect
setCurrentAnimation(0) is expected to set the currentAnimation pointer -
which it does, as long as there are any animations.

Fixes static analyzer warning 106daf11ddfe9bb4fa7cf98c9097962c

Change-Id: I3739bcfda103db391d21f135485f0b700c48ead1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 976d8b1f74d3fe556e4f468936affccbd3124247)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-25 01:33:11 +00:00
Volker Hilsheimer
b3182755bd Consistently test for nullptr
m_view might be nullptr, which is checked before setting up the palette,
so don't set the QTextCharFormat up without checking first as well.

Fixes static analyzer warning 0ef07dd07bebe04b93d1fc802eddb57a

Change-Id: Ia1c92eb4183c9e368e92875775cff90e2883ddaf
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit e38b55c47ce95480e6d0c1eb9d795cebc4d28c04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-25 01:33:10 +00:00
Craig Scott
2ef9fe42d1 Avoid cyclic dependency between plugin and module *Config.cmake files
In static per-repo builds, we have a mix of targets provided by
packages and targets provided by the main build. For the builds that
create the packages, we must avoid adding a dependency for the main
module library target on its associated plugin targets or else the
package config files end up with a cyclic dependency that cannot be
resolved when something tries to consume them. This only happens for
static builds because we have been attaching a linking relationship
to the main module library that isn't really a true dependency, we
attached it only for convenience of things linking to that module
library.

To preserve that convenience linking without breaking the config
packages, we use the QT_NO_CREATE_TARGETS condition to prevent CMake
seeing that relationship when generating the *Config.cmake files.
Creating these relationships will be delayed until the plugin's
*Config.cmake file is loaded, at which point it will add itself to
the main module library's imported target INTERFACE (this was already
done before, we just now rely solely on that).

Task-number: QTBUG-90819
Change-Id: Id725742182bcda64841be84fe1650bafb9151bb1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit be7e20213cc34d6ab23d3db938c6b9317034c9d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-25 01:20:02 +00:00
Craig Scott
4bf51e4ca9 qt6_finalize_executable(): Enable finalizers to be set per-target
Some plugins need to append additional processing to targets that use
them. This is most commonly needed for static builds to identify
additional plugins that need to be linked, but which cannot be
determined automatically by CMake as part of its transitive
dependency handling. Check for finalizers on directly linked targets
as a way to help automate common scenarios.

Because we need to lookup dependency targets and these may have
visibility limited to the depender target's scope, we now formally
document that finalizers should be called from the same scope as
the one in which the target was created. This was loosely expected
before, but is now made explicit.

Task-number: QTBUG-90819
Task-number: QTBUG-86669
Change-Id: I065a3f3a4ab6eeff6a98a655835427949e2fe0f1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 279ebfd487a8e43a65f50f273c6b6ee8cdbec0a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 22:53:01 +00:00
Volker Hilsheimer
100881d886 Assert that either both or neither pointer are nullptr
Identical change to qmetatype.cpp

Fixes static analyzer warning 0267bc9b3ba521cf8bf0a7fea8981ee5

Change-Id: Id6219f5025d703dd43b1742a067aa934d6aacd8c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3be3848338040f4178ed5a450d98eed883b79cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 15:33:56 +00:00
Friedemann Kleint
5be74d220a QStandardPaths: Add translation comment for macOS-specific item
Change-Id: Idde81ee9badb41ff7893dcbdfd39ec4cb8db9742
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit f0cc9f10da408a142eea685f9991ffd3cbcb1501)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 15:33:56 +00:00
Friedemann Kleint
ff10696d76 QSystemSemaphore: Fix broken translated messages
Add Q_DECLARE_TR_FUNCTIONS() and use tr().

Change-Id: I31a27afa06ee2a592a7e588283e5ff08b5d14f3b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 1128e0bea1dbe8578cd71385ef3c7231aee80e1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 15:33:55 +00:00
Kai Koehne
b87a916453 Disable NetworkManager plugin for -no-dbus
The plugin depends on Qt::DBus, so do not try to configure it if
Qt::DBus is not available.

Fixes: QTBUG-91155
Change-Id: I70ddca63a277cd57a253092f97160f89ebc76f06
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ea1c35d5578e978b743350bc6ab7c61c50152ca6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 15:33:53 +00:00
Volker Hilsheimer
43fe602ea3 Assert that either both or neither pointer are nullptr
If called by QMetaType::canConvert with two nullptr values,
the QMETATYPE_CONVERTER_ASSIGN macro will expand to code
dereferencing both 'to' and 'from' pointers.

Assert that others callers provide two valid pointers.

Fixes static analyzer warning 02dc34cc2ad1d4c3c6e55b44e08983f2

Change-Id: I24de914faa25dc7cb1da5eae09a125506caac389
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 52b5e9b76663fa7b43da1466fb2678d6b18d86b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 13:02:37 +00:00
Craig Scott
3d1a007d95 CMake: Prevent qt_remove_args() from accessing out-of-range list index
Change-Id: Ie9c5f0551722c7d3fb11879b209c11ce3d7ccd6d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 10b3681c72491cacf9ccf515fa2cbdf2ef131ff9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 13:02:35 +00:00
Volker Hilsheimer
2e00c7996a Assert that dereferenced pointer is never nullptr
It can't be, since then 'o' (which is never nullptr) would be different,
and we'd return in the previous line.

Since we test for d->popup a few lines above, help clang static analyzer
to not report this with hash
27ff831d79d1779825fd964239cbefe7.

Change-Id: I9f0b14bd88418b897cee2d7a63e8a10fc4a0b01c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f6c9dec610238bae0d2d61e733d4c29ecf57aa9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 13:02:33 +00:00
Volker Hilsheimer
3ad55194a4 Assert that we have a layout before dereferencing
Since we test the pointer in the beginning, it might be nullptr.
But if we receive events that require a layout, then it must not be
nullptr. Assert that assumption.

Address static analyzer warning 06f8cc945ead26f20c6b9599faf76c83.

Change-Id: I1c6eb9e9d2c9444fcb9bd1d1d9c345237dc72b33
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 1f6dbbd53969837cc4ff59f39dbb4c06d700a689)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 13:02:31 +00:00
Eirik Aavitsland
2d32e38e3a Avoid int overflow in QImage rotate90/180/270
Fixes: QTBUG-91223
Change-Id: Ice53c80d695a5ffdf9162df84e7c9b1e43106bae
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8daa94431341afece6beb052e6224d215f8507b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 13:02:29 +00:00
Craig Scott
bd70f6d550 cmake: Don't give plugins PUBLIC usage requirements
The pro2cmake.py conversion script faithfully reproduced the .pro files
for the plugins, which specified the libraries as public. But in CMake,
the implications of this are that public usage requirements should then
be propagated to consumers. We don't expect any consumers, since a
plugin is created as a MODULE library in CMake, so for Windows we don't
even have an import library to link with. The only exception to this is
for static builds where plugins are created as STATIC libraries
instead, but only in certain controlled situations do we then link to
plugins. Even then, usage requirements are not expected to propagate to
the consumers, so these relationships should always be specified as
private.

This change warns on any PUBLIC usage requirements specified for a
plugin. This check is disabled by default to avoid spamming CI builds
for repos that haven't been fixed yet. The check can be enabled by a
CMake cache option, which is intended for developers to use locally
when fixing this issue in other repos (all plugins in qtbase should
not trigger this warning as a result of changes in this commit).

Task-number: QTBUG-90819
Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fe29159aad0e03ca5eebabf910c90f279b222d03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 08:32:35 +00:00
Craig Scott
933e4c328e CMake: Reformat shared keyword lists
Putting each keyword on its own line makes it much easier to read and
improves maintainability. It is friendlier to source control when
keywords need to be added or removed.

This commit introduces no functional change.

Change-Id: I79efd039e5afa5f11f1d859405d6487ad6b3beb2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 844e37ca397d0c57d39c06503eba601159f9dfd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-24 06:29:16 +00:00
Joerg Bornemann
c515ee178f Move build tools to libexec instead of the bin dir
[ChangeLog][Build System] Tools that are called by the build system and
are unlikely to be called by the user are now installed to the libexec
directory.

This is a step towards easier co-installability of different Qt
versions.

Task-number: QTBUG-88791
Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 1f30bcf33618ca39c47dc1058529b55635e30aef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-23 19:06:50 +00:00
Valery Volgutov
c0d32623e9 evdevtouch: Fix wrong addTouchPoint for "mtdev"
Origin patch 359546b069051213a7b337fefbe21b664618f959
has following rule:
"the state for processed released points is reset
to zero at the end of the SYN_REPORT handler"

Patch 4e400369c08db251cd489fec1229398c224d02b4
changed state according new event refactor, but not fully.

Task-number: QTBUG-86013
Change-Id: If35b756d5c726533f11d18e7b73c98fffa17d809
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 462410a08b8bbfb068b6e06573adb0701c527d06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-23 19:06:48 +00:00
Volker Hilsheimer
5d323919e1 Initialize out-variables
QSplitterPrivate::getRange might return early, and then the variables
will contain garbage.

Fixes warning from clang static analyzer.

Change-Id: I0081ad9847f158da4440b945ba2db7e7f5d4780b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4f24e1e9b1230b97a45c6aab366fecd29795e885)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-23 16:56:21 +00:00
Andreas Buhr
7898f6a6aa Fix handling of virtual/native pixels in QAndroidPlatformWindow
f92e1953699b2529cc6ea2fd399fe4f2b887e83c made sure a new
QAndroidPlatformWindow always has a geometry. However, it did not
take into account HiDPI handling. This patch fixes it and introduces
proper HiDPI handling.

Fixes: QTBUG-91161
Change-Id: Iddf31b7abfd0a1bada3b051ed4de3bf6c2897d8e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit dec429e0778493bc4e85d6b18202804d0bbbe5f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-23 16:56:20 +00:00
Andy Shaw
7f22edc00c iOS: Pass the text to handleExtendedKeyEvent when known
This will ensure that the QKeyEvent also has this information passed on
as appropriate.

Change-Id: I52436404115b453664b9b3414f8ec4e715dd6a28
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5540c9c10754963375cd34f740e64b068c440a3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-23 10:50:18 +00:00
Dong Rui
a363e1e8ea QLineEdit: Fix editingFinished() not being emitted when pressing the clear button
When pressing the clear button, the editingFinished() signal was not
received when focussing out.

Call  _q_textEdited(QString()) when pressing the clear button.

Fixes: QTBUG-83295
Change-Id: Ie4bc6d9a2f27f89163c05c4c15175540c7631a30
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c5904cb96aed3b171c543a2cf0bed8f8ac5f95c4)
2021-02-23 10:22:42 +00:00
Friedemann Kleint
b06c3a0af8 QtNetwork: Fix build with QT_NO_SSL
Fix:
qsslcertificate_qt.cpp.obj : error LNK2001: Unresolved symbol ""public: static struct QMetaObject const QTlsBackend::staticMetaObject" (?staticMetaObject@QTlsBackend@@2UQMetaObject@@B)".

Task-number: QTBUG-90953
Change-Id: I4eb99c2ee4be67dfdf07e52219b73c6b14436344
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9a5a2d61c077ddc8a0fb4e2cce7a36a5dbb081d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 20:08:03 +00:00
Thiago Macieira
31849db9c6 QProcess::startDetached/Unix: fix the resetting of SIGPIPE
This should have been SIG_DFL, as we're about to execute a child
process. It's the child's responsibility to ignore SIGPIPE if it wants
to, or get killed by it when it writes to an pipe with no readers.

Qt itself does this for its own purposes (see qt_ignore_sigpipe() [until
I can get some time to teach Linux about O_NOSIGPIPE]). Therefore, we
ought to reset what we've done.

Change-Id: Ic90d8429a0eb4837971dfffd166585a686790dde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit f4e3b073b3d2a50133d734dd604bff21f061a3e6)
2021-02-22 18:12:25 +00:00
Thiago Macieira
bcc80f4e21 QProcess::startDetached/Unix: remove unnecessary ignoring of SIGPIPE
This is unnecessary because we can only get SIGPIPE if the reading end
of the pipe is closed. And that can only happen if the parent process
has exited, meaning there's no one to read our message anyway.

Change-Id: Ic90d8429a0eb4837971dfffd1664ec6821993ada
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 089bcb007454fe44224139b2d0a0e4145f209b15)
2021-02-22 18:12:13 +00:00
Volker Hilsheimer
62d3268501 Initialize QStyleOptionHeaderV2 with correct version
Amends 4c6579eacded086ad014b0fd2432095362c1d131

Task-number: QTBUG-91224
Change-Id: I9a41db9354bff2fa706cf6053aa229cdca16759e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 85af149c9b69772ad8c559bd9d771803383c5d05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 17:53:32 +00:00
Assam Boudjelthia
8d94f5b549 Re-order includes in qjniobject.cpp
Change-Id: I80acd829bfd0940d17170f2277e92bc9620ce929
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f265736e9fdce7e9d049774f2e9f648f52aef31f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 17:53:27 +00:00
Volker Hilsheimer
ef193ccaed Complete documentation for QStyleOptionHeaderV2
Document the isSectionDragTarget variable, and add \inmodule command.
Put code and documentation together.

Amends 4c6579eacded086ad014b0fd2432095362c1d131.

Change-Id: Id8837ca75cd6af13c8dc4c028b304b279e507ade
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 7f1dc4bb750f412482a55e4f52e29751d2b4120d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 17:53:26 +00:00
Morten Johan Sørvig
b147c28e27 Add scaledPixmap() override
QAbstractFileIconEngine implements the QIconEngine interface
and creates a new interface where subclasses override the
filePixmap() function.

QIconEngine subclasses must now also override scaledPixmap();
add implementation which forwards to filePixmap().

(The intermediate implementation in QPixmapIconEngine is not
used by QAbstractFileIconEngine.)

Task-number: QTBUG-91104
Change-Id: I229e3a003ad0c3fff768eac7e75c59fe7145fcaa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit bb110cee5dbcce58c44e9a59b47fd0bbf6aaddaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 17:23:06 +00:00
Timur Pocheptsov
573ba145d7 A follow-up fix for potentially missing OpenSSL symbol resolving
This patch also adds 'isValid()' to know if a backend from a plugin
is in working condition (say, there is 'openssl' plugin but no or
old openssl libraries in some system).

Pick-to: dev
Task-number: QTBUG-65922
Change-Id: I0b846536a069ca8c5a94e7191f11c81bac6ad527
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-22 09:58:28 +01:00
Thiago Macieira
64c47d7f61 QProcess::startDetached: set the error condition on failure to start
And set *pid to -1.

[ChangeLog][QtCore][QProcess] If a startDetached() fails to start the
target application, the QProcess object should now have a proper error
string in errorString().

Change-Id: Ic90d8429a0eb4837971dfffd1664e825ffcb923e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 73a04edce151b21ea5d07494603c0317716e99d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-22 04:57:45 +00:00
Friedemann Kleint
3961b82e6c dirview example: Show file icons on Windows
Use QFileIconProvider from QtWidgets.

Task-number: QTBUG-66177
Change-Id: I22db2f8671c64d90c45ff7160af9a6925d1cecea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 060fceb2ab7f39d04d977146db2e5f990804e398)
2021-02-21 19:51:45 +01:00
Thiago Macieira
9ab73a80b2 QNetworkInterface/Linux: make the IFLA_OPER_STATE set IsRunning
We were setting IsUp for both the ifinfomsg::ifi_flags field and
IFLA_OPER_STATE message. Turns out the second matches the "RUNNING"
state that ifconfig used to return (IFF_RUNNING from SIOCIFFLAGS).

Example:
$ ip link show vboxnet0
4: vboxnet0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
$ ifconfig vboxnet0
vboxnet0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In this example, ifconfig is not showing "RUNNING", so its "UP" matches
iproute2's in the <> section (that's the interface's ifi_flags). In an
interface that ifconfig shows RUNNING, iproute2 will show "state UP",
which is the IFLA_OPER_STATE.

Exception: looks like the loopback has IF_OPER_UNKNOWN.

Change-Id: Ic90d8429a0eb4837971dfffd1664bfc3f4b4e030
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7507d872856282f381354b13a3b50d865c9ce2f8)
2021-02-21 08:20:38 +00:00
Volker Hilsheimer
57e2003982 macOS: don't let windows that are transparent for input become key window
Such windows are typically used as mostly transparent overlays on top
of other windows underneath. Letting such an overlay become the key
window breaks cursor updates and focus handling.

Fixes: QTBUG-83632
Change-Id: I192d419a5bdb8dfa0e9223e9fbbd7876c62fe743
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 24b07b2b2d367c61b911c8f3a72f7209ef7e00d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-20 23:05:27 +00:00
Thiago Macieira
68b329d733 QProcess::startDetached/Unix: move up the chdir() and remove qWarning
That qWarning cannot be in the child process (we don't know if a user
logger is fork-no-exec-safe) and the failure to chdir() should be
reported as a failure in QProcess::startDetached() instead.

Change-Id: Ic90d8429a0eb4837971dfffd1664e7577c81610b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
(cherry picked from commit 31bb141aed52549fae52f2156ac66bd2647cad16)
2021-02-20 07:44:50 +00:00
Thiago Macieira
ef1a0231e0 QProcess/Unix: remove unnecessary chdir("/") before _exit()
That only created an opportunity for qWarning(), which should never be
in the child process in the first place.

Change-Id: Ic90d8429a0eb4837971dfffd1664e57a2291ea78
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
(cherry picked from commit e274d56effc13e4ba7c5fcec783c3227551551c6)
2021-02-20 07:44:39 +00:00
Volker Hilsheimer
f9d13af6d1 Unbreak binary compatibility in QStyleOptionHeader
4d943846128118e1b9932a17ce6f977a0f4127a5 introduced a new data member to
QStyleOptionHeader, and reduced the size of the orientation member.
This changed the binary layout of class instances, and breaks ABI.

180c662b0790c6eceffdcb4661681d7df1541a2d added another member within
the new bitfield.

Introduce a new QStyleOptionHeaderV2 class instead with the new members,
and use that in QHeaderView, and the styles using the new members.

Fixes: QTBUG-91224
Change-Id: I47e6841e6652e4b67f247b7b4514e90be5609156
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 4c6579eacded086ad014b0fd2432095362c1d131)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 23:22:06 +00:00
Topi Reinio
78d71d156b Doc: Remove styling for hyperlinks from the simplified offline style
Using a dark theme with the simplified offline style in Qt Assistant
results in hard to see links against a dark background. Let the
backend style the hyperlinks instead.

Fixes: QTBUG-32778
Change-Id: I51ca87f8a526a07a385e42a3c978712ac4d1e91b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 6ab1f926504e7e4ad64e439f1bb0f7c0f4d3ba01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:59 +00:00
Lars Schmertmann
3ebe798f2d [Android]: Fix exception when using Qt to create a service on Android
Fixes: QTBUG-91194
Change-Id: Idd243c17bf82150fe2ea8b0100f8c432d75ef249
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3466fc5b76a97eabc815a7406f01454e4ac0db4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:28 +00:00
Morten Johan Sørvig
cbe0da5975 QMdiSubWindow: Set correct ControlLabel size
The label pixmap may be a high-dpi pixmap. Set the ControlLabel
fixed size to be the pixmap device independent size.

Fixes: QTBUG-87871
Change-Id: Ib836e322d25599cb5e79011ea597e32ee1f8d093
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 33ddacdd24523acbdafcda0f520dd2d73c879cfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:26 +00:00
Topi Reinio
09a7102433 Offline documentation CSS: Remove external link icon from video links
Change-Id: I1fddad28399f83bfb8bfb7bbc0c4825907dfeb4d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e9a7ea6639b303f7313d84aceb8020e6650816b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:21 +00:00
Alex Blasche
02ad983e3f Remove assignment to variable which is never read
Highlighted by static code analysis.

Change-Id: I0e0d33c66c3aac5135204212bea2d5d48bad3739
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0f4b2ccea4a8701a83c37c612b0ad0e60063b7c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:20 +00:00
Topi Reinio
aee40e4f06 Doc: Offline CSS: Reduce excess vertical spacing
Fixes: QTBUG-89829
Change-Id: I0beb43fb2f40cbd1e5b36c95322f1a1530f5acf4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit c4c2ce5b828e3859acf5b998dffb201b2153f5b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 14:39:16 +00:00
Assam Boudjelthia
0b92f05361 Coin: fix android emulator script to use bash instead of sh
Task-number: QTBUG-91180
Change-Id: I410c6769aac3b3b760ff35aa71d52c8a5d6c1143
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 136324ad623c09f47061b8c47deac90111904f57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-19 12:08:13 +00:00
Assam Boudjelthia
bbb2fe3c28 Coin: remove workarounds to allow running Android tests
We had two workarounds:
* script that adds Gui to tests
* create a symbolic link for the qt install dir to fake_prefix which
androiddelployqt was expecting them to be under

Both issues are fixed, thus removing the workarounds.

Change-Id: Ic022bece15afe92c693d573893d260b13b4227ed
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
(cherry picked from commit bcbdbd50fefd90cc8cfe2c01d8f681dfe690971a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:16 +00:00
Alexey Edelev
9b8b1fe6d1 Fix the qmake error when building with qtquickcompiler for iOS
Fix condition when adding qmake_immediate to resources. This condition
was wrongly positive in any non-android case, but also had to check for
BUILD emptiness or build_pass. This cause issue because
qmake_qmake_immediate was added to the RESOURCES variable earlier, than
actually generated.

Fixes: QTBUG-88031
Change-Id: I38dad858a7e81ab709e622ec24baa8f9b80970fa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 58556afb6960b442f88649b550aaec8e1a04338b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:13 +00:00
Mårten Nordheim
5a081b5eed Mark QSocketNotifier::activated(int) QT_MOC_COMPAT
Fixes: QTBUG-83888
Change-Id: I0833812376a5bf1a024a4b036c09b23760437862
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9d19a8ca2fc4fbd99427d2be10ad1d1e98b34506)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:12 +00:00
Assam Boudjelthia
9b98e84da5 CMake: handle Android features dependencies for modules
QMake used to allow retrieving the Android features list for a modules.
The dependencies are written to *-android-dependencies.xml files and are
read by androiddeployqt. This option was missed at some point along the
way of writing CMake port for Qt 6.

Change-Id: Ic0b82f024567e640968f97aeff2db1888f2b53a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 09fc4f9525740b8c671c036413153d3419750b99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:11 +00:00
Ulf Hermann
f78810b936 QJsonObject: Fix operator<=()
We had a copy-paste error there.

Change-Id: Ib1448197ac4f4641c6559f133f41dcf326f210f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a2e23bca0f2b43a26e2e489f83cfe2e521da63b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:09 +00:00
Joerg Bornemann
49f32b2650 qmake: Introduce QT_HOST_LIBEXECS property
This will be used to access host tools that are installed in
${prefix}/libexec instead of ${prefix}/bin.

Change-Id: I36c4b5736330f8229d267a117c65d55cd5e12758
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit edd122548940a0213e35d11649566efbef7f1fea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:06 +00:00
Mårten Nordheim
3470241161 QNetworkInformation: Address API review feedback
Added missing NOTIFY for Q_PROPERTY.
Switched one Q_ENUM to Q_FLAG.
Declared missing operators for QFlag.

Change-Id: I8e6756838e44e205844a34c95f436df6b51a862f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0d4fb41e8c00263a0d385b70cc066776cbf6cc37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:04 +00:00
Volker Hilsheimer
8fa8f4dab0 Make constructing QFont from families explicit
Disallow implicit conversion from QStringList to QFont.
Address API review comment.

Change-Id: I73eb3a49182865e050965e97d459463e73bcddfd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit c0b67256740e98a9071885284edb8ae0e69640dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:45:03 +00:00
Lars Schmertmann
bb1a550d58 Android: replace stacktrace with debug message in search for setService
Don't print stacktrace when setService is not found but only print a
debug message, QtServiceDelegate will continue to look for setContext
which might actually be a problem if not implemented.

950e628fd842f22ac741b18440fcc99213820587
did this change for QtActivityDelegate.

Fixes: QTBUG-86733
Change-Id: I8f2c6494da9133a3e9dedaabbe5fc931732d0d72
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 15572f9efeb1b7dd609b55f8981eb5b5dc3d3db9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:59 +00:00
Edward Welbourne
8418a95f1c Correct qt_mktime()'s check for last second in 1969
It was comparing time->second() to MSECS_PER_DAY - 1, but
time->second() is the second within its minute, so is at most 59.
It should be comparing seconds into the day to SECS_PER_DAY - 1.
Prompted by a PVS-studio article.

Change-Id: I1802c49fa18818f4b4fe74f187da5f799df7d1de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 94b9ee03b5646bf58c12337bbc44e38265ad15a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:59 +00:00
Edward Welbourne
5d786b626a Remove redundant code in androiddeployqt/main.cpp
Prompted by a PVS-studio article.

Change-Id: I9699cc9baf9c90a6cf5b9564cd175205a9b2fa6b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 36ea42effc0cb7eee55f0545221e6f8fffaa1179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:56 +00:00
Friedemann Kleint
89eda9ab1f Fix some qdoc-warnings for 6.1
Fix:
qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_Message' in QTest::LogElementType
qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: No such enum item 'LET_Error' in QTest::LogElementType
qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_SystemOutput' in QTest::LogElementType
qtbase/src/network/ssl/qsslsocket.cpp:1666: (qdoc) warning: Unknown command '\cl'
qtbase/src/corelib/kernel/qproperty.cpp:883: (qdoc) warning: Unknown command '\T'
qtbase/src/corelib/kernel/qproperty.cpp:799: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text
qtbase/src/corelib/kernel/qjnienvironment.cpp:250: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text

Change-Id: I116f5d8ace2c29ba7b6b93256d5761591e01296a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
(cherry picked from commit 868242b6e1840fcea491ad86d8b2a7a101c4eeaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:51 +00:00
Mårten Nordheim
b9a721eaaa QNetworkInformation: Revise locking during creation
Potential issue caught by the Mårten static analyzer.
In case another thread somehow ended up creating and returning
an instance while another was waiting to relock it would deallocate
the previous instance, which could lead to some bad situations.

Change-Id: I6e1843f8a483b2c3e0540e998c383e41f59c8655
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c98e92b8ca7fd295482ee99f095c220b6f389169)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:50 +00:00
Alexey Edelev
933162c445 Do not rewrite boolean INPUTs if they have a corresponding feature
Initial replacement of boolean INPUT_ variables to the FEATURE_
variables was wrongly changed to updating of the INPUT_ variable
value to ON/OFF value. This causes potential issues when INPUT_
variable has explicit check for 'yes' or 'no'.
The feature evaluation step enables FEATURE_ variables in case if
the corresponding INPUT_ variable contains a positive CMake value.
So there is no need to process boolean INPUTs at the argument
processing step.
Also no need to keep the special opengl case, since it will be
processed correctly.

Fixes: QTBUG-91158
Change-Id: I96bb7903a904ae3cf788d7ef7d4e0c019046eb95
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 530b62934923070b5b8b5c5b3c764a2b7d4db039)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:49 +00:00
Volker Hilsheimer
5c2cfd7973 Use same version in deprecation macros
Address API review comment.

Change-Id: Ifd9f9dafc958ab8304f36e2ae6ab2fb5a01a29d8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 6c883f0341084d010b1109b0590c6065e5d34ae9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-18 15:44:48 +00:00
Andreas Hartmetz
d458eafbec Fix QNetworkInterface IsUp and IsRunning enum documentation
The information is based on common Linux knowledge, StackOverflow
answers (this is just one of them):
https://stackoverflow.com/questions/11679514/what-is-the-
difference-between-iff-up-and-iff-running
an LKML thread about IFF_UP and IFF_RUNNING:
https://lkml.org/lkml/1999/7/9/69
and the FreeBSD manpage for "ifnet" - e.g.
https://www.freebsd.org/cgi/man.cgi?query=ifnet&sektion=9

Change-Id: I50a47b7fb26a63ac9d3f7eeef559fa7f56003cff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e6bd5a5ca3f55765edccf7c667612fb0919e6c94)
2021-02-18 12:28:07 +00:00
Timur Pocheptsov
b677883263 qssl.h - address comments from API review
Enumerators initially were to be flags, but this changed later, no
initialisers needed now.

Pick-to: dev
Change-Id: I72b24f979e207e21d6f42a11cf0ae8887df473d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-18 12:34:11 +01:00
Timur Pocheptsov
0352cf8e1b Port QSslKey to the new plugin-based implementation
The idea is to have QSslKey(Private) backend-neutral and hide
all library-specific code inside plugins.

Pick-to: dev
Fixes: QTBUG-90953
Task-number: QTBUG-65922
Change-Id: I2eeee3b2b72c78c2e24f2fb914abce3caa913be8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-18 12:33:50 +01:00
Nico Vertriest
36017b0894 Revert "Remove the qmake project files" for snippets
This reverts a limited part of commit ad2da2d27a590333fc89a56fc58700a09c3017b3
that deleted .pro files for snippets compilation.
Some .pro files which contain snippets used in the documentation
itself should be restored.

Task-number: QTBUG-90483
Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 3183673303f6e66a02a7fbd25f4df2da8e979cc5)
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2021-02-18 07:42:52 +01:00
Edward Welbourne
ef973d277b Rework tst_QDateTime::toString_isoDate() to eliminate an XFAIL
Instead of an XFAIL, actually test what we expect will happen for the
test, namely that the milliseconds will be lost. In the process,
verify that milliseconds since epoch also matches what was expected,
change an "expecting empty" condition to check for the "invalid"
test-case to which it's actually relevant and note that this test-case
shall need amended when we update our ISODate support to the 2019
update, which extends the year range.

Task-number: QTBUG-56552
Change-Id: I680aa31ee0dcc8fadabb5d4cd6c083a8afd48573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cc93dadf772480df3b27fd031a471047a5db0038)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-16 12:50:00 +00:00
Fabian Kosmale
4e3a5f266e Do not make QTimer::interval bindable
Issues were found and fixed only in 6.2. Let's play it safe and do not
make interval bindable in 6.1.

Change-Id: I4465d3991d0c303037de7421d5a670f009ac2bf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-02-16 09:42:46 +01:00
Samuli Piippo
cc4bcf94e0 tst_qprocess: enable test again for cross-compilations
All test cases pass with QEMU.

Fixes: QTBUG-85287
Fixes: QTBUG-67760
Change-Id: I188d70c05f6d858e17f1099d3c02862ea9b2a2ab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 71eef476d789bf94602006cc2c9a44ba384f988e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-16 07:35:29 +00:00
Fabian Kosmale
9e2a85b2a2 Mark QPropertyAlias as internal
That class was only really meant for the QML compiler, and it is dubious
if event that one needs it. The current implementation is also broken.

Change-Id: Ie40d282707f3fabc8079bee9e98f082aeb9d30b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 5481601debd6ce06bb8f0135e3ea4baf8a21cb3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-16 01:24:49 +00:00
Edward Welbourne
6e1b0f9d14 Fix tst_QDateTime::systemTimeZoneChange() for 32-bit systems
The test verified that a LocalTime's time since Epoch changes when the
system time-zone changes. This works when the QDateTime object is in
short form and recomputes its offset from UTC every time it is needed,
but fails with a pimpled QDateTime, as this caches its offset from UTC
when it is created, saving the recomputation which - in the far more
usual case where the system time-zone does not change in the lifetime
of a QDateTime object - would normally produce the same result.

Changed the test to use a newly-created QDateTime constructed with the
same parameters, which doesn't have the cached out-of-date knowledge
of its zone offset. Removed the XFAIL. Made the test data-driven and
added test-cases: one so close to the Epoch that it should be short
even on 32-bit systems, one so far that it's pimpled even on 64-bit
systems (used in reproducing the issue in order to debug it).

This then revealed that Android 5 doesn't seem to support the POSIX
zone IDs used by this test, so it now verifies that LocalTime has the
expected offset from UTC after zone changes, QSKIP()ping if not.

Documented that the behavior of LocalTime is undefined after a change
to the system time-zone. Cleaned up the existing doc of Qt::TimeSpec
in the process.

Fixes: QTBUG-89889
Change-Id: I1058f47a1ff3ee1c326f3579ac80bd8bab242e28
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 02ae1b522193b60e7a5c8e5eff7a15d25b0f7aae)
2021-02-15 23:35:12 +01:00
Joerg Bornemann
3fd72dbf1b Document more arguments of qt_internal_add_tool
Change-Id: Ia89922bb7d8ce327ea864889f5e2132427c58be6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit a63f72d442df201065efbe6868f669a5855aa557)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 20:37:37 +00:00
Alexey Edelev
ce7ab499f3 Remove the corelib_add_mimetypes_resources call for the Core library
Looks like the corelib_add_mimetypes_resources call is redundant and
deprecated. It duplicates the mime-type database in the Core library.

This also fixes the static build of the qmimedatabase tests, since
avoids propagation of the resource symbols by the Core library.

Fixes: QTBUG-89952
Change-Id: I5c0dbd761b7726589fdf6970cd546af89d2ff837
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 01e32d5c4a0ca1da0f31f57b970ef271fe13bd1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 20:37:31 +00:00
Joerg Bornemann
83c3f0b3bb Prepare installation of tools to libexec
Add the INSTALL_DIR argument to qt_internal_add_tool to allow
installation of tools in other locations than INSTALL_BINDIR.

Task-number: QTBUG-88791
Change-Id: I88ede81a4c13c82f6d209156d3801ce130f8fc10
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit c1cbfcb38fc3aac01da8d32cb8607fad76210e29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 20:37:30 +00:00
Alexey Edelev
37d6083690 Fix qmake_qmake_immediate path for Android
Add missed RCC_DIR to the qmake_qmake_immediate.qrc path,
when generating android deployment settings.

Fixes: QTBUG-90969
Change-Id: If4959581fcc153d9c19d178233297fc7b440b2f7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f8736d34d4ec00d27d05993de2dee661089f0dfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 20:37:27 +00:00
Liang Qi
1122a204d5 xcb: unset old states and set new ones for window
This partly reverts a02959bb5b43a3f9d881e5213ceedf535202b6a1.

Fixes: QTBUG-87078
Change-Id: I69e18ad3c0a8d142b2e1f5ab87990addc97d9df1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f61b140482d9578c07410a5979379e44e05352e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 20:37:26 +00:00
Joerg Bornemann
1668b12466 Fix deprecated API in network/torrent example
Change-Id: Ie4493f0d93cdeff281c3826d2ca3beb4e68d7a0f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit ab585356bd8815bdc17cecac0a0d5fcf54d50dff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 18:20:51 +00:00
Joerg Bornemann
90860224c8 Fix CMake build of network/torrent example
The ui_XXX.h include did not match the location of the XXX.ui file, and
AUTOUIC failed with
    "SRC:/addtorrentdialog.h"
    includes the uic file "ui_addtorrentform.h",
    but the user interface file "addtorrentform.ui"
    could not be found in the following directories
      "SRC:"

While this could be fixed by adjusting the include paths properly, this
would complicate the CMake project file, and we're dealing with an
example where needless complexity would cloud comprehensibility.

Move the .ui file next to corresponding source files instead.

This removes the need for any special cases in CMakeLists.txt, and we
can remove .prev_CMakeLists.txt.

Fixes: QTBUG-87457
Change-Id: Ic2dec5ded7100e22d5afc571efc4b009bc62e41c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 0c51a8756377c40180619046d07b35718fcf1784)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 18:20:51 +00:00
Tor Arne Vestbø
aa499b5fbc tst_qapplication: Prevent desktopaware test from deactivating main test
Applications on macOS are automatically activated (put into the foreground),
when launched from the Finder, or via 'open' on the command line. But when
launched from the terminal, e.g. foo.app/Contents/MacOS/foo, the application
will launch in the background (inactive).

In Qt we override this behavior, activating the app even when launched from
the terminal, as a convenience, as long as the application is a GUI application.

Unfortunately this means that when tst_qapplication launches a subprocess that
is a GUI app, it will steal activation from tst_qapplication, which in turn
will break tests that later try to activate a window and check that the window
is then active. The window will not be active until the application is active.

We can work around it by preventing Qt from activating the application, but
ideally we'd find a better solution to this, as we don't want to sprinkle
overrides all over our tests.

Fixes: QTBUG-90699
Change-Id: If53a86548002b739df0c0a7153d6244924a4a205
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 09cc63d425dabfa37b406e7eb1cee627c2eabb67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 18:20:49 +00:00
Mårten Nordheim
a1ad779db6 MinGW: fix warning in QMatrix4x4::map functions
The definitions get the following warning (treated as error):

redeclared without dllimport attribute after being referenced with dll
linkage [-Werror]

I take it to mean that because they are labelled 'inline' the compiler
disregards the 'dllimport', but that makes it inconsistent with the
declaration. So we label the declaration inline as well.

Change-Id: I87bb42141a1086b2c565db881077f33acb4aab64
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 10aa4b5c61b0073a76ff22946f1682f021cbd34b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 18:20:45 +00:00
Mårten Nordheim
329a99605c Schannel: Fix incomplete downloads with read buffer restricted
When the read buffer has a max size we do our best not to exceed it.
Usually there's no problem and we just read more when the next
tcp frame arrives. However if there's data leftover after the last
tcp frame arrived then we won't receive any more data. To counter
this QSslSocket would try to invoke QSslSocketPrivate::transmit
indirectly if there were any bytes available on the plain socket.
The problem is that with Schannel the last few remaining bytes
would not be in the plain socket, but in the 'intermediateBuffer'.
So let's make QSslSocket aware of that.

Fixes: QTBUG-90625
Change-Id: If56e4cce558f99c9a08a1f6818e005a887712ef2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6d4da1340f18b66e60ed6969aeb7180e00d39077)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 14:15:01 +00:00
Kai Köhne
b6e644ad40 Fix attribution for tinycbor
Amends cbdf2ba46aed53d002b90d4d9683c28306f8e0a9

Change-Id: Ie1a89ec9367ecc2d674b5f8b27ab3d9bc5a16eca
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit df255a4a04149ca11704c8c9113149d16c79ea5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-15 11:21:27 +00:00
Allan Sandfeld Jensen
95191e55e1 Extend colorspace testing and fix bug it uncovered
When changing transferfunction the look-up-tables needs to be
regenerated.

Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b2631c72c0628e68c0fae7567fd12e6646455efc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-13 12:21:03 +00:00
Samuli Piippo
83dcbf75ad Move QEMU emulation detector to QTest
The emulation detection has been usable only on qtbase tests, move it to
QTest so that it can be used in other modules as well.

Change-Id: I4b2321b7856414d7b1cfd5e6b1405a633c6bb878
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0ce443691fac1188103e5eaa66be40278d5d5e97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-13 10:14:16 +00:00
Assam Boudjelthia
1c0073ba72 Android: set minimum recommended android SDK to 29
comply with the api version used by default with androiddeployqt and
in docs. Google play also requires api 29 as minimum.

Task-number: QTBUG-90943
Change-Id: I05e2a90b4d7f2120b0198e3fb7b8b1b2398eba93
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit e711eb35f54cabf8b0beff49e5b748731d042c63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-13 08:05:25 +00:00
Allan Sandfeld Jensen
1803f904bd Fix QImage::fill with semi-transparent QColor
A few formats were not treating the input QColor correctly. Fixed and
added more exhaustive test.

Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 95712c5e5438e4eb5cd205ab4659febf3192137a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-12 20:46:11 +00:00
Assam Boudjelthia
f94fbaf80a Add build.gradle to easily modifying Java project with Android Studio
Change-Id: Ie030ff0a3569caa0eacfa331d21f59e5455c90ed
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 886a2d4511bdd5705595bcf4a29fb22f84c0e9aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-12 15:38:19 +00:00
Assam Boudjelthia
ea8a0eb417 Fix docs misuse of escape character \
Use {} instead of \, this fix a badly generated block of text.

Task-number: QTBUG-89632
Change-Id: Ia4aad4c06285eb016a092f4340669fcbef1a6780
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 448ea34637af3a8a92c2a4c5780815ca44e0ecf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-12 11:09:17 +00:00
Mårten Nordheim
2983fe8f09 QNetworkInformation fixups
Addressing feedback that came after the reviews
ended from both bot and people.

Added CLASS_NAME to the CMakeLists files for the plugins so that
cmake can generate the correct import.

Fixes: QTBUG-91061
Change-Id: Ib3f1e863100c1c421a6c0a4081b1d40696d67b23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 92b15beb9aa09467583230a018c23114bb666a8e)
2021-02-12 07:55:09 +00:00
Giuseppe D'Angelo
2c55e121c2 QMatrix4x4: deprecate operator*(QVector3D, QMatrix4x4)
The operation is sketchy for a number of reasons:

1) Mathematically, it doesn't make sense. The code interprets the
QVector3D as a point, extending it with w=1, and uses it as a
row vector. But similarly, the vector could be intepreted as a
directional vector, with w=0. No semantic is "better" than the
other.

2) QMatrix4x4 is not meant to be post-multiplied. Granted,
one could use a QMatrix4x4 as arbitrary storage for 16 floats,
but QMatrix4x4 builds itself to be always *pre* multiplied
(e.g. translate changes the 4th column, not the 4th row). We
can keep post multiplication for the general case if we do it
against a QVector4D, but I don't feel that we should support it
also for QVector3D.

[ChangeLog][QtGui][QMatrix4x4] The multiplication operator
(operator*) between a QVector3D and a QMatrix4x4 has been deprecated.
User code needs to extend the QVector3D to a QVector4D first
(by specifying the intended w coordinate), and then multiply
the QVector4D by the matrix.

Change-Id: I41b64d8ab7eb6126dc4c49fe29cf3f1b7afc7987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 654a2164994974639e62f9d388408ed559b797a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-12 02:03:06 +00:00
Assam Boudjelthia
121ad4c22f Refactor duplicate code for clearing JNI exceptions before returning
Add a private function to handle checking/clearing and deleting the
local reference to jobject before returning a QJniObject.

Task-number: QTBUG-89633
Change-Id: I0ea28c8ba4da0bfc1e341c6b4c1f61fecfec87a6
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c7bcc51e2c196e5cc3def89137ca31b4a9d29157)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 19:16:29 +00:00
Assam Boudjelthia
afd74eb7fb Android: take JavaVM() from QJniEnvironment and not QtAndroidPrivate
Task-number: QTBUG-89482
Change-Id: Idfd442afc90c00e672b28b43c78c789813f46c7d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 3348107c038cbac724e33d6bb30671ddddc1505a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 19:16:29 +00:00
Giuseppe D'Angelo
f576e22f6e QMatrix4x4: deprecate operator*(QMatrix4x4, QVector3D/QPoint(F))
The operation does not make sense at the "fundamental" level
for these classes (algebraic, in this case), so it shouldn't exist.

It's also a semantic trap:
* it interprets a _vector_ as a _point_ instead (the vector gets
  1-extended in 4D)
* after the multiplication, it gets perspective divided.

These semantics do not belong to operator*.

operator*(QVector3D/QPoint(F), QMatrix) will be tackled in a next commit;
we don't have a straightforward replacement for it.

Drive-by, document that map() interprets vectors as points.

[ChangeLog][QtGui][QMatrix4x4] operator* between a QMatrix4x4 and a
QVector3D, QPoint, or QPointF has been deprecated in favor of map()
and mapVector().

Task-number: QTBUG-89708
Change-Id: Iad78d6eb68cc8cdc3ac16b1635c4d3b522c95213
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6862ce3d7763d8163cc1350c45bc6adae8b4fc7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 19:16:27 +00:00
Assam Boudjelthia
0c413c379a Fix registerNativeMethods for good
The initial implementation and the commit
c00ab6f8eaa3cdc9a29dd103c91b2eaf212cac9f was wrong:
* env->findClass() in fact returns a global reference, and in any
case we shouldn't be calling that, instead QJniObject would be
enough.
* The size param provided to env->RegisterNatives was wrong.
* A test for registerNativeMethods() is added to ensure such break
is not repeated again.

Task-number: QTBUG-89633
Change-Id: I4d3a6a9270755f465c40add25521fb750dd4de0a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit deca7cd730a44988d3e15c551d9a82a5c75618e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 19:16:26 +00:00
Tor Arne Vestbø
4a3fe46313 iOS: Disable three-finger-tap editing interaction menu when there's no focus object
A typical Qt application, such as a QML application, is a single full
screen QUIView, containing all of the granular controls of the UI.

The view accepts first responder status, so that we can pass on text
input to a possible text field inside the UI. That however triggers iOS
to bring up the editing interaction menu whenever the user taps with
three fingers, as iOS can't know that only parts of our view is suitable
for interaction.

To mitigate that we override the editingInteractionConfiguration getter
of the view, as documented, and dynamically report the correct enablement
based on whether we have an active focus object that accepts input.

This works because iOS queries the getter from the three finger tap
gesture recognizer, before showing the menu.

Change-Id: I0874340c42e437e1d7251896993f2eafe122f09e
Fixes: QTBUG-89735
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f0f00dbd119e0169bc81aa761e4d548e4ecf2214)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 17:13:15 +00:00
Joerg Bornemann
c1781dd958 configure: Don't guess the compiler if the user already chose one
We must not guess the compiler from the -platform argument if one of the
following holds:
- the CXX/CC environment variables are set
- the CMAKE_CXX_COMPILER/CMAKE_C_COMPILER variables are passed

Fixes: QTBUG-90914
Change-Id: Iff7a0e7b8857f77333f1705f118d7952af5234ba
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 41e3d167d5e1dede286e6960037c5ac115eb692f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 10:30:02 +00:00
Samuli Piippo
dec5cfcd4b CMake: setup windows tools path only when building on Windows
Fix cross-compilation on Linux host.

Task-number: QTBUG-91052
Change-Id: I48c970f0e6af71e3eda3818557e764f60d3836ad
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 24d2215b67e1875046aa8c856751260f4356453f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 10:30:01 +00:00
Assam Boudjelthia
71fc71c96e CMake: add Qt::Gui dependency by default for Android tests
Normal Android apps require Qt::Gui dependency and since tests don't
need to handle any special cases for an app without Qt::Gui, let's add
it by default.

This also will allow us to remove some workarounds done on CI side to
run tests for Android.

Fixes: QTBUG-90870
Change-Id: I845650c17a1b73e4c4977043f863ec44e50f06c3
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 85c7a9d3a6710f8487ce4aa1e4e2d7d1d46b6cde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 10:30:01 +00:00
Richard Moe Gustavsen
cdf8c96118 iOS: don't report selection changed if it didn't change
Be more careful about reporting a new selection to Qt. The code for
handling IM selection events in QQuickTextArea is quite complex
and need to take pre-edit text into account. The latter means
that when the pre-edit text changes, as a result of the user composing
a word, the width of the pre-edit text will also change (and as
such, the cursor rectangle). But the cursor position itself stays
the same.  And for this reason, it emits cursorRectChanged more often
than strictly needed. But rather than trying to clean that up, we
do some extra checking before we send the IM event from QPA in
the first place.

Fixes: QTBUG-63018
Change-Id: I689d989c3fe5d61ef2b1dbee7a70418b7790bce9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit be06164201d7d9ccdbaaff343af2e8f3662c044d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 08:22:37 +00:00
Joerg Bornemann
89590a1fed Fix FindWrapOpenSSL.cmake if OpenSSL::Crypto is UNKNOWN_LIBRARY
The attempt to call target_link_libraries on OpenSSL::Crypto failed when
this target was added as UNKNOWN library by FindOpenSSL.cmake.
Instead, set the INTERFACE_LINK_LIBRARIES property directly.

Fixes: QTBUG-90925
Change-Id: Idbc1379c89480225fc7a8d417416ed20404a1122
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b6b9e54f167aab104600f4d4a2db71ae70561c3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-11 08:16:15 +00:00
Eirik Aavitsland
db06e85722 Fix recently added auto test of text layout overflow
Ignore width of trailing space.

Fixes: QTBUG-91038
Change-Id: I74e278366a2c3b170335738bf6d6ee23933b361a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit be4127d6f747742c714914e1b313186422b438f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 22:33:33 +00:00
Eirik Aavitsland
8c2860672f Filter cosmetic lines using transformed, not world coordinates
Lines smaller than 1e-12 would not be drawn even when scaled up.

Fixes: QTBUG-75630
Change-Id: I8f261876c325b60f61e95ca2e5fde2cb227d4cba
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1549dff04c49aa37333e54f8bc45900d0f35b270)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 22:33:29 +00:00
Alex Blasche
f8d209c0da Fix completely wrong init_class and jar_bundle_native values
This prevented androiddeployqt from properly deploying libraries which
specify init class via the ":" delimiter.

Change-Id: Ib9cfa7edc864d7d540577df22284ceb9714a2511
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit 8cceb04232001e51276f1588d9e67f2c696fbe91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 14:46:43 +00:00
Andrei Golubev
dca5a2ca39 Restore pre-Qt6 QList::fill() behavior
Somehow QList::fill(t, newSize) introduced a regression in Qt6:
when newSize < QList::size() we should resize to the newSize.
This is aligned with QVector::fill() in 5.15 and std::vector::assign()

While 6.0 is already out, picking it to 6.0.x could save someone who
haven't migrated yet as well as fix some accidental bugs in Qt's code

[ChangeLog][QtCore][QList] Fixed QList::fill() regression introduced in
6.0: calling fill() with size < current list size wouldn't truncate the
list

Fixes: QTBUG-91042
Change-Id: Ic166e2c5e42390b61df1030f7c705e344433f7f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 6512a7fc642c65455db770385c67cfa6d71c294c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 14:46:42 +00:00
Assam Boudjelthia
ab9032acbb CMake: always pass QT6_INSTALL_PREFIX to androiddeployqt
Qt CMake uses a fake_prefix as install dir when running tests instead of
the main qt install path, this will throw androiddeployqt off since it
expects the real qt install path which has gradle and java sources.

Fixes: QTBUG-88579
Change-Id: I6580470840ae14d4a4a68a95f217b30408d7ab44
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0d42f4df9275897d708ee01ed879ac185aab7360)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 14:46:39 +00:00
Alex Blasche
0415dca628 Fix typo in android APK generation log
Change-Id: I9e593f35e1c4a51ef2cd4b08fe7e4b7c1a35a5d6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 04eb9b7c3279e7e8c3f6079cc28cee9baea5e944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 14:46:35 +00:00
Alexey Edelev
2be22ecf29 Fix compilation of the QPSQLDriverPlugin plugin with enabled PCH
PostgreSQL package delivers several header files such as pthread, zlib,
zconf, uuid, etc. within Windows installation package. The headers are
exposed to the compiler by PostgreSQL include paths and have different
versions. When compiling PCH of the QPSQLDriverPlugin plugin, MinGW uses
the pthread.h header from the PostgreSQL include paths, that cause an
error related to pthread implementation mismatch.

Disable PCH for the QPSQLDriverPlugin plugin, when using MinGW.

Fixes: QTBUG-90850
Change-Id: I0be91bbefe37731acb2658d679b5b644ef552b23
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 43cb801ccb10e2d9efd230803822761b794fd4fb)
2021-02-10 09:52:48 +00:00
Kai Köhne
fe38ba8cf3 Update name of c++2a to c++20
Keep the c++2a feature, but make it an alias for compatibility
purposes.

Change-Id: I6f153109be84659806f1b7a57a88a187875166d8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3c412c93c251862a2791557881f9232fd76fda79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 09:13:11 +00:00
Assam Boudjelthia
4f2f53dd7f CMake: fix typo in qt_finalize_executable snippet
Task-number: QTBUG-90943
Change-Id: Idea90f1a5fdd2070102ebda85feed79abcba3f70
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ab907053bd7b4c5acc1ddb9220a708b9244f7b0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-10 00:42:37 +00:00
Mitch Curtis
37c6b53217 Doc: link to QScopeGuard in QScopedValueRollback documentation
Change-Id: I02b9960fe37b09bc373ed52dec84b1efc8f43397
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1c2aa56cfa2c5648f05aed912dae2bb3ed5d8951)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 21:59:24 +00:00
Assam Boudjelthia
77b035aa6e Documentation improvements to JNI API
Amends 4e60681c879a54cf5b34862a30e27c492ed36363.

Fixes: QTBUG-89632
Change-Id: I7856e9b63eea5ba68a5472575016540ae656ec5f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 817f8ac03cd4e85b7813b45f8cabf5b679f28702)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 18:23:26 +00:00
Wang Chuan
bbdcc86c52 QPlainTextEdit: adjust scroll bars when showing up
The text of QPlainTextEdit might change when it is invisible, so an
adjustment of scroll bars is needed when the QPlainTextEdit showing
up, otherwise the range of scroll bars might be incorrect.

Fixes: QTBUG-77937
Change-Id: I45c686c7e09ca7b2944c36122e9157de0ec4f0e0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 13ae47d98057c2ddca8c865b845973d7e4c8dd8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 17:52:06 +00:00
Jonas Karlsson
30001fdaf9 QTextureFileData: support key value metadata
Task-Id: QTBUG-76970
Change-Id: I9dba1b373250cea4d0c806997290a7afcdc900d7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2861cfb6f851d7cee503b19f0e800a33374db66c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 17:52:04 +00:00
Topi Reinio
69f267defa Doc: Online CSS: Fix image captions overlapping images used in tables
Fixes: QTBUG-90963
Change-Id: I15c7459246ed6dfa1ad85b732484770babeabfdc
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 222c0ab081251f5249f31b6236ca7b912d303816)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 17:52:03 +00:00
Laszlo Agocs
9fc6a9099e egl: Add debug option to print all EGLConfigs
QT_QPA_EGLFS_DEBUG=1 prints the attributes for the chosen EGLContext.
Make QT_QPA_EGLFS_DEBUG=2 print the same for all EGLContexts.

Change-Id: Id161d04789fbd015e29e5a5a89a0901000096ea3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit d8c771c53acb58cc79cadbb795d59d5e8db7754e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-09 12:12:29 +00:00
Christian Strømme
27337fe242 Android: Fix the input type for date/time
The default variation of the DATETIME class is to show the layout for
date and time. If either date or time is requested, then only set one
of them.

Change-Id: I5178f5f80490b7b0d7e7011d11da402a316d164a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 86e10e1acd34ae4463bb2b0c24b8bdab71c6ade4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 21:02:54 +00:00
Joerg Bornemann
0da2b24991 configure: Fix handling of -translationdir argument
This is supposed to be mapped to INSTALL_TRANSLATIONSDIR, not
INSTALL_TRANSLATIONDIR (without the s).

Fixes: QTBUG-90946
Change-Id: Icec93ffc0dc80d9ac7cf6cf1b13824bc2a1e795f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit b9d1dc43f2764d765caf9fa8102aafea268ed3bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 15:06:41 +00:00
Allan Sandfeld Jensen
ac05ca5072 Handle macOS 11 issues in softHyphens test
Calculate the effective width of the hyphen better, and compare with
ceiled sizes.

Fixes: QTBUG-90698
Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 0ffdbb21261eee3a9ec1cd541478ee883a12065c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 15:06:07 +00:00
Laszlo Agocs
d95069771b eglfs: kms: Log gbm bo handle and stride as well
Change-Id: Ie345a3f4a4ab0407e3c532c6385ae31ca698d628
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3bda970935d4d54c07fa1d6454e2472abff66a77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 15:06:02 +00:00
Assam Boudjelthia
c834aefa77 Fix compiler warnings for QFontMetrics use
Change-Id: I4c416280cef8c316258817184e94962c250370da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d6b9200e329281269ad8c74177f2b2621798ae56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 14:33:22 +00:00
Peter Seiderer
b5ff6da096 CMake/QtAutoDetect: fix failure with multiline toolchain file
The unquoted 'string(FIND ${toolchain_file_content} ...)' call fails for
multiline content of the variable toolchain_file_content, so add
quotes around, fixes:

  [...]
  CMake Error at cmake/QtAutoDetect.cmake:42 (string):
    string sub-command FIND requires 3 or 4 parameters.
  Call Stack (most recent call first):
    cmake/QtAutoDetect.cmake:311 (qt_auto_detect_android)
    CMakeLists.txt:19 (include)
  [...]
  -- Configuring incomplete, errors occurred!

in case the given toolchain file starts with multiple lines
in the first 80 characters, e.g. in the case of buildroot:

  #
  # Automatically generated file; DO NOT EDIT.
  # CMake toolchain file for Buildroot
  #
  [...]

Task-number: QTBUG-90980
Change-Id: I8e038e08d83016e8253f2e83b2efb8f06034c6cd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8aff901f70def69c2ac56754ef4146150e43bf8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-08 12:11:23 +00:00
Timur Pocheptsov
405337ee72 Introduce QSsl::X509Certificate interface and its implementations
To enable QSslCertificate to use TLS plugins. All backend-specific
code is to be moved from QSslCertificate(Private) making them
backend-neutral.

Pick-to: dev
Task-number: QTBUG-90954
Task-number: QTBUG-65922
Change-Id: Ic9d5abf91e42ce81fe56239f95ae97b64035e950
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-07 16:10:18 +01:00
Samuli Piippo
137f5518b8 tst_qtexttable: fix fail on QEMU ARMv7
Different font was used when running on QEMU ARMv7 and the second page
was never reached.

Task-number: QTQAINFRA-4127
Change-Id: Ic85b76661cf3642b69e6e1b21e8062d7c36231e3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d6f00c637d6e12986a42e3c00622e7801b55a5d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 21:09:26 +00:00
Richard Moe Gustavsen
80cc01aeb5 iOS: close edit menu upon focus transfer
If you select text, the edit menu will show.
But if you tap directly inside another input
field, and as such, transfer focus, the menu
will continue to stay visible.

This patch will ensure that we hide the edit
menu when the input field that it was
requested for looses focus.

Fixes: QTBUG-90937
Change-Id: I1d97bd57fc793826a3170404795b06a1e058d1b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 0bae5fbabbb64371b1b6c646ce0a32e084e42f83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 18:48:08 +00:00
Eskil Abrahamsen Blomfeldt
9807573764 Fix crash when requesting A32 glyph on Wayland
On Wayland we aren't getting any information about the subpixel
layout of the screen. On Freetype, this triggers an
assert / memory corruption when explicitly requesting a subpixel
antialiased glyph (via QRawFont) because it needs to know the
layout to render the glyphs.

It might be possible to get this information in the Wayland plugin,
but at least we should have a failsafe which doesn't crash when
the problem occurs. This simply falls back to using A8 antialiasing
when it doesn't know the subpixel layout.

[ChangeLog][Freetype] Fixed crash when calling
QRawFont::alphaMapForGlyph() with subpixel antialiasing on Wayland.

Fixes: QTBUG-90236
Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ef763e195892a6d8ce207f5d947fe508f645cb6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 16:28:53 +00:00
Jan Arve Sæther
fd15b28cf8 a11y: Report mixed state if QCheckBox is PartiallyChecked
Previously it only returned checked or unchecked for a tri-state
checkbox.

Fixes: QTBUG-84616
Change-Id: Ife72098e35f8295fd389bda232de5478ffa7e87f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f4887aca1e5ac7b90abf862d7c9828417a74a1b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 14:36:26 +00:00
Mårten Nordheim
8652493529 QNetworkInformation backend for Android
Based on the old bearer manager code!

A lot of the old code went away though since it had been deprecated
in the time since it was written.

Pick-to: dev
Task-number: QTBUG-86966
Change-Id: I21a6db1d4ebd8367084355a8e3202f4c05d9dce5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-05 14:37:15 +01:00
Mårten Nordheim
677797929d Switch QNetworkInformation manual test back to using qDebug
It turns out QTextStream on Android isn't as easily visible as it is
when going through qDebug (where it can easily be seen with
`adb logcat -v brief libqnetworkinformation_<arch>.so:* -s`)

Pick-to: dev
Change-Id: I3b495d7a3d331fda6cfe602c461107dd1d0b3faf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-05 14:37:12 +01:00
Mårten Nordheim
7860b9e6ff Remove QNetworkStatusMonitor
Since the old code is now fully integrated in QNetworkInformation backends

Pick-to: dev
Change-Id: Ia843d17bb3c98333e8d68752e25722b5860f48e0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-05 14:37:09 +01:00
Mårten Nordheim
309a2360fd SCNetworkReachability based backend for QNetworkInformation
For macOS/iOS. Based on the code Timur wrote for QNetworkStatusMonitor,
and uses QNetworkConnectionMonitor. It has less detail than the other
backends which is unfortunate but should be fine!

Pick-to: dev
Task-number: QTBUG-86966
Change-Id: I0d5930d539f9668f001d6f85c86c9df0803d0f60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-05 11:37:45 +01:00
Mårten Nordheim
6d85e6e45a NetworkManager based backend for QNetworkInformation
For Linux. Based on the code from the old bearer plugin for
NetworkManager with changes to fit better the objective of
QNetworkInformation.

Pick-to: dev
Task-number: QTBUG-86966
Change-Id: I90c3488ff31ef6dfdcfb877c0e9c592c6c328a89
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-05 11:37:40 +01:00
Giuseppe D'Angelo
69912c671b QStandardItem(Model): refactor multiData support
QSI(M) allow users to override their data() functions. This
means that we can't have their data() implemented in terms of
multiData(), or otherwise a subclass that overrides data() will
fall out of sync with its multiData() implementation. We must
keep multiData() implemented in terms of data() instead.

While at it, document QSI::multiData().

Task-number: QTBUG-89423
Change-Id: If30a980d8449135b516745fec73170d53367b4b7
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a1e9817cec5e0dccf26040d0b0d24e974841d5b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-05 02:54:56 +00:00
Richard Moe Gustavsen
76c76d76ec iOS: hide edit menu if typing on the input panel
On iOS, if you select some text, the edit menu will show on
top of it. And if you tap on the screen (or inside the menu) it
will hide. But if you type on the input panel, it will stay
open. This is wrong.

This patch will keep better track of whether or not the edit
menu was opened by us, and if it was, ensure we close it also
if the cursor moves by typing on the input panel.

Fixes: QTBUG-90860
Change-Id: I0a51382030560182e7925c8b694b42e50943514e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b39081230428a9cc08389342c4610d11b2ee210d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-04 15:06:21 +00:00
Assam Boudjelthia
0bde13f33e Android: fix compiler warnings for Android input
QPointingDevice requires using the constructor to set its settings
in Qt 6.

Replace + with | operator and return QKeyCombination instead of int.

Change-Id: Id3da469cc13b34ec7b55afa751dbc04601880df6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4493b90224f575e5570afeb1ec181be5c4e74b09)
2021-02-04 11:39:19 +00:00
Eskil Abrahamsen Blomfeldt
065527825e Remove false Q_UNREACHABLE from shaping code
This was added by 9ff76c27b9031ae7c49c4c9e8b5a3bea1e0e3c78 on
the basis that it signifies a shaping error and would later assert
or crash.

But the line is easily reachable by user code. If Harfbuzz returns
0 glyphs, it just means it is unable to shape the string, for instance
if the input string only contains default ignorables (like a ZWJ)
and does not have any appropriate glyph to use for replacement.

Qt expects there to always be at least one glyph in the output
(num_glyphs == 0 is used to indicate shaping is not yet done), so
to avoid asserts later on, we simply populate the output with a
single 0 token, which is a required entry in the font that is
reserved for representing unrepresentable characters.

This also adds a test and therefore a zero-width joiner to the test
font to reproduce the issue.

[ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts
when shaping strings consisting only of control characters.

Fixes: QTBUG-89155
Change-Id: Ia0dd6a04844c9be90dcab6c464bebe339a3dab11
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
(cherry picked from commit fccd419dd632306a4bd85928223e0a56a59510ef)
2021-02-04 09:10:57 +00:00
Liang Qi
cecf21997b testlib: Only consider major version for macOS 11 and later in blacklists
Change-Id: I9d3f7ca2022b17559dd5bdd5c6bb8c85e89c3f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit faab8f603d2cc34c072ffd0822af68dafcfd686a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-02-03 21:27:47 +00:00
Laszlo Agocs
7a0f2cafaf rhi: gl: Attempt reading back floating point formats
...in the hope that they may work. If not, that's it, but at least we
tried.

Task-number: QTBUG-76970
Change-Id: I134c5cc4cfb5ad1e6f9edbfcf506df20022e127a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit d136299bb83f5343a62f9e02693f6737981edf62)
2021-02-03 16:07:53 +01:00
1425 changed files with 275305 additions and 60769 deletions

View File

@ -1,4 +1,4 @@
set(QT_REPO_MODULE_VERSION "6.1.0")
set(QT_REPO_MODULE_VERSION "6.1.3")
# Minimum requirement for building Qt
set(QT_MIN_SUPPORTED_CMAKE_VERSION "3.16")

View File

@ -6,7 +6,7 @@
#### Libraries
qt_find_package(ZLIB 1.0.8 PROVIDED_TARGETS ZLIB::ZLIB MODULE_NAME global QMAKE_LIB zlib)
qt_find_package(WrapZLIB 1.0.8 PROVIDED_TARGETS WrapZLIB::WrapZLIB MODULE_NAME global QMAKE_LIB zlib)
qt_find_package(ZSTD 1.3 PROVIDED_TARGETS ZSTD::ZSTD 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)
@ -67,12 +67,12 @@ std::visit([](const auto &) { return 1; }, v);
CXX_STANDARD 17
)
# cxx2a
qt_config_compile_test(cxx2a
LABEL "C++2a support"
# cxx20
qt_config_compile_test(cxx20
LABEL "C++20 support"
CODE
"#if __cplusplus > 201703L
// Compiler claims to support experimental C++2a, trust it
// Compiler claims to support C++20, trust it
#else
# error __cplusplus must be > 201703L (the value for C++17)
#endif
@ -450,7 +450,7 @@ qt_feature_definition("developer-build" "QT_BUILD_INTERNAL")
qt_feature_config("developer-build" QMAKE_PUBLIC_QT_CONFIG
NAME "private_tests"
)
qt_feature("debug"
qt_feature("debug" PRIVATE
LABEL "Build for debugging"
AUTODETECT ON
CONDITION CMAKE_BUILD_TYPE STREQUAL Debug OR Debug IN_LIST CMAKE_CONFIGURATION_TYPES
@ -594,10 +594,15 @@ qt_feature("c++1z" PUBLIC
CONDITION QT_FEATURE_cxx17
)
qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++2a"
qt_feature("c++20" PUBLIC
LABEL "C++20"
AUTODETECT OFF
CONDITION QT_FEATURE_cxx17 AND TEST_cxx2a
CONDITION QT_FEATURE_cxx17 AND TEST_cxx20
)
qt_feature_config("c++20" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++20"
CONDITION QT_FEATURE_cxx20
)
qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c89"
@ -668,37 +673,37 @@ qt_feature("sse2" PRIVATE
)
qt_feature_definition("sse2" "QT_COMPILER_SUPPORTS_SSE2" VALUE "1")
qt_feature_config("sse2" QMAKE_PRIVATE_CONFIG)
qt_feature("sse3"
qt_feature("sse3" PRIVATE
LABEL "SSE3"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_sse3
)
qt_feature_definition("sse3" "QT_COMPILER_SUPPORTS_SSE3" VALUE "1")
qt_feature_config("sse3" QMAKE_PRIVATE_CONFIG)
qt_feature("ssse3"
qt_feature("ssse3" PRIVATE
LABEL "SSSE3"
CONDITION QT_FEATURE_sse3 AND TEST_subarch_ssse3
)
qt_feature_definition("ssse3" "QT_COMPILER_SUPPORTS_SSSE3" VALUE "1")
qt_feature_config("ssse3" QMAKE_PRIVATE_CONFIG)
qt_feature("sse4_1"
qt_feature("sse4_1" PRIVATE
LABEL "SSE4.1"
CONDITION QT_FEATURE_ssse3 AND TEST_subarch_sse4_1
)
qt_feature_definition("sse4_1" "QT_COMPILER_SUPPORTS_SSE4_1" VALUE "1")
qt_feature_config("sse4_1" QMAKE_PRIVATE_CONFIG)
qt_feature("sse4_2"
qt_feature("sse4_2" PRIVATE
LABEL "SSE4.2"
CONDITION QT_FEATURE_sse4_1 AND TEST_subarch_sse4_2
)
qt_feature_definition("sse4_2" "QT_COMPILER_SUPPORTS_SSE4_2" VALUE "1")
qt_feature_config("sse4_2" QMAKE_PRIVATE_CONFIG)
qt_feature("avx"
qt_feature("avx" PRIVATE
LABEL "AVX"
CONDITION QT_FEATURE_sse4_2 AND TEST_subarch_avx AND ( NOT ANDROID OR NOT ( TEST_architecture_arch STREQUAL x86_64 ) )
)
qt_feature_definition("avx" "QT_COMPILER_SUPPORTS_AVX" VALUE "1")
qt_feature_config("avx" QMAKE_PRIVATE_CONFIG)
qt_feature("f16c"
qt_feature("f16c" PRIVATE
LABEL "F16C"
CONDITION QT_FEATURE_avx AND TEST_subarch_f16c
)
@ -710,79 +715,79 @@ qt_feature("avx2" PRIVATE
)
qt_feature_definition("avx2" "QT_COMPILER_SUPPORTS_AVX2" VALUE "1")
qt_feature_config("avx2" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512f"
qt_feature("avx512f" PRIVATE
LABEL "F"
CONDITION QT_FEATURE_avx2 AND TEST_subarch_avx512f
)
qt_feature_definition("avx512f" "QT_COMPILER_SUPPORTS_AVX512F" VALUE "1")
qt_feature_config("avx512f" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512er"
qt_feature("avx512er" PRIVATE
LABEL "ER"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512er
)
qt_feature_definition("avx512er" "QT_COMPILER_SUPPORTS_AVX512ER" VALUE "1")
qt_feature_config("avx512er" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512cd"
qt_feature("avx512cd" PRIVATE
LABEL "CD"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512cd
)
qt_feature_definition("avx512cd" "QT_COMPILER_SUPPORTS_AVX512CD" VALUE "1")
qt_feature_config("avx512cd" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512pf"
qt_feature("avx512pf" PRIVATE
LABEL "PF"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512pf
)
qt_feature_definition("avx512pf" "QT_COMPILER_SUPPORTS_AVX512PF" VALUE "1")
qt_feature_config("avx512pf" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512dq"
qt_feature("avx512dq" PRIVATE
LABEL "DQ"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512dq
)
qt_feature_definition("avx512dq" "QT_COMPILER_SUPPORTS_AVX512DQ" VALUE "1")
qt_feature_config("avx512dq" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512bw"
qt_feature("avx512bw" PRIVATE
LABEL "BW"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512bw
)
qt_feature_definition("avx512bw" "QT_COMPILER_SUPPORTS_AVX512BW" VALUE "1")
qt_feature_config("avx512bw" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512vl"
qt_feature("avx512vl" PRIVATE
LABEL "VL"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512vl
)
qt_feature_definition("avx512vl" "QT_COMPILER_SUPPORTS_AVX512VL" VALUE "1")
qt_feature_config("avx512vl" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512ifma"
qt_feature("avx512ifma" PRIVATE
LABEL "IFMA"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512ifma
)
qt_feature_definition("avx512ifma" "QT_COMPILER_SUPPORTS_AVX512IFMA" VALUE "1")
qt_feature_config("avx512ifma" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512vbmi"
qt_feature("avx512vbmi" PRIVATE
LABEL "VBMI"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512vbmi
)
qt_feature_definition("avx512vbmi" "QT_COMPILER_SUPPORTS_AVX512VBMI" VALUE "1")
qt_feature_config("avx512vbmi" QMAKE_PRIVATE_CONFIG)
qt_feature("aesni"
qt_feature("aesni" PRIVATE
LABEL "AES"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_aesni
)
qt_feature_definition("aesni" "QT_COMPILER_SUPPORTS_AES" VALUE "1")
qt_feature_config("aesni" QMAKE_PRIVATE_CONFIG)
qt_feature("rdrnd"
qt_feature("rdrnd" PRIVATE
LABEL "RDRAND"
CONDITION TEST_subarch_rdrnd
)
qt_feature_definition("rdrnd" "QT_COMPILER_SUPPORTS_RDRND" VALUE "1")
qt_feature_config("rdrnd" QMAKE_PRIVATE_CONFIG)
qt_feature("rdseed"
qt_feature("rdseed" PRIVATE
LABEL "RDSEED"
CONDITION TEST_subarch_rdseed
)
qt_feature_definition("rdseed" "QT_COMPILER_SUPPORTS_RDSEED" VALUE "1")
qt_feature_config("rdseed" QMAKE_PRIVATE_CONFIG)
qt_feature("shani"
qt_feature("shani" PRIVATE
LABEL "SHA"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_shani
)
@ -794,19 +799,19 @@ qt_feature("x86SimdAlways"
)
qt_feature_definition("x86SimdAlways" "QT_COMPILER_SUPPORTS_SIMD_ALWAYS" VALUE "1")
qt_feature_config("x86SimdAlways" QMAKE_PRIVATE_CONFIG)
qt_feature("mips_dsp"
qt_feature("mips_dsp" PRIVATE
LABEL "DSP"
CONDITION ( TEST_architecture_arch STREQUAL mips ) AND TEST_arch_${TEST_architecture_arch}_subarch_dsp
)
qt_feature_definition("mips_dsp" "QT_COMPILER_SUPPORTS_MIPS_DSP" VALUE "1")
qt_feature_config("mips_dsp" QMAKE_PRIVATE_CONFIG)
qt_feature("mips_dspr2"
qt_feature("mips_dspr2" PRIVATE
LABEL "DSPr2"
CONDITION ( TEST_architecture_arch STREQUAL mips ) AND TEST_arch_${TEST_architecture_arch}_subarch_dspr2
)
qt_feature_definition("mips_dspr2" "QT_COMPILER_SUPPORTS_MIPS_DSPR2" VALUE "1")
qt_feature_config("mips_dspr2" QMAKE_PRIVATE_CONFIG)
qt_feature("neon"
qt_feature("neon" PRIVATE
LABEL "NEON"
CONDITION ( ( TEST_architecture_arch STREQUAL arm ) OR ( TEST_architecture_arch STREQUAL arm64 ) ) AND TEST_arch_${TEST_architecture_arch}_subarch_neon
)
@ -834,7 +839,7 @@ qt_feature("stack-protector-strong" PRIVATE
)
qt_feature("system-zlib" PRIVATE
LABEL "Using system zlib"
CONDITION ZLIB_FOUND
CONDITION WrapZLIB_FOUND
)
qt_feature("zstd" PRIVATE
LABEL "Zstandard support"
@ -954,7 +959,7 @@ qt_configure_add_summary_entry(
)
qt_configure_add_summary_entry(
TYPE "firstAvailableFeature"
ARGS "c++2a c++17 c++14 c++11"
ARGS "c++20 c++17 c++14 c++11"
MESSAGE "Using C++ standard"
)
qt_configure_add_summary_entry(

View File

@ -6,4 +6,4 @@ DEFINES += QT_NO_JAVA_STYLE_ITERATORS
QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD)
MODULE_VERSION = 6.1.0
MODULE_VERSION = 6.1.3

View File

@ -25,7 +25,7 @@ qt_internal_check_for_suitable_cmake_version()
# Run auto detection routines, but not when doing standalone tests. In that case, the detection
# results are taken from either QtBuildInternals or the qt.toolchain.cmake file. Also, inhibit
# auto-detection in a top-level build, because the top-level project file already includes it.
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_SUPER_BUILD)
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_SUPERBUILD)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtAutoDetect.cmake)
endif()
@ -39,6 +39,9 @@ project(QtBase
# Make sure we only use latest private CMake API, aka no compatibility wrappers.
set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE)
# Make sure we use the fixed BASE argument of qt_add_resource.
set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
if(NOT QT_BUILD_STANDALONE_TESTS)
## Add some paths to check for cmake modules:
list(PREPEND CMAKE_MODULE_PATH
@ -50,6 +53,9 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
if(MACOS)
# Add module directory to pick up custom Info.plist template
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos")
elseif(IOS)
# Add module directory to pick up custom Info.plist template
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ios")
endif()
## Find the build internals package.
@ -71,9 +77,16 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
option(BUILD_SHARED_LIBS "Build Qt statically or dynamically" ON)
set(QT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
# This variable is also set in Qt6CoreConfigExtras.cmake, but it's not loaded when building
# qtbase. Set it here so qt_add_plugin can compute the proper plugin flavor.
set(QT6_IS_SHARED_LIBS_BUILD ${BUILD_SHARED_LIBS})
## Should this Qt be built with Werror?
option(WARNINGS_ARE_ERRORS "Build Qt with warnings as errors" ${FEATURE_developer_build})
## Should this Qt create versioned hard link for some tools?
option(QT_CREATE_VERSIONED_HARD_LINK "Enable the use of versioned hard link" ON)
## QtBase specific configure tests:
include(QtBaseConfigureTests)
@ -92,7 +105,10 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
include(src/corelib/Qt6CoreMacros.cmake)
# Needed when building qtbase for android.
include(src/corelib/Qt6AndroidMacros.cmake)
if(ANDROID)
include(src/corelib/Qt6AndroidMacros.cmake)
_qt_internal_create_global_apk_target()
endif()
# Set up optimization flags like in qmake.
# This function must be called after the global QT_FEATURE_xxx variables have been set up,

View File

@ -1,9 +0,0 @@
INSTALLING Qt Source Package Version %VERSION%.
For instructions on building and installing Qt for each supported platform,
please see http://doc.qt.io/qt-%SHORTVERSION%/build-sources.html,
or follow one of these links:
Mac OS X: http://doc.qt.io/qt-%SHORTVERSION%/osx-building.html
Windows: http://doc.qt.io/qt-%SHORTVERSION%/windows-building.html
X11 Platforms: http://doc.qt.io/qt-%SHORTVERSION%/linux-building.html

View File

@ -1,179 +0,0 @@
#!/usr/bin/env perl
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the porting tools of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 3 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL3 included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 3 requirements
## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 2.0 or (at your option) the GNU General
## Public license version 3 or any later version approved by the KDE Free
## Qt Foundation. The licenses are as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-2.0.html and
## https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
use Cwd;
use File::Find;
use File::Spec;
use IO::File;
use Getopt::Long;
use strict;
use warnings;
my $dry_run = 0;
my $help = 0;
my $stripModule = 0;
my $fixedFileCount = 0;
my $fileCount = 0;
my $verbose = 0;
my $qtdir;
my $qtIncludeDir;
my $USAGE=<<EOF;
This script replaces all Qt 4 style includes with Qt 5 includes.
Usage: $0 [options]
Options:
--dry-run : Do not replace anything, just print what would be replaced
--strip-modules : Strip the module headers for writing portable code
--verbose : Verbose
--qtdir <directory> : Point to Qt 5's qtbase directory
EOF
if (!GetOptions('dry-run' => \$dry_run, 'help' => \$help,
'strip-modules' => \$stripModule, 'verbose' => \$verbose, 'qtdir:s' => \$qtdir)
|| $help) {
print $USAGE;
exit (1);
}
my %headerSubst = ();
my $cwd = getcwd();
sub fixHeaders
{
my $fileName = $File::Find::name;
my $relFileName = File::Spec->abs2rel($fileName, $cwd);
# only check sources, also ignore symbolic links and directories
return unless -f $fileName && $fileName =~ /(\.h|\.cpp|\/C|\.cc|\.CC)$/;
my $inFile = new IO::File('<' . $fileName) or die ('Unable to open ' . $fileName . ': ' . $!);
$fileCount++;
my @affectedClasses;
my @outLines;
while (my $line = <$inFile>) {
if ($line =~ /^#(\s*)include(\s*)<.*?\/(.*?)>(.*)/) {
my $newHeader = $headerSubst{$3};
if ($newHeader) {
$line = '#' . $1 . 'include' . $2 . '<' . $newHeader . '>' . $4 . "\n";
push(@affectedClasses, $3);
}
} elsif ($line =~ /^#(\s*)include(\s*)<QtGui>(.*)/) {
$line = '#' . $1 . 'include' . $2 . '<QtWidgets>' . $3 . "\n";
push(@affectedClasses, 'QtGui');
}
push(@outLines, $line);
}
$inFile->close();
if (scalar(@affectedClasses)) {
$fixedFileCount++;
print $relFileName, ': ', join(', ', @affectedClasses), "\n" if ($verbose || $dry_run);
if (!$dry_run) {
my $outFile = new IO::File('>' . $fileName) or die ('Unable to open ' . $fileName . ': ' . $!);
map { print $outFile $_; } @outLines;
$outFile->close();
}
} else {
print $relFileName, ": no modification.\n" if ($verbose || $dry_run);
}
}
sub findQtHeaders
{
my ($dirName,$includeDir) = @_;
local (*DIR);
my $moduleIncludeDir = $includeDir . '/' . $dirName;
opendir(DIR, $moduleIncludeDir) || die ('Unable to open ' . $moduleIncludeDir . ': ' . $!);
my @headers = readdir(DIR);
closedir(DIR);
foreach my $header (@headers) {
next if (-d ($moduleIncludeDir . '/' . $header) || $header =~ /\.pri$/);
$headerSubst{$header} = $stripModule ? $header : ($dirName . '/' . $header);
}
}
# -------- MAIN
if ($qtdir) {
$qtIncludeDir = $qtdir . '/include';
} else {
$qtIncludeDir = `qmake -query QT_INSTALL_HEADERS`;
chop($qtIncludeDir);
}
die "The location of the Qt 5 include files could not be determined.\n"
."Please ensure qmake can be found in PATH or pass the command line option --qtdir.\n"
unless -d $qtIncludeDir;
findQtHeaders('QtCore', $qtIncludeDir);
findQtHeaders('QtConcurrent', $qtIncludeDir);
findQtHeaders('QtWidgets', $qtIncludeDir);
findQtHeaders('QtPrintSupport', $qtIncludeDir);
if (-d $qtIncludeDir . '/include/QtMultimedia') {
findQtHeaders('QtMultimedia', $qtIncludeDir);
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtmultimedia' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtMultimedia', $qtIncludeDir . '/../qtmultimedia');
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir . '/../qtmultimedia');
}
# Support porting from "Qt 4.99" QtDeclarative to QtQuick (QQuickItem et al)
if (-d $qtIncludeDir . '/include/QtQuick') {
findQtHeaders('QtQuick', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtdeclarative' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtQuick', $qtIncludeDir . '/../qtdeclarative');
}
# special case
$headerSubst{'QtGui'} = 'QtWidgets/QtWidgets';
find({ wanted => \&fixHeaders, no_chdir => 1}, $cwd);
print 'Done. ', ($dry_run ? 'Checked' : 'Modified'), ' ', $fixedFileCount, ' of ', $fileCount, " file(s).\n";

View File

@ -1,4 +1,4 @@
@__qt_cmake_standalone_test_os_prelude@
@__qt_cmake_standalone_test_script_relpath@
@__qt_cmake_private_relpath@ @__qt_cmake_standalone_test_relpath@ -DQT_STANDALONE_TEST_PATH=@__qt_cmake_standalone_passed_args@
@__qt_cmake_private_relpath@ @__qt_cmake_standalone_test_relpath@ -DQT_BUILD_STANDALONE_TESTS=ON -DQT_STANDALONE_TEST_PATH=@__qt_cmake_standalone_passed_args@

View File

@ -60,9 +60,9 @@ find_package_handle_standard_args(GLESv2 DEFAULT_MSG ${package_args})
mark_as_advanced(${package_args})
if(GLESv2_FOUND AND NOT TARGET GLESv2::GLESv2)
if(EMSCRIPTEN OR UIKIT)
if(EMSCRIPTEN OR IOS)
add_library(GLESv2::GLESv2 INTERFACE IMPORTED)
if(UIKIT)
if(IOS)
# For simulator_and_device builds we can't specify the full library path, because
# it's specific to either the device or the simulator. Resort to passing a link
# flag instead.

View File

@ -30,10 +30,10 @@ int main(int, char **)
check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC)
if(NOT HAVE_STDATOMIC)
set(_req_libraries "${CMAKE_REQUIRE_LIBRARIES}")
set(CMAKE_REQUIRE_LIBRARIES "atomic")
set(_req_libraries "${CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "atomic")
check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC_WITH_LIB)
set(CMAKE_REQUIRE_LIBRARIES "${_req_libraries}")
set(CMAKE_REQUIRED_LIBRARIES "${_req_libraries}")
endif()
add_library(WrapAtomic::WrapAtomic INTERFACE IMPORTED)

View File

@ -39,5 +39,59 @@ else()
target_link_libraries(WrapBrotli::WrapBrotliCommon INTERFACE PkgConfig::libbrotlicommon)
set(WrapBrotli_FOUND ON)
endif()
else()
find_path(BROTLI_INCLUDE_DIR NAMES "brotli/decode.h")
foreach(lib_name BrotliDec BrotliEnc BrotliCommon)
string(TOLOWER ${lib_name} lower_lib_name)
find_library(${lib_name}_LIBRARY_RELEASE
NAMES ${lower_lib_name} ${lower_lib_name}-static)
find_library(${lib_name}_LIBRARY_DEBUG
NAMES ${lower_lib_name}d ${lower_lib_name}-staticd
${lower_lib_name} ${lower_lib_name}-static)
include(SelectLibraryConfigurations)
select_library_configurations(${lib_name})
if (BROTLI_INCLUDE_DIR AND ${lib_name}_LIBRARY)
set(${lib_name}_FOUND TRUE)
endif()
if (${lib_name}_FOUND AND NOT TARGET WrapBrotli::Wrap${lib_name})
add_library(WrapBrotli::Wrap${lib_name} UNKNOWN IMPORTED)
set_target_properties(WrapBrotli::Wrap${lib_name} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}"
IMPORTED_LOCATION "${${lib_name}_LIBRARY}")
if(${lib_name}_LIBRARY_RELEASE)
foreach(config_name RELEASE RELWITHDEBINFO MINSIZEREL)
set_property(TARGET WrapBrotli::Wrap${lib_name} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${config_name})
set_target_properties(WrapBrotli::Wrap${lib_name} PROPERTIES
IMPORTED_LOCATION_${config_name} "${${lib_name}_LIBRARY_RELEASE}")
endforeach()
endif()
if(${lib_name}_LIBRARY_DEBUG)
set_property(TARGET WrapBrotli::Wrap${lib_name} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(WrapBrotli::Wrap${lib_name} PROPERTIES
IMPORTED_LOCATION_DEBUG "${${lib_name}_LIBRARY_DEBUG}")
endif()
endif()
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WrapBrotli REQUIRED_VARS
BrotliDec_FOUND BrotliEnc_FOUND BrotliCommon_FOUND)
if (WrapBrotli_FOUND)
set_property(TARGET WrapBrotli::WrapBrotliDec APPEND PROPERTY
INTERFACE_LINK_LIBRARIES WrapBrotli::WrapBrotliCommon)
set_property(TARGET WrapBrotli::WrapBrotliEnc APPEND PROPERTY
INTERFACE_LINK_LIBRARIES WrapBrotli::WrapBrotliCommon)
endif()
endif()
endif()

View File

@ -18,7 +18,7 @@ if(OpenSSL_FOUND)
else()
set(writableLib OpenSSL::Crypto)
endif()
target_link_libraries(${writableLib} INTERFACE Ws2_32 Crypt32)
set_property(TARGET ${writableLib} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Ws2_32 Crypt32)
unset(libType)
unset(writableLib)
endif()

29
cmake/FindWrapZLIB.cmake Normal file
View File

@ -0,0 +1,29 @@
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET WrapZLIB::WrapZLIB)
set(WrapZLIB_FOUND ON)
return()
endif()
set(WrapZLIB_FOUND OFF)
find_package(ZLIB ${WrapZLIB_FIND_VERSION})
if(ZLIB_FOUND)
set(WrapZLIB_FOUND ON)
add_library(WrapZLIB::WrapZLIB INTERFACE IMPORTED)
if(APPLE)
# On Darwin platforms FindZLIB sets IMPORTED_LOCATION to the absolute path of the library
# within the framework. This ends up as an absolute path link flag, which we don't want,
# because that makes our .prl files un-relocatable and also breaks iOS simulator_and_device
# SDK switching in Xcode.
# Just pass a linker flag instead.
target_link_libraries(WrapZLIB::WrapZLIB INTERFACE "-lz")
else()
target_link_libraries(WrapZLIB::WrapZLIB INTERFACE ZLIB::ZLIB)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WrapZLIB DEFAULT_MSG WrapZLIB_FOUND)

View File

@ -19,7 +19,7 @@ function(qt_internal_add_cmake_library target)
set(is_static_lib 1)
elseif(${arg_SHARED})
add_library("${target}" SHARED)
qt_internal_apply_win_prefix_and_suffix("${target}")
_qt_internal_apply_win_prefix_and_suffix("${target}")
elseif(${arg_MODULE})
add_library("${target}" MODULE)
set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default)
@ -32,7 +32,7 @@ function(qt_internal_add_cmake_library target)
# but Qt plugins are actually suffixed with .dylib.
set_property(TARGET "${target}" PROPERTY SUFFIX ".dylib")
endif()
qt_internal_apply_win_prefix_and_suffix("${target}")
_qt_internal_apply_win_prefix_and_suffix("${target}")
else()
add_library("${target}")
if(NOT BUILD_SHARED_LIBS)
@ -175,17 +175,6 @@ function(qt_internal_add_3rdparty_library target)
qt_autogen_tools_initial_setup(${target})
endif()
if(NOT arg_INTERFACE)
# This property is used for super builds with static libraries. We use
# it in QtPlugins.cmake.in to avoid "polluting" the dependency chain
# for the target in it's project directory.
# E.g: When we process find_package(Qt6 ... Gui) in QtDeclarative, the
# rules in QtPugins.cmake add all the known Gui plugins as interface
# dependencies. This in turn causes circular dependencies on every
# plugin which links against Gui. Plugin A -> GUI -> Plugin A ....
set_target_properties(${target} PROPERTIES QT_BUILD_PROJECT_NAME ${PROJECT_NAME})
endif()
if(NOT arg_EXCEPTIONS AND NOT arg_INTERFACE)
qt_internal_set_exceptions_flags("${target}" FALSE)
elseif(arg_EXCEPTIONS)
@ -286,8 +275,8 @@ function(qt_install_3rdparty_library_wrap_config_extra_file target)
set(use_bundled "OFF")
endif()
set(QT_USE_BUNDLED_${target} "${use_bundled}" CACHE BOOL "" FORCE)
set(extra_cmake_code "set(QT_USE_BUNDLED_${target} ${use_bundled} CACHE BOOL \"\" FORCE)")
set(QT_USE_BUNDLED_${target} "${use_bundled}" CACHE INTERNAL "")
set(extra_cmake_code "set(QT_USE_BUNDLED_${target} ${use_bundled} CACHE INTERNAL \"\")")
configure_file(
"${QT_CMAKE_DIR}/QtFindWrapConfigExtra.cmake.in"
"${QT_CONFIG_BUILD_DIR}/${INSTALL_CMAKE_NAMESPACE}/FindWrap${target}ConfigExtra.cmake"

View File

@ -8,7 +8,7 @@ define_property(TARGET
BRIEF_DOCS
"Recorded install location for a Qt Module."
FULL_DOCS
"Recorded install location for a Qt Module. Used by qt_android_dependencies()."
"Recorded install location for a Qt Module. Used by qt_internal_android_dependencies()."
)
@ -65,42 +65,36 @@ define_property(TARGET
FULL_DOCS
"Qt Module android permission list."
)
# Generate Qt Module -android-dependencies.xml required by the
# androiddeploytoolqt to successfully copy all the plugins and other dependent
# items into tha APK
function(qt_android_dependencies target)
get_target_property(target_type "${target}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
return()
endif()
define_property(TARGET
PROPERTY
QT_ANDROID_FEATURES
BRIEF_DOCS
"Qt Module android feature list."
FULL_DOCS
"Qt Module android feature list."
)
function(qt_internal_android_dependencies_content target file_content_out)
get_target_property(arg_JAR_DEPENDENCIES ${target} QT_ANDROID_JAR_DEPENDENCIES)
get_target_property(arg_BUNDLED_JAR_DEPENDENCIES ${target} QT_ANDROID_BUNDLED_JAR_DEPENDENCIES)
get_target_property(arg_LIB_DEPENDENCIES ${target} QT_ANDROID_LIB_DEPENDENCIES)
get_target_property(arg_LIB_DEPENDENCY_REPLACEMENTS ${target} QT_ANDROID_LIB_DEPENDENCY_REPLACEMENTS)
get_target_property(arg_BUNDLED_FILES ${target} QT_ANDROID_BUNDLED_FILES)
get_target_property(arg_PERMISSIONS ${target} QT_ANDROID_PERMISSIONS)
get_target_property(module_plugins ${target} MODULE_PLUGIN_TYPES)
get_target_property(arg_FEATURES ${target} QT_ANDROID_FEATURES)
if ((NOT module_plugins)
AND (NOT arg_JAR_DEPENDENCIES)
AND (NOT arg_LIB_DEPENDENCY_REPLACEMENTS)
AND (NOT arg_LIB_DEPENDENCIES)
if ((NOT arg_JAR_DEPENDENCIES)
AND (NOT arg_BUNDLED_JAR_DEPENDENCIES)
AND (NOT arg_LIB_DEPENDENCIES)
AND (NOT arg_LIB_DEPENDENCY_REPLACEMENTS)
AND (NOT arg_BUNDLED_FILES)
AND (NOT arg_PERMISSIONS)
AND (NOT arg_BUNDLED_FILES))
AND (NOT arg_FEATURES))
# None of the values were set, so there's nothing to do
return()
endif()
get_target_property(target_output_name ${target} OUTPUT_NAME)
if (NOT target_output_name)
set(target_name ${target})
else()
set(target_name ${target_output_name})
endif()
# mimic qmake's section and string splitting from
# mkspecs/feature/qt_android_deps.prf
macro(section string delimiter first second)
@ -115,10 +109,7 @@ function(qt_android_dependencies target)
endif()
endmacro()
set(dependency_file "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/${target_name}_${CMAKE_ANDROID_ARCH_ABI}-android-dependencies.xml")
set(file_contents "<rules><dependencies>\n")
string(APPEND file_contents "<lib name=\"${target_name}_${CMAKE_ANDROID_ARCH_ABI}\"><depends>\n")
set(file_contents "")
# Jar Dependencies
if(arg_JAR_DEPENDENCIES)
@ -135,11 +126,11 @@ function(qt_android_dependencies target)
# Bundled Jar Dependencies
if(arg_BUNDLED_JAR_DEPENDENCIES)
foreach(jar_bundle IN LISTS arg_BUNDLED_JAR_DEPENDENCIES)
section(${jar_bundle} ":" bundle_file init_calss)
section(${jar_bundle} ":" bundle_file init_class)
if (init_class)
set(init_class "initClass=\"${init_class}\"")
endif()
file(TO_NATIVE_PATH ${jar_bundle} jar_bundle_native)
file(TO_NATIVE_PATH ${bundle_file} jar_bundle_native)
string(APPEND file_contents "<jar bundling=\"1\" file=\"${jar_bundle_native}\" ${init_class} />\n")
endforeach()
endif()
@ -171,7 +162,6 @@ function(qt_android_dependencies target)
endforeach()
endif()
# Bundled files
if(arg_BUNDLED_FILES)
foreach(bundled_file IN LISTS arg_BUNDLED_FILES)
@ -180,13 +170,6 @@ function(qt_android_dependencies target)
endforeach()
endif()
# Module plugins
if(module_plugins)
foreach(plugin IN LISTS module_plugins)
string(APPEND file_contents "<bundled file=\"plugins/${plugin}\" />\n")
endforeach()
endif()
# Android Permissions
if(arg_PERMISSIONS)
foreach(permission IN LISTS arg_PERMISSIONS)
@ -194,13 +177,74 @@ function(qt_android_dependencies target)
endforeach()
endif()
string(APPEND file_contents "</depends></lib>")
string(APPEND file_contents "</dependencies></rules>\n")
# Android Features
if(arg_FEATURES)
foreach(feature IN LISTS arg_FEATURES)
string(APPEND file_contents "<feature name=\"${feature}\" />\n")
endforeach()
endif()
set(${file_content_out} ${file_contents} PARENT_SCOPE)
endfunction()
# Generate Qt Module -android-dependencies.xml required by the
# androiddeploytoolqt to successfully copy all the plugins and other dependent
# items into the APK
function(qt_internal_android_dependencies target)
get_target_property(target_type "${target}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
return()
endif()
# Get plugins for the current module
get_target_property(module_plugin_types ${target} MODULE_PLUGIN_TYPES)
# Get depends for the current module
qt_internal_android_dependencies_content(${target} file_contents)
# Get plugins from the module's plugin types and get their dependencies
foreach(plugin ${QT_KNOWN_PLUGINS})
get_target_property(iter_known_plugin_type ${plugin} QT_PLUGIN_TYPE)
foreach(plugin_type ${module_plugin_types})
if (plugin_type STREQUAL iter_known_plugin_type)
qt_internal_android_dependencies_content(${plugin} plugin_file_contents)
string(APPEND file_contents ${plugin_file_contents})
endif()
endforeach()
endforeach()
if ((NOT module_plugin_types)
AND (NOT file_contents))
# None of the values were set, so there's nothing to do
return()
endif()
get_target_property(target_output_name ${target} OUTPUT_NAME)
if (NOT target_output_name)
set(target_name ${target})
else()
set(target_name ${target_output_name})
endif()
string(PREPEND file_contents "<lib name=\"${target_name}_${CMAKE_ANDROID_ARCH_ABI}\"><depends>\n")
string(PREPEND file_contents "<rules><dependencies>\n")
# Module plugins
if(module_plugin_types)
foreach(plugin IN LISTS module_plugin_types)
string(APPEND file_contents "<bundled file=\"plugins/${plugin}\" />\n")
endforeach()
endif()
string(APPEND file_contents "</depends></lib>\n")
string(APPEND file_contents "</dependencies></rules>")
qt_path_join(dependency_file "${QT_BUILD_DIR}" "${INSTALL_LIBDIR}" "${target_name}_${CMAKE_ANDROID_ARCH_ABI}-android-dependencies.xml")
file(WRITE ${dependency_file} ${file_contents})
get_target_property(target_install_dir ${target} QT_ANDROID_MODULE_INSTALL_DIR)
if (NOT target_install_dir)
message(SEND_ERROR "qt_android_dependencies: Target ${target} is either not a Qt Module or has no recorded install location")
message(SEND_ERROR "qt_internal_android_dependencies: Target ${target} is either not a Qt Module or has no recorded install location")
return()
endif()

View File

@ -3,7 +3,7 @@
function(qt_internal_add_app target)
qt_parse_all_arguments(arg
"qt_internal_add_app"
"NO_INSTALL"
"NO_INSTALL;INSTALL_VERSIONED_LINK"
"${__default_target_info_args}"
"${__default_private_args}"
${ARGN})
@ -49,6 +49,14 @@ function(qt_internal_add_app target)
# if CONFIG += console was encountered during conversion.
set_target_properties("${target}" PROPERTIES WIN32_EXECUTABLE TRUE)
# Consider every app as user facing tool.
set_property(GLOBAL APPEND PROPERTY QT_USER_FACING_TOOL_TARGETS ${target})
# Install versioned link if requested.
if(NOT arg_NO_INSTALL AND arg_INSTALL_VERSIONED_LINK)
qt_internal_install_versioned_link("${INSTALL_BINDIR}" ${target})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_app ${target})
endfunction()

View File

@ -39,7 +39,7 @@ function(qt_auto_detect_android)
if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID)
file(READ ${CMAKE_TOOLCHAIN_FILE} toolchain_file_content OFFSET 0 LIMIT 80)
string(FIND ${toolchain_file_content} "The Android Open Source Project" find_result REVERSE)
string(FIND "${toolchain_file_content}" "The Android Open Source Project" find_result REVERSE)
if (NOT ${find_result} EQUAL -1)
set(android_detected TRUE)
else()
@ -268,11 +268,11 @@ function(qt_auto_detect_darwin)
# macOS
set(version "10.14")
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(version "12.0")
set(version "13.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
set(version "5.0")
set(version "6.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
set(version "12.0")
set(version "13.0")
endif()
if(version)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${version}" CACHE STRING "${description}")

View File

@ -238,6 +238,11 @@ if(MACOS)
cmake/macos/MacOSXBundleInfo.plist.in
DESTINATION "${__GlobalConfig_install_dir}/macos"
)
elseif(IOS)
qt_copy_or_install(FILES
cmake/ios/MacOSXBundleInfo.plist.in
DESTINATION "${__GlobalConfig_install_dir}/ios"
)
endif()
# Install CI support files to libexec.

View File

@ -252,7 +252,7 @@ set(CMAKE_INSTALL_RPATH "" CACHE STRING "RPATH for installed binaries")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
function(qt_setup_tool_path_command)
if(NOT WIN32)
if(NOT CMAKE_HOST_WIN32)
return()
endif()
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
@ -331,21 +331,30 @@ else()
set(QT_QMAKE_HOST_MKSPEC "${QT_QMAKE_TARGET_MKSPEC}")
endif()
# Platform definition dir provided by user on command line.
# Derive the absolute one relative to the current source dir.
if(QT_PLATFORM_DEFINITION_DIR)
set(QT_DEFAULT_PLATFORM_DEFINITION_DIR "${QT_PLATFORM_DEFINITION_DIR}")
get_filename_component(
QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE
"${QT_PLATFORM_DEFINITION_DIR}"
ABSOLUTE)
elseif(QT_QMAKE_TARGET_MKSPEC)
# Used by consumers of prefix builds via INSTALL_INTERFACE (relative path).
set(QT_DEFAULT_PLATFORM_DEFINITION_DIR "${INSTALL_MKSPECSDIR}/${QT_QMAKE_TARGET_MKSPEC}")
# Used by qtbase itself and consumers of non-prefix builds via BUILD_INTERFACE (absolute path).
set(QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE "${QT_MKSPECS_DIR}/${QT_QMAKE_TARGET_MKSPEC}")
# Used by consumers of prefix builds via INSTALL_INTERFACE (relative path).
set(QT_DEFAULT_PLATFORM_DEFINITION_DIR "${INSTALL_MKSPECSDIR}/${QT_QMAKE_TARGET_MKSPEC}")
# Used by qtbase in prefix builds via BUILD_INTERFACE
set(QT_PLATFORM_DEFINITION_BUILD_INTERFACE_BASE_DIR
"${CMAKE_CURRENT_LIST_DIR}/../mkspecs/"
)
# Used by qtbase and consumers in non-prefix builds via BUILD_INTERFACE
if(NOT QT_WILL_INSTALL)
set(QT_PLATFORM_DEFINITION_BUILD_INTERFACE_BASE_DIR
"${QT_BUILD_DIR}/${INSTALL_MKSPECSDIR}"
)
endif()
get_filename_component(QT_PLATFORM_DEFINITION_BUILD_INTERFACE_DIR
"${QT_PLATFORM_DEFINITION_BUILD_INTERFACE_BASE_DIR}/${QT_QMAKE_TARGET_MKSPEC}"
ABSOLUTE
)
set(QT_PLATFORM_DEFINITION_BUILD_INTERFACE_DIR
"${QT_PLATFORM_DEFINITION_BUILD_INTERFACE_DIR}"
CACHE INTERNAL "Path to directory that contains qplatformdefs.h"
)
if(NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS)
set(QT_DEFAULT_PLATFORM_DEFINITIONS "")
endif()
@ -354,8 +363,7 @@ set(QT_PLATFORM_DEFINITIONS ${QT_DEFAULT_PLATFORM_DEFINITIONS}
CACHE STRING "Qt platform specific pre-processor defines")
set(QT_PLATFORM_DEFINITION_DIR "${QT_DEFAULT_PLATFORM_DEFINITION_DIR}"
CACHE PATH "Path to directory that contains qplatformdefs.h")
set(QT_PLATFORM_DEFINITION_DIR_ABSOLUTE "${QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE}"
CACHE INTERNAL "Path to directory that contains qplatformdefs.h")
set(QT_NAMESPACE "" CACHE STRING "Qt Namespace")
if(QT_NAMESPACE STREQUAL "")
set(QT_HAS_NAMESPACE OFF)
@ -411,37 +419,65 @@ endif()
# Needed for qt_internal_add_link_flags_no_undefined.
include(CheckCXXSourceCompiles)
set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_BASENAME;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_BASENAME;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES;COMPILE_OPTIONS;LINK_OPTIONS;MOC_OPTIONS;DISABLE_AUTOGEN_TOOLS;ENABLE_AUTOGEN_TOOLS;PLUGIN_TYPES")
set(__default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES;PUBLIC_COMPILE_OPTIONS;PUBLIC_LINK_OPTIONS")
set(__default_private_module_args "PRIVATE_MODULE_INTERFACE")
set(__default_target_info_args TARGET_VERSION TARGET_PRODUCT TARGET_DESCRIPTION TARGET_COMPANY
TARGET_COPYRIGHT)
# Collection of qt_add_plugin arguments so they can be shared across different
# plugin type wrappers
set(__qt_add_plugin_optional_args
"STATIC;EXCEPTIONS;ALLOW_UNDEFINED_SYMBOLS"
set(__default_private_args
SOURCES
LIBRARIES
INCLUDE_DIRECTORIES
DEFINES
DBUS_ADAPTOR_BASENAME
DBUS_ADAPTOR_FLAGS
DBUS_ADAPTOR_SOURCES
DBUS_INTERFACE_BASENAME
DBUS_INTERFACE_FLAGS
DBUS_INTERFACE_SOURCES
FEATURE_DEPENDENCIES
COMPILE_OPTIONS
LINK_OPTIONS
MOC_OPTIONS
DISABLE_AUTOGEN_TOOLS
ENABLE_AUTOGEN_TOOLS
PLUGIN_TYPES
)
set(__qt_add_plugin_single_args
"TYPE;CLASS_NAME;OUTPUT_DIRECTORY;INSTALL_DIRECTORY;ARCHIVE_INSTALL_DIRECTORY;QML_TARGET_PATH;OUTPUT_NAME"
${__default_target_info_args}
set(__default_public_args
PUBLIC_LIBRARIES
PUBLIC_INCLUDE_DIRECTORIES
PUBLIC_DEFINES
PUBLIC_COMPILE_OPTIONS
PUBLIC_LINK_OPTIONS
)
set(__qt_add_plugin_multi_args
"${__default_private_args};${__default_public_args};DEFAULT_IF"
set(__default_private_module_args
PRIVATE_MODULE_INTERFACE
)
set(__default_target_info_args
TARGET_VERSION
TARGET_PRODUCT
TARGET_DESCRIPTION
TARGET_COMPANY
TARGET_COPYRIGHT
)
# Collection of arguments so they can be shared across qt_internal_add_executable
# and qt_internal_add_test_helper.
set(__qt_internal_add_executable_optional_args
"GUI;BOOTSTRAP;NO_QT;NO_INSTALL;EXCEPTIONS;DELAY_RC;DELAY_TARGET_INFO;QT_APP"
GUI
BOOTSTRAP
NO_QT
NO_INSTALL
EXCEPTIONS
DELAY_RC
DELAY_TARGET_INFO
QT_APP
)
set(__qt_internal_add_executable_single_args
"OUTPUT_DIRECTORY;INSTALL_DIRECTORY;VERSION"
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
VERSION
${__default_target_info_args}
)
set(__qt_internal_add_executable_multi_args
"EXE_FLAGS;${__default_private_args};${__default_public_args}"
EXE_FLAGS
${__default_private_args}
${__default_public_args}
)
option(QT_CMAKE_DEBUG_EXTEND_TARGET "Debug extend_target calls in Qt's build system" OFF)
@ -483,6 +519,43 @@ if(ANDROID)
include(QtAndroidHelpers)
endif()
# TODO: This block provides support for old variables. It should be removed once
# we remove all references to these variables in other Qt module repos.
# Prefer to use the provided commands to retrieve the relevant things instead.
# We won't have the queried command when we get here for qtbase (it is
# provided by the Core module), but we will for all other repos (which
# is all we need).
if(COMMAND _qt_internal_get_add_plugin_keywords)
_qt_internal_get_add_plugin_keywords(
__qt_public_add_plugin_option_args
__qt_public_add_plugin_single_args
__qt_public_add_plugin_multi_args
)
qt_internal_get_internal_add_plugin_keywords(
__qt_internal_add_plugin_option_args
__qt_internal_add_plugin_single_args
__qt_internal_add_plugin_multi_args
)
set(__qt_add_plugin_optional_args
${__qt_public_add_plugin_option_args}
${__qt_internal_add_plugin_option_args}
)
set(__qt_add_plugin_single_args
${__qt_public_add_plugin_single_args}
${__qt_internal_add_plugin_single_args}
)
set(__qt_add_plugin_multi_args
${__qt_public_add_plugin_multi_args}
${__qt_internal_add_plugin_multi_args}
)
unset(__qt_public_add_plugin_option_args)
unset(__qt_public_add_plugin_single_args)
unset(__qt_public_add_plugin_multi_args)
unset(__qt_internal_add_plugin_option_args)
unset(__qt_internal_add_plugin_single_args)
unset(__qt_internal_add_plugin_multi_args)
endif()
# This sets up the poor man's scope finalizer mechanism.
# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
if(CMAKE_VERSION VERSION_LESS "3.19.0")

View File

@ -1,11 +1,49 @@
# These values should be kept in sync with those in qtbase/.cmake.conf
cmake_minimum_required(VERSION 3.14...3.19)
######################################
###############################################
#
# Macros for building Qt modules
# Macros and functions for building Qt modules
#
######################################
###############################################
# Recursively reads the dependencies section from dependencies.yaml in ${repo_dir} and returns the
# list of dependencies, including transitive ones, in out_var.
#
# The returned dependencies are topologically sorted.
#
# Example output for qtimageformats:
# qtbase;qtshadertools;qtsvg;qtdeclarative;qttools
#
function(qt_internal_read_repo_dependencies out_var repo_dir)
set(seen ${ARGN})
set(dependencies "")
set(in_dependencies_section FALSE)
set(dependencies_file "${repo_dir}/dependencies.yaml")
if(EXISTS "${dependencies_file}")
file(STRINGS "${dependencies_file}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^([^ ]+):")
if(CMAKE_MATCH_1 STREQUAL "dependencies")
set(in_dependencies_section TRUE)
else()
set(in_dependencies_section FALSE)
endif()
elseif(in_dependencies_section AND line MATCHES "^ (.+):$")
set(dependency "${CMAKE_MATCH_1}")
set(dependency_repo_dir "${repo_dir}/${dependency}")
string(REGEX MATCH "[^/]+$" dependency "${dependency}")
if(NOT dependency IN_LIST seen)
qt_internal_read_repo_dependencies(subdeps "${dependency_repo_dir}"
${seen} ${dependency})
list(APPEND dependencies ${subdeps} ${dependency})
endif()
endif()
endforeach()
list(REMOVE_DUPLICATES dependencies)
endif()
set(${out_var} "${dependencies}" PARENT_SCOPE)
endfunction()
set(QT_BACKUP_CMAKE_INSTALL_PREFIX_BEFORE_EXTRA_INCLUDE "${CMAKE_INSTALL_PREFIX}")
@ -204,18 +242,19 @@ endmacro()
# find all targets defined in $subdir by recursing through all added subdirectories
# populates $qt_repo_targets with a ;-list of non-UTILITY targets
macro(qt_build_internals_get_repo_targets subdir)
get_directory_property(_targets DIRECTORY "${subdir}" BUILDSYSTEM_TARGETS)
if(_targets)
foreach(_target IN LISTS _targets)
get_target_property(_type ${_target} TYPE)
if(NOT (${_type} STREQUAL "UTILITY" OR ${_type} STREQUAL "INTERFACE"))
list(APPEND qt_repo_targets "${_target}")
endif()
endforeach()
endif()
get_directory_property(_directories DIRECTORY "${subdir}" SUBDIRECTORIES)
if (_directories)
foreach(_directory IN LISTS _directories)
get_directory_property(_targets DIRECTORY "${_directory}" BUILDSYSTEM_TARGETS)
if (_targets)
foreach(_target IN LISTS _targets)
get_target_property(_type ${_target} TYPE)
if (NOT (${_type} STREQUAL "UTILITY" OR ${_type} STREQUAL "INTERFACE"))
list(APPEND qt_repo_targets "${_target}")
endif()
endforeach()
endif()
qt_build_internals_get_repo_targets("${_directory}")
endforeach()
endif()
@ -369,7 +408,7 @@ macro(qt_build_repo_end)
qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE})
if(NOT PROJECT_NAME STREQUAL "QtBase")
if (EXISTS cmake)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
qt_copy_or_install(DIRECTORY cmake/
DESTINATION "${__qt_repo_install_dir}"
FILES_MATCHING PATTERN "Find*.cmake"
@ -473,11 +512,13 @@ macro(qt_build_tests)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/auto/CMakeLists.txt")
add_subdirectory(auto)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/CMakeLists.txt" AND QT_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manual/CMakeLists.txt" AND QT_BUILD_MANUAL_TESTS)
add_subdirectory(manual)
if(NOT QT_BUILD_MINIMAL_STATIC_TESTS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/CMakeLists.txt" AND QT_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manual/CMakeLists.txt" AND QT_BUILD_MANUAL_TESTS)
add_subdirectory(manual)
endif()
endif()
endmacro()
@ -595,3 +636,16 @@ macro(qt_examples_build_end)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
endmacro()
if ("STANDALONE_TEST" IN_LIST Qt6BuildInternals_FIND_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/QtStandaloneTestTemplateProject/Main.cmake)
if (NOT PROJECT_VERSION_MAJOR)
get_property(_qt_major_version TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::Core PROPERTY INTERFACE_QT_MAJOR_VERSION)
set(PROJECT_VERSION ${Qt${_qt_major_version}Core_VERSION})
string(REPLACE "." ";" _qt_core_version_list ${PROJECT_VERSION})
list(GET _qt_core_version_list 0 PROJECT_VERSION_MAJOR)
list(GET _qt_core_version_list 1 PROJECT_VERSION_MINOR)
list(GET _qt_core_version_list 2 PROJECT_VERSION_PATCH)
endif()
endif()

View File

@ -3,19 +3,7 @@ project(qt_single_test VERSION 6.0.0 LANGUAGES C CXX ASM)
find_package(Qt6 REQUIRED COMPONENTS BuildInternals)
# Includes QtSetup and friends for private CMake API.
qt_build_internals_set_up_private_api()
# Find all StandaloneTestsConfig.cmake files, and include them
# This will find all Qt packages that are required for standalone tests.
# It will find more packages that needed for a certain test, but will ensure any test can
# be built.
qt_get_standalone_tests_confg_files_path(standalone_tests_config_path)
file(GLOB config_files "${standalone_tests_config_path}/*")
foreach(file ${config_files})
include("${file}")
endforeach()
include(${CMAKE_CURRENT_LIST_DIR}/Main.cmake)
# Get the absolute path of the passed-in project dir, relative to the current working directory
# of the calling script, rather than relative to this source directory.
@ -27,10 +15,5 @@ else()
set(absolute_project_path "${QT_STANDALONE_TEST_PATH}")
endif()
# Just before adding the test, change the local (non-cache) install prefix to something other than
# the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix.
# Needs to be called after qt_get_standalone_tests_confg_files_path().
qt_set_up_fake_standalone_tests_install_prefix()
# Add the test project path as a subdirectory project.
add_subdirectory("${absolute_project_path}" "build_dir")

View File

@ -0,0 +1,18 @@
# Includes QtSetup and friends for private CMake API.
qt_build_internals_set_up_private_api()
# Find all StandaloneTestsConfig.cmake files, and include them
# This will find all Qt packages that are required for standalone tests.
# It will find more packages that needed for a certain test, but will ensure any test can
# be built.
qt_get_standalone_tests_confg_files_path(standalone_tests_config_path)
file(GLOB config_files "${standalone_tests_config_path}/*")
foreach(file ${config_files})
include("${file}")
endforeach()
# Just before adding the test, change the local (non-cache) install prefix to something other than
# the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix.
# Needs to be called after qt_get_standalone_tests_confg_files_path().
qt_set_up_fake_standalone_tests_install_prefix()

View File

@ -21,9 +21,25 @@ get_filename_component(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX
# This is an attempt to support Conan, aka handle installation of modules into a
# different installation prefix than the original one. Also allow to opt out via a special variable.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND
NOT QT_BUILD_INTERNALS_NO_FORCE_SET_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" CACHE PATH
NOT QT_BUILD_INTERNALS_NO_FORCE_SET_INSTALL_PREFIX)
set(qtbi_orig_prefix "@CMAKE_INSTALL_PREFIX@")
set(qtbi_new_prefix "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
if(CMAKE_HOST_WIN32)
# Make sure we use exactly the original prefix if it points to the same directory as the new
# one. This is needed for the case where the original prefix is passed without drive letter
# to support installing with DESTDIR set.
get_filename_component(qtbi_real_orig_prefix "${qtbi_orig_prefix}" REALPATH)
get_filename_component(qtbi_real_new_prefix "${qtbi_new_prefix}" REALPATH)
if(qtbi_real_orig_prefix STREQUAL qtbi_real_new_prefix)
set(qtbi_new_prefix "${qtbi_orig_prefix}")
endif()
endif()
set(CMAKE_INSTALL_PREFIX "${qtbi_new_prefix}" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
unset(qtbi_orig_prefix)
unset(qtbi_real_orig_prefix)
unset(qtbi_new_prefix)
unset(qtbi_real_new_prefix)
endif()
# Propagate developer builds to other modules via BuildInternals package.
@ -49,5 +65,9 @@ set(QT_BUILD_EXAMPLES_BY_DEFAULT @QT_BUILD_EXAMPLES_BY_DEFAULT@ CACHE BOOL
# Propagate usage of ccache.
set(QT_USE_CCACHE @QT_USE_CCACHE@ CACHE BOOL "Enable the use of ccache")
# Propagate usage of versioned hard link.
set(QT_CREATE_VERSIONED_HARD_LINK "@QT_CREATE_VERSIONED_HARD_LINK@" CACHE BOOL
"Enable the use of versioned hard link")
# Extra set of exported variables
@QT_EXTRA_BUILD_INTERNALS_VARS@

View File

@ -131,9 +131,13 @@ function(qt_remove_args out_var)
# remove arg
list(REMOVE_AT result ${find_result})
list(LENGTH result result_len)
if(find_result EQUAL result_len)
# We removed the last argument, could have been an option keyword
continue()
endif()
list(GET result ${find_result} arg_current)
# remove values until we hit another arg or the end of the list
while(NOT ${arg_current} IN_LIST arg_ALL_ARGS AND find_result LESS result_len)
while(NOT "${arg_current}" IN_LIST arg_ALL_ARGS AND find_result LESS result_len)
list(REMOVE_AT result ${find_result})
list(LENGTH result result_len)
if (NOT find_result EQUAL result_len)
@ -152,6 +156,26 @@ function(qt_re_escape out_var str)
set(${out_var} ${regex} PARENT_SCOPE)
endfunction()
# Input: string
# Output: regex string to match the string case insensitively
# Example: "Release" -> "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$"
#
# Regular expressions like this are used in cmake_install.cmake files for case-insensitive string
# comparison.
function(qt_create_case_insensitive_regex out_var input)
set(result "^(")
string(LENGTH "${input}" n)
math(EXPR n "${n} - 1")
foreach(i RANGE 0 ${n})
string(SUBSTRING "${input}" ${i} 1 c)
string(TOUPPER "${c}" uc)
string(TOLOWER "${c}" lc)
string(APPEND result "[${uc}${lc}]")
endforeach()
string(APPEND result ")$")
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
# Gets a target property, and returns "" if the property was not found
function(qt_internal_get_target_property out_var target property)
get_target_property(result "${target}" "${property}")

View File

@ -116,6 +116,24 @@ function(qt_internal_warn_about_unsuitable_cmake_versions)
# https://gitlab.kitware.com/cmake/cmake/-/issues/21163
list(APPEND unsuitable_versions "3.18.2")
# Cyclic dependencies are created when mixing AUTOMOC/AUTOUIC with sources
# that have their SKIP_MOC or SKIP_UIC source file properties set to true.
# https://gitlab.kitware.com/cmake/cmake/-/issues/21977
list(APPEND unsuitable_versions "3.20.0")
# AUTOMOC can crash or hang when using a Qt that supports moc depfiles.
# Issues reported on Windows with Ninja and Makefiles, but it could be happening
# on other platforms too.
# https://gitlab.kitware.com/cmake/cmake/-/issues/22014
list(APPEND unsuitable_versions "3.20.1")
# Cyclic dependencies can happen when the AUTOMOC / AUTOUIC include directory is added as a
# target include directory.
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6380
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6359
# https://gitlab.kitware.com/cmake/cmake/-/issues/16776
list(APPEND unsuitable_versions "3.21.0")
foreach(unsuitable_version ${unsuitable_versions})
if(CMAKE_VERSION VERSION_EQUAL unsuitable_version)
message(WARNING

View File

@ -44,8 +44,15 @@ list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/kwin")
if(APPLE AND (NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
# Add module directory to pick up custom Info.plist template for macOS
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/macos")
elseif(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
# Add module directory to pick up custom Info.plist template for iOS
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/ios")
endif()
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING "Additional directories where find(Qt6 ...) components are searched")
file(TO_CMAKE_PATH "${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path)
file(TO_CMAKE_PATH "$ENV{QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path_env)
# Find required dependencies, if any.
include(CMakeFindDependencyMacro)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
@ -63,15 +70,43 @@ if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
endif()
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
if(NOT "${QT_HOST_PATH}" STREQUAL ""
AND "${module}" MATCHES "Tools$"
AND NOT "${module}" MATCHES "ShaderTools$"
AND NOT "${module}" MATCHES "^Tools$"
AND NOT QT_NO_FIND_HOST_TOOLS_PATH_MANIPULATION)
# Make sure that a Qt*Tools package is also looked up in QT_HOST_PATH.
# But don't match QtShaderTools and QtTools which are cross-compiled target package names.
# Allow opt out just in case.
# TODO: Handle a hypothetical QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH
# See QTBUG-94524
set(__qt_find_package_host_qt_path "${QT_HOST_PATH}/lib/cmake")
set(__qt_backup_cmake_prefix_path "${CMAKE_PREFIX_PATH}")
set(__qt_backup_cmake_find_root_path "${CMAKE_FIND_ROOT_PATH}")
list(PREPEND CMAKE_PREFIX_PATH "${__qt_find_package_host_qt_path}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
endif()
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_REQUIRED}
PATHS
${_qt_cmake_dir}
${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_find_package_host_qt_path}
${__qt_use_no_default_path_for_qt_packages}
)
if(NOT "${__qt_find_package_host_qt_path}" STREQUAL "")
set(CMAKE_PREFIX_PATH "${__qt_backup_cmake_prefix_path}")
set(CMAKE_FIND_ROOT_PATH "${__qt_backup_cmake_find_root_path}")
unset(__qt_backup_cmake_prefix_path)
unset(__qt_backup_cmake_find_root_path)
unset(__qt_find_package_host_qt_path)
endif()
if (NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY)

View File

@ -1,42 +1,49 @@
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(_third_party_deps "@third_party_deps@")
set(__qt_third_party_deps "@third_party_deps@")
@third_party_extra@
foreach(_target_dep ${_third_party_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 is_optional)
list(GET _target_dep 2 version)
list(GET _target_dep 3 components)
set(find_package_args "${pkg}")
if(version)
list(APPEND find_package_args "${version}")
foreach(__qt_target_dep ${__qt_third_party_deps})
list(GET __qt_target_dep 0 __qt_pkg)
list(GET __qt_target_dep 1 __qt_is_optional)
list(GET __qt_target_dep 2 __qt_version)
list(GET __qt_target_dep 3 __qt_components)
list(GET __qt_target_dep 4 __qt_optional_components)
set(__qt_find_package_args "${__qt_pkg}")
if(__qt_version)
list(APPEND __qt_find_package_args "${__qt_version}")
endif()
if(components)
string(REPLACE " " ";" components "${components}")
list(APPEND find_package_args COMPONENTS ${components})
if(__qt_components)
string(REPLACE " " ";" __qt_components "${__qt_components}")
list(APPEND __qt_find_package_args COMPONENTS ${__qt_components})
endif()
if(__qt_optional_components)
string(REPLACE " " ";" __qt_optional_components "${__qt_optional_components}")
list(APPEND __qt_find_package_args OPTIONAL_COMPONENTS ${__qt_optional_components})
endif()
# Already build an error message, because find_dependency calls return() on failure.
set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
if(version)
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nVersion: ${version}")
set(__qt_message "\nPackage: ${__qt_pkg}")
if(__qt_version)
string(APPEND __qt_message "\nVersion: ${__qt_version}")
endif()
if(components)
string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${components}")
if(__qt_components)
string(APPEND __qt_message "\nComponents: ${__qt_components}")
endif()
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
"${__@INSTALL_CMAKE_NAMESPACE@_message}")
if(__qt_optional_components)
string(APPEND __qt_message "\nComponents: ${__qt_optional_components}")
endif()
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE "${__qt_message}")
if(is_optional)
if(__qt_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND find_package_args QUIET)
list(APPEND __qt_find_package_args QUIET)
endif()
find_package(${find_package_args})
find_package(${__qt_find_package_args})
else()
find_dependency(${find_package_args})
find_dependency(${__qt_find_package_args})
endif()
endforeach()

View File

@ -174,4 +174,94 @@ function(qt_internal_add_executable name)
if("Qt::Gui" IN_LIST linked_libs AND TARGET qpa_default_plugins)
add_dependencies("${name}" qpa_default_plugins)
endif()
if(NOT BUILD_SHARED_LIBS)
# For static builds, we need to explicitly link to plugins we want to be
# loaded with the executable. User projects get that automatically, but
# for tools built as part of Qt, we can't use that mechanism because it
# would pollute the targets we export as part of an install and lead to
# circular dependencies. The logic here is a simpler equivalent of the
# more dynamic logic in QtPlugins.cmake.in, but restricted to only
# adding plugins that are provided by the same module as the module
# libraries the executable links to.
set(libs
${arg_LIBRARIES}
${arg_PUBLIC_LIBRARIES}
${extra_libraries}
Qt::PlatformCommonInternal
)
set(deduped_libs "")
foreach(lib IN LISTS libs)
if(NOT TARGET "${lib}")
continue()
endif()
# Normalize module by stripping any leading "Qt::", because properties are set on the
# versioned target (either Gui when building the module, or Qt6::Gui when it's
# imported).
if(lib MATCHES "Qt::([-_A-Za-z0-9]+)")
set(new_lib "${QT_CMAKE_EXPORT_NAMESPACE}::${CMAKE_MATCH_1}")
if(TARGET "${new_lib}")
set(lib "${new_lib}")
endif()
endif()
# Unalias the target.
get_target_property(aliased_target ${lib} ALIASED_TARGET)
if(aliased_target)
set(lib ${aliased_target})
endif()
list(APPEND deduped_libs "${lib}")
endforeach()
list(REMOVE_DUPLICATES deduped_libs)
foreach(lib IN LISTS deduped_libs)
string(MAKE_C_IDENTIFIER "${name}_plugin_imports_${lib}" out_file)
string(APPEND out_file .cpp)
# Initialize plugins that are built in the same repository as the Qt module 'lib'.
set(class_names_regular
"$<GENEX_EVAL:$<TARGET_PROPERTY:${lib},_qt_initial_repo_plugin_class_names>>")
# Initialize plugins that are built in the current Qt repository, but are associated
# with a Qt module from a different repository (qtsvg's QSvgPlugin associated with
# qtbase's QtGui).
string(MAKE_C_IDENTIFIER "${PROJECT_NAME}" current_project_name)
set(prop_prefix "_qt_repo_${current_project_name}")
set(class_names_current_project
"$<GENEX_EVAL:$<TARGET_PROPERTY:${lib},${prop_prefix}_plugin_class_names>>")
# Only add separator if first list is not empty, so we don't trigger the file generation
# when all lists are empty.
set(class_names_separator "$<$<NOT:$<STREQUAL:${class_names_regular},>>:;>" )
set(class_names
"${class_names_regular}${class_names_separator}${class_names_current_project}")
set(out_file_path "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
file(GENERATE OUTPUT "${out_file_path}" CONTENT
"// This file is auto-generated. Do not edit.
#include <QtPlugin>
Q_IMPORT_PLUGIN($<JOIN:${class_names},)\nQ_IMPORT_PLUGIN(>)
"
CONDITION "$<NOT:$<STREQUAL:${class_names},>>"
)
# CMake versions earlier than 3.18.0 can't find the generated file for some reason,
# failing at generation phase.
# Explicitly marking the file as GENERATED fixes the issue.
set_source_files_properties("${out_file_path}" PROPERTIES GENERATED TRUE)
target_sources(${name} PRIVATE
"$<$<NOT:$<STREQUAL:${class_names},>>:${out_file_path}>"
)
target_link_libraries(${name} PRIVATE
"$<TARGET_PROPERTY:${lib},_qt_initial_repo_plugins>"
"$<TARGET_PROPERTY:${lib},${prop_prefix}_plugins>")
endforeach()
endif()
endfunction()

View File

@ -227,13 +227,8 @@ function(_qt_internal_dump_expression_values expression_dump expression)
set(${expression_dump} "${${expression_dump}}" PARENT_SCOPE)
endfunction()
function(qt_feature_set_cache_value resultVar feature emit_if condition calculated label)
function(qt_feature_set_cache_value resultVar feature condition calculated label)
if (DEFINED "FEATURE_${feature}")
# Must set up the cache
if (NOT (emit_if))
message(FATAL_ERROR "Sanity check failed: FEATURE_${feature} that was not emitted was found in the CMakeCache.")
endif()
# Revisit value:
set(cache "${FEATURE_${feature}}")
@ -257,12 +252,8 @@ meet its condition after reconfiguration.")
set("FEATURE_${feature}" "${cache}" CACHE BOOL "${label}" FORCE)
else()
# Initial setup:
if (emit_if)
set("FEATURE_${feature}" "${calculated}" CACHE BOOL "${label}")
set(result "${calculated}")
else()
set(result OFF)
endif()
set("FEATURE_${feature}" "${calculated}" CACHE BOOL "${label}")
set(result "${calculated}")
endif()
set("${resultVar}" "${result}" PARENT_SCOPE)
@ -350,8 +341,17 @@ function(qt_evaluate_feature feature)
endif()
endif()
qt_feature_set_cache_value(cache "${feature}" "${emit_if}" "${condition}" "${result}"
"${arg_LABEL}")
if(NOT emit_if AND DEFINED FEATURE_${feature})
set(msg "")
string(APPEND msg
"Feature ${feature} is insignificant in this configuration, "
"ignoring related command line option(s).")
qt_configure_add_report_entry(TYPE WARNING MESSAGE "${msg}")
set(result OFF)
set(FEATURE_${feature} OFF)
endif()
qt_feature_set_cache_value(cache "${feature}" "${condition}" "${result}" "${arg_LABEL}")
qt_feature_set_value("${feature}" "${cache}" "${condition}" "${arg_LABEL}"
"${arg_CONDITION}")
@ -890,9 +890,8 @@ function(qt_get_platform_try_compile_vars out_var)
# Pass darwin specific options.
# The architectures need to be passed explicitly to project-based try_compile calls even on
# macOS, so that arm64 compilation works on Apple silicon.
if(CMAKE_OSX_ARCHITECTURES)
list(GET CMAKE_OSX_ARCHITECTURES 0 osx_first_arch)
qt_internal_get_first_osx_arch(osx_first_arch)
if(osx_first_arch)
# Do what qmake does, aka when doing a simulator_and_device build, build the
# target architecture test only with the first given architecture, which should be the
# device architecture, aka some variation of "arm" (armv7, arm64).
@ -909,6 +908,16 @@ function(qt_get_platform_try_compile_vars out_var)
set("${out_var}" "${flags_cmd_line}" PARENT_SCOPE)
endfunction()
# Set out_var to the first value of CMAKE_OSX_ARCHITECTURES.
# Sets an empty string if no architecture is present.
function(qt_internal_get_first_osx_arch out_var)
set(value "")
if(CMAKE_OSX_ARCHITECTURES)
list(GET CMAKE_OSX_ARCHITECTURES 0 value)
endif()
set(${out_var} "${value}" PARENT_SCOPE)
endfunction()
function(qt_config_compile_test_x86simd extension label)
if (DEFINED TEST_X86SIMD_${extension})
return()

View File

@ -18,7 +18,7 @@ macro(qt_find_package)
set(find_package_options CONFIG NO_MODULE MODULE REQUIRED)
set(options ${find_package_options} MARK_OPTIONAL)
set(oneValueArgs MODULE_NAME QMAKE_LIB)
set(multiValueArgs PROVIDED_TARGETS COMPONENTS)
set(multiValueArgs PROVIDED_TARGETS COMPONENTS OPTIONAL_COMPONENTS)
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# If some Qt internal project calls qt_find_package(WrapFreeType), but WrapFreeType was already
@ -57,7 +57,10 @@ macro(qt_find_package)
# Re-append components to forward them.
list(APPEND arg_UNPARSED_ARGUMENTS "COMPONENTS;${arg_COMPONENTS}")
endif()
# TODO: Handle REQUIRED_COMPONENTS.
if(arg_OPTIONAL_COMPONENTS)
# Re-append optional components to forward them.
list(APPEND arg_UNPARSED_ARGUMENTS "OPTIONAL_COMPONENTS;${arg_OPTIONAL_COMPONENTS}")
endif()
# Don't look for packages in PATH if requested to.
if(QT_NO_USE_FIND_PACKAGE_SYSTEM_ENVIRONMENT_PATH)
@ -148,6 +151,13 @@ macro(qt_find_package)
PROPERTY INTERFACE_QT_PACKAGE_COMPONENTS ${components_as_string})
endif()
if(arg_OPTIONAL_COMPONENTS)
string(REPLACE ";" " " components_as_string "${arg_OPTIONAL_COMPONENTS}")
set_property(TARGET ${qt_find_package_target_name}
PROPERTY INTERFACE_QT_PACKAGE_OPTIONAL_COMPONENTS
${components_as_string})
endif()
get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY
IMPORTED_GLOBAL)
qt_internal_should_not_promote_package_target_to_global(

View File

@ -19,7 +19,9 @@
# LIBRARY_SUFFIXES: list of known library extensions, e.g. .so;.a on Linux
# LIBRARY_PREFIXES: list of known library prefies, e.g. the "lib" in "libz" on on Linux
# LINK_LIBRARY_FLAG: flag used to link a shared library to an executable, e.g. -l on UNIX
# IMPLICIT_LINK_DIRECTORIES: list of implicit linker search paths
cmake_policy(SET CMP0007 NEW)
include("${CMAKE_CURRENT_LIST_DIR}/QtGenerateLibHelpers.cmake")
file(STRINGS "${IN_FILE}" lines)

View File

@ -216,7 +216,7 @@ endfunction()
function(qt_set_language_standards)
## Use the latest standard the compiler supports (same as qt_common.prf)
if (QT_FEATURE_cxx2a)
if (QT_FEATURE_cxx20)
set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE)
else()
set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
@ -260,6 +260,15 @@ function(qt_enable_utf8_sources target)
endif()
endfunction()
function(qt_internal_enable_unicode_defines)
if(WIN32)
set(no_unicode_condition
"$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_NO_UNICODE_DEFINES>>>")
target_compile_definitions(Platform
INTERFACE "$<${no_unicode_condition}:UNICODE;_UNICODE>")
endif()
endfunction()
# Saves the list of known optimization flags for the current compiler in out_var.
#
# Mostly used for removing them before adding new ones.
@ -416,7 +425,7 @@ function(qt_internal_remove_flags_impl flag_var_name flag_values IN_CACHE)
# cache variable with FORCE will overwrite the non-cache variable in this
# function scope, but we need to use the original value before that change.
foreach(flag_value IN LISTS flag_values)
string(${replace_type} "${flag_value}" "" ${flag_var_name} "${${flag_var_name}}")
string(${replace_type} "${flag_value}" " " ${flag_var_name} "${${flag_var_name}}")
endforeach()
string(STRIP "${${flag_var_name}}" ${flag_var_name})
set(${flag_var_name} "${${flag_var_name}}" PARENT_SCOPE)
@ -428,7 +437,7 @@ function(qt_internal_remove_flags_impl flag_var_name flag_values IN_CACHE)
# Work exclusively on cache variable value only.
set(mod_flags $CACHE{${flag_var_name}})
foreach(flag_value IN LISTS flag_values)
string(${replace_type} "${flag_value}" "" mod_flags "${mod_flags}")
string(${replace_type} "${flag_value}" " " mod_flags "${mod_flags}")
endforeach()
string(STRIP "${mod_flags}" mod_flags)
get_property(help_text CACHE ${flag_var_name} PROPERTY HELPSTRING)

View File

@ -6,11 +6,12 @@ function(qt_get_library_name_without_prefix_and_suffix out_var file_path)
if(IS_ABSOLUTE "${file_path}")
get_filename_component(basename "${file_path}" NAME_WE)
get_filename_component(ext "${file_path}" EXT)
string(TOLOWER "${ext}" ext_lower)
foreach(libsuffix ${LIBRARY_SUFFIXES})
# Handle weird prefix extensions like in the case of
# "/usr/lib/x86_64-linux-gnu/libglib-2.0.so"
# it's ".0.so".
if(ext MATCHES "^(\\.[0-9]+)*${libsuffix}(\\.[0-9]+)*")
if(ext_lower MATCHES "^(\\.[0-9]+)*${libsuffix}(\\.[0-9]+)*")
set(is_linkable_library TRUE)
set(weird_numbered_extension "${CMAKE_MATCH_1}")
break()
@ -64,6 +65,14 @@ function(qt_transform_absolute_library_paths_to_link_flags out_var library_path_
foreach(library_path ${library_path_list})
qt_get_library_with_link_flag(lib_name_with_link_flag "${library_path}")
if(lib_name_with_link_flag)
string(TOLOWER "${IMPLICIT_LINK_DIRECTORIES}" IMPLICIT_LINK_DIRECTORIES_LOWER)
get_filename_component(dir "${library_path}" DIRECTORY)
string(TOLOWER "${dir}" dir_lower)
# If library_path isn't in default link directories, we should add it to link flags.
list(FIND IMPLICIT_LINK_DIRECTORIES_LOWER "${dir_lower}" index)
if(${index} EQUAL -1)
list(APPEND out_list "-L\"${dir}\"")
endif()
list(APPEND out_list "${lib_name_with_link_flag}")
else()
list(APPEND out_list "${library_path}")

View File

@ -7,6 +7,7 @@
# LIBRARY_SUFFIXES: list of known library extensions, e.g. .so;.a on Linux
# LIBRARY_PREFIXES: list of known library prefies, e.g. the "lib" in "libz" on on Linux
# LINK_LIBRARY_FLAG: flag used to link a shared library to an executable, e.g. -l on UNIX
# IMPLICIT_LINK_DIRECTORIES: list of implicit linker search paths
#
# QMAKE_LIBS_XXX values are split into QMAKE_LIBS_XXX_DEBUG and QMAKE_LIBS_XXX_RELEASE if
# debug_and_release was detected. The CMake configuration "Debug" is considered for the _DEBUG
@ -15,6 +16,7 @@
# The library values are transformed from an absolute path into link flags
# aka from "/usr/lib/x86_64-linux-gnu/libcups.so" to "-lcups".
cmake_policy(SET CMP0007 NEW)
cmake_policy(SET CMP0057 NEW)
# Create a qmake-style list from the passed arguments and store it in ${out_var}.

View File

@ -190,7 +190,7 @@ function(qt_internal_add_headers_clean_target
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# -Za would enable strict standards behavior, but we can't add it because
# <windows.h> and <GL.h> violate the standards.
set(hcleanFLAGS -std:c++17 -WX -W3)
set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -WX -W3)
# cl.exe needs a source path
get_filename_component(source_path "${QT_MKSPECS_DIR}/features/data/dummy.cpp" REALPATH)

View File

@ -125,3 +125,49 @@ function(qt_set_up_nonprefix_build)
qt_remove_install_target()
endif()
endfunction()
# Create a versioned hard-link for the given target.
# E.g. "bin/qmake6" -> "bin/qmake".
# If no hard link can be created, make a copy instead.
#
# In a multi-config build, create the link for the main config only.
function(qt_internal_install_versioned_link install_dir target)
if(NOT QT_WILL_INSTALL)
return()
endif()
if(NOT QT_CREATE_VERSIONED_HARD_LINK)
return()
endif()
qt_path_join(install_base_file_path "$\{qt_full_install_prefix}"
"${install_dir}" "$<TARGET_FILE_BASE_NAME:${target}>")
set(original "${install_base_file_path}$<TARGET_FILE_SUFFIX:${target}>")
set(linkname "${install_base_file_path}${PROJECT_VERSION_MAJOR}$<TARGET_FILE_SUFFIX:${target}>")
set(code "set(qt_full_install_prefix \"$\{CMAKE_INSTALL_PREFIX}\")"
" if(NOT \"$ENV\{DESTDIR}\" STREQUAL \"\")"
)
if(CMAKE_HOST_WIN32)
list(APPEND code
" if(qt_full_install_prefix MATCHES \"^[a-zA-Z]:\")"
" string(SUBSTRING \"$\{qt_full_install_prefix}\" 2 -1 qt_full_install_prefix)"
" endif()"
)
endif()
list(APPEND code
" string(PREPEND qt_full_install_prefix \"$ENV\{DESTDIR}\")"
" endif()"
" message(STATUS \"Creating hard link ${original} -> ${linkname}\")"
" file(CREATE_LINK \"${original}\" \"${linkname}\" COPY_ON_ERROR)")
if(QT_GENERATOR_IS_MULTI_CONFIG)
# Wrap the code in a configuration check,
# because install(CODE) does not support a CONFIGURATIONS argument.
qt_create_case_insensitive_regex(main_config_regex ${QT_MULTI_CONFIG_FIRST_CONFIG})
list(PREPEND code "if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"${main_config_regex}\")")
list(APPEND code "endif()")
endif()
list(JOIN code "\n" code)
install(CODE "${code}")
endfunction()

View File

@ -32,6 +32,25 @@ function(qt_internal_set_warnings_are_errors_flags target)
list(APPEND flags -Wno-error=format-overflow)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
# GCC 10 has a number of bugs in -Wstringop-overflow. Do not make them an error.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101134
list(APPEND flags -Wno-error=stringop-overflow)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0")
# We do mixed enum arithmetic all over the place:
list(APPEND flags -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.2.0")
# GCC 11.1 has a regression in the integrated preprocessor, so disable it as a workaround (QTBUG-93360)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
list(APPEND flags -no-integrated-cpp)
endif()
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
if (ANDROID)
list(APPEND flags -Wno-error=literal-suffix)
@ -133,7 +152,6 @@ function(qt_internal_apply_bitcode_flags target)
set(bitcode_flags "$<${is_enabled_genex}:${flags_genex}>")
target_link_options("${target}" INTERFACE ${bitcode_flags})
target_compile_options("${target}" INTERFACE ${bitcode_flags})
endfunction()
@ -147,13 +165,11 @@ elseif(UIKIT)
target_compile_definitions(PlatformCommonInternal INTERFACE GLES_SILENCE_DEPRECATION)
endif()
if(WIN32)
target_compile_definitions(PlatformCommonInternal INTERFACE "UNICODE;_UNICODE")
if(MSVC)
target_compile_definitions(PlatformCommonInternal INTERFACE
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:_WINDLL>"
)
endif()
if(MSVC)
target_compile_definitions(PlatformCommonInternal INTERFACE
"_CRT_SECURE_NO_WARNINGS"
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:_WINDLL>"
)
endif()
if(UIKIT)
@ -316,8 +332,5 @@ function(qt_handle_apple_app_extension_api_only)
target_link_options(PlatformPluginInternal INTERFACE ${flags})
endif()
endfunction()
function(qt_disable_apple_app_extension_api_only target)
set_target_properties("${target}" PROPERTIES QT_NO_APP_EXTENSION_ONLY_API TRUE)
endfunction()
qt_handle_apple_app_extension_api_only()

View File

@ -8,40 +8,46 @@ endif()
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
PATHS
"${CMAKE_CURRENT_LIST_DIR}/.."
${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(_third_party_deps "@third_party_deps@")
set(__qt_@target@_third_party_deps "@third_party_deps@")
foreach(_target_dep ${_third_party_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 is_optional)
list(GET _target_dep 2 version)
list(GET _target_dep 3 components)
set(find_package_args "${pkg}")
if(version)
list(APPEND find_package_args "${version}")
foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
if(__qt_@target@_version)
list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
if(components)
string(REPLACE " " ";" components "${components}")
list(APPEND find_package_args COMPONENTS ${components})
if(__qt_@target@_components)
string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
if(__qt_@target@_optional_components)
string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
if(is_optional)
if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND find_package_args QUIET)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
find_package(${find_package_args})
find_package(${__qt_@target@_find_package_args})
else()
find_dependency(${find_package_args})
find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
# Find Qt tool package.
set(_tool_deps "@main_module_tool_deps@")
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
if(NOT "${QT_HOST_PATH}" STREQUAL "")
# Make sure that the tools find the host tools first
@ -51,19 +57,23 @@ if(NOT "${QT_HOST_PATH}" STREQUAL "")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
endif()
foreach(_target_dep ${_tool_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 version)
foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
unset(find_package_args)
unset(__qt_@target@_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND find_package_args QUIET)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
list(APPEND find_package_args REQUIRED)
list(APPEND __qt_@target@_find_package_args REQUIRED)
endif()
find_package(${pkg} ${version} ${find_package_args})
if (NOT ${pkg}_FOUND)
find_package(${__qt_@target@_pkg} ${__qt_@target@_version} ${__qt_@target@_find_package_args}
PATHS
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
)
if (NOT ${__qt_@target@_pkg}_FOUND)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
@ -77,16 +87,17 @@ if(NOT "${QT_HOST_PATH}" STREQUAL "")
endif()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
set(_target_deps "@target_deps@")
foreach(_target_dep ${_target_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 version)
set(__qt_@target@_target_deps "@target_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_target_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
if (NOT ${pkg}_FOUND)
find_dependency(${pkg} ${version}
if (NOT ${__qt_@target@_pkg}_FOUND)
find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version}
PATHS
"${CMAKE_CURRENT_LIST_DIR}/.."
${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)

View File

@ -166,7 +166,7 @@ function(qt_internal_add_module target)
)
endif()
qt_internal_apply_win_prefix_and_suffix("${target}")
_qt_internal_apply_win_prefix_and_suffix("${target}")
if (WIN32 AND BUILD_SHARED_LIBS)
_qt_internal_generate_win32_rc_file(${target})
@ -241,15 +241,6 @@ function(qt_internal_add_module target)
endif()
if(NOT arg_HEADER_MODULE)
# This property is used for super builds with static libraries. We use
# it in QtPlugins.cmake.in to avoid "polluting" the dependency chain
# for the target in it's project directory.
# E.g: When we process find_package(Qt6 ... Gui) in QtDeclarative, the
# rules in QtPugins.cmake add all the known Gui plugins as interface
# dependencies. This in turn causes circular dependencies on every
# plugin which links against Gui. Plugin A -> GUI -> Plugin A ....
set_target_properties(${target} PROPERTIES QT_BUILD_PROJECT_NAME ${PROJECT_NAME})
# Plugin types associated to a module
if(NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x")
# Reset the variable containing the list of plugins for the given plugin type
@ -364,10 +355,7 @@ function(qt_internal_add_module target)
QT_BUILD_${module_define_infix}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
${deprecation_define}
)
endif()
if(MSVC)
list(APPEND defines_for_extend_target _CRT_SECURE_NO_WARNINGS)
list(APPEND arg_LIBRARIES Qt::PlatformModuleInternal)
endif()
qt_internal_extend_target("${target}"
@ -383,7 +371,7 @@ function(qt_internal_add_module target)
${arg_DEFINES}
${defines_for_extend_target}
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
LIBRARIES ${arg_LIBRARIES} Qt::PlatformModuleInternal
LIBRARIES ${arg_LIBRARIES}
PRIVATE_MODULE_INTERFACE ${arg_PRIVATE_MODULE_INTERFACE}
FEATURE_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
DBUS_ADAPTOR_SOURCES ${arg_DBUS_ADAPTOR_SOURCES}
@ -567,7 +555,7 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
if (ANDROID AND NOT arg_HEADER_MODULE)
# Record install library location so it can be accessed by
# qt_android_dependencies without having to specify it again.
# qt_internal_android_dependencies without having to specify it again.
set_target_properties(${target} PROPERTIES
QT_ANDROID_MODULE_INSTALL_DIR ${INSTALL_LIBDIR})
endif()

View File

@ -1,12 +1,12 @@
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
set(_tool_deps "@package_deps@")
foreach(_target_dep ${_tool_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 version)
set(__qt_@target@_tool_deps "@package_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
if (NOT ${pkg}_FOUND)
find_dependency(${pkg} ${version})
if (NOT ${__qt_@target@_pkg}_FOUND)
find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version})
endif()
endforeach()

View File

@ -33,7 +33,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-28")
set(QT_ANDROID_API_VERSION "android-29")
# Locate android.jar
set(QT_ANDROID_JAR "${ANDROID_SDK_ROOT}/platforms/${QT_ANDROID_API_VERSION}/android.jar")

View File

@ -1,5 +1,14 @@
include_guard(DIRECTORY)
if(DEFINED QT_REPO_DEPENDENCIES AND NOT QT_BUILD_STANDALONE_TESTS)
# We're building a Qt repository.
# Skip this plugin if it has not been provided by one of this repo's dependencies.
string(TOLOWER "@PROJECT_NAME@" lower_case_project_name)
if(NOT lower_case_project_name IN_LIST QT_REPO_DEPENDENCIES)
return()
endif()
endif()
@PACKAGE_INIT@
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)

View File

@ -1,29 +1,34 @@
set(@target@_FOUND FALSE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(_third_party_deps "@third_party_deps@")
set(__qt_@target@_third_party_deps "@third_party_deps@")
foreach(_target_dep ${_third_party_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 is_optional)
list(GET _target_dep 2 version)
list(GET _target_dep 3 components)
set(find_package_args "${pkg}")
if(version)
list(APPEND find_package_args "${version}")
foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
if(__qt_@target@_version)
list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
if(components)
string(REPLACE " " ";" components "${components}")
list(APPEND find_package_args COMPONENTS ${components})
if(__qt_@target@_components)
string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
if(__qt_@target@_optional_components)
string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
if(is_optional)
if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND find_package_args QUIET)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
find_package(${find_package_args})
find_package(${__qt_@target@_find_package_args})
else()
find_dependency(${find_package_args})
find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
@ -33,16 +38,17 @@ if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
endif()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
set(_target_deps "@target_deps@")
foreach(_target_dep ${_target_deps})
list(GET _target_dep 0 pkg)
list(GET _target_dep 1 version)
set(__qt_@target@_target_deps "@target_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_target_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
if (NOT ${pkg}_FOUND)
find_dependency(${pkg} ${version}
if (NOT ${__qt_@target@_pkg}_FOUND)
find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version}
PATHS
@find_dependency_paths@
${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)

View File

@ -1,3 +1,24 @@
# Note that these are only the keywords that are unique to qt_internal_add_plugin().
# That function also supports the keywords defined by _qt_internal_get_add_plugin_keywords().
macro(qt_internal_get_internal_add_plugin_keywords option_args single_args multi_args)
set(${option_args}
EXCEPTIONS
ALLOW_UNDEFINED_SYMBOLS
SKIP_INSTALL
)
set(${single_args}
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
ARCHIVE_INSTALL_DIRECTORY
${__default_target_info_args}
)
set(${multi_args}
${__default_private_args}
${__default_public_args}
DEFAULT_IF
)
endmacro()
# This is the main entry point for defining Qt plugins.
# A CMake target is created with the given target. The TYPE parameter is needed to place the
# plugin into the correct plugins/ sub-directory.
@ -6,35 +27,63 @@ function(qt_internal_add_plugin target)
qt_internal_set_qt_known_plugins("${QT_KNOWN_PLUGINS}" "${target}")
_qt_internal_get_add_plugin_keywords(
public_option_args
public_single_args
public_multi_args
)
qt_internal_get_internal_add_plugin_keywords(
internal_option_args
internal_single_args
internal_multi_args
)
set(option_args ${public_option_args} ${internal_option_args})
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"
"${__qt_add_plugin_optional_args};SKIP_INSTALL"
"${__qt_add_plugin_single_args}"
"${__qt_add_plugin_multi_args}"
"${option_args}"
"${single_args}"
"${multi_args}"
"${ARGN}"
)
# Put this behind a cache option for now. It's too noisy for general use
# until most repos are updated.
option(QT_WARN_PLUGIN_PUBLIC_KEYWORDS "Warn if a plugin specifies a PUBLIC keyword")
if(QT_WARN_PLUGIN_PUBLIC_KEYWORDS)
foreach(publicKeyword IN LISTS __default_public_args)
if(NOT "${arg_${publicKeyword}}" STREQUAL "")
string(REPLACE "PUBLIC_" "" privateKeyword "${publicKeyword}")
message(AUTHOR_WARNING
"Plugins are not intended to be linked to. "
"They should not have any public properties, but ${target} "
"sets ${publicKeyword} to the following value:\n"
" ${arg_${publicKeyword}}\n"
"Update your project to use ${privateKeyword} instead.\n")
endif()
endforeach()
endif()
qt_remove_args(plugin_args
ARGS_TO_REMOVE
${internal_option_args}
${internal_single_args}
${internal_multi_args}
ALL_ARGS
${option_args}
${single_args}
${multi_args}
ARGS
${ARGN}
)
qt6_add_plugin(${target} ${plugin_args})
qt_get_sanitized_plugin_type("${arg_TYPE}" plugin_type_escaped)
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${arg_TYPE}")
set(install_directory_default "${INSTALL_PLUGINSDIR}/${arg_TYPE}")
if (arg_QML_TARGET_PATH)
set(target_path "${arg_QML_TARGET_PATH}")
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_QMLDIR}/${target_path}")
set(install_directory_default "${INSTALL_QMLDIR}/${target_path}")
endif()
# Derive the class name from the target name if it's not explicitly specified.
# Don't set it for qml plugins though.
set(plugin_class_name "")
if (NOT "${plugin_type_escaped}" STREQUAL "qml_plugin")
if (NOT arg_CLASS_NAME)
set(plugin_class_name "${target}")
else()
set(plugin_class_name "${arg_CLASS_NAME}")
endif()
endif()
qt_internal_check_directory_or_type(OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${arg_TYPE}"
"${output_directory_default}" output_directory)
if (NOT arg_SKIP_INSTALL)
@ -46,42 +95,28 @@ function(qt_internal_add_plugin target)
endif()
endif()
if(arg_STATIC OR NOT BUILD_SHARED_LIBS)
add_library("${target}" STATIC)
else()
add_library("${target}" MODULE)
if(APPLE)
# CMake defaults to using .so extensions for loadable modules, aka plugins,
# but Qt plugins are actually suffixed with .dylib.
set_property(TARGET "${target}" PROPERTY SUFFIX ".dylib")
endif()
qt_internal_apply_win_prefix_and_suffix("${target}")
endif()
qt_set_common_target_properties(${target})
qt_set_target_info_properties(${target} ${ARGN} TARGET_VERSION "${arg_VERSION}")
# Override the OUTPUT_NAME that qt6_add_plugin() set, we need to account for
# QT_LIBINFIX, which is specific to building Qt.
# Make sure the Qt6 plugin library names are like they were in Qt5 qmake land.
# Whereas the Qt6 CMake target names are like the Qt5 CMake target names.
set(output_name "${target}")
if(arg_OUTPUT_NAME)
set(output_name "${arg_OUTPUT_NAME}")
endif()
get_target_property(output_name ${target} OUTPUT_NAME)
set_property(TARGET "${target}" PROPERTY OUTPUT_NAME "${output_name}${QT_LIBINFIX}")
# Add a custom target with the Qt5 qmake name for a more user friendly ninja experience.
if(arg_OUTPUT_NAME AND NOT TARGET "${output_name}")
add_custom_target("${output_name}")
add_dependencies("${output_name}" "${target}")
# But don't create such a target if it would just differ in case from "${target}"
# and we're not using Ninja. See https://gitlab.kitware.com/cmake/cmake/-/issues/21915
string(TOUPPER "${output_name}" uc_output_name)
string(TOUPPER "${target}" uc_target)
if(NOT uc_output_name STREQUAL uc_target OR CMAKE_GENERATOR MATCHES "^Ninja")
add_custom_target("${output_name}")
add_dependencies("${output_name}" "${target}")
endif()
endif()
if (ANDROID)
qt_android_apply_arch_suffix("${target}")
set_target_properties(${target}
PROPERTIES
LIBRARY_OUTPUT_NAME "plugins_${arg_TYPE}_${output_name}"
)
endif()
qt_internal_add_target_aliases("${target}")
qt_skip_warnings_are_errors_when_repo_unclean("${target}")
_qt_internal_apply_strict_cpp("${target}")
@ -97,41 +132,15 @@ function(qt_internal_add_plugin target)
QT_PLUGIN_TYPE "${plugin_type_escaped}"
# Save the non-sanitized plugin type values for qmake consumption via .pri files.
QT_QMAKE_PLUGIN_TYPE "${arg_TYPE}"
QT_PLUGIN_CLASS_NAME "${plugin_class_name}")
qt_handle_multi_config_output_dirs("${target}")
)
qt_handle_multi_config_output_dirs("${target}")
qt_internal_library_deprecation_level(deprecation_define)
qt_autogen_tools_initial_setup(${target})
set(static_plugin_define "")
if (arg_STATIC OR NOT QT_BUILD_SHARED_LIBS)
set(static_plugin_define "QT_STATICPLUGIN")
endif()
# Save the Qt module in the plug-in's properties
if(NOT plugin_type_escaped STREQUAL "qml_plugin")
qt_get_module_for_plugin("${target}" "${plugin_type_escaped}")
get_target_property(qt_module "${target}" QT_MODULE)
set(plugin_install_package_suffix "${qt_module}")
endif()
# Add the plug-in to the list of plug-ins of this module
if(TARGET "${qt_module}")
set_property(TARGET "${qt_module}" APPEND PROPERTY QT_PLUGINS "${target}")
endif()
# Change the configuration file install location for qml plugins into the Qml package location.
if(plugin_type_escaped STREQUAL "qml_plugin" AND TARGET "${INSTALL_CMAKE_NAMESPACE}::Qml")
set(plugin_install_package_suffix "Qml/QmlPlugins")
endif()
# Save the install package suffix as a property, so that the Dependencies file is placed
# in the current location.
if(plugin_install_package_suffix)
set_target_properties("${target}" PROPERTIES
_qt_plugin_install_package_suffix "${plugin_install_package_suffix}")
endif()
unset(plugin_install_package_suffix)
# The generic plugins should be enabled by default.
# But platform plugins should always be disabled by default, and only one is enabled
@ -142,19 +151,120 @@ function(qt_internal_add_plugin target)
set(_default_plugin 1)
endif()
if (DEFINED arg_DEFAULT_IF)
if (NOT ${arg_DEFAULT_IF})
set(_default_plugin 0)
else()
set(_default_plugin 1)
endif()
if(DEFINED arg_DEFAULT_IF)
if(${arg_DEFAULT_IF})
set(_default_plugin 1)
else()
set(_default_plugin 0)
endif()
endif()
add_dependencies(qt_plugins "${target}")
if(arg_TYPE STREQUAL "platforms")
add_dependencies(qpa_plugins "${target}")
# Save the Qt module in the plug-in's properties and vice versa
if(NOT plugin_type_escaped STREQUAL "qml_plugin")
qt_internal_get_module_for_plugin("${target}" "${plugin_type_escaped}" qt_module)
if(_default_plugin)
set(qt_module_target "${QT_CMAKE_EXPORT_NAMESPACE}::${qt_module}")
if(NOT TARGET "${qt_module_target}")
message(FATAL_ERROR "Failed to associate Qt plugin with Qt module. ${qt_module_target} is not a known CMake target")
endif()
set_target_properties("${target}" PROPERTIES QT_MODULE "${qt_module}")
set(plugin_install_package_suffix "${qt_module}")
get_target_property(aliased_target ${qt_module_target} ALIASED_TARGET)
if(aliased_target)
set(qt_module_target ${aliased_target})
endif()
get_target_property(is_imported_qt_module ${qt_module_target} IMPORTED)
# Associate plugin with its Qt module when both are both built in the same repository.
# Check that by comparing the PROJECT_NAME of each.
# This covers auto-linking of the majority of plugins to executables and in-tree tests.
# Linking of plugins in standalone tests (when the Qt module will be an imported target)
# is handled instead by the complicated genex logic in QtModulePlugins.cmake.in.
set(is_plugin_and_module_in_same_project FALSE)
if(NOT is_imported_qt_module)
# This QT_PLUGINS assignment is only used by QtPostProcessHelpers to decide if a
# QtModulePlugins.cmake file should be generated (which only happens in static builds).
set_property(TARGET "${qt_module_target}" APPEND PROPERTY QT_PLUGINS "${target}")
get_target_property(module_source_dir ${qt_module_target} SOURCE_DIR)
get_directory_property(module_project_name
DIRECTORY ${module_source_dir}
DEFINITION PROJECT_NAME
)
if(module_project_name STREQUAL PROJECT_NAME)
set(is_plugin_and_module_in_same_project TRUE)
endif()
# When linking static plugins with the special logic in qt_internal_add_executable,
# make sure to skip non-default plugins.
if(is_plugin_and_module_in_same_project AND _default_plugin)
set_property(TARGET ${qt_module_target} APPEND PROPERTY
_qt_initial_repo_plugins
"${target}")
set_property(TARGET ${qt_module_target} APPEND PROPERTY
_qt_initial_repo_plugin_class_names
"$<TARGET_PROPERTY:${target},QT_PLUGIN_CLASS_NAME>"
)
endif()
endif()
# Associate plugin with its Qt module when the plugin is built in the current repository
# but the module is built in a different repository (qtsvg's QSvgPlugin associated with
# qtbase's QtGui).
# The association is done in a separate property, to ensure that reconfiguring in-tree tests
# in qtbase doesn't accidentally cause linking to a plugin from a previously built qtsvg.
# Needed for in-tree tests like in qtsvg, qtimageformats.
# This is done for each Qt module regardless if it's an imported target or not, to handle
# both per-repo and top-level builds (in per-repo build of qtsvg QtGui is imported, in a
# top-level build Gui is not imported, but in both cases qtsvg tests need to link to
# QSvgPlugin).
#
# TODO: Top-level in-tree tests and qdeclarative per-repo in-tree tests that depend on
# static Qml plugins won't work due to the requirement of running qmlimportscanner
# at configure time, but qmlimportscanner is not built at that point. Moving the
# execution of qmlimportscanner to build time is non-trivial because qmlimportscanner
# not only generates a cpp file to compile but also outputs a list of static plugins
# that should be linked and there is no straightforward way to tell CMake to link
# against a list of libraries that was discovered at build time (apart from
# response files, which apparently might not work on all platforms).
# qmake doesn't have this problem because each project is configured separately so
# qmlimportscanner is always built by the time it needs to be run for a test.
if(NOT is_plugin_and_module_in_same_project AND _default_plugin)
string(MAKE_C_IDENTIFIER "${PROJECT_NAME}" current_project_name)
set(prop_prefix "_qt_repo_${current_project_name}")
set_property(TARGET ${qt_module_target} APPEND PROPERTY
${prop_prefix}_plugins "${target}")
set_property(TARGET ${qt_module_target} APPEND PROPERTY
${prop_prefix}_plugin_class_names
"$<TARGET_PROPERTY:${target},QT_PLUGIN_CLASS_NAME>"
)
endif()
endif()
# Change the configuration file install location for qml plugins into the Qml package location.
if(plugin_type_escaped STREQUAL "qml_plugin" AND TARGET "${INSTALL_CMAKE_NAMESPACE}::Qml")
set(plugin_install_package_suffix "Qml/QmlPlugins")
endif()
# Save the install package suffix as a property, so that the Dependencies file is placed
# in the correct location.
if(plugin_install_package_suffix)
set_target_properties("${target}" PROPERTIES
_qt_plugin_install_package_suffix "${plugin_install_package_suffix}")
endif()
if(TARGET qt_plugins)
add_dependencies(qt_plugins "${target}")
endif()
if(arg_TYPE STREQUAL "platforms")
if(TARGET qpa_plugins)
add_dependencies(qpa_plugins "${target}")
endif()
if(_default_plugin AND TARGET qpa_default_plugins)
add_dependencies(qpa_default_plugins "${target}")
endif()
endif()
@ -184,10 +294,7 @@ function(qt_internal_add_plugin target)
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
DEFINES
${arg_DEFINES}
QT_DEPRECATED_WARNINGS
${deprecation_define}
"${static_plugin_define}"
QT_PLUGIN
PUBLIC_DEFINES
${arg_PUBLIC_DEFINES}
FEATURE_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
@ -287,20 +394,29 @@ function(qt_internal_add_plugin target)
endif()
qt_internal_add_linker_version_script(${target})
qt_add_list_file_finalizer(qt_finalize_plugin ${target} "${install_directory}")
set(finalizer_extra_args "")
if(NOT arg_SKIP_INSTALL)
list(APPEND finalizer_extra_args INSTALL_PATH "${install_directory}")
endif()
qt_add_list_file_finalizer(qt_finalize_plugin ${target} ${finalizer_extra_args})
qt_enable_separate_debug_info(${target} "${install_directory}")
qt_internal_install_pdb_files(${target} "${install_directory}")
if(NOT arg_SKIP_INSTALL)
qt_enable_separate_debug_info(${target} "${install_directory}")
qt_internal_install_pdb_files(${target} "${install_directory}")
endif()
endfunction()
function(qt_finalize_plugin target install_directory)
function(qt_finalize_plugin target)
cmake_parse_arguments(arg "" "INSTALL_PATH" "" ${ARGN})
if(WIN32 AND BUILD_SHARED_LIBS)
_qt_internal_generate_win32_rc_file("${target}")
endif()
# Generate .prl files for plugins of static Qt builds.
if(NOT BUILD_SHARED_LIBS)
qt_generate_prl_file(${target} "${install_directory}")
if(arg_INSTALL_PATH)
qt_generate_prl_file(${target} "${arg_INSTALL_PATH}")
endif()
endif()
endfunction()
@ -311,8 +427,7 @@ function(qt_get_sanitized_plugin_type plugin_type out_var)
endfunction()
# Utility function to find the module to which a plug-in belongs.
# This will set the QT_MODULE target property on the plug-in - e.g. "Gui", "Sql"...
function(qt_get_module_for_plugin target target_type)
function(qt_internal_get_module_for_plugin target target_type out_var)
qt_internal_get_qt_all_known_modules(known_modules)
qt_get_sanitized_plugin_type("${target_type}" target_type)
@ -327,14 +442,10 @@ function(qt_get_module_for_plugin target target_type)
get_target_property(plugin_types
"${QT_CMAKE_EXPORT_NAMESPACE}::${qt_module}"
MODULE_PLUGIN_TYPES)
if(plugin_types)
foreach(plugin_type ${plugin_types})
if("${target_type}" STREQUAL "${plugin_type}")
set_target_properties("${target}" PROPERTIES QT_MODULE "${qt_module}")
return()
endif()
endforeach()
if(plugin_types AND target_type IN_LIST plugin_types)
set("${out_var}" "${qt_module}" PARENT_SCOPE)
return()
endif()
endforeach()
message(AUTHOR_WARNING "The plug-in '${target}' does not belong to any Qt module.")
message(FATAL_ERROR "The plug-in '${target}' does not belong to any Qt module.")
endfunction()

View File

@ -19,7 +19,9 @@ function(__qt_internal_add_static_plugins_once)
foreach(_config_file ${_qt_plugin_config_files})
string(REGEX REPLACE "^.*/@INSTALL_CMAKE_NAMESPACE@(.*Plugin)Config.cmake$" "\\1" _qt_plugin "${_config_file}")
include("${_config_file}")
list(APPEND _qt_plugins ${_qt_plugin})
if(TARGET "@INSTALL_CMAKE_NAMESPACE@::${_qt_plugin}")
list(APPEND _qt_plugins ${_qt_plugin})
endif()
endforeach()
set_property(TARGET ${_module_target} PROPERTY QT_PLUGINS ${_qt_plugins})
@ -29,27 +31,12 @@ function(__qt_internal_add_static_plugins_once)
endif()
set(_default_plugins_are_enabled "$<NOT:$<STREQUAL:$<GENEX_EVAL:$<TARGET_PROPERTY:QT_DEFAULT_PLUGINS>>,0>>")
# Make sure to boolify the result of the expression, in case if the returned property value
# is empty.
set(_default_plugins_are_enabled_wrapped "$<BOOL:${_default_plugins_are_enabled}>")
set(_manual_plugins_genex "$<GENEX_EVAL:$<TARGET_PROPERTY:QT_PLUGINS>>")
set(_no_plugins_genex "$<GENEX_EVAL:$<TARGET_PROPERTY:QT_NO_PLUGINS>>")
# Plugin genex marker for prl processing.
set(_is_plugin_marker_genex "$<BOOL:QT_IS_PLUGIN_GENEX>")
# In super builds the rules below pollute the dependency rule for the
# plugin target when it's being build, causing cyclic dependencies.
# to overcome this, we check if the current target where this rule evaluates
# has a QT_BUILD_PROJECT_NAME equal to the current PROJECT_NAME.
# If so we disable the injection of plugin link rules to avoid cyclic
# dependencies.
if (@QT_SUPERBUILD@)
set(_build_allow_plugin_link_rules_genex "$<NOT:$<STREQUAL:$<TARGET_PROPERTY:QT_BUILD_PROJECT_NAME>,@PROJECT_NAME@>>")
else()
set(_build_allow_plugin_link_rules_genex 1)
endif()
# The code in here uses the properties defined in qt_import_plugins (Qt6CoreMacros.cmake)
foreach(target ${_qt_plugins})
set(_plugin_target "@INSTALL_CMAKE_NAMESPACE@::${target}")
@ -114,18 +101,24 @@ function(__qt_internal_add_static_plugins_once)
">"
)
# No point in linking the plugin initialization source file into static libraries. The
# initialization symbol will be discarded by the linker when the static lib is linked into an
# executable or shared library, because nothing is referencing the global static symbol.
set(type_genex "$<TARGET_PROPERTY:TYPE>")
set(no_static_genex "$<NOT:$<STREQUAL:${type_genex},STATIC_LIBRARY>>")
# Complete condition that defines whether a static plugin is linked
string(CONCAT _plugin_condition
"$<BOOL:$<AND:"
"${_is_plugin_marker_genex},"
"${_build_allow_plugin_link_rules_genex},"
"${no_static_genex},"
"$<OR:"
"${_plugin_is_whitelisted},"
"${_plugin_versionless_is_whitelisted},"
"${_plugin_is_in_type_whitelist},"
"${_plugin_versionless_is_in_type_whitelist},"
"$<AND:"
"${_default_plugins_are_enabled_wrapped},"
"${_default_plugins_are_enabled},"
"${_plugin_is_default},"
"${_plugin_is_not_blacklisted}"
">"
@ -139,15 +132,23 @@ function(__qt_internal_add_static_plugins_once)
set(_generated_qt_plugin_file_name
"${CMAKE_CURRENT_BINARY_DIR}/qt_@QT_MODULE@_${target}.cpp")
set(_generated_qt_plugin_file_name_template "${_generated_qt_plugin_file_name}.in")
set(_generated_qt_plugin_file_content "#include <QtPlugin>\nQ_IMPORT_PLUGIN(${_classname})")
# Generate a source file to import that plug-in. Has to be done with configure_file,
# because file(GENERATE) and target_sources has issues with scopes.
file(WRITE "${_generated_qt_plugin_file_name_template}"
"${_generated_qt_plugin_file_content}")
configure_file("${_generated_qt_plugin_file_name_template}"
"${_generated_qt_plugin_file_name}")
# Generate a source file to import that plug-in. Be careful not to
# update the timestamp of the generated file if we are not going to
# change anything. Otherwise we will trigger CMake's autogen to re-run
# and executables will then need to at least relink.
set(need_write TRUE)
if(EXISTS ${_generated_qt_plugin_file_name})
file(READ ${_generated_qt_plugin_file_name} old_contents)
if(old_contents STREQUAL "${_generated_qt_plugin_file_content}")
set(need_write FALSE)
endif()
endif()
if(need_write)
file(WRITE "${_generated_qt_plugin_file_name}"
"${_generated_qt_plugin_file_content}")
endif()
target_sources(${_module_target} INTERFACE
"$<${_plugin_condition}:${_generated_qt_plugin_file_name}>")
@ -156,6 +157,6 @@ function(__qt_internal_add_static_plugins_once)
set_target_properties(${_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endfunction()
if(NOT @BUILD_SHARED_LIBS@)
if(NOT @BUILD_SHARED_LIBS@ AND NOT QT_NO_CREATE_TARGETS)
__qt_internal_add_static_plugins_once()
endif()

View File

@ -13,3 +13,4 @@ if (ANDROID)
endif()
qt_internal_install_prl_files()
qt_internal_generate_user_facing_tools_info()

View File

@ -57,8 +57,14 @@ macro(qt_collect_third_party_deps target)
set(package_components "")
endif()
get_target_property(package_optional_components ${dep}
INTERFACE_QT_PACKAGE_OPTIONAL_COMPONENTS)
if(NOT package_optional_components)
set(package_optional_components "")
endif()
list(APPEND third_party_deps
"${package_name}\;${package_is_optional}\;${package_version}\;${package_components}")
"${package_name}\;${package_is_optional}\;${package_version}\;${package_components}\;${package_optional_components}")
endif()
endif()
endforeach()
@ -619,6 +625,27 @@ endif()
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${install_prefix_content}")
if(NOT BUILD_SHARED_LIBS)
# The top-level check needs to happen inside QtBuildInternals, because it's possible
# to configure a top-level build with a few repos and then configure another repo
# using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not
# be set anymore.
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES AND NOT QT_SUPERBUILD)
qt_internal_read_repo_dependencies(QT_REPO_DEPENDENCIES \"$\{PROJECT_SOURCE_DIR}\")
endif()
")
endif()
if(DEFINED OpenGL_GL_PREFERENCE)
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
# Use the OpenGL_GL_PREFERENCE value qtbase was built with. But do not FORCE it.
set(OpenGL_GL_PREFERENCE \"${OpenGL_GL_PREFERENCE}\" CACHE STRING \"\")
")
endif()
qt_compute_relative_path_from_cmake_config_dir_to_prefix()
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake.in"
@ -633,7 +660,7 @@ endfunction()
function(qt_modules_process_android_dependencies)
qt_internal_get_qt_repo_known_modules(repo_known_modules)
foreach (target ${repo_known_modules})
qt_android_dependencies(${target})
qt_internal_android_dependencies(${target})
endforeach()
endfunction()
@ -698,12 +725,38 @@ function(qt_internal_create_config_file_for_standalone_tests)
endfunction()
function(qt_internal_install_prl_files)
# Install prl files
# Get locations relative to QT_BUILD_DIR from which prl files should be installed.
get_property(prl_install_dirs GLOBAL PROPERTY QT_PRL_INSTALL_DIRS)
# Clear the list of install dirs so the previous values don't pollute the list of install dirs
# for the next repository in a top-level build.
set_property(GLOBAL PROPERTY QT_PRL_INSTALL_DIRS "")
foreach(prl_install_dir ${prl_install_dirs})
qt_install(DIRECTORY "${PROJECT_BINARY_DIR}/${prl_install_dir}/"
qt_install(DIRECTORY "${QT_BUILD_DIR}/${prl_install_dir}/"
DESTINATION ${prl_install_dir}
FILES_MATCHING PATTERN "*.prl"
)
endforeach()
endfunction()
function(qt_internal_generate_user_facing_tools_info)
if("${INSTALL_PUBLICBINDIR}" STREQUAL "")
return()
endif()
get_property(user_facing_tool_targets GLOBAL PROPERTY QT_USER_FACING_TOOL_TARGETS)
set(lines "")
foreach(target ${user_facing_tool_targets})
get_target_property(filename ${target} OUTPUT_NAME)
if(NOT filename)
set(filename ${target})
endif()
qt_path_join(tool_target_path "${CMAKE_INSTALL_PREFIX}" "${INSTALL_BINDIR}" "${filename}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${filename}${PROJECT_VERSION_MAJOR}")
list(APPEND lines "${tool_target_path} ${tool_link_path}")
endforeach()
string(REPLACE ";" "\n" content "${lines}")
string(APPEND content "\n")
set(out_file "${PROJECT_BINARY_DIR}/user_facing_tool_links.txt")
file(WRITE "${out_file}" "${content}")
endfunction()

View File

@ -55,8 +55,10 @@ function(qt_generate_qmake_libraries_pri_content module_name output_root_dir out
endforeach()
# Filter out implicit include directories
string(PREPEND lib_incdir "$<FILTER:")
string(APPEND lib_incdir ",EXCLUDE,${implicit_include_dirs_regex}>")
if(implicit_include_dirs_regex)
string(PREPEND lib_incdir "$<FILTER:")
string(APPEND lib_incdir ",EXCLUDE,${implicit_include_dirs_regex}>")
endif()
set(uccfg $<UPPER_CASE:$<CONFIG>>)
string(APPEND content "list(APPEND known_libs ${uclib})
@ -244,7 +246,7 @@ function(qt_generate_module_pri_file target)
if (arg_INTERNAL_MODULE)
string(APPEND config_module_name "_private")
# Internal module pri needs to provide private headers
set(public_module_includes "${private_module_includes}")
set(public_module_includes "${public_module_includes} ${private_module_includes}")
endif()
qt_path_join(target_path ${QT_BUILD_DIR} ${INSTALL_MKSPECSDIR}/modules)
@ -375,6 +377,13 @@ QT.${config_module_name}_private.disabled_features = ${disabled_private_features
${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}
${CMAKE_STATIC_LIBRARY_SUFFIX})
if(MSVC)
set(link_library_flag "-l")
file(TO_CMAKE_PATH "$ENV{LIB};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" implicit_link_directories)
else()
set(link_library_flag ${CMAKE_LINK_LIBRARY_FLAG})
set(implicit_link_directories ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
endif()
add_custom_command(
OUTPUT "${private_pri_file_path}"
DEPENDS ${inputs}
@ -383,8 +392,9 @@ QT.${config_module_name}_private.disabled_features = ${disabled_private_features
COMMAND ${CMAKE_COMMAND} "-DIN_FILES=${inputs}" "-DOUT_FILE=${private_pri_file_path}"
"-DLIBRARY_PREFIXES=${library_prefixes}"
"-DLIBRARY_SUFFIXES=${library_suffixes}"
"-DLINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG}"
"-DLINK_LIBRARY_FLAG=${link_library_flag}"
"-DCONFIGS=${configs}"
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtGenerateLibPri.cmake"
VERBATIM)
add_custom_target(${target}_lib_pri DEPENDS "${private_pri_file_path}")
@ -454,7 +464,7 @@ function(qt_generate_plugin_pri_file target pri_file_var)
get_target_property(plugin_class_name ${target} QT_PLUGIN_CLASS_NAME)
set(plugin_extends "")
if(NOT default_plugin AND (plugin_type STREQUAL "generic" OR plugin_type STREQUAL "platforms"))
if(NOT default_plugin)
set(plugin_extends "-")
endif()
@ -631,7 +641,9 @@ function(qt_generate_global_device_pri_file)
# Write android specific device info.
if(ANDROID)
file(TO_CMAKE_PATH ${ANDROID_SDK_ROOT} ANDROID_SDK_ROOT)
string(APPEND content "DEFAULT_ANDROID_SDK_ROOT = ${ANDROID_SDK_ROOT}\n")
file(TO_CMAKE_PATH ${ANDROID_NDK} ANDROID_NDK)
string(APPEND content "DEFAULT_ANDROID_NDK_ROOT = ${ANDROID_NDK}\n")
set(android_platform "android-23")
@ -782,6 +794,13 @@ CONFIG += ${private_config_joined}
${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}
${CMAKE_STATIC_LIBRARY_SUFFIX})
if(MSVC)
set(link_library_flag "-l")
file(TO_CMAKE_PATH "$ENV{LIB};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" implicit_link_directories)
else()
set(link_library_flag ${CMAKE_LINK_LIBRARY_FLAG})
set(implicit_link_directories ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
endif()
add_custom_command(
OUTPUT "${qmodule_pri_target_path}"
DEPENDS ${inputs}
@ -790,8 +809,9 @@ CONFIG += ${private_config_joined}
COMMAND ${CMAKE_COMMAND} "-DIN_FILES=${inputs}" "-DOUT_FILE=${qmodule_pri_target_path}"
"-DLIBRARY_PREFIXES=${library_prefixes}"
"-DLIBRARY_SUFFIXES=${library_suffixes}"
"-DLINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG}"
"-DLINK_LIBRARY_FLAG=${link_library_flag}"
"-DCONFIGS=${configs}"
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtGenerateLibPri.cmake"
VERBATIM)
add_custom_target(qmodule_pri DEPENDS "${qmodule_pri_target_path}")

View File

@ -187,7 +187,7 @@ function(qt_internal_walk_libs
if(lib_rcc_objects_${target})
qt_merge_libs(rcc_objects ${lib_rcc_objects_${target}})
endif()
else()
elseif(NOT lib_target_type STREQUAL "OBJECT_LIBRARY")
qt_merge_libs(libs "$<TARGET_LINKER_FILE:${lib_target}>")
get_target_property(target_rcc_objects "${lib_target}" _qt_rcc_objects)
@ -379,6 +379,13 @@ ${prl_step1_content_libs}
qt_path_join(prl_meta_info_path
"${CMAKE_CURRENT_BINARY_DIR}"
"${prl_meta_info_name_prefix}${config}${prl_meta_info_name_suffix}")
if(MSVC)
set(link_library_flag "-l")
file(TO_CMAKE_PATH "$ENV{LIB};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" implicit_link_directories)
else()
set(link_library_flag ${CMAKE_LINK_LIBRARY_FLAG})
set(implicit_link_directories ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
endif()
add_custom_command(
OUTPUT "${prl_step2_path}"
DEPENDS "${prl_step1_path}"
@ -391,8 +398,9 @@ ${prl_step1_content_libs}
"-DOUT_FILE=${prl_step2_path}"
"-DLIBRARY_PREFIXES=${library_prefixes}"
"-DLIBRARY_SUFFIXES=${library_suffixes}"
"-DLINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG}"
"-DLINK_LIBRARY_FLAG=${link_library_flag}"
"-DQT_LIB_DIRS=${qt_lib_dirs}"
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtFinishPrlFile.cmake"
VERBATIM
COMMENT "Generating prl file for target ${target}"

View File

@ -28,8 +28,10 @@ endmacro()
if("${MODULE_ROOT}" STREQUAL "")
# If MODULE_ROOT is not set, assume that we want to build qtbase or top-level.
get_filename_component(MODULE_ROOT ".." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(auto_detect_generator TRUE)
else()
file(TO_CMAKE_PATH "${MODULE_ROOT}" MODULE_ROOT)
set(auto_detect_generator FALSE)
endif()
set(configure_filename "configure.cmake")
set(commandline_filename "qt_cmdline.cmake")
@ -47,7 +49,6 @@ list(FILTER configure_args EXCLUDE REGEX "^[ \t]*$")
list(TRANSFORM configure_args STRIP)
list(TRANSFORM configure_args REPLACE "\\\\" "\\\\\\\\")
unset(generator)
set(auto_detect_generator TRUE)
set(auto_detect_compiler TRUE)
unset(device_options)
set_property(GLOBAL PROPERTY UNHANDLED_ARGS "")
@ -185,6 +186,10 @@ function(qt_commandline_assignment var internal_var)
set(commandline_nr_of_assignments ${n} PARENT_SCOPE)
endfunction()
# Check the following variable in configure.cmake files to guard code that is not covered by the
# stub functions above.
set(QT_CONFIGURE_RUNNING ON)
####################################################################################################
# Load qt_cmdline.cmake files
@ -361,7 +366,7 @@ function(qt_commandline_addString arg val nextok)
qtConfValidateValue("${arg}" "${val}" success)
if(success)
if(DEFINED command_line_option_${arg}_variable)
set(opt ${command_line_option_${arg}_variable)
set(arg ${command_line_option_${arg}_variable})
endif()
set_property(GLOBAL APPEND PROPERTY "INPUT_${arg}" "${val}")
set_property(GLOBAL APPEND PROPERTY CONFIG_INPUTS ${arg})
@ -587,18 +592,55 @@ macro(translate_list_input name cmake_var)
endif()
endmacro()
# Check whether to guess the compiler for the given language.
#
# Sets ${out_var} to FALSE if one of the following holds:
# - the environment variable ${env_var} is non-empty
# - the CMake variable ${cmake_var} is set on the command line
#
# Otherwise, ${out_var} is set to TRUE.
function(check_whether_to_guess_compiler out_var env_var cmake_var)
set(result TRUE)
if(NOT "$ENV{${env_var}}" STREQUAL "")
set(result FALSE)
else()
set(filtered_args ${cmake_args})
list(FILTER filtered_args INCLUDE REGEX "^(-D)?${cmake_var}=")
if(NOT "${filtered_args}" STREQUAL "")
set(result FALSE)
endif()
endif()
set(${out_var} ${result} PARENT_SCOPE)
endfunction()
# Try to guess the mkspec from the -platform configure argument.
function(guess_compiler_from_mkspec)
if(NOT auto_detect_compiler)
return()
endif()
check_whether_to_guess_compiler(guess_c_compiler CC CMAKE_C_COMPILER)
check_whether_to_guess_compiler(guess_cxx_compiler CXX CMAKE_CXX_COMPILER)
if(NOT guess_c_compiler AND NOT guess_cxx_compiler)
return()
endif()
string(REGEX MATCH "(^|;)-DQT_QMAKE_TARGET_MKSPEC=\([^;]+\)" m "${cmake_args}")
set(mkspec ${CMAKE_MATCH_2})
set(c_compiler "")
set(cxx_compiler "")
if(mkspec MATCHES "-clang(-|$)" AND NOT mkspec MATCHES "android")
push("-DCMAKE_C_COMPILER=clang")
push("-DCMAKE_CXX_COMPILER=clang++")
set(c_compiler "clang")
set(cxx_compiler "clang++")
elseif(mkspec MATCHES "-icc(-|$)")
push("-DCMAKE_C_COMPILER=icc")
push("-DCMAKE_CXX_COMPILER=icpc")
set(c_compiler "icc")
set(cxx_compiler "icpc")
endif()
if(guess_c_compiler AND NOT c_compiler STREQUAL "")
push("-DCMAKE_C_COMPILER=${c_compiler}")
endif()
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
endif()
set(cmake_args "${cmake_args}" PARENT_SCOPE)
endfunction()
@ -610,7 +652,7 @@ function(check_qt_build_parts type)
set(buildFlag "FALSE")
endif()
list(APPEND knownParts "tests" "examples" "benchmarks")
list(APPEND knownParts "tests" "examples" "benchmarks" "manual-tests" "minimal-static-tests")
foreach(part ${${input}})
if(part IN_LIST knownParts)
@ -638,12 +680,13 @@ translate_string_input(qt_libinfix QT_LIBINFIX)
translate_string_input(qreal QT_COORD_TYPE)
translate_path_input(prefix CMAKE_INSTALL_PREFIX)
translate_path_input(extprefix CMAKE_STAGING_PREFIX)
foreach(kind bin lib archdata libexec qml data doc translation sysconf examples tests)
foreach(kind bin lib archdata libexec qml data doc sysconf examples tests)
string(TOUPPER ${kind} uc_kind)
translate_path_input(${kind}dir INSTALL_${uc_kind}DIR)
endforeach()
translate_path_input(headerdir INSTALL_INCLUDEDIR)
translate_path_input(plugindir INSTALL_PLUGINSDIR)
translate_path_input(translationdir INSTALL_TRANSLATIONSDIR)
if(NOT "${INPUT_device}" STREQUAL "")
push("-DQT_QMAKE_TARGET_MKSPEC=devices/${INPUT_device}")
@ -726,11 +769,6 @@ if("${INPUT_ltcg}" STREQUAL "yes")
endforeach()
endif()
if(NOT "${INPUT_opengl}" STREQUAL "")
drop_input(opengl)
push("-DINPUT_opengl=${INPUT_opengl}")
endif()
translate_list_input(device-option QT_QMAKE_DEVICE_OPTIONS)
translate_list_input(defines QT_EXTRA_DEFINES)
translate_list_input(fpaths QT_EXTRA_FRAMEWORKPATHS)
@ -738,13 +776,6 @@ translate_list_input(includes QT_EXTRA_INCLUDEPATHS)
translate_list_input(lpaths QT_EXTRA_LIBDIRS)
translate_list_input(rpaths QT_EXTRA_RPATHS)
foreach(feature ${commandline_known_features})
qt_feature_normalize_name("${feature}" cmake_feature)
if(${feature} IN_LIST config_inputs)
translate_boolean_input(${feature} INPUT_${cmake_feature})
endif()
endforeach()
foreach(input ${config_inputs})
qt_feature_normalize_name("${input}" cmake_input)
push("-DINPUT_${cmake_input}=${INPUT_${input}}")

View File

@ -4,9 +4,10 @@ function(qt_internal_setup_public_platform_target)
## QtPlatform Target:
add_library(Platform INTERFACE)
add_library(Qt::Platform ALIAS Platform)
add_library(${INSTALL_CMAKE_NAMESPACE}::Platform ALIAS Platform)
target_include_directories(Platform
INTERFACE
$<BUILD_INTERFACE:${QT_PLATFORM_DEFINITION_DIR_ABSOLUTE}>
$<BUILD_INTERFACE:${QT_PLATFORM_DEFINITION_BUILD_INTERFACE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${QT_PLATFORM_DEFINITION_DIR}>
$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>
@ -29,4 +30,6 @@ function(qt_internal_setup_public_platform_target)
# By default enable utf8 sources for both Qt and Qt consumers. Can be opted out.
qt_enable_utf8_sources(Platform)
# By default enable unicode on WIN32 platforms for both Qt and Qt consumers. Can be opted out.
qt_internal_enable_unicode_defines(Platform)
endfunction()

View File

@ -56,6 +56,7 @@ function(qt_generate_qconfig_cpp)
qt_add_string_to_qconfig_cpp("") # config.input.sysroot
qt_add_string_to_qconfig_cpp("false") # qmake_sysrootify
qt_add_string_to_qconfig_cpp("${INSTALL_BINDIR}")
qt_add_string_to_qconfig_cpp("${INSTALL_LIBEXECDIR}")
qt_add_string_to_qconfig_cpp("${INSTALL_LIBDIR}")
qt_add_string_to_qconfig_cpp("${hostdatadir}")
qt_add_string_to_qconfig_cpp("${QT_QMAKE_TARGET_MKSPEC}")
@ -91,6 +92,23 @@ function(qt_generate_qconfig_cpp)
set(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "${from_bin_dir_to_prefix}")
set(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "${from_bin_dir_to_prefix}")
# Ensure Windows drive letter is prepended to the install prefix hardcoded
# into qconfig.cpp, otherwise qmake can't find Qt modules in a static Qt
# build if there's no qt.conf. Mostly relevant for CI.
# Given input like
# \work/qt/install
# or
# \work\qt\install
# Expected output is something like
# C:/work/qt/install
# so it includes a drive letter and forward slashes.
set(QT_CONFIGURE_PREFIX_PATH_STR "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
if(CMAKE_HOST_WIN32)
get_filename_component(
QT_CONFIGURE_PREFIX_PATH_STR
"${QT_CONFIGURE_PREFIX_PATH_STR}" REALPATH)
endif()
configure_file(global/qconfig.cpp.in global/qconfig.cpp @ONLY)
endfunction()

View File

@ -23,13 +23,13 @@ function(qt_internal_add_resource target resourceName)
)
qt_internal_record_rcc_object_files("${target}" "${out_targets}"
INSTALL_LOCATION "${INSTALL_LIBDIR}")
INSTALL_DIRECTORY "${INSTALL_LIBDIR}")
endif()
endfunction()
function(qt_internal_record_rcc_object_files target resource_targets)
set(args_optional "")
set(args_single INSTALL_LOCATION)
set(args_single INSTALL_DIRECTORY)
set(args_multi "")
cmake_parse_arguments(arg
@ -48,7 +48,7 @@ function(qt_internal_record_rcc_object_files target resource_targets)
# Compute the install location of a resource object file in a prefix build.
# It's comprised of thee following path parts:
#
# part (1) INSTALL_LOCATION.
# part (1) INSTALL_DIRECTORY.
# A usual value is '${INSTALL_LIBDIR}/' for libraries
# and '${INSTALL_QMLDIR}/foo/bar/' for qml plugin resources.
#
@ -70,9 +70,9 @@ function(qt_internal_record_rcc_object_files target resource_targets)
set(object_file_name "${generated_cpp_file_relative_path}${CMAKE_CXX_OUTPUT_EXTENSION}")
qt_path_join(rcc_object_file_path
"objects-$<CONFIG>" ${out_target} "${object_file_name}")
if(arg_INSTALL_LOCATION)
if(arg_INSTALL_DIRECTORY)
qt_path_join(rcc_object_file_path
"${arg_INSTALL_LOCATION}" "${rcc_object_file_path}")
"${arg_INSTALL_DIRECTORY}" "${rcc_object_file_path}")
else()
message(FATAL_ERROR "No install location given for object files to be installed"
" for the following resource target: '${out_target}'")

View File

@ -20,7 +20,7 @@ function(qt_compute_relative_rpath_base rpath install_location out_var)
# needed in the .prf files, but for CMake we need to prepend them ourselves.
if(APPLE)
set(rpath_rel_base "@loader_path")
elseif(LINUX)
elseif(LINUX OR SOLARIS OR FREEBSD)
set(rpath_rel_base "$ORIGIN")
else()
message(WARNING "No known RPATH_REL_BASE for target platform.")

View File

@ -164,6 +164,7 @@ option(QT_BUILD_EXAMPLES "Build Qt examples" OFF)
option(QT_BUILD_EXAMPLES_BY_DEFAULT "Should examples be built as part of the default 'all' target." ON)
option(QT_BUILD_MANUAL_TESTS "Build Qt manual tests" OFF)
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" OFF)
## Find host tools (if non native):
set(QT_HOST_PATH "" CACHE PATH "Installed Qt host directory path, used for cross compiling.")

View File

@ -15,7 +15,7 @@ function(qt_ensure_sync_qt)
endif()
# When building qtbase, use the source syncqt, otherwise use the installed one.
set(SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/bin/syncqt.pl")
set(SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/libexec/syncqt.pl")
if(NOT ("${QtBase_SOURCE_DIR}" STREQUAL "") AND EXISTS "${SYNCQT_FROM_SOURCE}")
set(QT_SYNCQT "${SYNCQT_FROM_SOURCE}" CACHE FILEPATH "syncqt script")
message(STATUS "Using source syncqt found at: ${QT_SYNCQT}")
@ -23,10 +23,6 @@ function(qt_ensure_sync_qt)
qt_path_join(syncqt_install_dir ${QT_INSTALL_DIR} ${INSTALL_LIBEXECDIR})
qt_copy_or_install(PROGRAMS "${SYNCQT_FROM_SOURCE}"
DESTINATION "${syncqt_install_dir}")
qt_path_join(syncqt_install_dir ${QT_INSTALL_DIR} ${INSTALL_BINDIR})
qt_copy_or_install(PROGRAMS "${SYNCQT_FROM_SOURCE}"
DESTINATION "${syncqt_install_dir}")
elseif(NOT "${QT_HOST_PATH}" STREQUAL "")
get_filename_component(syncqt_absolute_path
"${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}/syncqt.pl"

View File

@ -264,43 +264,6 @@ function(qt_internal_check_directory_or_type name dir type default result_var)
endif()
endfunction()
function(qt_internal_apply_win_prefix_and_suffix target)
if(WIN32)
# Table of prefix / suffixes for MSVC libraries as qmake expects them to be created.
# static - Qt6EdidSupport.lib (platform support libraries / or static QtCore, etc)
# shared - Qt6Core.dll
# shared import library - Qt6Core.lib
# module aka Qt plugin - qwindows.dll
# module import library - qwindows.lib
#
# The CMake defaults are fine for us.
# Table of prefix / suffixes for MinGW libraries as qmake expects them to be created.
# static - libQt6EdidSupport.a (platform support libraries / or static QtCore, etc)
# shared - Qt6Core.dll
# shared import library - libQt6Core.a
# module aka Qt plugin - qwindows.dll
# module import library - libqwindows.a
#
# CMake for Windows-GNU platforms defaults the prefix to "lib".
# CMake for Windows-GNU platforms defaults the import suffix to ".dll.a".
# These CMake defaults are not ok for us.
# This should cover both MINGW with GCC and CLANG.
if(NOT MSVC)
set_property(TARGET "${target}" PROPERTY IMPORT_SUFFIX ".a")
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "STATIC_LIBRARY")
set_property(TARGET "${target}" PROPERTY PREFIX "lib")
else()
set_property(TARGET "${target}" PROPERTY PREFIX "")
set_property(TARGET "${target}" PROPERTY IMPORT_PREFIX "lib")
endif()
endif()
endif()
endfunction()
function(qt_internal_strip_target_directory_scope_token target out_var)
# In CMake versions earlier than CMake 3.18, a subdirectory scope id is appended to the
# target name if the target is referenced in a target_link_libraries command from a
@ -504,7 +467,7 @@ function(qt_internal_create_tracepoints name tracepoints_file)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
qt_path_join(tracegen
"${QT_HOST_PATH}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
"tracegen")
else()
set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen")
@ -595,3 +558,7 @@ function(qt_internal_install_pdb_files target install_dir_path)
endif()
endif()
endfunction()
function(qt_disable_apple_app_extension_api_only target)
set_target_properties("${target}" PROPERTIES QT_NO_APP_EXTENSION_ONLY_API TRUE)
endfunction()

View File

@ -51,8 +51,10 @@ function(qt_internal_add_benchmark target)
add_dependencies("${target}_benchmark" "${target}")
#Add benchmark to meta target.
add_dependencies("benchmark" "${target}_benchmark")
# Add benchmark to meta target if it exists.
if (TARGET benchmark)
add_dependencies("benchmark" "${target}_benchmark")
endif()
endfunction()
# Simple wrapper around qt_internal_add_executable for manual tests which insure that
@ -240,7 +242,6 @@ function(qt_internal_add_test name)
set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
# QMLTest specifics
qt_internal_extend_target("${name}" CONDITION arg_QMLTEST
PUBLIC_LIBRARIES ${QT_CMAKE_EXPORT_NAMESPACE}::QuickTest
)
@ -254,6 +255,11 @@ function(qt_internal_add_test name)
DEFINES
QUICK_TEST_SOURCE_DIR=":/"
)
# Android requires Qt::Gui so add it by default for tests
qt_internal_extend_target("${name}" CONDITION ANDROID
PUBLIC_LIBRARIES ${QT_CMAKE_EXPORT_NAMESPACE}::Gui
)
endif()
foreach(path IN LISTS arg_QML_IMPORTPATH)
@ -379,18 +385,20 @@ function(qt_internal_add_test name)
"${CMAKE_CURRENT_SOURCE_DIR}")
qt_path_join(testdata_install_dir ${QT_INSTALL_DIR}
"${relative_path_to_test_project}")
foreach(testdata IN LISTS arg_TESTDATA)
set(testdata "${CMAKE_CURRENT_SOURCE_DIR}/${testdata}")
if (IS_DIRECTORY "${testdata}")
qt_install(
DIRECTORY "${testdata}"
DESTINATION "${testdata_install_dir}")
else()
qt_install(
FILES "${testdata}"
DESTINATION "${testdata_install_dir}")
endif()
endforeach()
if (testdata_install_dir)
foreach(testdata IN LISTS arg_TESTDATA)
set(testdata "${CMAKE_CURRENT_SOURCE_DIR}/${testdata}")
if (IS_DIRECTORY "${testdata}")
qt_install(
DIRECTORY "${testdata}"
DESTINATION "${testdata_install_dir}")
else()
qt_install(
FILES "${testdata}"
DESTINATION "${testdata_install_dir}")
endif()
endforeach()
endif()
endif()
endfunction()

View File

@ -2,15 +2,37 @@
# The BOOTSTRAP option allows building it as standalone program, otherwise
# it will be linked against QtCore.
#
# USER_FACING can be passed to mark the tool as a program that is supposed to be
# started directly by users.
#
# We must pass this function a target name obtained from
# qt_get_tool_target_name like this:
# qt_get_tool_target_name(target_name my_tool)
# qt_add_tool(${target_name})
# qt_internal_add_tool(${target_name})
#
# Option Arguments:
# INSTALL_VERSIONED_LINK
# Prefix build only. On installation, create a versioned hard-link of the installed file.
# E.g. create a link of "bin/qmake6" to "bin/qmake".
#
# One-value Arguments:
# EXTRA_CMAKE_FILES
# List of additional CMake files that will be installed alongside the tool's exported CMake
# files.
# INSTALL_DIR
# Takes a path, relative to the install prefix, like INSTALL_LIBEXECDIR.
# If this argument is omitted, the default is INSTALL_BINDIR.
# TOOLS_TARGET
# Specifies the module this tool belongs to. The module's Qt6${module}Tools.cmake file
# will then contain targets for this tool.
#
function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_QT;NO_INSTALL"
"TOOLS_TARGET;EXTRA_CMAKE_FILES;${__default_target_info_args}"
set(option_keywords BOOTSTRAP NO_QT NO_INSTALL USER_FACING INSTALL_VERSIONED_LINK)
set(one_value_keywords TOOLS_TARGET EXTRA_CMAKE_FILES INSTALL_DIR
${__default_target_info_args})
qt_parse_all_arguments(arg "qt_internal_add_tool" "${option_keywords}"
"${one_value_keywords}"
"${__default_private_args}" ${ARGN})
# Handle case when a tool does not belong to a module and it can't be built either (like
@ -23,7 +45,7 @@ function(qt_internal_add_tool target_name)
if(CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING AND (name STREQUAL target_name))
message(FATAL_ERROR
"qt_add_tool must be passed a target obtained from qt_get_tool_target_name.")
"qt_internal_add_tool must be passed a target obtained from qt_get_tool_target_name.")
endif()
set(full_name "${QT_CMAKE_EXPORT_NAMESPACE}::${name}")
@ -121,7 +143,12 @@ function(qt_internal_add_tool target_name)
set(no_qt NO_QT)
endif()
qt_internal_add_executable("${target_name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIR)
set(install_dir "${arg_INSTALL_DIR}")
endif()
qt_internal_add_executable("${target_name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${install_dir}"
${bootstrap}
${no_qt}
NO_INSTALL
@ -171,11 +198,15 @@ function(qt_internal_add_tool target_name)
)
endif()
if(arg_USER_FACING)
set_property(GLOBAL APPEND PROPERTY QT_USER_FACING_TOOL_TARGETS ${target_name})
endif()
# If building with a multi-config configuration, the main configuration tool will be placed in
# ./bin, while the rest will be in <CONFIG> specific subdirectories.
qt_get_tool_cmake_configuration(tool_cmake_configuration)
set_target_properties("${target_name}" PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${tool_cmake_configuration} "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
RUNTIME_OUTPUT_DIRECTORY_${tool_cmake_configuration} "${QT_BUILD_DIR}/${install_dir}"
)
if(NOT arg_NO_INSTALL AND arg_TOOLS_TARGET)
@ -193,6 +224,7 @@ function(qt_internal_add_tool target_name)
foreach(cmake_config ${cmake_configs})
qt_get_install_target_default_args(
OUT_VAR install_targets_default_args
RUNTIME "${install_dir}"
CMAKE_CONFIG "${cmake_config}"
ALL_CMAKE_CONFIGS "${cmake_configs}")
@ -212,12 +244,16 @@ function(qt_internal_add_tool target_name)
unset(install_initial_call_args)
endforeach()
qt_apply_rpaths(TARGET "${target_name}" INSTALL_PATH "${INSTALL_BINDIR}" RELATIVE_RPATH)
if(arg_INSTALL_VERSIONED_LINK)
qt_internal_install_versioned_link("${install_dir}" "${target_name}")
endif()
qt_apply_rpaths(TARGET "${target_name}" INSTALL_PATH "${install_dir}" RELATIVE_RPATH)
endif()
qt_enable_separate_debug_info(${target_name} "${INSTALL_BINDIR}")
qt_internal_install_pdb_files(${target_name} "${INSTALL_BINDIR}")
qt_enable_separate_debug_info(${target_name} "${install_dir}")
qt_internal_install_pdb_files(${target_name} "${install_dir}")
endfunction()
function(qt_export_tools module_name)

View File

@ -112,15 +112,53 @@ function(qt_internal_create_toolchain_file)
"set(CMAKE_OSX_DEPLOYMENT_TARGET \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" CACHE STRING \"\")")
endif()
# Save list of initial architectures Qt was configured with.
set(_qt_osx_architectures_escaped "${CMAKE_OSX_ARCHITECTURES}")
string(REPLACE ";" "LITERAL_SEMICOLON"
_qt_osx_architectures_escaped "${_qt_osx_architectures_escaped}")
set(docstring "List of architectures Qt was built with")
list(APPEND init_platform
"set(QT_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"${docstring}\")")
list(APPEND init_platform "")
# When building another qt repo, ensure the same list of architectures is used by default.
# Detection of a qt repo is done by checking for QT_REPO_MODULE_VERSION which is set in
# the repo's .cmake.conf file.
# Standalone tests will be not be built with multiple architectures to avoid issues in the
# CI when trying to run cmake build tests on VMs that do not have a universal macOS
# SDK.
list(APPEND init_platform "# Only build multiple architectures when building Qt itself")
list(APPEND init_platform "if((QT_REPO_MODULE_VERSION AND NOT QT_BUILD_STANDALONE_TESTS) OR QT_FORCE_QT_OSX_ARCHITECTURES)")
list(APPEND init_platform " set(__qt_toolchain_building_qt_repo TRUE)")
list(APPEND init_platform " set(CMAKE_OSX_ARCHITECTURES \"\${QT_OSX_ARCHITECTURES}\" CACHE STRING \"\")")
list(APPEND init_platform "endif()")
list(APPEND init_platform "")
# For macOS user projects, default to not specifying any architecture. This means CMake will
# not pass an -arch flag to the compiler and the compiler will choose the default
# architecture to build for.
# On Apple Silicon, CMake will introspect whether it's running under Rosetta and will
# pass the detected architecture (x86_64 under Rosetta or arm64 natively) to the compiler.
# This is line with default CMake behavior for user projects.
#
# For iOS, we provide a bit more convenience.
# When the user project is built using the Xcode generator, don't specify a default
# architecture and let Xcode and the developer handle it.
# When using the Ninja generator, specify the first architecture from QT_OSX_ARCHITECTURES
# (even with a simulator_and_device Qt build). This ensures that the default configuration
# at least tries to build something.
if(UIKIT)
qt_internal_get_first_osx_arch(osx_first_arch)
list(APPEND init_platform "if(NOT CMAKE_GENERATOR STREQUAL \"Xcode\" AND NOT __qt_toolchain_building_qt_repo)")
list(APPEND init_platform
" set(CMAKE_OSX_ARCHITECTURES \"${osx_first_arch}\" CACHE STRING \"\")")
list(APPEND init_platform "endif()")
list(APPEND init_platform "")
endif()
if(UIKIT)
list(APPEND init_platform
"set(CMAKE_SYSTEM_NAME \"${CMAKE_SYSTEM_NAME}\" CACHE STRING \"\")")
set(_qt_osx_architectures_escaped "${CMAKE_OSX_ARCHITECTURES}")
string(REPLACE ";" "LITERAL_SEMICOLON"
_qt_osx_architectures_escaped "${_qt_osx_architectures_escaped}")
list(APPEND init_platform
"set(CMAKE_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"\")")
list(APPEND init_platform "if(CMAKE_GENERATOR STREQUAL \"Xcode\" AND NOT QT_NO_XCODE_EMIT_EPN)")
list(APPEND init_platform " set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME OFF)")
list(APPEND init_platform "endif()")

View File

@ -152,16 +152,14 @@ function(qt_internal_create_qt_configure_tests_wrapper_script)
string(APPEND qt_cmake_path ".bat")
set(script_passed_args "${common_args} %*")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-internal-configure-tests.in"
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/${script_name}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/${script_name}"
DESTINATION "${INSTALL_BINDIR}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libexec/qt-internal-configure-tests.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}"
DESTINATION "${INSTALL_LIBEXECDIR}")
endfunction()
function(qt_internal_install_android_helper_scripts)
qt_path_join(destination "${QT_INSTALL_DIR}" "${INSTALL_LIBEXECDIR}")
qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/util/android/android_emulator_launcher.sh"
DESTINATION "${destination}")
qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/util/android/android_cmakelist_patcher.sh"
DESTINATION "${destination}")
endfunction()

View File

@ -56,7 +56,7 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| | or -DFEATURE_<backend> | |
| -sanitize address -sanitize undefined | -DECM_ENABLE_SANITIZERS=address;undefined | |
| -coverage <arg> | | |
| -c++std c++2a | -DFEATURE_cxx2a=ON | |
| -c++std c++20 | -DFEATURE_cxx20=ON | |
| -sse2/-sse3/-ssse3/-sse4.1 | -DFEATURE_sse4=ON | |
| -mips_dsp/-mips_dspr2 | -DFEATURE_mips_dsp=ON | |
| -qreal <type> | -DQT_COORD_TYPE=<type> | |

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -63,8 +63,9 @@ get_filename_component(QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR "${CMAKE_CURRENT_LIST_
# Instead of collapsing the search prefix (which is the case when one is a subdir of the other),
# it concatenates them creating an invalid path. Workaround it by setting the root path to the
# Qt install prefix, and the prefix path to the lib/cmake subdir.
list(PREPEND CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}")
set(CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR};${CMAKE_PREFIX_PATH}")
set(CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX};${CMAKE_FIND_ROOT_PATH}")
@init_qt_host_path_checks@
# Allow customization of the toolchain file by placing an additional file next to it.

View File

@ -1,17 +1,5 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.SourceDir}}"
- type: ExecuteCommand
command: "{{.InstallDir}}/libexec/android_cmakelist_patcher.sh"
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200
userMessageOnFailure: >
Failed to patch CMakeLists.txt.
enable_if:
condition: property
property: features
contains_value: AndroidTestRun
- type: ChangeDirectory
directory: "{{.BuildDir}}"
- type: ExecuteCommand
@ -26,7 +14,7 @@ instructions:
property: host.os
equals_value: Windows
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} {{.Env.INSTALL_DIR_FOR_CMAKE_TESTS}}/bin/qt-internal-configure-tests {{.Env.COIN_CMAKE_ARGS}}"
command: "{{.Env.TESTS_ENV_PREFIX}} {{.Env.INSTALL_DIR_FOR_CMAKE_TESTS}}/libexec/qt-internal-configure-tests {{.Env.COIN_CMAKE_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200

View File

@ -23,6 +23,15 @@ instructions:
env_var: COIN_CMAKE_ARGS
equals_value: null
# Inform CMake to build just a minimal set of tests for static Qt builds.
- type: AppendToEnvironmentVariable
variableName: COIN_CMAKE_ARGS
variableValue: " -DQT_BUILD_MINIMAL_STATIC_TESTS=ON"
enable_if:
condition: property
property: features
contains_value: "MinimalStaticTests"
- !include "{{qt/qtbase}}/call_cmake_for_standalone_tests.yaml"
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} cmake --build . --parallel -v"
@ -35,7 +44,3 @@ instructions:
archiveDirectory: "{{.BuildDir}}"
maxTimeInSeconds: 1200
maxTimeBetweenOutput: 1200
disable_if:
condition: property
property: configureArgs
contains_value: "-DBUILD_SHARED_LIBS=OFF"

View File

@ -7,7 +7,7 @@ instructions:
- type: ChangeDirectory
directory: "{{.BuildDir}}"
- type: ExecuteCommand
command: "rm {{.SourceDir}}/CMakeCache.txt" # CMake configure does not apply if not removed.
command: "rm -f {{.SourceDir}}/CMakeCache.txt" # CMake configure does not apply if not removed.
maxTimeInSeconds: 300
maxTimeBetweenOutput: 300
userMessageOnFailure: Failed to remove CMake cache.
@ -20,7 +20,7 @@ instructions:
variableValue: "-DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}} {{.SourceDir}}"
- !include "{{qt/qtbase}}/call_cmake.yaml"
- type: ExecuteCommand
command: "{{.Env.ENV_PREFIX}} cmake --build . --target generate_docs -v"
command: "{{.Env.ENV_PREFIX}} cmake --build . --target docs -v"
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200
userMessageOnFailure: Failed to generate documentation.

View File

@ -11,13 +11,3 @@ instructions:
Failed to install tests archive.
- type: ChangeDirectory
directory: "{{.SourceDir}}_standalone_tests"
- type: ExecuteCommand
command: "ln -s {{.InstallDir}}/target fake_prefix"
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200
userMessageOnFailure: >
Failed to run android hack. See QTBUG-88579 to check if this can be removed
enable_if:
condition: property
property: features
contains_value: AndroidTestRun

View File

@ -2,7 +2,3 @@ type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_regular_test_instructions_common.yaml"
- !include "{{qt/qtbase}}/cmake_run_ctest_enforce_exit_code.yaml"
disable_if:
condition: property
property: configureArgs
contains_value: "-DBUILD_SHARED_LIBS=OFF"

View File

@ -3,8 +3,14 @@ instructions:
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml"
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_host.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml"
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_host.yaml"
disable_if:
condition: runtime
env_var: QT_CI_SKIP_MODULE_BUILD
not_equals_value: null
- !include "{{qt/qtbase}}/cmake_documentation_build.yaml"
enable_if:
condition: and

View File

@ -3,7 +3,7 @@ instructions:
- type: Group
instructions:
- type: ExecuteCommand
command: "sh {{.InstallDir}}/libexec/android_emulator_launcher.sh"
command: "{{.InstallDir}}/libexec/android_emulator_launcher.sh"
maxTimeInSeconds: 300
maxTimeBetweenOutput: 300
userMessageOnFailure: "Failed to start emulator, check logs."

View File

@ -111,7 +111,7 @@ Build options:
sanitizers or generate instrumented code to collect execution
counts and enable code coverage analysis, respectively. (Clang only)
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11]
-c++std <edition> .... Select C++ standard <edition> [c++20/c++17/c++14/c++11]
-sse2 ................ Use SSE2 instructions [auto]
-sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512
@ -175,8 +175,10 @@ Component selection:
-skip <repo> ......... Exclude an entire repository from the build.
-make <part> ......... Add <part> to the list of parts to be built.
Specifying this option clears the default list first.
[libs and examples, also tools if not cross-building,
also tests if -developer-build]
(allowed values: libs, tools, examples, tests,
benchmarks, manual-tests, minimal-static-tests)
[default: libs and examples, also tools if not
cross-building, also tests if -developer-build]
-nomake <part> ....... Exclude <part> from the list of parts to be built.
-gui ................. Build the Qt GUI module and dependencies [yes]
-widgets ............. Build the Qt Widgets module and dependencies [yes]

View File

@ -1,12 +1,22 @@
#### Inputs
#### Libraries
qt_find_package(ZLIB 1.0.8 PROVIDED_TARGETS ZLIB::ZLIB MODULE_NAME global QMAKE_LIB zlib)
qt_find_package(WrapZLIB 1.0.8 PROVIDED_TARGETS WrapZLIB::WrapZLIB MODULE_NAME global QMAKE_LIB zlib)
# special case begin
# Work around global target promotion failure when WrapZLIB is used on APPLE platforms.
# What ends up happening is that the ZLIB::ZLIB target is not promoted to global by qt_find_package,
# then qt_find_package(WrapSystemPNG) tries to find its dependency ZLIB::ZLIB, sees it's not global
# and tries to promote it to global, but fails because the directory scope of the PNG package is
# different (src/gui) from where ZLIB was originally found (qtbase root).
# To avoid that, just manually promote the target to global here.
if(TARGET ZLIB::ZLIB)
set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)
endif()
# special case end
qt_find_package(ZSTD 1.3 PROVIDED_TARGETS ZSTD::ZSTD 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)
@ -67,12 +77,12 @@ std::visit([](const auto &) { return 1; }, v);
CXX_STANDARD 17
)
# cxx2a
qt_config_compile_test(cxx2a
LABEL "C++2a support"
# cxx20
qt_config_compile_test(cxx20
LABEL "C++20 support"
CODE
"#if __cplusplus > 201703L
// Compiler claims to support experimental C++2a, trust it
// Compiler claims to support C++20, trust it
#else
# error __cplusplus must be > 201703L (the value for C++17)
#endif
@ -463,7 +473,7 @@ qt_feature_definition("developer-build" "QT_BUILD_INTERNAL")
qt_feature_config("developer-build" QMAKE_PUBLIC_QT_CONFIG
NAME "private_tests"
)
qt_feature("debug"
qt_feature("debug" PRIVATE
LABEL "Build for debugging"
AUTODETECT ON
CONDITION CMAKE_BUILD_TYPE STREQUAL Debug OR Debug IN_LIST CMAKE_CONFIGURATION_TYPES
@ -607,10 +617,15 @@ qt_feature("c++1z" PUBLIC
CONDITION QT_FEATURE_cxx17
)
qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++2a"
qt_feature("c++20" PUBLIC
LABEL "C++20"
AUTODETECT OFF
CONDITION QT_FEATURE_cxx17 AND TEST_cxx2a
CONDITION QT_FEATURE_cxx17 AND TEST_cxx20
)
qt_feature_config("c++20" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++20"
CONDITION QT_FEATURE_cxx20
)
qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c89"
@ -681,37 +696,37 @@ qt_feature("sse2" PRIVATE
)
qt_feature_definition("sse2" "QT_COMPILER_SUPPORTS_SSE2" VALUE "1")
qt_feature_config("sse2" QMAKE_PRIVATE_CONFIG)
qt_feature("sse3"
qt_feature("sse3" PRIVATE
LABEL "SSE3"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_sse3
)
qt_feature_definition("sse3" "QT_COMPILER_SUPPORTS_SSE3" VALUE "1")
qt_feature_config("sse3" QMAKE_PRIVATE_CONFIG)
qt_feature("ssse3"
qt_feature("ssse3" PRIVATE
LABEL "SSSE3"
CONDITION QT_FEATURE_sse3 AND TEST_subarch_ssse3
)
qt_feature_definition("ssse3" "QT_COMPILER_SUPPORTS_SSSE3" VALUE "1")
qt_feature_config("ssse3" QMAKE_PRIVATE_CONFIG)
qt_feature("sse4_1"
qt_feature("sse4_1" PRIVATE
LABEL "SSE4.1"
CONDITION QT_FEATURE_ssse3 AND TEST_subarch_sse4_1
)
qt_feature_definition("sse4_1" "QT_COMPILER_SUPPORTS_SSE4_1" VALUE "1")
qt_feature_config("sse4_1" QMAKE_PRIVATE_CONFIG)
qt_feature("sse4_2"
qt_feature("sse4_2" PRIVATE
LABEL "SSE4.2"
CONDITION QT_FEATURE_sse4_1 AND TEST_subarch_sse4_2
)
qt_feature_definition("sse4_2" "QT_COMPILER_SUPPORTS_SSE4_2" VALUE "1")
qt_feature_config("sse4_2" QMAKE_PRIVATE_CONFIG)
qt_feature("avx"
qt_feature("avx" PRIVATE
LABEL "AVX"
CONDITION QT_FEATURE_sse4_2 AND TEST_subarch_avx AND ( NOT ANDROID OR NOT ( TEST_architecture_arch STREQUAL x86_64 ) )
)
qt_feature_definition("avx" "QT_COMPILER_SUPPORTS_AVX" VALUE "1")
qt_feature_config("avx" QMAKE_PRIVATE_CONFIG)
qt_feature("f16c"
qt_feature("f16c" PRIVATE
LABEL "F16C"
CONDITION QT_FEATURE_avx AND TEST_subarch_f16c
)
@ -723,79 +738,79 @@ qt_feature("avx2" PRIVATE
)
qt_feature_definition("avx2" "QT_COMPILER_SUPPORTS_AVX2" VALUE "1")
qt_feature_config("avx2" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512f"
qt_feature("avx512f" PRIVATE
LABEL "F"
CONDITION QT_FEATURE_avx2 AND TEST_subarch_avx512f
)
qt_feature_definition("avx512f" "QT_COMPILER_SUPPORTS_AVX512F" VALUE "1")
qt_feature_config("avx512f" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512er"
qt_feature("avx512er" PRIVATE
LABEL "ER"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512er
)
qt_feature_definition("avx512er" "QT_COMPILER_SUPPORTS_AVX512ER" VALUE "1")
qt_feature_config("avx512er" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512cd"
qt_feature("avx512cd" PRIVATE
LABEL "CD"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512cd
)
qt_feature_definition("avx512cd" "QT_COMPILER_SUPPORTS_AVX512CD" VALUE "1")
qt_feature_config("avx512cd" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512pf"
qt_feature("avx512pf" PRIVATE
LABEL "PF"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512pf
)
qt_feature_definition("avx512pf" "QT_COMPILER_SUPPORTS_AVX512PF" VALUE "1")
qt_feature_config("avx512pf" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512dq"
qt_feature("avx512dq" PRIVATE
LABEL "DQ"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512dq
)
qt_feature_definition("avx512dq" "QT_COMPILER_SUPPORTS_AVX512DQ" VALUE "1")
qt_feature_config("avx512dq" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512bw"
qt_feature("avx512bw" PRIVATE
LABEL "BW"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512bw
)
qt_feature_definition("avx512bw" "QT_COMPILER_SUPPORTS_AVX512BW" VALUE "1")
qt_feature_config("avx512bw" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512vl"
qt_feature("avx512vl" PRIVATE
LABEL "VL"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512vl
)
qt_feature_definition("avx512vl" "QT_COMPILER_SUPPORTS_AVX512VL" VALUE "1")
qt_feature_config("avx512vl" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512ifma"
qt_feature("avx512ifma" PRIVATE
LABEL "IFMA"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512ifma
)
qt_feature_definition("avx512ifma" "QT_COMPILER_SUPPORTS_AVX512IFMA" VALUE "1")
qt_feature_config("avx512ifma" QMAKE_PRIVATE_CONFIG)
qt_feature("avx512vbmi"
qt_feature("avx512vbmi" PRIVATE
LABEL "VBMI"
CONDITION QT_FEATURE_avx512f AND TEST_subarch_avx512vbmi
)
qt_feature_definition("avx512vbmi" "QT_COMPILER_SUPPORTS_AVX512VBMI" VALUE "1")
qt_feature_config("avx512vbmi" QMAKE_PRIVATE_CONFIG)
qt_feature("aesni"
qt_feature("aesni" PRIVATE
LABEL "AES"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_aesni
)
qt_feature_definition("aesni" "QT_COMPILER_SUPPORTS_AES" VALUE "1")
qt_feature_config("aesni" QMAKE_PRIVATE_CONFIG)
qt_feature("rdrnd"
qt_feature("rdrnd" PRIVATE
LABEL "RDRAND"
CONDITION TEST_subarch_rdrnd
)
qt_feature_definition("rdrnd" "QT_COMPILER_SUPPORTS_RDRND" VALUE "1")
qt_feature_config("rdrnd" QMAKE_PRIVATE_CONFIG)
qt_feature("rdseed"
qt_feature("rdseed" PRIVATE
LABEL "RDSEED"
CONDITION TEST_subarch_rdseed
)
qt_feature_definition("rdseed" "QT_COMPILER_SUPPORTS_RDSEED" VALUE "1")
qt_feature_config("rdseed" QMAKE_PRIVATE_CONFIG)
qt_feature("shani"
qt_feature("shani" PRIVATE
LABEL "SHA"
CONDITION QT_FEATURE_sse2 AND TEST_subarch_shani
)
@ -807,19 +822,19 @@ qt_feature("x86SimdAlways"
)
qt_feature_definition("x86SimdAlways" "QT_COMPILER_SUPPORTS_SIMD_ALWAYS" VALUE "1")
qt_feature_config("x86SimdAlways" QMAKE_PRIVATE_CONFIG)
qt_feature("mips_dsp"
qt_feature("mips_dsp" PRIVATE
LABEL "DSP"
CONDITION ( TEST_architecture_arch STREQUAL mips ) AND TEST_arch_${TEST_architecture_arch}_subarch_dsp
)
qt_feature_definition("mips_dsp" "QT_COMPILER_SUPPORTS_MIPS_DSP" VALUE "1")
qt_feature_config("mips_dsp" QMAKE_PRIVATE_CONFIG)
qt_feature("mips_dspr2"
qt_feature("mips_dspr2" PRIVATE
LABEL "DSPr2"
CONDITION ( TEST_architecture_arch STREQUAL mips ) AND TEST_arch_${TEST_architecture_arch}_subarch_dspr2
)
qt_feature_definition("mips_dspr2" "QT_COMPILER_SUPPORTS_MIPS_DSPR2" VALUE "1")
qt_feature_config("mips_dspr2" QMAKE_PRIVATE_CONFIG)
qt_feature("neon"
qt_feature("neon" PRIVATE
LABEL "NEON"
CONDITION ( ( TEST_architecture_arch STREQUAL arm ) OR ( TEST_architecture_arch STREQUAL arm64 ) ) AND TEST_arch_${TEST_architecture_arch}_subarch_neon
)
@ -847,7 +862,7 @@ qt_feature("stack-protector-strong" PRIVATE
)
qt_feature("system-zlib" PRIVATE
LABEL "Using system zlib"
CONDITION ZLIB_FOUND
CONDITION WrapZLIB_FOUND
)
qt_feature("zstd" PRIVATE
LABEL "Zstandard support"
@ -970,7 +985,7 @@ qt_configure_add_summary_entry(
)
qt_configure_add_summary_entry(
TYPE "firstAvailableFeature"
ARGS "c++2a c++17 c++14 c++11"
ARGS "c++20 c++17 c++14 c++11"
MESSAGE "Using C++ standard"
)
qt_configure_add_summary_entry(
@ -1109,6 +1124,13 @@ qt_configure_add_report_entry(
MESSAGE "Command line option -sanitize fuzzer-no-link is only supported with clang compilers."
CONDITION QT_FEATURE_sanitize_fuzzer_no_link AND NOT CLANG
)
# special case begin
qt_configure_add_report_entry(
TYPE ERROR
MESSAGE "Setting a library infix is not supported for framework builds."
CONDITION QT_FEATURE_framework AND DEFINED QT_LIBINFIX
)
# special case end
qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC)
qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)

View File

@ -363,18 +363,18 @@
"qmake": "CONFIG += c++11 c++14 c++17"
}
},
"cxx2a": {
"label": "C++2a support",
"cxx20": {
"label": "C++20 support",
"type": "compile",
"test": {
"head": [
"#if __cplusplus > 201703L",
"// Compiler claims to support experimental C++2a, trust it",
"// Compiler claims to support C++20, trust it",
"#else",
"# error __cplusplus must be > 201703L (the value for C++17)",
"#endif"
],
"qmake": "CONFIG += c++11 c++14 c++17 c++2a"
"qmake": "CONFIG += c++11 c++14 c++17 c++20"
}
},
"precompile_header": {
@ -783,7 +783,8 @@
},
"debug": {
"label": "Build for debugging",
"autoDetect": "features.developer-build || (config.win32 && !config.gcc) || config.darwin"
"autoDetect": "features.developer-build || (config.win32 && !config.gcc) || config.darwin",
"output": [ "privateFeature" ]
},
"debug_and_release": {
"label": "Compile libs in debug and release mode",
@ -983,10 +984,15 @@
"condition": "features.c++17",
"output": [ "publicFeature", "publicQtConfig" ]
},
"c++2a": {
"label": "C++2a",
"c++20": {
"label": "C++20",
"autoDetect": false,
"condition": "features.c++17 && tests.cxx2a",
"condition": "features.c++17 && tests.cxx20",
"output": [ "publicFeature", "publicQtConfig" ]
},
"c++2a": {
"label": "C++20",
"condition": "features.c++20",
"output": [ "publicFeature", "publicQtConfig" ]
},
"c89": {
@ -1063,6 +1069,7 @@
"condition": "features.sse2 && tests.sse3",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE3", "value": 1 }
]
},
@ -1071,6 +1078,7 @@
"condition": "features.sse3 && tests.ssse3",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_SSSE3", "value": 1 }
]
},
@ -1079,6 +1087,7 @@
"condition": "features.ssse3 && tests.sse4_1",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE4_1", "value": 1 }
]
},
@ -1087,6 +1096,7 @@
"condition": "features.sse4_1 && tests.sse4_2",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE4_2", "value": 1 }
]
},
@ -1095,6 +1105,7 @@
"condition": "features.sse4_2 && tests.avx && (!config.android || !arch.x86_64)",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX", "value": 1 }
]
},
@ -1103,6 +1114,7 @@
"condition": "features.avx && tests.f16c",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_F16C", "value": 1 }
]
},
@ -1120,6 +1132,7 @@
"condition": "features.avx2 && tests.avx512f",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512F", "value": 1 }
]
},
@ -1128,6 +1141,7 @@
"condition": "features.avx512f && tests.avx512er",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512ER", "value": 1 }
]
},
@ -1136,6 +1150,7 @@
"condition": "features.avx512f && tests.avx512cd",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512CD", "value": 1 }
]
},
@ -1144,6 +1159,7 @@
"condition": "features.avx512f && tests.avx512pf",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512PF", "value": 1 }
]
},
@ -1152,6 +1168,7 @@
"condition": "features.avx512f && tests.avx512dq",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512DQ", "value": 1 }
]
},
@ -1160,6 +1177,7 @@
"condition": "features.avx512f && tests.avx512bw",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512BW", "value": 1 }
]
},
@ -1168,6 +1186,7 @@
"condition": "features.avx512f && tests.avx512vl",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512VL", "value": 1 }
]
},
@ -1176,6 +1195,7 @@
"condition": "features.avx512f && tests.avx512ifma",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512IFMA", "value": 1 }
]
},
@ -1184,6 +1204,7 @@
"condition": "features.avx512f && tests.avx512vbmi",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512VBMI", "value": 1 }
]
},
@ -1192,6 +1213,7 @@
"condition": "features.sse2 && tests.aesni",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AES", "value": 1 }
]
},
@ -1200,6 +1222,7 @@
"condition": "tests.rdrnd",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_RDRND", "value": 1 }
]
},
@ -1208,6 +1231,7 @@
"condition": "tests.rdseed",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_RDSEED", "value": 1 }
]
},
@ -1216,6 +1240,7 @@
"condition": "features.sse2 && tests.shani",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_SHA", "value": 1 }
]
},
@ -1232,6 +1257,7 @@
"condition": "arch.mips && subarch.dsp",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_MIPS_DSP", "value": 1 }
]
},
@ -1240,6 +1266,7 @@
"condition": "arch.mips && subarch.dspr2",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_MIPS_DSPR2", "value": 1 }
]
},
@ -1248,6 +1275,7 @@
"condition": "(arch.arm || arch.arm64) && subarch.neon",
"output": [
"privateConfig",
"privateFeature",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_NEON", "value": 1 }
]
},
@ -1520,7 +1548,7 @@
{
"message": "Using C++ standard",
"type": "firstAvailableFeature",
"args": "c++2a c++17 c++14 c++11"
"args": "c++20 c++17 c++14 c++11"
},
{
"type": "feature",

View File

@ -532,3 +532,8 @@
\externalpage http://facebook.github.io/zstd/
\title Zstandard Site
*/
/*!
\externalpage https://www.unicode.org/
\title Unicode standard
*/

View File

@ -56,7 +56,7 @@ macro.QtMinorVersion.match = "\\d+\\.(\\d+)"
# HTML.extraimages += images/dQw4w9WgXcQ.jpg
# qhp.ProjectName.extraFiles += images/dQw4w9WgXcQ.jpg
#
macro.youtube.HTML = "<div class=\"video\">\n<span class=\"vspan\"></span>\n" \
macro.youtube.HTML = "<div class=\"video\">\n" \
"<a href=\"https://www.youtube.com/watch/?v=\1\">\n"\
"<img src=\"images/\1.jpg\"" \
"title=\"Click to play in a browser\" /></a>\n" \

View File

@ -8,10 +8,6 @@ pre, .LegaleseLeft {
overflow-x:auto;
}
pre a[href] {
color: #5caa15;
}
p {
width: 70%;
margin: 15px 0px 10px 15px;
@ -22,16 +18,6 @@ table p {
padding: 0px;
}
a[href] {
color: #007330;
text-decoration: none;
}
/* Different color for ext. links */
a[href|="http://"], a[href|="https://"] {
color: #6bb8db;
}
h1.title {
margin-top: 30px;
margin-left: 6px;

View File

@ -1,6 +1,6 @@
body {
font: normal 400 14px/1.2 Arial;
margin-top: 85px;
margin-top: 50px;
font-family: Arial, Helvetica;
text-align: left;
margin-left: 5px;
@ -96,6 +96,10 @@ a[href*="https://"]::before {
padding-right: 5px;
}
.video a {
background: none;
}
.flags {
text-decoration: none;
text-height: 24px;
@ -230,7 +234,6 @@ footer and license
.navigationbar {
display: block;
position: relative;
top: -20px;
border-top: 1px solid #cecece;
border-bottom: 1px solid #cecece;
background-color: #F2F2F2;
@ -318,18 +321,17 @@ headers
@media screen {
.title {
color: #313131;
font-size: 24px;
font-size: 20px;
font-weight: normal;
left: 0;
padding-bottom: 20px;
padding-bottom: 15px;
padding-left: 10px;
padding-top: 20px;
padding-top: 15px;
position: absolute;
right: 0;
top: 0;
background-color: #E6E6E6;
border-bottom: 1px #CCC solid;
border-top: 2px #CCC solid;
font-weight: bold;
margin-left: 0px;
margin-right: 0px;
@ -349,7 +351,7 @@ h2, p.h2 {
font-weight: 100;
background-color: #F2F3F4;
padding: 4px;
margin-bottom: 30px;
margin-bottom: 15px;
margin-top: 30px;
border-top: #E0E0DE 1px solid;
border-bottom: #E0E0DE 1px solid;
@ -364,7 +366,7 @@ h3 {
font: 500 14px/1.2 Arial;
font-weight: 100;
text-decoration: underline;
margin-bottom: 30px;
margin-bottom: 15px;
margin-top: 30px;
}
@ -383,7 +385,7 @@ h3.fn, span.fn {
max-width: 75%;
font-size: 14px;
margin: 0px;
margin-top: 45px;
margin-top: 30px;
}
.fngroup h3.fngroupitem {
margin-bottom: 5px;
@ -667,6 +669,7 @@ Content table
width: 200px;
text-align: left;
margin-left: 20px;
margin-top: 5px;
}
}
@ -803,10 +806,6 @@ div.multi-column div {
display:table
}
.mainContent .video > .vspan {
padding-top:60%;
display:block
}
.mainContent .video iframe {
width:100%;
height:100%;

View File

@ -875,6 +875,9 @@ li a.active {
margin-left:3px;
font-style:italic
}
.context table p.figCaption {
transform:initial;
}
.context table {
vertical-align:initial
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@ -52,11 +52,43 @@
#include <QApplication>
#include <QScreen>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDebug>
#include <QRect>
//! [0]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription("Qt Mandelbrot Example");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption passesOption("passes", "Number of passes (1-8)", "passes");
parser.addOption(passesOption);
parser.process(app);
if (parser.isSet(passesOption)) {
const auto passesStr = parser.value(passesOption);
bool ok;
const int passes = passesStr.toInt(&ok);
if (!ok || passes < 1 || passes > 8) {
qWarning() << "Invalid value:" << passesStr;
return -1;
}
RenderThread::setNumPasses(passes);
}
MandelbrotWidget widget;
const auto geometry = widget.screen()->availableGeometry();
widget.resize((2 * geometry.size()) / 3);
const auto pos = (geometry.size() - widget.size()) / 2;
widget.move(geometry.topLeft() + QPoint(pos.width(), pos.height()));
widget.show();
return app.exec();
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@ -73,6 +73,8 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent) :
pixmapScale(DefaultScale),
curScale(DefaultScale)
{
help = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
"Press and hold left mouse button to scroll.");
connect(&thread, &RenderThread::renderedImage,
this, &MandelbrotWidget::updatePixmap);
@ -80,8 +82,6 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent) :
#if QT_CONFIG(cursor)
setCursor(Qt::CrossCursor);
#endif
resize(550, 400);
}
//! [1]
@ -127,8 +127,9 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
}
//! [8] //! [9]
QString text = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
"Press and hold left mouse button to scroll.");
QString text = help;
if (!info.isEmpty())
text += ' ' + info;
QFontMetrics metrics = painter.fontMetrics();
int textWidth = metrics.horizontalAdvance(text);
@ -169,6 +170,9 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_Up:
scroll(0, +ScrollStep);
break;
case Qt::Key_Q:
close();
break;
default:
QWidget::keyPressEvent(event);
}
@ -226,6 +230,8 @@ void MandelbrotWidget::updatePixmap(const QImage &image, double scaleFactor)
if (!lastDragPos.isNull())
return;
info = image.text(RenderThread::infoKey());
pixmap = QPixmap::fromImage(image);
pixmapOffset = QPoint();
lastDragPos = QPoint();

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@ -86,6 +86,8 @@ private:
QPixmap pixmap;
QPoint pixmapOffset;
QPoint lastDragPos;
QString help;
QString info;
double centerX;
double centerY;
double pixmapScale;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@ -51,8 +51,14 @@
#include "renderthread.h"
#include <QImage>
#include <QElapsedTimer>
#include <QTextStream>
#include <cmath>
int RenderThread::numPasses = 8;
//! [0]
RenderThread::RenderThread(QObject *parent)
: QThread(parent)
@ -98,6 +104,7 @@ void RenderThread::render(double centerX, double centerY, double scaleFactor,
//! [3]
void RenderThread::run()
{
QElapsedTimer timer;
forever {
mutex.lock();
const double devicePixelRatio = this->devicePixelRatio;
@ -116,13 +123,14 @@ void RenderThread::run()
QImage image(resultSize, QImage::Format_RGB32);
image.setDevicePixelRatio(devicePixelRatio);
const int NumPasses = 8;
int pass = 0;
while (pass < NumPasses) {
while (pass < numPasses) {
const int MaxIterations = (1 << (2 * pass + 6)) + 32;
const int Limit = 4;
bool allBlack = true;
timer.restart();
for (int y = -halfHeight; y < halfHeight; ++y) {
if (restart)
break;
@ -165,8 +173,20 @@ void RenderThread::run()
if (allBlack && pass == 0) {
pass = 4;
} else {
if (!restart)
if (!restart) {
QString message;
QTextStream str(&message);
str << " Pass " << (pass + 1) << '/' << numPasses
<< ", max iterations: " << MaxIterations << ", time: ";
const auto elapsed = timer.elapsed();
if (elapsed > 2000)
str << (elapsed / 1000) << 's';
else
str << elapsed << "ms";
image.setText(infoKey(), message);
emit renderedImage(image, requestedScaleFactor);
}
//! [5] //! [6]
++pass;
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@ -72,6 +72,10 @@ public:
void render(double centerX, double centerY, double scaleFactor, QSize resultSize,
double devicePixelRatio);
static void setNumPasses(int n) { numPasses = n; }
static QString infoKey() { return QStringLiteral("info"); }
signals:
void renderedImage(const QImage &image, double scaleFactor);
@ -88,6 +92,7 @@ private:
double scaleFactor;
double devicePixelRatio;
QSize resultSize;
static int numPasses;
bool restart = false;
bool abort = false;

View File

@ -16,7 +16,7 @@ if(TARGET Qt::Widgets)
add_subdirectory(loopback)
add_subdirectory(threadedfortuneserver)
add_subdirectory(googlesuggest)
# add_subdirectory(torrent) FIXME: This does not find its ui file:-/ # special case
add_subdirectory(torrent)
add_subdirectory(multicastreceiver)
add_subdirectory(multicastsender)
add_subdirectory(fortuneclient)

View File

@ -1,73 +0,0 @@
# Generated from torrent.pro.
cmake_minimum_required(VERSION 3.14)
project(torrent LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/torrent")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
bencodeparser.cpp bencodeparser.h
connectionmanager.cpp connectionmanager.h
filemanager.cpp filemanager.h
forms/addtorrentform.ui
main.cpp
mainwindow.cpp mainwindow.h
metainfo.cpp metainfo.h
peerwireclient.cpp peerwireclient.h
ratecontroller.cpp ratecontroller.h
torrentclient.cpp torrentclient.h
torrentserver.cpp torrentserver.h
trackerclient.cpp trackerclient.h
)
set_target_properties(torrent PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(torrent PUBLIC
Qt::Core
Qt::Gui
Qt::Network
Qt::Widgets
)
# Resources:
set(icons_resource_files
"icons/1downarrow.png"
"icons/1uparrow.png"
"icons/bottom.png"
"icons/exit.png"
"icons/peertopeer.png"
"icons/player_pause.png"
"icons/player_play.png"
"icons/player_stop.png"
)
qt6_add_resources(torrent "icons"
PREFIX
"/"
FILES
${icons_resource_files}
)
install(TARGETS torrent
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -22,10 +22,10 @@ find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
addtorrentform.ui
bencodeparser.cpp bencodeparser.h
connectionmanager.cpp connectionmanager.h
filemanager.cpp filemanager.h
forms/addtorrentform.ui
main.cpp
mainwindow.cpp mainwindow.h
metainfo.cpp metainfo.h
@ -39,7 +39,6 @@ set_target_properties(torrent PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_include_directories(torrent PUBLIC forms) # special case
target_link_libraries(torrent PUBLIC
Qt::Core
Qt::Gui

View File

@ -93,7 +93,7 @@ public:
progressBarOption.state = QStyle::State_Enabled;
progressBarOption.direction = QApplication::layoutDirection();
progressBarOption.rect = option.rect;
progressBarOption.fontMetrics = QApplication::fontMetrics();
progressBarOption.fontMetrics = QFontMetrics(QApplication::font());
progressBarOption.minimum = 0;
progressBarOption.maximum = 100;
progressBarOption.textAlignment = Qt::AlignCenter;

View File

@ -27,7 +27,7 @@ SOURCES += main.cpp \
trackerclient.cpp
# Forms and resources
FORMS += forms/addtorrentform.ui
FORMS += addtorrentform.ui
RESOURCES += icons.qrc
# install

View File

@ -388,8 +388,14 @@ void Dialog::setColor()
void Dialog::setFont()
{
const QFontDialog::FontDialogOptions options = QFlag(fontDialogOptionsWidget->value());
const QString &description = fontLabel->text();
QFont defaultFont;
if (!description.isEmpty())
defaultFont.fromString(description);
bool ok;
QFont font = QFontDialog::getFont(&ok, QFont(fontLabel->text()), this, "Select Font", options);
QFont font = QFontDialog::getFont(&ok, defaultFont, this, "Select Font", options);
if (ok) {
fontLabel->setText(font.key());
fontLabel->setFont(font);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -842,7 +842,7 @@
If \c fileName is not empty, we create a QFile object, \c file, with
\c fileName. QFile works with QDataStream as QFile is a QIODevice.
Next, we attempt to open the file in \l{QIODevice::}{WriteOnly} mode.
Next, we attempt to open the file in \l{QIODeviceBase::}{WriteOnly} mode.
If this is unsuccessful, we display a QMessageBox to inform the user.
\snippet tutorials/addressbook/part6/addressbook.cpp saveToFile() function part2
@ -869,7 +869,7 @@
\image addressbook-tutorial-part6-load.png
If \c fileName is not empty, again, we use a QFile object, \c file, and
attempt to open it in \l{QIODevice::}{ReadOnly} mode. Similar to our
attempt to open it in \l{QIODeviceBase::}{ReadOnly} mode. Similar to our
implementation of \c saveToFile(), if this attempt is unsuccessful, we
display a QMessageBox to inform the user.
@ -939,7 +939,7 @@
choose a location for the file. Using the file name chosen, we create an
instance of QFile to write to.
We attempt to open the file in \l{QIODevice::}{WriteOnly} mode. If this
We attempt to open the file in \l{QIODeviceBase::}{WriteOnly} mode. If this
process fails, we display a QMessageBox to inform the user about the
problem and return. Otherwise, we pass the file as a parameter to a
QTextStream object, \c out. Like QDataStream, the QTextStream class

View File

@ -34,15 +34,9 @@
\image fetchmore-example.png
This example consists of a dialog where you can enter a directory
name in the \uicontrol Directory edit field. The application loads and
visualizes all files it finds as you are typing. It is not required
to press [Enter] to launch the search.
When you have large - or perhaps even infinite - data sets, you
will need to add items to the model in batches, and preferably only
when the items are needed by the view (i.e., when they are visible
when the items are needed by the view (i.e., when they become visible
in the view).
In this example, we implement \c FileListModel - an item view
@ -50,6 +44,15 @@
Window, which sets up the GUI and feeds the model with
directories.
The UI consists of a dialog with a list showing the contents
of the root directory. Directories can be navigated by double-clicking.
At the bottom, there is a log window displaying messages when the view
asks the model for more data.
To exercise it, navigate to a large directory (say \c /bin), and scroll
to the bottom. Log messages appear showing the data being retrieved.
Let's take a tour of \c {FileListModel}'s code.
\section1 FileListModel Class Definition

View File

@ -76,6 +76,8 @@ int main(int argc, char *argv[])
? QString() : parser.positionalArguments().first();
QFileSystemModel model;
QFileIconProvider iconProvider;
model.setIconProvider(&iconProvider);
model.setRootPath("");
if (parser.isSet(dontUseCustomDirectoryIconsOption))
model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons);

View File

@ -54,8 +54,10 @@
#include <QDir>
#include <QPalette>
static const int batchSize = 100;
FileListModel::FileListModel(QObject *parent)
: QAbstractListModel(parent), fileCount(0)
: QAbstractListModel(parent)
{}
//![4]
@ -67,24 +69,33 @@ int FileListModel::rowCount(const QModelIndex &parent) const
QVariant FileListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
return {};
if (index.row() >= fileList.size() || index.row() < 0)
return QVariant();
const int row = index.row();
if (row >= fileList.size() || row < 0)
return {};
if (role == Qt::DisplayRole) {
return fileList.at(index.row());
} else if (role == Qt::BackgroundRole) {
int batch = (index.row() / 100) % 2;
if (batch == 0)
return qApp->palette().base();
else
return qApp->palette().alternateBase();
switch (role) {
case Qt::DisplayRole:
return fileList.at(row).fileName();
case Qt::BackgroundRole: {
const int batch = row / batchSize;
const QPalette &palette = QGuiApplication::palette();
return (batch % 2) != 0 ? palette.alternateBase() : palette.base();
}
return QVariant();
case Qt::DecorationRole:
return iconProvider.icon(fileList.at(row));
}
return {};
}
//![4]
QFileInfo FileListModel::fileInfoAt(const QModelIndex &index) const
{
return fileList.at(index.row());
}
//![1]
bool FileListModel::canFetchMore(const QModelIndex &parent) const
{
@ -99,19 +110,20 @@ void FileListModel::fetchMore(const QModelIndex &parent)
{
if (parent.isValid())
return;
int remainder = fileList.size() - fileCount;
int itemsToFetch = qMin(100, remainder);
const int start = fileCount;
const int remainder = int(fileList.size()) - start;
const int itemsToFetch = qMin(batchSize, remainder);
if (itemsToFetch <= 0)
return;
beginInsertRows(QModelIndex(), fileCount, fileCount + itemsToFetch - 1);
beginInsertRows(QModelIndex(), start, start + itemsToFetch - 1);
fileCount += itemsToFetch;
endInsertRows();
emit numberPopulated(itemsToFetch);
emit numberPopulated(path, start, itemsToFetch, int(fileList.size()));
}
//![2]
@ -121,7 +133,8 @@ void FileListModel::setDirPath(const QString &path)
QDir dir(path);
beginResetModel();
fileList = dir.entryList();
this->path = path;
fileList = dir.entryInfoList(QDir::NoDot | QDir::AllEntries, QDir::Name);
fileCount = 0;
endResetModel();
}

View File

@ -52,7 +52,8 @@
#define FILELISTMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include <QFileInfoList>
#include <QFileIconProvider>
//![0]
class FileListModel : public QAbstractListModel
@ -65,8 +66,10 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QFileInfo fileInfoAt(const QModelIndex &) const;
signals:
void numberPopulated(int number);
void numberPopulated(const QString &path, int start, int number, int total);
public slots:
void setDirPath(const QString &path);
@ -76,8 +79,10 @@ protected:
void fetchMore(const QModelIndex &parent) override;
private:
QStringList fileList;
int fileCount;
QFileInfoList fileList;
QString path;
QFileIconProvider iconProvider;
int fileCount = 0;
};
//![0]

View File

@ -56,37 +56,43 @@
Window::Window(QWidget *parent)
: QWidget(parent)
{
FileListModel *model = new FileListModel(this);
model->setDirPath(QLibraryInfo::path(QLibraryInfo::PrefixPath));
model = new FileListModel(this);
model->setDirPath(QDir::rootPath());
QLabel *label = new QLabel(tr("&Directory:"));
QLineEdit *lineEdit = new QLineEdit;
label->setBuddy(lineEdit);
QListView *view = new QListView;
view = new QListView;
view->setModel(model);
logViewer = new QTextBrowser(this);
logViewer->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
logViewer = new QPlainTextEdit(this);
logViewer->setReadOnly(true);
logViewer->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred));
connect(lineEdit, &QLineEdit::textChanged,
model, &FileListModel::setDirPath);
connect(lineEdit, &QLineEdit::textChanged,
logViewer, &QTextEdit::clear);
connect(model, &FileListModel::numberPopulated,
this, &Window::updateLog);
connect(view, &QAbstractItemView::activated,
this, &Window::activated);
QGridLayout *layout = new QGridLayout;
layout->addWidget(label, 0, 0);
layout->addWidget(lineEdit, 0, 1);
layout->addWidget(view, 1, 0, 1, 2);
layout->addWidget(logViewer, 2, 0, 1, 2);
auto *layout = new QVBoxLayout(this);
layout->addWidget(view);
layout->addWidget(logViewer);
setLayout(layout);
setWindowTitle(tr("Fetch More Example"));
}
void Window::updateLog(int number)
void Window::updateLog(const QString &path, int start, int number, int total)
{
logViewer->append(tr("%1 items added.").arg(number));
const int last = start + number - 1;
const QString nativePath = QDir::toNativeSeparators(path);
const QString message = tr("%1..%2/%3 items from \"%4\" added.")
.arg(start).arg(last).arg(total).arg(nativePath);
logViewer->appendPlainText(message);
}
void Window::activated(const QModelIndex &index)
{
const QFileInfo fi = model->fileInfoAt(index);
if (fi.isDir()) {
logViewer->clear();
model->setDirPath(fi.absoluteFilePath());
}
}

View File

@ -54,9 +54,13 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
class QTextBrowser;
class QModelIndex;
class QListView;
class QPlainTextEdit;
QT_END_NAMESPACE
class FileListModel;
class Window : public QWidget
{
Q_OBJECT
@ -65,10 +69,13 @@ public:
Window(QWidget *parent = nullptr);
public slots:
void updateLog(int number);
void updateLog(const QString &path, int start, int number, int total);
void activated(const QModelIndex &);
private:
QTextBrowser *logViewer;
QPlainTextEdit *logViewer;
FileListModel *model;
QListView *view;
};
#endif // WINDOW_H

View File

@ -42,147 +42,42 @@ target_link_libraries(affine PUBLIC
# Resources:
set_source_files_properties("../shared/images/button_normal_cap_left.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_normal_cap_left.png"
)
set_source_files_properties("../shared/images/button_normal_cap_right.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_normal_cap_right.png"
)
set_source_files_properties("../shared/images/button_normal_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_normal_stretch.png"
)
set_source_files_properties("../shared/images/button_pressed_cap_left.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_pressed_cap_left.png"
)
set_source_files_properties("../shared/images/button_pressed_cap_right.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_pressed_cap_right.png"
)
set_source_files_properties("../shared/images/button_pressed_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/button_pressed_stretch.png"
)
set_source_files_properties("../shared/images/frame_bottom.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_bottom.png"
)
set_source_files_properties("../shared/images/frame_bottomleft.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_bottomleft.png"
)
set_source_files_properties("../shared/images/frame_bottomright.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_bottomright.png"
)
set_source_files_properties("../shared/images/frame_left.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_left.png"
)
set_source_files_properties("../shared/images/frame_right.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_right.png"
)
set_source_files_properties("../shared/images/frame_top.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_top.png"
)
set_source_files_properties("../shared/images/frame_topleft.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_topleft.png"
)
set_source_files_properties("../shared/images/frame_topright.png"
PROPERTIES QT_RESOURCE_ALIAS "images/frame_topright.png"
)
set_source_files_properties("../shared/images/groupframe_bottom_left.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_bottom_left.png"
)
set_source_files_properties("../shared/images/groupframe_bottom_right.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_bottom_right.png"
)
set_source_files_properties("../shared/images/groupframe_bottom_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_bottom_stretch.png"
)
set_source_files_properties("../shared/images/groupframe_left_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_left_stretch.png"
)
set_source_files_properties("../shared/images/groupframe_right_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_right_stretch.png"
)
set_source_files_properties("../shared/images/groupframe_top_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_top_stretch.png"
)
set_source_files_properties("../shared/images/groupframe_topleft.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_topleft.png"
)
set_source_files_properties("../shared/images/groupframe_topright.png"
PROPERTIES QT_RESOURCE_ALIAS "images/groupframe_topright.png"
)
set_source_files_properties("../shared/images/line_dash_dot.png"
PROPERTIES QT_RESOURCE_ALIAS "images/line_dash_dot.png"
)
set_source_files_properties("../shared/images/line_dash_dot_dot.png"
PROPERTIES QT_RESOURCE_ALIAS "images/line_dash_dot_dot.png"
)
set_source_files_properties("../shared/images/line_dashed.png"
PROPERTIES QT_RESOURCE_ALIAS "images/line_dashed.png"
)
set_source_files_properties("../shared/images/line_dotted.png"
PROPERTIES QT_RESOURCE_ALIAS "images/line_dotted.png"
)
set_source_files_properties("../shared/images/line_solid.png"
PROPERTIES QT_RESOURCE_ALIAS "images/line_solid.png"
)
set_source_files_properties("../shared/images/radiobutton-on.png"
PROPERTIES QT_RESOURCE_ALIAS "images/radiobutton-on.png"
)
set_source_files_properties("../shared/images/radiobutton_off.png"
PROPERTIES QT_RESOURCE_ALIAS "images/radiobutton_off.png"
)
set_source_files_properties("../shared/images/radiobutton_on.png"
PROPERTIES QT_RESOURCE_ALIAS "images/radiobutton_on.png"
)
set_source_files_properties("../shared/images/slider_bar.png"
PROPERTIES QT_RESOURCE_ALIAS "images/slider_bar.png"
)
set_source_files_properties("../shared/images/slider_thumb_on.png"
PROPERTIES QT_RESOURCE_ALIAS "images/slider_thumb_on.png"
)
set_source_files_properties("../shared/images/title_cap_left.png"
PROPERTIES QT_RESOURCE_ALIAS "images/title_cap_left.png"
)
set_source_files_properties("../shared/images/title_cap_right.png"
PROPERTIES QT_RESOURCE_ALIAS "images/title_cap_right.png"
)
set_source_files_properties("../shared/images/title_stretch.png"
PROPERTIES QT_RESOURCE_ALIAS "images/title_stretch.png"
)
set(shared_resource_files
"images/button_normal_cap_left.png"
"images/button_normal_cap_right.png"
"images/button_normal_stretch.png"
"images/button_pressed_cap_left.png"
"images/button_pressed_cap_right.png"
"images/button_pressed_stretch.png"
"images/frame_bottom.png"
"images/frame_bottomleft.png"
"images/frame_bottomright.png"
"images/frame_left.png"
"images/frame_right.png"
"images/frame_top.png"
"images/frame_topleft.png"
"images/frame_topright.png"
"images/groupframe_bottom_left.png"
"images/groupframe_bottom_right.png"
"images/groupframe_bottom_stretch.png"
"images/groupframe_left_stretch.png"
"images/groupframe_right_stretch.png"
"images/groupframe_top_stretch.png"
"images/groupframe_topleft.png"
"images/groupframe_topright.png"
"images/line_dash_dot.png"
"images/line_dash_dot_dot.png"
"images/line_dashed.png"
"images/line_dotted.png"
"images/line_solid.png"
"images/radiobutton-on.png"
"images/radiobutton_off.png"
"images/radiobutton_on.png"
"images/slider_bar.png"
"images/slider_thumb_on.png"
"images/title_cap_left.png"
"images/title_cap_right.png"
"images/title_stretch.png"
"../shared/images/button_normal_cap_left.png"
"../shared/images/button_normal_cap_right.png"
"../shared/images/button_normal_stretch.png"
"../shared/images/button_pressed_cap_left.png"
"../shared/images/button_pressed_cap_right.png"
"../shared/images/button_pressed_stretch.png"
"../shared/images/frame_bottom.png"
"../shared/images/frame_bottomleft.png"
"../shared/images/frame_bottomright.png"
"../shared/images/frame_left.png"
"../shared/images/frame_right.png"
"../shared/images/frame_top.png"
"../shared/images/frame_topleft.png"
"../shared/images/frame_topright.png"
"../shared/images/groupframe_bottom_left.png"
"../shared/images/groupframe_bottom_right.png"
"../shared/images/groupframe_bottom_stretch.png"
"../shared/images/groupframe_left_stretch.png"
"../shared/images/groupframe_right_stretch.png"
"../shared/images/groupframe_top_stretch.png"
"../shared/images/groupframe_topleft.png"
"../shared/images/groupframe_topright.png"
"../shared/images/line_dash_dot.png"
"../shared/images/line_dash_dot_dot.png"
"../shared/images/line_dashed.png"
"../shared/images/line_dotted.png"
"../shared/images/line_solid.png"
"../shared/images/radiobutton-on.png"
"../shared/images/radiobutton_off.png"
"../shared/images/radiobutton_on.png"
"../shared/images/slider_bar.png"
"../shared/images/slider_thumb_on.png"
"../shared/images/title_cap_left.png"
"../shared/images/title_cap_right.png"
"../shared/images/title_stretch.png"
)
qt6_add_resources(affine "shared"

Some files were not shown because too many files have changed in this diff Show More