Commit Graph

39689 Commits

Author SHA1 Message Date
Thiago Macieira
e3f05981cb QHash: use the shadow seed
[ChangeLog][Important Behavior Changes] The qHash functions operating on
string-like types and the qHashBits function will now mix in a shadow
seed (not available in any API) if the provided main seed is not 0. This
means the hashing value for any particular input has an almost zero
chance of being equal in two different processes, even if processes of
the same application. This unpredictability makes QHash more strongly
resist denial-of-service attacks through degenerate hashing tables.

Change-Id: Id2983978ad544ff79911fffd167240196f7cd5c8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-26 11:38:56 -07:00
Thiago Macieira
0077eac4e4 QHash: double the size of the stored seed
There's now another half of the seed which will be used by the hashers.
This is not stored in QHash, so it is never changed for the lifetime of
the application (not even when QHashSeed::setDeterministicGlobalSeed()
is called). However, we will not use it when we're in deterministic
mode.

This commit uses the compiler thread-safe statics to implement the
initialization of more than one atomic word, thus freeing us from having
to have a reserved value. As a bonus, the QT_HASH_SEED warning will only
be printed once.

Change-Id: Id2983978ad544ff79911fffd16723f1673f9a5b4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-26 11:38:56 -07:00
Alexey Edelev
6adaaa7745 Add internal property to store Qt namespace
In some cases it might be useful to use the value of Qt namespace in
CMake files. Currently the value is only stored inside Core target
compile definitions. This adds the internal property _qt_namespace to
the Core target and exports it.

Change-Id: Ic0454f0ce6b8c65b5a186981463d3977169b022e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-26 19:20:47 +02:00
Mårten Nordheim
f670e483c1 QNI: refactor to avoid tiny lambda slot objects
by just adding the parameter to the signal there's no longer a need for
the tiny lambdas that just call a getter.

Originally the idea was that, since the emission from Backend to the
'frontend' may be a queued emission, I wanted to use the getter so that
the data emitted from the frontend was as up-to-date as possible.
But on one hand, that's not really a big problem, and at the same time
it would then emit the signal twice with the same value.

Change-Id: Ief0959f8cbf06faf1b02a1ed4ae777181ff4f059
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-26 18:28:04 +02:00
Edward Welbourne
bb220f2d99 Fix overflow issue on parsing min-qint64 with its minus sign repeated
The call to std::from_chars() accepts a sign, but we've already dealt
with a sign, so that would be a second sign. Check the first character
after any prefix is in fact a digit (for the base in use). This is a
follow-up to commit 5644af6f8a.

Fixes: QTBUG-97521
Change-Id: I65fb144bf6a8430da90ec5f65088ca20e79bf02f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-26 17:38:22 +02:00
David Skoland
25e85ec45f Remove unused statements in QWindow
Change-Id: I91f0d23d22923f7c2b8c9099371288d226d541c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-26 13:59:59 +02:00
Topi Reinio
cdf8fd5e86 Doc: Enforce zero warnings for QtCore, QtGui
Change-Id: I7b39f9bf8d7bc9c9c5c21c4bd648a86281162740
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-26 11:54:41 +00:00
Ivan Solovev
5f0e57ebc7 QObjectComputedProperty docs: move example to snippet
This patch amends 89a4c8d40d.
It moves the code sample into a separate snippet file, which allows us
to use Q_OBJECT macro in it without complaints from moc.

Task-number: QTBUG-97656
Pick-to: 6.2
Change-Id: I368d8dd8c00dbbebd8a6bf3788be796c8ca4bce8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-26 10:18:07 +02:00
Volker Hilsheimer
da632baf34 QTabBar: re-layout when tab size hint depends on selected state
QTabBar caches the rects for the tabs to avoid costly recalculation of
each tab's size hint. That cache is only updated via layoutTabs if the
entire tab bar is resized or modified. However, when a style sheet is
set that calculates a different size hint for tabs that are selected,
then the tab bar also needs to be laid-out when the current tab changes.

To minimize the cost, compare the cached size for the new current tab
with its new size hint, and re-layout the tabs when they are different.

Fixes: QTBUG-6905
Fixes: QTBUG-8209
Pick-to: 6.2
Change-Id: I110444d18938c2b3446ee58e4a8c6c472b5f12c3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-26 00:57:36 +02:00
David Skoland
0921caf976 wasm: Hide popups when a window is left-clicked
This logic is taken from the macOS platform implementation and seems
reasonable to reuse in WASM.

Fixes: QTBUG-90990
Change-Id: Id4a4dd8d9fdd9de3085bfcd9079793aad3dda363
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-25 22:17:39 +00:00
Volker Hilsheimer
01f96b1764 Don't fire shortcut if the action only lives in an unreachable submenu
Menus can be represented by a menu action, and if that menu action has
been hidden or disabled, then the submenu is not accessible from the
parent menu or menu bar to which it was added. Don't walk the menu
action chain further when checking whether the shortcut should trigger.

Note that this is unrelated to the menu being visible or not; we
obviously want to trigger shortcuts for actions that only live in a menu
that has not been shown, otherwise the shortcut would be rather
pointless.

Pick-to: 6.2
Fixes: QTBUG-25743
Change-Id: I48735e17352989bbc84a72263e4828f519b78095
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-25 17:17:40 +00:00
Ivan Solovev
89a4c8d40d Make QObjectComputedProperty documentation visible
QObjectComputedProperty belongs to public API. It's even referred in
other documentation (for example, QBindable).
It does not make sense to have its documentation marked as \internal.

Task-number: QTBUG-97656
Pick-to: 6.2
Change-Id: I6ca81292cfafea873dd3577fb0e5ddb583969dc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-25 14:57:18 +02:00
Ivan Solovev
164e575673 Fix -trace build on Windows
The TraceLoggingValue template does not have overloads for Qt
types, so it was throwing multiple template instantiation errors
while trying to log the unknown types.
Fix it by serializing such types to QString using QDebug::toString,
and the logging this string.

Apart from that, fixes some other compiler errors on Windows build
with -trace enabled:
- implicit size_t to ULONG conversion
- complaints on std::min
- add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE to the generated
  *_tracepoints_p.h headers to fix the namespace build.

Task-number: QTBUG-97246
Fixes: QTBUG-97241
Pick-to: 6.2
Change-Id: Ifba134bab8d7fda7f1e30da9938e25cae813e1c6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-25 14:57:18 +02:00
Ivan Solovev
2a72f0f15d Fix compilation with QT_NAMESPACE and tracing on Linux
The tracegen tool was not taking into account that Qt could be build
with a custom namespace. As a result, the combination of namespace
build and tracing enabled was not working, because tracegen generated
classes without the namespace.

This patch fixes it.
We cannot add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE because of the
tricky logic that recursively includes the generated header file
multiple times, also including the code like

static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
(hash)include TRACEPOINT_INCLUDE
    NULL, /* Dummy, C99 forbids 0-len array. */
};

where TRACEPOINT_INCLUDE is the path to the generated header.

This patch is using QT_USE_NAMESPACE, wrapped into some #ifdefs.
This should be safe, considering that the generated trace headers
are only used as private API.

The windows tracing support seems to be broken even in a
non-namespace build, so it's not handled in this patch.

Task-number: QTBUG-97246
Pick-to: 6.2
Change-Id: I12db76e199a3aa3abde641fbf99a6e1a3d7de203
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2021-10-25 14:57:18 +02:00
Assam Boudjelthia
cbc29dc16c Android: set EXTRA_TITLE to the initially selected file in save dialog
The extra data EXTRA_TITLE is only documented to be used to provide
the initially selected file name in the context of file dialog [1].
So, let's stick to setting it only in save mode. This also now allows
the save dialog to set an initial file name which wasn't possible
before.

[1] https://developer.android.com/reference/kotlin/android/content/
Intent#action_create_document

Pick-to: 6.2 5.15
Change-Id: Ib55191a7269bfad28af4928f4e74d87981bdd574
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-10-25 15:47:46 +03:00
Volker Hilsheimer
137ba2aba8 Initialize member variables before we check their values
Amends 51679efcf97dfea86431912eeb9489088c0804ed, which broke Ctrl+key
handling so that the key was not translated based on the alphanumerical
character anymore.

Fixes: QTBUG-97713
Pick-to: 6.2
Change-Id: I9835fd7af99693aae636ba3c4c114ef8e11621e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-25 14:07:00 +02:00
Ilya Fedin
6bf41058a6 Add a QNetworkInformation backend based on GNetworkMonitor
GNetworkMonitor can get information from 3 sources:
* org.freedesktop.portal.NetworkMonitor
* NetworkManager
* netlink

Change-Id: Icfafe6af42148f26360449f1262093ffc6b0613a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-24 18:22:46 +04:00
Ivan Tkachenko
8896ef999b Doc: Fix formatting: remove extra \c before \nullptr
Change-Id: Ie93cf7253bdc6b70fd187c208da636fc551491c2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-24 13:15:51 +03:00
Mårten Nordheim
06d2a5cf61 Update windows version detection
Since the API still doesn't return 11.

Pick-to: 6.2 5.15
Change-Id: Ifd4f7f845915702fcbb0f857487358ae8e806273
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-24 07:50:02 +00:00
Thiago Macieira
4c50810a1a Remove old pre-6.0 hooks
Now only qt_startup_hook officially remains

Change-Id: Iac31783a62a040638d73fffd168aaaa7408c9be4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-22 19:12:07 -07:00
Venugopal Shivashankar
b6230421f1 Doc: Fix qdoc warnngs
qt5/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:75: (qdoc) warning: Cannot tie this documentation to anything [qdoc found a /*! ... */ comment, but there was no topic command (e.g., '\fn', '\page') in the comment and no function definition following the comment.]
qt5/qtbase/src/gui/text/qtextformat.cpp:1500: (qdoc) warning: Overrides a previous doc
qt5/qtbase/src/gui/text/qtextformat.cpp:1487: (qdoc) warning: (The previous doc is here)
qt5/qtbase/src/gui/text/qtextformat.cpp:1533: (qdoc) warning: Overrides a previous doc
qt5/qtbase/src/gui/text/qtextformat.cpp:1520: (qdoc) warning: (The previous doc is here)

