Commit Graph

57726 Commits

Author SHA1 Message Date
Sona Kurazyan
5ae013a2b6 Remove unneeded Q_DECLARE_SHARED_IMPL
After d06a686cad, Q_DECLARE_SHARED_IMPL is
used only in Q_DECLARE_TYPEINFO, so remove the indirection through
Q_DECLARE_TYPEINFO_IMPL.

Change-Id: Ida188053c4ea512e9ebdf04f807f86a6159f8425
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-24 17:50:25 +02:00
Mikolaj Boc
11f12521bc Resolve window focusing problems on WASM
- Moved the modal window resolution to
QWasmWindow::requestActivateWindow so that multiple async activation
events are not issued in unpredictable patterns.
- Request activation on added windows and on stack top in case of
window removal

Pick-to: 6.4
Change-Id: I6f02cf1b7e83abb7961caf311ffc83e91c8bf810
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-24 17:50:25 +02:00
Edward Welbourne
0acb56518d Rearrange mapLocalTime() so its millis always have the right sign
Doing a simple division to get seconds, before using rounding-down
division to get days and positive seconds, saves the need to check for
seconds and millis in opposite directions that might cause a needless
overflow when computing the final result.

Change-Id: Ia4f95bb0510eb4f2c1f9131a34d317bd41bbed2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-24 16:08:18 +02:00
Axel Spoerl
854cb55987 Make QHeaderView restore state from different stream versions
If restoring a QHeaderView state from a data stream with version Qt_5_0,
check alignment and resize mode properites for out-of-bound values.

If out of bounds, try QDataStream version Qt_6_0, which is used by KDE
apps compiled with 5.15.2 or 6.2.3.

QFileDialog stores settings in the same settings file across different
Qt versions, using different QDataStream versions. That makes
QFileDialog vulnerable to the issue (QTBUG-104962). A respective auto
test is added with this patch.

Fixes: QTBUG-104962
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104425
Change-Id: I666207fca7ab837ad27a247e504a40757ee8afab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-24 14:08:18 +00:00
Joerg Bornemann
e38c7618be CMake: Fix Android build for CMake < 3.19
The Android build used cmake_language(DEFER) and guarded with a check
for CMake's version being >= 3.18.  However, cmake_language(DEFER) was
introduced in CMake 3.19.  Fix that version check.

Fixes: QTBUG-105841
Pick-to: 6.3 6.4
Change-Id: Ic318c104cf212de4c97c5a89b73536609826fd5b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-24 15:11:40 +02:00
Michael Weghorn
1f35be2f38 tests: Fix tst_qprinterinfo for CUPS printer instances
CUPS has a feature called printer instances that allows saving
different sets of default options for a single print queue,
s. section "Creating Saved Options" at [1].

A printer instance can be set up using e.g.

    lpoptions -p printer/instance -o name=value

The printer instance is then listed with the print
queue name and the instance name separated by a slash
in the 'lpstat -e' output.
Qt also supports CUPS printer instances and displays
them using the same as printer names.

