Commit Graph

56932 Commits

Author SHA1 Message Date
Thiago Macieira
dda9c9e2bc moc: fix use of escape sequence of more than one character
We had the code to calculate the length, but were improperly using it
only for the offset, not the length of the string or its containing
array. That resulted in the generated moc output containing:

 QT_MOC_LITERAL(111, 5), // "\xffz"
 QT_MOC_LITERAL(114, 5), // "\0012"
 QT_MOC_LITERAL(117, 23), // "slotWithAReallyLongName"

The two strings are described as occupying 5 bytes (length 4 + null
terminator), which is incorrect. The offset was correct: 114 - 111 = 3
and 117 - 114 = 3. The new output is:

        QT_MOC_LITERAL(111, 2),  // "\xffz"
        QT_MOC_LITERAL(114, 2),  // "\0012"
        QT_MOC_LITERAL(117, 23),  // "slotWithAReallyLongName"

The effect of the array size calculation would only be felt if moc
decided it needed a second string array (for strings over 65535 bytes),
which would cause the offsets in the second array to be all wrong. There
was no such test until now.

Drive-by fixing of the newline, indentation, and the stale comment
referring to QByteArrayData (Qt 5).

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9cd01b3e0709a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 13:03:17 -07:00
Thiago Macieira
c83a87eca7 CMake: fix build with FreeBSD 13.1
I don't know if they've just added the libs and therefore the GSSAPI
content wasn't enabled before, but libgssapi_krb5.so does not have the
symbols we need.

ld: error: undefined symbol: gss_acquire_cred
>>> referenced by qauthenticator.cpp:1803 (/usr/home/tjmaciei/src/qt/qt6/qtbase/src/network/kernel/qauthenticator.cpp:1803)
>>>               src/network/CMakeFiles/Network.dir/kernel/qauthenticator.cpp.o:(qGssapiTestGetCredentials(QStringView))

ld: error: undefined symbol: gss_release_name
>>> referenced by qauthenticator.cpp:1808 (/usr/home/tjmaciei/src/qt/qt6/qtbase/src/network/kernel/qauthenticator.cpp:1808)
>>>               src/network/CMakeFiles/Network.dir/kernel/qauthenticator.cpp.o:(qGssapiTestGetCredentials(QStringView))
[...]

Pick-to: 6.2 6.3 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fabf70bbd272f5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-22 12:42:11 -07:00
Alexandru Croitor
754512a64d CMake: Fix prl files not to contain hard-coded library paths
Make sure to convert absolute paths generated using the
$<TARGET_LINKER_FILE> generator expressions into relative paths.

Because prl files are generated for both modules and plugins, we need
to pass both a list of qt module locations and qt plugin locations
to QtFinishPrl.cmake, and then try to make the absolute path relative
to each passed directory.

A warning assertion is shown if we no relative path could be made,
which will cause an absolute path to be embedded. This should not
happen though.

Amends f4e9981259

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-104396
Change-Id: Id68395c0dbb20aad5c510d77835cc931b9396556
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-22 20:18:39 +02:00
Ye ShanShan
c3b959733a Add QDom internalSubset implementation
QDom's internalSubset() always returned empty because nothing
actually set the internal data member it returns. When parsing
the DECLTYPE, extract the internal subset and save it to the
doctype()'s member when present.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-53661
Change-Id: I6e41ff8b914381168246073b3289d82205b1c255
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-23 02:18:39 +08:00
Iikka Eklund
5271f5082c Conan: Do not force 'qt_host_path' usage in cross-build context
If the user does not pass:

  -o qtbase:qt_host_path=/foo

then log a warning but allow to continue. For example Boot2Qt
integration resolves the 'QT_HOST_PATH' by other means thus making it
a mandatory option to be passed by the user should not be needed.

Pick-to: 6.3 6.4
Change-Id: I4c1d8b5253e33466ccdf463f89473966e90c0e0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-06-22 18:18:42 +03:00
Ulf Hermann
2c0518eb62 moc: Allow reading property values through bindables
The behavior is similar to MEMBER: If the READ accessor is "default",
synthesize it using the bindable.