Change-Id: I5a089bef1841d6d69bff4c780805d20e5926fe6f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-10-23 03:08:58 +02:00
Venugopal Shivashankar
b50ee930c7 Doc: Fix qdoc warnings
src/corelib/kernel/qmetatype.cpp:1605: (qdoc) warning: Command '\snippet (//! [[implicit]])' failed at end of file 'qmetatyp>
src/corelib/kernel/qmetatype.cpp:1615: (qdoc) warning: Command '\snippet (//! [[member]])' failed at end of file 'qmetatype/>
src/corelib/kernel/qmetatype.cpp:1626: (qdoc) warning: Command '\snippet (//! [[memberOk]])' failed at end of file 'qmetatyp>
src/corelib/kernel/qmetatype.cpp:1639: (qdoc) warning: Command '\snippet (//! [[unaryfunc]])' failed at end of file 'qmetaty>
src/corelib/text/qbytearraymatcher.cpp:233: (qdoc) warning: No such parameter 'view' in QByteArrayMatcher::indexIn()
src/corelib/time/qdatetime.cpp:1854: (qdoc) warning: Can't link to 'QLocaleie:pmText()'
src/corelib/thread/qsemaphore.cpp:494: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text
src/corelib/thread/qsemaphore.cpp:505: (qdoc) warning: Undocumented parameter 'timeout' in QSemaphore::try_acquire_for()
src/corelib/thread/qsemaphore.cpp:505: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text
src/corelib/thread/qsemaphore.cpp:516: (qdoc) warning: Undocumented parameter 'tp' in QSemaphore::try_acquire_until()
src/corelib/thread/qsemaphore.cpp:516: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text

Change-Id: Ib612c69525ec7542f2ad3dd9a07e89f266718fd8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-10-23 03:08:58 +02:00
Robert Löhning
a7d1c48ca3 QVarLengthArray: Reduce memory allocations in emplace()
Currently, we allocate memory for elements one by one which can get
pretty slow when adding many elements.

[ChangeLog][QtCore][QVarLengthArray] Reduced number of memory
allocations in emplace() by allocating more memory at once.

Fixes: QTBUG-97489
Pick-to: 6.2
Change-Id: Idfb5b5946b047d5215c8ed00770574249f9f5d40
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-23 01:22:15 +02:00
Gatis Paeglis
fdbf7cdd09 xcb: use QXcbConnection::selectionOwner() convenience API
Change-Id: I4fbae152829206b15bf0430d3fb2c9e2b6026566
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-10-22 23:30:07 +02:00
Gatis Paeglis
7f0e227d8a xcb: remove confusing indirections for qt selection owner
This makes it more obvious that clipboard and DnD use the
same selection owner (QXcbConnection::qtSelectionOwner()).

This way we can also drop some QT_NO_CLIPBOARD defines.
These defines actually are broken, but that is out-of-scope
for this patch.

And renamed the functions according to Qt guidelines:

getSelectionOwner()   -> selectionOwner()
getQtSelectionOwner() -> qtSelectionOwner()

The previous naming probably was influenced by underlying
C API - xcb_get_selection_owner().

Change-Id: I467f1a3dbe75b4e8fd41c7e66ca9b0e25ef1039c
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-10-22 23:30:07 +02:00
Liang Qi
e0938223c4 xcb: avoid to use invalid pointers
Pick-to: 6.2 5.15 5.12
Task-number: QTBUG-96399
Change-Id: I33909940b501cb13f78981c43f3aef9fc9d1d52d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-22 23:30:07 +02:00
Mårten Nordheim
5ea712987b Update Gradle to 7.2.0 and Android Gradle Plugin to 7.0.2
The latest build-tools 31.0.0 requires AGP version 7.0+, and that
requires Gradle version 7.0+, so use the latest stable release for both.

[1] https://developer.android.com/studio/releases/gradle-plugin?
buildsystem=ndk-build#updating-gradle

Fixes: QTBUG-97002
Pick-to: 6.2
Change-Id: I8ff26819bdf1a00f484ecc194c4d4e7bca2b598a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-22 19:54:45 +02:00
Joerg Bornemann
7c7184ad60 Remove superfluous qfuture.h includes from qcoreapplication[_p].h
This include is only needed on Android, and removing it improves build
times slightly.

Remove the include from qcoreapplication.h and guard the includes in
qcoreapplication_platform.h properly for Android.

Remove the include from qcoreapplication_p.h as well.  This was a
left-over from the app permissions API that was removed.

Pick-to: 6.2
Task-number: QTBUG-97601
Change-Id: I131baebe3e08e93ad5420d40908c2dceab89554c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-22 09:48:41 +02:00
Joerg Bornemann
c327cc60bf Remove unused qapplicationpermission.h
The app permission API was removed, and this file is a left-over.
This amends commit 72e5b36e2e.

Pick-to: 6.2
Change-Id: Ie1bf9465260594864464c4d4ee4dc99593c28cc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-22 09:48:33 +02:00
Volker Hilsheimer
71aaf831d1 QAbstractItemView: auto-scroll with selection rectangle
Some item views, such as QListView in icon mode, implement a selection
rectangle with which the user can "lasso" items. So far, dragging that
rectangle did not trigger auto scroll, so unless an item near the edge
was selected, the user had to stop the lassoing and scroll manually to
reach more items.

Since QAbtractItemView implements auto scrolling for drag'n'drop, we can
use that mechanism also when the selection rectangle is dragged. This
requires some modifications:

We need to make sure that scrolling the view during a drag-selection
generates mouse move events so that the selection is extended and the
rectangle is updated in subclasses.
And we need to stop using QCursor::pos to get the position of the mouse
pointer, as this makes the auto-scrolling untestable. Instead, record
the mouse position last seen during a mouseMove or dragMoveEvent in
content-coordinates (identical to pressedPosition).

As a drive-by, fix some coding-style issues in nearby code.

Done-with: Zhang Hao <zhanghao@uniontech.com>
Fixes: QTBUG-96124
Change-Id: I426f786e5842ae9f9fb04e9d34dc6d3379a6207f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-22 09:43:53 +02:00
Mårten Nordheim
bfe579613a QNI: Add a convenience method for loading the default plugin
We have some official plugins, we may as well treat them as default
and give a convenient function which loads those.

Change-Id: I6251c77ac042b795bcf24b86e510e960ee4bab54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:49 +02:00
Mårten Nordheim
5f8e9c194e QNI: Add supportedFeatures getter
Which just returns all the supported features

Change-Id: I8c3996b00a6ebb114bdbc9db3085a0e27fc8fa79
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:45 +02:00
Thiago Macieira
a43dd9a6b1 Doc: QString: formalize that we now include the QBA's nulls
We've been meaning to do this ever since the QByteArray overloads were
added some time prior to Qt 4.5.1[1], but had been wary of behavior
compatibility issues. Commit 6abdbb65e5
did it and even explained so in the ChangeLog. I'm just being more
explicit.

[1] https://code.qt.io/cgit/qt/qt.git/tree/src/corelib/tools/qstring.h?h=v4.5.1#n415

Fixes: QTBUG-97451
Change-Id: Icb2516126f674e7b8bb3fffd16ad55e46a9781c8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-21 21:31:00 -07:00
Thiago Macieira
f9139b19bf QLatin1String: harmonize null byte handling with the rest of QString
After the introduction of QByteArrayView, all the QString::fromXxx
overloads and the constructor will include the null bytes inside
QByteArrays and so will QLatin1Strings created from QByteArrayViews.
This was the lone stand-out that wasn't fixed in 6.0, so do it now.

[ChangeLog][Important Behavior Changes] Since Qt 6.0, all QString and
QLatin1String methods consuming QByteArray and QByteArrayView objects
will include any embedded null bytes and treat them as U+0000 Unicode
characters, whereas in Qt 4.x and 5.x, they would stop at the first null
byte like bare C strings. Qt 6.3 contains a fix for a couple of the
methods that mistakenly persisted the old behavior in 6.0-6.2, namely
the QLatin1String constructor from QByteArray and the equality and
inequality operators between QByteArray and QString.

Task-number: QTBUG-97451
Change-Id: Icb2516126f674e7b8bb3fffd16ad5621cf3e64ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-22 04:30:53 +00:00
Allan Sandfeld Jensen
c1a5f08ba0 Add QFontMetricsF methods taking text options into account
This is needed by Qt Quick to be able to calculate font metrics using
design metrics matching Quick text rendering.

Task-number: QTBUG-85936
Task-number: QTBUG-94023
Change-Id: I67c74e2a912bd58df7a57349a858f20f04609f0f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-22 01:05:43 +02:00
Ulf Hermann
8a4f252644 Avoid warnings when compiling bootstrap library without zstd
Change-Id: Ic67cd2b582df0464a17f6181157ebbd47986114c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-21 23:34:11 +02:00
Fan RuiJie
ab1904363a Fix warnings due to enums in QSizePolicy
gcc 11 generates warnings as

"bitwise operation between different enumeration types
'QSizePolicy::Policy' and 'QSizePolicy::PolicyFlag' is deprecated"

in C++20.

Fixes: QTBUG-93810
Pick-to: 6.2 5.15
Change-Id: If8a796b33a772cc1a561eb0b6bc4def8f9f54bc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-21 19:31:27 +00:00
Venugopal Shivashankar
347e74cafa Doc: Enable qdoc warning count limit
This should restrict changes that
introduce new warnings.

Change-Id: I7e4b5d9d5d84b7c336509c380bc7e6d86e360f4a
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-10-21 19:10:52 +02:00
Volker Hilsheimer
d42cfeb84f macOS: add default Edit menu items, if not added by AppKit
AppKit automatically appends "Start Dictation..." and "Emoji & Symbols"
menu items, after a separator, to a menu in the menu bar that has the
title "Edit" in the operating system language.

Qt applications might however be translated to some other language, in
which case the "Edit" menu is not recognized by AppKit, and the menu
items won't be added. This is bad for accessibility and for users
wanting to type emojis.

If we have a menu that has the title "Edit" as translated in Qt's i18n
system, then create those items manually. To prevent a duplication of
the system- provided menu items, don't add the items if there already
is one with the action being set to the relevant selector. Otherwise,
perform the selector or call the NSApplication method ourselves. This
then results in the relevant keyboard input through regular code paths.

Fixes: QTBUG-79565
Change-Id: Ifd06036211756277550d398034689aca8e770133
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-21 16:05:47 +02:00
Michal Klocek
e2fc3246d2 Make QOffscreenX11PlatformNativeInterface a QX11Application
Make it possible to use new native interface QX11Application with
offscreen plugin in case of x11, which technically is
x11 application without xcb connection.

