Commit Graph

54383 Commits

Author SHA1 Message Date
Sona Kurazyan
022891bcd8 Document the example showing the benefits of using bindable properties
And mention the example in the bindable properties docs.

Pick-to: 6.2
Task-number: QTBUG-97655
Change-Id: I676e90dbda66c2e718c7f6c2240fac608a8653df
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-02 12:53:34 +01:00
Sona Kurazyan
cee89e70a6 Add example showing the benefits of using bindable properties
Added two examples for modeling a subscription service: signal/slot
connection-based and bindable property-based. The examples are based
on the example from Fabian's Qt WS talk about the bindable properties.

Pick-to: 6.2
Task-number: QTBUG-97655
Change-Id: I0345913b8b6e5c40b8477e128d36483598bdfcaa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-02 12:53:34 +01:00
Joerg Bornemann
75eb08711e Install MSVC debug information for resource object libraries
Building against a static debug MSVC Qt produced LNK4099 warnings (PDB
was not found with object file).

This was because we did not install the .pdb files for the object
libraries that are created for Qt resources.  Now, these .pdb files are
named like the object library targets and are installed next to the
object files.

Pick-to: 6.2
Fixes: QTBUG-97699
Change-Id: I7e23f8392b7ac657be1d2fb3b33e051ae2e4d407
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-02 12:53:34 +01:00
Eskil Abrahamsen Blomfeldt
6b02473e1e Fix overlapping text for Osaka font on macOS
The Osaka font on macOS has all zeroes in the OS/2 table, probably
because it is not intended to be cross-platform. In Qt 6 (since
f761ad3cd9) we are trying using the
same vertical metrics on all platforms, but this only works if
they are valid.

To work around this issue, we detect the case when ascent/descent
values are both 0, since this is very unlikely to be intentional,
so we fall back to the system-provided ascent and descent in these
cases.

Adding the test also revealed that we had missed the check for
a macOS-specific bitmap font format when skipping the check for
bitmap fonts in 7a18b7e2c2.

[ChangeLog][macOS][Text] Fixed a problem where using the Osaka
font would lead to overlapping text.

Pick-to: 6.2
Fixes: QTBUG-96880
Change-Id: Ifea7918641a68829e8f5ef20a4fb61c0a7e5b757
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-02 07:54:39 +01:00
Zhang Yu
c6c039167c Fix fail to activate first sub window with QMdiArea::TabbedView
The first sub window added will activate itself automatically, and
isActive is set to true. Therefore the call to setActiveSubWindow to
activate the first sub window will be ignored.

When showing the mdiarea, all sub windows will be activated in the order
in which they were added, so the active window will always be the last
sub window added.

Fix this by setting isActive to false so that setActiveSubWindow
activates the first sub window when the mdiarea becomes active.

Fixes: QTBUG-92037
Pick-to: 6.2
Change-Id: Id4a793e2059803c1a4ada916fdae2d3cc02cdf06
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-02 09:08:40 +08:00
Marc Mutz
f814241abe QVarLengthArray: make static if's constexpr
Cleaner. Probably also more efficient at compile time, who knows?

Also more consistent, since _some_ static if's were already
constexpr'ed.

Change-Id: I9657f7cf2166975f562db52e9f90630aaf412986
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-02 01:01:56 +01:00
Eskil Abrahamsen Blomfeldt
bda75c81f5 Fix missing characters or assert with certain font sizes
The alphaMapBoundingBox() only exists to prefetch the size
of rendered alpha maps, to reserve space in the glyph cache.
Since 104e6d0f54 we have not
used the QPainterPath fallback code path when actually
rendering the glyphs, but that patch neglected to update the
code that retrieved the bounding box.

This could in some cases cause a mismatch, and if the alpha
map we ended up with in the end was larger than the reserved
space, this could trigger an assert or an empty spot in the
cache.

[ChangeLog][Text][Freetype] Fixed an issue where characters
would in some rare cases be missing from text, depending on
font metrics, font size and system scale factor.

