Commit Graph

62921 Commits

Author SHA1 Message Date
Orkun Tokdemir
bc0c44d4cd _qt_internal_create_moc_command: Fix genex parse
The function was replacing the `>` character in generator expressions coming from `add_compile_definitions`. This was creating generator expression syntax errors. Discard generator expressions from character replacing.
Add tests for the three cases.

Fixes: QTBUG-111717
Change-Id: I694d2908738085fdf15112834f20183a9f393422
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-17 13:09:46 +02:00
Tasuku Suzuki
7301cd5cfa Fix build with -no-feature-dragandrop
Change-Id: I9ac2a9edb747608ef93008ac865886b1ee0ea82a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: David Redondo <qt@david-redondo.de>
2023-08-17 16:18:57 +09:00
Volker Hilsheimer
3965d52ad5 QTabBar: don't make current tab visible while tab bar is invisible
When changing the current index while the tab bar is not visible,
calculating the necessary scroll offset might result in wrong results if
the tab bar still has an old size. When the tab bar then gets shown and
resized, the scroll wouldn't be corrected, potentially leaving tabs
unnecessarily scrolled out.

We don't need to make the current index visible if the tab bar itself is
not visible, it's enough to flag the layout as dirty so that the next
show event (which either way makes the then current index visible)
triggers a laying out of the tab bar tabs.

Amends e851d4c06154bf02b23030ff1f7024a8b9edf874.

Fixes: QTBUG-115109
Task-number: QTBUG-113140
Pick-to: 6.6 6.5
Change-Id: I3d8633f9f8b907a36190123839a6104a17bfe138
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-16 22:36:35 +02:00
Fredrik Ålund
6e9f989eb6 Fix architecture selection for Mimer SQL client library
Case-insensitively match the architecture string for x86 and amd64.

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: I775e81965f46bb7479e0e9a05e66b8a080656ee5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-08-16 17:04:40 +00:00
Alexandru Croitor
121f7f382b CMake: Allow installation of example sources into the Qt prefix
In Qt 5 times, if Qt was configured with -make examples, running
make install would not only build and install the example binaries,
but would also install the example sources into the prefix.
Installation of example sources was not implemented when the Qt 6
build system has switched to using CMake.

There is still a use case for it though, mainly for Qt Creator, which
only shows the examples of a Qt kit if the sources are available.

In contrast to Qt 5, in Qt 6 we will not install example sources
by default. It will be opt in.

To enable installation of examples sources, configure with

 configure -make examples -install-examples-sources

or

 cmake -DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON

The -make examples part is required, otherwise
-install-examples-sources has no effect.

All example sources can be installed by calling
 cmake --install . --component examples_sources
in the qt repo build directory.

In a top-level build, per-repo installation can be done using
 cmake --install . --component examples_sources_<repo_name>
where repo_name could be 'qtbase'.

A single example's source can be installed by calling
 cmake --install . --component examples_sources_<subdir_name>
where subdir_name is the subdirectory name of the example, e.g.
'gallery'.

Implement installation of example sources by hooking into the
qt_internal_add_example command.
This means that all examples in all repos need to be added via
qt_internal_add_example instead of add_subdirectory, to ensure the
sources are installed. The majority of repos already use it.

For testing purposes one can configure with
-DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON
-DQT_INTERNAL_NO_CONFIGURE_EXAMPLES=ON to allow testing installation
of examples sources without building them.

Take into account an additional variable called
QT_INTERNAL_EXAMPLES_SOURCES_INSTALL_PREFIX to allow installation of
example sources into a location different from the example binaries.

As a cleanup, the NAME option that could previously be passed to
qt_internal_add_example_external_project has been removed.
That's because it's never used anywhere and could not have worked
anyway because qt_internal_add_example_in_tree never handled it.

Pick-to: 6.6
Fixes: QTBUG-112135
Change-Id: I52aa5ec643ff7e212276c88d8dd2dfecdbdbeb0d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-16 19:04:40 +02:00
Thiago Macieira
120fc8244a QCollator: clarify the POSIX backend limitations
This clarifies what doesn't work, that we print a warning, and that it
applies to all Unix systems aside from macOS, not just Linux.