This change is motivated by use of new native interface
in webengine, where offscreen plugin is used for
some tests.

Pick-to: 6.2
Change-Id: Ic2ed5b39573062feaa1e8985962d5d9327b371d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-21 13:39:53 +02:00
Assam Boudjelthia
54576b3dd9 Android: set allowNativeHeapPointerTagging to false in the manifest
Android 11 enables pointer tagging by default on arm64 systems [1],
which can cause QML to get invalid data, which caused the color
issue (and most likely other issues).

[1] https://source.android.com/devices/tech/debug/tagged-pointers

Fixes: QTBUG-97009
Task-number: QTBUG-91150
Change-Id: Ic4f145bba3345b3bee5445685f03269e3785f514
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 9fa805f7f8dfe96d561e9ed3170770ad768baf93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-21 11:39:53 +00:00
Timur Pocheptsov
4b282e0602 TLS plugin (OpenSSL): don't use the deprecated functions
If we have OPENSSL_NO_DEPRECATED_3_0 defined. This includes RSA, DSA,
EC and DH-related APIs. As of now, we only make sure the code still
compiles.

Pick-to: 6.2 5.15
Fixes: QTBUG-83733
Change-Id: Id455b851421ce0dcdfb0229fa515ba2b2ed690b1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-21 12:58:05 +02:00
Allan Sandfeld Jensen
4748369eb2 Fix inconsistencies between advanceWidth and bounding rects
Unify the logic in QTextEngine

Ensure tightBoundingRect, and the FreeType boundingRect, calculates from
the shaped x offset when calculating the max x coordinate for a glyph.

Fixes: QTBUG-7768
Task-number: QTBUG-70184
Task-number: QTBUG-85936
Task-number: QTBUG-94023
Change-Id: I6daafb25c79158dc7e777529abb5e8d3a284dac0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-21 12:37:22 +02:00
Bartlomiej Moskal
6dd6342864 androidtestrunner: make sure that system-user is used
It happens on Android Automotive emulator, that output file is in other
directory.

According android spec [1]:
"If a default user isn't specified, each adb subcommand has a different
user. The best practice is to retrieve the user ID with am
get-current-user and then explicitly use --user <userId> for any
command that supports it."

That is the reason why output file can be found in
/data/user/USER_ID/PACKAGE_NAME directory.

Checking path related to current user was added as backup solution.

[1]https://source.android.com/devices/tech/admin/multi-user-testing

Pick-to: 6.2
Change-Id: Id7e6ddef74f4f20b7469a07bba6a71d3622c4e20
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-21 08:23:22 +00:00
Thiago Macieira
aa82d295c8 Move the ABI tag from minimum-linux.S to qlibraryinfo.cpp
We don't need the assembly file any more. According to a comment to
patchsets 2 in the Gerrit code review for commit
bb8a61866e, the section ended up as
SHT_PROGBITS instead of SHT_NOTE. I didn't know then that the section
type is not actually important, only whether it's present in the segment
pointed by a PT_NOTE is. That isn't recorded in the review.

Since we now depend on the linker properly placing the .note.* sections
for Qt plugins, we can rely on this working.

Change-Id: Icb2516126f674e7b8bb3fffd16ad659149e34a23
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-21 00:55:48 -07:00
Thiago Macieira
7362b321e5 Doc: QByteArrayMatcher: add note that the pattern must remain on scope
This issue bit me. The API is surprising and very un-Qt-like...

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16aa1c58d921bd7e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-21 07:55:48 +00:00
Thiago Macieira
a0d66b60b7 QFactoryLoader: continue the port from JSON to CBOR
This continues the effort from the previous commit, by not passing
through the JSON conversion at all, and simply using CBOR directly.

The port in qtbase is complete, but in order to support the conversion
in other modules without introducing breakages, there's a temporary
class used for converting to QPluginParsedMetaData from
QJsonObject. It'll be removed once all other modules have finished
converting.

Change-Id: I2de1b4dfacd443148279fffd16a3ed4ddaf34afc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-20 22:04:03 -07:00
Thiago Macieira
2bea9b74ba QPlugin: keep the CBOR data as CBOR
Since QJsonValue and QCborValue use the same backend, we may as well use
the CBOR frontend classes, which means we avoid an unnecessary
conversion until later.

Change-Id: I2de1b4dfacd443148279fffd16a3e2f56cd74c0b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-20 22:04:01 -07:00
Alexey Edelev
3c493b89df Remove WIN32 and MACOSX_BUNDLE arguments when building Android binary
This fixes the regression introduced in Android multiabi changes.

Amends 0a02d84555

Task-number: QTBUG-88841
Change-Id: I09e129361eb760cdc14c2302e821ce4fcbf117c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-20 21:18:38 +02:00
Tor Arne Vestbø
4ea32eaad0 macOS: Wake up event dispatcher after running modal dialog helpers
The root event loop may have been exited, so we need to ensure the
event dispatcher is woken up so it can evaluate whether it should
continue or not. For most applications this happens automatically
when e.g. the user moves their mouse or press a key, but for tests
this may not be the case, and the test will stall and never exit
its event loop.

Pick-to: 6.2
Change-Id: Ic241e3f1045481c34150289ff711b921addb18e4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-20 21:17:08 +02:00
Tor Arne Vestbø
132ed5eb51 Centralize maybeLastWindowClosed checking in QWindow
Instead of plumbing QWidgetWindow close events via handleCloseEvent,
we just implement closeEvent directly. This allows QWindow do save
the state of the window/widget before the close event, so that we
know whether we should trigger lastWindowClosed handling, even if
the window was deleted as a result of the close event.

This also relieves QGuiApplication and QApplication from dealing
with the close logic in their notify functions, so that these
functions can focus on the propagation of events -- not how the
event is handled.

Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-20 21:17:08 +02:00
Mårten Nordheim
c58a3a4aae QDateTime: Limit string processing to known boundaries
We were treating the input as if it was always reasonably good.
Since we know the max boundaries anyway lets just stop processing
when those are reached

Fixes: QTBUG-97489
Change-Id: Ibb78d6d51ad58454b2007ab46d54116ca0be5448
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 15:16:53 +00:00
Mårten Nordheim
faa4cfcae9 SSL: Update documentation wrt backends
Mention the platform-specific backends and add a section on packaging

Pick-to: 6.2
Fixes: QTBUG-97532
Change-Id: Ice78e32e81a719ccf237625e542d620662d3073e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-20 15:16:53 +00:00
Mårten Nordheim
3c5c13c639 QNI: Windows: support transportMedium
Brings support for transportMedium to NetworkListManager
backend. Which, with this patch, also uses winrt API because
there is no equivalent API available in NLM.

This API is so much nicer than NLM...

Task-number: QTBUG-91023
Change-Id: I360a3a197caa2aa4848c8f768aea6a09a68b0ed5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-10-20 17:16:53 +02:00
Sona Kurazyan
a9d51298ae Fix metatype declaration for QHash/QMultiHash with no operator==
When declaring metatypes, the metatype system tries to detect if the
comparison operators for the given type exist and automatically register
them. In case of QHash, the equality operator was enabled if the value
type provides one. But the implementation needs equality operator of
the key type as well. As a result, when the key type has no equality
operator, the metatype system detects that the equality operator is
available for the QHash itself, but the compilation for metatype
registration fails when trying to instantiate the code that uses
equality operator for the key. This is fixed by enabling equality
operators for the QHash only when both the key and value types provide
one.

The same issue existed also for QMultiHash, with the difference, that
QMultiHash didn't have the constraints even on the value type. So added
checks for both.

Fixes: QTBUG-96256
Pick-to: 6.2
Change-Id: Ib8b6d365223f2b3515cbcb1843524cd6f867a6ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 17:16:53 +02:00
Ulf Hermann
a182897f77 Help the compiler avoid duplicate TLS lookups
Most compilers are clever enough to optimize this out. Yet, even with
optimizations disabled, we don't want to do two TLS lookups here.

Change-Id: I822954c7cec591084d6c27c916818dab7e000ea9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-20 17:14:38 +02:00
Ulf Hermann
c6bc549b6b Optimize QObjectCompatProperty::notify
Do the check for inBindingWrapper() last.

Change-Id: I3d589c9fba524f465e35cd4cc0e65e3af376b419
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-20 17:14:38 +02:00
Ievgenii Meshcheriakov
af2f88f5b6 QObjectCompatProperty: Add support for custom getters
Add additional template argument to QObjectCompatProperty to specify
a custom getter. This may be useful for classes like
QAbstractProxyModelPrivate the need to customize property getters.

Task-number: QTBUG-89655
Change-Id: I34fe4bdebbbf1446aff60bd20a946454607f52d5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-20 17:04:51 +02:00
Karsten Heimrich
bb8d84c358 Make QDir::mkpath() return true when given an existing root path
On macOs with APFS mkdir sets errno to EISDIR, so take the error code
into account.

Pick-to: 6.2
Fixes: QTBUG-97110
Change-Id: I8e7d10c95430a2802bdbfbf94dd65219bd9071a7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-20 15:04:51 +00:00
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
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
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
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
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
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
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
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
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
Edward Welbourne
5417186692 Fix typo: alignment has an n in it
Change-Id: If64edd32c5084984227b3c366932b3129df94b31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-14 01:36:13 +02:00
Tor Arne Vestbø
954b58f368 Remove unneeded function QGuiApplicationPrivate::emitLastWindowClosed
It only has a single call site nowadays.

Change-Id: I6f486dec51f76e1fb231fb7276bc8c856885bee1
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-13 22:30:08 +02:00
Tor Arne Vestbø
947188b969 Fix references to QGuiApplication::lastWindowClosed
The signal is emitted from QGuiApplication these days.

Pick-to: 6.2
Change-Id: I7423cd4808e8df86960f225fd6e4a12a1a4f11f3
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-13 22:30:08 +02:00
Thiago Macieira
0df7831d01 qfloat16: re-merge the F16C content into qfloat16.cpp
The bugs we had noticed previously are believed to be fixed. MSVC will
do per-function updating of AVX content where necessary and the ICC
issue is no longer relevant.