Pick-to: 5.15 6.2
Fixes: QTBUG-86633
Change-Id: Ic8ade168115e4f51bac71539325936bbae993120
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-01 21:48:49 +01:00
Tatiana Borisova
0de5fcafe2 Turn on autotest build for INTEGRITY on CI
- add INTEGRITY tests to CI for qtbase

Pick-to: 6.2
Change-Id: I7c7b0cb2639a086c1d53bea2d2e682d4c0fb2581
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-12-01 22:48:49 +02:00
Volker Hilsheimer
9538c7ca73 Don't shrink a column when it spans multiple columns
If a cell spans multiple columns, then the merged cells' starting
column's maximum width should never become smaller than what was
calculated from previous rows.

Otherwise, we'd distribute the space of the column that has a span
across all merged columns, resulting in unnecessary line breaks esp if
WrapAnywhere is enabled.

Add a test case.

Fixes: QTBUG-91691
Fixes: QTBUG-95240
Pick-to: 6.2 5.15
Change-Id: Ic27dbdb128071e50fba049de85c9f23ba2f059b3
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-12-01 21:23:05 +01:00
Marc Mutz
147093edd9 QVarLengthArray: More Self-Encapsulate Field
Two more instances where we can use public API instead of accessing the data members directly.

Amends 9d79e5f26c.

Task-number: QTBUG-84785
Change-Id: I2037339383836b0d292b3362fe1d6b056638e81a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-01 15:03:34 +01:00
Giuseppe D'Angelo
e977b55346 QTabBar: clamp maxScrollOffset before using it in qBound
QTabBar's test reveals that maxScrollOffset can be negative, so
using it in a call like

  qBound(0, x, maxScrollOffset)

is wrong. Clamp it to 0.

Change-Id: Idd635343bf14c904dbcc4d141f10bd0161d2cfb4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-01 15:03:34 +01:00
Tor Arne Vestbø
d281274c3f Don't overwrite flipped textureTransform with unflipped on next blit
The logic introduced in 60d9509cb0 didn't
account for the fact that repeated blits with OriginTopLeft would only
hit the code path that modified the source transform to flip it if the
uniform state wasn't already IdentityFlipped.

As a result, we would end up setting the unflipped texture transform
on the next blit, even though the origin was still OriginTopLeft.

Fixes: QTBUG-98803
Change-Id: Ib19e80e026acaa43981077b98ff942a7fa060378
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-01 15:03:34 +01:00
Alexey Edelev
a88b53f713 Use config from the main ABI when building ABI-specific external project
ABI-specific external projects should use the same config as the one is
used by the "main" ABI.

Task-number: QTBUG-88841
Change-Id: If7a1834d9a3f238f6dadd05323ccc0cf8552128c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-01 07:28:58 +01:00
Alexandru Croitor
4ad57bb212 Re-enable tst_qopenglwindow on Linux
Amends 5d6705c567

Change-Id: I359b638465e24f3da0941083f9ad6f022b5222ed
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-12-01 03:28:56 +01:00
Lorn Potter
9a31dada02 wasm: Fix assert/crash when tooltip window is closed and mouse moved
Fixes: QTBUG-92521
Pick-to: 5.15 6.2
Change-Id: I627fdcf3064321a3c1cb1140473038571ec78b9e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-12-01 12:28:27 +10:00
Sona Kurazyan
3be72253a6 Fix QFuture continuations/handlers to work with move-only callables
std::function, which is used to store the type-erased continuation
lambdas, requires the passed callable to be copy-constructible. This
makes impossible to use move-only callables with continuations/handlers.
In particular, it makes impossible passing lambdas that are capturing
move-only objects. The workaround is to store the continuation lambda
inside a wrapper for the callable, which stores the move-only lambda in
a QSharedPtr and can be stored in std::function, since it's copyable.

