Commit Graph

53630 Commits

Author SHA1 Message Date
Karsten Heimrich
71652ad4bf Make QDir::mkpath() return true when given an existing drive name
Commit ed48391c59 removed the check for
ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...)
function in case an existing windows drive name was passed as argument.
This restores the behavior of the function which broke after 5.15.

Pick-to: 6.2
Fixes: QTBUG-85997
Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2021-10-20 15:04:51 +00:00
Tatiana Borisova
57ec47921e Compile Private API autotests for INTEGRITY
- GHS's __PRETTY_FUNCTION__ (used by QT as Q_FUNC_INFO) doesn't have spaces
  round the = operator when indicating the type of the template parameter.

 The compilation error:
 qt5/qtbase/src/corelib/kernel/qmetatype.h", line 2104: note #3316-D:
 cannot access position 53 in array of 49 elements
 constexpr const char *begin = func + prefix;
                                             ^
   detected during:
     instantiation of
     "auto QtPrivate::typenameHelper<T>() [with T=void]" at
       line 2186


Task-number: QTBUG-97087
Pick-to: 6.2
Change-Id: I33e61f5d54a61944a5aecf07d149a8dee0ef1e5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 15:04:51 +00:00
Alexey Edelev
3f4082c0e8 Add missing LIBRARY DESTINATION for examples
Pick-to: 6.2
Fixes: QTBUG-97629
Change-Id: I5b32824693206926de9b4ee6637749a1814fdde7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-20 17:04:51 +02:00
Friedemann Kleint
5074679cfc uic: Fix missing Python import when setting tab orders
Add QWidget as default import so that QWidget.setTabOrder() is found.

Pick-to: 6.2
Change-Id: I7593008d1395e3fddacf7124d271a0eaf4c345d9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-10-20 11:34:03 +02:00
Alexandru Croitor
87215c70c0 CMake: Fix rpath-link dependencies when cross-compiling
Private Qt module dependencies of a Qt module are recorded
in the IMPORTED_LINK_DEPENDENT_LIBRARIES property of a Qt module.
This property is used to compute the runtime dependency dir path
to be passed to the linker via the -rpath-link option.

