Commit Graph

40099 Commits

Author SHA1 Message Date
Marc Mutz
5327bae6f0 QEventPoint: forward-declare QMutableEventPoint before befriending it
Otherwise the friend declaration declares the name, which here is ok,
but can cause duplicate names in other situations.

Pick-to: 6.3 6.2
Change-Id: I695f9c5c116b90ba52e1b99e15f31e732e63d357
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-12 02:03:15 +01:00
Marc Mutz
3917838d64 QFlatMap: optimize construction from existing containers
Use {copy,move} ctors instead of default-ctor, followed by
(move|copy)-assignment.

Pick-to: 6.3 6.2
Change-Id: Id2fd53050cd353a9374fd065ac25d753d42d1be9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-12 02:03:15 +01:00
Marc Mutz
e809d4e3cc QFlatMap: fix pointless reallocations on repeated range-insert()s
When looping over range-insert(), the repeated shrink_to_fit() calls
would cause cause reserved (or geometrically-grown) capacity to be
shed, breaking the underlying container's growth strategy.

Fix by not shedding excess capacity.

Pick-to: 6.3 6.2
Change-Id: I10915a06fc9442039c192486a55e48083da7c839
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-12 02:03:15 +01:00
Laszlo Agocs
cdfbe70923 rhi: Improve the handling of HDR capable texture formats
Add some sort of autotest for both RGBA16F and the new RGB10A2. The
latter is introduced particularly because ideally we should have a
texture format that corresponds to the D3D/Vulkan swapchain color
buffer format with HDR10.

Change-Id: I1e1bbb7c7e32cb3db89275900811c0bcaeac39d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-11 22:38:35 +01:00
Laszlo Agocs
0be28d1030 rhi: Add some docs for the hdr info queries
Change-Id: I9b3b62ac83642a7d3e474c991e572877b9e46ca5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-11 22:38:35 +01:00
Thiago Macieira
bb35b2f64d QByteArray: fix append() with a negative length
The documentation says that if it's negative, we find the null
termination. This bug was introduced with the clean up to use
QByteArrayView in commit 8897aa071a.

Fixes: QTBUG-99640
Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-11 15:12:30 +00:00
Shawn Rutledge
17dca04a61 Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spans
If the editing app (like qtbase/examples/widgets/richtext/textedit)
has controls only for setting a specific font, and someone uses it to
write markdown "from scratch", then we need to detect that they chose
Courier or some other fixed-pitch font, and write the backticks,
because Markdown has no syntax for selecting a specific font family.
If the user loads markdown into such an application, the font
is set to QFontDatabase::systemFont(QFontDatabase::FixedFont).
Round-trip editing was already working, as long as such a font exists.
QTextCharFormat::setFont() calls setFontFixedPitch(font.fixedPitch()),
but for the chosen "mono" font, font.fixedPitch() can be false.
For semantic completeness and separation of concerns, we now
set fontFixedPitch explicitly if a `backtick` span is encountered.
As a followup to f1e60de665 this
should get its autotest passing reliably.

Fixes: QTBUG-99676
Pick-to: 6.3 6.2 5.15
Change-Id: I4987a1f0f819f82ec64546bdc3ef53e7d29933de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-01-11 15:04:25 +00:00
Øystein Heskestad
2a086a9857 Replace QString with QStringView and use qsizetype in QPdfEnginePrivate
Task-number: QTBUG-98763
Change-Id: Iab09d5a4d23215fd44e4b2cf4212688cd8f27a63
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-11 15:39:14 +01:00
Marc Mutz
ae49252dbc QMutableEventPoint: add static overloads of setters
These overloads don't require a cast from QEventPoint to
QMutableEventPoint, thus avoiding undefined behavior.

Port easy users of QMutableEventPosition::(const)from()
to the new API.

Pick-to: 6.3
Task-number: QTBUG-99615
Change-Id: I4e9228322134ef7c712ca478ee8286466efc3585
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-08 09:00:10 +00:00
Michal Klocek
7819edabf6 Revert "Implement QTest::qWait() in terms of QTest::qWaitFor()"
This reverts commit 5c908c8263.

git-bisect points to this commit as the cause for serious test
regressions in the qtwebengine module where test time execution
goes up 10 times (at least for debug builds), causing timeouts.