Pick-to: 6.2
Fixes: QTBUG-98493
Change-Id: I8b7a22fcf68dc132b3c533216a7a1665e9f9fb0a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-01 01:58:18 +01:00
Marc Mutz
1a61b85a2c QVarLengthArray: simplify default ctor
Instead of calling the QVLA(qsizetype) ctor and letting the optimizer
and inliner have a field day on them, simply set the trivial values
for a, s, and ptr manually.

Mark it as noexcept.

Task-number: QTBUG-84785
Change-Id: I011826eacdaf63a4c37b21465e5fe4a6e70a1ab7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-01 00:20:25 +01:00
Mårten Nordheim
c891382900 Openssl backend: reinsert a missing C in qCDebug
Pick-to: 6.2 5.15
Change-Id: I2b13d2f88517abea7e015bfba4fe71dcbada86c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-12-01 00:20:25 +01:00
Alexey Edelev
34fc4770e7 Fix the path to the build dir when creating an androiddeployqt depfile
According to the CMake documentation any relative paths in DEPFILE
should be relative to the CMAKE_CURRENT_BINARY_DIR if the CMP0116
is set to NEW. This also forces CMP0116 to NEW if the policy exists.

Pick-to: 6.2
Change-Id: I3d697b008ea06effb2247bc204da9bcc4e9046b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-30 20:16:13 +01:00
Alexey Edelev
d162ce3732 Add _make_aab target
Add target triggering AAB creation. Since the _make_aab target is
not added to the ALL set, we may avoid dependency check for it and
admit that the target is "always out of date".

[ChangeLog][Android][Platform Specific Changes] Add the extra
_make_aab targets for each executable target, that can be used
to generate android app bundles. Also add aab metatarget to build
all _make_aab targets that are created in the project.

Pick-to: 6.2
Fixes: QTBUG-96710
Change-Id: I3b0c7fbb5a7dd493ca7a124c4e4b91fd857386bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-30 20:16:13 +01:00
Giuseppe D'Angelo
54536bb5ae QString::arg: deprecate use of arbitrary Unicode digits as replacements
The only documented replacements for Q*String*::arg() are sequences like
%1, %2, %3 -- where the n-th number is expressed using a sequence of
ASCII digits [1].

The code parsing the replacements however used the QChar::digitValue()
function. That function simply checks if a QChar has a *Unicode digit
value* (no matter what its block/category is), and if so, returns the
corresponding digit value as an int (otherwise returns -1).

The result of this is that a sequence like "%¹" or "%१" actually
triggered substitutions (both count as "1"). Similarly, QChars with
a digit value would be parsed as part of longer sequences like "%1²"
(counting as "12" (!)).

This behavior is weird, undocumented, and extremely likely the usual
backstabbing by Unicode by using "convenience" QChar methods -- that is,
never *intended* by the implementation.

This commit deprecates (via warnings) such usages, which for the time
being are left working as before (in the name of backwards
compatibility). At the same time: given it's extremely unlikely that
someone would be deliberately relying on this behavior, it implements
the desired change of behavior (only accept sequences of ASCII digits)
starting from Qt 6.6, that is, after the next LTS.

Throughout Qt 6's lifetime users will still be able to control arg()'s
behavior by setting an env variable, but that variable (and the support
for Unicode digits) will disappear in Qt 7.

To summarize:

* Qt 6.3->6.5: default is Unicode digits, env var to control
* Qt 6.6->6.x: default is ASCII digits, env var to control
* Qt 7: only ASCII digits, no env var

[1] That's the name Unicode gives to them, cf. https://www.unicode.org/charts/PDF/U0000.pdf

[ChangeLog][QtCore][Deprecation Notices] The arg() functions
featured in Qt string classes have always been documented to require
replacements tokens to be sequences of ASCII digits (like %1, %2, %34,
and so on). A coding oversight made it accept sequences of arbitrary
characters with a Unicode digit value instead. For instance, "%2੩" is
interpreted as the 23rd substitution; and "%1²" is interpreted as the
12th substitution. This behavior is deprecated, and will result in
runtime warnings. Starting from Qt 6.6, arg()'s behavior will be changed
to accept only ASCII digits by default. That means that "%1²" is going
to be interpreted as substitution number 1 followed by the "²" character
(which does not get substituted, so it gets left as-is in the result).
Users can restore the previous semantics (accept Unicode digits) by
setting the QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG environment
variable to a non-zero value. In Qt 7, arg() will only support sequences
of ASCII digits. Note that from Qt 6.3 users can also set
QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG to zero; this will make arg()
use ASCII digits only, in preparation for the future change of defaults.

