Commit Graph

61915 Commits

Author SHA1 Message Date
Thiago Macieira
4b4d384f3e Moc: remove GCC 9 ban for using QtMocHelpers::stringData()
Whatever issue used to be present in the CI no longer is. That doesn't
mean the problem went away; Ubuntu 20.04 is probably still shipping a
broken compiler with bad codegen, but this isn't the first issue.

Change-Id: I9201d9ecf52f4146bb04fffd1764673c94ee8955
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-05 15:23:01 -07:00
Mikolaj Boc
b9491daad0 Modernize the qtloader
This is a minimal version of qtloader. The load function accepts
the same arguments as emscripten runtime with a few additions:
- qt.environment
- qt.onExit
- qt.containerElements
- qt.fontDpi
- qt.onLoaded
- qt.entryFunction

State handling has been removed in favor of making the load async
(assume loading when the promise is live).

Public APIs getting crashed status, exit text and code have been
refactored into the new qt.onExit event fed to load. No need for
keeping the state in the loader.

The loader is integration-tested. A test module with test APIs
has been created as a test harness.

The runtime APIs exposed by Qt (font dpi and screen API) are handled
by the qtloader seamlessly.

Change-Id: Iaee65702667da0349a475feae6b83244d966d98d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-06-05 23:14:28 +02:00
Ahmad Samir
821a4234d0 QFileDialog: refactor a static helper
- Fix narrowing conversion warnings
- Don't use an out of bounds index with QStringView::mid(), which
  happened when view.size() was used as an index
- Use sliced()

Change-Id: Ia9bf62887ffb6ddd2458c9e46d33e8cfe0ee2b66
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-05 23:35:21 +03:00
Ahmad Samir
ef53352dbc QFileDialog: use ::sysconf() to get initial passwd struct buffer size
Use QVLA since buf is no techincally a var-length-array.

Change-Id: I334cf2d1f9ef162495ed223a8e48e1b8e674afc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:21 +03:00
Ahmad Samir
79710abf95 QFileDialog: split a static helper
Split the getpwnam* related code to a separate helper; this makes the
code more readable.

Change-Id: Ia7c6b6f7801d88b6b3a8809e973ede6c58e89923
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Ahmad Samir
8d77ee0f2b Misc.: fix narrowing conversion warnings with explicit cast to int
And using qsizetype in some places.

::pathconf() returns long.

Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.