However, tst_QPrinterInfo::getPrintersFromSystem was
previously truncating the printer name at the slash,
so the comparison of printer names on a system that
has CUPS printer instances set up would fail e.g. as follows:

    ********* Start testing of tst_QPrinterInfo *********
    Config: Using QtTest library 6.5.0, Qt 6.5.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 12.1.0), debian unknown
    PASS   : tst_QPrinterInfo::initTestCase()
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() Test believes Default Printer                              =  "PDF"
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() QPrinterInfo::defaultPrinter() believes Default Printer    =  "PDF"
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() QPrinterInfo::availablePrinters() believes Default Printer =  "PDF"
    PASS   : tst_QPrinterInfo::testForDefaultPrinter()
    QDEBUG : tst_QPrinterInfo::testForPrinters() Test believes Available Printers                              =  QList("Canon_MX390_series", "PDF", "PDF", "PDF-5cm-margins", "dummy", "dummy-ricoh-c3000", "tofile-hp-officejet-8600", "tofile-ricoh-aficio", "tofile-ricoh-mufu", "tofile-samsung-m2875", "tofile-test-tdf106963", "tofile-xerox-phaser-6510")
    QDEBUG : tst_QPrinterInfo::testForPrinters() QPrinterInfo::availablePrinters() believes Available Printers =  QList("Canon_MX390_series", "PDF", "PDF-5cm-margins", "PDF/myinstance", "dummy", "dummy-ricoh-c3000", "tofile-hp-officejet-8600", "tofile-ricoh-aficio", "tofile-ricoh-mufu", "tofile-samsung-m2875", "tofile-test-tdf106963", "tofile-xerox-phaser-6510")
    FAIL!  : tst_QPrinterInfo::testForPrinters() Compared values are not the same
       Actual   (qtPrinters.at(i))  : "PDF-5cm-margins"
       Expected (testPrinters.at(i)): "PDF"
       Loc: [/home/michi/development/git/qt5/qtbase/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp(232)]

Fix this by adding the slash character to the regex.

[1] https://www.cups.org/doc/options.html

Change-Id: Id0dc27a8b4c592847ed364cebf277e988039cad4
Reviewed-by: Albert Astals Cid <aacid@kde.org>
2022-08-24 14:20:14 +02:00
Mitch Curtis
9c66af1f1d Account for dark system themes in qt_fusionPalette
On Ubuntu (Gnome), the Fusion style didn't account for when a dark
theme was set in the system's settings. Neither QGtk3Theme, nor
QGnomeTheme (which it derives from) provide a palette() implementation,
so they'd fall back to QPlatformTheme's. This default implementation
calls QPlatformThemePrivate::initializeSystemPalette(), which uses
qt_fusionPalette().

This patch accounts for QPlatformTheme::appearance() in
qt_fusionPalette(), adjusting the palette roles accordingly
to look correct when run under a dark theme.

This also fixes the same issue for the Fusion style in Qt Quick
Controls.

Fixes: QTBUG-90504
Task-number: QTBUG-99276
Pick-to: 6.4
Change-Id: Id096bf809ef7a63dc440b5a68283e123173e917e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-24 15:18:21 +08:00
Mikolaj Boc
a4c0e442e5 Disable resizing only when explicitly asked
Do not assume that popups are unconditionally non-resizable. Only
disallow resizing if explicitly asked by minimum/maximum size match.

Change-Id: Ia8e3e4d074e4dc24b0ae4be56858e0d833eeebdb
Pick-to: 6.4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-24 04:49:11 +02:00
Mikolaj Boc
8d728a0ed9 Implement the batch_tests feature
An approach of test batching (joining multiple tests into a single
binary) has been taken, due to long linking times/binary size on certain
platforms, including WASM. This change adds a new feature
'batch_test_support' in Qt testlib. Based on the value of the feature,
test batching may become enabled with the -batch-tests switch.

Batching works for every target added via qt_internal_add_test. When
first such target is being processed, a new combined target for all of
the future test sources is created under the name of 'test_batch'.
CMake attempts to merge the parameters of each of the tests, and some
basic checks are run for parameter differences that are impossible to
reconcile.

On the C++ level, convenience macros instantiating the tests are
redefined when batch_tests is on. The new, changed behavior triggered
by the changes in the macros registers the tests in a central test
registry, where they are available for execution based solely on their
test name. The test name is interoperable with the names CMake is aware
of, so CTest is able to run the tests one by one in the combined binary.

Task-number: QTBUG-105273
Change-Id: I2b6071d58be16979bd967eab2d405249f5a4e658
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-08-24 02:46:37 +02:00
Sona Kurazyan
8446655f24 Remove QT_MODULE define
This doesn't seem to be used in any of the modules.

Change-Id: I5c007f50bdd9f5ed5f512606a0d4599593c6b40e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-24 01:00:08 +02:00
Sona Kurazyan
11ee62bf76 Move Q_AUTOTEST_EXPORT to qtconfigmacros.h
The include statements for qconfig*.h can now be moved there too.

