Commit Graph

52837 Commits

Author SHA1 Message Date
Tor Arne Vestbø
bae9aeacbe macOS: Correctly compute marked and selected text range, and use for insertion
The NSTextInputClient protocol expects marked (composed) and selected
text ranges to be relative to the document, not to the current editing
block as Qt typically expects.

Luckily we can use the absolute cursor position to compute an absolute
offset that we can apply to any other positions, such as the selection.

Now that we are computing the ranges correctly we can also use them
during text insertion, when the incoming replacementRange is not valid.

We then transform and sanitize the replacement range to the format that
Qt expects for QInputMethodEvent::setCommitString().

Pick-to: 6.2
Change-Id: I4cb2f7c63adb92e407f38af05adce539c9bed7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-24 13:39:06 +02:00
Tor Arne Vestbø
f6b851837d Fix warning about loop variable creating a copy
qxpmhandler.cpp:1162:21: warning: loop variable '[color, index]' of type
  'const std::__1::pair<const unsigned int, int>' creates a copy from type
  'const std::__1::pair<const unsigned int, int>' [-Wrange-loop-analysis]
    for (const auto [color, index] : colorMap)
                    ^

Change-Id: Ifabf1c569efdcd929859227d860f4598250ba5bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-24 13:39:06 +02:00
Volker Hilsheimer
01aeb5f7e4 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
Pick-to: 5.15 6.1 6.2
Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-24 13:32:07 +02:00
Giuseppe D'Angelo
d48058f197 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 a794c5e287.

Fixes: QTBUG-94951
Pick-to: 6.1 5.15
Change-Id: If987d5ccf7c6b13de36d049b1b3d88a3c4b6dd00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-24 12:58:20 +02:00
Eirik Aavitsland
ca604964f6 Painting: handle large and negative dash offset values
The mapping of the dash offset into the dash pattern was susceptible
to int overflow.

Pick-to: 6.2 6.1 5.15
Change-Id: I254ed40b323ef516d10abc8e6008b14cfc23d2a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-24 08:49:48 +02:00
Eirik Aavitsland
279a434c1c 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
Pick-to: 6.2 6.1 5.15
Change-Id: Ida05ecd8fe6df402c9e669206fd5cec4a9f5386a
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-24 08:49:36 +02:00
David Faure
cf34fca4d0 QDBus: fix ExportScriptableInvokables to allow calling scriptable invokables
The "wantedMask" check in the xml generator didn't distinguish slots
from invokables, so exporting an object with just ExportScriptableInvokables
didn't allow calling Q_SCRIPTABLE methods.

Change-Id: I7b408755da5b28e67a9384d9df95e22dc5de2369
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-23 23:07:30 +02:00
David Faure
7a5f8baa67 qdbusxml2cpp: don't generate an include for all of QtDBus+QtCore
This, however, has to wait for Qt 7 for compat reasons.

Change-Id: I84db4715bf2e9d080d1446d24f0996c78a875e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-23 23:07:30 +02:00
Alexey Edelev
f037357232 Add the json option to disable the zstd based compression
Need to disable zstd compression if its support is not built in Qt
for Android. The flag is dected when configuring user's project and
is a part of the deployment settings. This partially fixes loading of
android_rcc_bundle.rcc.

Pick-to: 6.2
Task-number: QTBUG-93340
Task-number: QTBUG-95969
Change-Id: I635afb3f9e182a559d53e9344e07f62788f9837d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-23 20:05:27 +02:00
Tor Arne Vestbø
86d338383e macOS: Highlight selected part of preedit using platform theme palette
QInputMethodEvent::Selection unfortunately doesn't apply to the
preedit text, and QInputMethodEvent::Cursor which does, doesn't
support setting a selection. Until we've introduced attributes
that allow us to propagate the preedit selection semantically
we resort to styling the selection via the TextFormat attribute,
so that the preedit selection is visible to the user.

This allows us to remove the fallback we had for thick and double
underline styles, where we mapped those to the wiggly underline style.
This was needed to distinguish the selected cluster when composing
CJK, but looked out of place.