The reason for the time regression in test execution is caused
as the 'processEvents' call is no longer executed with
'remaining' time:

QCoreApplication::processEvents(QEventLoop::AllEvents, remaining)

'processEvents' do not spin for the whole duration and instead it calls
'predicate' after all event processing but before proceeding with new
events. This introduces significant Chromium's message pump lag
and makes test execution much slower.

In case of relanding this change we need to go through all tests and
extend timeouts, which is not feasible at the moment.

This is a quick-fix for 6.3.

Change-Id: I90696479bfb9f0a0b8a8acc5bb7e7058b7d0c462
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f2d0b327e4e6a6c4b72998c290d554d6c4a8f5b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-01-08 04:51:12 +00:00
Marc Mutz
d0bcbbebc3 QGuiApplication: remove an unneeded const_cast
QPointingDevicePrivate::pointById() already returns (mutable)
EventPointData*, so the eventPoint member is mutable, too.

Task-number: QTBUG-99615
Pick-to: 6.3 6.2
Change-Id: Iae1e665cab4b83b63e0e693bf7c4689e99aa3bae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-08 02:52:08 +01:00
Laszlo Agocs
0739170d4b rhi: gl: Prevent breaking with ES when querying the sampler mapping table
Send the full QShaderVersion down the line, not just the version number.

Change-Id: I895d552fc47e0eb4ca92f32f117cd5a1d4d9015a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-07 14:31:38 +01:00
Mitch Curtis
75abba6487 Add PreselectFirstFileInDirectory platform theme hint
This allows Qt Quick Dialogs to accurately check whether it should
select the first file in a directory when a file dialog is opened.

While we're here, fix an incorrect version on the last theme hint
that was added.

Task-number: QTBUG-98562
Change-Id: I08cc8a0fbed28a42d1212016c6ee7fc5459578bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-07 13:31:38 +00:00
Øystein Heskestad
0edbf7f97d Use ranged for loops instead of QString::utf16
Task-number: QTBUG-98763
Change-Id: I27a854121a783e67afcc4f8634ea7c8c921430c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-07 14:31:38 +01:00
Øystein Heskestad
18671b0491 Replace QString::utf16() with data() in memcpy() and QByteArray ctor
QString::utf16() needlessly detaches fromRawData() to ensure a
terminating NUL. Use data() where we don't require said NUL, taking
care not to call the mutable data() overload, which would detach,
too.

Task-number: QTBUG-98763
Change-Id: I7075a8f18ab1f82ebbcf8cfab1643e8ab7f38d51
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-07 14:31:38 +01:00
Marc Mutz
a5b158ed6d QFlatMap: fix const iterator API
Iterators model pointer, so const must be shallow.

Pick-to: 6.3 6.2
Change-Id: I90494c98762f1494efcca4965ee739540333f5d7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-07 14:31:38 +01:00
Marc Mutz
e6cd1eb079 QFlatMap: fix mixed rvalue/lvalue insert overloads
They never worked.

Pick-to: 6.3 6.2
Change-Id: I9a15c848416419823f28ea580248fbe93a4365dd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-07 14:31:38 +01:00
Tor Arne Vestbø
2e11918456 macOS: Handle momentum scroll NSEventPhaseBegan when scroll had ended
We use nextEventMatchingMask to look for future momentum scroll events
when the non-momentum scroll ends, to continue the scroll uninterrupted
from the perspective of client code. But we're not guaranteed to find
a future momentum scroll event, as observed on macOS 12.1, so if we
then see a momentum NSEventPhaseBegan we need to treat it as a scroll
begin from Qt's perspective.

Fixes: QTBUG-97841
Pick-to: 6.3 6.2 5.15
Change-Id: I412abe0891660eda32a42a08d7dc7dee9eaa73aa
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-07 07:02:20 +01:00
Yuhang Zhao
00d197662d QHighDpiScaling: fix typo in doc
Pick-to: 6.3 6.2
Change-Id: I7f874e85484a6ab4be0280e736b57141bdebc656
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-07 12:25:04 +08:00
Yuhang Zhao
44cd0c6c5f QFontDatabase: remove outdated comments
QtBase/2526df506bda99f9497e83a4e6820557a722660e has
resolved what the comment said.

As a drive-by, remove the unused QSystemLibrary include,
which is forgotten in 2526df506b.