Change-Id: I8a044b629bcca6996e76018c9faf7c6748ae04e8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-30 19:33:34 +02:00
Edward Welbourne
064c3d35e6 Don't allocate an OCIDateTime object unless we're going to use it
The QOCIDateTime destructor carefully checks that dateTime is non-null
before tidying it away, but the constructor allocated it independently
of whether it was used, leaving it in a still-not-constructed state if
the date-time it was to represent was invalid.

Only allocate if the date-time is valid; and check against null when
an OCIDateTime is being converted back to QDateTime. Add warnings if
either allocation or construction fails. Incidentally use
static_cast<> instead of C-casting (and split a long line) in the
other place that allocates an OCIDateTime descriptor.

Pick-to: 6.2 5.15
Task-number: QTBUG-98471
Change-Id: Idd5531d9f7101878802cb9a3a016d3fd80903543
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-30 16:34:01 +01:00
Iikka Eklund
dafed13eb5 Conan: Do not write qt.conf to build artifacts
The qt.conf causes issues with CI and building/running tests.

Pick-to: 6.2
Task-number: QTBUG-93037
Change-Id: I079e71e64985eb69c37adaacb93c45a4a92ef4fa
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-11-30 17:34:00 +02:00
Kai Köhne
6c10546a4b Enable warnings-are-errors for Visual Studio 2022
Change-Id: Id0b143f668f69481f6037f94aedbfd2e87331497
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-11-30 16:32:10 +01:00
Alexey Edelev
bcac7d9433 Use config-specific suffix of android deployment settings for multi-config only
QtCreator doesn't expect any config-specific suffixes in the android
deployment settings file, when running androiddeployqt. This avoids
adding the config-specific suffix in the single-config builds and
for the first config in the multi-config builds.

Amends a41d9bcac9

Change-Id: I606509c9bfd2e75cac144aca37b4568639aae74f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-30 16:32:10 +01:00
Janne Juntunen
2bfa4b9960 QNX: check and use elf.h from alternative location
In QNX, instead of #include <elf.h>, we have to use #include <sys/elf.h>
since that file is placed in a subdirectory.

Also removed the previous workaround.

Fixes: QTBUG-97833
Change-Id: Id932a5eeb618a42c8778459cdfd8bb5bf903523c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-30 14:37:52 +02:00
Edward Welbourne
b9f7add531 Verify returns from QXmlTestLogger's xmlQuote() and xmlCdata()
Using partially-converted text would lead to invalid XML, so don't use
the buffer contents if the return is zero. As a result,
QTestJUnitStreamer::formatEnd() needs to return some indication of
whether *it* succeeded, so change it to forward their int returns;
and, as it's in fact only used internally by the streamer, make it
private.

Make these functions [[nodiscard]] so that further uses of them will
be discouraged from ignoring the possibility of failure. Make the
public versions return bool so that they can correctly succeed on
empty input. Assert various conditions we can infer to save work we
don't need to do.

Change-Id: I899bad23d1dfbd05fc725de269def4ce213dbc5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-30 12:26:08 +01:00
Kai Köhne
78a6e73007 Remove unused LICENSE.LGPLv3 files
It's not referenced anymore in qtbase since a while. Other Qt
repositories are cleaned up, too.

Change-Id: Ic6fe796b9b08848e41d6bce9d97e19399af05907
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-30 11:16:17 +01:00
Marc Mutz
0265b923ac QVarLengthArray: simplify copy ctor implementation
std::tie(a, s, ptr) = {Prealloc, 0, (T*)array} is exactly the effects
of the default ctor, so just delegate to it, before calling
copyAppend().