[ChangeLog][QtCore] You can now specify "READ default" in a Q_PROPERTY
if you also specify a BINDABLE. moc will synthesize a READ accessor in
that case.

Task-number: QTBUG-97249
Change-Id: I4a275adabaed12df95dac505095f847c4be65dfe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 16:05:07 +02:00
Joerg Bornemann
073214fdf9 qmake/msbuild: Turn off "use full paths in diagnostics" by default
The default setting for "Full Path of Source Code File in Diagnostics"
changed with VS 2017: it's now turned on by default.  It can also be
enabled with the compiler flag /FC, but there is no flag for turning it
off.

Users might want to disable /FC to obtain reproducable binaries.

Change qmake's default from "use Visual Studio's default" to "off" for
this feature.  Users can enable it manually by putting the following
into their project files:

    QMAKE_CXXFLAGS += /FC

CMake faced the same problem.  See CMake upstream issue #18261 for
comparison.

Pick-to: 5.15 6.2 6.3 6.4
Task-number: QTBUG-104450
Change-Id: Ibe636a0ac5d18aefb44f2b7179b59fcec2ad8353
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-22 16:05:07 +02:00
Joerg Bornemann
6a6b27940d qmake/msbuild: Support all /DEBUG:xxx linker options
/DEBUG:OFF now turns debug info generation off.
/DEBUG:FULL maps to DebugFull.
Unknown /DEBUG:xxx options are added to AdditionalOptions.

Pick-to: 5.15 6.2 6.3 6.4
Task-number: QTBUG-104450
Change-Id: Ibd072145e51551b29370e809b880c0d7f1a00c03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-22 16:05:07 +02:00
Joerg Bornemann
566ede6ee1 qmake/msbuild: Support all /LTCG:xxx options
/LTCG:OFF now turns off LTCG.
/LTCG:INCREMENTAL maps to UseFastLinkTimeCodeGeneration.
Unknown /LTCG:xxx values are passed to AdditionalOptions.

Pick-to: 5.15 6.2 6.3 6.4
Task-number: QTBUG-104450
Change-Id: If85942dbeec204dc2571a861a43201cb3d5993ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-22 16:05:07 +02:00
Sona Kurazyan
73e1bc09e6 Move QFutureInterfaceBase::cleanContinuation() to removed_api
This method isn't used anymore, but we can't remove it entirely for BC
reasons, because it was called from inline code.

Pick-to: 6.4
Change-Id: I9183c666c466030787ac7c2386706b50abf23eaa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-22 14:32:01 +02:00
Lorn Potter
cf9cd8cc08 wasm: do not allow blocked windows to be resized
Fixes: QTBUG-102869
Pick-to: 6.3 6.4
Change-Id: I69a4afbb67618dce7bcc499208e7e608e9adf212
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-06-22 20:04:35 +10:00
Thiago Macieira
e114fec62a QJsonValue: fix incorrect to{Array,Object} when the value is empty
This is a repeat of commit de6ced6692
"QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4),
which fixed the same thing for QCborValue. I've just copied the exact
same implementation onto the QJsonValue functions.

Pick-to: 6.2 6.3 6.4 5.15
Fixes: QTBUG-104085
Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-21 22:25:32 -07:00
Morten Sørvig
492b338f57 wasm: improve the specialHtmlTargets test
It can actually be undefined, so test for that before checking
the object type.

This fixes the asyncify build.

Pick-to: 6.4
Change-Id: I5a6a0bc60c153290c35c20242400c59cd1312403
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-22 07:14:59 +02:00
Thiago Macieira
45de3fedba QThread:idealThreadCount: fix build with FreeBSD 13.1
They added the CPU_COUNT_S macro.