Task-number: QTBUG-99313
Change-Id: I65f564fc48b9074861b0f8b50046062c2e83090c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-24 01:00:08 +02:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Juha Vuolle
501dfe1bc7 Unstringify QTimeZone Android parts
Qt 6.4 introduced new facilities to reduce the plain strings
with Android methods/signatures.

Fixes: QTBUG-104187
Change-Id: I94fc336f253e4969ac96ebcba5c1423989b340ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-23 22:33:20 +03:00
Mikolaj Boc
80d9436488 Remove the dead drawShadePanel in qwasmcompositor
The method is not used anywhere. Remove it to save tens of LOCs.

Change-Id: Id853d12d238aa30eb197ab3fed7ccc24a2213e31
Pick-to: 6.4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-23 18:49:47 +00:00
Axel Spoerl
7c61eb101d Revert Q_DECLARE_EXPORTED_LOGGING_CATEGORY in tst_qdockwidget
Q_DECLARE_EXPORTED_LOGGING_CATEGORY is available from 6.5 only, hence
cherrypicking this solution fails.

Change-Id: Ib3351a8846bb5cf6047cd2d13c9f7cd242df9c93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-23 20:49:47 +02:00
Paul Wicking
767bac9c5e Doc: Format certain operators in text
Use correct text formatting; this ensures e.g. the decrement
operator isn't converted to an en dash in the docs. Apply
to increment operator docs also for consistency.

Task-number: QTBUG-105729
Change-Id: I5f126b90bc1d1b91d86e1f87c9b17a583841adb6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-08-23 20:49:47 +02:00
Laszlo Agocs
37bf3b883d rhi: metal: Update out-of-date internal comments
Would have been nice to provide a flag to set the METAL_DEVICE_WRAPPER_TYPE
env.var. but apparently it needs to be set very early, the QRhi just cannot
do it, it's too late to qputenv then. So just update the internal docs.

Change-Id: I94926debe3af73b67018c5449d7893df38f31f0d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-23 20:49:47 +02:00
Marc Mutz
6b146566e6 [docs] QAnyStringView: remove the prediction that Qt 7 will drop L1
UTF-8 can never replace Latin-1 as the go-to US-ASCII superset,
because, as a variable-length encoding, it cannot use the important
size check in equality comparisons with UTF-16 to avoid having to
iterate the whole string data.

Mention that.

UTF-8 only makes sense in a UTF-8-only environment where the size
check works again. As long as our preferred charset is UTF-16, Latin-1
must be the preferred US-ASCII wrapper.

Pick-to: 6.4 6.3 6.2
Change-Id: Ibe52cfc0c9fce0e7aaacd4cd8d6361e8d8bdee3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-23 20:40:59 +02:00
Timur Pocheptsov
da951c9dbf QCocoaDrag: don't add pasteboard items with non-absolute URLs
AppKit rejects them and we end up with inconsistent number of pasteboard
items and drag images:

"NSURLs written to the pasteboard via NSPasteboardWriting must be absolute URLs."
"There are 1 items on the pasteboard, but 2 drag images."

Fixes: QTBUG-105711
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7b1bc99f6e0b2b304f92f69125fb6af4ab5e303f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-23 07:59:19 +02:00
Yuhang Zhao
1270284f8d QSystemLibrary: Cache the system directory path
The system directory path won't change during the lifetime
of the application, so cache it to avoid querying it for
multiple times.

Change-Id: I302285794d491d581d74a93e7ba9affc6379c681
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-23 11:24:15 +08:00
Yuhang Zhao
00618db5ff QSystemLibrary: Use in-class initialization
Initialize the member variables in class. It's more modern and
also saves some typing in some constructor functions.