If the referenced target does not exist in the scope where it's
used, no -rpath-link will be generated (or at least that specific
dir path won't be passed).
The linking operation will either fail saying the library is not found,
or a different version of the library might be silently picked up in
the sysroot or other implicit lib dir.

Make sure that QtFooModuleDependencies.cmake calls find_package() for
all Qt module private dependencies (or other Qt provided 3rd party
libs in the Qt6:: namespace) so that the targets are in scope and
IMPORTED_LINK_DEPENDENT_LIBRARIES does its job.

qmake also records the INTERFACE_LINK_LIBRARIES of a private Qt module
as the runtime dependencies of the module.
It's not clear why it does that. A private Qt module is an
INTERFACE_LIBRARY so it shouldn't add any new runtime dependencies.

Nevertheless, the find_package part of that has been recently addressed
in 2b6500cd15 for a different reason.

This change is basically the CMake equivalent of
326b91ea78

Pick-to: 6.2
Fixes: QTBUG-86533
Change-Id: Iaf514a14acaded4e8752149cca0c159a271be188
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-20 11:24:03 +02:00
Thiago Macieira
9153458731 RHI: use the flags we've just calculated
Caught by clang 13 detecting we set a variable but never used it.

Change-Id: I8c6a0ff3ec184205a544fffd16af3d52b6f172a2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-19 13:13:14 -07:00
Alexander Volkov
056e807bb1 Fix correspondence between QFileDialog::Option and QFileDialogOption::FileDialogOptions
It was broken by fe4a5a27e0.

Pick-to: 6.2
Change-Id: I77da7ec9cdedc80a72b7f11980950a8bebfdaf3b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-19 20:13:14 +00:00
Thiago Macieira
edfb0922ea QtGui & its plugins: remove set-but-unused variables
Found by clang 13:

qfontsubset.cpp:1211:10: warning: variable 'sumAdvances' set but not used [-Wunused-but-set-variable]

Change-Id: Iea05060bc2c046928536fffd16adf500fb9bc8e5
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-19 13:13:14 -07:00
Thiago Macieira
9ecf72704d MySQL: only set the charset if the connection has succeeded
No point otherwise. But do it before trying to select the database, in
case the database name has non-US-ASCII characters.

Task-number: QTBUG-97054
Pick-to: 6.2 6.2.1
Change-Id: Iea05060bc2c046928536fffd16adf036367b07bb
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-10-19 07:55:55 -07:00
Thiago Macieira
11f5c07c1b MySQL: fix the check for the return value of mysql_set_character_set()
It returns zero on success and non-zero on failure.

Fixes: QTBUG-97054
Pick-to: 6.2 6.2.1
Change-Id: Iea05060bc2c046928536fffd16adf0177aadb082
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-10-19 07:55:53 -07:00
Christian Strømme
aad24f6033 Rhi: Document expectation for setGraphicsPipeline's pipeline argument
The backed expect the pipeline to be valid, so document it and
assert if the set pipeline is a null pointer.

Pick-to: 6.2
Change-Id: I72b3d0d11b8dc98240d17e13adf2b6ccbd71891d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-19 09:01:19 +00:00
Ulf Hermann
2e81e445f2 Disable copy and move for QPropertyObserverNodeProtector
It's not intended to be copied or moved and static analysis complains.

Change-Id: I2ac2eccadb66ea572cf297f16af693b15553a1b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-19 10:53:52 +02:00
Antti Määttä
378ff29b29 Don't render widget to backing store if its parent has graphics effect
If widget parent has graphics effect, it can't render directly to the
backing store, because the backing store needs to be updated from the
parents effect drawing instead of the widget drawing.

Pick-to: 6.2 5.15
Fixes: QTBUG-96240
Change-Id: Ib9b55547f9e5538f32837ec9df45d29fa68d7c1b
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-19 07:28:47 +03:00
Thiago Macieira
8662fbdd7e RHI: suppress annoying warning about deprecated copy constructors
With clang 13:

vk_mem_alloc.h:4360:22: warning: definition of implicit copy constructor for 'VmaStlAllocator<VmaDefragmentationAlgorithm::AllocationInfo>' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
vk_mem_alloc.h:4391:9: note: in implicit copy constructor for 'VmaStlAllocator<VmaDefragmentationAlgorithm::AllocationInfo>' first required here

Repeats ad nauseam

Change-Id: Iea05060bc2c046928536fffd16adf5181ede7abe
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-18 14:58:58 -07:00
Thiago Macieira
b64d720b28 QPluginLoader: use constexpr variables for detecting debug plugins
For MSVC it's clear that the plugin and Qt must match, since they would
be linking to different runtime assemblies otherwise. For all other
systems, including MinGW on Windows, there's no such thing.

But we insist on MinGW debug-and-release builds matching.

Change-Id: I3eb1bd30e0124f89a052fffd16a6aa52c7f8b9c0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 14:58:58 -07:00
Ulf Hermann
57d08f6c09 Inline a few methods of QPropertyObserverPointer
This is necessary to optimize QObjectCompatProperty::notify in a second
step.

Change-Id: I89aaf51d39e04f17285f7db27f9b40d145fd846d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-18 20:53:25 +02:00
Antti Määttä
9f763a5f3f Allow negative delta for designer animation driver
The designer animation driver needs the ability to drive the animation
both forwards and backwards.

Pick-to: 6.2 6.2.1
Task-number: QDS-4910
Change-Id: Ie2b1855d062bb254b28b216328cb618d90ee8454
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 20:40:26 +03:00
Tor Arne Vestbø
acb86da793 Prevent recursive calls to QWindow::close
QWidget will call close() in its destructor, which we might end up
in if a user deletes the widget in the closeEvent.

Pick-to: 6.2
Change-Id: I39684aec0ca130033dad60f2bbf823364a5edcec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 19:06:48 +02:00
Ievgenii Meshcheriakov
826fc8c9bd Update UCD to Revision 28
This corresponds to Unicode version 14.0.0.

Added the following scripts:

    * CyproMinoan
    * OldUyghur
    * Tangsa
    * Toto
    * Vithkuqi

Full support of these scripts requires harfbuzz version 3.0.0,
this version adds support for Unicode 14.0:

    https://github.com/harfbuzz/harfbuzz/releases/tag/3.0.0

With this release 10 test cases in tst_qurluts46 were fixed, one
additional test case is failing in tst_qtextboundaryfinder and
is commented out. In total 62 line break test cases and 44 word
break test cases are failing.

A comment in src/corelib/text/qt_attribution.json was updated to
include the URL of the page containing UCD version number.

Fixes: QTBUG-94359
Change-Id: Iefc9ff13f3df279f91cbdb1246d56f75b20ecb35
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-18 16:45:10 +00:00
Topi Reinio
439f6c9576 coin: Add instructions to generate docs during testing
A single configuration provides qdoc and qtattributionsscanner via
provisioning. The environment variables instruct QDoc to run in
testing mode; it ignores linking warnings (since we don't have .index
files for external documentation modules) and terminates with non-zero
exit code if documentation warnings exceed the limit set in the
documentation config.

The provisioned binaries are portable, packaged together with their
dependencies. As they are installed under /opt, the instructions
create symlinks to the binaries in the install directory before
building the 'generate_docs' target.

Pick-to: 6.2
Task-number: QTBUG-78069
Fixes: QTBUG-95554
Change-Id: I4a4765250247e2fc6eddd153c36cf8126ddd10ae
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-18 16:23:13 +00:00
Ulf Hermann
bcf3f63d52 QProperty: Eliminate further unnecessary TLS operations
If we don't have a binding, we don't need to remove it. We can figure
this out without TLS lookup.

Pick-to: 6.2
Change-Id: I0cb20f2a68a119df7742631e307002e3813eac03
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-18 18:23:13 +02:00
Ulf Hermann
80c17af940 QProperty: Don't needlessly calculate inBindingWrapper()
If there is no binding data, we don't need it. inBindingWrapper()
involves a TLS lookup.

Pick-to: 6.2
Change-Id: I829f314d708b80821e907124eef4aec758bbbc6a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-18 18:23:13 +02:00
Tor Arne Vestbø
44b7a1a37b Don't hide dialogs before closing them
When a dialog was accepted or rejected via done(), we used to only hide
it, but as of 0246bfd40a we now close it.

Closing a widget results in hiding it as part of handleClose, so we
do not need to explicitly hide it before calling close(). In fact
doing so prevents the lastWindowClosed logic from checking whether
the window was visible before handling the close event, which is
documented to be a requirement for a window triggering lastWindowClosed.

We still need to hide the widget in case we don't end up closing it
ourselves, to ensure QDialog::closeEvent accepts the close. The reason
for the code in closeEvent seems a bit dubious, but that's left for
future adventures.

Change-Id: Ic32b965d495c08996c3a199bbee798df0206216c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 15:29:09 +02:00
Tor Arne Vestbø
df359bcb70 Decouple quitOnLastWindowClosed from quitLockEnabled
In a512e210ac5b032c5fc2edf1ddf72e5a414485fda512e21 quitOnLastWindowClosed
was changed to be implemented in terms of quitLockEnabled, but without
any documentation to that end.

Although the two features are similar (automatic quit under certain
conditions), and interact, it doesn't make sense to overlap them until
we actually expose them as a single property (automaticQuit e.g.)

The logic for determining whether we can can quit automatically has
been refactored to take both properties into account, on both a Core
and Gui level. The call sites still need to check the individual
properties to determine whether to activate automatic quit for
that particular code path.

Change-Id: I38c3e8cb30db373ea73dd45f150e5048c0db2f4d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 15:29:09 +02:00
Tor Arne Vestbø
55f8f916ce Fix indentation in inputMethodQuery implementations
Change-Id: I406194e084f62f16d432eae63845bcc3da148ac0
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 15:29:09 +02:00
Sona Kurazyan
8a8bf1b84e Fix docs for comparison/debug/data stream operators of Qt containers
Because of the constraints on comparison, debug and data stream
operators, the return types for them look weird in docs. Conditionally
use the actual return types, in case if Q_CLANG_QDOC is defined.

Also add the docs of debug stream operators for types for which they
were misssing.

Task-number: QTBUG-97247
Pick-to: 6.2
Change-Id: I57f2c52bd3af805c7eeebb602c47de1e95ee09bd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 13:42:07 +02:00
Jonas Kvinge
2f2fdc418d sqldrivers: Fix typo in error message
Pick-to: 5.15 6.2
Change-Id: I6354275d04ee9474d4baeaaf0b14a52aca3dd70c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 13:42:06 +02:00
David Skoland
723a2c34a5 Make sure Qt::Popup is treated like a dialog
According to the documentation, Qt::Popup should have a proper frame
with a title bar. To honor this, two functions had to be
slightly altered.

Change-Id: I4bbc18e6b7fbec5702fad6e22ef2226c09dea15a
Fixes: QTBUG-94768
Pick-to: 5.15 6.2
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-10-18 13:42:06 +02:00
Volker Hilsheimer
5335cc4a5a Fix cursor positioning on bidi boundaries
When the cursor is positioned between to script items that have different
writing directions, prioritise the script item that has the same direction
as the paragraph (i.e. the QTextEngine) when deciding where and how to
display the cursor. If visual cursor movement is enabled, the behavior is
unchanged.

As a drive-by, clean up coding style and avoid shadowing of function-
local variables.

Task-number: QTBUG-88529
Pick-to: 6.2
Change-Id: I15227b10b1469d9caf1235b00e4d6f9f64a8b510
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-18 13:05:42 +02:00
Volker Hilsheimer
f54044d4a9 Fix cursor placement at left and right ends of bidi text
In a text line that has a change of direction at either end of the text,
the cursor needs to be positioned where the next character is inserted,
or where backspace deletes the previous character. In bidi text, this is
ambiguous as illustrated by this example:

abcشزذ

Depending on whether this string was typed in a left-to-right document
or in a right-to-left document, it could be first latin, then arabic; or
it could be first arabic, then latin.

If a general left-to-right context, cursor position 0 should be in front
of the 'a', and cursor position 6 should be at the end of the arabic
text, in the visual middle of the line. Cursor position 3 can be either
after the 'c' if the next character typed would be latin, or at the
visual end of the line if the next character will be arabic.

Qt calculated the cursor position past the right end of the text as 3
(which is not wrong, but 3 has two visual positions), and placed the
cursor at the visual end of the line (favoring the right-to-left
alternative). Backspace would then delete the 'c', writing a new
latin character would insert a 'd' next to the 'c', writing a new arabic
character would insert it also in the middle - none of these operations
happen at the visual end of the line, where the cursor was blinking.

To fix this, we take into account the general layout of the text, which
is typically based on the document, or the user's locale setting and UI
translation, and calculate the cursor position accordingly: if we are
past the visual end of the document on either side, then the cursor
position is either 0 or the last character of the text, depending on the
direction of the QTextEngine used. This way, the cursor ends up in the
middle of the document when we click beyond the end of the line, which
is where characters are removed and inserted. Typing a 'd' at this point
will make the cursor jump to the end, where the d is added.

There are still corner cases: clicking on the right-most arabic character
calculates the cursor position as 3, which is then ambiguous, as it can
be either at the visual end of the string, or next to the 'c'. َQt makes
the inconsistent choice to place the cursor at the visual end, showing
the left-to-right indicator, but pressing a 'd' adds the 'd' after the
'c' in the middle of the text.

Fixes: QTBUG-88529
Pick-to: 6.2
Change-Id: Idccd4c4deead2bce0e858189f9aef414857eb8af
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 13:05:42 +02:00
Thiago Macieira
e652fa4d3e Q_GLOBAL_STATIC: suppress warning about expressions in noexcept()
We use a simple statement to try and mark the holder as noexcept and that
works for most cases (but not all). It triggers a warning when the
expression is complex, though, like this in qlocale.cpp:

Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
                          (new QLocalePrivate(defaultData(), defaultIndex())))

