Commit Graph

39689 Commits

Author SHA1 Message Date
Richard Moe Gustavsen
30adaaedf7 QInputMethod: check if focusobject supports the "new" IM function before calling it
We use QMetaObject to invoke the "queryFocusObject" function. But if
the current focus object doesn't implement this function, we get a
"QMetaObject::invokeMethod: No such method" warning.

This patch will add a check if the focus object supports IM queries
before trying to call "queryFocusObject", to avoid the warning.

Task-number: QTBUG-91545
Change-Id: I3aa8bd2d4bf57bd42c2d77ed71174ec4f9951f81
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-11 21:24:30 +01:00
Richard Moe Gustavsen
30276cec3d QIOSTextInputOverlay: listen for selection changes, also for Qt::ImReadOnly
The focus object can emit selection updates (e.g from mouse drag), and
accept modifying it through IM when dragging on the handles, even if it
doesn't accept text input and IM in general (and hence return false from
inputMethodAccepted()). This is typically the case for read-only text fields.
So we should listen for selection changes and enable handles also for
this case (unless the IM hints tells us explicitly not to use handles/edit menu).

Fixes: QTBUG-91545
Change-Id: I2855505fc229e954b2c43f5e11374e64bba7eb4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-11 22:24:30 +02:00
Richard Moe Gustavsen
aae4d52cbb QIOSInputContext: use QIOSResponder when the focus object is Qt::ImReadOnly
In Qt, Qt::ImEnabled means that the focus object accepts text input from
input method (IM) events. But the IM API also contains API for dealing
with text selections. Text input and text selections are logically two
different operations, but since IM makes use of selections to implement
text input (like selecting a word to suggest a spelling correction), it's
understandable that they are combined into to same API.

So when a focus object reports Qt::ImEnabled to be false, it only means
that it doesn't accept input. E.g a TextArea in QML with "readOnly:true"
will set Qt::ImEnabled to false. At the same time, it can have
"selectByMouse:true", which lets you select text with the mouse.
This behavior is consistent in Qt, for both Quick, Controls 2 and Widgets.

Since we want to support any selections done in controls/widgets on iOS
with selection handles and edit menus, regardless if the focus object
accepts input or not, this patch will set the QIOSResponder (with read-only
actions) as first responder when we detect a focus object with Qt::ImReadOnly.
This means that if a query for Qt::ImReadOnly returns "true", we take that
to mean that it implements the IM API, but without accepting input.

Task-number: QTBUG-91545
Change-Id: I07349909a3bca81f484a2e9af9672428dca62c49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-11 22:24:30 +02:00
Richard Moe Gustavsen
2211092aa5 QIOSTextInputResponder: factor out the "read-only" part to a QIOSTextResponder base class
QIOSTextInputResponder has two responsibilities; It takes care of
handling text input from UIKit, and to implement first responder
actions related to the edit menu, like copy and paste.

Currently the responder offers both writable (paste) and
readable (select, copy) actions. Because of the former, it means
that it can only be used for focus objects that accepts text input.

Since we also want to be able to show an edit menu for selections
done on a read-only input field, this patch will factor out the
read-only actions we want for that case into a QIOSTextResponder
base class. An instance of this class can be used as first responder
for a focus object that has read-only text, but otherwise doesn't
support text input. This part is implemented in a subsequent patch.

The remaining set of writeable actions, together with input method
handling, will continue to be in the QIOSTextInputResponder subclass.

Task-number: QTBUG-91545
Change-Id: I1c215bb509eb7820c6c60f7ad806f61a5de02ded
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-11 22:24:30 +02:00
Volker Hilsheimer
c7e8133a95 QSlider: Always set the sunken state and the active control
initStyleOption should initialize the state based on which controls are
pressed or hovered, not only when painting but also when calling other
style APIs.

Pick-to: 6.2
Task-number: QTBUG-98093
Change-Id: I482793b7de38657aa36a20d0abab8845155ad0e9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-11-11 20:08:18 +01:00
Morten Johan Sørvig
0a8a4698d6 wasm: fix native timer update for the no-timer case
QTimerInfoList::timerWait() does not update the timespec
out argument if there are no active timers, which caused
the current code to calculate an arbitrary toWaitDuration.

Instead use the timerWait() return value, and clear any
native timers if there are no active Qt timers.

Pick-to: 6.2
Change-Id: I7d5ec4c2930000bece6f6ea6c63e76f4df543b04
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-11 15:24:36 +00:00
Morten Johan Sørvig
966f7cb5dd wasm: make timers work for the new event dispatcher
Don’t exit from the timer callback if there is no main
thread event dispatcher, since it could be that the main
thread event dispatcher is of the old event dispatcher type.

Pick-to: 6.2
Change-Id: Ibb7a34a99e2001b52d2a985022f5baa7cd2152bf
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-11 17:24:35 +02:00
Michal Klocek
e6db4206b8 Fix not respected qt.conf settings
Change 6fb569af95 introduces reloadOnQAppAvailable for
QLibrarySettings, however it is missing a reload check
for hasPaths, this breaks essentially reading custom qt.conf

Add missing check.

Fixes: QTBUG-97382
Fixes: QTBUG-97383
Fixes: QTBUG-97947
Pick-to: 6.2
Change-Id: I28379d9dd38357c290edd44b93d3bea489b9cefe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-11-11 14:30:00 +00:00
Venugopal Shivashankar
f9e6ee655f Doc: Fix qdoc warnings
In addition, added the missing warninglimit
entry to a few doc configs.

Change-Id: I51b9d2ad66123a2a9673a3b42870662641375e6b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-11 11:34:49 +01:00
Alexey Edelev
f6d210a0d3 Add missing qt namespace in qthreadstorage.h
Wrap 'else QT_CONFIG(thread)' block in qthreadstorage.h with qt
namespace

Pick-to: 6.2
Fixes: QTBUG-98085
Change-Id: Ica1817fa6beeaf9e4883edaa8738f042b29f0c5e
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-11 08:52:02 +01:00
Thiago Macieira
da326804ea qmetatype.cpp: provide missing initializer for const variable
qmetatype.cpp(1565): warning #854: const variable "metatypeHelper" requires an initializer -- class "struct <unnamed>" has no user-provided default constructor