Amends commit 2526df506b

Pick-to: 6.3
Change-Id: Iab5c7d00e22d306be63d7588ea44bf73d377793d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-07 12:25:04 +08:00
Yuhang Zhao
e8882ac896 QOperatingSystemVersion_win: Allow override as Windows 11
And added some later Windows Server versions.

Change-Id: I81415f1044d11458a4b4d19b01ce90e357f9d111
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-07 09:39:08 +08:00
Laszlo Agocs
7cbac745dc rhi: Returns mapping tables by value from QShader
As these are QList and QHash. All existing usages are based on this
anyway, no value in being able to indicate "not available" - an empty
container fulfills the same role.

Change-Id: I8059025fa7a4acb6fc674cd98b16fcafa19ed85d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-07 01:03:47 +01:00
Marc Mutz
d2055fcee5 QGuiApplication: remove a use of QMutableEventPoint
The 'persistentPoint' reference is never used as a QMutableEventPoint,
so don't cast to it (which is UB).

Pick-to: 6.3 6.2
Task-number: QTBUG-99615
Change-Id: I7fdfb2427a09d691242bf1fa28e202ba326ea678
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-06 21:06:10 +00:00
Shawn Rutledge
f1e60de665 QTextMarkdownImporter: don't apply text char format to list item block
We want an ordered list item's number to be rendered with default char
format, like the others in the same list, even if the list item's text
begins with a span that has a different char format.  So insert the
list item's block with a default char format first, then change the
char format of the cursor to suit the text that's about to be inserted.
In HTML interpretation, it means the <li> does not have a style, but
contains a styled span.

Fixes: QTBUG-92445
Task-number: QTBUG-3583
Task-number: QTBUG-99148
Pick-to: 5.15 6.2 6.3
Change-Id: I7eb58a8d1171c16503cac01c8cce109d9f12e1af
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-01-06 22:06:09 +01:00
Laszlo Agocs
0d98a1faf7 rhi: gl: Do not just rely on GL_COMPRESSED_TEXTURE_FORMATS
Pick-to: 6.3 6.2
Task-number: QTBUG-98937
Change-Id: I64f2783ae64ad3ef77a389999ded4c9ba2c46ee5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-01-06 14:56:32 +01:00
Laszlo Agocs
0a59101495 rhi: Add support for separate image and sampler objects
For Direct 3D, Metal, and Vulkan this is natively supported. (and
makes no difference in particular for D3D and Metal because they do
not have the legacy combined image sampler concept anyways)

With OpenGL it will work too, but this relies on SPIR-Cross magic and
is still using a combined sampler (e.g. a sampler2D) in the GLSL
shader. The GL backend walks back and forth in the mapping tables from
the shader baker in order to make this work, which is presumably
slightly more expensive than combined image samplers.

Do note that combined image samplers (i.e. sampler2D in the shader and
QRhiShaderResourceBinding::sampledTexture() in code) continue to be
the primary, recommended way for any user of the rhi for the time
being.

Change-Id: I194721bc657b1ffbcc1bb79e6eadebe569a25087
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-06 14:56:25 +01:00
Andy Shaw
c20b213eab SQLite: Update SQLite to v3.37.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.37.0

Pick-to: 6.3 6.2 5.15
Change-Id: I5b6ec6f7a3c4be551ce73d46557e43bbce657854
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-06 13:55:53 +00:00
Kai Köhne
17eb0f2d8a Keep original text for text/plain mime data
For historical reasons, QTextDocument[Fragment]::toPlainText replaces
nbsp character (U+00A0) with a normal space, and U+2029, and U+2028
characters with a line feed character.

This behavior differs from native (plain) text editors. It also creates
an asymetry, because the characters in question can be pasted into the
document, but not copied out of it.

Use the newly introduced QTextDocumentFragment::toRawText()
to avoid this conversion.

[ChangeLog][QtGui][Drag&Drop] Special characters like &nbsp; are now
preserved in the text/plain part of the clipboard when copied from
a QTextEdit or QLineEdit.

Fixes: QTBUG-99572
Change-Id: If01a5dd98127a59be15a425dc029c7303bce18f1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-01-06 07:58:44 +01:00
Kai Köhne
93c1f481ab Add QTextDocumentFragment::toRawText()
Like QTextDocument::toRawText(), QTextDocumentFragment::toRawText()
does allow access to the raw string without normalizing nbsp,
line separator, paragraph separator unicode characters.