Change-Id: Ib4d942610a57e0af3f22248c00207d7cdb683763
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-23 11:24:06 +08:00
Ilya Fedin
c2bcba0d3c Fix build without highdpiscaling feature
Fixes: QTBUG-104925
Pick-to: 6.4
Change-Id: Ieb5dd2194c54a61733c427c8a0ddf7576147d6ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-23 05:41:16 +04:00
Thiago Macieira
f514ed7d76 QProcess/docs: add more information about environment variables
Fixes: QTBUG-42500
Pick-to: 6.4
Change-Id: Ie4bb662dcb274440ab8bfffd170a6a56977ef8b9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-08-22 14:37:26 -07:00
Volker Hilsheimer
5afb04d79b Mac: close popups opened on inactive application on relevant user action
On macOS, users can right-click into an inactive application to open a
context menu without activating the application. Qt handles a number of
events to close open popups (window deactivating or a mouse press
outside the popup), but none of those will get called when the
application is already inactive. So the popup might stay open (and on
top of the window stack) when the user clicks into other applications,
or activates another window.

To fix this we need to watch for events outside of the Qt application on
which we need to close the popup: when the user presses a mouse button,
or activates another application using Cmd-Tab. But we don't want to
monitor for key events, as that requires user permission. Use a global
event monitor to watch for mouse presses, and an notification observer
to watch for application activations, and respond by closing all popups
(and removing the monitor and observer again).

Use the monitor as well to watch for mouse moves, and pass only those
events through the Qt event system so that mouse tracking in the menu
works even if the application is inactive. This change brings back a
version of the global event monitor we had in Qt 5.15.

However, a press into our own menu will trigger the activation observer
after the application became active, which would now close the menu. We
don't want that, so we also need to remove the observer when the
application becomes active (which makes sense anyway, as we will get
regular events from then on).

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-105474
Change-Id: I18573fcda09a46c27730bd670a795f4d467aab01
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-22 20:10:13 +02:00
Volker Hilsheimer
03144190df Mac: close popups when the user clicks into the menubar
Otherwise it is possible to have a context menu and a menu from the
menu bar open at the same time. Native applications close the context
menu, but also block the click into the title bar. This change only
closes popups, the click goes through to the menubar.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-105474
Change-Id: I664c00eea83ba8fb43cc8a630d787f2d2b5b96ff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-08-22 20:10:11 +02:00
Ilya Fedin
cf6ab64f03 Move PreselectFirstFileInDirectory theme hint from QGtk3Theme to QGnomeTheme
It doesn't use any gtk API, so can live in QGnomeTheme

Pick-to: 6.4
Change-Id: Iff0391de6f01a03981f6e45b04fe9824fd2becfc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-08-22 09:20:04 +04:00
André de la Rocha
62d957f6aa Windows QPA: fix tree item discovery through UI Automation
This change reverts a workaround for a compatibility issue with
a Windows utility, which is no longer necessary with Qt6 and was
in some cases preventing accessibility tools from discovering
tree items.

This reverts commit 1c55a6caf1.

Fixes: QTBUG-105814
Pick-to: 6.4 6.3 6.2
Change-Id: Id464da49704b6953affca2fa40acc03f1ffd05ac
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-08-22 02:43:13 +02:00
Tor Arne Vestbø
1ecfc4101c tst_qgraphicswidget: Avoid redeclaration of Size from MacTypes.h
If an included header brings in MacTypes.h it will cause issues,
so rename the enum to be on the safe side.

Pick-to: 6.4 6.3 6.2
Change-Id: I29ec795be74a65d4f2267d8121a514bf192cf969
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-21 14:40:38 +02:00
Tor Arne Vestbø
3053df3366 Add some more logging to QFontDatabase
Change-Id: I5ac289cb7cb0beb842c403683681a739c44b26a1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-08-21 14:40:38 +02:00
Yuhang Zhao
c519372dbf QSystemLibrary: Replace 0 with nullptr
Use modern C++ more.

Change-Id: I8ba2a6e95187976b7e4077bb39f05eab04a8575f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 19:04:51 +08:00
Marc Mutz
c51c4aa2c5 [docs] QAnyStringView: mention automatic U8→L1 reclassification
...for US-ASCII literals.