Pick-to: 6.2
Change-Id: Iea05060bc2c046928536fffd16adf4be6126d039
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-18 08:53:27 +00:00
Thiago Macieira
8c2969ea86 QPlugin: Move the plugin metadata to a note in ELF platforms
A few systems, like OpenWRT, may strip the section table off the
resulting binaries (see [1]), making it impossible for us to pinpoint
the exact location of the Qt plugin metadata. This commit moves the meta
data to a location that is identifiable even in fully stripped binaries:
an ELF note.

By naming our section ".note.qt.metadata", we instruct the linker to
place it along the other notes and to mark it in the program header
section. Another advantage is that the notes are usually in the very
beginning of the file, as they are used by the dynamic linker itself, so
we'll need to read much less of the full contents.

The unit test is modified not to attempt to strip the plugin of
debugging data. In fact, we add something to the end that would,
otherwise, be matched as (invalid) metadata.

The following was produced with GCC 11 and GNU binutils ld 2.36.1.

Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES Flags Lk Inf Al
[ 0]                      NULL         0000000000000000 00000000 00000000  0        0   0  0
[ 1] .note.gnu.property   NOTE         00000000000002a8 000002a8 00000030  0 A      0   0  8
[ 2] .note.gnu.build-id   NOTE         00000000000002d8 000002d8 00000024  0 A      0   0  4
[ 3] .note.qt.metadata    NOTE         00000000000002fc 000002fc 000001ac  0 A      0   0  4

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
...
  NOTE           0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030 0x000030 R   0x8
  NOTE           0x0002d8 0x00000000000002d8 0x00000000000002d8 0x0001d0 0x0001d0 R   0x4

