Commit Graph

53594 Commits

Author SHA1 Message Date
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
Povilas Kanapickas
a875503d9e xcb: Use byte buffer for event masks
This prepares for use of masks larger than 32 bits which happens on XI
2.4. Additionally, since the XI protocol always sends the masks using
little-endian, the XI protocol support on big-endian machines was
currently broken.

Change-Id: Id22131e075059cea783b5be0691a673a457c7364
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-16 12:52:29 +02:00
Volker Hilsheimer
32edae5e26 Fix restoring main window state for maximized/fullscreen windows
On systems that asynchronously resize the window to maximized or full
screen state, the window will become visible in its normal geometry
before it gets the final size by the windowing system. This might cause
multiple resize events, to each of which the widget's layout responds
with a call to its setGeometry implementation.

The QMainWindowLayout is special in that it will shrink dock widgets if
there is not enough space for them, but it doesn't grow them back once
there is. With the initial resize event being for a smaller size than
what was restored, the state is not restored correctly, but remains in
the state that fit into the smallest size with which setGeometry got
called.

To fix this, we have to keep the restored state around until the window
either gets a size that is large enough for it to fit, or until we can
be reasonably certain that the windowing system is done resizing the
window while transitioning it to the maximized or full screen state.
Since across the various platforms and windowing systems there is no
reliable way to know when the window reaches its final size, we have
to use a timer that we (re)start for each call to setGeometry with a
size that's not large enough. Once the timer times out, we have to
give up; then the last layout state calculated is the final state.

To calculate the size of the layout, introduce a function to the
QDockAreaLayout that returns the size required for the current sizes
of the docks. Refactor sizeHint and minimumSize (which were identical)
into a helper template that takes member-function pointers to call the
respective method from the dock area layout's content items.

Add a test case for various permutations of the scenario. The timeout
of 150ms is based on running this test case repeatedly on various
desktop platforms and X11 window managers.

Fixes: QTBUG-46620
Change-Id: I489675c2c40d3308ac8194aeb4267172b2fb38be
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-16 09:46:22 +02:00
Jonas Kvinge
553a1c48fd widgets: Fix typos in source code comments
Pick-to: 6.2
Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-15 20:07:09 +02:00
Joerg Bornemann
dedb29cf23 Fix high DPI position of foreign child windows on Windows
Suppose you have a child window that is a foreign window.  In the bug
report's example it's a QAxWidget that wraps the Windows Media Player.

This means, we have a non-top-level QWindow with a platformWindow
assigned.  If windows:dpiawareness is set to 1 (system-DPI aware) and
the window is displayed on a screen with origin != (0, 0), then we
called QPlatformWindow::setGeometry with a position in native
coordinates.  This moved the child window outside of the visible area.

Fix this by calling QHighDpi::toNativeWindowGeometry instead of
QHighDpi::toNativePixels.  The former function takes child windows
properly into account.

Pick-to: 6.2
Fixes: QTBUG-96114
Change-Id: Ibb0f844b10aece8ede99cb34289c0430ac283fa0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-15 20:03:34 +02:00
Alexandru Croitor
aad4158959 CMake: Postpone target existence check for qml plugin targets
Each included qml Qt6FooPluginTargets.cmake file checks whether
all the dependency targets that are referenced in the file already
exist by the time the file is included.