Change-Id: I2bbf422288924c198645fffd16a9b868ff7adcb9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 17:29:54 -07:00
Martin Storsjö
d7d9451361 Fix 32-bit builds broken by mul_overflow() on qint64
Use std::integral_constant to avoid instantiating QIntegerForSize<16>,
caused by 2b26dea51b

Change-Id: Ia6f49a1dcd82835c7e76200a650767fc519eab90
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 23:23:23 +01:00
Thiago Macieira
3ba1a196aa Q{XcbGl,EglFSDevice}IntegrationFactory: remove unused extra plugin path
Cargo-cult copied this from somewhere, unnecessarily. This just made the
code bigger for no reason.

Task-number: QTBUG-97950
Pick-to: 6.2
Change-Id: Ice04365c72984d07a64dfffd16b48520d42c7043
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-10 10:21:43 -08:00
Thiago Macieira
b0dc6abfb2 QGuiApplication: properly decode path command-line arguments
Using QFile::decodeName, not QString::fromLocal8Bit.

Pick-to: 6.2
Change-Id: Ice04365c72984d07a64dfffd16b47dcbfee23341
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-10 10:21:43 -08:00
Ievgenii Meshcheriakov
893990a67e QFileSystemEngine: Don't use _?W suffixes
We don't use W suffix for most of the Windows API so there is no
need to use it here either. Also remove W suffix for variables of
type TRUSTEE (was TRUSTEE_W).

Change-Id: Id67b772ba5d3232f882841a1e581fb1bbd392fa4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 19:21:43 +01:00
Ievgenii Meshcheriakov
d7e1416580 Use nullptr to represent null pointers
Replace occurrences of NULL and 0 when used for pointers.

Change-Id: I485e73d22a1a85d1303f3e0967cd4e8f10ff5d33
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 19:21:43 +01:00
Ievgenii Meshcheriakov
65041967b6 QFileSystemEngine: Fix some code style issues in Windows backend
Wrap lines at column 101 so that it is easier to edit the
file and review the changes in Gerrit. Move comments when
they cannot be easily wrapped. Add curly braces to `if`
statements if they became multiline. Run `git clang-format`
on the file afterwards.

Change-Id: Ib21afd65147a7b202e031d4a865b5f615e5ad6d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 19:21:43 +01:00
Ievgenii Meshcheriakov
1cc9ac71ac Move toMode_t() from qfilesystemengine_unix.cpp to qfiledevice_p.h
The function is needed in multiple files to implement QDir::mkdir()
and QFile::open() methods that accept a permission argument on Unix.

Task-number: QTBUG-79750
Change-Id: Ib0853f7d12bcb5d6f1116b43ec1aa07b6554bb93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 18:22:07 +01:00
Edward Welbourne
7db0eeae34 Clean up exports from qlocale_p.h
Explain why QSystemLocale needs to be an export. Unexport
QLocaleId::fromName() now that qttools no longer uses it.
QLocalePrivate was only Q_CORE_EXPORT for the sake of one use in
tst_QLocale, that can now be replaced by a call to a public QLocale
method.

Change-Id: I1efe8ee03488acfc6e1c36661f6e956a86e191c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 18:16:24 +02:00
ChunLin Wang
62b7130423 QPushButton: emit released signal when mouse dragged out of bounds
After special processing for hover, QPushButton::mouseMoveEvent()
needs to call the base class function, like every virtual override
should, to continue processing other logic.  Amends
3310e13a17

Fixes: QTBUG-97937
Pick-to: 6.0 6.2
Change-Id: Ic2e111d6c38371e0aa04423f5fb26c52717bf5fb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-11-10 16:16:24 +00:00
Ievgenii Meshcheriakov
f28e161361 Remove useless blocks
Don't put the code inside two blocks for no reason.

Change-Id: I54b8d6fbfab50a26ddcd8ec07ba689e5094bcad3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-10 16:45:52 +01:00
Edward Welbourne
34287c9eae Add QGregorianCalendar::yearSharingWeekDays()
When fixing up problems on system APIs with limited date ranges, we
need a year, inside the supported date range, in which Gregorian dates
fell on the same days of the week as a given year outside the range.
A year with the same last two digits makes handling of two-digit year
formats easier.

Change-Id: If64ee27e829f9dcfd5504ed8ba51f72c36297242
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 14:47:42 +01:00
Edward Welbourne
2b093450c3 Improve unicodeForDigit()'s comments
I'd typo'd the Suzhou one-digit. Record that our CLDR scanner verifies
this is the only number system with non-contiguous digits, rather than
merely recording a (now old) CLDR version in which that was true.

Change-Id: I6f5b5d1f0a5aa1cd0557f62f296777b90b603087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 14:10:20 +01:00
Yuhang Zhao
6652bf2353 Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)
And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time,
to unblock the developers from accessing the latest Windows APIs.

Pick-to: 6.2
Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 20:31:05 +08:00
Laszlo Agocs
a8be40bd64 rhi: Expose the maximum uniform buffer range limit
Pick-to: 6.2
Task-number: QTBUG-97715
Change-Id: I7f0a52c410b9b77f735fb3b7fd33141674bb0cda
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-11-10 13:31:05 +01:00
David Skoland
cdf784a1c7 Remove unreachable breaks
Change-Id: I0e005964624125d3ab12f77c94fd393802547a13
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-10 13:31:05 +01:00
Øystein Heskestad
09291eead4 Add additional grapheme, word, and sentence break class tests from tr29
Stop turning THAI CHARACTER SARA AM into a grapheme boundary because it
breaks a test and chromium does not consider it to be a separate
grapheme.

Fixes: QTBUG-88545
Change-Id: Ib1aea8dbb66ac42b2129cf9fe04c39f5f76eeb36
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 09:44:03 +01:00
Fabian Kosmale
76b4739e07 QFactoryLoader: unconditionally provide toJson
Amends c0a8cfe167. The StaticPluginLoader
needs it, too, and that one is available in non-library configurations.