The Qt metadata note is 4-byte aligned and can thus be found in the
second note section, which spans from 0x02d8 to 0x02d8+0xac=0x0384.

GNU readelf -n can even show it:

Displaying notes found in: .note.qt.metadata
  Owner                Data size        Description
  qt-project!          0x0000018f       Unknown note type: (0x74510001)
   description data: 01 06 03 81 bf ...... ff

I chose 0x7451 as the prefix for our notes, even though they're already
namespaced by the owner in the first place, because eu-readelf
mistakenly tries to interpret note 1 as a GNU ABI tag regardless of
owner. The owner name was chosen to be 12 bytes long, so the ELF note
header is 24 bytes in total. There's no space wasted because the payload
needs to be aligned to 32-bit anyway and I didn't want to use only 4
characters (header total size 16 bytes) so we'd skip the "GNU" note on
size, without string comparison. And I couldn't think of a 4-character
representative string ("QtP" ?).

[1] https://github.com/openwrt/video/issues/1

Fixes: QTBUG-96327
Change-Id: I2de1b4dfacd443148279fffd16a3987729346567
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-18 01:53:27 -07:00
Thiago Macieira
d09306064f QUtf32: remove set-but-not-used variable
Found by clang 13:

qstringconverter.cpp:1039:15: warning: variable 'length' set but not used [-Wunused-but-set-variable]