Also clean up the copy ctor declaration (superfluous inline keyword,
and template arguments).

Change-Id: Iefc758a47996382fee10b1e081e44f008b146287
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-30 06:38:40 +01:00
Thiago Macieira
6855b80eae QList::count(T): remove the &* hack on iterators
Use data() and data() + size() instead.

This solves an UB when the list is in its default-constructed state,
for which constData() == nullptr.

Pick-to: 6.2
Fixes: QTBUG-98770
Change-Id: I2cffe62afda945079b63fffd16bc165978c769f6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-30 01:42:50 +00:00
Tor Arne Vestbø
60d9509cb0 Teach QOpenGLTextureBlitter about GL_TEXTURE_RECTANGLE textures
Change-Id: Ie577bda046f60ce23dfb8cdd6164bb3de4b54358
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-30 02:36:29 +01:00
Lorn Potter
0fa98a26fd wasm: add Blob and File type
Convenience getters for mime type associated with the object.

Change-Id: I7e3530459e50ac4740d533db59c46e838c94dbcd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-11-30 09:06:54 +10:00
Marc Mutz
be84b033dc QRegularExpression: don't detach() a pattern QStringLiteral
... just to pass it to pcre2_compile_16().

The QString::utf16() function guarantees a NUL-terminated result, so
it detach()es from QStringLiteral (Qt 6) and/or QString::fromRawData()
(Qt 5 + 6).

This user doesn't require the NUL-termination, though, since
pcre2_compile_16() takes an explicit length, so the detach() is
completely unneccesary, yet common, since regex pattern strings are
often QStringLiteral()s.

Task-number: QTBUG-98763
Change-Id: I1d08ae1a1ec4281ff44a68c5ba5c56584b71d24e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-11-30 00:04:38 +01:00
Mårten Nordheim
4c930e9d13 QNAM: Disable h2c by default
And since it's relatively unlikely to be used, just leave it
behind a environment variable for now.

[ChangeLog][QtNetwork][Potentially Source-Incompatible] Support for
clear-text http/2 was disabled due to incompatibility with certain
servers. If you were relying on this feature you must re-enable it by
setting the QT_NETWORK_ALLOW_H2C environment variable. For a later
version of Qt it will get a dedicated attribute.

Pick-to: 6.2
Task-number: QTBUG-98642
Change-Id: Id3e360726e285b3128e3e3f4bce9440404c9ad6e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-30 00:04:38 +01:00
Samuli Piippo
ca9d72f465 Doc build: fix conflicting response file with moc
Doc build is using the same variable to define the reponse file
as moc build, which can lead to case where moc is using the qdoc's
response file instead of its own. Moc needs more include paths than
qdoc, this can then lead to weird compilation issues as moc doesn't
warn about missing includes.

Task-number: QTBUG-98569
Pick-to: 6.2 5.15
Change-Id: Id35da18f664e2032bae96d11b00dbfe55ce37f66
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-11-29 22:50:00 +02:00
Marc Mutz
8568a6386c Check that QStringView::split() w/rvalue QRegularExpression returns valid data
This test currently passes in Qt 6, but fails in Qt 5.15, thus the
QT_VERSION check.

Pick-to: 6.2 5.15
Task-number: QTBUG-98653
Change-Id: I3c7b9bc7ef74f605ff63768b38c473296274d0de
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-29 20:04:38 +00:00
Marc Mutz
ccaeffe565 QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH: use unqualified qHash() lookup
... instead of QT_PREPEND_NAMESPACE(qHash), which is qualified (prepends at least '::'), and therefore disables ADL.

This is not a problem as long as we wrote our qHash() overloads as free functions (incl. non-hidden friends), but it should™ fail for hidden friends, so use the old using-std::swap() trick to bring QT_PREPEND_NAMESPACE(qHash) into scope, proceeding with an unqualified lookup.