One disadvantage of faking the selection via text format is that
we will not update the selection color on theme change, e.g. when
switching from light to dark mode, but this is a minor issue that we
can live with until we've introduced a proper QInputMethodEvent
attribute for the preedit selection.

Pick-to: 6.2
Change-Id: I1c45c310107697962e328a4db908d29d2358f756
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-23 17:30:18 +02:00
Tor Arne Vestbø
7d45f2d0b9 macOS: Add debug keyboard layout for manual testing
Pick-to: 6.2
Change-Id: Ie35f7a57c6d54c1cc0a7b79d8fd25d0b056bf5e6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-23 17:30:18 +02:00
Eskil Abrahamsen Blomfeldt
1971250de5 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.

Pick-to: 6.1 6.2
Fixes: QTBUG-94529
Change-Id: Id2c88f0a145776151be0399ee646f28b3bdf9072
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-23 16:35:36 +02:00
Volker Krause
ec497d5e65 Fix access to content: URLs with transient read/write permissions
The current code assumed that the lack of persistent permissions means
we cannot access the file at all. That however isn't the case for
content: URLs we get e.g. via Intents, those are accessible perfectly
fine via QFile, we just don't have (and can't obtain) persistent
permissions for them.

This is done by continuing in the case of not having persistent
permissions and checking for SecurityExceptions that are thrown when
accessing content: URLs we really have no permission for.

Pick-to: 6.2 5.15
Change-Id: I39115a7730d717eb9517e4f1c1a57e40988001a5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-08-23 15:36:03 +02:00
Edward Welbourne
3878a17137 Use constexpr for constants and ranged-based for loops
In the process, actually use the constants as the size of some arrays,
instead of making [1024] arrays and then only using a few entries.

Change-Id: I9f36b322840393b8680788190cf8b40a828f4957
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-08-23 15:11:49 +02:00
Assam Boudjelthia
760e24e867 Android: guard getStateCount() with correct VERSION.SDK_INT
The call getStateCount() was introduced in 29, so cases for
lower API should be handled.

Pick-to: 6.2 6.1
Change-Id: I7f58541c0b16fed91835e6f390afa89378a7af3e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-08-23 15:39:44 +03:00
Edward Welbourne
eec25c7807 Fix the (currently unbuilt) qdir/tree/ benchmark
It tried to find its test-data-directory locally, instead of asking
FileSystem where it was keeping its files, relative to a temporary
directory. Its expected counts didn't match the arcane results of its
data file; since this is a benchmark, not a regression test, I'm
assuming that's just because it was never right or the rules for
QDirIterator's filtering have changed.

Tidied up somewhat in the process.

Change-Id: Ib2dcd314b11cb0f1a6fc425633afd0e9c39bd036
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-08-23 14:39:44 +02:00
Zhang Hao
d267060189 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
Pick-to: 5.15 6.1 6.2
Change-Id: I9eef35fd89c5c1d79f6dd703355634d6905ca967
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-23 12:39:44 +00:00
Fabian Kosmale
e4d62651c2 Re-add QPropertyAlias functionality
As QPropertyAlias was public by accident in 6.0, we have to ensure that
it still works in 6.2.
This re-adds some tests for it, and reimplements the unlinking
functionality. To avoid performance regressions in hot-paths,
a new unlink_fast function is added, which behaves like the old unlink:
It ignores the special handling for QPropertyAlias, so that we can skip
the tag check. It is only used in QPropertyObserverNodeProtector and
clearDependencyObservers, where we already know the type of the
observer.

Fixes: QTBUG-95846
Pick-to: 6.2
Change-Id: Ifb405b8327c4d61c673b1a912ed6e169d27c2d8f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-08-23 12:39:44 +00:00
Marc Mutz
17357856b5 QMetaEnum: write "proper code"
Rewrite keysToValue() as suggested by a comment:

- Don't use the moral equivalent of
     QString::fromLatin1(keys).split().front().toLatin1(),
  use QStringTokenizer over QLatin1Strings, removing lots of
  allocations.

- Use QL1S instead of raw char* and strcmp(), because that made the
  old code rely on NUL-terminated tokens after splitting, which is no
  longer the case when using QStringTokenizer.