Amends eaabd0c545.

Pick-to: 6.4
Task-number: QTBUG-101014
Change-Id: Id0acccb9bf2dfb01bca93f62da634e8dfe299fbc
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:31:00 +02:00
Marc Mutz
f8c23116bb Fix int/qsizetype mismatches in data url support
More int/qsizetype mismatches.

Task-number: QTBUG-103525
Pick-to: 6.4 6.3 6.2
Change-Id: I30723b6f59fa62dd7096110458305da7573ad345
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:30:11 +02:00
Marc Mutz
35cbf52f0c Port QDir to qsizetype [1/3]: indexed to ranged loops
Indexed for loops are prone to int/qsizetype mismatches, so use ranged
for loops where possible.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: Ia3e97a6b2924f92d3f7fb1a7ae075b59188006e9
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:54 +02:00
Marc Mutz
f06c41e729 QDir: fix non-idiomatic indexed loop counting
Counting backwards from two may be clever, and less to type, but it
raised this code reader's eyebrows, so use the formulation everyone
understands instead.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: I9416539e552e78e4777a744405b0773a9df1f6d0
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-21 08:29:47 +02:00
Marc Mutz
4906b43b00 QCoreGlobalData: remove
Inline the data members into the only remaining user (qdir.cpp) and
remove the class.

As a drive-by, fix the non-idiomatic use of QT_BUILD_CORE_LIB to mean
!QT_BOOTSTRAPPED and apply the guard consistently to the declaration,
too.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-105747
Change-Id: If2c780dd96e2a2e331cabdc42fd920874e7737b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-21 08:29:37 +02:00
Marc Mutz
48c5780d5f qdir.cpp: remove unused qresource.h
Probably amends f369be93a1.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-105747
Change-Id: I6b6d9c7d1193bdc1ec470f7d8c57b433ccee8e75
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:29 +02:00
Marc Mutz
eef0013086 QDirPrivate: pass input QList by cref
Unlike the mutable lvalue reference that was previously used to pass
it suggested, the input is never modified, so pass by const reference.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I5659fe5eab4a8953cd36134735e9e8fd9601f530
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:23 +02:00
Marc Mutz
84277dda00 QDir: replace an indexed loop with all_of()
Replaces ten LOC with int/qsizetype mismatches with two LOC with no
ints in sight.

For reviewers that don't know std::all_of: it's range conjunction aka
universal quantifier, which means it returns true for the empty set.

Task-number: QTBUG-103525
Pick-to: 6.4 6.3 6.2
Change-Id: I2423102631a66996b1faff7297c7fc365f0ffb12
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:17 +02:00
Marc Mutz
d8561b1dea QDebug: finish porting to qsizetype/size_t
Port two variables from int/uint to qsizetype/size_t. These don't
cause problems, because their possible ranges are limited, however,
int/uint variables are a code smell these days, so replace them
nonetheless.

[ChangeLog][QtCore][QDebug] Fixed issues on 64-bit platforms when
streaming containers (incl. strings) of more than 2Gi elements.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: Ica6c5a6a062990306280fb713c47adb2053b752d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:11 +02:00
Marc Mutz
db44800627 QContiguousCache: fix streaming into QDebug when indices are > INT_MAX
As usual, int/qsizetype mismatch.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: Ic5d9fb4fd42e4534ec0358ca7c4d79650c6ac919
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:29:04 +02:00
Marc Mutz
bc2b8411c9 QDebug: finish porting put{String,ByteArray} to qsizetype
The underlying QTextStream seems to support qsizetype-sized data and
the private API of QDebug that is under consideration in this patch
takes size_t, but, as so often, there're int/uint casts in-between
that break things.

Widen the int/uint casts to qsizetype/size_t, respectively.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: I10bca093dc2d6f136871c94ca43f5b42fd1c8971
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:28:59 +02:00
Marc Mutz
a888239cf1 QDebug: port putEscapedString() from int to size_t
All callers of the function pass size_t values, so remove the
impedance mismatch and preserve the value.