Change-Id: I2bbf422288924c198645fffd16a9235f2d73cc19
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 12:49:49 -07:00
Thiago Macieira
cb0ea39895 CMake: remove support for building Qt with the old Intel compiler
This hasn't worked for some time. It's not in our CI and I don't think
it was working at all. When I tried to build it, I ran into several
problems with C++17 and an Internal Compiler Error I did not have any
interest in working around.

After discussing with the Intel compiler team, it was decided that
fixing those issues in the old compiler is not going to happen. Instead,
their recommendation is to adopt the new LLVM-based compiler, which
the last commit added support for.

This commit does not remove qmake support for the old ICC. It's possible
someone is using qmake with a non-Qt6 project and ICC.

Change-Id: Icb2516126f674e7b8bb3fffd16ad6350ddbd49e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-13 12:49:49 -07:00
Andreas Buhr
2630c15a3d Revert "[Android] Remove signal and slot mechanism to listen states in editor's"
This reverts commit a40a512dec.
It caused UI freezes and cursor position inconsistencies.
See the linked bugs.

Pick-to: 6.2 6.2.1 5.15
Task-number: QTBUG-58013
Task-number: QTBUG-93414
Task-number: QTBUG-95669
Task-number: QTBUG-96671
Task-number: QTBUG-96675
Task-number: QTBUG-96769
Change-Id: Ie8100538609a1460713ca9115cdbe329654d0772
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-13 20:36:00 +02:00
Friedemann Kleint
2160042dc3 XCB: Silence clipboard warning "SelectionRequest too old"
Use the predefined logging category for clipboard warnings
and change the offending  warning to qCDebug() so that it is silent
by default.

Pick-to: 6.2 5.15
Fixes: QTBUG-60257
Change-Id: Icf1bc84cd64207b94ef471f13090c43b45e20728
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-10-13 20:36:00 +02:00
Giuseppe D'Angelo
9422dd0e19 QList: remove yet another iterator->pointer implicit conversion
The ranged constructor for QList has an optimization when the
iterators are QList's own iterators. In that case, it uses a
"contiguous append" shortcut by converting the iterators to pointers.
Avoid that conversion by extracting the pointers from the iterators.

Note that this is an optimization for C++17 only; in C++20
appendIteratorRange will deal with this case as well. Leave a note.

Change-Id: I761c36ff500dee95b4ae1b0a4479d22db0c8e3de
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-13 19:34:36 +02:00
Giuseppe D'Angelo
507be11303 QArrayDataOps: improve appendIteratorRange
Handle contiguous iterators in there directly.

Change-Id: I3b6d45f993f82d0de5edbfcd75856f43a7f1263b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-13 19:34:36 +02:00
Giuseppe D'Angelo
14c5daad43 QList: code tidies
Do not rely on implicit pointer->QList::(const_)iterator conversions.
Amend QList's own code so to avoid them.

Change-Id: Ia3e7a83631943e636831217cdad28b73c98c1dc7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-13 19:34:36 +02:00
Mårten Nordheim
f828b47e43 Document QFutureWatcher::isFinished behavior change
in the Qt6 changes documentation

Pick-to: 6.2
Change-Id: Ief45c145cbb9353455af39060a3fb444afe3f1b9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-10-13 16:43:20 +00:00
Assam Boudjelthia
7235eeab19 Android: replace ndk.dir with android.ndkVersion in build.gradle
The use of ndk.dir in local.properties is deprecated in favor of
android.ndkVersion in build.gradle, and will be totatlly removed in
the future, so we need to adapt to that.

Fixes: QTBUG-91391
Pick-to: 6.2
Change-Id: I54c57113a759d43c3685c9cdf2b9dcc5c948c0fd
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2021-10-13 18:33:32 +03:00
Volker Hilsheimer
f7a4a79c62 Take overshoot into account when laying out QAbstractScrollArea
QAbstractScrollAreaPrivate::layoutChildren() positions the viewport, but
did not take the overshoot from scrolling with a scroller into account.
If the scroll area was resized during a scroll, then this resulted in the
roll back overcompensating for the overshoot, placing the viewport outside
the visible area.

Fix this by taking the overshoot into account when positioning the
viewport.

Add a test case. We have to use QWindow-based mouse event simulation, as
the QWidget based move events use QCursor::setPos, which doesn't reliably
go through the gesture framework.

Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Zhang Hao <zhanghao@uniontech.com>
Fixes: QTBUG-94769
Pick-to: 5.15 6.2
Change-Id: Idf650c91e5a9cffa996e23e743939243b1d4fcc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-13 14:27:12 +00:00
Friedemann Kleint
36a6d17af0 Windows QPA: Fix mouse event position for QWindows with Qt::WindowTransparentForInput
The local position needs to be corrected when the Qt receiver window
does not correspond to the native event receiver window.

Fixes: QTBUG-97095
Pick-to: 6.2 5.15
Change-Id: Ic9fa3d84b6ee84ae5f8fa2408b0d60e35dbfa328
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-10-13 08:37:17 +02:00
Giuseppe D'Angelo
2bd3c53a95 QLalr: use QList iterators in algorithms
There's no need to dereference+reference a QList's iterator
only to pass the result to an algorithm, just pass the iterator.

Change-Id: I7367010f6ab489d951715259bd51aeec790d3c84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-13 04:33:21 +02:00
Ivan Tkachenko
871802455e Doc: Fix \notes in QObject
Pick-to: 5.15 6.2
Change-Id: Ic442f56d3fb0c3e073c3cd69f193829958550296
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-13 02:40:32 +03:00
Ievgenii Meshcheriakov
9940e4812b Add suffixes to loop variables for Q_FOREACH
Currently using nested Q_FOREACH loops produces warnings about
shadowing local variables (if enabled). For example, this code:

    QList<int> aList;
    QList<int> bList;
    foreach (int a, aList) {
        Q_UNUSED(a);
        foreach (int b, bList)
            Q_UNUSED(b);
    }

produces the following warning with MSVC:

    warning C4456: declaration of '_container_' hides previous local
    declaration

This is due to using variable _container_ as loop variable for both
loops.

This patch appends current line number to the name of the loop
variables so that most of the uses of Q_FOREACH will not result
in shadowing.

The patch originally by Benoit Regrain.

Fixes: QTBUG-79081
Pick-to: 5.15 6.2
Change-Id: I55235e917e920171b138c8b3239a95dfe2ac7988
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-13 01:40:32 +02:00
Peter Varga
d24651d548 Guard WinRT API code for clang-cl
It is unsupported with clang-cl and breaks the build.

This is a fixup for:
  51e8d3592a Let QLocale::uiLanguages() use WinRT API when possible

Task-number: QTBUG-94341
Pick-to: 6.2
Change-Id: Icf32339e81d67d4c119b7fb8d8d834c744b9ead0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-12 21:34:02 +00:00
Jonas Kvinge
ced47a05aa openglblacklists: Fix typo in description
Pick-to: 5.15 6.2
Change-Id: I13fa34099daed8de8d23af3952aa18f1ecde7883
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-10-12 23:15:45 +02:00
Jonas Kvinge
cf81ccd1cd qwindowsdrag: Fix typo in documentation
Pick-to: 5.15 6.2
Change-Id: I4bd8ff5b4ddeee1760b012bd603b014d535534ed
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-10-12 23:15:45 +02:00
Jonas Kvinge
79e209c4c3 windows: Fix typos in source code comments
Change-Id: I5d83574639d0b1f935843a75217aae70a5925fa0
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-10-12 23:15:45 +02:00
Edward Welbourne
ba23507960 Fix handling of time-zone gap in QTimeZonePrivate::dataForLocalTime()
This was handled correctly when the backend supplies transitions
bracketing the time in question, but the fallback code tried to use
the DST offset at the time with larger offset from UTC; this did not
work when the gap was due to a change in standard time. Discovered by
ANS1 parsing of a date-time with two-digit year, for which the
date-time parser tried to use 1921-05-01T00:00 local time when filling
in the fields it had parsed; but, when run in Europe/Helsinki, there
is no such time due to the 20m 11s skipped when joining EET from the
prior local solar mean time.

Correct the calculation to use the actual change in offset from UTC,
as used in the (far better tested) between-transitions branch of the
code, rather than the DST offset after the transition.

Add a test-case based on the ASN.1 certificate date whose parsing
revealed the issue. Although it seems nothing in Coin can reproduce
the issue, the reporter has verified that the test does indeed fail on
the system where the bug was found and the fix does fix it.

Fixes: QTBUG-96861
Pick-to: 6.2
Change-Id: I12b02bad01daca2073d1a356452cd573684aa688
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-12 22:52:50 +02:00
Assam Boudjelthia
22e330db48 Android: remove unused imports and fix warning on network java code
Pick-to: 6.2
Change-Id: Ifa69c04f7f2e75751b6f8a157d04f3870f0c0eb1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 22:12:08 +03:00
Mike Achtelik
91d8443f6d CMake: Fix adding generated resources on iOS with CMake and Xcode
When adding resources generated via a custom command, the project fails
to configure when targeting iOS with CMake and Xcode with the error:

CMake Error in src/CMakeLists.txt:
  The custom command generating
    src/.qsb/TestShader.frag.qsb
  is attached to multiple targets:
    TestApp_other_files
    TestApp
  but none of these is a common dependency of the other(s).  This is
  not allowed by the Xcode "new build system".

This happens e.g. when using qt6_add_shaders, which adds a custom
command to generate the qsb files. Or by simply adding resources via
qt6_add_resources, which depend on a custom command.

The problem is that qt6_add_resources also adds the resource to a
second "fake" target ${target}_other_files via
_qt_internal_process_resource and _qt_internal_expose_source_file_to_ide.
See c7d1874cd1.
Since these targets do not have a common dependency CMake fails to
configure the project.

So lets fix it similar to change 1bd0a5ce02352a600367beb5a5421c8f8332e1fe
and let the ${target}_other_files depend in the main ${target}.

Pick-to: 6.2
Task-number: QTBUG-95763
Change-Id: Iecdb40993a91da8bfbf6553892f9b0722d2e886c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-12 17:36:57 +00:00
Volker Hilsheimer
8513bcd90c Fix caching of parsed border color values in CSS parser
When parsing CSS, a border-color value is parsed as four brushes, as css
allows assigning up to four values, one for each side.

