Commit Graph

39853 Commits

Author SHA1 Message Date
Marc Mutz
d5c605b148 QMetaType: port the BC fix for id() to new QT_REMOVED_SINCE
The allows qmetatype.cpp compilation to enjoy PCH again.

Change-Id: I47c5af33a5dbc930ee4c120b254e732c52bc2369
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-06 19:06:30 +01:00
Gatis Paeglis
9ef69efb3b qxkbcommon: UCS-4-encode surrogate characters in QKeyEvent::key()
Fixes: QTBUG-72776
Pick-to: 6.2 5.15
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: I9d1f4e34527079c3bc460016fe9b953636b4d6cb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-12-06 15:41:33 +01:00
Morten Johan Sørvig
fd0ef140cf wasm: make the compositor draw the window icon
Currently the compositor draws the Qt logo by default;
check if the window has an icon and draw that instead
if set.

Fixes: QTBUG-86052
Pick-to: 6.2
Change-Id: Ia4f9c03562c15993c86cb8717f27e47ab669353d





Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-06 14:42:45 +01:00
Giuseppe D'Angelo
ad5c5bb541 qBound: add an assert on !(upper < lower)
It's a precondition and we might just as well check it, given that
people have actually got the order of the arguments wrong (cf.
QTBUG-69330).

Unfortunately, Q_ASSERT is defined below qBound in qglobal.h, so I had
to reshuffle some code around.

Change-Id: I82e52bcb863ff8c96594817e0cd5d7d2abe2e57e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-06 12:28:41 +01:00
Giuseppe D'Angelo
19072a177b QPageLayout: do not calculate an invalid margin
A default constructed QPageLayout has an invalid QPageSize. When
asking for its size, an invalid QSize is returned (-1, -1). This
size is then used to calculate the maximum margins the page layout
can have, resulting in negative margins.

I'm not sure if that makes sense for QPageLayout (in principle, a
negative margin is acceptable, meaning to "grow" the size), but then
this margin is passed as an upper bound to a series of qBound calls in
QPageLayoutPrivate::clampMargins.

To fix this, change the calculations of the maximum margins by using
a lower bound of 0.

Change-Id: I429104acfb2296d9eb1ee54c113e9d7e22d9b6ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-06 12:28:41 +01:00
Giuseppe D'Angelo
212b7614e1 QListView: fix a broken qBound
If a QListView's model is reset to an empty one, its columnCount()
below the root is going to be 0. Therefore, the code was doing a

  qBound(0, d->column, -1)

which is meaningless (high < low). Instead, do the two logical
operations explicitly: first do an upper bound on d->column
(using qMin) and then lower bound the result by 0 (using qMax).

The code worked by chance, because 0 was eventually the correct
number to use as a bound for d->column.

Change-Id: Ic32077cdab01eaa715137c05ed1f9d66c8eb2f67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-06 12:28:41 +01:00
Kai Köhne
251e848007 Remove .prev_CMakeLists.txt
These are left-overs from the initial qmake2cmake conversion.

Pick-to: 6.2
Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-06 11:23:26 +00:00
Shawn Rutledge
af987c1bde doc: Add details about what to use instead of QMouseEvent::source()
Pick-to: 6.2
Fixes: QTBUG-98875
Change-Id: I2678edccf68d754d191b9eb6cdfe09bba327e85a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-04 12:23:51 +00:00
Tor Arne Vestbø
b89608dcf8 Document which header to include for the various native interfaces
Fixes: QTBUG-98654
Pick-to: 6.2
Change-Id: Ic5ea3cc7d90ed336a5b6e827d1523bdd58fabc13
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-04 12:41:46 +01:00
Mårten Nordheim
cdc3de6c84 QStringBuilder: Add support for QByteArrayView
[ChangeLog][QtCore][QStringBuilder] Added support for QByteArrayView.