Fixes: QTBUG-115852
Pick-to: 6.6
Change-Id: I80612a7d275c41f1baf0fffd1779701e98e7552d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-08-16 10:04:40 -07:00
Anton Kudryavtsev
8037d4f4eb qmimeprovider: use view types more
Change-Id: Idd6552313d3ef6ba692432858699521c392c70c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-16 19:40:18 +03:00
Mikolaj Boc
8703829d41 Remove the EM_LOG_DEMANGLE parameter from the call to emscripten_log
EM_LOG_DEMANGLE does nothing from emscripten 3.1.44 and is marked
deprecated. Also, it doesn't work for strict mode functions as
described in PR 19820, and needs the deprecated arguments.callee.

Change-Id: I4d71f50caa75373253881c4153acbc6ab38fcf18
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-08-16 17:17:13 +02:00
Mikolaj Boc
c0c9e43be1 Add a special testcase for IndexedDB settings only
The test removes the file in memfs that IndexedDB settings use as the
backing store. This forces a new instance of IDB settings to read from
the actual IndexedDB, instead of the file.

Change-Id: I7c04a90ae80e47b7742bd133b2d9327ce0063fe2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-16 17:17:13 +02:00
Mitch Curtis
5de991059e Improve Qt Test documentation regarding skipping/expecting failures
- Mention QEXPECT_FAIL on the best practices page.
- Link to the best practices page from "Chapter 6: Skipping Tests with
QSKIP".
- Add some more links.

Pick-to: 6.2 6.5 6.6
Change-Id: I0c9e0adb9fe500791dad44869434cf6ecdcf51a1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-16 23:17:12 +08:00
Kai Köhne
ab1b22c49b Doc: Fix \since for QMessageBox::options
While at it, also make \brief a proper sentence, starting with
an uppercase letter and ending with a dot.

This amends code added in commit 29b2506e8c .

Pick-to: 6.6
Change-Id: I5ca4c5e2a7dd2e826ba4392f4ea0e0dee00c92f4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2023-08-16 16:25:48 +02:00
Ahmad Samir
726899dc65 QSortFilterProxyModel: "fix" connection names in connect calls
d->model is the source model, so a QAbstractItemModel; techincally it
made no difference because it resolves to the same signal(s), but it's
less confusing as QAbstractItemModel.

Pick-to: 6.6
Change-Id: I4388a50ac33a2bee628fccc1aef6a9d1898e2ca2
Reviewed-by: David Faure <david.faure@kdab.com>
2023-08-16 14:25:48 +00:00
Mikolaj Boc
d0c92821af Do not call processEvents async with JSPI enabled on WASM
With JSPI, the main dispatcher loop is not exited and processEvents
should not be called, as events will get processed after the thread has
been unsuspended. processEvents posted with emscripten_async_call
causes stack corruption.

Fixes: QTBUG-115959
Change-Id: Ibccccbf54f18df2d03f0c5e817c3a7102e96c9ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-16 16:25:48 +02:00
Marc Mutz
3adf81f09f QFileSystemModel: remove incorrect ### Qt 7 comment
QTimeZone is not trivially-copyable, so we shouldn't default arguments
of that type (cf. QTBUG-98117), but continue overloading.

Found in API-review.

Task-number: QTBUG-98117
Pick-to: 6.6
Change-Id: I24e9d6c10512a50c172b5722c7d75bf74adf60a6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-16 16:25:48 +02:00
Edward Welbourne
91e70f239e Give QLocale::uiLanguages() a separator parameter
It has always returned dash-joined forms of the locale names, and
callers who need an underscore-joined form have been obliged to
replace('-', '_') before using them. Given that everything it adds to
the list comes from QLocaleId methods that accept a separator, it's
trivial to let it offer the same choice to its callers and save them
this hassle.

Amended code in QTranslater and QMimeType to save them that hassle.

[ChangeLog][CoreLib][QLocale] QLocale::uiLanguages() now lets the
caller choose what separator to use between the tags that make up each
locale-identifier in the list returned.

Change-Id: I91fcd0b988d9a64e0e9ad9e851f6cb8c1be8ae50
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-16 16:25:48 +02:00
Edward Welbourne
d7bad11a87 Correct name of HanifiScript in enum documentation
This amends commit 9237908327, which
shouldn't have integrated, but apparently the qdoc check in Coin
wasn't running that day.