Change-Id: I5d396e78abe7358a5df5ef816cfe92137d3ae4b5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-10 09:18:07 +01:00
Ievgenii Meshcheriakov
aee0021fc8 QLocale: Add support for Kaingang and Nheengatu languages
Update the locale generation script to support Kaingang and
Nheengatu languages. These are new in CLDR v40. Regenerate
the locale data.

Task-number: QTBUG-94358
Change-Id: I5195d5161d8c4d9f17129bbcfde39dfd3fcf1cd5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-10 00:36:12 +01:00
Ievgenii Meshcheriakov
96a03533f9 Update CLDR-derived data to newly-released v40
Update tst_qlocale to take into account "narrow" day representation
change for Russian locales. This version of CLDR changes narrow forms
to one letter. Previously those forms were identical to short forms
(two letter). The new representation is consistent with other languages
and so does not appear to be a bug.

Fixes: QTBUG-94358
Pick-to: 6.2
Change-Id: I9724c281a250685da8232e5c05c9c375a8c79253
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-10 00:36:12 +01:00
Ievgenii Meshcheriakov
2c505eea01 locale_database: Add entry for 'South Sudan Standard Time'
This timezone is new in CLDR 40, Olson database calls it Africa/Juba.
The offset is UTC+2.

Reference: https://techcommunity.microsoft.com/t5/daylight-saving-time-time-zone/2021-time-zone-updates-for-republic-of-south-sudan-now-available/ba-p/2234981

Task-number: QTBUG-94358
Pick-to: 6.2
Change-Id: Ib70dbd9b472eb9cf8cb62a0eb5e241199148c077
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-10 00:36:11 +01:00
Andreas Buhr
0098dd8120 Capture full logcat output in Android unit tests
Previously, when running unit tests on Android, the log presented
to the user was the log as known to the Qt logging system. This
does not include log messages generated by Java code using e.g.
Log.d("message"). Neither does it include log messages by system
libs. This patch changes androidtestrunner to capture the full
logcat output for the unit test. This improves the developer
experience when working with unit tests.

Fixes: QTBUG-93438
Change-Id: I580f728349041eb8a84a32d187754b7b5448f512
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-11-09 22:39:24 +01:00
Ulf Hermann
81c92aec66 QTestLog: Properly own the loggers
Previously, the loggers would leak if the application failed to call
stopLogging(). Now they are owned by the global static which will delete
them in that case.

Also, since we have to adapt loggerCount() to the fact that std::vector
uses size_t, recognize that we only ever want to know whether the number
of loggers is 0. Change the method to only provide that information
rather than the actual number.

Change-Id: Ieb2e185048d573ec7f36373ad49bb2a0ca391ce3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-09 21:36:50 +01:00
Fabian Kosmale
a4ce85f356 QDomDocument::setContent: Open device if necessary
This restores the Qt 5 behavior in Qt 6, but prepares for disabling it
in Qt 7. We want to deprecate the current behavior, as it makes it
unclear who is responsible for calling close.

Fixes: QTBUG-97747
Pick-to: 6.2
Change-Id: I2c99eb96667e784576d8850085068ca334d75b16
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-09 18:33:39 +01:00
Allan Sandfeld Jensen
c677b3b8af Add compatible weak pointer move operations
We have those on QSharedPointer, so adding them for consistency.

Change-Id: Iab5eddc79206605a4bcce46f63e0fb685aed40ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-09 13:42:23 +02:00
Hannah von Reth
740d652f2d Fix internal mimetypes db on Windows when compressed by an external tool
Ensure to use binary encoding when handling the output of the
compression tool.
With out this change \r are dropped and the compressed file is corrupted.

Change-Id: Iaf9b1fc015a376682f793aff079f45d03b201aec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-09 08:39:38 +01:00
Eirik Aavitsland
1a984b3d2d Avoid painting outside boundaries when printing QGraphicsProxyWidget
Implement clipping to widget geometry when rendering to other
paintdevices.

Fixes: QTBUG-98026
Pick-to: 6.2 5.15
Change-Id: I5652bdb8cc052ae34f05ea7963943d2b5b28e220
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-11-09 01:34:31 +01:00
Tor Arne Vestbø
851ed6f0b1 Don't quit application if we're not in exec
The documentation states that the function will not have any effect
before control enters the main event loop. Prior to 0c02f133f3
this was incidentally true due to QCoreApplication::exit just setting
quitNow to true and exiting all the event loops (which before exec
were none), and exec() setting quitNow to false explicitly. But
now that we plumb the quit down to the platform we can't rely
on this incidental behavior, and need to check explicitly.

Fixes: QTBUG-98088
Pick-to: 6.2
Change-Id: I54cece3630e39e4456abc3b372839c0b5c4c4713
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-11-08 23:44:05 +01:00
Mårten Nordheim
ac7e94090f qoperatingsystemversion_win: fix thread race
If two threads call the function at the same time before the static is initialized
one of them may end up with a half-written object.

Amends 3fe89eec61

Pick-to: 6.2
Change-Id: Ie08970f9ee283fd75292a8b44a1fca89de4b04eb
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-08 22:39:45 +01:00
Tor Arne Vestbø
2010df52d4 Draw QTableView grid lines centered between table cells
We were reserving space between table cells corresponding to one logical
pixel, which on retina screen results in two device pixels. By drawing
the grid line with a cosmetic pen, we were only filling one of these
pixels, leaving space for leftover pixel dust from earlier blits.

By drawing with a non-cosmetic pen of size 1, and ensuring that the grid
line is drawn at the center of the grid, we end up filling the entire
grid line, without overdrawing the table cells.

Pick-to: 6.2
Change-Id: I7f4d2b27380e5a3d221e265a25f7531fdc4a02b3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-08 21:26:52 +01:00
Mårten Nordheim
d2c5494c3d QNI: Windows support for the isMetered API
As a drive-by: fix some improper indentation