Adjust local variable runLength to qsizetype, because with this change
the int variable may now overflow, which would cause infinite looping.

Adjust callers to not perform narrowing conversions.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: I2a9d3301118855fc95245a55bf64de6c46fa2f51
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:28:51 +02:00
Marc Mutz
bcc32bc112 Port QtDebugUtils::toPrintable() to qint64/qsizetype
Some callers pass qint64 arguments to the len parameter, so take the
size as qint64, not qsizetype, to avoid silent truncation.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: I4bc5673297f24aea0cfc9d20887dc8a877743214
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-21 08:28:44 +02:00
Marc Mutz
52c5f28695 QBuffer: optimize setData(ptr, n)
The old code always created a new QByteArray, always allocating
memory.

The new call assigns the data to the existing QByteArray, enabling
potential re-use of the internal QByteArray's buffer. Since QByteArray
is missing the STL-style assign() function, abuse replace() for this
task.

Change-Id: I357f11bad0a976d4d0fb2faeb93f8b2262fa5a65
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-20 21:22:53 +02:00
Marc Mutz
817e47fbcd QBuffer: fix the setData() API re: int/qsizetype
The setData(ptr, n) overload was still taking the size as int.

Widen it.

Task-number: QTBUG-103525
Change-Id: If1d6d6404d62bbae5e0defea9a2115648c1fd5da
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-20 21:22:29 +02:00
Volker Hilsheimer
3be99799a6 Don't access QObjectPrivate::declarativeData unguarded
The QObjectPrivate::declarativeData member is stored in a union with
currentChildBeingDeleted. The QObject destructor always sets the
currentChildBeingDeleted member of the union. It also sets the
isDeletingChildren bool, which is the only way to find out which union
member we can safely access.

While the QObject destructor is deleting children and isDeletingChildren
is set, we must not access the declarativeData member of the union.

Add a test case that initializes the function pointers for the
declarative handlers and constructs a situation where an object
emits a signal while it is destroying children.

Fixes: QTBUG-105286
Pick-to: 6.4 6.3 6.3.2 6.2 5.15
Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-20 03:55:12 +02:00
Mikolaj Boc
503018ae07 Do not invalidate the entire window on window move on WASM
The invalidate on window move is redundant - the previous texture can
be reused for the window. Just request another refresh on the compositor
and don't update the window texture. Makes window moves smoother.

Pick-to: 6.4
Change-Id: Ied2922a000d3c8e6143e64d029154d74bc4f3480
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-20 02:51:34 +02:00
Mikolaj Boc
2a23652bbb Avoid image format conversion when drawing window nonclient area
This radically speeds up window resizing and dragging.

Fixes: QTBUG-105709
Pick-to: 6.4
Change-Id: I844601a5b139d21024db0c373482af18f350d0eb
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-20 01:16:41 +02:00
Alexey Edelev
f3f0d646b9 Add possibility to store source files for interface targets
Add source files to the _qt_internal_target_sources property, when
running qt_internal_extend_target on interface libraries instead of
ignoring sources for CMake versions that don't support non-interface
properties. The property is not full-functional, but still allows to
execute internal routines on target sources.

Also add qt_internal_get_target_sources_property function that helps
to destinguish which property stores target sources.

Task-number: QTBUG-103196
Change-Id: I435c558090a24a7988f1a1c49f924dc195e72480
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-19 23:53:11 +02:00
Alexey Edelev
a2809d9ec1 Fix Multi-ABI builds when CMAKE_<C/CXX>_COMPILER_LAUNCHER contains list
Add list-escaping for CMAKE_<C/CXX>_COMPILER_LAUNCHER variables when
passing them to an external ABI-specific Android project.

Amends c7231177df

Pick-to: 6.3 6.4
Change-Id: I0c98eee6594c395dc6a37465a99ea32b1af39b84
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-19 23:53:11 +02:00