Pick-to: 6.5 6.6
Task-number: QTBUG-111550
Change-Id: Ife6108eb49fb8988d43390200de480fc5b57e58f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-16 16:25:48 +02:00
Simo Fält
77273f2693 COIN: Enable debian instructions for all submodules
Pick-to: 6.6
Change-Id: Ic5ce96cb0dbcb85fbffb3af52d65b9c3fd7f9bb4
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-08-16 12:56:51 +00:00
Ivan Solovev
17297e1792 QUuid: improve documentation regarding the order parameter
Clarify that the order is the expected byte order of the input data.

Found during Qt 6.6 API Review.

Pick-to: 6.6
Change-Id: Iaa1f5eef22df60676e52197fbcf613f6e9970a3e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-16 14:56:51 +02:00
Ievgenii Meshcheriakov
9c386ebb0d QDBusConnectionPrivate: Define _q_newConnection outside of extern "C" block
That's weird and I have no idea how that worked.

Change-Id: I6ecb967e108256ebf1609e08ef02fc2ec83ef2ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-16 14:56:51 +02:00
Jan Arve Sæther
193fb8bb68 Revert "Windows QPA: Add support to UiaRaiseNotificationEvent()"
This reverts commit 566def740e.

The fix had some unwanted side-effects when the
QAccessibleValueChangeEvent carried a value of type string. Only
QComboBox uses QAccessibleValueChangeEvent in such a way.
The consequence of the reverted patch was that it broke QComboBox
so that the screen reader would read aloud the value change event
regardless of the visibility or focus state of the QComboBox. (Thus, if
you e.g. changed the QComboBox::currentIndex on a *hidden* combo box,
the screen reader would still read aloud the event)
This is also the root cause of what is described in QTBUG-93763.

Also, due to the usage of NotificationProcessing_ImportantMostRecent
the screen reader would treat it as such an important event that it
would abort whatever it was currently speaking.

In addition, the reverted change didn't fix any bugs and it failed to
implement the suggested behavior in a correct way (as was described in
QTBUG-75003 - albeit properly described after the change was merged).
QTBUG-75003 has already been reopened due to this, and the change can
therefore be reverted quite risk-free.

Task-number: QTBUG-75003
Task-number: QTBUG-93763
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ib91872adc563c31534fe2b30fd9c447bfcca6b40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-16 14:56:51 +02:00
Mats Honkamaa
4e009da7ef Doc: Add example categories for Qt Network examples
Task-number: QTBUG-116001
Pick-to: 6.5 6.6
Change-Id: I0c32df7752347f7c38996b3815d270dbd4c90707
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-08-16 15:56:50 +03:00
Marc Mutz
c86cf385d6 tst_QHashFunctions: extend the consistency() test with int/FP types
It's ... broken. Found and filed lots of bugs. Add #ifdef'ery and
QEXPECTED_FAIL() to document the state of affairs, hopefully reminding
us to fix these things come Qt 7.

Task-number: QTBUG-116064
Task-number: QTBUG-116076
Task-number: QTBUG-116077
Task-number: QTBUG-116079
Task-number: QTBUG-116080
Pick-to: 6.6 6.5
Change-Id: I29e89fdf995ddf60ef1e03c7af009e80980c9817
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-16 12:56:50 +00:00
Morten Sørvig
f7953cdee6 wasm: handle missing qconfig.h
There's no guarantee that qconfig.h will be present
when __qt_internal_get_qt_build_emsdk_version() is called
during configure, since the file is written by a file(GENERATE)
call which does not write the file immediately.

Handle this case and allow configure to complete.

Change-Id: Iab85790f9f133fd1ba5f276cdd7bc55f9af1d980
Pick-to: 6.6
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-08-16 08:42:32 +00:00
Marc Mutz
fa522eb8be tst_QHashFunctions: use actual seed in consistent() test function
We were only ever testing with a 0 seed, even though the function was
called for all QFETCH_GLOBAL seeds.

Add the seed.

Amends 5e93361888.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I3c78714ad6fb3f94233789dd2c8884d9b157fa76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-16 04:23:51 +02:00
Ahmad Samir
d50fd6acfa tst_qdbusconnection: iterate over member container directly
The loops don't change the m_connections container. The call chain is:
- registerObjectPeer() unittest constructs a MyServer, which connects
  QDBusServer::newConnection to MyServer::handleConnection(), the
  latter stores each new connection's name in m_connections
- An QTestEventLoop is entered, which triggers handleConnection(),
  handleConnection() calls exitLoop() at the bottom (this is repeated
  multiple times)