[ChangeLog][QtGui][Text] Added QTextDocumentFragment::toRawText() function.

Task-number: QTBUG-99572
Change-Id: Ia74150a3870ea0e6326fdcda4d9d0410019124ae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-01-06 07:58:39 +01:00
Frank Su
f19ce3898e CMake: link OpenSSL to openssl tls backend instead of QtNetwork
TLS backend has become plugins since Qt 6.2.
QtNetwork does not need these links anymore.

Also removes unnecessary condition since openssl tls backend is enabled
only if OpenSSL is enabled.

Pick-to: 6.2 6.3
Change-Id: I4cc0422531d567ad015f9648fbb2bcd51f634cb9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-06 10:10:52 +08:00
Laszlo Agocs
8efe2d54b7 rhi: Expose HDR output info in a saner way
Don't bother with exposing the IDXGIOutput6. Instead, report the values,
just the ones that matter for tonemapping or transfer functions in a
cross-platform way that's also prepared for Metal's different way of doing
things.

Change-Id: I28c7b6144f8267a9d3d44eff1e40697fb543385f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-06 02:43:40 +01:00
Marc Mutz
abe802cd00 QTzTimeZonePrivate: use ctor delegation instead of init()
This makes it obvious that the code in init() is only called from the
constructor and its m_icu handling doesn't need mutex protection (to
be added in a subsequent commit).

Since the input to the ctor is the result of a virtual function,
factor said virtual into a static function and call that instead.

Pick-to: 6.3 6.2 5.15
Change-Id: I7c49f2e865201a2ce2b2d86b19dae29c6d337e0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 21:29:54 +01:00
Marc Mutz
23aa51991d QTzTimeZonePrivate: fix permanently-detaching m_icu
The m_icu member is a mutable QSharedDataPointer, which means that
only the non-const API subset is accessible, and so any access to it
will always detach, in 5.15 even a check like if (m_icu), which the
code luckily doesn't use (Qt 6 added a operator bool() const).

We don't need detaching behavior here, though, since, once set, m_icu
is never changed. So just use a QExplicitlySharedDataPointer instead,
and never call detach() (which would do the wrong thing). Just in case
someone does add a detach() later, instantiate
QExplicitlySharedDataPointer over QIcuTimeZonePrivate directly. This
requires making displayName() overloads from QTimeZonePrivate visible
in QIcuTimeZonePrivate. Add an assertion that QIcuTimeZonePrivate is
final, with instructions on what to do if it fails. Finally, hold a
pointer-to-const to avoid race conditions in the pointee.

The code still contains a data race, due to the lazy initialization of
m_icu, but now we have at least a fighting change to fix it.

Pick-to: 6.3 6.2 5.15
Change-Id: I32c343822dac43f96d9fbc4c759fa44138861eae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 20:29:42 +00:00
Marc Mutz
2dea20e4b0 QFutureCallOutInterface: de-inline dtor
Pick-to: 6.3
Task-number: QTBUG-45582
Change-Id: I5f3411e1dcea4b76fb0e729f612516db3163c93a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 21:29:31 +01:00
Morten Johan Sørvig
08ea8aaa8b wasm: don’t exit on clean return from main()
Qt 6 uses Emcripten’s default of not exiting the runtime
when main() exits. Make qtloader not transition to
the “Exited” state when main() exits with code 0, since
this would hide the app canvas.

(The app state tracking code in qtloader is by now
outdated, and should be revisited.)

Pick-to: 6.3
Change-Id: Ib47898f1dd93d87b2675f20cd39f96ac3cb681a7
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:49 +01:00
Morten Johan Sørvig
eb62b6ac02 wasm: always use requestAnimationFrame for updates
The compositor was posting update events and flushing/redrawing
using a zero-timer. Change this to use the request_animation_frame
API from Emscripten, which makes sure we flush window
content at the next native paint event.

This has the additional benefit that hidden canvases
(e.g on hidden tabs) won’t get frame events, and then
stop painting.

We support both well-behaved QWindows, where the window
calls requestUpate() and then paints/flushes on the
following deliverUpdateRequest(), and also less well
behaved windows which paints at any point during event
processing.