Task-number: QTBUG-91024
Change-Id: I29e04aff3638dfb2aab9d40650c55a48baba7222
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-08 21:12:14 +01:00
Tor Arne Vestbø
ecfbc918d7 macOS: Add QCALayerBackingStore::preserveFromFrontBuffer helper function
Pick-to: 6.2
Change-Id: Iadd4791907564b8b82437643c54696ffa778d882
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-08 19:04:59 +01:00
Tor Arne Vestbø
4ffdf2270a macOS: Rename QCALayerBackingStore::prepareForFlush()
The need to finalize the back buffer isn't limited to flushing.

Pick-to: 6.2
Change-Id: I98b04ab49ec27ea536e99462deab8d48a8e40e82
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-08 19:04:59 +01:00
Tor Arne Vestbø
5190e77d87 macOS: Track painted area of backingstore buffer via its dirty region
When introducing support for scrolling the backingstore it doesn't make
sense to track the painted region explicitly.

Pick-to: 6.2
Change-Id: I370932f02490ac526fb049908f99af678884e807
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-08 19:04:59 +01:00
Tor Arne Vestbø
38130406ca macOS: Don't defer back/front-buffer swap in CALayer backingstore
CoreAnimation doesn't immediately mark a surface as in use the moment
we assign it to a layer, but defers it until the surface has bee picked
up by the window server. In theory this would allow us to defer the swap
until the next beginPaint(), which would allow painting to the back buffer
again before Core Animation has time to flush the transaction and persist
the layer changes to the window server, and would also automatically deal
with requests to flush without painting anything.

But, since a client may do several rounds of beginPaint/endPaint before
flushing, we might end up in a situation where we detect that a surface
is in use in the middle of several paint rounds, and end up swapping in
a new back buffer without copying over the previously painted content,
like we do in prepareForFlush. To be on the safe side we swap the back
and front buffer straight away.

We also need to mark the surface in use, to prevent the same problem
from appearing when the window server doesn't pick up the surface in
between two rounds of flushes.

Pick-to: 6.2
Change-Id: Ib418852424773c399df710da33a388e8d2c2e92c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2021-11-08 19:04:59 +01:00
Edward Welbourne
2b26dea51b Fix some out-of-range issues with time-zone support
The MS-Windows back-end neglected to check for overflow when mapping
date and time to milliseconds from the epoch. Add the checks for that
and take care not to return qint64-min as a transition time - that's
the invalidMSecs() value used as a special marker.

QTimeZonePrivate::dataForLocalTime() neglected to handle the case of
the backend being unable to answer offsetFromUtc() for one of the
times requested, which the MS backend might.

Change-Id: I6d7ee2cbf9aaf6678abb24a20e18b5cdac7f5a23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-08 17:05:25 +01:00
Zhang Hao
c0bc4c7638 Initialize QStyleOptionProgressBar with QStyle::State_Horizontal
In Qt 5, QStyleOptionProgressBar::orientation was Qt::Horizontal by default.
In Qt 6, we need to init state with QStyle::State_Horizontal so that code
setting up a style option doesn't need to do so explicitly.

Amends add8262f72

Pick-to: 6.2
Fixes: QTBUG-93412
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: Iaa311cf0f4bab72c0bacbd8e698ba24660bca6b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-08 08:06:00 +00:00
Thiago Macieira
04ee5795cc qC{Debug,Info,Warning,Critical}: Simplify #ifndef QT_NO_xxx_OUTPUT
Further simplifies the definition of the macros.

The class is placed in an unnamed namespace so two translation units can
still have different settings.

A difference is that the expanded no-output code is now using QDebug,
not QNoDebug, but it should get dead-code-eliminated either way.

Change-Id: I3eb1bd30e0124f89a052fffd16a7564f4450ec8a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-06 20:43:22 -07:00
Thiago Macieira
d20b78a569 qC{Debug,Info,Warning,Critical}: centralize common parts
Move some content to a helper structure and the rest to a common macro.

Immediate advantage is that we avoid calling the category function
twice. The Q_UNLIKELY also moves most of the formatting code out of the
hot code paths of the functions where it's used.

Change-Id: I3eb1bd30e0124f89a052fffd16a754e980c1d971
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-06 20:43:21 -07:00
Ievgenii Meshcheriakov
5fc9c02a69 QProcess: Distinguish between null and empty QProcessEnvironment
The documentation for QProcessEnvironment's default constructor
says:

    This constructor creates an empty environment. If set on a
    QProcess, this will cause the current environment variables
    to be removed.

This is not the case however, because setting such an environment
for a process is equivalent to not setting an environment at all
and the child process is executed with parent's environment.

It is still possible starting from Qt 6.2.0 to create an empty
environment by adding a variable to a null environment and removing
it, but that's cumbersome, and the comparison operator says that
it is equal to the null environment but it is obviously behaving in
a different way.

This change adds an additional constructor to QProcessEnvironment
that can be used to construct a null environment, and changes the
default constructor to produce an empty environment. The comparison
operator is changed to correctly distinguish between such objects.
This is a behavior change, but the current behavior is broken
and this is unlikely to affect working code.

[ChangeLog][QtCore][QProcessEnvironment] An additional constructor
was added to explicitly create an object that when set on QProcess
would cause it to inherit the environment from parent (this was
formerly the behavior of a default-constructed QProcessEnvironment,
which will now (as documented) actually give a process an environment
with no variables set). A new method inheritsFromParent() was added
to test for such objects.

Fixes: QTBUG-58053
Change-Id: I15e20c6a5f01ebe2c736d5578c75dba1ee319320
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-07 01:53:44 +01:00
Lorn Potter
7f8fd38931 wasm: fix size of QDialogs
We can simply propagate the minimum window size.

Pick-to: 6.2 5.15
Fixes: QTBUG-83503
Change-Id: Ia9f67c92ca37fd0f4e89f08e5153e12c1385f6f8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-11-06 15:36:06 +10:00
Lorn Potter
663a175893 wasm: fix network reply status attribute
We were emitting the finished signal before the status code attributes
were being set.

Fixes: QTBUG-97984
Pick-to: 6.2 5.15
Change-Id: Ib179898dee2b9667d482348ad12180e8bdef74db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-11-06 15:08:54 +10:00
Thiago Macieira
8790142aeb QPluginLoader: fix indentation and comments
Indetnation was bad in commit 0ab3c5c250
and was missed in code review and one comment wasn't updated when the
code was.