- server.unregisterObject() is called, iterating over m_connections
- server.registerObject() is called iterating over m_connections
- between the unregisterObject() call and the registerObject() calls
  m_connections is not modified AFAICS

Thus no need for taking a copy of m_connections (not that it matters
much, it's a QStringList with size() == 3).

Change-Id: Idaea2ca4d3b27fc88d39f8434e3817a2a4098c72
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-15 21:27:50 +03:00
Ahmad Samir
a6274fa39a QMdiArea: port Q_FOREACH to ranged-for, one trivial case
Straightforward, the code was already iterating over a local const
copy, i.e. Q_FOREACH wasn't needed here.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I3e806c54ce56b6eb06431eea6aea1758c8ecd154
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-15 20:53:11 +03:00
Marc Mutz
c0a3806609 tst_macdeplyqt: unbreak runVerifyDeployment()
Amends f2f8820073.

I have no idea how this went through the CI, but assigning to a const
variable cannot possibly compile.

Reported-by: Axel Spoerl <axel.spoerl@qt.io>
Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I0f22dcd5ab691f92880ea3c6446aedca53df0721
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-15 17:40:22 +00:00
Aaron McCarthy
c27798da2f androiddeployqt: Fix generation of qtDataDirectory
Commit 9db5ca87897340873a4606c651a37e0356e8f1a0 sets the default
qtDataDirectory to the value of qtInstallDirectory, which results in an
invalid path when appended to the SDK. This results in build failures
for Android when building with qbs. cmake builds are not affected as
the data directory is explicitly set in the build scripts.

Pick-to: 6.6 6.5
Change-Id: Ia29c5bae7648f5fccefe019c225e187985bd2592
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-15 16:18:41 +00:00
Tor Arne Vestbø
b0827bf8d4 wasm: Apply window mask during QWasmWindow initialization
We need to apply properties of the QWindow the underlying "native
window", in this case our <div>, on construction, without waiting
for the user to call one of the QWindow setters.

Pick-to: 6.6
Change-Id: Id422a9424f584e2269ef333e2c7c88a123ecb70b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-15 18:18:41 +02:00
Tor Arne Vestbø
3c438c5d4c wasm: Don't add window border, title bar, etc, to child windows
Only top level windows should have window manager features,
to match other platforms.

Pick-to: 6.6
Change-Id: I7a0563ef34aeb430d0b1a16633a5626482ccd17d
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-15 18:18:40 +02:00
Tor Arne Vestbø
89209c8eca wasm: Don't clamp y position of child QWindows to parent rect
A child window should be possible to place at arbitrary positions
within its parent, even outside the parent's current rect. Once
the parent size is changed, the child might become visible.

The current code also caused issues when the parent did not
have a size yet (0x0) at the time of the child's setGeometry
call, resulting in the child always being placed at y=0.

Pick-to: 6.6
Change-Id: I1534b606ab6eb7d51216d3b305a1b60443c41ec2
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-08-15 18:18:40 +02:00
Laszlo Agocs
e73d0ffb4c Clean up and fix some things in QRhiWidget doc
Change-Id: Ib941a15e0e051b17dd84c0c59792bfa3da89be03
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-15 17:04:35 +02:00
Laszlo Agocs
02f30f700d rhi: d3d11: Rework timestamp query logic
For offscreen frames this is a significant improvement since
now we will have timings available after endOffscreenFrame()
returns, meaning the behavior matches the Vulkan, D3D12,
and Metal backends in this regard.

It also enables getting timings in frames that have
QRhi::finish() or QRhiCommandBuffer::begin/endExternal()
calls.

Change-Id: I1cc45a47e7215f342df0b1c600cc481088c8135b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-08-15 15:10:35 +02:00
Laszlo Agocs
373c08d03d Fix texture-based non-native child of a non-texture-based native child
Another one in the series of problems around having texture-based and
regular widgets in hierarchies where some widgets are native and some
are not.

Pick-to: 6.6 6.5
Fixes: QTBUG-115652
Task-number: QTBUG-108344
Task-number: QTBUG-113557
Change-Id: I34306503cb17ccb915b90168ec3f39e209f668e5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-08-15 15:10:35 +02:00
Laszlo Agocs
55c79dcc25 rhi: add a way to test Display P3 with the manual test
Extended linear Display P3 + FP16 is likely the thing to use
on platforms such as VisionOS and iOS (and optionally on macOS)
and perhaps iOS). Enable testing this on macOS with the hdr
manual test.