Pick-to: 6.3
Change-Id: I747d6f7ace86ceddaa18ab86b6a0ee833f98991b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:38 +01:00
Thiago Macieira
e3e2674100 QGlobalStatic: invert the order of destruction and setting the guard
This is how the old implementation did it: the Type member was a member
of Holder, but the guard was set to Destroyed in the HolderBase
destructor, which ran after. I find the way I implemented in
commit81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8 to be more natural, but
it caused regressions at runtime for code that attempted to reenter the
global static on destruction.

Not unit-tested because I don't know if we want to keep this forever.

Pick-to: 6.3
Fixes: QTBUG-99192
Change-Id: Ib42b3adc93bf4d43bd55fffd16c09d7f835d121e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-05 17:03:45 -03:00
Marc Mutz
602a186cb4 QScopedValueRollback: explicitly disable move semantics
For RAII objects, it's natural to have move semantics enabled these
days. So if a RAII type does _not_ offer it (and, as in this case,
cannot be made to offer it), be explicit and disable moves, too.

Change-Id: I5636a0c7ff2fc51982ce9a406f975b07d51af01a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-01-05 10:26:41 +01:00
Marc Mutz
91e210137c QArrayDataOps: remove unused header <algorithm>
The header only uses std::destroy(), which is in <memory>, not
<algorithm>.

Doesn't change anything, because <algorithm> is still transitively
included via qcontainertools_impl.h.

Pick-to: 6.3 6.2
Change-Id: Ib6a94ea56d5819f916c80a2e307c99b328f3d61d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-05 10:26:41 +01:00
Marc Mutz
b8431bef37 QRandom: remove dead pre-C++11 code
All compilers support C++11 unrestricted unions in Qt 6.

Gets rid of another instance of to-be-deprecated-in-C++-23
std::aligned_storage.

Pick-to: 6.3
Task-number: QTBUG-99122
Change-Id: I5e6dc025893c79d0c516fc2d3801ec071615b9cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 10:26:41 +01:00
Marc Mutz
bf81cd8d92 De-inline ctors/dtors in qabstractanimation_p.h
Also add explicit, where missing, and use NSDMI to simplify default
ctor implementations.

For the ctors, this is just about code hygiene. The classes are
exported, so de-inlining the ctors prevents them from being duplicated
in other libraries.

Ditto dtors, except in the case of dtors, being virtual functions, we
also avoid duplicating vtables, which has its own set of problems (see
bug-report).

Task-number: QTBUG-45582
Change-Id: I11536844b751f2e81269a5637153f84c8874ab10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 08:22:00 +01:00
Marc Mutz
85c31d976f QAbstractAnimation: add missing forward-declaration
QUnifiedTimer is declared as a friend using an unqualified name that
hasn't been forward-declared before. In this situation, the friend
declaration declares the name. This is subtle, and while it's ok here,
in other situations it can actually lead to two different names being
declared.

Fix by adding the missing forward declaration.

Pick-to: 6.3 6.2 5.15
Change-Id: Ie9f5165578f1d88c6bee1afa23ef43847755a0eb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 08:22:00 +01:00
Timur Pocheptsov
eabaa8a08e QMacStyle: use the 'momentary push in' type for push buttons
In the past, we were using different hacks to emulate the 'default' button
and a normal button (and them in a pressed/not pressed active/non-active
states). In macOS 12 old trick stopped working and UI looks a bit different:
non-default buttons never get accent color even if pressed. Instead of relying
on a combination of 'push on-push off' type's states and highlight, we can
use the 'momentary push in' (highlighted == YES gives an impression of a pressed
button) + setting a key equivalent (thanks to Tor Arne for the hint) gives
the desired 'default button' look.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-98483
Change-Id: If7d665d217420b7732b556d98d9e0313258ff93e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-05 04:16:43 +00:00
Giuseppe D'Angelo
9ea1f0f8b9 Fix qobject_cast on partially destroyed QWidget/QWindow
QWidget and QWindow use bits in QObjectPrivate to provide for a couple
of shortcuts -- one in qobject_cast, and another in the isWidgetType() /
isWindowType() functions in QObject. These can be optimized by simply
looking at the bits, without actually doing more expensive runtime
casts.

These bits were set on construction, but not unset on destruction.  The
result was for instance that destroying a QWidget would report that the
object was still a QWidget when ~QObject was reached.

