Commit Graph

52879 Commits

Author SHA1 Message Date
Joerg Bornemann
b073de274d qmake: Recognize MSVC 16.x as VS 2019 in the VS project generator
In a subsequent comment we will set the qmake variable MSVC_VER to 16.8
to check for the availability of certain compiler flags that were
introduced in that compiler version.

The old code compared exact version strings.  With this patch we're
checking version ranges instead and handle MSVC_VER 16.x as VS 2019.

Pick-to: 6.2 5.15
Task-number: QTBUG-89296
Change-Id: I9ea24a66f68a342a72f5c2a285bafacb8786661b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-26 18:32:44 +02:00
Tatiana Borisova
664a7947be Check QMake support for building apps on INTEGRITY
-Add integrity QMAKE_* paths for SA8155P device

Task-number: QTBUG-95671
Pick-to: 6.2
Change-Id: Ife60cf2db74bfd0c47103e2dd6aaa73609d856d2
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2021-08-26 19:32:44 +03:00
Mårten Nordheim
b3c0537404 QNetworkCookie: Fix use-after-free
The code was previously calling indexOf() on a temporary, which
QRegularExpression would create backing storage for.
After 11d1dcc6e2 the internals were made
to use the QStringView path, which inadvertently meant that there was
no storage for the temporary string anymore. So we need to keep it alive
ourselves.

Change-Id: I542da7010934594eba3b93261322963866ed9297
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 18:16:41 +02:00
Lars Schmertmann
0755eba5e8 Android: Add information about who launched this activity to intents
* With this change, applications can easily determine the source
  of an intent without creating an own extension of QtActivity.
* https://developer.android.com/reference/android/app/Activity#getReferrer()

Task-number: QTBUG-84382
Pick-to: 6.2
Change-Id: I6a5200af1d997640f02e2b934343914fb5f32ccc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-08-26 15:44:12 +00:00
Ievgenii Meshcheriakov
4bf3010378 QUrl: Implement UTS #46
UTS #46 (https://unicode.org/reports/tr46/) is a successor to
IDNA 2003/2008 standards from Unicode.

The current implementation uses nontransitional processing by default.
An optional argument is added to QUrl::toAce() and QUrl::fromAce() to
allow using transitional processing and to ignore the IDN whitelist.

[ChangeLog][QtCore][QUrl] ACE processing is now performed according
to the UTS #46 standard based on IDNA 2008 instead of IDNA 2003.

Task-number: QTBUG-85371
Change-Id: I46b2e86792bc9699cb6961bae8e283fbff72f874
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 16:55:05 +02:00
Ievgenii Meshcheriakov
f5360b7c72 unicode: Regenerate Unicode tables
Re-run unicode utility to update the Unicode tables. This adds
properties and mappings needed to implement UTS #46 (IDNA).