Change-Id: I67f0bdbadae8c7ebccae7de008f12fd8d9135529
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-15 15:10:35 +02:00
Assam Boudjelthia
ea75e34d69 Android: fix content URI handling for non-ascii file names
Pass an encoded URI string before parsing them through the Android APIs.

Fixes: QTBUG-114435
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I65131799fad81bfe7490d663d3b7996c94d37f0b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-08-15 15:23:30 +03:00
Axel Spoerl
efc4bf5e63 QDockArealLayoutItem: recurse subinfo in QDebug operator<<
A subinfo has its own item list. Recurse into it when debugging.

Task-number: QTBUG-115058
Pick-to: 6.6 6.5
Change-Id: Ide820e4440caa97b84a3366c2d385546fb6026ec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-15 10:48:52 +02:00
Axel Spoerl
e03bc88a80 QDockWidgetGroupWindow::adjustFlags() - don't show() empty group window
The method calls show() on a dock widget group window, when the window
flags have changed. When all of its contained, tabbed dock widgets are
programmatically hidden or docked on the main window, an empty group
window is shown.

This patch implements bool hasVisibleDockWidgets(). It returns true, if
at least one of the group window's dockwidget children is not hidden.
It replaces show() by setVisible(), passing the return value of
hasVisibleChildren().

It adapts tst_QDockWidget::floatingTabs() to test the fix.
(Drive-by: remove dead code)

Fixes: QTBUG-115058
Pick-to: 6.6 6.5 6.2
Change-Id: Ifb8e2450e91a7c78decc06f592e160631ca2faf5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-15 10:47:28 +02:00
Simo Fält
95768e38b7 COIN: Fix typo in debian packaging instructions
Pick-to: 6.6
Change-Id: I2d13bd567f790fcf7cff51b133deb9f2220cb73d
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-08-15 11:40:01 +03:00
Axel Spoerl
ccd8a496cf QXmlStreamReader::readNextStartElement() - return false on document end
The method reads the next element in a loop, as long as valid elements
exist. Within the loop, it returns
- false if the end of an element has been reached
- true if a new element has started

When the document end has been reached, the loop continues, until
readNext() returns Invalid. Then, PrematureEndOfDocumentError is launched.

This is wrong, because reading beyond the document end is caused by a
missing return condition in the loop.

=> Treat document end like element end and return false without
reading beyond it.

=> Test correct behavior in tst_QXmlStream::readNextStartElement()

Fixes: QTBUG-25944
Pick-to: 6.6 6.5 6.2
Change-Id: I0160b65880756a2be541e9f55dc79557fcb1f09f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-15 07:16:31 +02:00
Thiago Macieira
56bd5d60c9 Fix registration of QtDBus types' metatypes
By actually registering them.

Commit 850d850c5a changed from
qMetaTypeId<QDBusArgument>() to QMetaType::fromType<QDBusArgument>() and
in Qt 6, fromType() does not register the type with the database. That
means the lines became runtime no-ops at that time or during the
QMetaType updates since 6.0. All they did was instantiate the C++ inline
variable.

The testing also detected we didn't register QList<QDBusVariant> as an
alias for the "av" signature. I'm not entirely sure you're allowed to
use this because QtDBus does not like re-registration of the built-in
types, and "av" is already assigned to QVariantList. This is no trouble
for the parser, anyway.

Minor change to qdbuscpp2xml to allow reading from stdin, so we don't
have to create temporary files.

Pick-to: 6.5 6.6
Fixes: QTBUG-115964
Change-Id: I80612a7d275c41f1baf0fffd177a14925e7d23ac
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-14 20:19:36 -07:00
Thiago Macieira
7a1ffacca0 tests/tools: only run qdbus{cpp2xml,xml2cpp} tests if D-Bus is available
Strictly speaking, we don't need the *bus*, only libdbus-1, but some
machines in our CI appear to be misconfigured somehow. I don't
understand how they can both have and not have this library in the same
run.

Pick-to: 6.5 6.6
Change-Id: I80612a7d275c41f1baf0fffd177a66a04951948c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-14 20:19:36 -07:00
Thiago Macieira
14d1108d35 Deprecate Q_ASSUME()
We've known for a long time that this is producing worse code with GCC
because of how we implemented in Q_ASSUME_IMPL(). So bite the bullet and
actually deprecate the macro, replacing all extant Q_ASSUME() with
Q_ASSERT().