When applying the CSS to the HTML, we accessed it as a color value,
which overwrote the parsed value with a QColor. So while we had a valid
parsed value (and didn't re-parse), the code accessing that value still
expected it to be a list, and thus failed to retrieve the data.

There are several ways to fix that, but the cleanest way without
introducing any performance penalty from repeatedly parsing (and in fact
removing a parse of the string into a color) is to enable colorValue to
interpret an already parsed value that is a list without overwriting the
parsed value again. To avoid similar issues in the future, add assert
that the parsed value has the right type in brushValues.

As a drive-by, speed things up further by making use of qMetaTypeId
being constexpr, which allows for it to be used in a switch statement.

Add a test case.

Fixes: QTBUG-96603
Pick-to: 6.2 5.15
Change-Id: Icdbff874daedc91bff497cd0cd1d99e4c713217c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-12 18:26:26 +02:00
Thiago Macieira
878b2047b5 QList::iterator: use templates for advancing operators
Because of the addition of the operator T*(), the expression "it + N"
where N was not exactly qsizetype but any other integer type was a
compilation failure because of ambiguous overload resolution.

With GCC it's apparently a warning:

 warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
 note: candidate 1: ‘QList<T>::iterator QList<T>::iterator::operator+(qsizetype) const [with T = char; qsizetype = long long int]’
 note: candidate 2: ‘operator+(char*, ptrdiff_t {aka long int})’ (built-in)

With Clang, it's an error:

 error: use of overloaded operator '+' is ambiguous (with operand types 'QList<int>::const_iterator' and 'ptrdiff_t' (aka 'long'))
 note: candidate function
        inline const_iterator operator+(qsizetype j) const { return const_iterator(i+j); }
 note: built-in candidate operator+(const int *, long)

Pick-to: 6.2
Fixes: QTBUG-96128
Change-Id: Ie72b0dd0fbe84d2caae0fffd16a06f23dd56b060
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 08:46:31 -07:00
Jonas Kvinge
2675c288e8 wasm: Fix source code comment typos
Change-Id: I9b2b76c01880c7bb515fdc1a6c4ef1f0bcf6be95
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-12 15:55:53 +02:00
Timur Pocheptsov
0e58b3db34 Don't send the default SETTINGS_INITIAL_WINDOW_SIZE
And don't set non-default large value in QNetworkRequest's constructor.
Some servers consider those values as 'flow control error'.

Pick-to: 6.2
Fixes: QTBUG-97384
Change-Id: I801b7c83fe7e7392a02ba653c36dfa8a22c21d1e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 14:08:08 +02:00
Topi Reinio
b836098179 Doc: Fix usage of \summary macro
The macro takes only one parameter, sentences must be wrapped in {}.

Pick-to: 6.2
Fixes: QTBUG-97441
Change-Id: I7177548a32a67d720c2b551d16c09d898b0fda51
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-12 14:08:08 +02:00
Volker Hilsheimer
3b6a027885 macOS: fix window activation when popup is open
On macOS, it is possible to right-click-open a context menu for a window
that is not active. This does not activate the window.

When then clicking into the window to activate it, the popup is closed,
but only after the WindowActivate events has been sent. This blocks the
event delivery, as QApplication (since commit 78264f333e)
interpreted activation changes while popups are open to be just delayed
focus events. The UI ends up in a broken state where focus cannot be set
on the widgets in the window.

To fix this, don't ignore such activation events on macOS. As a drive-by,
give the variables more meaningful names.

Note: We cannot call closeAllPopups before delivering WindowActivate,
as that would close the popup before the mouse event is delivered, making
it impossible to select any of the actions from the menu.

Ideally, clicking into a popup of an otherwise inactive application would
not activate that application (that is the default behavior for native
macOS applications), but that's out of scope for this patch.

Fixes: QTBUG-78750
Task-number: QTBUG-69710
Task-number: QTBUG-66513
Pick-to: 6.2
Change-Id: I6344370ae7be31630e37514e04918b2d6cb8b69a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-12 14:08:08 +02:00
Ievgenii Meshcheriakov
3715166539 QPoint: Don't claim that QPoint[F]::dotProduct() produces length squared
The documentation snippets name the result of dotProduct()
"lengthSquared", but it is just a coincidence, not the property of dot
product of two different points. Just name the result `dotProduct`
without claiming any properties.

Also fix the type of the result in the QPointF case.

Fixes: QTBUG-94979
Change-Id: I4c337dd8335953489eac86c07a219c0a2d232369
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 12:08:08 +00:00
Eskil Abrahamsen Blomfeldt
e05e3c7762 freetype/no-fc: Disambiguate fonts with different widths
When using the Freetype font database, we would ignore the
typographical width of loaded fonts, which could make it
impossible to select certain fonts in a family.

[ChangeLog][Freetype] Fixed a bug where fonts of different
width within the same family would be unselectable if the
Freetype font database (no-fontconfig configuration) was in
use.

Pick-to: 5.15 6.2
Fixes: QTBUG-89640
Change-Id: Ic9c17a7c3cc14eb7e942b05d6b21b7c1602816cf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-10-12 13:33:19 +02:00
Eskil Abrahamsen Blomfeldt
6f0d7eb92e RHI: Don't retain texture operations after frame is done
Retaining texture upload commands comes at a price, because it
means we also retain the backing storage, which could e.g. be
fullscreen buffers for applications on Wayland. These would
eventually be overwritten, but just clearing the array between
frames is also fine because the data is never reused and the
array is a QVarLengthArray anyway so it already has a lot of
reserved space.

Pick-to: 6.2
Change-Id: I7389487be67b671830787e30e1468c303b7ac5c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-12 11:33:19 +00:00
Giuseppe D'Angelo
95fd21a26a RHI: introduce a way to disable framebuffer clears on GL
On low-end hardware without fast framebuffer clears one can
significantly reduce the fill rate by disabling framebuffer clears
(provided, as it's usually the case, that the application has content
filling the entire framebuffer).

Add a couple of environment variables to do so, one to disable all
clears and one to disable only color clears (in case the surface is
requested without a depth buffer). Note that disabling all clears
on a surface *with* a depth buffer still requires
QSG_NO_DEPTH_BUFFER to be set, otherwise QtQuick is going to assume
that there is a clean usable depth buffer.

Change-Id: I96ad0a3d28dd0ab65cc960fb7cb2e0a8b6f35628
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-12 13:33:19 +02:00
Jonas Kvinge
5ed0974ef4 concurrent: Fix typo in documentation
Pick-to: 6.2
Change-Id: Ibe3715de704f420ba3796d19c9e78cd6204eb4e5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-12 10:52:03 +00:00
Jonas Kvinge
aa97bc5f6c concurrent: Fix namespace typo
Change-Id: I7fed1f3965f97a4e1c4d096bc19f98572ea35c53
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 12:52:03 +02:00
Jonas Kvinge
13b5c269d6 gui: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: I533f5a55cd0cd60a76990b552d7dab51a301ac1c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
30613163ba widgets: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: I6b77f0ec043d08da3b7958d780dce9595daf97a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
616802fe88 QEventDispatcherWasm: Fix typo in debug message
Pick-to: 6.2
Change-Id: I183de5fd477b9529dd5272c88a196b9bebf4ab66
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
00ebab71d3 gui: Fix typo in CMake feature
Pick-to: 6.2
Change-Id: Icf81eac4d12fb61bcec2ca92d118ce88f970522e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
6c4403e92a network: Fix typos in source code comments
Change-Id: Iff505451e3f00de2d753de0f1d891a73cf73ef0d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
1cebe7d7db network: Fix typos in messages
Pick-to: 5.15 6.2
Change-Id: Ibad852372c80a988efeabc2b0757bf238b92b9a3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
dce874415d QWindowsWindow: Fix typo in documentation
Pick-to: 5.15 6.2
Change-Id: Ib20b2f23e399b295e26b8c29084023e4e1361579
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
18e1711f7a corelib: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: I64d63af708bc6ddaabd12450eb3089e5077f849e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
231fec7ca2 corelib: Fix typos in source code comments
Pick-to: 6.2
Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
651d7debe1 gui: Fix typos in source code comments
Pick-to: 5.15 6.2
Change-Id: Ie53e5542a8f93856470982939ecd8ec90b323d69
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
5cb48619e2 xml: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: Ie2a4df380dc2e519a55db4457bd17e326e62046f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
9f701b6ffc tools: Fix typos in source code comments
Change-Id: I9666104a320f66b22c5144375ce7440bb59737e6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
f55c1fb3b4 cocoa: Fix typo in debug messages
Pick-to: 5.15 6.2
Change-Id: I0a4c344f2104241175a9bfce7cfc7128c3f7d3ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-12 12:52:02 +02:00
Jonas Kvinge
93f808b781 qcocoa: Fix typos in source code comments
Pick-to: 6.2 5.15
Change-Id: Ide20e1d133891890a7673c8403ea91b489baa8f6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-12 10:52:01 +00:00
Jonas Kvinge
9bf555e3c8 qcocoa: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: Ibf86b9b95715e20e8bf9c49a347f9c8ca0c04bb5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-12 12:52:01 +02:00
Jonas Kvinge
84d0d089a8 qwindowsxpstyle: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: I5dc4649783b0d4c2b17e0555b98874b83a5b9f30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 12:52:01 +02:00
Jonas Kvinge
12f937d909 styles: Fix typos in source code comments
Change-Id: If0f140f4ad02395bd0dd5eee08f90318d3a7e930
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 12:52:01 +02:00
Jonas Kvinge
72c7c96143 network: Fix typos in documentation
Pick-to: 5.15 6.2
Change-Id: I386c6e4a21dacb2553a39a073052dcf6d92a9854
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 12:52:01 +02:00
David Rosca
5f01d33dbf evdevtouch: Fix loading screen name for output mapping
Accidentally broken in 4b899a29fa

Change-Id: I8ff52153c3549fcda4ebd178cc4fc1ea9538be86
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
2021-10-12 12:52:01 +02:00
Jonas Kvinge
b64c6285f7 tls: Fix typos in source code comments
Change-Id: Iec42e4d0f3476bd421861a0139731ff89788ee23
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-12 11:29:15 +02:00
Mårten Nordheim
dc01509878 QNI: Add missing transportMedium documentation
I forgot

Fixes: QTBUG-97409
Change-Id: I5ee94b2cc4c70b6408bb9bb9368c6876f3179783
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 08:54:17 +00:00
Shawn Rutledge
826765f654 Select a single range of cells in QTableView, away from merged cells
- when there is no intersection between the current selection and the
  spans collection, get ranges for all cells, just as if no span exists
- when there is an intersection between the current selection and the
  spans collection, get separate ranges for each cell (as before)

This fixes the regular case of selecting multiple non-spanned cells
after some cells are merged (get a single range for all cells instead of
separate range for each cell). However, when selecting together a group
of spanned and non-spanned cells, you still get a separate range for
each cell. But this is normal behavior in similar applications; for
example in LibreOffice, you cannot select and merge spanned and
non-spanned cells: an error dialog tells you that it's not allowed.

Done-with: Christos Kokkinidis
Pick-to: 6.2
Fixes: QTBUG-255
Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-12 09:07:54 +02:00
Volker Hilsheimer
9a77230685 QTableWidgetSelectionRange: Make it possible to compare for equality
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.

Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-12 09:07:54 +02:00
Jonas Kvinge
9684764bda xml: Fix typos in source code comments
Pick-to: 6.2
Change-Id: I33aaefec7128009ca5e1b368fdb67e2fbcd06e30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-12 07:07:54 +00:00
Thiago Macieira
f11bc38850 QOffsetStringArray: rewrite in modern C++17
Less clunky due to having better constexpr support, plus fold
expressions.

Change-Id: I3eb1bd30e0124f89a052fffd16a6bc73ba79ec19
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 19:00:52 -07:00
Thiago Macieira
d105a7bd62 qconfig.cpp: Remove the install date
It's not used anywhere. It's been a legacy since 5.0 anyway.

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9740444c7f13b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-11 19:00:31 -07:00
Thiago Macieira
8e5fcf02bd QPlugin: add qt_plugin_query_metadata_v2() to dynamic plugins
They return a pointer to the actual header, skipping the magic string.
This is done in preparation for the header located in an ELF note, which
won't have the magic.

Change-Id: I3eb1bd30e0124f89a052fffd16a8229bec2ad588
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 18:59:52 -07:00
Thiago Macieira
c89286b26a QPlugin: suppress the "QTMETADATA !" magic in static plugins
The .qtmetadata section is already suppressed for static plugins, but we
carried this unnecessary magic string. For library file formats where we
don't have a scanner (Windows COFF PE), a library that linked multiple
static plugins could end up with multiple metadata found.

We can't suppress the header because the version of moc could be
different to the version of Qt, so we need to read the header version
too. Right now, the version isn't output by moc (all the logic is in
qplugin.h), but this could change again in the future. In any case, 4
extra bytes are not a big deal, so the header stays.