Task-number: QTBUG-85323
Change-Id: Id1de91caddd82095f8f8f2301bfd7bb2ee3fcafd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 16:55:05 +02:00
Ievgenii Meshcheriakov
2afe1a3c19 unicode: Generate tables for IDNA/UTS #46
Update the Unicode data processing tool to generate properties
and mapping tables needed to implement UTS #46
(https://unicode.org/reports/tr46/). The implementation extends
the standard to allow usage of underscores in URLs. This is done
for compatibility with DNS-SD and SMB protocols.

The data file needed to generate the new properties was taken from
https://www.unicode.org/Public/idna/13.0.0/IdnaMappingTable.txt

Task-number: QTBUG-85323
Change-Id: I2c303bf8a08aefb18a7491fb9b55385563bfa219
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 16:55:05 +02:00
Alexandru Croitor
0dbf73e3de CMake: Warn when PRIVATE_MODULE_INTERFACE is provided with no target
Warn if the PRIVATE_MODULE_INTERFACE option is provided a value, but
there is no ${target}Private target to set the interface dependencies
on.

Pick-to: 6.2
Task-number: QTBUG-95921
Change-Id: I7d4df9cb3aa9b7746d836b82019ecdd9c8f50fdc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-26 16:40:15 +02:00
Alexandru Croitor
80705298ca CMake: Build a subset of tests when targeting iOS in the CI
Add infrastructure to build cmake auto tests in the CI when targeting
iOS.
Currently the are only CI instructions for qtbase.
More work is needed to make it work for other repos.

With this change, we will build a single Widgets application targeting
the iOS simulator. We can't target the device SDK in the CI because
signing fails due to a missing signing certificate and provisioning
profile.

The Coin instructions will now set a QT_BUILD_ENVIRONMENT=ci env var
whose value will be checked in _qt_internal_test_expect_pass, to
ensure we build for the simulator SDK when using a universal Qt.
Without this, xcodebuild will try to build with the device SDK and
fail to build the project.

Pick-to: 6.2
Task-number: QTBUG-95839
Change-Id: Ib39c9527b107b2004746ccbdc9d9d1d658f88c76
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-26 16:40:15 +02:00
Alexandru Croitor
1f3949a5a8 CMake: Make _qt_internal_test_expect_pass more configurable
Introduce new options: NO_CLEAN_STEP, NO_BUILD_PROJECT_ARG,
GENERATOR, MAKE_PROGRAM, BUILD_TYPE.

If cache or env var QT_CMAKE_TESTS_ADDITIONAL_CONFIGURE_OPTIONS is
provided, the value is interpreted as a list of additional configure
arguments to pass to the built project.

Also skip adding a test command if there is no BINARY or BINARY_ARGS
option provided.

Pick-to: 6.2
Change-Id: I3a1d82b41a734dcd3f473e59cc64efd00363e49b
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-26 16:40:15 +02:00
Laszlo Agocs
ae306b1c5a rhi: Polish some feature flag docs
Clean a bit, also enhance, e.g. mention textureLod for TexelFetch which
is how Quick3D uses it, and most notably expand the "in practice" notes.
As no application or library can be expected to write fully conditional
code based on all these flags, knowing when a certain feature is
(un)supported in a real run time environment is essential in order to
make informed decisions on when and in what manner (i.e. with or without
conditions), rely on a given feature.

Pick-to: 6.2
Change-Id: I15ea34e11bd345b36248f92de9b1fdb1fdc3e8d9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-08-26 15:31:53 +02:00
Laszlo Agocs
afa0ce9045 rhi: gl: Allow passing in a custom shareContext
We already honor AA_ShareOpenGLContexts and pass in the QGuiApp's
context as the shareContext for the QRhi's QOpenGLContext. Extend this
to also allow specifying a QOpenGLContext in the init params struct.

A good example of this is the backingstore compositor that serves
QQuickWidget and co. If one wanted to implement that with (an
OpenGL-based) QRhi, instead of direct OpenGL calls, then the ability
to create a QRhi that uses a context that shares resources with a
given other context becomes essential.

Pick-to: 6.2
Change-Id: I6bc5ff8e803d467f8795197ac1f12fdc0f73bbd1
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-08-26 15:31:53 +02:00
Ivan Solovev
7729989648 QLocale: improve documentation snippet
QString::toDouble() now always uses C locale, so the previous code
snippet does not make much sense, as the results do not depend on the
selected default locale.
The updated snippet uses the default locale, which allows to show the
difference between locales.

Pick-to: 6.2
Change-Id: I76a00429fa5b75cf109cf45bc25280a7fd427e0f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 15:31:53 +02:00
Morten Johan Sørvig
8585cd2483 wasm: don’t dereference null reply pointer
Move all access to the reply inside the nullptr check,
while making sure to still call emscripten_fetch_close()
unconditionally where needed.

Make all four Emscripten callback handlers have a similar
structure where we check if the reply is not null and
not in the Aborted state.

(This removes one emscripten_fetch_t nullptr check in
stateChage(), if it is really the case that Emscripten
calls us with a null emscripten_fetch_t then we should
add it back.)

Pick-to: 5.15 6.1 6.2
Change-Id: Iadcbe6338c338cfeb8967490e0951d8b3e1ec5b3
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-08-26 15:31:53 +02:00
Tor Arne Vestbø
e68bf3ddaf macOS: Modernize and clean up key event handling
- Pass key event type as QEvent::Type
  - Use proper type for NSEventModifierFlags
  - Use modern Objective-C property access in key handler
  - Modernize flagsChanged implementation using ranged-for
  - Use explicit Qt::Key type in key handling
  - Add FIXME comments for dubious code

Pick-to: 6.2
Change-Id: I533e0a5685108dc3cdccd2b276b4eb7a729d172e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-26 14:53:03 +02:00
Tor Arne Vestbø
146bc0e607 macOS: Move replacement range calculations into helper methods
We're going to need this logic for marked text as well.

Pick-to: 6.2
Change-Id: I461024c3df0c4956c794f16d1cb31fc6b0efe4c5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-26 14:53:02 +02:00
Tor Arne Vestbø
137c28d077 Fix Clang warning about loop variable creating a copy
Change-Id: I2a8b75294ee3bde008bcff37519da087f603ca51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-26 14:53:02 +02:00
Volker Hilsheimer
98d65c8d42 QGraphicsView: send timestamp information through QGraphicsSceneEvent
Qt relies on event timestamp information to detect double click events.
The information was not passed through QGraphicsSceneEvent, so the
synthesized QMouseEvent delivered for the second press of a double click
to an embedded widget was never recognized as a double click.

This requires addition of a new setter/getter to QGraphicsSceneEvent.
Event though not all QGraphicsSceneEvent instances will have a valid
timestamp, this provides us with more flexibility than adding the API to
several QGraphicsSceneEvent types (mouse, touch, wheel).

Pick-to: 6.2
Fixes: QTBUG-96009
Change-Id: I343f25902286157f6d6670641dfad9c92dd44250
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-26 14:32:26 +02:00
Mårten Nordheim
842ece2117 NetworkAccessBackend: Remove the backend part of the name
For consistency with naming of other plugins.

Slight compatibility break, but this is semi-private API.

[ChangeLog][Network][QNetworkAccessBackend] The NetworkAccessBackend
plugin-type is renamed to NetworkAccess, if you have a plugin marked
NetworkAccessBackend you need to change it to NetworkAccess.

Pick-to: 6.2
Change-Id: Ib5ea02f542254b0f5b8c425c89ee00075a58c956
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 14:32:26 +02:00
Mårten Nordheim
4fee73c444 QNetworkAccessManager: move #ifery out of if-condition
for legibility

Change-Id: Id5bc2471e79bb8560cec46068cc72573f6adec34
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 12:32:26 +00:00
Mårten Nordheim
0e9b75eab2 QNetworkAccessBackend: emit readyRead less often
Once per iteration of the loop wouldn't theoretically be so bad if there
was no overhead to emitting signals or reading from buffers.

Change-Id: I0e424264fcc95eb2e2e5f8f908cf9ae3a7cc4b7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 14:32:26 +02:00
Alexandru Croitor
d806ce6fc5 CMake: Properly export MODULE_PLUGIN_TYPES
Don't export the MODULE_PLUGIN_TYPES property only when a module has
an associated configure.cmake file with features. Instead, always
export it if a module defines a plugin type.

This fixes qttools DesignerTargets.cmake file to contain the plugin
types it defines, given that the Designer lib does not declare any
features via a configure.cmake file.

Pick-to: 6.2
Task-number: QTBUG-95668
Change-Id: Ic036c31768e03b51d3bce9c2afe48e04f69f435b
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-26 11:36:27 +00:00
Volker Hilsheimer
6bf70bc014 Refactor QApplication::translateRawTouchEvent to take a QTouchEvent*
Both call sites just pass the data from an existing QTouchEvent through,
so just pass the QTouchEvent through instead.

Amends 20d4f45a132606f7a910050d468519108486e9cf.

Pick-to: 6.2
Change-Id: If3b9508b83311889b58e109e7f64743985b8b178
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-08-26 09:36:25 +02:00
Volker Hilsheimer
1ecf2212fa Forward touchEvents to children inside QGraphicsProxyWidget
Just sending the event to the embedded widget is not enough, we
have to perform hit-testing for the different touch points, and
send the event to the child widget under the point. Fortunately,
QApplicationPrivate::translateRawTouchEvent provides the logic
that generates multiple events for groups of touch points.

Since that helper always sent events spontaneously, add an
optional parameter to allow sending of non-spontaneous events.

Add a test case that simulates touch events to different widget
configurations inside a QGraphicsProxyWidget.

Fixes: QTBUG-67819
Task-number: QTBUG-45737
Pick-to: 6.2 6.1 5.15
Change-Id: Iffd5c84c64ee2ceadc7e31863675fdf227582c81
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-08-26 09:36:20 +02:00
Giuseppe D'Angelo
f0c2c987e3 QBA(V)/QS(V)::lastIndexOf: fix the search of 1-char needles
When a needle has length 1 (because it's a QChar/char16_t, or because
it's a string-like of length 1) then an ad-hoc search algorithm is
used. This algorithm had a off-by-one, by not allowing to match at
the last position of a haystack (in case `from` was `haystack.size()`).

That is inconsistent with the general search of substring needles
(and what QByteArray does). Fix that case and amend wrong tests.
This in turn unveiled the fact that the algorithm was unable to cope
with 0-length haystacks (whops), so fix that as well. Drive-by, add a
similar fix for QByteArray.

Amends 6cee204d56.

Pick-to: 6.2
Change-Id: I6b3effc4ecd74bcbcd33dd2e550da2df7bf05ae3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-26 07:08:34 +02:00
Luca Di Sera
a2abb01451 Doc: Replace the example for QFileInfo::setFile
The example in the documentation of `QFileInfo::setFile` made no use
of `setFile` and only showed a use of `QDir::setCurrent`.

The example was replaced with a new example showing how `setFile`
changes the file that the information are retrieved from.

The old example was moved under the documentation for
`QDir::setCurrent` as it shows its working.

Fixes: QTBUG-87128
Pick-to: 6.2 6.1 5.15
Change-Id: I8227876cfcb4d582040bda9b4b7f3f7debea1e07
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-25 09:35:08 +00:00
David Faure
531b913f61 qdbuscpp2xml: add support for custom types with a new -t option
qdbuscpp2xml can't know about custom types registered with
qDBusRegisterMetaType<> in the server application whose header file
it's parsing. So add support for custom types using a command line
argument. For example:
    qdbuscpp2xml -t 'std::vector<Person>=a{ssss}' peopleserver.h
which generates
    <arg name="people" type="a{ssss}" direction="in"/>
    <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="std::vector&lt;Person&gt;"/>

[ChangeLog][QtDBus][qdbuscpp2xml] Added a -t option to specify how to
handle custom types.

Change-Id: Ic0cad4f4eec8d5dfa48055c3a46cc772b1a60174
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-25 01:03:54 +02:00
Ievgenii Meshcheriakov
8b5de677a7 tst_qurl{,internal}: Use U+FB01 for normalization to ASCII test cases
Use U+FB01 LATIN SMALL LIGATURE FI instead of U+00DF LATIN SMALL
LETTER SHARP S in testcases that need non-ASCII URLs that are
normalized to ASCII. The latter is not normalized to ASCII when
using UTS #46 nontransitional processing.

Task-number: QTBUG-85371
Change-Id: I8c153feb58e556b1d31439018cc84d8e8f1de1a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-25 00:13:39 +02:00
Ievgenii Meshcheriakov
d9881799c1 tst_qurlinternal: Remove testcases that use U+04CF
U+04CF CYRILLIC SMALL LETTER PALOCHKA was undefined in Unicode 3.5 used
by IDNA2003 but it is allowed in UTS #46.

Task-number: QTBUG-85371
Change-Id: I7f5c0f6dc57f1197fd509e98328207d6179f1624
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-25 00:13:39 +02:00
Ievgenii Meshcheriakov
655e353557 tst_qurlinternal: Remove nameprep and STD3 rules tests
IDNA 2008/UTS #46 do not use nameprep anymore and have different
validity rules.

Unexport qt_nameprep() and qt_check_std3rules() because they
are not used by any tests anymore.

Task-number: QTBUG-85323
Change-Id: I38c0dbae9a6bd108fbcfac350767aa7e757e786f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-25 00:13:39 +02:00
Ievgenii Meshcheriakov
5b01399781 tst_qurl: Make an invalid URL test compatible with UTS #46
Use U+1F100 DIGIT ZERO FULL STOP instead of U+1F4D9 ORANGE BOOK.
The latter is not allowed according to IDNA 2003 rules but is allowed
according to UTS #46 rules. The former is disallowed in either case.

Task-number: QTBUG-85371
Change-Id: Idc8afef68c26ae0b702a475e5a53592182998a08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-25 00:13:39 +02:00
Giuseppe D'Angelo
bac329a28b QRegularExpressionMatch: add a way to know if a capturing group captured
Relying on the fact that a given capturing group captured a null string
doesn't allow users to distinguish whether a capturing group did not
capture anything, or captured a null substring (say, from a null subject
string).

Perl allows for the distinction: the entries in the @- and @+ arrays are
set to values in case there is a capture, but they're undef otherwise.

PCRE2 gives us the information already in the results "ovector", but
it was simply not exposed to QREM users. So, expose it.

[ChangeLog][QtCore][QRegularExpressionMatch] Added the hasCaptured()
family of functions to know if a given capturing group has captured
something.

Change-Id: Ic1320933d4554e2e313c0a680be1b1b9dd95af0b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-25 00:06:42 +02:00
Topi Reinio
145940e1ef Doc: Fix documentation issues for Qt Core
* Tag deprecated Q(Multi)Map operators in the header to correctly
  match them with documentation \fn commands.
* Add documentation for QByteArrayView comparison operators.
* Add a dummy typedef 'jfieldID' for generating docs correctly
  on non-Android platforms
* Fix other minor issues

Pick-to: 6.2
Task-number: QTBUG-95860
Change-Id: I141d2f75d6aa10557aa374201f09ad74b4cd6e81
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-24 23:50:23 +02:00
Joerg Bornemann
d9f8b68963 Revive tst_qresourceengine
This test was not ported to CMake yet.

Pick-to: 6.2
Fixes: QTBUG-88601
Change-Id: Ied3b1a0e2ddfbcf003cb0d8d01d5f64cb83cf4e7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-24 23:27:30 +02:00
Robert Löhning
8694104809 Fuzzing: Remove .pro-files of libfuzzer tests
They were replaced by CMake files and oss-fuzz was updated to use the
latter. No need to still maintain qmake based builds.

Change-Id: If38f39c23ef3a58c33c428341486b62fd0a81888
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-24 22:04:38 +02:00
Alexandru Croitor
eb635dda1e CMake: Fix indentation in _qt_internal_test_expect_pass
Change-Id: Ib92bcd600bbfb0f2ee8ad8e5d44eaecdf9d16916
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-24 21:24:43 +02:00
Alexandru Croitor
5a437d2590 CMake: Fix automatic iOS bundle id extraction
If no Xcode preferences file was found,
_qt_internal_get_ios_bundle_identifier_prefix accidentally assigned
the error output of running PlistBuddy to the bundle id property.

That resulted in a bundle id called
'${team_id}.Doesn't Exist, Will Create: /Users/qt/Library/Preferences/com.apple.dt.Xcode.plist\n.app'

Check that the error variable is empty before assigning.

Amends 4d838dae5a

Pick-to: 6.1 6.2
Task-number: QTBUG-95838
Change-Id: I3a7241528590ae3e9986cfa1f3e91ac983ef54f6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-24 21:24:43 +02:00
Alexey Edelev
abb19da572 Add missing PRIVATE_MODULE_INTERFACEs to INTERNAL_MODULEs
To detect the internal module ouside the qt_internal_add_module
function need to mark it with the property.
This adds _qt_is_internal_module property to the Qt internal modules.
Since PRIVATE_MODULE_INTERFACE only was applicable to pure Private
modules, INTERNAL_MODULEs is missing those dependencies if they were
specified. Add extra condition to qt_internal_extend_target to link
PRIVATE_MODULE_INTERFACE libraries to internal modules as well.

Pick-to: 6.2 6.1
Change-Id: I9c32fa5bad3aff365f5d7663349e5365d5f1d72d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-24 20:58:39 +02:00
Jonas Kvinge
41b56c31bc Fix inserting node entry in QNetworkAccessCache::linkEntry
When the new entry has the same, or older timestamp than the newest,
it's linked behind the newest entry, but "newest" for the new node
currently isn't assigned to the newer entry.

Fixes: QTBUG-95950
Change-Id: I7ef5f1ce5a9479ce47839c8f1a6011124d3f43de
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-24 16:40:57 +02:00
Alexandru Croitor
3c1125d9fe CMake: Create plugin initializers for static user plugins
Previously we only created object library static plugin initializers
for Qt plugins only, not user-project plugins.

The reason was that if a user tried to install the plugin target via
an export set, CMake would error out saying that the _init library is
not part of the same export set.

Introduce an OUTPUT_TARGETS option that would allow projects to get
the name of the generated _init target, so they can install it if
needed.
This was already done for qt6_add_qml_module, so we just introduce the
same option for qt6_add_plugin.

Now user static plugins will have an _init target created, which will
be propagated to consumers whenever the consumers link against the
plugin itself.

We also need an internal option to disable this propagation, because
it's handled a bit differently for Qt plugins which can be linked
either via finalizers or via usage requirements.

Amends 91c65dd80c

As a result of the implementation change, cleanup example projects
to ensure that they build successfully (the important part is
specifying the CLASS_NAME).

Only plugandpaint works properly with both shared and static Qt
builds.

echoplugin works with a shared Qt build, but not a static one due to
some assumptions in the C++ code about shared plugins.

styleplugin doesn't seem to work properly neither with shared Qt
builds nor static Qt builds, at least on macOS. But it builds fine.
For some reason even if the plugin is found, the style is not applied.

Amends 4caac1feea

Pick-to: 6.2
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: I6f631cda9566229b7a63992b23d7d7fa50303eeb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-24 16:10:31 +02:00
David Faure
511bbbdfc0 qdbusxml2cpp: generate "using" rather than "typedef"
It's more modern :)

I was hoping it would allow to forward declare the org::kde::Foo class,
but unfortunately it doesn't, the forward declaration has to use
"using" or "typedef" too...

Change-Id: I9ec2900ac25c1bca75d097aa339fd2a872568f95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-24 15:34:59 +02:00
Joerg Bornemann
278368b523 CMake: Fix excessive size of precompiled header files
Do not add catch-all header files like QtCore, QtGui, etc. to
precompiled headers for targets that already define their own set of
precompiled header files.

This reduces the size of the precompiled headers and brings the pch file
sizes down into the region of the qmake build.

Pick-to: 6.2
Task-number: QTBUG-89122
Change-Id: I8e4d17aa6829c7d7b1aa01a01a61b6677e22c460
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-24 14:50:12 +02:00
Tor Arne Vestbø
bae9aeacbe macOS: Correctly compute marked and selected text range, and use for insertion
The NSTextInputClient protocol expects marked (composed) and selected
text ranges to be relative to the document, not to the current editing
block as Qt typically expects.

Luckily we can use the absolute cursor position to compute an absolute
offset that we can apply to any other positions, such as the selection.

Now that we are computing the ranges correctly we can also use them
during text insertion, when the incoming replacementRange is not valid.

We then transform and sanitize the replacement range to the format that
Qt expects for QInputMethodEvent::setCommitString().

Pick-to: 6.2
Change-Id: I4cb2f7c63adb92e407f38af05adce539c9bed7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-24 13:39:06 +02:00
Tor Arne Vestbø
f6b851837d Fix warning about loop variable creating a copy
qxpmhandler.cpp:1162:21: warning: loop variable '[color, index]' of type
  'const std::__1::pair<const unsigned int, int>' creates a copy from type
  'const std::__1::pair<const unsigned int, int>' [-Wrange-loop-analysis]
    for (const auto [color, index] : colorMap)
                    ^

Change-Id: Ifabf1c569efdcd929859227d860f4598250ba5bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-24 13:39:06 +02:00
Volker Hilsheimer
01aeb5f7e4 QGraphicsProxyWidget: forward Window(De)Activate events
The nested widget might be a QGraphicsView as well (documented to be
supported), and QGraphicsScene maintains it's own activation status by
counting Window(De)Activate events. We need to make sure that the
embedded widget is informed about its activation status so that deeper
nested children can receive focus.

Forward WindowActivate/Deactivate events to the nested widget, which
will pass it on to all its children. Add test case, which without this
fix fails when verifying the inner scene's isActive state, or later
when testing that focusInEvent is delivered to the embedded widget.

Fixes: QTBUG-94091
Pick-to: 5.15 6.1 6.2
Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-24 13:32:07 +02:00
Giuseppe D'Angelo
d48058f197 Unicode: fix the grapheme clustering algorithm
An oversight in the code kept the algorithm in the GB11 state, even if
the codepoint that is being processed wouldn't allow for that (for
instance a sequence of ExtPic, Ext and Any).

Refactor the code of GB11/GB12/GB13 to deal with code points that break
the sequences (falling back to "normal" handling).

Add some manual tests; interestingly enough, the failing cases are not
covered by Unicode's tests, as we now pass the entire test suite.

Amends a794c5e287.

Fixes: QTBUG-94951
Pick-to: 6.1 5.15
Change-Id: If987d5ccf7c6b13de36d049b1b3d88a3c4b6dd00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-24 12:58:20 +02:00
Eirik Aavitsland
ca604964f6 Painting: handle large and negative dash offset values
The mapping of the dash offset into the dash pattern was susceptible
to int overflow.

Pick-to: 6.2 6.1 5.15
Change-Id: I254ed40b323ef516d10abc8e6008b14cfc23d2a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-24 08:49:48 +02:00
Eirik Aavitsland
279a434c1c QDashStroker: cap the number of repetitions of the pattern
Since the dashing is computed even outside the clipping and device
area, painting very long dashed lines could consume unexpected amounts
of time and resources. Fix by placing a limit on the dashing, and fall
back to solid line drawing if hit.

Fixes: QTBUG-95594
Pick-to: 6.2 6.1 5.15
Change-Id: Ida05ecd8fe6df402c9e669206fd5cec4a9f5386a
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-24 08:49:36 +02:00
David Faure
cf34fca4d0 QDBus: fix ExportScriptableInvokables to allow calling scriptable invokables
The "wantedMask" check in the xml generator didn't distinguish slots
from invokables, so exporting an object with just ExportScriptableInvokables
didn't allow calling Q_SCRIPTABLE methods.

Change-Id: I7b408755da5b28e67a9384d9df95e22dc5de2369
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-23 23:07:30 +02:00
David Faure
7a5f8baa67 qdbusxml2cpp: don't generate an include for all of QtDBus+QtCore
This, however, has to wait for Qt 7 for compat reasons.

Change-Id: I84db4715bf2e9d080d1446d24f0996c78a875e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-23 23:07:30 +02:00