Take the opportunity to remove an old TODO that has been completed for
years.

Change-Id: Ice04365c72984d07a64dfffd16b4899604513680
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-11-05 21:13:35 -07:00
Thiago Macieira
4fe71db2ee QCoreApplication: document the app's bindir is in libraryPaths()
The QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
function has been there since at least Qt 4.5.1, so the documentation
for appendLibraryPaths() hasn't matched behavior for a minimum of 13
years. The documentation for libraryPaths() has mentioned this fact,
though.

Searching the application's bin dir is normal on Windows, as many
application packages are a flat install with the .exe and all .dlls in
one dir. I find it questionable to do so on Unix, though: any and all
applications expecting to be installed by a Linux distribution would not
install plugins to /usr/bin, whereas on macOS bundles have their own
organization anyway.

But I'm not prepared to change the behavior without more justification.
I can think only of broken configurations (such what is described in
QTBUG-97950 where a combination of bad decisions led to scanning all of
/usr/bin) and running an executable that is stored in a world-writable
directory.

Task-number: QTBUG-97950
Pick-to: 6.2
Change-Id: Ice04365c72984d07a64dfffd16b440868373d7a5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-11-05 21:13:34 -07:00
Thiago Macieira
1d62bf3150 Revert "QOperatingSystemVersion: Add support for Win10 sub-versions"
This reverts commit 9568362bfe because
the implementation does not use the agreed-upon solution of static
constexpr (thus, inline) variables. This change needs to be re-issued
after that suppotr lands.

Change-Id: Ib42f3828dcbed66603adc2a699cdac2a8469b263
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-06 00:27:42 +00:00
Marc Mutz
570485be95 QArrayDataOps: fix QList range ctors with mixed value_type in C++20 builds
The QList<X> range ctor is supposed to accept iterators with
value_types convertible to X, e.g. tst_qitemselectionrange passes
iterator to a container of QModelIndex to the ctor of a
QList<QPersistentModelIndex>. But copyAppend() is not a template, so
trying to pass QModelIndex* when QPersistentModelIndex* is expected
errors out.

Fix by taking the copyAppend() path only if the types match.

Amends 507be11303.

Change-Id: I5e3ff84a80dc05dafde5572463b33df9002c8fe0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-11-06 00:05:15 +01:00
Alexey Edelev
a07598e47b Move the ${target}_prepare_apk_dir target description
Move the description of ${target}_prepare_apk_dir to the right place.
The code related to qt_internal_plugins was mistakenly placed between
comment and target creation, so move it to avoid confusion.

Change-Id: Iaf178811a30ce0f51d6131c8a68f024d3efddfeb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-05 23:40:25 +01:00
Timur Pocheptsov
081a2b9b1f QMacStyle: skip 'custom' rendering of CE_HeaderLabel
Instead, similar to 'Fusion' style use what common style can do,
thus respecting text alignment and not always forcing VCenter
alignment.

Fixes: QTBUG-97698
Change-Id: I89ad01807afc217c3c33650e1f1d255d0b81ed46
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-05 20:30:08 +01:00
Luca Di Sera
ae0733c99b Doc: Remove broken homepage link for Vera fonts attribution
The attribution for the Vera Fonts project declares a page on the gnome
domain as the homepage of the fonts.

The page is not maintained anymore and was removed from the gnome
domain.

Hence, we remove the "Homepage" key from the Vera Fonts attribution as
no homepage seems to exists at the moment.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: If4801eb96ce5568c4c18ecea7807ad87e165ca2a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-05 18:02:09 +01:00
Volker Hilsheimer
02164b292f Don't use QCursor::pos in QTabBar and fix hover handling
Relying on QCursor::pos makes tests fragile and prevents multi-seat support.
Instead, record the mouse position in the already existing event handling,
and use that instead. Styles might use either WA_Hover or enable mouse
tracking for the widget to enable hover-effects, so we need to support both.
Fix the scenario where a newly inserted tab ends up under the mouse, which
was previously not handled correctly (only the case of removing a tab was).

Clean up the repaint management when the hovered tab changes; just call
update on the old rect, and then later update on the new rect; there's no
need to make a copy first, updates are posted and compressed.

Add a unit test that makes sure that we paint tabs that should be under the
mouse in the hovered state. Since not all styles enable hovering and/or
mouse tracking in all cases, use a style sheet for those styles that don't.

Change-Id: I7cdbb18e9e04b52651e273680fec87b50cb81e05
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-11-05 16:54:55 +01:00
Zhang Hao
7451fb36fd plaintextEdit draw text with clipRect should consider cusorWidth
If the width of the text to be drawn is equal to the width of
clipRect, the cursor will not be displayed.
So we need add cursorWidth to the clipRect when draw text.

Fixes: QTBUG-94028
Pick-to: 5.15
Change-Id: I8686953f13c04d224327cf0f865ded7241d80ccd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-11-05 15:31:23 +00:00
Luca Di Sera
09a68dfa94 Doc: Move Q_OBJECT_COMPUTED_PROPERTY to QObjectComputedProperty
`Q_OBJECT_COMPUTED_PROPERTY` is a macro that is used to declare a
`QObjectComputedProperty`.

The documentation for the macro was related to the
`QObjectCompatProperty` documentation, which is internal.

A link to `Q_OBJECT_COMPUTED_PROPERTY` appears in
`QObjectComputedProperty`'s page, but fails to resolve as the required
documentation page is internal.

Furthermore, `QObjectCompatProperty` has a macro that is equivalent to
`Q_OBJECT_COMPUTED_PROPERTY`, `Q_OBJECT_COMPAT_PROPERTY`, whose
documentation is declared related to `QObjectCompatProperty`.