Change-Id: If2c23549d533dd31c320f3ee455fcd01ea5b460a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-04 08:21:22 +00:00
Mårten Nordheim
9909ec0bc6 QNAM: Reintroduce h2c with an attribute
[ChangeLog][QtNetwork][QNetworkRequest] Added
QNetworkRequest::Http2CleartextAllowedAttribute which controls whether
HTTP/2 cleartext (h2c) is allowed or not. The default is false. This
replaces the QT_NETWORK_H2C_ALLOWED environment variable.

Task-number: QTBUG-98642
Change-Id: I43ae1cc671788f6d2559cd316f6667b412c8e75e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-04 08:20:52 +00:00
Ievgenii Meshcheriakov
83f2f27bb6 QFile: Add open() overload that accepts permissions argument
The new overload allows creation of files with non-default permissions.
This is useful when files need to be created with more restrictive
permissions than the default ones, and removes the time window when
such files are available with less restrictive permissions.

[ChangeLog][QtCore][QFile] Added QDir::open() overload that
accepts permissions argument.

Fixes: QTBUG-79750
Change-Id: Iddfced3c324e03f2c53f421c9b31c76dee82df58
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-04 01:27:11 +01:00
Ievgenii Meshcheriakov
56e13acf4e QAbstractFileEngine: Add permission argument to open()
The new argument allows atomic creation of files with non-default
permissions.

Task-number: QTBUG-79750
Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-04 01:27:08 +01:00
Volker Hilsheimer
56bd1b76d2 Don't change resolve mask when setting brush doesn't change palette
After 556511f9f3, which moved the resolve
mask storage into the palette's d-pointer, modifying the resolve mask
requires a detach. As of now, we only detached when setting a different
brush, but always modified the resolve mask, which broke palettes that
shared the d-pointer (likely the global default palette).