Pick-to: 6.2
Change-Id: Iea05060bc2c046928536fffd16adf46d4934c37c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-18 01:53:27 -07:00
David Skoland
2c648fea57 Add comment about the meaning of magic number in QWasmEventTranslator
Without this comment, the button == 0 code is very cryptic.
This comment helps in deciphering what exactly is being checked.

Change-Id: Ied96118362d097d7036bafcc491b8574e1225de1
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-10-18 08:07:20 +02:00
Eirik Aavitsland
73119e27b3 Handle DPR in QPainter's drawing methods taking a brush parameter
The emulation paint engine is required not only for non-LogicalMode
gradient brushes, but also for texture (pixmap/image) brushes with
DPR != 1. fillRect(), strokePath() etc. would check for the former
case, but not the latter.

Fix by factoring out a common checking function.

Pick-to: 6.2 5.15
Fixes: QTBUG-89101
Change-Id: I3cddf8a86a321de97b12c85a187069e77d2acea6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-18 07:52:35 +02:00
Thiago Macieira
fc3ac31891 QFontDatabase: suppress warning about its constructor being deprecated
qmetatype.h:2263:76: warning: 'QFontDatabase' is deprecated: Call the static functions instead [-Wdeprecated-declarations]
...
moc_qfontdatabase.cpp:159:1: note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_QFontDatabase_t, QtPrivate::TypeAndForceComplete<QFontDatabase, std::integral_constant<bool, true>>>' requested here
qfontdatabase.h:113:7: note: 'QFontDatabase' has been explicitly marked deprecated here