It is hence assumed that relating the documentation for
`Q_OBJECT_COMPUTED_PROPERTY` to `QObjectCompatProperty` was a typo, such
that the documentation for the macro is now moved to be related to
`QObjectComputedProperty`, resolving the linking issue in the process.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: I2c1bfd6ba64f13e186c65701593047b64bf0c199
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-11-05 15:31:23 +00:00
Alexey Edelev
45ce3c6fb9 Make sure that all MODULE_LIBRARY targets are built before deploying to Android
Users may add the implicit runtime depedencies to the MODULE_LIBRARY
targets, that are created using standard CMake API. When iterating a
project tree we collect all module libraries and add them as
dependencies to the qt_internal_plugins meta target. All the
${target}_make_apk targets depend on this meta target, so we can
be sure that plugins are built and present on the file system before
running androiddeployqt.

Task-number: QTBUG-94714
Task-number: QTBUG-88841
Change-Id: I4fa7f0772d23897f19db59c6e4ad38646bd3aed6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-05 15:56:07 +01:00
Alexey Edelev
067a23f2c6 Make sure that all plugin targets are built before deploying to Android
We need to make sure that all plugin targets are built and present
on the file system before running androiddeployqt. This especially
important when building executables that depend on qml modules that are
built in the project tree. This adds meta target that collects all
the plugin targets as dependencies and adds this meta target as the
dependency for the custom target that executes androiddeployqt.

TODO: We should also take into account MODULE libraries that were
added using the CMake add_library call, but since qt6_finalize_project
is not a part of 6.2 API, this will be added in follow up commit.

Pick-to: 6.2
Task-number: QTBUG-94714
Task-number: QTBUG-88841
Change-Id: I4b4596eb8ed364dbe80e2cfb0ce31cec32e7c03f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-05 14:52:26 +01:00
Joerg Bornemann
2c070b6f4d Fix EntryPointMinGW32Target.cmake to be found in top-level build
This amends commit 67dadc7e34.

We need to copy EntryPointMinGW32Target.cmake to the build dir.  The
variable config_install_dir contains path relative to the install
prefix, and the copy command needs one relative to the build dir (or an
absolute one).

Pick-to: 6.2
Fixes: QTBUG-97919
Change-Id: I4e3d735edfb69e27c248191b892422cef572258e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-05 14:52:26 +01:00
Volker Hilsheimer
e5ebc28764 QAIV: Reset double-click flag in mousePressEvent
Amends 17c1ebf8bf, which introduced logic
that recognizes double clicks to avoid duplicate clicked() emits. If a
slot connected to doubleClicked opens a dialog, then the release-event
will not be seen by the item view, leaving the flag incorrectly set and
preventing the next clicked signal.

Fixes: QTBUG-97853
Pick-to: 6.2 5.15
Change-Id: Iced83e8c66a763672f522265435dc52a745227e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-11-05 14:52:25 +01:00
Volker Hilsheimer
c04b5e0c8c Tidy up QPixmapCache to prevent potential segfault
Following reports of segfaults in long-running programs leading to
QPixmapCache corruption, clean up some code smells:

* check pointers before dereferencing

We did this in some places, and a default constructed or moved-from key
could have a nullptr KeyData, so check everywhere.

* don't trunctate qsizetype to int

Still plenty of int APIs left, but no need for ints in internal code.

* don't underflow maxCost to -1 if totalCost was 0
* use ranged-for to iterate over list of keys
* guard any public function that might create the cache with the thread-
test

This avoids that the cache ends up living in the wrong thread.

* don't use reinterpret_cast when static_cast is enough (which is always
from void*)

Since the crash is not reproducible so far, and the reports indicate
that it can only be observed when the program has run for a long time,
there is no test case included. However, this removes some code smells
that might be responsible for data corruption.

Pick-to: 6.2
Task-number: QTBUG-97903
Task-number: QTBUG-91445
Task-number: QTCREATORBUG-26473
Change-Id: Ibdd8963d7dd44caab1468ecc6f81ace761719c69
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-11-05 14:09:39 +01:00
Marc Mutz
faa854ffeb QByteArrayList: fix narrowing in join() implementations [2/2]
We forgot to adjust the interface and implementation of join() to the
int → qsizetype change in Qt 6.

This part of the two-part patch fixes things in a non-forwards-BC way,
so it can't be picked into released versions. The forwards-BC part is
in the first patch of the series.

We can't just replace the int seplen with qsizetype, because qsizetype
is an alias to int on 32-bit platforms. So, pass the separator by
QByteArrayView.

[ChangeLog][QtCore][QByteArrayList] Fixed a bug when calling join()
with separators of length > INTMAX.

Change-Id: I2ccc61de1c8901ac5504aea1ebd895d12dbcb064
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-05 09:06:22 +01:00
Marc Mutz
0b768e3c43 Include qproperty.h where needed
Don't rely on transitive include from qobject.h, which will go away.

Change-Id: I99dd97ff4fb1d0632d040daab0bffa2d7b85d3ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-04 21:45:02 +01:00
Kai Köhne
879e42cba8 Suppress rc.exe default output
Hide output like

  Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
  Copyright (C) Microsoft Corporation.  All rights reserved.

when building the auto-generated .rc files.

Pick-to: 6.2
Fixes: QTBUG-97729
Change-Id: Id0c32c8015ec2ac0b47b3add52d5c0f8a7a1c203
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-04 18:29:57 +01:00
Thiago Macieira
c0a8cfe167 QFactoryLoader: remove the porting hack to complete the port to CBOR
Change-Id: I3eb1bd30e0124f89a052fffd16a6f632c62bcef5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-04 10:20:09 -07:00
Thiago Macieira
0ab3c5c250 QPluginLoader/ELF: fix Clang ASan builds
Clang aligns the object at 32-byte boundaries even though we
specifically asked for alignof(void*), so tell it not to sanitize the
address of the plugin object. Tested with Clang 12 and 13.

GCC seems not to be affected, even when ASan is enabled.

If this doesn't work, we may need to accept reading a note that is
improperly aligned. I don't think the output will be actually a correct
note because the intra-note alignment will be wrong (I carefully chose
the ELF note name so it would not require alignment, but that's only
valid up to 8-byte alignments).