However, detaching has negative side effects when styles set brushes on
temporary palette objects and then use that palette object's cache key
to build a cache of pixmaps. As each drawing would detach the palette
(even if the palette doesn't change, which is likely), the cache key
changes with each detach, and the cache would quickly increase in size.
This was addressed in changes d7bcdc3a44
and 1e75dcf251.

We can either detach and find other ways to address the issues from
QTBUG-65475, or we can not change the resolve mask when the brush doesn't
change and completely ignore the call.

Since QFont ignores the setting of any attribute to a value that is
identical to the current value, and since it's possible to force that
the resolve-bit is set by calling setBrush twice with different brushes,
ignoring the call seems like the better solution.

[ChangeLog][QtGui][QPalette] Setting a brush on a palette that is
identical to the current brush no longer sets the resolve mask bit for
that particular role, so items using the palette will continue to
inherit changes from parent items.

Fixes: QTBUG-98762
Task-number: QTBUG-65475
Pick-to: 6.2
Change-Id: Ife0f934b6a066858408ef75b7bb7ab61193ceb47
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-03 21:07:09 +01:00
Albert Astals Cid
98c2260c3b Add QFontComboBox::setDisplayFont
Allows changing the font used to display a font family

[ChangeLog][QtWidgets][QFontComboBox] Added the setDisplayFont() function, in order to be able to control the font used to render the font name and sample text (when previewing the fonts).

Change-Id: I94bfef43142c5346237e3069449bd19dbacb7420
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-12-03 20:35:33 +01:00
Albert Astals Cid
63c0a1bd23 Add QFontComboBox::setSampleText
Allows setting the sample text to be used

[ChangeLog][QtWidgets][QFontComboBox] Added the setSampleText() function, in order to be able to control the sample text displayed by the combobox (when previewing the fonts).

Change-Id: Iedcd3bb72bc6aec9a178f14f7fbbe324ba0223ef
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-12-03 20:35:33 +01:00
Kai Köhne
6598a26a13 androiddeployqt: Fix signing of paths with spaces
Only use shellQuote() if the path is actually passed to a native API.
For QFile API, use the unquoted path.

Fixes: QTBUG-97649
Pick-to: 5.15 6.2
Change-Id: I9d8131819010bbd2faa8a81eef367245d90a767f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-12-03 15:09:26 +00:00
Andrei Golubev
08b0a63a0f QFontDatabase: unify relevant documentation pieces
addApplicationFont and addApplicationFontFromData basically do the same
thing (with one reading the data from a file and another reading
it directly from QByteArray)

The documentation is not quite identical, so fix that by using \include
magic of qdoc

As a drive-by, remove outdated \note within addApplicationFont() description

Fixes: QTBUG-98752
Pick-to: 5.15 6.2
Change-Id: I29738e7411d241c26a4b2e1dd91d0af867fcc111
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-12-03 12:57:39 +00:00
Marc Mutz
020191d2ef QLayoutPolicy: fix annoying -Wdeprecated-enum-enum-conversion
Says GCC -std=c++20:

    src/gui/util/qlayoutpolicy_p.h:127:30: warning: bitwise operation between different enumeration types ‘QLayoutPolicy::Policy’ and ‘QLayoutPolicy::PolicyFlag’ is deprecated [-Wdeprecated-enum-enum-conversion]
      127 |         if (verticalPolicy() & ExpandFlag)
          |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

Fix by making Policy a QFlags<PolicyFlag>, which we can do because the
class is private. In QSizePolicy, this would break BC.

Since a QFlags cannot be opened for constants like an enum, we need to
define the ex-Policy-enumerators as static inline constexpr objects
instead.

Pick-to: 6.2
Change-Id: I29bc938f86508deed3f99ad9d1c1892547206c05
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-03 12:57:39 +00:00
Marc Mutz
2d2104da7c QSizePolicy: make qHash() a hidden friend
Less noisy compiler error messages.

[ChangeLog][Potentially Source-Incompatible Changes][QSizePolicy]
qHash() is now a hidden friend and can only be called by unqualified
(qHash(sp)), not by qualified lookup (as in, say, ::qHash(sp) or
QT_PREPEND_NAMESPACE(qHash)(sp)).

Task-number: QTBUG-98863
Change-Id: I37d26c661c2d8bb74350eb9378bd19fa426678d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-03 12:57:39 +00:00
Assam Boudjelthia
f1c2b6f5f9 Android: add methods to get the FileDescriptor for a Uri
This can be useful for some cases when the Android APIs have calls
that expects a FileDescriptor instead of a Uri or an int file
descriptor (like a case in Qt Multimedia with MediaRecorder).

Pick-to: 6.2
Task-number: QTBUG-96081
Task-number: QTBUG-96957
Change-Id: I0ab8d37a43b7cb94f6ebb5d48014e5a7903aadc7
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2021-12-03 14:19:21 +02:00
Assam Boudjelthia
be55118bd3 Android: simplifications to exception messages for content file handling
The method getUriWithValidPermission() now returns null only if the
Uri couldn't be parsed, otherwise, returns the parsed Uri and fail later
when used if it doesn't have permissions for example.

Also, Don't use use hardcoded strings for method names, and print the
exception message instead of the whole stack.

Pick-to: 6.2
Task-number: QTBUG-96081
Task-number: QTBUG-96957
Change-Id: If7ba88265c9683e6660cb483cfee6c22016f2976
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2021-12-03 12:19:21 +00:00
Volker Hilsheimer
c034ad03ac QPA: Set focus reason when window activation changes focus
QApplication hides the fact that the reason is never set by several
QPA plugins, but Quick items don't receive the correct reason on
Windows, Android, the offscreen plugin, and other platforms.

Add relevant scenario to the QFocusEvent test case, and fix the
plugins to always set the focus reason when handling window activation
changes. Exclude the minimal plugin from the test, it seems largely
unmaintained anyway.

Task-number: QTBUG-75862
Change-Id: I5404a225b387fc9a3851b6968d0777c687127ed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-03 08:15:29 +01:00
ChunLin Wang
8e465c75fe Repair parameter type
Fix the parameter types corresponding to the sample code and subclasses

Fixes: QTBUG-98578
Pick-to: 6.2
Change-Id: I06e342ae1210ed53c5deec3e2711457cf2ac5b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-03 11:52:21 +08:00
Marc Mutz
d06a686cad Remove unused Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6
There are no users left in the tree.

Change-Id: I336f4e15c0ec1f5933c1fcfa661bad85bd38ed35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-03 03:42:01 +01:00
Inho Lee
ac2f4bd9db Remove XCB_EVENT_MASK_RESIZE_REDIRECT for Qt:WindowTransparentForInput
In xcb plugin, XCB_EVENT_MASK_RESIZE_REDIRECT is set but it is not
necessary. Mouse events are disabled by setTransparentForMouseEvents
and there is no reason to have this event mask.

Fixes: QTBUG-86372
Pick-to: 6.2 5.15
Change-Id: I2124b0684a0847d6705344bb5850bac178a292b6
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-03 00:22:49 +01:00
Shawn Rutledge
dbb9579566 Text editing: smart block and char format after newline
When you are editing in a QTextEdit and press enter to start a new line,
calling insertBlock() with no arguments tries to preserve the current
charFormat and blockFormat. That is often OK:
- if you hit enter at the end of a list item, you probably want another
  item in the same list
- if you are writing code inside a code block, you're probably just
  writing the next statement on the next line: stay in the same block
- margins, indents, tab positions should stay the same (but hopefully
  your editor has UI to manually reset the block format to default
  in case you are not continuing in the same style)
But there are some exceptions we can apply to be helpful:
- nobody ever wants to follow an <hr/> with another one (but
  hopefully the application has an action to insert one manually)
- a heading is more likely to be followed by a paragraph, or perhaps
  a smaller heading; another heading at the same level is unlikely.
  We need to reset the char format, not only the block format, because
  the large font and heavy font weight are stored there.
- when adding to a todo list, hitting enter at the end of the last task,
  let's assume the next task is not yet done, so it will be unchecked
  by default (else, why are you writing a todo list at all)
To achieve that, we need to customize the formats and call the
insertBlock() overload that takes them. The no-argument insertBlock()
will continue to preserve the formats, because it's an old API that is
used for much more than interactive editing.

Additionally, word processors tend to let you end a list (for example)
by hitting enter twice. In that case, you stay in the same paragraph
that you created the first time you hit enter, but now the formats are
reset to default, so that you can go on typing an ordinary paragraph,
rather than having to mouse up to the toolbar to select the paragraph
style in a combobox, or something like that. So we now do that: reset
both block and char formats after you hit enter on a blank line; but if
you then hit enter again, after the block format has been reset, then
you will get the actual blank line (empty block) inserted.

[ChangeLog][QtWidgets][QTextEdit] Hitting enter at the end of a line
with a special block format (horizontal rule, heading, checklist item)
now makes some "smart" adjustments to avoid retaining properties that
are unlikely to be continued on the next line. Hitting enter twice now
resets block and char formats to default.

Fixes: QTBUG-48815
Task-number: QTBUG-80473
Fixes: QTBUG-97459
Change-Id: I3dfdd5b4c0d9ffb4673acc861cb7b5c22291df25
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-12-02 22:22:59 +01:00
Mårten Nordheim
a6744bc9f9 OpenSSL: handle renegotiate errors by comparing certs
If the certificate didn't change then our trust in it didn't either.
Sadly, cannot have an autotest because we don't have any way
to facilitate a renegotiation at the moment and with TLS 1.3
not having them at all it's unlikely we ever will.

Pick-to: 6.2 5.15
Task-number: QTBUG-92231
Change-Id: Ibaa9b2f627daca05021c574e69526710aacdadae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-02 19:29:58 +00:00
Michał Cieślak
02955a10fa Use Android's View.generateViewId() for generating ids for views/surfaces
Qt Android was using consecutive numbers starting from 1 as ids for View.setId(int). The ids are used internally with an assumption that they are unique. It was potentially leading to collisions and unexpected behavior when adding custom views with id generated by View.generateViewId().

Task-number: QTBUG-98649
Pick-to: 5.15 6.2
Change-Id: I5bf2fe1d196c7adafeec544d8d945ebd82ba5cb6
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-12-02 19:09:40 +01:00
Edward Welbourne
24e4370414 Close leak of QOCIDateTime object
Noticed while reviewing usage of this type. The code has a whole
TempStorage class to take care of keeping allocated memory live until
we're done with it, explicitly including date-time objects as a
special case, but neglected to use it in one place.

Pick-to: 6.2 5.15
Change-Id: Ic94c56d67dda6dc3ee36a025a2e0149f6b2a1837
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-12-02 17:38:33 +01:00
Edward Welbourne
4ef8e9427c Reduce scope of a hack using volatile in favor of viewAt()
We can now get qt_configure_strs to tell us the size of the string, as
well as its start, bypassing the strlen()-calling branch of
fromLocal8Bit() that caused the need for a hack using a volatile
variable. However, QT_CONFIGURE_SETTINGS_PATH still needs the volatile
hack.

Change-Id: I0181abf512123e6355acdd506d6845c3fb75c0e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-02 17:38:33 +01:00
Edward Welbourne
4d4aa6e21c Restrict clang warning disabler to affected versions
Apparently -Wdeprecated-copy got added between clang 9 and 11.
Versions without it warn about the attempt to suppress this option's
warnings.

This follows-up on commit 8662fbdd7e

Change-Id: I7fe9258cfe8a79d24c1f8b331a56468415b25cdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-02 17:38:33 +01:00
Jonas Kvinge
a817490335 qnx: Fix typos in source code comments
Change-Id: I6420e14e3de9c7efc7d5073f44ccfd7ee9b88ea6
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-12-02 18:38:33 +02:00
Jonas Kvinge
5d08806adf android: Fix typo in source code comment
Change-Id: Ieeab35d51588cf247c3d9626d0291e2983720873
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-12-02 18:38:33 +02:00
Marc Mutz
ecc307ff41 QString et al: fix lastIndexOf() API asymmetry
Commit 6cee204d56 introduced overloads
of lastIndexOf() which drop the 'from' argument, inadvertently fixing
QTBUG-80694, but failed to provide the new overloads for all existing
lastIndexOf() overloads, making the fix for QTBUG-80694 incomplete.

This patch completes the fix, by adding the missing overloads (for
char-likes) and also adds the missing (non-regex) tests to
tst_qstringapisymmetry.

Also amends 1c164ec7f2.

Fixes: QTBUG-80694
Change-Id: Ib4b3d597d658ce2edf01a2bce0d711ecea593d6e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-02 16:05:33 +00:00
Elvis Lee
093a62a69a Support to get timing from pagefilp
Handle the timing from drmEvent when page flip finished.
The information can be used to optimize rendering timing.

Change-Id: I14612ca48a8fea5208aa74949d7543787e860c5f
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-12-03 01:05:33 +09:00
Alexey Edelev
63b8840380 Fix dependency chain that collects the metatype json files
cmake_automoc_parser has the logic preventing the run of moc with the
--collect-json parameter if metatype json files are not changed.
This logic only verify if the file list is changed but not their
content. This change adds a timestamp file that contains the last
metatype json file timestamp that was modified during the last
cmake_automoc_parser run. The logic still prevents of running
'moc --collect-json' when the list of metatype json files is not
changed, but also checks if their content is no changed.

Another approach it to generate the depfile that can be utilized by
CMake in add_custom_command as DEPFILE argument. But this concept only
works from the second build attempt because of an issue related to
dyndep.

Pick-to: 6.2
Fixes: QTBUG-98532
Change-Id: I713f8bfa9ae769cefe0beac0b7fa19750b00a765
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-02 16:34:23 +01:00
Alexey Edelev
7a6dd6084c Replace BUILD_OPTIONS_LIST variable by the getter function
Encapsulate configuration options in a function and use it instead of
a globally defined variable.

Pick-to: 6.2
Change-Id: I5c69c207788fe069fdd046b68a6bc58aa16e71b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-02 16:34:22 +01:00
Volker Hilsheimer
d22bafe355 QTableView: correctly toggle column selection when scrolled
We need to check whether the horizontal header's selection includes the
index for the row at the top, rather than for row 0, as the index we
check is based on the scrolled position of the header, so would never be
included in the top row when the view is scrolled. This is correctly
done in selectRow already.

Add a test case that simulates selection of rows and columns by clicking
on the header.

Fixes: QTBUG-98444
Pick-to: 6.2
Change-Id: I2fa1b32bf75dc96225b40145b713bf7e2ffc29dd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-02 14:16:49 +00:00
Volker Hilsheimer
97cfd49401 Don't let text table cells shrink below their minimum width
We calculate the minimum width, but then use it only to make sure that
the maximum width is at least as large as it. Without setting the layout
struct's minimumWidth as well, table cells can be smaller.

Add a test case.

Fixes: QTBUG-86671
Fixes: QTBUG-97463
Pick-to: 6.2 5.15
Change-Id: Idf4ad015938abb8d3e599e9a58e002f29c0067be
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-12-02 15:16:49 +01:00
Alexey Edelev
6b025f9b27 Use depfile to control ABI-specific builds of executable targets
qt_internal_${target}_copy_apk_dependencies should use CMake DEPFILE
approach when it's possible. Since we don't have any specific
artifact that androiddeployqt can produce when collecting dependencies
this change adds simple timestamp file that is touched each time when
androiddeployqt is running. The timestamp is used then as a file-level
dependency for the qt_internal_${target}_copy_apk_dependencies target.

Task-number: QTBUG-88841
Change-Id: I985535c7b6e471cb4cfbf90128628087dadc72d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-02 14:28:09 +01:00
Alexey Edelev
87db26bdfe Change the external projects approach for multi-abi builds
Instead of generating external projects that build the project tree
for each target, this creates a single project for each ABI that have
the common for all targets configure steps. Each executable target
then adds additional build step to each ABI-specific external project,
that builds and copies dependencies to the "main" project build tree.

To resolve dependencies from the build tree, when building multi-abi
apk instead of scanning the build directories of external projects for
dependencies, it makes sense to run androiddeployqt for each
ABI-specific external project to copy all necessary libraries. This
is done by adding --copy-dependencies-only flag to androiddeployqt
that only copies the apk dependencies, but avoids creating apk and all
the essential steps. The ABI-specific external project now handles the
deploying of the build artifacts to the end-point apk deployment
directory and the "main" project assembles the apk using collected
artifacts. The ABI-specific external project uses the
qt_internal_${target}_copy_apk_dependencies target to run androiddeployqt
with the introduced --copy-dependencies-only flag.

TODO: Build steps that build and copy the ABI-specific apk
dependencies are non-skipable and will run each time top-level build
is triggered. This behavior should be fixed by adding dependencies to
the generated by androiddeployqt DEPFILES for each ABI in the
top-level build.

Task-number: QTBUG-88841
Tash-number: QTBUG-94714
Change-Id: Id442a9fbd589f58b70f4204c5215645056b379a2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-02 14:28:09 +01:00
Mårten Nordheim
0062f5a208 Freetype: adjust underlinePosition to match our expectations
We expect underlinePosition() to be the topleft corner of where we
start drawing the underline but freetype reports the _center_ of the
underline:

"underline_position: [...]. It is the center of the underlining stem."
- https://freetype.org/freetype2/docs/reference/ft2-base_interface.html

Pick-to: 6.2 5.15
Fixes: QTBUG-62602
Change-Id: I96808816f50f3f37b18f579adf285502c88e6ea5
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-12-02 12:53:34 +01:00
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
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
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