'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>
- 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>
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>
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>
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>
...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>
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>
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>
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>
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>
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>
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>
Set it to nullptr on clear, and deal with possibly null bindingStatus.
Task-number: QTBUG-101177
Task-number: QTBUG-102403
Pick-to: 6.4
Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In combination with EGL_EXT_platform_xcb support, this allows xcb_egl
to be used without xlib. Without EGL_EXT_platform_xcb support, this
still reduces amount of code using xlib.
Pick-to: 6.4
Change-Id: I29e2b29f7ef8ea34320887f62697f84232b86fba
Reviewed-by: Liang Qi <liang.qi@qt.io>
In a lambda, capturing of `*this` by reference via `=` is deprecated,
and breaks the build. Capture everything needed instead.
Amends fb981a0954.
Change-Id: I5d3d192e71662b96154cb5979898277bd0720a90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In a lambda, capturing of `*this` by reference via `=` is deprecated,
and breaks the build. Capture everything needed instead.
Amends e7477e8934.
Change-Id: Ibdbf51cb7a5ec54004b14b719dfd44e86d6f0893
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Recent changes on load speed of individual assets made
AndroidAbstractFileEngine use a cache for basic information in order
to avoid to have to open assets every time a QFileInfo is created,
which was very expensive for older phones.
However, size() method was forgotten and continued to expect that the
asset would be opened first, and therefore QFileInfo().size() would
always return -1.
This change fixes this by caching as well the information about the
size of the asset, and also reverts a part in open() to close() first
in case asset would already be opened, in order to keep previous
behavior (even if this did not cause any known issue).
Fixes: QTBUG-104412
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Added for 6.4. Not extremely useful as long as the macros that allow
the declaration of new class and type strings also being documented.
Pick-to: 6.4
Change-Id: I9ee466fdd0aaccec1e627ceb313b5a5c17e3f3fa
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
As it stood, QTableView would sometimes show drawing
artifacts when sections (rows or columns) where
rearranged, in combination with spans.
The reason is that the current code would go through the
currently visible cells in the viewport to check if any of
them where affected by a span. But the stored spans (in
QSpanCollection) is kept in sync with the column layout in
the model, and doesn't know anything about the rearranged
columns in the view. But a column with spans that is moved
to the left of the viewport can affect the painting of
the viewport as well, and needs to be taken into consideration.
For that reason, the current solution that uses
QSpanCollection::spanAt(x, y), will in that case fail.
Since it seems sensible that QSpanCollection is kept in sync with
the model (it makes model changes that affect spans easier to
handle), this patch will not change QSpanCollection. Instead, it
will iterate through all the spans (which is assumed to normally be
a limited size), convert them to the column layout of the view
(visual instead of logical), and find the ones that overlap.
Overlapping spans will, like before, be added as clip rects
to the QPainter.
Fixes: QTBUG-91896
Pick-to: 6.4 6.3 6.2
Change-Id: Iabe20df13cbd41a68f1104d3d9e24b89c4b88913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We missed the terminating ";" in the QSKIP lines.
Amends ea4d6b987a
Pick-to: 6.3 6.4
Change-Id: Ibda43b8a84230c243dbcc74e157f4c3f8ef3891d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And also update some docs to provide more detailed info.
Pick-to: 6.4
Change-Id: I7b51fcb6613399cb4f1dd5d75cf3168df195577b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Thread termination might prevent stack unwinding, which then
generates ASAN errors such as
ERROR: AddressSanitizer: stack-buffer-underflow on address
0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8
Skip such tests so that we can enable blocking CI runs under ASAN.
Fixes: QTBUG-104421
Pick-to: 6.4 6.3
Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Upstream PR: https://github.com/rockdaboot/libpsl/pull/182
The repo owner denied the PR because the library only
produces C89-compatible code and constexpr is a C++ feature.
Pick-to: 6.4
Task-number: QTBUG-100485
Change-Id: I9e01705b27022a636a98ac67b19169677d7c7652
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It seems this block of code was originally copied from elsewhere
so the original indention is preserved.
Pick-to: 6.4
Change-Id: I53ab8e58b4304dfc768bd6472255a6c2d0471d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This adds support for additional codecs to QStringConverter when ICU is
available.
We store the converter in the state (d[0]), and its canonical name in
d[1]. We need the name there, as in the clear function we close the
UConverter, and set the pointer to null. Consequently, the actual
conversion functions might need to re-open the converter again. The
advantage of this approach is that clear is used in the destructor of
State, and with this approach we properly clean up the state.
There is however a disadvantage: The clear function was so far also used
for resetting the state when QStringConverter::resetState . Discarding
the whole Uconverter for that is however rather costly. For that reason
we modify resetState to call a new function, State::reset. For existing
converters, it behaves the same as clear; for the ICU based converter,
we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can
benefit from this more efficient version; code compiled against older Qt
versions will continue to work, as the conversion functions can just
recretate the converter from the name.
We can distinguish between ICU and non-ICU converters by checking if the
UsesIcu flag is set.
QStringConverter::name is changed to return the name stored in d[1]. The
interface of the ICU converter has a dummy name, so code using the old
name function from QT < 6.4 still returns something, namely a message
asking the user to recompile.
The function is moved out of line, as we need to check for the private
ICU feature, and want to avoid having that check in the public header.
As the QStringConverter ctor taking a name now can allocate memory, it
can no longer be noexcept. Removing the noexceptness is safe, as it was
only added after Qt 6.3.
Note that we cannot extend the API consuming or returning Encoding, as
we use Encoding values to index into an array of converter interfaces in
inline API.
Further API to support getting an ICU converter for HTML will be added
in a future commit.
Currently, the code depending on ICU is enabled at compile time if ICU
is found. However, in the future it could be moved into a plugin to
avoid a hard dependency on ICU in Core.
[ChangeLog][Corelib][Text] QStringConverter and API using it now
supports more text codecs if Qt is compiled with ICU support.
Fixes: QTBUG-103375
Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The WM_DISPLAYCHANGE message it sent when displays are added, removed,
or update their properties such as the scale/DPI.
We were processing this message as part of QWindowsContext::windowsProc(),
which meant that we would only react to display changes if there was a
QWindow on screen. Just creating a QGuiApplication was insufficient to
pick up changes to screens after startup.
In addition, despite being documented to post messages to child windows,
WM_DISPLAYCHANGE only ends up in top level windows. Presumably it's the
top level window's responsibility to post the message to child windows.
As a result, if a QWindow was a native child window of a foreign window,
such as in audio plugins being hosted in a DAW, we would again fail to
pick up display changes.
We solve both these cases by decoupling the WM_DISPLAYCHANGE handling
from QWindowsContext::windowsProc(), by creating a dedicated window
for listening to WM_DISPLAYCHANGE. This is similar to how we already
handle tray icons, power notifications, clipboard, etc -- the only
difference being that since purely HWND_MESSAGE windows do not
receive WM_DISPLAYCHANGE it's an actual invisible WS_TILED window.
This also lets us remove the workaround for QTBUG-79248, which was
doing screen updates in response to WM_DPICHANGED when detecting
that there were no QWindows.
Task-number: QTBUG-103383
Task-number: QTBUG-79248
Fixes: QTBUG-102343
Pick-to: 6.4
Change-Id: I905d8253069ec339b193edf05c052d21361ca3e9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
As of Qt6, QList will assert that an insertion index is in range of
existing values. QBoxLayout interprets negative indices as "append at
the end". That part is covered.
Indices larger than the number of items in the layout would trigger the
assertion in QList, but after the insert method had returned. That would
make it hard to debug. This change asserts the index range before
inserting, thus making it easier to spot the problem.
Fixes: QTBUG-103775
Change-Id: Ida099f785263fe8a5c8a1d0a48c4ff87713549b4
Pick-to: 6.2 6.3 6.4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
also remove duplicated function call to get Qt key for event
Pick-to: 6.3 6.4
Fixes: QTBUG-78826
Change-Id: Ibaf0dd3eb428b65280ed1f840a4849b44f2868e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
androiddepployqt calls qmlimportscanner to find qml modules.
Due to an issue in a generator expression, CMake did not write out the
android default qml output directory to the deployment json file,
which in turn means that qmlimportscanner did not get that
information.
When the scanner scanned the sources, it found some relative imports
but couldn't find relevant qmldir files because they were in an
android-specific directory.
This caused warnings like 'qmldir file not found at /some/path'
repeatedly.
Fix the generator expression to use $<COMMA> instead of , so that the
genex condition is evaluated successfully and the extra qml import
paths are passed along to qmlimportscanner.
Amends 76665f2a72
Pick-to: 6.4
Fixes: QTBUG-102595
Change-Id: Ia74c3c80f12d05b0a9cd0978df1a58bb5582198a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
A generated file can be added to a resource target, which in turn
adds it to the other_files target. With the Xcode generator, this can
lead to errors like
The custom command generating foo.txt is attached to multiple
targets:
foo_other_files
foo_resources_1
but none of these is a common dependency of the other(s). This is
not allowed by the Xcode "new build system".
Neither of the targets depend on each other because logically
they shouldn't depend on each other.
And yet XCode wants that each generated file is attached only to one
target, which will be a common dependency for the other targets.
Make sure _qt_internal_expose_source_file_to_ide extracts and uses
that common target dependency just like
qt_add_resources -> _qt_internal_process_resource already does.
One case of a common target dependency is the _lrelease target
in qttools which was added in 5b0e765ab0dddba86662925cb44aeac748a286b7
Another case is in qt_add_shaders in qtshadertools.
I expect we might encounter other cases where we need to introduce a
common driving target.
Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-103723
Change-Id: Ideff023718a6ce109a4b3eefa01bffa79d1c6a3e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Amends 53ee4c8b1f, which deprecated
QListWidgetItem::setTextAlignment(int) etc and provided a typesafe
Qt::Alignment overload instead. However, Qt::AlignLeft by itself is of
type Qt::AlignmentFlag, it only becomes a Qt::Alignment when or'ed
with another alignment flag. So the deprecated int-overload was taken
by the compiler, resulting in a deprecation warning.
Add a Qt::AlignmentFlag overload in addition, and document it as
\internal since it is just a C++ technicality that we need both.
Pick-to: 6.4
Change-Id: Ide97eed7f6d1f89a5f955b2ed45167e771bd8c81
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When QWidget::resize() is called on a maximized or minimized QWidget,
the window state of the widget and the corresponding QWindow is not
updated (i.e. remains maximized or minimized).
This patch updates the window state to Qt:WindowNoState when
setGeometry() is called in QWindowsWindow or QXcbWindow.
A test is added in tst_QWidget.
Fixes: QTBUG-104201
Pick-to: 6.4
Change-Id: I07491fb9293d13509573fc403750da0a50f6a785
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
According to
https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/.
Added support for Net/CursorBlinkTime Net/DoubleClickTime
Net/DoubleClickDistance Net/DndDragThreshold.
Change-Id: Ief208736ed2938792d935bfd730fefdd745394b6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Restoring the toolbar state of a QMainWindow could not update
QWidgetPrivate::widgetItem for the QToolBar, because at that point it
was still holding the pointer to the widgetItem of the previous state.
Later on, when the new state was successfully applied, the previous
state was deleted, and the corresponding widgetItem was reset to
nullptr.
This patch explicitly resets the QToolBar's widgetItem while updating
the state, so that it is later correctly updated while creating a
new QWidgetItemV2.
Fixes: QTBUG-102395
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I17613d62423edcc0faf85ecb0a714865a50d87e8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When the print dialog is opened without a printer installed, then the
printer's output format is PDF rather than native. In this case, we need
to set the NSPrintInfo with some page atttributes explicitly, and not
default to the application-wide NSPrintInfo.sharedPrintInfo. Otherwise,
the print dialog will show the wrong page size and orientation, and the
printer will not have the previously set values when the dialog returns.
The dialog always shows the wrong values for the page margins (only
available through the presets dialog), but the printer's values are not
overridden. Also, the print range is taken care of correctly by the code
further down in this function, irrespective of the printer's output
format.
Note: this cannot be unit tested as we need to open the native print
dialog on a system without printer installed, and compare the values we
set on the printer before opening the dialog with the values after the
dialog was successfully finished via PDF->Save as PDF.
Fixes: QTBUG-100188
Pick-to: 6.4 6.3 6.2
Change-Id: I8f1561e054f6a867b131111845c9b061778e4eb0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>