Fixes: QTBUG-97941
Change-Id: Ice04365c72984d07a64dfffd16b422fe074d8a70
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-04 18:20:09 +01:00
Marc Mutz
b4c7d6b8d4 Extract Header qbindingstorage.h
QBindingStorage doesn't depend in-size on much else in qproperty.h,
but is used in-size in qobject.h, thus requiring qobject.h to include
qproperty.h.

As a first step, move the class and the bits it actually depends on,
to a separate header file, qbindingstorage.h, and, for now, just
include that from qproperty.h. The end goal here is to make qobject.h
independent of qproperty.h.

Pick-to: 6.2
Change-Id: I44245a5e57473067e3106d1fd70bf2d744ce0a5f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-04 16:11:36 +00:00
Marc Mutz
404a7c0094 QDataStream: remove pointless guard around std::pair operators
The code is already in 'ifndef QT_NO_DATASTREAM'. Well, the condition
is a bit more complicated, which makes this nested guard even more
wrong.

Amends 55150f0f0b.

Change-Id: I1c8f35ebc0355185244c8bf098d000b7c5c543d5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-04 17:11:36 +01:00
Marc Mutz
c1c15abc8d QByteArrayList: fix narrowing in join() implementations [1/2]
We forgot to adjust the interface and implementation of join() to the
int → qsizetype change in Qt 6.

This part of the two-part patch fixes things in a forwards-BC way, to
allow picking into released versions. The forwards-BC break is in the
second patch of the series.

[ChangeLog][QtCore][QByteArrayList] Fixed a bug when calling join() on
lists with more than INTMAX elements.

Pick-to: 6.2
Change-Id: I26976864e77169ff0db7c672d1d42d88dbfcc437
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-04 16:11:35 +00:00
Marc Mutz
5d19219eeb QNI NetworkManager: Extract Method primaryConnectionDevicePath()
Avoids duplication of complex code (RB tree lookup).

Change-Id: I70ac7095b05ee56cdf7c86dd1d1a7c9c3232c9d4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-04 12:02:47 +01:00
Mårten Nordheim
4a3996e98b QNI NetworkManager: Small refactorings and correctness fix
Extract and reuse a lambda for initialization and slot object.
Pass a QDBusObjectPath parameter by const-ref.
Avoid implicit ascii-to-utf16 string conversion.

Change-Id: I591ae6e58e010ccabcf9012db866949492e0191d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-04 12:02:44 +01:00
Mårten Nordheim
33df48f957 QNI: networkmanager support for the isMetered API
Task-number: QTBUG-91024
Change-Id: I25ac05adbcbfa92a98fe1e9db9ac931e5c340fcd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-04 11:02:40 +00:00
Mårten Nordheim
83ddf49bc7 QNI: Android support for isMetered
Task-number: QTBUG-91024
Change-Id: I7a8fdcddc25fdb60390b424a888d0311afd8cef3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-04 11:02:29 +00:00
Mårten Nordheim
bd52c1bba6 QNI: Add API to check if connection is metered
This may be a useful factor in deciding whether or not you should
perform communications over the network which are not purely essential.
For example, if you have a logging mechanism you can delay uploading
them until you are no longer on a metered network.

Task-number: QTBUG-91024
Change-Id: I19d32f031a3893512dc440914133678004987fb1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-04 12:02:25 +01:00
Morten Johan Sørvig
6d039a5e76 wasm: enable event dispatcher asyncify support
Misc. fixes, including:

Fix a couple of typos in the JavaScript code. Also, macros-
within-macros don’t work, (without resorting to preprocessor
token pasting), so remove the debug output for now.

Limit the exec() “simulateInfiniteLoop” workaround to
top-level application exec() only. This way, asyncify
can be used for nested QEventLoop::exec() calls. (Emscripten
supports one level of suspend only, so we don’t want
to use that for the top-level exec(), but instead use it
for dialogs and such).

Use the new QEventLoop::ProcessEventsFlag::ApplicationExec
enum value to detect the exec() call type.

Change-Id: Ic702bfc31faf2e9f84ac5d3ccf43d067c5c61bf0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-04 09:23:11 +02:00
Tor Arne Vestbø
34f9da730f iOS: Hide UIWindow before restoring mirror mode
Doing it the opposite way, by associating the new screen first, will
result in the external screen not going back to mirroring the main
display.

Pick-to: 6.2 5.15
Change-Id: I63970380fc4f0902af5032043809a9c1b1f9f95b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-04 05:06:03 +01:00
Tor Arne Vestbø
36852d78bf iOS: Defer restoring screen mirroring until next runloop pass
Associating the UIWindow with a different screen will trigger layout
of the child views of the window, including the view that we're in
the process of removing, which doesn't have a platform window anymore.

Instead of protecting every possible code path in the view code
with checks for a platform window we defer the restoring of
mirror mode until after the view has been removed.

Pick-to: 6.2 5.15
Task-number: QTBUG-94530
Change-Id: I8c66106cafa67e06721e621c019b2d10acf02326
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-04 05:06:03 +01:00
Tor Arne Vestbø
f2d1502429 iOS: Don't try to initialize a11y for views that have no platform window
The window may have been destroyed, but the UIView may still be
be referenced and kept alive by the a11y subsystem.

Pick-to: 6.2 5.15
Task-number: QTBUG-94530
Change-Id: I24f1c9d45e80c1bb4c92536e7f91533a94fd077f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-04 05:06:03 +01:00
Yuhang Zhao
9568362bfe QOperatingSystemVersion: Add support for Win10 sub-versions
Windows 10 has many sub-versions such as 1809/1903/1909/etc,
currently Qt6 can only detect if the application is running
on Win10 or not, which I think is not accurate enough.
Different Win10 version may introduce different features
and bugs, the developers will have to know the exact version.
Only give a general Win10 as an answer is not ideal. I think
Qt should add variables for these sub-versions.

Change-Id: I772d25a528ee2f8a4afba314d701142a06c718f9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-04 12:06:03 +08:00
Marc Mutz
f5fbad669d QByteArrayList: add join(QByteArrayView)
Since QByteArray/QByteArrayView don't overload nicely, we need to make
the existing QByteArray overload a Q_WEAK_OVERLOAD (= a template) as a
tie breaker. This automatically prefers the QByteArrayView version
over the QByteArray overload, transparently optimizing existing users
passing char string literals to avoid the implicit creation of a
QByteArray just for passing the separator.