If one of the referenced targets is missing, the file sets
${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE with a message mentioning
which targets are missing and also sets
${CMAKE_FIND_PACKAGE_NAME}_FOUND to FALSE.

All our qml package Config.cmake and Targets.cmake files are
include()d by Qt6QmlPlugins.cmake using a file(GLOB) which means the
order in which the files are loaded is implementation-defined.

Furthermore we didn't check the above set variables after each
inclusion, which means the values are overridden and the last plugin
to be loaded determines whether the Qml package is found or not.
If the last included file sets no error, it effectively silences any
previously set error.

Ever since we added dependencies between the qml plugin targets
themselves, we hit the above situation and depending on the platform,
no error was shown because the last file overrode any errors.

But we finally got a specific platform (wasm) which unearthed the
problem (QTBUG-97478). This can happen for any static Qt build though.

To fix this properly, we will most likely have to rewrite the whole
inclusion mechanism to use find_package() so that dependencies
can be resolved recursively as needed. This is a non-trivial change
that will have to be addressed in both qtbase and qtdeclarative.

In the mean time, a stop-gap solution that this change implements is
to include all the files while ignoring any error messages.
Then include the files one more time and check for error message after
each included file.

All qml plugin targets should have been brought into scope with the
first round of inclusions, thus circumventing "missing referenced
target" errors, while still catching any other possible errors.

Amends
6fd1216801f078f65be2cbc748cc459cb6912a4f
9fc302e6d146878103b3d105dce49c7695fcf93a
c368175a9e0a0c120b5bb8a0a02859bfc0cf42ba
in qtdeclarative.

Pick-to: 6.2 6.2.1
Fixes: QTBUG-97478
Task-number: QTBUG-95609
Task-number: QTBUG-97099
Change-Id: I157fa93fc979d726cd221d969b995b3642aeec77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-10-15 18:25:29 +02:00
Tor Arne Vestbø
f572b88899 Clarify QWidget::normalGeometry documentation
The property reflects the widget's current geometry if it is not in a
full screen or maximized state.

Pick-to: 6.2
Change-Id: I5816687119500995654a926aef952d788ad74886
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-15 18:14:25 +02:00
Alexey Edelev
2b6500cd15 Add PRIVATE_MODULE_INTERFACE to the module dependency set
PRIVATE_MODULE_INTERFACE libraries are linked as interface libraries to
the module's Private target and exported as the dependencies of package
targets. We need to register these modules as public package dependencies
to call find_package when resolving module dependencies in user
projects.

Pick-to: 6.2
Fixes: QTBUG-96558
Change-Id: I4eef550aab306eaf357539ef7a0f76d69873f856
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-15 15:53:23 +02:00
Alexey Edelev
f19f729511 Improve double call protection of qt_internal_generate_tool_command_wrapper
file(GENERATE) might fail if an unrelated configuration error happens,
and yet QT_TOOL_COMMAND_WRAPPER_PATH would already be set. Set the
cache variable only if generating was successful and replace the
QT_TOOL_COMMAND_WRAPPER_PATH valiable check with GLOBAL property to
protect the function from double call.

For CMake versions higher than or equal to 3.18 replace 'file(GENERATE'
call with 'file(CONFIGURE' to generate the wrapper at configure time
with the use of a plain semicolon character.

Pick-to: 6.2
Fixes: QTBUG-96870
Change-Id: Icf9c40f571d9c069043604f67ffcf2762966f6d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-15 15:53:23 +02:00
Andy Shaw
a36c84c6a3 When filling a pixmap after an assignment ensure the set DPR is not lost
Pick-to: 6.2 5.15
Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-15 10:27:15 +02:00
Mårten Nordheim
ed3e1ecb27 QOpenSSLBackend: Properly load 3.0 when compiled with 3.0
The naming updated but the version suffix is hardcoded on windows
and it was overlooked when work was done to support OpenSSL 3.

Fixes: QTBUG-97116
Pick-to: 6.2 5.15 6.2.1
Change-Id: Iec15d772c54ed214940ec5634a0929485478f771
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-15 08:21:17 +00:00
Giuseppe D'Angelo
ad972af8fb QList: add mixed comparison operators between (const_)iterators
It is currently possible to compare a QList iterator with a
const_iterator and viceversa, even though these operations aren't
defined, because they are actually routed through the relational
operators between iterators and raw pointers after a conversion (!).

With the deprecation of iterator->pointer implicit conversions, this
is going to break, so add the missig mixed comparison operators.

Change-Id: Ic645ab0246f79f64b04334ecd02e9fe8fa46f0fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-15 10:19:17 +02:00
Iikka Eklund
be3df082bc Conan: Do not use f-strings
Conan supports Python3.5 which does not support f-strings yet.

Pick-to: 6.2
Change-Id: Ie4b64e3baff7da64b80db71f4f0ea4172ddc61fb
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-10-15 11:09:38 +03:00
Tatiana Borisova
144f3fe5a3 Fix autotest public API compilation for INTEGRITY
- getgid/getpwuid are not supported
- process should be used with config check

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: Ib6854772bcf52f3533cb722f963426717926258b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-15 11:00:25 +03:00
Jonas Kvinge
071ebc9eee dbus: Fix typos
Pick-to: 5.15 6.2
Change-Id: I9efce6a3163ca6564d511c994776ff96999909b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-14 20:22:21 +02:00
Jonas Kvinge
1463ffc38d xcb: Fix typos in source code comments
Change-Id: I3a91f57d3c47d9e96215d5dc064664626a8f65e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 20:22:21 +02:00
Jonas Kvinge
7ce3231749 qwindowsdialoghelpers: Fix typo in documentation
Pick-to: 5.15 6.2
Change-Id: I23e096655f68d64c0c40c02a246582916c2d1743
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-10-14 20:22:21 +02:00
Jonas Kvinge
3a68f49c48 Fix typos in SQL driver documentation
Pick-to: 5.15 6.2
Change-Id: I871f6eff908926485c371121113d4853064f808f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 20:22:21 +02:00
Jonas Kvinge
35385dcbe6 qxcbscreen: Fix typo in documentation
Pick-to: 5.15 6.2
Change-Id: I92f7d707a1395594ad6d1fe841fa77d21ae7c8b1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 20:22:21 +02:00
Alexey Edelev
61441074ef Set QT_ANDROID_ABIS when builing qtbase for Android
When building Qt we need to set QT_ANDROID_ABIS value to
CMAKE_ANDROID_ARCH_ABI explictily since the automatical detecting of
android ABI is not executed. This fixes build of the qtbase in-tree
tests.

Fixes: QTBUG-97133
Change-Id: Ica7057bcfcc8f4fe4b5a921ca7449f74cdbca0f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-14 19:57:10 +02:00
Shawn Rutledge
5e55297ee0 Markdown writer: indent fence consistent with code block
- Under a list item, we've been indenting code blocks:
  ```
  int main() ...
  ```
- But it's also ok *not* to indent (and github handles that better):
```
int main() ...
```
- There was a bug that when the code is not indented, the fence would be
  indented anyway:
  ```
int main() ...
  ```
  and that was not OK, neither for md4c nor for github.

Now with this change, either way is rewritable: you can read markdown
into QTextDocument, make small edits and write it back out again, with
the indentation being preserved (the code block is either part of the
list item, thus indented, or else it's outside the list completely).

Pick-to: 6.2
Task-number: QTBUG-92445
Change-Id: I5f51899e28ba9f09b88a71e640d9283416cce171
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 19:57:09 +02:00
Volker Hilsheimer
74e634d82c macOS: Correctly record normalGeometry in Cocoa plugin
Cocoa sends QWidget the state-change notification after the window has
been resized already, at which point we cannot store the normal geometry
anymore.

Handle zoom and full screen callbacks prior to the state changing
to store the geometry in QCocoaWindow. We do not need to handle
minimized state, as the window will still reflect the original
geometry.

Return the stored value from an override of
QPlatformWindow::normalGeometry so that QWidget gets the correct values
even though the new state is already active.

Fix the tst_QWidget::normalGeometry test to make it pass on all
platforms by waiting for the window to actually have transitioned to
the new state before comparing geometries. Both macOS and Windows fully
pass; on Xcb, deminimizing a window using setWindowState does not work,
which is why the test was partially skipped (confirmed by visual
testing). Move those problematic, complex test cases to the end so
that most cases are covered on Xcb as well.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Pick-to: 6.2
Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 17:19:38 +00:00
Tor Arne Vestbø
e95e9c28f0 QWidget: Don't rely on topextra to determine if window is top level
Doing so results in bailing out early for a widget that hasn't been
shown yet, or otherwise resulted in creating extra and topextra,
which means the normalGeometry will not reflect the widget's geometry.

Pick-to: 6.2
Change-Id: Ieb85e9a6109ae34fe20d79e3c12f4517f827a590
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 19:19:38 +02:00
Edward Welbourne
c179549a74 Tidy up in QGraphicsWidget::resize()
Simplify various conditions.
Eliminate duplication from an overly-complex if/else cascade.
Move the set-up of a QGraphicsSceneResizeEvent to only happen if it's
going to be used.

Change-Id: Ie51aa5de5f2bd1603478ae0cda0fd4279334f45a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 18:40:22 +02:00
Edward Welbourne
ed9665597d Eliminate use of goto in QGraphicsWidget::resize()
Get rid of the gotos by packaging the wrap-up code in a QScopeGuard.
Thanks to Volker Hilsheimer for suggesting that solution.

Change-Id: I71bebf59263ce05f111d1fcfcec93f4635a35428
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 18:40:22 +02:00
Jarek Kobus
3c747aafa4 Optimize mime type matching
Don't count "*", don't search for "[" and for "?"
inside m_pattern on every call to matchFileName().
Do it once, when constructing the MimeGlobPattern.

Fix matching the pattern for names without any
wildcard: index of question mark should be -1, not
just different from 0.

This shortens loading a Qt6 project in Creator
by about 500 ms.

Pick-to: 6.2 5.15
Change-Id: Ifa40c2cec4aba07a0312ef36877e571a8c8fb151
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-14 18:40:22 +02:00
Giuseppe D'Angelo
4ed5f826c8 QNetworkAccessAuthenticationManager: don't mix iterators and pointers
QList::iterator is not a pointer and shouldn't be treated as one.
Convert the code to use iterators consistently (using iterators is
necessary due to the call to insert()).

Change-Id: I917b3ff6fdcf1f7959e35ac5b091a8140e9f833c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 18:16:17 +02:00
Andreas Buhr
a47f66cee2 Android: Fix handling of cursor position when stop composing
This is a workaround for a problem in TextEdit.
The symptom is that when the user places the cursor inside
of a word and hits backspace, the last letter of the word
is removed instead of the letter just before the cursor.
The reason is as follows.
When stopping composing, the current cursor position has to
be maintained. To that end, QAndroidInputContext sends an
event containing the text to be committed and the cursor position
to the editor. But the resulting cursor position is wrong.
This patch adapts QAndroidInputContext to send two events:
One to commit the text, the second to place the cursor.
A real fix would fix the editor to correctly
handle the event containing both the committed text and
the cursor position.

Fixes: QTBUG-97491
Pick-to: 6.2 5.15
Change-Id: Idd00e5afcbfe29c9cb77356f9add2e881c51b9bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2021-10-14 17:20:58 +02:00
Morten Johan Sørvig
2e73ff1079 Initialize m_dpiAdjustmentPolicy from correct env
Commit 4d1f13f354 accidentally changed the code to read
envScaleFactorRoundingPolicy instead of envDpiAdjustmentPolicy.

Pick-to: 6.2.1 6.2
Fixes: QTBUG-97443
Change-Id: I26f519fd8829860af26fa8439df9bbf15cd7352f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-14 15:20:58 +00:00
Andy Shaw
d0d29a944a Android: Hide the keyboard when the height is less than 0
When swiping on a device to do the back gesture then there is no back
key pressed sent so we still need to catch when the keyboard is hidden.
So we can listen for the geometry change and if the height is less than
0 then it is safe to say it is hidden so we update the internal setting
on this.

Fixes: QTBUG-96560
Pick-to: 6.2 5.15
Change-Id: Iec0560935ef914d2cebcb7641a72ab4f71877d23
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-14 17:20:58 +02:00
Shawn Rutledge
5c436365f5 Support background-color CSS styling on <hr/>
[ChangeLog][QtGui][CSS] The background-color style can now be applied to
<hr/> to set the rule color.

Task-number: QTBUG-74342
Change-Id: Ib960ce4d38caa225f258b6d228fb794cef43e1b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-10-14 17:09:20 +02:00
Edward Welbourne
f83a3c4b6e Convert Latin1 to UTF-16 before passing to ICU API
The ICU UChar type is a UTF-16 type, not a single-byte type, so
passing it the data() of a QByteArray representing an ID is misguided.

Fixes: QTBUG-97486
Pick-to: 6.2 6.2.1
Change-Id: I6789f491674b1d913eb8655d788b497e2fc06f7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-14 17:09:20 +02:00
Andreas Buhr
dbc434dc09 Fix segfault in QItemSelectionModel::hasSelection
Amends 0c2125458a.
The code assumed that a QItemSelectionModel always has a model.
But during initialization from QML, it hasn't.

Fixes: QTBUG-97475
Pick-to: 6.2 6.2.1
Change-Id: Ie9c680f8989a23ef732faaf5da7ef7ae273126aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-14 17:09:20 +02:00
Kevin Funk
f08704330d qtlogging: Document QT_MESSAGELOGCONTEXT define
Document it here to let people know about the pitfalls with some
placeholder values. Link the QMessageLogContext class doc for more information.

Pick-to: 6.2
Change-Id: I8e7b4c0dcb8bceeeee645664c98e63ae7ca7e854
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-14 08:31:31 +00:00
Fan RuiJie
146749f9b7 QTimer: Add \note in documentation
Keeping the event loop busy with a zero-timer like
that is bound to cause trouble and highly erratic behavior of the UI.

Fixes: QTBUG-96869
Pick-to: 6.1 6.0 5.15
Change-Id: Idf02a7a7e0689c59e1223610a6525262ead56d8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-14 16:25:21 +08:00
Doris Verria
ec09900997 Call QWidget close handling in QWidget::close for non-toplevel native widgets
Since commit 7ba75d0 we close the QWindow in QWidget::close for native
widgets and trigger the closeEvent in QWidgetWindow. However, if the
widget's window handle is not a top level window, QWindow::close()
will not close the window, failing in this way to deliver the
closeEvent and call the close handling in QWidgetPrivate::handleClose.
To fix, call handleClose() from QWidget::close for such widgets.

Task-number: QTBUG-74606
Pick-to: 6.2
Change-Id: Ied342eced3340aaf19b5443762935b1a5fc5c27b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-14 10:19:29 +02:00
Thiago Macieira
dcb281af7d CMake: Make LTO build work
We don't need to check FEATURE_ltcg, just add -fno-lto unconditionally.
That makes QtCore compile with -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON.

Change-Id: Icb2516126f674e7b8bb3fffd16ada2c71d7334aa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 18:29:35 -07:00