Pick-to: 6.2
Change-Id: I00860b2313699849f86bfe3dd9f41db4ce993cd3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-29 18:55:10 +00:00
Joerg Bornemann
95ccdfa432 CMake: Fix Android platform detection
...if an Android platform < 10 is installed.

The existing platform detection code preferred android-9 over
android-31, because the sorting did not use natural comparison.

Natural comparison was added to CMake in version 3.18.  We simulate this
feature for older CMake versions.

Pick-to: 6.2
Fixes: QTBUG-98726
Change-Id: Ib2eb87bd47220feb672275fa5203df4f2b6d7ca7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-29 19:55:05 +01:00
Eskil Abrahamsen Blomfeldt
793417ce75 Fix gaps between lines of selection
When a font has fractional metrics, we could get visible gaps
between lines in a multi-line selection, if the bottom of the
rect was not aligned to the pixel grid. In Qt 5, this was
primarily an issue on macOS, but since making vertical metrics
consistent in f761ad3cd9, we
could also get this on other platforms, causing a regression
on these platforms.

The fix is to align the rect to the pixel grid.

[ChangeLog][Text] Fixed an issue where there would sometimes be
visible gaps in selections spanning multiple lines.

Pick-to: 6.2
Fixes: QTBUG-98372
Change-Id: I03cb1465602b6d78c60a0c764d920f7f092418a8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-29 16:25:38 +01:00
Volker Hilsheimer
56da533b45 Never handle scrollbars styled with box or border changes as transient
If scrollbars are styled with a style sheet that includes a box or
removes off the native border, then we never treat them as transient or
overlapping. Otherwise, the layout logic in QAbstractScrollArea will
show them on top of the viewport, overlapping the content.

Add case to the style sheet test baseline test. It's a test for
scrollbars in a scroll area, rather than a test for the styling of the
scrollbars themselves.

Fixes: QTBUG-98289
Pick-to: 6.2
Change-Id: Ic53ad248b3eedd54722ac7b2fe5256a27092dbc1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-11-29 16:02:28 +01:00
Eirik Aavitsland
8fbedf2196 QTextDocument: fix an off-by-one in the changed signal for lists
When blocks are added or removed in block groups, i.e. items added or
removed from text lists, the whole group is marked as changed, but the
calculation of the before/after group length would be one off. That
was reflected in the contentsChange signal.

Add unit test. Since the whole group changes when list items are
added, text is removed and the change-begin is not where the cursor
was when the change was made.

Fixes: QTBUG-82455
Pick-to: 6.2 5.15
Change-Id: I99ee2cfef4944fcac8aca492741fd0f3b0de4920
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-11-29 13:25:31 +01:00
Oliver Wolff
a892a7b2ca Shorten target name for qsortfilterproxymodel auto tests
These long target names can quickly lead to exceeding Windows' max path
length.

Pick-to: 6.2
Change-Id: Ibd77e53464a71221f9302d490afbe9c41c16646d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-29 08:08:21 +01:00
Liang Qi
143f20692e gui: add QInputDevice::seatNames()
Change-Id: Ie6cedd62dcd684a8fd9adbc2409e5aa1f3490ede
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-28 13:15:00 +02:00
Thiago Macieira
0e72a846d3 QObject: Q_ASSERT the object type before calling a PMF
The old-syle signal-slot syntax had the advantage of not delivering
signals to slots in derived classes after that derived class's
destructor had finished running (because we called via the virtual
qt_metacall). The new syntax made no checks, so a conversion from the
old to the new syntax may introduce crashes or other data corruptions at
runtime if the destructor had completed.

This commit introduces a Q_ASSERT to print the class name that the
object is not any more. Since this is in inline code, this should get
enabled for users' debug modes and does not therefore depend on Qt being
built in debug mode.

It required some Private classes to be adapted to the new form, by
exposing the public q_func() in the public: part.

Pick-to: 6.2
Fixes: QTBUG-33908
Change-Id: Iccb47e5527544b6fbd75fffd16b874cdc08c1f3e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-11-27 21:38:22 -08:00
Thiago Macieira
b41356658e QLocale: suppress annoying GCC warning in the bootstrap lib
Happens on line:
        return QList<QLocale>() << QLocale(QLocale::C);