None of our modules exports a subclass of QByteArrayList, so turning
join(QByteArray) into a function template should be ok.

[ChangeLog][QtCore][QByteArrayList] Added join(QByteArrayView)
overload.

Change-Id: I090671d9b94c30b63a986f17e966d124c22b5c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-04 01:16:16 +01:00
Timur Pocheptsov
122f7d7adc qnsview_mouse, scrollWheel: do not assume zero deltas on Ending phase
It's somewhat difficult to reproduce, but having a mac with a trackpad
and a huge scrollview (meaning I have to scroll fast and a lot), I am
able from time to time to trigger an assert on the line:
Q_ASSERT(pixelDelta.isNull() && angleDelta.isNull())

In all such cases, I can see that deltas are not zero, but equal
to the ones that the next event (momentumPhase == Begin) has.

The code is based on Tor Arne's patch.

Pick-to: 6.2 5.15
Fixes: QTBUG-97945
Change-Id: I874c776b265d3950cc2b6c1d8054363b3d0d1fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-03 23:56:01 +01:00
Giuseppe D'Angelo
efc1cd5799 PCRE2: upgrade to 10.39
New upstream release.

[ChangeLog][Third-Party Code] PCRE2 has been updated to version 10.39.

Change-Id: Ic8db3035bad41a8cdb0d735e593e71124b5df9d2
Pick-to: 5.15 6.2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-03 22:54:37 +01:00
Thiago Macieira
74e1ab1adf qlibrary.cpp: avoid the +12 constant in too many places
Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9a5f99bf9499e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-11-03 14:54:37 -07:00
Thiago Macieira
2c2c6de85a qlibraryinfo.cpp: use qOffsetStringArray for qtConfEntries
Beats a manual array with too wide strings. I thought even to simply
replace this with a switch (loc)... it's not like this is
performance-critical code, given it uses QString.

Change-Id: I2bbf422288924c198645fffd16a977778ff8d52d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-11-03 14:54:37 -07:00
Mårten Nordheim
2d39509d4a QNI: Clarify Feature enum entries' documentation
Saying properties are not available depending on feature support
is misleading. It is available even if not supported, it's just not useful.

Pick-to: 6.2
Change-Id: I6325c50867bb873258c70280adb8d75125db2096
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-11-03 20:07:32 +01:00
Mitch Curtis
762a3d73f5 Make QPlatformTheme a gadget
So that we can wrap it and expose that wrapper to QML.

Also, make the ThemeHints enum available with Q_ENUM.

Change-Id: I920e7cc29c45c81c3a381b14ddb077f259f66b6c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-03 20:41:30 +02:00
Mitch Curtis
3aa1a7fad1 Add ShowDirectoriesFirst platform theme hint
This allows Qt Quick Dialogs to accurately check how it should show
files and directories.

Change-Id: I0f5102553ff9a0484b3714ba176f7e5e668fd05c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-03 20:41:30 +02:00
Andy Shaw
fa53c62472 FreeType: allow falling back to synthesized bold if desired
Some users still prefer the fake bold look even if in some cases it does
not look good. So add an environment variable -
QT_NO_SYNTHESIZED_BOLD_LIMIT - to allow that fallback to stay in place.

Pick-to: 6.2 5.15
Change-Id: I8212c1fa36edb4730b187dc4a23ea45f94981154
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-11-03 16:23:47 +02:00
Ievgenii Meshcheriakov
57cab7b9a8 QAbstractFileEngine: Remove useless method overrides
Remove useless overrides of QAbstractFileEngine methods from the derived
classes. Also remove "This virtual function must be reimplemented by
all subclasses" passages from the QAbstractFileEngine's documentation.
There are pure virtual methods for such use cases. QAbstractFileEngine
already contains useful defaults for classes not supporting all the
functionality.

Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-03 13:42:35 +01:00
Mårten Nordheim
29f86b5698 QMultiHash: Add forgotten documentation
After the split of QHash and QMultiHash this function was not documented
since it was previously inherited from QHash.

As a drive-by also update 'int' to 'qsizetype' in docs

Pick-to: 6.2
Change-Id: I5d168886f13c2cdd4482038e66d0cf218789c847
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-03 07:41:56 +00:00
Morten Johan Sørvig
e3a5bd3e55 Add QEventLoop::ProcessEventsFlag::ApplicationExec
The wasm event dispatcher needs to differentiate between
top-level QCoreApplication::exec() and QEventLoop::exec()
calls.

Add the “ApplicationExec” enum value. The value is
undocumented, like EventLoopExec and DialogExec.

Change-Id: I2924daee39ef85a3ea7e766e317b3071b5d7f541

Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-03 08:52:39 +02:00
Laszlo Agocs
ace53d282d rhi: Extend docs regarding QImage and data lifetime
Change-Id: I45e0e53af7e6ba084f6305c3097c6a0ff65fb458
Pick-to: 6.2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-11-02 22:21:06 +01:00
Laszlo Agocs
711c55b632 rhi: vk: fix offscreen frame command completion wait
Remove the if-there-is-more-than-one-swapchain condition. Surely in a
(onscreen) 0, (onscreen) 1, (offscreen) 0 frame sequence the wait is
essential when starting the offscreen frame. Otherwise we may be
deferred-releasing resources from the still active onscreen #0 frame.

The problem is only apparent with certain frame slot change sequences.
For instance (onscreen) 0, (offscreen) 1, (onscreen) 0 would not show
any problems.

Pick-to: 6.2
Change-Id: I705a0a3ab0b4bc9e4dc2b1c6ff60025d04c739b3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-11-02 22:21:06 +01:00
Alexey Edelev
ad2143b8d2 Add CMake variable to run androiddeployqt with --verbose argument
Change-Id: Ib913e0471ef9c7efcc64c52de21a2e4c7d44e416
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-11-02 19:51:42 +01:00