- Use the new stringDataView() instead of stringData() to avoid
  QByteArray dtors littering the code.

- Extract Method parse_scope(), using high-level API operating on QL1S
  to see what it's actually doing, instead of previous low-level
  bit-pushing with char* and ints that did a good job of obfuscating
  the purpose of all the scanning.

- Extract Method lookup() as a lambda to make the main loop of the
  algorithm more readable.

- Extract Method className() to delay looking up the class name until
  it is required (and help with readability). This could be further
  optimized by memoizing the result, but I'm convinced that's not
  worth the effort.

The code now no longer allocates, but we still can't mark the function
as noexcept, because stringDataView() contains a Q_ASSERT, so the
function has preconditions.

Results show that the new code is up to 2x faster than the old, and
never slower (within measurement uncertainty):

 PASS   : tst_QMetaEnum::keysToValue(0 bits set)
-     0.00042 msecs per iteration (total: 56, iterations: 131072)
+     0.00012 msecs per iteration (total: 68, iterations: 524288)
 PASS   : tst_QMetaEnum::keysToValue(1 bits set)
-     0.00079 msecs per iteration (total: 52, iterations: 65536)
+     0.00024 msecs per iteration (total: 63, iterations: 262144)
 PASS   : tst_QMetaEnum::keysToValue(2 bits set)
-     0.0010 msecs per iteration (total: 71, iterations: 65536)
+     0.00040 msecs per iteration (total: 53, iterations: 131072)
 PASS   : tst_QMetaEnum::keysToValue(3 bits set)
-     0.0014 msecs per iteration (total: 98, iterations: 65536)
+     0.00054 msecs per iteration (total: 72, iterations: 131072)
 PASS   : tst_QMetaEnum::keysToValue(4 bits set)
-     0.0017 msecs per iteration (total: 57, iterations: 32768)
+     0.00074 msecs per iteration (total: 98, iterations: 131072)
 PASS   : tst_QMetaEnum::keysToValue(5 bits set)
-     0.0019 msecs per iteration (total: 65, iterations: 32768)
+     0.00088 msecs per iteration (total: 58, iterations: 65536)
 PASS   : tst_QMetaEnum::keysToValue(6 bits set)
-     0.0022 msecs per iteration (total: 74, iterations: 32768)
+     0.0010 msecs per iteration (total: 72, iterations: 65536)
 PASS   : tst_QMetaEnum::keysToValue(7 bits set)
-     0.0025 msecs per iteration (total: 85, iterations: 32768)
+     0.0012 msecs per iteration (total: 79, iterations: 65536)
 PASS   : tst_QMetaEnum::keysToValue(8 bits set)
-     0.0027 msecs per iteration (total: 91, iterations: 32768)
+     0.0012 msecs per iteration (total: 85, iterations: 65536)
 PASS   : tst_QMetaEnum::keysToValue(9 bits set)
-     0.0029 msecs per iteration (total: 98, iterations: 32768)
+     0.0014 msecs per iteration (total: 97, iterations: 65536)
 PASS   : tst_QMetaEnum::keysToValue(10 bits set)