The replacement is in C++23. Backporting the support onto Q_ASSUME_IMPL
was previously rejected by reviewers.

[ChangeLog][Deprecation Notice] The Q_ASSUME() macro is deprecated. This
macro has different side-effects depending on the compiler used (GCC
compared to Clang and MSVC), and there are certain conditions under
which GCC is known to produce worse code than if the macro was absent.
To give a hint to the compiler for optimizations, use the C++23
[[assume]] attribute.

Change-Id: I80612a7d275c41f1baf0fffd177a3a4ad819fb2d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-08-14 17:36:37 -07:00
Ievgenii Meshcheriakov
e8e8e1082e QDBusConnectionManager: Register metatypes in the constructor
Call QDBusMetaTypeId::init() in the cosntructor. This ensures that
the custom metatype registry is not destroyed before the instance
of the connection manager.

Task-number: QTBUG-58732
Pick-to: 6.6
Change-Id: I8c7c4c23deab2c7e11c6389a8976666ccf6baf48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-15 01:11:03 +02:00
Laszlo Agocs
d48831612a examples: Add new subdirectory to examples/widgets CMakeLists
Already there in the .pro.

Change-Id: I2f4312310b80ad3403f242ba387218e8ec86bcb4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-08-15 01:11:03 +02:00
Jøger Hansegård
711efcae55 [Doc] Clarify caller expectations for IPC Cross-platform safe key format
Clarify that Qt will silently truncate oversized keys for
QSystemSemaphore and QSharedMemory. This can have implications for some
use-cases, for example if an absolute path file name is used as a key
name to synchronize access to files.

Change-Id: I74742d11fd72139ff69d033e611904dcf0e9e822
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-15 01:11:03 +02:00
Marc Mutz
9c1d20337a Remove QUuid(quint128) constructor again
This constructor matches way too many argument types (integral,
unscoped enums, FP types), so it's likely to cause mayhem, even if
left in as an explicit constructor.

We now have a named constructor for the same functionality, so just
drop the "unnamed" constructor.

"Unnamed" constructors are important when emplacement is more
efficient than construction + move, or when implicit conversion is
required.  Neither is the case here: The named as well as the
"unnamed" constructors just copy ten bytes around, and the compiler
can optimize those extra copies away just fine.

Found in API review.

Pick-to: 6.6
Change-Id: I7faafd3ebf522fb2b0e450112fb95d643fece5ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-14 20:13:54 +00:00
Marc Mutz
3693dd74fe tst_QWizard: port from QSharedPointer to std::shared_ptr
QSharedPointer is 'meh', see QTBUG-109570 and 18113e22e9.

This is just a textual replacement of

- QSharedPointer<(.+)>::create() → std::make_shared<\1>()
- QSharedPointer → std::shared_ptr

And it compiles and still passes. No non-standard APIs to fix up.

Task-number: QTBUG-109570
Change-Id: I827d4a9be0511780c3900bd53ffcbdcb6aacbc3b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-08-14 23:11:54 +03:00
Marc Mutz
f2f8820073 tests: port assorted trivial uses of Q_FOREACH to ranged for loops
All of these fall into the trivial category: loops over (readily made)
const local containers. As such, they cannot possibly depend on the
safety copy that Q_FOREACH performs, so are safe to port as-is to
ranged for loops.

There may be more where these came from, but these were the ones that
stood out as immediately obvious when scanning the 100s of uses in
qtbase, so I preferred to directly fix them over white-listing their
files with QT_NO_FOREACH (which still may be necessary for some files,
as this patch may not port all uses in that file).

Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I7b7893bec8254f902660dac24167113aca855029
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-14 23:11:54 +03:00
Marc Mutz
47375a213f QMimeDatabase benchmark: port away from Q_FOREACH
The original code duplicated contained elements of a QStringList by
repeated appending it to itself, preventing the container from being
marked const.

Instead, keep a list of unique mime-types, and iterate over the list
eight times.

As a drive-by, port from QList to a C array ("never use a
dynamically-sized container for statically-sized data"), use u""_s
UDLs (since we're touching almost all lines of the function, anyway,
also in the unrelated mimeTypeForName() call).

This allows porting the Q_FOREACH loop (which anyway cannot deal with
C arrays) to a ranged for one (which can).

Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I844ae38104bb2980ea194b85f9017a3e95791ea2
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-14 23:11:54 +03:00