QLocale's constructor taking the C "language" calls findLocalePrivate()
that returns indeed the non-heap object c_locale in the c_private()
function. But it also sets the refcount to 1, meaning it can never drop
to 0 under proper refcounting and will thus never be deleted.

Therefore, the compiler is wrong. I don't have time to figure out how to
teach it that the deletion can never happen. I just want the warning to
go away. It wsa probably introduced by commit
d4242b8af3.

In destructor ‘QSharedDataPointer<T>::~QSharedDataPointer() [with T = QLocalePrivate]’,
    inlined from ‘QLocale::~QLocale()’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:1035:1,
    inlined from ‘void QtPrivate::QMovableArrayOps<T>::emplace(qsizetype, Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qarraydataops.h:829:5,
    inlined from ‘T& QList<T>::emplaceBack(Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:891:15,
    inlined from ‘void QList<T>::append(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:479:24,
    inlined from ‘QList<T>& QList<T>::operator<<(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:726:13,
    inlined from ‘static QList<QLocale> QLocale::matchingLocales(QLocale::Language, QLocale::Script, QLocale::Territory)’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:2684:54:
/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qshareddata.h:91:55: warning: ‘void operator delete(void*, std::size_t)’ called on unallocated object ‘c_locale’ [-Wfree-nonheap-object]
   91 |     ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; }
      |                                                       ^~~~~~~~

Pick-to: 6.2
Change-Id: Iccb47e5527544b6fbd75fffd16b8d078987b812b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-27 19:10:52 -08:00
Marc Mutz
df663625af QLayoutPolicy: un-export the class
The class is almost completely inline. Don't export it wholesale, only
export the few out-of-line members.

Also acts as a test-case for the new Q_GADGET_EXPORT feature.

Task-number: QTBUG-55458
Change-Id: I699a774614183960d7ac4e0afcdb57cfef76db15
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-27 17:22:57 +01:00
Ivan Tkachenko
e8531e4c1f Drop Qt3 support
QDoc does not need those defines anymore because there is no Qt3Support
library anymore; they are simply not #ifdef guarding any code anymore.

Task-number: QTBUG-98650
Change-Id: I42b9c3ce025f639ce6282102b5eadb52fea7fa8e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-11-27 16:04:03 +03:00
Lorn Potter
820a6d4117 wasm: fix mouse move and right click
Emscripten has no concept of 'no mouse button', so when there
is no button down, it was sending left mouse.

Also we were hiding mousepress for only leftmouse downs.

Fixes: QTBUG-97431
Pick-to: 6.2
Change-Id: Ibf078705c343944e45551830b7fee94ed5aa7333
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-11-27 14:17:37 +10:00
Jarkko Koivikko
625cfb6b40 QGraphicsItem: Update input context after InputMethod event
Without updating the input context, the input method goes out of sync
with the text control.

Fix by updating the input context after InputMethod event.

Fixes: QTBUG-98544
Pick-to: 6.2 5.15
Change-Id: Idfb99bb0f886249cdab923b8dbed96277800c064
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-27 04:14:15 +02:00
Marc Mutz
23f980799d QSharedPointer: fix counter-productive QT_PREPEND_NAMESPACE use in qHash() impl
The qHash(QSharedPointer) implementation is already in QT_NAMESPACE,
if any, so explicitly qualifying the call adds no functions to the
overload set, but actually removes functions that would be found by ADL
(which is only enabled for unqualified calls).

Fix by using an unqualified call.

[ChangeLog][QtCore][QSharedPointer] The qHash(QSharedPointer<X>)
overload can now use qHash(X*) overloads found (only) through ADL
(was: ADL was disabled due to qualified lookup of qHash(X*)).

Pick-to: 6.2 5.15
Change-Id: Ic6cc47103142d48b6cdefa2cd6552a65cf1cb222
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-27 01:37:06 +00:00