Change-Id: I3eb1bd30e0124f89a052fffd16a82088d8303081
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 18:59:45 -07:00
Sona Kurazyan
64e9312464 Fix compilation error with MSVC 2019 and C++20
Fixes: QTBUG-97425
Pick-to: 6.1 6.2
Change-Id: Id327e3494d1deae852f953211c0409a80beafe88
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-10-12 00:51:27 +02:00
Thiago Macieira
333b40a12e QUtf32: fix bad assertion in convertFromUnicode
Looks like it was copied from QUtf16::convertFromUnicode(), but for the
UTF-32 case that is not correct. UTF-16 to UTF-32 conversions can change
the length of the string due to surrogates.

There are unit test tests for creating and parsing UTF-32 headers, and
for detecting content as UTF-32, but there aren't any for UTF-32
conversions. I don't have time to add a full test for that.

Fixes: QTBUG-97122
Pick-to: 6.2 6.1
Change-Id: Ic17a33f599b844d8ab5dfffd16ab2c4cb6b0547d
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-11 11:08:15 -07:00
Mitch Curtis
2b77e779ce QGtk3Theme: implement appearance function to detect dark themes
This allows Qt Quick Controls to detect if a dark theme is in use,
and if so, use a dark theme of the current style (if available).

Fixes: QTBUG-93955
Pick-to: 6.2
Change-Id: I15fc8a2271acf9ba27232359056d5a681d4cffca
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-11 16:18:38 +02:00
Edward Welbourne
04419c2852 Set tm_isdst = -1 before calling mktime()
Leaving it set to 0 will cause mktime() to interpret other fields as
in standard time, potentially "correcting" them and tm_isdst to
represent the equivalent moment in daylight-saving time. Set it to -1
to tell mktime() to let the system work out whether the time is
standard or daylight-saving.

Change-Id: Id33d4cb0afdb14f236ca5ce04cf605610a30d712
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-11 16:01:56 +02:00
Edward Welbourne
299f016b5d Broaden condition on use of MS's localtime_s()
It's available on MinGW, so not limited to MSVC; and the MinGW
localtime() and localtime_r() fail in some cases where it works.

Use the generic name rather than _localtime64_s(), since localtime_s()
now just calls it; and, in any case, we were assuming time_t is
__time64_t when calling it.

Change-Id: I316cc5b1a3e19cd6725555042dfaba3124a25a03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-11 16:01:56 +02:00
Alexander Neumann
a4e9ea7a1f avoid max macro expansion on windows if NOMINMAX is missing
Pick-to: 6.2
Change-Id: I1c19da59bdf97a434be52239c2a5b1b517341bcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-11 14:01:56 +00:00
Volker Hilsheimer
44b9aec8d9 QDialog: respect WA_ShowWithoutActivating
QDialog overrides setVisible to set focus on the default push button, or
(if there is no such button), make the first autoDefault push button the
default button. QDialog also explicitly sends a FocusIn event to the
focus widget in the dialog.

All this should not be done if the dialog does not become active after
getting shown, which will be prevented if the WA_ShowWithoutActivating
attribute is set.

Add a test case.

Fixes: QTBUG-8857
Pick-to: 6.2
Change-Id: If47021a4721a280ba45e95b43d0424cdacd9b4ea
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-11 15:48:33 +02:00
David Skoland
3fc58a5ed8 Remove union in QFileSystemEngine
The need for this union has disappeared at some point during refactoring
It does confuse MemorySanitizer, though, so it's good to remove it.

Change-Id: I5f5050adba302bf96db96d5f303d2a25630543ce
Fixes: QTBUG-97109
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-11 15:46:46 +02:00
Volker Hilsheimer
6c4dc722cb Reduce the width of a hfw-widget if scrollbar would be flipping
For a widget that implements height-for-width, the vertical scrollbar
becoming visible might be just enough to make the scrollbar unnecessary.
In that situation, the scrollbar flips on and off continuously.

To avoid that situation, make the width of the widget smaller until the
height fits without scrollbar, up to the point where we have space for
the scrollbar anyway.

The calcuation here is assumed to be cheap, but depends on the
heightForWidth implementation in the widget. Running the while-loop a
few dozen times should have no performance impact during resizing
and laying out the scroll area contents.

Add a test that confirms that within a brief period of time we only get
the one hide-event we expect.

Done-with: Zou Ya <zouya@uniontech.com>
Fixes: QTBUG-92958
Pick-to: 6.2 5.15
Change-Id: I0faeb5f9b1a226aada958c18333d9c2ac8203dd1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-11 10:49:57 +02:00
Timur Pocheptsov
dd57605b9e Http/2 - handle PADDED flag correctly
Previously, when deciding where the actual data is, Frame was calling
padding() to test if offset is needed. A curious case with a DATA frame
containing compressed body and having 'PADDED' flag set with a padding
equal to ... 0, ended in a decompression error (and assert in 6.2 code).

Pick-to: 6.2 5.15
Fixes: QTBUG-97179
Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-09 12:49:01 +02:00
Qiang Li
5d4b91ea66 Fix QTabBar's SelectPreviousTab behavior
When setCurrentIndex is called by removeTab, the old current index
might no longer be valid. Only update the lastTab value of the new
current tab if the old current index is still valid.

As a drive-by, use the validIndex helper function.

Fixes: QTBUG-94352
Pick-to: 6.2
Change-Id: I945e2093a90a1fccbba86d32b1113f83fedd41de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-09 05:41:00 +02:00
Ievgenii Meshcheriakov
4682af483f QString: Use QStringIterator in QtPrivate::isRightToLeft()
This simplifies the code. While at it, also expand default case
so changes in the QChar::Direction enum don't go unnoticed.

Change-Id: Id52140b0aaf7fd259c4b8079462811603eb3ff93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-09 02:54:45 +02:00
Fabian Kosmale
e5183c49dd androiddeployqt: Use QElapsedTimer to get elapsed time
No need to reinevent the wheel. Also, use nanoseconds
now that we have the precision available.

Change-Id: I287d06198edc3f5bdf7f85bd5f3e235b1fea95a3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-08 20:03:22 +02:00
Sona Kurazyan
ce59ccb334 Optimize QPromise destructor
Unify cancel and finish in QPromise destructor in a single call. This
saves us one extra mutex lock and atomic state change.

Task-number: QTBUG-84977
Change-Id: Iac06302c39a2863008b27325fcf6792d4f58c8ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-08 17:17:20 +02:00
Mårten Nordheim
22248a4e96 QNI: Windows: Remove unneeded friend
Change-Id: I5d66a67a5c16a479f62b9f43cb769d5ee5f66b60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-08 14:46:14 +02:00
Joerg Bornemann
08a0ba5733 Doc: Prettify -G cmake arguments in SQL drivers documentation
Use '-G Ninja' instead of '-G"Ninja"'.

Pick-to: 6.2
Change-Id: I53a77ea3b2d1547bb516b3ab756f5ae0f24092b1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-08 14:16:51 +02:00
Joerg Bornemann
bf9f0844c2 Doc: Fix cmake build/install commands in SQL driver documentation
Pick-to: 6.2
Fixes: QTBUG-97098
Change-Id: I1c5214d66341aa412c5fc9b2de6d0e26ba4612aa
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-08 14:16:51 +02:00
Laszlo Agocs
46e6a9a759 gl: Try the local CacheLocation when the shared one fails
We prefer the shared cache path, because there is no reason to give up
benefitting from sharing the content between applications. If that path
is not QFileInfo().isWritable(), we fall back to the local cache path.

However, there are reportedly systems with security solutions such as
AppArmor where the writable check passes and yet attempting to create a
file still fails. Then there is no cache in effect, because nothing ever
gets written out.