Pick-to: 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fabe9f8226ecda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-21 21:52:57 -07:00
Thiago Macieira
cb0b1ee441 moc: remove unnecessary emission of "#include <qbytearray.h>"
We don't need QByteArrayData any more (since 6.0).

[ChangeLog][Potentially Source-Incompatible Changes] moc no longer emits
an #include for QByteArray in the output file. None of the content that
moc generates needed that header, so this should not cause changes for
most people. However, codebases that #include'd the moc output
(something that is recommended) could be depending on this indirect
include.

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9cf13dc8d61b5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-21 21:52:57 -07:00
Thiago Macieira
3cf38290d9 moc: rename the "offsetsAndSize" member to "offsetsAndSizes"
It contains more than one size.

Drive-by drop the const from the structure, so it becomes properly
trivial (though there's disagreement, see[1]).

[1] https://conformance.godbolt.org/z/rK1xW669K

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9cc69ffd90aa4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-22 04:52:57 +00:00
Lorn Potter
1e2d67152f wasm: Optimize use of opengles
- USE_WEBGL2 is depreciated, Emscripten now uses MAX_WEBGL_VERSION
- Optimize and remove use of emulated ES2 and ES3, which means
only use WebGL friendly subset.
Users can add USE_ES3=1 and USE_ES2=1 to the final linker arguments
for those respective versions in order to enable using
glDrawArrays and glDrawElements with unbound buffers.
See https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html

Pick-to: 6.4
Change-Id: I11ae359966964b3e7aa6e61ccc714c2bfbf61f96
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-22 13:59:25 +10:00
Luca Di Sera
73d04340ad Doc: Add qthelp dependency to gui and widgets
The documentation for both gui and widgets defines members of the
"helpsystem" group, which definition is given in qthelp.

Due to recent changes in QDoc that automatically link a class page to
its owning group, it is now required for those project to be dependent
on qthelp, so that it is possible to retrieve the necessary linking
information for the group definition.

Hence, such a dependency was added.

Change-Id: Id9399e76bbe10fb9ae0c05d637006b5cdc0b742b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-22 04:49:38 +02:00
Marc Mutz
32925d0a85 tst_tostring: add benchmarks for QCOMPARE vs. QCOMPARE_EQ
There's currently no statistically-significant difference between the
two, due to a huge pessimistion in QTestLib where every QCOMPARE* and
QVERIFY writes 1KiB of data onto the stack before doing anything else,
so I'm not reporting numbers in this commit message.

Pick-to: 6.4
Task-number: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: I233878596f0a8fe6b96360adb839fecd72c398a2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-22 01:38:12 +00:00
Marc Mutz
06f21a3870 headerclean: remove dead code
The variable was misspelt, so we obviously don't need these
exceptions.

Pick-to: 6.4 6.3 6.2
Change-Id: I691c9315bcde3aad72410ce01ae6dc6a013ee6fd
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-22 03:09:24 +02:00
Marc Mutz
97f643faee Long live QT_INLINE_SINCE!
We have now had several requests for inlining previously-exported
member functions, but no standard mechanism to effect it.

As QT_REMOVED_SINCE has shown, there is great value in having such a
standard mechanism, so here is one.

With this change, to inline a previously exported (member) function,
simply

- mark the declaration with QT_<MODULE>_INLINE_SINCE

- move the definition into the header file (outside the class),

  - wrap it in QT_<MODULE>_INLINE_IMPL_SINCE

- #include the header into the module's removed_api.cpp

Just including the header into removed_api.cpp is enough, so you may
want to add a comment:

    #include "header.h" // uses QT_<MODULE>_INLINE_SINCE

The effect is as follows:

- A TU in a _different_ library will see an inline declaration,
  followed by the definition, and so it will see a normal inline
  function.

- A TU in the same library will, however, see a non-inline
  declaration, to avoid the ODR violation that at least GCC/ld are
  able to detect.

  - When QT_<MODULE>_BUILD_REMOVED_API is in effect, the TU will also
    see the definition, which is the same setup as before the change,
    except in a different TU, and therefore export the member.

  - When, OTOH, QT_<MODULE>_BUILD_REMOVED_API is _not_ in effect, the
    TU will see no declaration, assuming (correctly), that the
    definition will be supplied by a different TU.

This is, of course, an ODR violation, but not worse than what we do
elsewhere, as the definitions differ only between library and user.

The function is inline only for the users of the library, not the
library itself, which will still see the function as non-inline. If
inlining is critical within the library, too, the existing function
should call a new inline function, and calls in the same library should
be changed to call the new inline function instead.

Use the new mechanism to inline the QLocale ctor we intended to inline
for 6.3, but couldn't, because we hadn't found the magic incantation,
yet. Thiago found it a few weeks later, and this is what this patch is
based on.

Fixes: QTBUG-100452
Pick-to: 6.4
Change-Id: Ia0030cddc64b6b92edfed860170d5204aa74b953
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-22 01:09:24 +00:00
Marc Mutz
1a030f6609 QPostEventList: de-inline addEvent()
While in a private header, it did manage to place QList<QPostEvent>
operations near the top spots of all Qt template instantiations in a
QtWidgets build.

Task-number: QTBUG-97601
Pick-to: 6.4
Change-Id: I4fa1972b8764b71ad0559633131e7e44b3d4ae6a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 01:09:24 +00:00
Marc Mutz
882fc48b9e tst_bench_shared_ptr: fix build with BOOST_NO_EXCEPTIONS
If, for whatever reason, BOOST_NO_EXCEPTIONS is defined, the user of
the Boost libraries is supposed to provide a definition of
boost::throw_exception, which we didn't.

We used to run into this only on ubsan builds, but it seems we now
have the problem on a regular Ubuntu 22.04 build, too (cf. bugreport).

Fix by adding the necessary definitions.

Fixes: QTBUG-104083
Pick-to: 6.4 6.3
Change-Id: I9b061a158a5b77e8d286bd7b40312e5bc63ee8de
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-22 03:09:24 +02:00
Sona Kurazyan
bf3fc5c95c QPromise: run continuation(s) on destruction
If the QFuture is canceled because the associated QPromise has been
destroyed, we still need to run its continuations (i.e. onCanceled
handler, if it's attached), so replaced the cleanContinuation() call
inside ~QPromise() with runContinuation(), which will also take care of
cleaning the continuation.

[ChangeLog][QtCore][Important Behavior Changes] QFuture now runs its
continuations when its associated QPromise has been destroyed.
Previously, if a QFuture was canceled because the associated QPromise
has been destroyed, its continuations were skipped.

Fixes: QTBUG-103992
Pick-to: 6.4 6.3 6.2
Change-Id: Ie05bc760c96c349aade8adb8d2fe5263aff8efac
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-22 03:09:24 +02:00
Alexey Edelev
5d041a15bf Isolate http2protocol_p.h include
http2protocol_p.h is not supposed to be used without the http feature
is enabled. Move its include under QT_CONFIG(http) guard.

Change-Id: I374dd84d3330de2b4c340b9803d0c3d2c13bc8e3
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-22 03:03:31 +02:00
Alexey Edelev
36ea34c714 Add the qt_class pragma to file listed in sync.profile classnames map
This makes header files self-contained and reduces the number of
'sources of truth' for syncqt procedure.

Change-Id: I7f5865abc69934603139d23e1b5452da46ccb110
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-22 03:03:31 +02:00
Alexey Edelev
5fce82bc6c Move ssl header files to the general QtNetwork sources
Move public ssl headers to the general QtNetwork sources since they
supposed to be used across the project without corresponding checks
for the FEATURE_ssl presence. The content in these header files has
a conditional implementation guarded by corresponding macros.

Change-Id: I43168469da27321c2d8064ec2e5d7fe31126ebec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-22 03:03:31 +02:00
Alexey Edelev
c769432cd5 Move threads header files out of the FEATURE_thread
Threads header files are used across the project without the check for
FEATURE_thread enabled. So moving them out of the FEATURE_thread
condition in CMake file to make them part of the CMake source tree
even if FEATURE_thread is disabled.

Change-Id: I8ee4ee5ffa16054b9af0df0aa5704b0f87678e1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-22 03:03:30 +02:00
Sona Kurazyan
c3f76a867b QDom: Clean-up warnings about old-style cast uses
Change-Id: I7cf2089f34e46a901f8b03987feed24773a72c00
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-22 02:26:33 +02:00
Shawn Rutledge
bd1ea2eb92 Replace a few more QString::fromLatin1() with _s literals
Wasn't done in 7d79b94db7

Pick-to: 6.4
Task-number: QTBUG-98434
Change-Id: Id9c26f6b58e2c96a1c5f72154b735b136c57debc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-22 00:14:27 +02:00
André de la Rocha
ecd41111a3 Add ExpandCollapse UI Automation pattern to combo boxes
Also add support to expandable/expanded states to QAccessibleComboBox
in widgets. QtDeclarative will still require updates so that QML combo
boxes report the expanded/collapsed state and react to UIA actions.

Task-number: QTBUG-103591
Pick-to: 6.4 6.3
Change-Id: Iff8ba5e3143778ce17998dbe7f5f76cae658dc19
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-22 00:08:34 +02:00
Mate Barany
b9b5734559 Disable useless-cast warning for moc generated code
The useless-cast gcc warning is disabled in the files generated by
the moc. A typical warning is like

using_t = void(Counter::*)(int );
if (*reinterpret_cast<_t*>(_a[1]) ==
    static_cast<_t>(&Counter::valueChanged)) {
        *result = 0;
         return;
    }

Removing the static cast results in a compilation error
"address of overloaded function with no contextual type-of
information" in moc_myobject.cpp files.

Checking whether we have an overload set or a single function
might be too much effort for too little benefit and may not worth
it.

Fixes: QTBUG-71938
Change-Id: I6f67e163a3493b51fb95f54218ce6bf9a302f824
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 00:08:34 +02:00
Topi Reinio
0c82d6a75a Doc: Fix online macros for commercial template
qt-module-defaults-online.qdocconf includes online-specific overrides
for some of the documentation macros. This needs to happen also in
the commercial template to have equivalent behavior.

Pick-to: 6.4 6.3
Change-Id: I2ca3246fbf16cef502e8eada056df6e8db573d5d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2022-06-21 22:08:34 +00:00
Mikolaj Boc
bc676a7d7a Document QMouseEvent::pos() as deprecated in 6.0
The API is deprecated, but the documentation does not state that.

Fixes: PYSIDE-1750
Pick-to: 6.4 6.3 6.2 6.1 6.0
Change-Id: I038ffeb958312d7648690743e06598a15dfb4cbc
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-06-22 00:08:34 +02:00
Shawn Rutledge
579f0a4cf2 Remove unused variable in tst_QTextEdit::setDocumentPreservesPalette()
Change-Id: I96c0f39c2ee1bd03cf0d7939624652ee008c9726
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-06-21 21:42:18 +02:00
Alexey Edelev
84e22f9e82 Fix concurrent access to files by androiddeployqt in multi-abi builds
'androiddeployqt' supposed to copy artifacts that may not have
abi-specific identifies. One example is Qt6Android.jar file. We need
to prevent execution of multiple androiddeployqt instances in
parallel. External projects now are divided into two steps. The
first runs the build and can be executed in parallel to the build
steps from the other external projects. The second one triggers
androiddeployqt and can only be run exclusively in relation
to the similar steps from other ABI-specific external projects.

To solve the issue we build the dependency chain between the all
ABI-pecific qt_internal_${target}_copy_apk_dependencies targets to
execute androiddeployqt sequentially. This is non-optimal, but
guarantees that androiddeployqt is not running simultaneously with
another instance in external projects.

Pick-to: 6.3 6.4
Fixes: QTBUG-104013
Change-Id: I39a25dd5f38ed988e0ca74b185024bc602ab81a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-21 21:42:18 +02:00
Andreas Eliasson
ac171469a0 Doc: Revise Qt Test tutorial
- Make it explicit that each chapter can be run as a stand-alone test
application
- Add a CMake section on how to build the executable

Task-number: QTBUG-103730
Pick-to: 6.4 6.3
Change-Id: Id4c87c454521f698dcf16cfdc176318dd3e16786
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-21 11:08:49 +00:00
Ilya Fedin
56a33edf2a xcb: Port XSync call in QXcbWindow::create to xcb
QXcbConnection::sync is a full equivalent of calling XSync with false,
they both are sending GetInputFocus request and getting its reply

Pick-to: 6.4
Change-Id: I4f91b9447a02def41a8693a54312856b56e74811
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 11:07:47 +00:00
Liang Qi
a79e2aafd6 xcb: set primary screen more correctly
For example, when having virtual monitor which includes two real
monitors, the primary information in xcb_randr_monitor_info_t
is normally false, because user can only set it for output.

Kudos to Jiang Wu for his first patch and details of the issue.

Done-with: Jiang Wu <wujiang@kylinos.cn>
Pick-to: 6.4 6.3
Change-Id: I6af443ff69d347a6d86efc9c8ea7a5d18f4c3e24
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Jiang Wu <wujiang@kylinos.cn>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-21 04:05:53 +02:00
Jiang Wu
fd9aeb1b38 xcb: clear m_singlescreen before update
Pick-to: 6.4 6.3
Change-Id: Iafff57be82b5beb1f5702c00e0b6d7d0dd3ccdc2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 02:05:53 +00:00
Nils Jeisecke
03e76ac23d xcb: fix missing initialization of m_cursor
Regression introduced in 9a4c98e556:

m_cursor is not initialized and never set when monitorInfo is not
available in QXcbScreen::setMonitor. This seems to happen when running
in VNC, e.g. on a Raspberry Pi.

This usually results in crashing the application pretty soon.

Using a unique_ptr solves both the initialization and a possible leak
when setMonitor is called multiple times.

[ChangeLog][Linux/XCB] Fixed crash when no monitorInfo is available (e.g. VNC).

Fixes: QTBUG-104443
Pick-to: 6.3 6.4
Change-Id: If13493c177121a1994b5d00dfbd64f1da694df2e
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 01:04:12 +02:00
Joerg Bornemann
fc2e40e88d qmake/MinGW: Install separate debug info of DLLs next to the DLL
...instead of next to the import library.

If separate_debug_info is enabled then we would create an install rule
that puts the .dll.debug file next to the .a file.  GDB however expects
the file to be next to the .dll.

Fix the installation rule in separate_debug_info.prf accordingly.  This
affects the MinGW packages of Qt 5.15 and user projects targeting MinGW.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-86790
Change-Id: If91c356e7e7f7f4330ebc43691e414929f9beb4b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-21 01:04:12 +02:00
Lars Knoll
9c1f3b6d4d Add QStringDecoder::decoderForHtml()
Now that QStringConverter can handle non UTF encodings through ICU,
add a way to get a decoder for arbitrary HTML code.

Opposed to QStringConverter::encodingForHtml(), this method will
try to create a valid string decoder also for non unicode codecs.

Pick-to: 6.4
Change-Id: I343584da1b114396c744f482d9b433c9cedcc511
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-21 01:04:12 +02:00
Thiago Macieira
d531c4b65d qsimd: don't enforce shstk (CET) feature on launch
Clang with -march=tigerlake or -march=sapphirerapids pre-defines
__SHSTK__, which QtCore require the feature, even if the OS does not
have support for it. That's of no consequence because the compiler does
not generate shadow stack operations on its own.

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-20 16:04:12 -07:00
Sona Kurazyan
da0d7f61c8 QDom: Stop treating non-BMP characters as invalid
According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters
within the range of [#x10000-#x10FFFF] are considered to be valid, so
fix the check for valid characters accordingly. This requires changing
the loop over the input QString to iterate over code points (instead of
code units).

Fixes: QTBUG-104362
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 21:29:04 +00:00
Mårten Nordheim
3d73aa660b function_ref test: Don't take reference of temporaries
When assigning the lambdas directly to a function_ref their lifetime is
limited to that of the expression. Store them on the stack first to
avoid the UB.

Fixes: QTBUG-104419
Pick-to: 6.4
Change-Id: I3c85ac683b0bd7768b646dc9d0a1ed4dd173e6f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 19:52:01 +00:00
Tor Arne Vestbø
7d2488280e Windows: Avoid accidentally copying QWindowsScreenManager
Pick-to: 6.2 6.3 6.4
Change-Id: I60b219e9a3ea62a96c369ee910eacf06d61f4f71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-06-20 20:56:59 +02:00
Alexandru Croitor
91fd8bdb11 CMake: Warn when using qt6_add_big_resources on iOS
qt6_add_big_resources works by calling rcc to generate a resource
.cpp file, compiling it into an object file, then passing the
compiled object file to rcc again for further manipulation.

The path to the object file is passed to rcc using the
$<TARGET_OBJECTS> generator expression.

This generator expression does not work when used in
add_custom_command / file(GENERATE) when targeting iOS, because
CMake claims it does not know where the object file will be on-disk
(presumably because the location is controlled by Xcode itself and it
can vary based on the active architecture and sysroot).

The following error is shown at generation time:
 Error evaluating generator expression:

    $<TARGET_OBJECTS:rcc_object_foo>

  The evaluation of the TARGET_OBJECTS generator expression is only
  suitable for consumption by CMake (limited under Xcode with multiple
  architectures). It is not suitable for writing out elsewhere.

More details about the issue can be found at
https://gitlab.kitware.com/cmake/cmake/-/issues/20516

Trying to work around the issue by manually invoking the compiler
instead of using a genex so we know the location of the object file
hits similar issues in that we don't know the active arch and sysroot
for which to compile the object file.

Until the CMake limitation is lifted or we find a different fix, warn
that qt6_add_big_resources can't be used when targeting iOS and
fall back to using qt6_add_resources instead.

Note that qmake CONFIG+=big_resources also falls back to non-big
resources mode when targeting Xcode (mac-xcode) and doesn't even show
a warning.

Another note is that using CMake + Xcode + qt6_add_big_resources does
work when targeting macOS, although it generates some warnings

 warning same member name (qrc_assets.o) in output file used for input
 files: qrc_assets.o qrc_assets.o
 (due to use of basename, truncation, blank padding or duplicate input
 files)

So there is some hope this could be fixed for iOS in the future.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-103497
Change-Id: I91152247651ecd35e8110b8874399cb1b8b394bd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-20 20:56:59 +02:00
Volker Hilsheimer
2e12479e06 QGraphicsScene: respect that items can override selection changes
QGraphicsItems may override itemChange to prevent certain attribute
changes. Overriding ItemSelectedChange this way is explicitly documented
to be allowed.

However QGraphicsScene::clearSelection did not test whether items were
in fact deselected after the call to setSelection, and always cleared
the stored set of selected items.

Fix this by checking the actual selected state of the item as we iterate
over them, and store those items that are still selected in a set that
becomes the new selectedItems set (which will be empty if no item
overrides, which is the default).

Add a test that also checks that clearing the selection emits the
selectionChanged signal correctly (and does not if all selected items
block being deselected).

Fixes: QTBUG-85474
Pick-to: 6.4 6.3 6.2
Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-20 20:44:23 +02:00
Heikki Halmet
bb674adb25 BLACKLIST tst_qfont for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-84248
Change-Id: I2978cd2a6ed07bb6fc5769b174d0a897dfa3566d
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 17:06:20 +00:00