Change-Id: Iea05060bc2c046928536fffd16adf537be122db2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 11:59:10 -07:00
Thiago Macieira
d91b2a4479 QtWidgets: remove set-but-unused variables
Found by clang 13:

qlayoutengine.cpp:80:9: warning: variable 'cMax' set but not used [-Wunused-but-set-variable]

Change-Id: Iea05060bc2c046928536fffd16adf54d1527e657
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 08:49:27 -07:00
Shawn Rutledge
362e56b520 Markdown importer: keep entities in HTML blocks with the HTML
If an entity occurs directly in markdown, we parse and insert it
directly; but if it occurs in an HTML block, it has to be added to the
HTML accumulator string for deferred parsing when the HTML block ends.

Pick-to: 6.2
Fixes: QTBUG-91222
Fixes: QTBUG-94245
Change-Id: I0cf586d68d6751892ca035a98f77cd67950d3bc4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 16:10:49 +02:00
Tor Arne Vestbø
848e3855f9 macOS: Don't require marked text before passing mouse down to input context
There are situations where the input context might want the event,
even if there's no marked text, for example when long-pressing A
with a US keyboard layout and getting the accent popup. In that
case we want a press somewhere else in the input item to move the
cursor, and commit the current preedit.

This is the same approach as NSTextView has, always calling
handleEvent, and in line with the recommendation from Apple:

 https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html

Pick-to: 6.2
Change-Id: Iff0861a4e604ab594d1ad4ccbb9367d8e0ffe4ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:29 +02:00
Tor Arne Vestbø
3007050db7 macOS: Pass on mouse press if input context didn't handle it
We follow the approach of [NSTextView mouseDown:] by bailing out if the
input context handled the event, and otherwise passing it along to the
input item.

This allows moving the cursor with a single click in the input item,
which will also commit the current preedit string as is, depending on
the input context.

For some reason 2-Set Korean input results in plain insertText calls
for each step of the composition with an NSTextView, while we get
marked text. The result is that when composing with 2-Set Korean,
a native NSTextView will only require a single click to move the
cursor, while for us it requires two, since the input context says
it handled the event.

We opt to follow the behavior of NSTextView to bail out if the
input context handled the event, instead of trying to emulate
the observed behavior for 2-Set Korean by always passing the
mouse event on, as the former seems like a safer approach.

This is also in line with the recommendations from Apple:

 https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html

Pick-to: 6.2
Change-Id: I372ac62ee3b8b20531cd7cfa2d412a5efea3eb68
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:29 +02:00
Tor Arne Vestbø
0488fde042 Add implementation of QCocoaInputContext::commit()
Without this we end up treating input method commits from the
input items as cancellations, as the base class implementation
doesn't do anything.

Pick-to: 6.2
Change-Id: Ieeed71404ee32ab51287b2f4f2d70ffcf9d8e7ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:29 +02:00
Tor Arne Vestbø
c67f46877c macOS: Only send mouse press to input context if clicking input item
Our QNSView can represent many controls, not just the current input item,
so we need to ensure the click happens inside the input item before we
ask the input context to handle the event.

This allows clicking controls such as buttons and check boxes while
composing complex text, without cancelling or otherwise affecting
the composition.

Fixes: QTBUG-57347
Pick-to: 6.2
Change-Id: I8449c8d74fd21b1ee1d5bd75f960751b64d7e078
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:29 +02:00
Tor Arne Vestbø
1dfc74970c Deduplicate lastWindowClosed handling
Whenever a window was closed, we had logic to check if it was the last
window, and if so emitted lastWindowClosed and then tried to quit the
application. But the automatic quit process also checked if there were
any remaining windows, as this process could be triggered as a result
of a QEventLoopLocker going out of scope. The two paths now share the
same logic for determining if there are any remaining windows.

The docs have been updated to reflect the original intent of the logic,
dealing only with primary windows (top levels without a transient parent).
This was how both the original code paths implemented their logic.

For historical reasons the Qt::WA_QuitOnClose attribute is closely
tied to the lastWindowClosed signal, and isn't merely limited to
controlling whether we try an automatic quit when the last window
closes. For now this behavior has been kept, but the docs have been
updated to clarify how the attribute is handled in practice.