Handle this better: if writing the file fails and we still use our first
choice, the global cache location, fall back to the secondary choice
(the app-local path) and try again.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-96789
Change-Id: Ifea32e9af0cf85aa70f3069256ed3d6a7e2fbe90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dalton Durst <dalton@ubports.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-10-08 11:07:15 +02:00
Laszlo Agocs
cef788f398 rhi: metal: Query supported sample counts from the device
Check if 2, 4, 8 are actually supported.

Pick-to: 6.2
Fixes: QTBUG-97146
Change-Id: I23c22c2bfeb072b9658f3b5dfba51dd6dc850de3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-10-08 11:07:15 +02:00
Mitch Curtis
3fbf1f13ae Doc: clarify case sensitivity in QCompleter
This was confusing for me, being unfamiliar with the API.

Pick-to: 6.2 5.15
Change-Id: I831c6d0aa30847e069a7c21c279f147a1b24e486
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-08 08:00:39 +02:00
Thiago Macieira
1bac82fa99 QtTest: fix build with MinGW/GCC 9: no std::mutex support
Unfortunately we can't depend on the C++11, 14 or 17 Standard
Library, which is not properly and completely implemented
everywhere. All Library features above C++98 must be checked with
their corresponding __cpp_lib macro before use. This does not
apply to the C++17 Core Language.

qwaitcondition_p.h:144:20: error: 'mutex' in namespace 'std' does not name a type
  144 | using mutex = std::mutex;
      |                    ^~~~~
qwaitcondition_p.h:59:1: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   58 | #include <condition_variable>
  +++ |+#include <mutex>
   59 | #include <mutex>
qwaitcondition_p.h:145:33: error: 'condition_variable' in namespace 'std' does not name a type
  145 | using condition_variable = std::condition_variable;
      |                                 ^~~~~~~~~~~~~~~~~~
qwaitcondition_p.h:59:1: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
   58 | #include <condition_variable>
  +++ |+#include <condition_variable>
   59 | #include <mutex>

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9249e5330136a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-08 00:09:33 +00:00
Volker Hilsheimer
e0b6b27d39 Add style hint for preventing spin box selection on up/down
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.

This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.