Change-Id: I9f9abd3d4d6fe73f525eec869ceabc799317f3d6
Pick-to: 6.6 6.5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Ahmad Samir
3ee289e40d Misc.: fix narrowing conversion warnings
Using:
- range-for and iterator-based loops
- QList constructor that takes a pair of iterators

Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses, e.g. adding this to clangd's config file
(see https://clangd.llvm.org/config):
CompileFlags:
    Add: [-Wshorten-64-to-32]

Pick-to: 6.6 6.5
Change-Id: I13ae65e09ab59a59f9e5c189ea27e4e16527df2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Ahmad Samir
794dbfe0a0 QProgressDialog: minor refactor
Change-Id: Iba4dd1b0c3087e22e9fc0cae7fc764fbc055b089
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Ahmad Samir
63720716a0 QProgressDialog: fix integral narrowing conversion warnings
By porting to chrono internally.

Change-Id: I49c4461be8f8eabce0b9fb186cccc3e72eb75314
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Ahmad Samir
8a67b0c20c Add missing #includes
This is needed by static analysis tools (which compile each header on
its own, IIUC), e.g. clang-tidy:
src/widgets/itemviews/qtableview_p.h:99:22: error: unknown type name
'QTableView' [clang-diagnostic-error].
    Q_DECLARE_PUBLIC(QTableView)
                     ^

Change-Id: I84a1221469e9a78f243cc892ef7c60da9b515718
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 23:35:20 +03:00
Tor Arne Vestbø
a3dde7c93e Move widgets blurpicker example to manual test
Change-Id: I7e19b84ac4b6a8e380fc9a7dcc37cc08ced89b4b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-05 19:13:33 +02:00
Joerg Bornemann
e0ec19de41 CMake: Fix unnecessary rebuilds in Visual Studio projects
User projects that use qt_add_qml_module faced unnecessary rebuilds when
using the Unix Makefiles or Visual Studio project generators.

The bug was in qt6_extract_metatypes. For the mentioned generators (and
CMake 3.16 in general), we detect that CMake's AUTOMOC does not generate
a dep file, and we use a custom target to trigger cmake_automoc_parser.
That custom target runs always.

Later, we call moc to generate meta_types/foo_metatypes.json.gen. To not
trigger a rebuild of its dependents on every build, we use
copy_if_different to generate meta_types/foo_metatypes.json only if the
content changed.

The custom command for that had two outputs:
     add_custom_command(
         OUTPUT
             ${metatypes_file_gen}
             ${metatypes_file}
         ...
     )

The Unix Makefile generator and the Visual Studio generator (and
potentiall others) interpret this as "all outputs are always changed by
this command". The Unix Makefile generator even ensures that by creating
an additional foo_metatypes.json target that touches the file. In the
generated Visual Studio project, the dependents of foo_metatypes.json
are out of date even if the actual file has an old timestamp.

In projects with QML modules, the QML type registration depends on this
file. This caused a near full rebuild of the affected QML modules.

We must mark foo_metatypes.json as byproduct of the command to specify
that it is a file "whose modification time may or may not be newer than
the dependencies".

Unfortunately, there's CMake upstream issue #19005. There's a dependency
missing between the consuming target and the byproduct. We must work
around this issue with an additional custom command with OUTPUT
${metatypes_file}.

Pick-to: 6.5
Fixes: QTBUG-106683
Change-Id: Icc2f7227c3e7b523631c1f361e29e26ae4efc46c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-04 20:44:39 +02:00
Axel Spoerl
8a9e3c7869 Default to WindowText color in QTextDocumentLayoutPrivate::drawBlock()
When a block is drawn in a text document, drawBlock is checking,
whether the block has a BackgroundBrush property defined. If none is
defined, the color used to draw lines around the block defaults to
QPalette::Dark. This was implemented, assuming a light color scheme.
In a dark color scheme, the lines become hardly or even not visible.

This patch changes the default to Inactive/WindowText of the underlying
QPalette. This provides contrast to the document's text content and
is dark/light sensitive.

Fixes: QTBUG-113990
Pick-to: 6.5
Change-Id: Ie855852f441a0efb11c318c7edb27395151cbcce
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-04 13:51:54 +00:00
Dennis Oberst
54d8d8055e QString: add STL-style assign() [1/4]: non-(it,it) overloads
Implemented assign() methods for QString to align with the
criteria of std::basic_string, addressing the previously missing
functionality. This is a subset of the overloads provided by the
standard.

Reference:
https://en.cppreference.com/w/cpp/string/basic_string/assign

The assign(it, it) overload is a bit more complicated and will be
added in follow-up patches.

[ChangeLog][QtCore][QString] Added assign().

Task-number: QTBUG-106198
Change-Id: Ia1481d184865f46db872cf94c266fef83b962351
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-04 06:33:12 +00:00
Marc Mutz
ef1be84551 QStringDecoder: add a char16_t overload of appendToBuffer(QChar*, ~~~)
More and more code in Qt uses char16_t instead of QChar, even
QString::Data, so reduce the impedance mismatch with such code and
supply a char16_t overload in parallel to the existing QChar* one.

[ChangeLog][QtCore][QStringDecoder] Added appendToBuffer() overload for
char16_t*, complementing the existing overload taking QChar*.

Task-number: QTBUG-106198
Change-Id: I0cb8ab22c897c14b1318a676f5212cc0cf1b72b7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-04 06:32:59 +00:00
Fabian Kosmale
f9fe333018 QVariant: replace fromValue() specializations with if-constexpr
Keeps all the special cases in a central place and will help with
adding an rvalue overload of fromValue() for 6.6.

Change-Id: I14f12bb98a2e2f4edfcec8ce39660643e23c1d07
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-04 06:32:46 +00:00
Thiago Macieira
114d00f043 QDnsLookup/Unix: cache previously decoded domain names
Change-Id: I5f7f427ded124479baa6fffd175f3ce37f0e49aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-03 19:28:15 -07:00
Thiago Macieira
59a2a32276 QDnsLookup/Windows: add a simple decoded domain cache
Avoid decoding multiple times the domain name when it comes in
sequence. This happens when a given domain label either has multiple
entries in its record set or when it's a CNAME (or both), such as in:

;; ANSWER SECTION:
cname-cname.test.qt-project.org. 3600 IN CNAME  cname.test.qt-project.org.
cname.test.qt-project.org. 1614 IN      CNAME   multi.test.qt-project.org.
multi.test.qt-project.org. 1614 IN      A       198.51.100.2
multi.test.qt-project.org. 1614 IN      A       198.51.100.3
multi.test.qt-project.org. 1614 IN      A       198.51.100.1

Label targets from other records such as MX and SRV usually do show up
again, in the Additional section, but the chance that they are
sequential isn't very good, so we don't cache those.

;; ANSWER SECTION:
mx-multi.test.qt-project.org. 3354 IN   MX      10 multi.test.qt-project.org.
mx-multi.test.qt-project.org. 3354 IN   MX      20 a-single.test.qt-project.org.

;; ADDITIONAL SECTION:
multi.test.qt-project.org. 1145 IN      A       198.51.100.3
multi.test.qt-project.org. 1145 IN      A       198.51.100.1
multi.test.qt-project.org. 1145 IN      A       198.51.100.2
a-single.test.qt-project.org. 3364 IN   A       192.0.2.1

Change-Id: I5f7f427ded124479baa6fffd175f5cf88939ee73
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-03 19:28:14 -07:00
Thiago Macieira
8b6bd8ed99 QDnsLookup: allow looking up the root domain
[ChangeLog][QtNetwork][QDnsLookup] It is now possible to look up the
root DNS domain, by setting the name property to an empty string. This
query is usually done while setting the query type to NS.

Change-Id: I5f7f427ded124479baa6fffd175f688395941610
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-03 19:28:13 -07:00
Thiago Macieira
01dfcfcecf QDnsLookup: merge some of the domain label expansion code
Use qt_ACE_do directly from QtCore, to avoid going through Latin1
(US-ASCII) multiple times.

Drive-by reduce the size of the buffers from PACKETSZ (512) to the
maximum name a label can be (255 plus 1 for the null, just in case).

Drive-by replace the last QString::fromWCharArray with QStringView,
saving an unnecessary memory allocation before calling
QtPrivate::convertToLatin1().

Change-Id: I3e3bfef633af4130a03afffd175d8be1feb5d74b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-03 19:28:11 -07:00
Axel Spoerl
eda71105ff Move widgets Application example to manual tests
With 6e77da640aa84c1efe330d4a5224c9c7425ece57, the documentviewer
demo's TxtViewer plugin has been fully documented in order to replace
the Application example.

This patch moves the application example to manual tests.

Pick-to: 6.5
Change-Id: I67d975e478c7bc840613c8af1301a4eafe8f1a42
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-04 01:18:19 +02:00
Axel Spoerl
27906b7da8 QXmlStreamReader: Add key/value to "Invalid attribute" error message
When QXmlReaderPrivate::startDocument() parses declarations, it reports
an error if a declaration contains an unknown attribute. The message
doesn't mention the invalid attribute's key and value, so the user has
to guess which one is the faulty declaration.

This patch extends the error message by adding the respective key/value
pair.

Pick-to: 6.5
Change-Id: I7f5a228bed44937472880c3b3d63d5e816b39361
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-04 01:18:05 +02:00
Thiago Macieira
4ce97e25d3 tst_QProcess: put the tests in the right order
They were in the right order before rebasing multiple times. kdiff3 is
currently broken, so I don't know what happened.

Change-Id: Ib5ce7a497e034ebabb2cfffd17626fcf46c541fd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-03 08:50:53 -07:00
Tor Arne Vestbø
0ab091c92f macOS: Disable minimize button for Qt::Dialog windows by default
Regression after 4c78ef80ca, where
we moved the window titlebar button logic from QCocoaWindow's
windowStyleMask function to updateTitleBarButtons.

Fixes: QTBUG-114064
Pick-to: 6.5
Change-Id: Idb0870571e88fa2962af36decd9bc7b53c35664d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-06-03 14:02:45 +02:00
Marc Mutz
8983225d3c QVariant: add rvalue overload of fromStdVariant()
Extract Method fromStdVariantImpl() to share the otherwise
more-or-less identical implementation between the two overloads.

Don't use a constrained template version of fromStdVariantImpl() as
fromStdVariant(), because the constraint would have to be very complex
to continue allowing subclasses of std::variant to be passed.

As a drive-by, mark the valueless_by_exception() path Q_UNLIKELY.

[ChangeLog][QtCore][QVariant] Added overload of fromStdVariant()
taking rvalue std::variant<>s.

Fixes: QTBUG-114134
Change-Id: Ia1c7ae93ab421e6689dc9f2d8d0c2295b23cbbf6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-02 20:32:11 +00:00
Fabian Kosmale
79ae79d05c QVariant::fromValue: Add rvalue optimization
When passing an rvalue-reference to QVariant, there is no reason to make
a copy if the type is moveable. Moreover, we know that the pointer which
we construct from the object passed to fromValue non-null. We make use
of both facts by parametrizing custom_construct on
non-nullness and availability of a move-ctor, and then dispatching to
the suitable template.
We need to keep the const T& overload, as otherwise code which
explicitly specializes fromValue and passes a const lvalue to it would
stop to compile.

[ChangeLog][QtCore][QVariant] Added fromValue() overload taking rvalues.

Change-Id: I44fb757d516ef364fe7967bc103b3f98278b4919
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-02 22:31:36 +02:00
David Redondo
581c4bcb62 Use platform drags for drags of docks and toolbars on wayland
On Wayland we can't know where windows are in relation to
each other so the whole mechanism was broken, toolbars
were unmovable once undocked and could be blindly redocked.
Dockwidgets had native toolbars to move them around but could
not be redocked.
This introduces an alternative code path that uses a platform
drag with a special mimetype that enables the platform to
issue a combined drag and window move using the relevant protocol.
Should the protocol not be available this doesn't make things
actively worse as it will be similar broken as before.

Fixes: QTBUG-87332
Change-Id: I3b8bdc0b1bc22569a64cb8bf7ca7d37d223936a6
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-02 19:53:34 +02:00
Amir Masoud Abdol
1eb4d17cb4 Generate and set a CFBundleIdentifier when none were provided on macOS
When using Ninja generator on macOS, we now do a bit of extra work to
make sure that bundle identifier is always set.

- In the case where no identifier was provided, the warning message has
  been updated indicating that the user can set either of the
  properties.
- If both `MACOSX_BUNDLE_GUI_IDENTIFIER` and
  `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` were set but have
  different values, a warning will be shown to encourage the user to set
  only one of them.
- In addition `_qt_internal_get_ios_bundle_identifier_prefix` is renamed
  to `_qt_internal_get_apple_bundle_identifier_prefix` to be more
  platform specific.

Note:
    In general, if Ninja is the generator, we set the value of
    `MACOSX_BUNDLE_GUI_IDENTIFIER` and don't touch the
    `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`. If Xcode is the
    generator, we set the value of
    `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`, and in addition, to
    silence a Xcode warning, we set the `MACOSX_BUNDLE_GUI_IDENTIFIER`
    to `${PRODUCT_BUNDLE_IDENTIFIER}`, ie., let Xcode figures it out if
    needed.

[ChangeLog][CMake][macOS] When using Ninja generator, if neither
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` nor
`MACOSX_BUNDLE_GUI_IDENTIFIER` is provided for a target, a bundle
identifier, i.e., `com.yourcompany.<teamid>.<target>` will be generated
and set as CFBundleIdentifier.

Pick-to: 6.5
Fixes: QTBUG-110889
Change-Id: Ie071085bbaf465afcb022b760423eb6b3c921f6d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 19:28:04 +02:00
Antti Määttä
d67abb9de1 CTF: Use static with operator
Also fix coding style in the operator.

Pick-to: 6.5
Change-Id: Ia8f85a7bb7aa2d6f55923c80f72b734fc8dbd693
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-06-02 17:53:29 +03:00
Antti Määttä
d214c56e43 CTF: Properly handle invalid session file
Pick-to: 6.5
Change-Id: Iabb2621364b5256ac89ec8cb7fafb0a9d346515d
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-06-02 17:53:27 +03:00
Antti Määttä
6639285ad7 CTF: Add qt_error_string to file open warning
Pick-to: 6.5
Change-Id: I85e1aff7689b6592ad2da1e91f480848eea317eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-02 17:53:26 +03:00
Antti Määttä
fdce0cbbc9 CTF: Fix coding style
Pick-to: 6.5
Change-Id: Idf3a593949c3ac58438d499e2487375d20bebab7
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-06-02 17:53:26 +03:00
Antti Määttä
dad95f4a43 CTF: Use QT_FSTAT to read file size
Pick-to: 6.5
Change-Id: Ic4b184e1ed51d8e30c2305a5ead619117a505518
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-06-02 17:53:25 +03:00
Antti Määttä
5e2b4c401d CTF: Use access to check if location is writable
Pick-to: 6.5
Change-Id: Ic6afcf74432f176374d47e828b480e4d2499c670
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2023-06-02 17:53:24 +03:00
Alexey Edelev
0006a564c8 Collect module_sync_headers targets from the target deps
Use the internal target property to store the module_sync_header target
name. The property then is used to collect module_sync_header targets
and build the dependency tree between them. This mechanism only works
for Qt dependencies that are added using qt_internal_extend_target call
that works well at least for out CI builds. The mechanism allows to
omit the race in sync_header runs that might lead to unexpected results
since internal targets like automoc or headersclean_check only depend
directly on module_sync_header target that belong to the module.

Change-Id: I564f3ea0f3c1703e70c4c300fd1307c3214d39d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:09 +02:00
Alexey Edelev
251e3b44fa Add the description for the QT_ALLOW_DOWNLOAD option
Introduce QT_ALLOW_DOWNLOAD option that should be used the downloading
of the resources from web in Qt builds. Calls like file(DOWNLOAD or
FetchContent_* should be wrapped with this option, so users that build
Qt could control this and disable functionality that requires
resources from web.

Change-Id: Ie0494265c0c5fe93a7ef0d1cbcee1af919d57fa5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:08 +02:00
Alexey Edelev
f323fa818c Add Gui_sync_headers as the explicit dependency for Test module
The Test module uses Gui header files implictily without explicit Gui
linking. We need the dependency chain at least between the
module_sync_headers targets to make sure that all header files required
for successful module build are present "in time".

Change-Id: I40fd81cceeb0e0e8271db4ba33fd914eb484d001
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:07 +02:00
Tor Arne Vestbø
1d3ae5f0e9 cmake: Add known translations to CFBundleLocalizations in Info.plist
For untranslated applications we set CFBundleAllowMixedLocalizations to
true, so that the application's locale will not be limited to the
development region "en".

But once we have a set of known translations, added by qt_add_translations,
we can turn these into CFBundleLocalizations, which lets macOS/iOS
choose a best match between what the app supports and what the user
preferences are.

[ChangeLog][Internationalization] Translations added via
qt_add_translations are now reflected as CFBundleLocalizations
entries in the application's Info.plist file on Apple platforms.
to disable this behavior, set QT_NO_SET_PLIST_LOCALIZATIONS.

Change-Id: I3f7ae1a1884eaf269038fa8ee49dbe6cac855706
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:06 +02:00
Tor Arne Vestbø
21000ede37 cmake: Always copy Info.plist to build directory manually
Allows us to modify this file in place, before CMake copies it into
the application bundle during its generator step.

Change-Id: I73325c66b5b8919f57dbaa1cc76a7edbc145609c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:05 +02:00
Tor Arne Vestbø
eb09d98065 Link to Application Permissions docs from Qt Core overview
Pick-to: 6.5
Change-Id: Ida5ff78967b5e9165f83131ee67ac4f12bd1936b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-06-02 15:12:05 +02:00
Antti Määttä
c26c72a370 CTF: Do not check nullptr before delete
Pick-to: 6.5
Change-Id: I3935d7a0898f20804e8dc6f916cb9a5954230c0f
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-06-02 13:10:29 +03:00
Antti Määttä
fab8bbd79f CTF: Use qEnvironmentVariable
Pick-to: 6.5
Change-Id: I492da6862491cc476355a318652bd9901fffcd76
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2023-06-02 13:10:28 +03:00
Antti Määttä
3c7bf8e189 CTF: Remove extraneaus include
Pick-to: 6.5
Change-Id: I6ebe1d6a492e8606762a78bae422fa86440d18be
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-06-02 13:10:27 +03:00
Marc Mutz
5862819918 QVariant: fix shadowing of QVariant::Type/List
QDoc mis-interprets the Type and List template arguments as referring
to the QVariant::Type enum and its List enumerator, resp.

To fix, rename the template parameters from Type to T and from List
to U.

Task-number: QTBUG-112187
Change-Id: Ib4093acdd84cc86a0f85dcc5046b6e7da7885a44
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-06-02 09:13:09 +02:00
Fabian Kosmale
f564e905c1 QVariant: Support emplace
[ChangeLog][QtCore][QVariant] Implemented in-place construction for
QVariant. The constructor taking std::in_place_type<Type> constructs
an object of type Type directly inside QVariant's storage, without any
further copy or move operations. QVariant::emplace() does the same
when replacing the content of an existing QVariant and tries to reuse
previously-allocated memory.

Fixes: QTBUG-112187
Change-Id: I16614ad701fa3bb583976ed2001bb312f119a51f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-06-02 09:13:08 +02:00
Dennis Oberst
18a2c62c07 QByteArray: add STL-style assign()
Implemented assign() methods for QByteArray to align with the
criteria of std::basic_string, addressing the previously missing
functionality. This is a subset of the overloads provided by the
standard.

Reference:
https://en.cppreference.com/w/cpp/string/basic_string/assign

[ChangeLog][QtCore][QByteArray] Added assign().

Fixes: QTBUG-106199
Change-Id: I899b14d74e8f774face8690303efb8610ead95b5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-02 06:43:31 +02:00
Ievgenii Meshcheriakov
1ee7aa741a qdbusxml2cpp: Fail if -c option is used with multiple interfaces
Exit with an error code when -c option is specified by the command
is not processing a single interface. Mention this in the option
description.

Fixes: QTBUG-36405
Change-Id: I7ea217c780d37332278c634f030d20040b7459e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-02 02:11:37 +02:00
Amir Masoud Abdol
6f6bd2c4dc Set QT_FORCE_FEATURE_neon to ON for x86_64h arch as well, on macOS
We were not accounting for `x86_64h` arch, and as a result
cross-compiling with `-DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64`
was failing.

Pick-to: 6.5
Fixes: QTBUG-113694
Change-Id: Ieb50a7a62aabcca76b09f9c853b3faf915eab1a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-01 22:27:06 +02:00
Marc Mutz
6f529c38ce QVariant::fromStdVariant(): protect against accidental fromValue() ADL pick-ups
The use of unqualified fromValue(arg) in the visitor implementation
invites non-QVariant fromValue(T) overloads to be found using ADL,
which just happen to compile because their return value implicitly
converts to QVariant (like most stuff does).

To rule this out, use FQN QVariant::fromValue() to switch off ADL.

[ChangeLog][QtCore][QVariant] The fromStdVariant() function used an
unqualifed fromValue() call to convert each alternative type in the
std::variant. It now uses qualified QVariant::fromValue() to avoid
picking up unrelated fromValue() overloads whose return value just
happens to implicitly convert to QVariant.

Amends 5927acaf65.

Pick-to: 6.5 6.2
Change-Id: Ica21b08c919459d0a740af03f451e4ffe224b641
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-01 18:39:26 +00:00
Dennis Oberst
60f739f51f tst_ContainerApiSymmetry: make assign_impl() more robust
Refactor the 'CHECK' macro to eliminate the capacity check and
explicitly verify that no reallocation occurred. The previous
implementation had to pass constants to suppress the issue arising
from differing growth rates between implementations.

Additionally, improve the 'std::stringstream' versions of the test
by incorporating the correct values. In the previous implementation,
the usage of:

    auto tData = V(9);
    ~~~
    std::stringstream ss("9 9 ");

had several issues. Firstly, it used the wrong test data since the
container's value_type of '(char) 9' resulted in a tab character '\t',
which was not accurately reflected in the stringstream assignment.
Secondly, this value caused problems in how stringstreams interprets it.

To address these issues, let's make the following improvements:

1. Use a default test value of 65 instead of (char) 9. This value, which
represents the character 'A', is less likely to cause errors and is more
intuitive.
2. Use the tData variable for the assignments in the stringstream. This
ensures that the correct data from the container is used.
3. Change the test value between the assign() calls to verify that the
container's contents are successfully overwritten.

These changes ensure, that the test cases are more accurate and
reliable.

Amends: 3b0536bbe8.

Change-Id: I9441c4818106bf93e93a1a5d2d2d54c89d80e7b0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-01 18:39:25 +00:00