-     0.0033 msecs per iteration (total: 55, iterations: 16384)
+     0.0018 msecs per iteration (total: 62, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(11 bits set)
-     0.0036 msecs per iteration (total: 60, iterations: 16384)
+     0.0022 msecs per iteration (total: 73, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(12 bits set)
-     0.0036 msecs per iteration (total: 60, iterations: 16384)
+     0.0018 msecs per iteration (total: 62, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(13 bits set)
-     0.0039 msecs per iteration (total: 64, iterations: 16384)
+     0.0021 msecs per iteration (total: 70, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(14 bits set)
-     0.0040 msecs per iteration (total: 67, iterations: 16384)
+     0.0023 msecs per iteration (total: 77, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(15 bits set)
-     0.0042 msecs per iteration (total: 70, iterations: 16384)
+     0.0025 msecs per iteration (total: 82, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(16 bits set)
-     0.0053 msecs per iteration (total: 88, iterations: 16384)
+     0.0028 msecs per iteration (total: 92, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(17 bits set)
-     0.0048 msecs per iteration (total: 80, iterations: 16384)
+     0.0029 msecs per iteration (total: 97, iterations: 32768)
 PASS   : tst_QMetaEnum::keysToValue(18 bits set)
-     0.0050 msecs per iteration (total: 83, iterations: 16384)
+     0.0031 msecs per iteration (total: 51, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(19 bits set)
-     0.0051 msecs per iteration (total: 85, iterations: 16384)
+     0.0037 msecs per iteration (total: 62, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(20 bits set)
-     0.0053 msecs per iteration (total: 88, iterations: 16384)
+     0.0041 msecs per iteration (total: 68, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(21 bits set)
-     0.0056 msecs per iteration (total: 92, iterations: 16384)
+     0.0042 msecs per iteration (total: 69, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(22 bits set)
-     0.0056 msecs per iteration (total: 93, iterations: 16384)
+     0.0044 msecs per iteration (total: 73, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(23 bits set)
-     0.0057 msecs per iteration (total: 95, iterations: 16384)
+     0.0044 msecs per iteration (total: 73, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(24 bits set)
-     0.0060 msecs per iteration (total: 99, iterations: 16384)
+     0.0062 msecs per iteration (total: 51, iterations: 8192)
 PASS   : tst_QMetaEnum::keysToValue(25 bits set)
-     0.0063 msecs per iteration (total: 52, iterations: 8192)
+     0.0048 msecs per iteration (total: 80, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(26 bits set)
-     0.000381 msecs per iteration (total: 100, iterations: 262144)
+     0.00014 msecs per iteration (total: 75, iterations: 524288)
 PASS   : tst_QMetaEnum::keysToValue(27 bits set)
-     0.00616 msecs per iteration (total: 101, iterations: 16384)
+     0.0050 msecs per iteration (total: 82, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(28 bits set)
-     0.0062 msecs per iteration (total: 51, iterations: 8192)
+     0.0051 msecs per iteration (total: 85, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(29 bits set)
-     0.0064 msecs per iteration (total: 53, iterations: 8192)
+     0.0050 msecs per iteration (total: 82, iterations: 16384)
 PASS   : tst_QMetaEnum::keysToValue(30 bits set)
-     0.0062 msecs per iteration (total: 51, iterations: 8192)
+     0.0050 msecs per iteration (total: 83, iterations: 16384)

Change-Id: Idff1ef7633862beb318901352516ebb0dde3c058
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-23 12:23:43 +00:00
Joerg Bornemann
c3308b13ca Doc: Add global \versionlessCMakeCommandsNote qdoc macro
When documenting a CMake command, document the unversioned command
'qt_foo' and use '\versionlessCMakeCommandNote qt6_foo' to refer to the
versioned command.  This avoids duplicating the command signature.

Use the new macro where applicable.

Pick-to: 6.2
Task-number: QTBUG-95796
Change-Id: I2e4180fbda0b89acf3d8c036459f591eb2f46475
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-23 13:06:27 +02:00
Ivan Solovev
fd9a94594f QDir: add assert for nullptr ok parameter in qt_cleanPath
Found by CodeChecker.
The function returns early in case of empty path, but the bool
parameter is never updated in this case. It's not a problem
with the current codebase though.
As it's a static local function, the reasonable solution is just
to add an assert, so that we do not get hit in case of refactoring.

Task-number: QTBUG-95727
Pick-to: 6.2
Change-Id: Idc00356c61b5db8b2204a574612c1ea8e65f4a69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-23 12:32:25 +02:00
Tang Haixiang
77bdce8496 Modify the internal rectangle drawing of CE_RubberBand
adjusted(1, 1, -2, -2) makes the rectangle smaller, but when
rect.x1-rect.x2 = 0. Then x1 + 1, x2-2 leads to x1> x2. This will
make the rectangle flip in advance. So there is a difference
between the updated area and the drawn area.

Add a judgment, when the rectangle we get is large enough, draw the inner rectangle.

Fixes: QTBUG-95716
Done-with: Oliver Eftevaag <oliver.eftevaag@qt.io>
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Pick-to: 6.2
Change-Id: I0d081a4ad7aee4a563acb988c0ef19a646bf1eea
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-23 16:26:55 +08:00
Eskil Abrahamsen Blomfeldt
d8f815db7f Update Harfbuzz to version 2.9.0
[ChangeLog][Text] Updated bundled Harfbuzz to
version 2.9.0.

Pick-to: 6.2
Change-Id: Ib8fed753b99a127d5a4cc793c5c1d55a0090f902
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-08-23 07:37:04 +02:00
Marc Mutz
d07742f333 QLibrary: use QStringTokenizer in isLibrary()
Rewrite the whole function for readability _and_ performance:

- Extract Method isValidSuffix() as a lambda

- Extract Method isNumeric() as a lambda

- Use a C array of QLatin1String instead of a QStringList to hold the
  statically-sized list of candidate suffixes. This has the nice
  side-effect that the compiler will now throw an error in case the
  #ifdef'ery yields zero candidates (C arrays cannot have no
  elements), e.g. when porting to a new platform.

- Last, not least, replace the parsing with a loop that makes clear
  what's going on and which is forward-iteration-only-compatible, so
  we can use QStringTokenizer directly, without toContainer() to get a
  random-access sequence.

Need to use the C++20 version of all_of(), since QStringTokenizer uses
sentinels instead of end-iterators.

Even though we use higher-level constructs now, the code is still more
efficient than the index-twisting we had before.

Change-Id: I9f3faf3e30f58c9eb8a1487a7ca190681e87767b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-21 01:28:27 +02:00
Marc Mutz
bd52059eef QMetaEnum: avoid quadratic behavior in valueToKeys()
QByteArray (thankfully) doesn't have the prepend "optimization", so
prepend() is a linear operation, calling it in a loop thus makes the
algorithm quadratic.

To fix, simply remember the parts in a QVLA (an upper bound on the
size of which is easily calculated) and then build the result by
reverse-iterating over the QVLA.

This join_reversed() function is possibly useful elsewhere, but I left
it locally in the unnamed namespace to ease cherry-picking.

The new stringDataView() function is more universally useful, too, and
will be used in a subsequent other change. It return QL1S instead of
QByteArrayView because the latter is scheduled to become a non-string
type, and already lacks certain features (e.g. qTokenize() doesn't
work on QBA, due to lack of a Qt::CaseSensitivity argument in
QBA::indexOf()). It's also a Qt 6 addition, so not available in
5.15. We can revisit this decision later, when QBAV (or, possibly,
QU8SV) has caught up.

Amends 05e0dfa006.

Results indicate a ~2x speedup:

 PASS   : tst_QMetaEnum::valueToKeys(1 bits set)
-     0.00026 msecs per iteration (total: 70, iterations: 262144)
+     0.00017 msecs per iteration (total: 90, iterations: 524288)
 PASS   : tst_QMetaEnum::valueToKeys(2 bits set)
-     0.00037 msecs per iteration (total: 98, iterations: 262144)
+     0.00019 msecs per iteration (total: 52, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(3 bits set)
-     0.00040 msecs per iteration (total: 53, iterations: 131072)
+     0.00021 msecs per iteration (total: 56, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(4 bits set)
-     0.00047 msecs per iteration (total: 62, iterations: 131072)
+     0.00022 msecs per iteration (total: 60, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(5 bits set)
-     0.00048 msecs per iteration (total: 63, iterations: 131072)
+     0.00024 msecs per iteration (total: 64, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(6 bits set)
-     0.00061 msecs per iteration (total: 80, iterations: 131072)
+     0.00027 msecs per iteration (total: 71, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(7 bits set)
-     0.00063 msecs per iteration (total: 83, iterations: 131072)
+     0.00027 msecs per iteration (total: 73, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(8 bits set)
-     0.00069 msecs per iteration (total: 91, iterations: 131072)
+     0.00030 msecs per iteration (total: 81, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(9 bits set)
-     0.00070 msecs per iteration (total: 92, iterations: 131072)
+     0.00031 msecs per iteration (total: 83, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(10 bits set)
-     0.00074 msecs per iteration (total: 98, iterations: 131072)
+     0.00034 msecs per iteration (total: 91, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(11 bits set)
-     0.000762 msecs per iteration (total: 100, iterations: 131072)
+     0.00035 msecs per iteration (total: 92, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(12 bits set)
-     0.00088 msecs per iteration (total: 58, iterations: 65536)
+     0.000381 msecs per iteration (total: 100, iterations: 262144)
 PASS   : tst_QMetaEnum::valueToKeys(13 bits set)
-     0.00094 msecs per iteration (total: 62, iterations: 65536)
+     0.00038 msecs per iteration (total: 51, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(14 bits set)
-     0.00099 msecs per iteration (total: 65, iterations: 65536)
+     0.00041 msecs per iteration (total: 55, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(15 bits set)
-     0.0010 msecs per iteration (total: 67, iterations: 65536)
+     0.00042 msecs per iteration (total: 56, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(16 bits set)
-     0.0010 msecs per iteration (total: 70, iterations: 65536)
+     0.00044 msecs per iteration (total: 58, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(17 bits set)
-     0.0011 msecs per iteration (total: 73, iterations: 65536)
+     0.00046 msecs per iteration (total: 61, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(18 bits set)
-     0.0012 msecs per iteration (total: 79, iterations: 65536)
+     0.00048 msecs per iteration (total: 63, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(19 bits set)
-     0.0012 msecs per iteration (total: 79, iterations: 65536)
+     0.00051 msecs per iteration (total: 67, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(20 bits set)
-     0.0012 msecs per iteration (total: 80, iterations: 65536)
+     0.00054 msecs per iteration (total: 71, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(21 bits set)
-     0.0012 msecs per iteration (total: 83, iterations: 65536)
+     0.00090 msecs per iteration (total: 59, iterations: 65536)
 PASS   : tst_QMetaEnum::valueToKeys(22 bits set)
-     0.0012 msecs per iteration (total: 85, iterations: 65536)
+     0.00057 msecs per iteration (total: 76, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(23 bits set)
-     0.0013 msecs per iteration (total: 87, iterations: 65536)
+     0.00059 msecs per iteration (total: 78, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(24 bits set)
-     0.0014 msecs per iteration (total: 93, iterations: 65536)
+     0.00065 msecs per iteration (total: 86, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(25 bits set)
-     0.0014 msecs per iteration (total: 94, iterations: 65536)
+     0.00063 msecs per iteration (total: 83, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(26 bits set)
-     0.00028 msecs per iteration (total: 74, iterations: 262144)
+     0.00017 msecs per iteration (total: 94, iterations: 524288)
 PASS   : tst_QMetaEnum::valueToKeys(27 bits set)
-     0.0014 msecs per iteration (total: 98, iterations: 65536)
+     0.00063 msecs per iteration (total: 83, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(28 bits set)
-     0.0014 msecs per iteration (total: 96, iterations: 65536)
+     0.00065 msecs per iteration (total: 86, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(29 bits set)
-     0.0014 msecs per iteration (total: 98, iterations: 65536)
+     0.00064 msecs per iteration (total: 84, iterations: 131072)
 PASS   : tst_QMetaEnum::valueToKeys(30 bits set)
-     0.0014 msecs per iteration (total: 97, iterations: 65536)
+     0.00064 msecs per iteration (total: 84, iterations: 131072)

Pick-to: 6.2 5.15
Change-Id: Ie456b71b39c118001987716e30642f08f5e8dcdb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-21 01:28:27 +02:00
Tor Arne Vestbø
62572f0a18 Add note about ImCursorPosition/ImAbsolutePosition not including preedit
The cursor position as reflected by these two properties is not affected
by the offset of the cursor in the preedit area. That means that when
composing text, the cursor position stays the same, at the preedit
insertion point, regardless of where the cursor is positioned within
the preedit string by the QInputMethodEvent::Cursor attribute.

Pick-to: 6.2
Change-Id: Ic2584369f92271e3f242d51f2e647f6f05c72d53
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Tor Arne Vestbø
b963888b1c macOS: Handle more NSUnderlineStyles during text composition
Pick-to: 6.2
Change-Id: I2a6cf612506d19736eab007f687a03f6d6595b62
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Tor Arne Vestbø
fa6e490374 macOS: Respect default marked text attributes
When the marked text was not an attributed string with built in styling
we used to fall back to a hard-coded underline style.

We now pick up the default marked text style via the markedTextAttributes
property of a temporarily created NSView, which by default is a yellow
background color.

The implementation in NSView respects text system configuration toggles
such as NSMarkedTextAttribute and NSMarkedTextColor, so by setting the
user default NSMarkedTextAttribute to "Underline" the marked text will
look like our old hard-coded default. This can be done in many ways,
including passing `-NSMarkedTextAttribute Underline` on the command
line, or by QSettings::setValue("NSMarkedTextAttribute", "Underline");

Pick-to: 6.2
Change-Id: Iede74836ed1449e77018c13733a675f8e9d84f7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Tor Arne Vestbø
88550e1210 macOS: Clean up code style in [QNSView setMarkedText:]
Pick-to: 6.2
Change-Id: I8a901ac81b64e6fc9bd7fe9ea4e3eaa6257118ce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Tor Arne Vestbø
6c5f996974 macOS: Ensure we provide a preedit format for non-attributed strings
The logic was not taking into account that we were always adding
an QInputMethodEvent::Cursor attribute, so we would never hit the
fallback code.

Pick-to: 6.2
Change-Id: I25bd725025152241a55e3fea60444c20e27db4f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Tor Arne Vestbø
993d8025dc macOS: Simplify validAttributesForMarkedText
We don't need to condition this on IM enablement. The attributes are
only used if we are actually marking text, which only happens for IM
enabled views.

Pick-to: 6.2
Change-Id: I47377cf53cf2bf44a1d9513d317f82c73f083fa3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-21 01:28:26 +02:00
Martin Storsjö
70df6052d8 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
Pick-to: 6.2 6.1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-20 22:19:58 +03:00
Joerg Bornemann
1ac947e3af Add missing -help argument to qt-configure-module
Now it's possible to display a configure help screen per module with
  qt-configure-module <module-source-dir> -help

Pick-to: 6.2
Fixes: QTBUG-95943
Change-Id: I7d26006246af4b38b5a2ec6deca3f45c5313afec
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-20 19:44:43 +02:00
Joerg Bornemann
57ad532e75 Fix our usage of CMake script mode in Windows configure
This is a preparation for adding the -help argument to
qt-configure-module.bat.

Consider the call
  qt-configure-module.bat path/to/qt-module -help
Internally, we called
  cmake ... -P .../QtWriteArgsFile.cmake path/to/qt-module -help
which was supposed to separate the arguments and write them into
config.opt.

However, passing arbitrary arguments after "-P script.cmake" only worked
by accident and is not supported.  As soon as arguments are passed that
are valid CMake arguments, like -help or -G, the CMake call would fail.

Now, we let configure.bat and qt-configure-module.bat write the
arguments as is into config.opt.in and let QtWriteArgsFile.cmake read
this file, separate the arguments and write config.opt.

Pick-to: 6.2
Task-number: QTBUG-95943
Change-Id: I80f298a2aaf55b0f79fed86320a055eb2d2b6faa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-20 19:44:43 +02:00
Tor Arne Vestbø
4e2ec5ab5d macOS: Clarify QAppleKeyMapper
Pick-to: 6.2
Change-Id: I6a6fb4a8ee6e9457b3a09b0ef51e71028df3356d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-20 17:14:03 +00:00
Ievgenii Meshcheriakov
c736fb25c7 QUrl: Fix typos in the documentation
URLs can contain underscores, not "undercores".

Pick-to: 6.2
Change-Id: I000ed89649cee0e7c6f283f2d930097961379445
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-20 18:09:36 +02:00
Joerg Bornemann
6e48d654d7 Don't force lld for Android when clang is used
This reverts commit 64c111e10f.

The claim of the commit message, that we cannot use the gold linker,
does not seem to be true (anymore?).  This is underlined by the fact
that CMake *forces* the gold linker for Android, whenever LTCG is
enabled (see Modules/Compiler/Clang.cmake as of CMake 3.21.1).

Change-Id: I90edac8555be4abdd44cd367228aeffb0d66b895
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-20 17:19:20 +02:00
Tor Arne Vestbø
1caa7680a1 macOS: Correct QNSPanelContentsWrapper @end marker placement
The incorrect "scoping" of q_IOObjectRetain and q_IOObjectRelease
luckily did not affect their functionality as QIOType helpers.

Pick-to: 6.2
Change-Id: I9b9c2312464c7e6f8e2d2a5856e35efa99ec0c41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-20 15:45:39 +02:00
ChunLin Wang
9ba4c6beef 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
Pick-to: 5.15 6.1 6.2
Change-Id: Iebdd5568baa3bdb41c705204dadb2895cfe9c0e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-20 13:31:45 +00:00
Richard Moe Gustavsen
b7150d22c8 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
Pick-to: 6.2 6.1
Change-Id: Ie2d99bfac9fcc70d45e5bd40ea45becf3fd70d87
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-08-20 14:33:16 +02:00
Eirik Aavitsland
587fe1a95a 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.

Pick-to: 6.2 6.1 5.15
Change-Id: I9cffc760524e9ade42362c9a04949270ac24180f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-20 13:50:24 +02:00
Morten Sørvig
7b14329d78 Check for correct "Access Denied" error
SetProcessDpiAwarenessContext() returns ERROR_ACCESS_DENIED if the
DPI awareness has already been set, and not E_ACCESSDENIED like
SetProcessDpiAwareness() does.

Pick-to: 6.2
Change-Id: I6b29214773776f31c0622a35494d98c5c9637b0b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-08-20 13:50:24 +02:00
Joerg Bornemann
80de516565 Fix Android -ltcg build
We're passing -Oz for release builds, but that's not a flag the linker
understands when -ltcg is enabled.  The build fails with:
    ld.gold: fatal error: Optimization level must be between 0 and 3

Fix this by using -O2, which -Oz is based on, and -O3 for the "full
optimization" that is used for core and gui.

Pick-to: 6.2
Fixes: QTBUG-89472
Change-Id: Ie1a86888baefce5ca97026e7d635f10d2819f9f4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-20 09:48:27 +02:00
Zhang Qipeng
cd36734ff4 Remove unnecessary type conversion
Change-Id: I3d1b998b84753706ee78ecb5e498f70e9f935fd5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-20 09:35:52 +08:00
Volker Hilsheimer
70b94eea10 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
Pick-to: 6.2 6.1 5.15
Change-Id: I9c354efc449cfefff3ed84fa34b1cd8a0da3b4a7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-19 23:38:24 +02:00
Tor Arne Vestbø
bb7fe09963 macOS: Expand QNSView complex text documentation
Pick-to: 6.2
Change-Id: Iceb146d7aafb869a80cebe50e27c3bc98e67ebe1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-19 19:10:59 +02:00
Tor Arne Vestbø
dcb4b5e7d2 macOS: Tweak method argument names in QNSView complex text implementation
Pick-to: 6.2
Change-Id: I6a7ec683ffe9c18a89326b3e53b4a907cb9a9512
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-19 19:10:59 +02:00
Tor Arne Vestbø
42573d9496 macOS: Restructure QNSView complex text implementation
For better overview of the flow and functionality of the
NSTextInputClient protocol.

Pick-to: 6.2
Change-Id: I8658405c7ff4ae762bfe3e4c11f9a157ae2b9a09
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-19 19:10:58 +02:00
Tor Arne Vestbø
b601eb9c2d macOS: Reorder QNSView instance variables
Pick-to: 6.2
Change-Id: Icde9ee6744290f88eaa2ac197c40ba412543b122
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-19 19:10:58 +02:00
Tor Arne Vestbø
fde6e1a18c macOS: Update QCocoaInputContext documentation
Pick-to: 6.2
Change-Id: I5ae5fe51ddc1512f2627dbc972fbb95360d7ea24
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-19 19:10:58 +02:00