[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.

Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-08 00:45:18 +02:00
Mårten Nordheim
1834fcad33 QNI: NetworkListManager: Extract the Events class
Moving the class out makes it easier to navigate the code

Change-Id: I8de67641512a7dbbf6446cdca9d8dea79a63c217
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:47 +02:00
Mårten Nordheim
5d941c7660 QNI:NetworkManager: Update dbus interface usage
We were using the non-standard interface for PropertiesChanged, and
support for this was dropped in a Network Manager update earlier this
year[0].

Switch to using the standard interface.

[0] https://networkmanager.dev/blog/networkmanager-1-32/

Pick-to: 6.2
Change-Id: Ibdf2b635ae13a3150c4d2faa028c15c70c8af5ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2021-10-07 19:08:39 +02:00
Mårten Nordheim
5d2fa94297 QNetworkInformation: support transportMedium with NetworkManager
Task-number: QTBUG-91023
Change-Id: Ie50e29ec321768ec6d0358d96a8c36b9b7cb10ba
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:35 +02:00
Mårten Nordheim
5b8a4c2063 QNI:Android: unify behavior of callbacks
The first callback added for the android backend does not have the value
as a parameter which is something the other callbacks have. Change it so
it does.

And promote the lambda to a real function.

Change-Id: I06f10f7c79f33a5ea3154f2fc6d20d550cd7eca7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:30 +02:00
Mårten Nordheim
589389843c QNetworkInformation: add support for transportMedium on Android
It's part of the capabilities which we are already using. It also lets
us work around a pre-existing edge-case where, if you have a VPN enabled
and enable Airplane mode it will continue to tell you it is Online even
when it is not. This happens because VPN is reported as a transport and
when Airplane mode is enabled it may be left enabled as the _only_
transport.

At the same time clear the default filters (if any), and filter out
suspended connections. May not necessarily make any difference.

And add a comment for why we cannot use a technically more suitable
type of callback.

Task-number: QTBUG-91023
Change-Id: Ic26c4d4e8da139ec8606a0b1bf5fb7157bd0beaf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:26 +02:00
Mårten Nordheim
7fb855e175 QNetworkInfo: Add transport medium detection API
The new public API returns and notifies changes to the currently active
transport medium for the application. And there's a new private API to
report it, with backends to follow.

Task-number: QTBUG-91023
Change-Id: I527985f9dabcd7bc4a32f36597e21bc4ab664c4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:23 +02:00
Fabian Kosmale
d9f6fba385 Fix compilation with -trace
Fixes: QTBUG-97241
Pick-to: 6.2
Change-Id: I877c6f0792ad2281ccfc73b7549dad7d6bd68995
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-07 17:42:38 +02:00
Doris Verria
911c97f2b5 QCocoaWindow: Make window key if the app's modal window is hidden
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.

However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.

This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.

Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-07 14:30:53 +00:00
Edward Welbourne
c1281c306c Fix handling of grouping characters when validating doubles
In QDoubleSpinBoxPrivate::validateAndInterpret() some code still
assumed checking one entry in a QString is enough (it isn't - the
grouping separator may be a surrogate pair) and nothing considered the
case of an empty grouping separator (as can arise if the user sets
that in their system configuration, as a brute-force way to suppress
digit-grouping). Failure to consider this case failed an assertion on
dereferencing the first character of the separator.

Handle the case of empty separator and suppress tests that try to
match a separator, when there is no separator.

Pick-to: 6.2
Fixes: QTBUG-96734
Change-Id: I63d3205ef8656a2cd2c0d855a25e712ad66e2429
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-07 14:22:56 +02:00
Morten Johan Sørvig
7b46ba165e Add message debug entry for DPI change events
WM_GETDPISCALEDSIZE and WM_DPICHANGED.

Pick-to: 6.2
Change-Id: I0614b0f552e52fc77d026dbc7e8c13b05f7d0e9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:56 +02:00
Morten Johan Sørvig
81707951fe Fix programatic geometry change to different DPI
The event flow for programatic window geometry change
(e.g. from MoveWindow()) differs from user-interactive
geometry change: We still get WM_DPICHANGED, but this
event is not preceded by WM_GETDPISCALEDSIZE, so we don’t
get to override the window size.

However, Qt has already scaled the window size for the
new DPI in this case (the scaled size is provided to
QWindowsWindow::setGeometry()), so we can omit making
second native set-geometry call.

Pick-to: 6.2
Change-Id: Ia7d42d7fee49adf757e7fe75d77f1731405ad519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:55 +02:00
Morten Johan Sørvig
2cfca7fd19 Handle WM_GETDPISCALEDSIZE
By handling WM_GETDPISCALEDSIZE we can keep QWindow’s
device independent size constant across DPI changes.
This is done by scaling QPlatformWindow’s native size
such that the change of scale factor and change of
QPlatformWindow size cancels out.

Qt now handles DPI change using two events:

WM_GETDPISCALEDSIZE: Compute the new size for the window.
WM_DPICHANGED: Apply the new DPI and window geometry.

The reason for this complication is that Windows retains
control over the window position during the DPI change,
in order to e.g. accurately track the cursor position
during a screen change.

The default WM_GETDPISCALEDSIZE implementation (provided
by Windows) scales the win32 window size linearly with
the DPI change. We want to use linear scaling as well,
however the win32 window size includes the margins, which
do not change linearly as the DPI changes.

Instead, scale the QPlatformWindow size, and then add
the new margins.

Pick-to: 6.2
Change-Id: I4f225be8fad56b1fa77e9e3cfd6538a206589d73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:55 +02:00
Morten Johan Sørvig
cd96d87011 Move VM_DPICHANGE handling to QWindowsWindow
We want to have as little code in the QWindowsContext
event switch as possible.

Pick-to: 6.2
Change-Id: I04d578aae81c4ee804310a70bd87ee60b2890b6a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-07 14:22:55 +02:00
Kai Köhne
3936648c60 Doc: Remove mentioning of CMake 3.9 minimum version
Change-Id: Ia63bc7f305e673588ec57a7405ed5c0fdf3f5074
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-07 14:22:55 +02:00
Volker Hilsheimer
51300566ff Fix closing and showing a window with a native child
Closing a window with a native child results in the native child's
QWidgetWindow being closed. That explicitly calls setVisible(false)
on the child, which will still have the ExplicitShowHide attribute
set from the initial (explicit) show. Even though we then reset
the ExplicitShowHide, the WState_Hidden attribute will still be
set, so Qt considers the window to have been hidden, and not show
it again when the parent becomes visible.

Add a test case.

Fixes: QTBUG-96286
Fixes: QTBUG-79012
Fixes: QTBUG-71519
Change-Id: I482e6d5236c959d82ce66798176b259a3176972c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-10-07 12:54:10 +02:00
Ulf Hermann
5d17487723 Return a plain QMetaObject* from toDynamicMetaObject()
The only place where we use it, we swiftly cast it to QMetaObject*
anyway. Generating an object with virtual methods, only to then cast to
its non-virtual base type is dangerous. Also, if we are required to
return a QAbstractDynamicMetaObject from a method of
QDynamicMetaObjectData, we cannot implement QDynamicMetaObjectData
without also implementing QAbstractDynamicMetaObject. This indirectly
forces us to copy metaobjects around as we cannot wrap an existing
metaobject into a QDynamicMetaObjectData subclass.

Copying metaobjects around makes QMetaObject::inherits() unusable
because inherits() assumes identity is determined by identity of the
pointer.

Change-Id: Icbe697efa6fd66649eef3c91260c95cda62e3c90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-07 12:54:10 +02:00
Volker Hilsheimer
638e0c3144 Silence static analyzer warning
The static analyzer can't see that the QPointer not being null implies
that the QWidget pointer is still valid. Since we reset the widget
pointer to nullptr earlier on if the QPointer is null, just test for the
widget pointer instead.

Amends f6befd3e63 and fixes report
020fbdde70065e8de370537304d13d21.

Change-Id: I715764956a02b1300766a3cea2d427f840f1cec8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-07 10:54:10 +00:00
Eskil Abrahamsen Blomfeldt
4d47b18c81 Revert "Support family names that end/start with space"
This reverts commit 7fd9ed3201.

While trimming the font name worked for cases with application fonts,
it actually introduced an assert for system fonts that ended with a
space, because enumerating these failed. So the original assumption
that all Windows APIs also trimmed the family name was wrong.

The original bug was that the font with the trailing space could
not be selected, but when using setFamilies(), it can. So there is
a perfectly fine way around the original bug when using a font that
has this problem. Therefore, no additional fix is needed for that.

[ChangeLog][Windows] Fixed an assert that happened when the system
had a font with a trailing or leading space in its name.

Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-93885
Task-number: QTBUG-79140
Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-07 12:35:04 +02:00
Ulf Hermann
7ecb3d3f1a QPlatformFontDatabase: Don't copy metaobjects
This is expensive and unnecessary here.

Change-Id: I542c0309db5839c696f51b066cd5423a63468438
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-07 11:25:24 +02:00
Ilya Fedin
62a81bddfa Always fallback opening URLs to the regular way if portal fails
Even if the code fails, the runtime will have a xdg-open binary
that supports the required API (portals in flatpak and userd launcher
in snap)

Task-number: QTBUG-83939
Change-Id: I8527cfe20411c535686b7171ff9ef285ab9e10aa
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-07 01:54:36 +04:00
Thiago Macieira
46fc01d7ca QElfParser: rewrite using elf.h
This rewrite uses the actual structures supplied by the system's C
library, so it should be easier to read. It removes hardcoded constants
with little evident meaning in favor of sizeof() and the macros from
that header. It also removes advancing the data pointer in favor of
having absolute offsets.

The resulting implementation is stricter than the original, checking
more fields in the header. Because the QPluginLoader and QFactoryLoader
users may make decisions based on availability of plugins before
attempting to load them, it's better to be stricter here than to fail
later when trying to dlopen() them.

Debugging and testing are much improved. Instead of stored artifacts, I
added a routine to modify a valid plugin to make it invalid, given the
conditions we've found so far.

If you turn debugging on for this category, you'll see things like:

 not-elf.fcqdMq.so : Not an ELF file (invalid signature)
 wrong-word-size.QrnSAx.so : ELF 32-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-word-size.bOkXvp.so : Invalid ELF file (class 0), LSB (GNU/Linux)
 unknown-word-size.ogYKeF.so : Invalid ELF file (class 66), LSB (GNU/Linux)
 wrong-endian.owiElX.so : ELF 64-bit MSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-endian.FRxClR.so : ELF 64-bit invalid endianness (0) (GNU/Linux)
 unknown-endian.FfvRrP.so : ELF 64-bit invalid endianness (65) (GNU/Linux)
 elf-version-0.gPTdpQ.so : ELF 64-bit LSB (GNU/Linux), file version 0
 elf-version-2.jlIUUg.so : ELF 64-bit LSB (GNU/Linux), file version 2
 executable.LlXiFp.so : ELF 64-bit LSB (GNU/Linux), version 1, executable, x86-64
 relocatable.UsOYuy.so : ELF 64-bit LSB (GNU/Linux), version 1, relocatable, x86-64
 core-file.hqvNRz.so : ELF 64-bit LSB (GNU/Linux), version 1, core dump, x86-64
 invalid-type.CIJgfS.so : ELF 64-bit LSB (GNU/Linux), version 1, unknown type 259, x86-64
 wrong-arch.UcNmgz.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, AArch64
 file-version-0.lZYuda.so : ELF 64-bit LSB (GNU/Linux), version 0, shared library or PIC executable, x86-64
 file-version-2.ucfdwL.so : ELF 64-bit LSB (GNU/Linux), version 2, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : contains 0 sections of 64 bytes at offset 0 ; section header string table (shstrtab) is entry 0
 no-sections.rSjsHh.so : no section table present, not able to find Qt metadata
 qtmetadata-executable.vrxcIf.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 qtmetadata-executable.vrxcIf.so : contains 42 sections of 64 bytes at offset 997256 ; section header string table (shstrtab) is entry 41
 qtmetadata-executable.vrxcIf.so : shstrtab section is located at offset 996831 size 423
 qtmetadata-executable.vrxcIf.so : section 0 name "" type NULL flags X offset 0x0 size 0x0
 qtmetadata-executable.vrxcIf.so : section 1 name ".note.gnu.property" type NOTE flags AX offset 0x2a8 size 0x30
 qtmetadata-executable.vrxcIf.so : section 2 name ".note.gnu.build-id" type NOTE flags AX offset 0x2d8 size 0x24
 qtmetadata-executable.vrxcIf.so : section 3 name ".hash" type HASH flags AX offset 0x300 size 0x44c
 qtmetadata-executable.vrxcIf.so : section 4 name ".gnu.hash" type 0x6ffffff6 flags AX offset 0x750 size 0x3b8
 qtmetadata-executable.vrxcIf.so : section 5 name ".dynsym" type DYNSYM flags AX offset 0xb08 size 0xd50
 qtmetadata-executable.vrxcIf.so : section 6 name ".dynstr" type STRTAB flags AX offset 0x1858 size 0x15d8
 qtmetadata-executable.vrxcIf.so : section 7 name ".gnu.version" type 0x6fffffff flags AX offset 0x2e30 size 0x11c
 qtmetadata-executable.vrxcIf.so : section 8 name ".gnu.version_r" type 0x6ffffffe flags AX offset 0x2f50 size 0xb0
 qtmetadata-executable.vrxcIf.so : section 9 name ".rela.dyn" type RELA flags AX offset 0x3000 size 0x480
 qtmetadata-executable.vrxcIf.so : section 10 name ".rela.plt" type RELA flags AX offset 0x3480 size 0x7e0
 qtmetadata-executable.vrxcIf.so : section 11 name ".init" type PROGBITS flags AX offset 0x4000 size 0x1b
 qtmetadata-executable.vrxcIf.so : section 12 name ".plt" type PROGBITS flags AX offset 0x4020 size 0x550
 qtmetadata-executable.vrxcIf.so : section 13 name ".plt.got" type PROGBITS flags AX offset 0x4570 size 0x8
 qtmetadata-executable.vrxcIf.so : section 14 name ".text" type PROGBITS flags AX offset 0x4580 size 0x110e
 qtmetadata-executable.vrxcIf.so : section 15 name ".fini" type PROGBITS flags AX offset 0x5690 size 0xd
 qtmetadata-executable.vrxcIf.so : section 16 name ".rodata" type PROGBITS flags AX offset 0x6000 size 0x473
 qtmetadata-executable.vrxcIf.so : section 17 name ".qtversion" type PROGBITS flags AX offset 0x6478 size 0x10
 qtmetadata-executable.vrxcIf.so : section 18 name ".qtmetadata" type PROGBITS flags AX offset 0x64a0 size 0x19b
 qtmetadata-executable.vrxcIf.so : found .qtmetadata section
 qtmetadata-writable.stzwrk.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64

Change-Id: I42eb903a916645db9900fffd16a4437af9728eea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-06 12:12:53 -07:00
Timur Pocheptsov
3abcff49eb QTlsBackend (OpenSSL) : detect incompatible versions
OpenSSL v3 among other nice things brought some nasty crashes
(essentially, finally breaking what was already not so nice
in 1.x: see, e.g. ASN1_ITEM_free and ASN1_ITEM_ptr that we
have to use to free resources allocated by openssl). Let's,
at least, not use v3 from Qt built with 1.1.1 and vice
versa.

Pick-to: 6.2 5.15
Change-Id: If14a2a0ce2189a1b7967b7ab7248d11d0f2fc423
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 21:12:53 +02:00
Assam Boudjelthia
b02d88e416 Android: Update and add missing gradle files for jar folders
Update the build.gradle for main Qt jar code, and add same files for
network and network information backend, so the code can be managed
from Android Studio.

This also adds .gitignore to ignore Android Studio build artefacts.

Pick-to: 6.2
Change-Id: Ic06e9d12708070fad112f17e58b8754608d184f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 16:05:19 +03:00
Assam Boudjelthia
3dbca82f86 Android: use gradle repo mavenCentral() instead of jcenter()
jcenter() is deprecated and will be shutdown by next year [1], thus
the replacement mavenCentral() could be used instead.

[1] https://blog.gradle.org/jcenter-shutdown

Pick-to: 6.2
Change-Id: Ic9d1c15d657f23712ee4c866d5c1a45706353429
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 16:05:18 +03:00
Allan Sandfeld Jensen
733923c81c Add a safer way to use QThreadPool::reserveThread
Add startOnReservedThread that specifically releases a reserved thread
and uses it atomically for a given task. This can make a positive
number of reserved threads work.

Change-Id: I4bd1dced24bb46fcb365f12cbc9c7905dc66cdf1
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-06 14:55:20 +02:00
Ilya Fedin
816c5de460 Add support for EGL_EXT_platform_xcb
This allows to create EGL context without involving Xlib.
This extension was created a year ago and is present in Mesa since 21.0

Change-Id: Id9bcbffe8c46cb00d9cc0a9a425c1706d1b52b28
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-06 15:34:17 +04:00
Alex Trotsenko
82b86960c0 QLocalSocket/Win: stop reading in close()
After calling close(), the socket can enter 'Closing' state, in which
we try to write buffered data before disconnecting. As the device is
already closed, we must disable any pipe reader activity and clear the
read buffer.

Change-Id: I8994df32bf324325d54dd36cbe1a1ee3f08022d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-10-06 10:16:14 +03:00
Tor Arne Vestbø
b689d8dccd macOS: Disable PCRE JIT when running under Rosetta
Although the Apple docs claim that Rosetta can translate apps that
contain just-in-time (JIT) compilers, it seems to have problems with
the PCRE JIT.

https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment

To be on the safe side we disable the JIT explicitly when detecting that
we are running under Rosetta. It's already disabled when we're running
on macOS ARM natively (see 2f8df4d1a8).

Fixes: QTBUG-97085
Pick-to: 6.2
Change-Id: I0e133939f28087560d4bc8354b7e49013e94a9f9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-05 20:28:41 +00:00
Wang Chuan
60caec953f macOS: Ensure cancelOperation is sent as regular key event
Since 9e1875483c the logic of sending
QKeyEvent was changed to only happen when we explicitly decided to not
treat input as complex text, or when a selector for a command was not
found. This missed the case where we handle cancelOperation by falling
back to sending a regular key event. We now set m_sendKeyEvent to true
to trigger this logic.

Fixes: QTBUG-97119
Pick-to: 6.2
Change-Id: Ibb72f4b068cce735db8d76e5e0a1882aae115207
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-05 20:28:41 +00:00