Change-Id: If3d06b065236aad2e59e9091cac3146bc4cf79f6
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:28 +02:00
Tor Arne Vestbø
30404b49d8 Remove unused parentWidget variable in QWidgetPrivate::handleClose
It was a leftover from when the quitOnClose logic was duplicated in the
handleClose function.

Change-Id: I38903b7e30ef1cf1d0dce87f61097a83259aea8e
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-16 14:33:28 +02:00
Joerg Bornemann
879f86098e Remove zlib from bootstrap library
None of the bootstrapped tools use zlib anymore.

Change-Id: I2cd7cb855ed671916a21c23449d9b6c4506f8546
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-16 14:33:28 +02:00
Giuseppe D'Angelo
896f71d500 QList: deprecate iterator<->pointer implicit conversions (3/3)
Follow-up of the previous commit: in case the implicit conversions
between iterator and pointers are disabled, then reintroduce
the non-template arithmetic operators for the iterator classes.

Change-Id: I8cee60fe77ee3a47e189b4b53a08e39408f9db18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-16 13:48:27 +02:00
Giuseppe D'Angelo
b6cbd9c43a QList: deprecate iterator<->pointer implicit conversions (2/3)
The constructor from a raw pointer should be
1) constexpr,
2) explicit, and
3) *private*.

We can do 1) without too much trouble.

2) is a (easy to fix) SIC in case of implicit conversions accidentally
relied upon from somewhere.

3) cannot be "easily" fixed by user code (they have to refactor), and
also, it's a BIC on Windows which encodes class members' access in
symbols. Someone may have been exporting some QList subclass, in turn
exporting the iterator classes, and therefore that someone now has the
constructors' symbols with a given access.

So, don't do 2+3 _just yet_ for user code, but set a deadline: Qt 6.5 is
the last that will support this. On Qt 6.6, we switch. All of this on
non-Windows, againt to avoid an ABI break. One can opt-in at any time
via a suitable define.

Given we have this define, use it to guard the other way around as well:
conversions from an iterator to a raw pointer should never be explicit
(there's std::to_address for this).

[ChangeLog][QtCore][QList] Converting a QList's iterator from and to a
raw pointer is deprecated, and will get removed in Qt 6.6. User code can
prepare for the change by defining QT_STRICT_QLIST_ITERATORS.

Change-Id: I0f34bfa3ac055c02af5a3ca159180304660dfc11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-16 13:48:27 +02:00
Giuseppe D'Angelo
0220484329 QList: deprecate iterator<->pointer implicit conversions (1/3)
QList<T>::(const_)iterator both feature an implicit operator T*.

This operator exists in order to keep compatibility with Qt 5 code,
where QVector<T>::iterator _was_ indeed a T*. However, iterators are
not proxy objects and should not convert to T* (at least, not
implictly). In fact we've already seen compilers complain about
ambiguous calls when e.g. moving an iterator through an arithmetic
operation (say, operator+).

For instance, if one does

  it + number

and the numeric argument of that call is not precisely qsizetype
(but, say, int), then the call is ambiguous between

  operator+(iterator, int promoted to qsizetype)
  operator+(pointer (converted from iterator), int)

One can imagine similar failures in generic code. In short: let's
deprecate (not remove) the implicit conversion, and let people use
iterators for what they are.

Task-number: QTBUG-96128
Change-Id: I008348beefe00e4449b2d95c21c842d676390a26
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-16 13:48:27 +02:00
Edward Welbourne
c6bd13ab3d Mention a change to QDateTimeEdit::setDateTime()
I neglected to record the change in the Qt 6 changes documents that
help folk migrate from Qt 5. This is a follow-up to
commit 2a653fde48

Fixes: QTBUG-97493
Pick-to: 6.2 6.2.1
Change-Id: Ie496fdd05759eeeac4c7610db40ab6745b5e0640
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-16 13:01:33 +02:00
Friedemann Kleint
bb56560b6b Polish the painting/affine example
- Use member initialization
- Remove C-style casts
- Add space around operators
- Use qsizetype for list indexes
- Remove commented out debugging code

Task-number: QTBUG-97095
Pick-to: 6.2
Change-Id: I11a17fa6e7f17968367a57291d83ee6fba731a34
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-16 12:52:29 +02:00