Fix this

1) by setting the bits only when QWidget / QWindow constructors start;

2) by resetting the bits once ~QWidget / ~QWindow are completed.
Technically speaking this is not 100% correct in the presence of data
members, but luckily those classes don't have any.

Amend an existing test for QWidget (whose comment said exactly the
opposite of what the test actually did) and add a test for QWindow.

Some other code was wrongly relying on isWidgetType() returning true
for destroyed QWidgets; amend it as needed.

[ChangeLog][QtCore][QObject] Using qobject_cast on partially constructed
or destroyed QWidget/QWindow instances now yields correct results.
Similarly, using the convenience isWidgetType() / isWindowType()
functions now correctly return false on such instances. Before,
qobject_cast (and the convenience functions) would erroneously report
that a given object was a QWidget (resp. QWindow) even during that
object's construction (before QObject's constructor had completed) or
destruction (after QWidget's (resp. QWindow's) destructors had been
completed). This was semantically wrong and inconsistent with other ways
of gathering runtime type information regarding such an object (e.g.
dynamic_cast, obj->metaObject()->className() and so on).

Pick-to: 6.3
Change-Id: Ic45a887951755a9d1a3b838590f1e9f2c4ae6e92
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-05 02:47:47 +01:00
Albert Astals Cid
7e7f5f9783 Use block char format to render list item bullets and numbers
It needs to be rendered with the format of the block not the format of
the first letter of the block; otherwise if the first letter is black or
italics or something, but the rest of the block isn't, the list item
text looks out of place.

Task-number: QTBUG-3583
Fixes: QTBUG-99148
Pick-to: 6.3 6.2 5.15
Change-Id: I63d8d6d6b7cee6bd9938fe1cf42a5f90da1bc0d3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-05 00:11:28 +01:00
Marc Mutz
a06ea83eab QDefaultAnimationDriver: don't promote timerEvent() to public
Leave it as protected. Private API, so no BC constraints apply.

Change-Id: I876456a05372c9d3b83cb7a6410eeaa6c44f1d52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-04 22:36:54 +01:00
Marc Mutz
36709d7dd5 QPointerEvent: de-inline point(i)
This function contributed 1.2s of the total 361s (0.34%) to KDDockWidgets
compilation time, according to a trace generated by Sergio Martins:

    **** Time summary:
    Compilation (146 times):
      Parsing (frontend):          343.2 s
      Codegen & opts (backend):     18.1 s

    **** Templates that took longest to instantiate:
      [...]
      1228 ms: QList<QEventPoint>::operator[] (59 times, avg 20 ms)
      1213 ms: QList<QEventPoint>::detach (59 times, avg 20 ms)
      1209 ms: QArrayDataPointer<QEventPoint>::detach (59 times, avg 20 ms)
      1202 ms: QArrayDataPointer<QEventPoint>::reallocateAndGrow (59 times, avg 20 ms)

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: I5f4ff9843f7deff9f390c465df28cba3391e048b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-04 21:36:54 +00:00
Shawn Rutledge
316389c123 doc: Update details about QSystemTrayIcon
- StatusNotifierItem is now more widely implemented (but I'm sure the
  list could be even longer); but Unity is obsolete
- XEmbed is nearly obsolete, so list it after StatusNotifierItem
- fix the links: it was meant to have friendly anchor text rather
  than showing the whole URL inline

Pick-to: 6.2 6.3
Change-Id: Id81059f9484a8144b6402e74a500edf81d845b65
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-01-04 20:16:22 +01:00
Laszlo Agocs
23f8d6c57f rhi: Drop the profiler for now
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.

This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.

The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.

When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.

Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-04 13:00:40 +01:00
Alexey Edelev
18e62ed3b7 Pass QT_BUILD_STANDALONE_TESTS to Android external project if defined
If we configure qtbase standalone tests for multiple Android ABIs,
external project also needs the QT_BUILD_STANDALONE_TESTS flag enabled
to avoid configuring the whole qtbase but not only tests.

TODO: Need to forward all cache variables that are defined by user to
the external project since otherwise the configuration of the external
project will differ. Created QTBUG-99537 to track this.

Pick-to: 6.3
Change-Id: I3aec1391c850fb37696dc50416e0ff2a2646e759
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-04 12:50:28 +01:00