Commit Graph

62379 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
96d67da420 String-like containers: add implicit conversions towards std:: string views
In C++20 std::basic_string_view has gained a range constructor (like
QStringView always had), but that range constructor has been made
explicit. This means we can't just pass a QString(View) to a function
taking a u16string_view. The consensus seems to be that that types that
should implictly convert towards stdlib's string views should do that
via implicit conversion operators. This patch adds them for

* QByteArrayView => std::string_view
* QString(View) => std::u16string_view
* QUtf8StringView => std::string_view or std::u8string_view, depending
  on the storage_type

QLatin1StringView doesn't have a matching std:: view so I'm not enabling
its conversion.

QByteArray poses a challenge, in that it already defines a conversion
towards const char *. (One can disable that conversion with a macro.)
That conversion makes it impossible to support:

  QByteArray ba;
  std::string_view sv1(ba);  // 1
  std::string_view sv2 = ba; // 2

because:

* if only operator const char *() is defined, then (2) doesn't work
  (situation right now);

* if both conversions to const char * and string_view are defined, then
  (1) is ambiguous on certain compilers (MSVC, QCC). Interestingly
  enough, not on GCC/Clang, but only in C++17 and later modes.

I can't kill the conversion towards const char * (API break, and we use
it *everywhere* in Qt), hence, QByteArray does not get the implicit
conversion, at least not in this patch.

[ChangeLog][QtCore][QByteArrayView] Added an implicit conversion
operator towards std::string_view.

[ChangeLog][QtCore][QString] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QStringView] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion
operator towards std::string_view (QUtf8StringView is using char
as its storage type in Qt 6). Note that QUtf8StringView is planned to
use char8_t in Qt 7, therefore it is expected that the conversion will
change towards std::u8string_view in Qt 7.

Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 16:19:06 +02:00
Kai Köhne
c07a3f10ef Doc: Add remaining SQL examples to Data Processing & I/O category
Task-number: QTBUG-115174
Pick-to: 6.5 6.6
Change-Id: Idd8ba8504efb17f0e4a11b3c36b991739251f2ef
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-07-13 16:19:05 +02:00
Hatem ElKharashy
d5822981ee Static build fix for RenderDoc dependency
Modify configure.cmake to avoid breaking static builds
while using RenderDoc with QGraphicsFrameCapture.

Change-Id: Id0f39304b20ab3a98bfb0206cf5b52031d38f0ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 14:59:14 +03:00
Marc Mutz
d41db62154 Move QBasicFutureWatcher behind the ABI boundary
... and out of QtPrivate.

No inline API requires it anymore, so move it into the only TU using
it. Can't move it into the unnamed namespace because of the friend
declaration in QFutureInterfaceBase.

Pick-to: 6.6
Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-13 08:24:02 +00:00
Joerg Bornemann
7c82a49e6f CMake: Fix error in qt_generate_deploy_app_script
...when using a Qt cross-built for embedded Linux and
NO_UNSUPPORTED_PLATFORM_ERROR set.

Attempting to install such a project will now give the following output:

-- Skipping runtime deployment steps. Support for installing runtime
dependencies is not implemented for this target platform (Linux, shared
Qt libs, cross-compiled).

Pick-to: 6.5 6.6
Fixes: QTBUG-114069
Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 09:53:28 +02:00
Marc Mutz
dfd07205e5 QFuture: Extract Method watchContinuation() (DRY && SCARY)
The old code violated the following principles:

- DRY: the same code occurred 3× in the code-base

- SCARY: the vast majority doesn't actually depend on template
  arguments, causing template bloat

Solve both with a tiered Extract Method.

We cannot change the order of the operations performed on
QBasicFutureWatcher, in particular not the connect() to the
contination w.r.t. setFuture(), so we cannot leave the connect to the
continuation lambda outside the function, as it would mean to also
leave the setFuture() call outside.

Thanks to Volker's makeCallableObject(), we can, however, type-erase
the lambda using QSlotObjectBase, which is what connect() internally
creates, anyway, therefore bringing the whole function behind the ABI
boundary.

As a non-QObject, non-QMetaObject friend, we're lacking support for
actually doing something useful with a QSlotObjectBase, but that can
be fixed in the implementation now. The interface is stable, which is
what matters for 6.6 now.

This will allow a subsequent commit to drag QBasicFutureWatcher behind
the ABI boundary, unexporting it.

Saves a whopping 8KiB in tst_qfuture text size on optimized C++20
Linux AMD64 GCC9 builds.

Pick-to: 6.6
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-13 09:50:42 +02:00
Marc Mutz
0ecf8a2158 QVariant: make customConstructShared() SCARY¹
Extract Method non-template customConstructSharedImpl() to avoid
instantiating std::unique_ptr with a different per-F Deleter over and
over again.

Not picking to 6.5 because the function was confined to the
qvariant.cpp TU in those versions.

Cf. 11791e2a50 and
d783363f60 for similar issues.

¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf

Pick-to: 6.6
Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:50:25 +00:00
Mårten Nordheim
93fe8cb305 QRecursiveMutex: remove QDeadlineTimer::Forever leftover
Amends 5f531ae2ac
The overload taking QDeadlineTimer::ForeverConstant was required,
prior to making it an enum class, because the conversion preferred
'int'. It was made an enum class for 6.6 and most overloads were
removed, including the one for QMutex, but QRecursiveMutex was
missed.

Pick-to: 6.6
Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:49:47 +00:00
Marc Mutz
df96d39c04 ThreadPoolThreadReleaser: add Q_NODISCARD_CTOR
QUIP: 19
Pick-to: 6.6
Change-Id: I465a2ef8edc103f0655a7732f3aaaf18748854c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 00:15:33 +02:00
Ivan Solovev
f1ffc11e61 Revert "QUuid: use NSDMI to initialize the members"
This reverts commit c3c5d2cab0.
Reason for the revert - it breaks the purpose of the Qt::Uninitialized
ctor

The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor
to avoid the compiler errors:

 error: member ‘QUuid::data*’ must be initialized by mem-initializer
 in ‘constexpr’ constructor

Pick-to: 6.6
Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 19:58:26 +00:00
Alexey Edelev
4bc0a08bea Add the 'version' argument to 'qt_deprecates' pragma
syncqt uses qt_deprecates pragma to generate deprecated header files
that might live forever in Qt packages. This adds the version argument
to the pragma, that allows specifying the version when the respective
header file should be removed. The new pragma format is the following:
  pragma qt_deprecates(<header>[,<major.minor>])

If deprecation version of the deprecated header file is lower than
the current Qt version, syncqt will display the respective warning in
the log and skip generating the deprectated header file.

Also the user warning message now displays the exact version when the
header file will be removed.

Task-number: QTBUG-115029
Pick-to: 6.6
Change-Id: Ifd7464b8539b8be93b95690fd1ca70ef0b14e436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-07-12 21:58:26 +02:00
Alexandru Croitor
b9b5ed3aa6 CMake: Don't set QT_BUILDING_QT for single standalone tests
Standalone test projects have the following condition in the
beginning of their project:

 if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
     find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST)
 endif()

When configuring the project the first time, QT_BUILDING_QT is not
set, find_package is called, configuration succeeds.
But because standalone projects implicitly include QtSetup.cmake,
that file sets the QT_BUILDING_QT cache var to true, and upon test
reconfiguration, cmake errors out with:
 Unknown CMake command "qt_internal_add_test"
or similar.

This happens because QT_BUILDING_QT is true on the second
reconfiguration and the find_package mentioned above is not executed
anymore, leading to unknown internal command errors.

Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect
a standalone test and check for its value in QtSetup so we don't
set QT_BUILDING_QT to TRUE anymore.

Adjust a few code locations where QT_BUILDING_QT being false might
trigger different behavior for standalone tests.

Task-number: QTBUG-93020
Change-Id: I5413b9f37653225175a1006f7626e023045b5979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-12 18:38:31 +00:00
David Redondo
42fd8a8e8a Add support for setting the initial directory in portal file dialog
Change-Id: I2bceddb470e7870f19fc616e3dbae73cc057cb66
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-07-12 19:15:03 +02:00
Alexandru Croitor
3ba3f322b6 moc: Print sterror(errno) when moc can't write the output file
Also prepend a "Error:" label to all strrerror handling locations,
to make it clear where the error starts.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 17:48:48 +02:00
Alexandru Croitor
dd1b7b5539 moc: Store errno after fopen call
To avoid QFile::encodeName() potentially overriding the value.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: Ie751df877d6624238ded344474b5eccc324ec541
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 17:48:48 +02:00
Edward Welbourne
258e7ed9fd Doc fix: QDomDocument::ParseResult is false on error
The documentation claimed the exact opposite of what the
implementation did. Since callers use it the way it's implemented, fix
the doc.

Fixes: QTBUG-112895
Pick-to: 6.6 6.5
Change-Id: I74d6259727c7af7265224c6d79ba39265663704b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-12 15:48:48 +00:00
Laszlo Agocs
f88ac07029 rhi: metal: Remove out of date / unneeded comment
E.g. the view.layer thread checker problems are eliminated
for some time now. The other mentioned XCode warning is
likely not there anymore with newer XCode. Whereas the
rest (that we pass validation) should be obvious.

Pick-to: 6.6 6.5
Change-Id: I9754077aa6e178ee2b866b64538991412af5bb5a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-12 17:48:47 +02:00
Volker Hilsheimer
8f3f765dad Fix build with latest MSVC
Amend 813bbc515b. Unclear why this
passed CI, but we can't use implicit conversion of string or character
literals.

Pick-to: 6.6
Change-Id: I1b3515e42b09a5caae1e632320b8251c27177f52
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-12 14:56:03 +02:00
Laszlo Agocs
bcf14392df rhi doc: Make getShader in the snippets more compact
One line is better than three.

Pick-to: 6.6
Change-Id: Ib738ec18b51accead3897b450b26207b3fba87d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-12 11:42:00 +02:00
Michal Klocek
ec2faefbc2 Explain why we can't use -Za in MSVC headersclean check
Bring back & update comment on -Za, which was removed
in 8bf60251 (in turn reverted in commit 2dcc3059).

For the details on -Za vs -permissive, see
   https://devblogs.microsoft.com/cppblog/permissive-switch/:
and the official Microsoft documentation.

This amends 2dcc30592b.

Change-Id: Ibeb135218dd0a17eddf821ad79246906993c586f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 11:37:54 +02:00
Volker Hilsheimer
84a33c67c6 Add porting documentation for QMacPasteboardMime/QWindowsMime
Task-number: QTBUG-93632
Pick-to: 6.6
Change-Id: I38294aef304adea86ecf5fbb118024037afedfe8
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-07-12 11:30:25 +02:00
Mårten Nordheim
533b12f335 tst_QThreadPool: remove Windows-specific QSKIP
I cannot get it to fail on my local machine

Change-Id: Iec30858df6bf5ef51a805745745cc0e98e8db03a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 11:29:56 +02:00
Mårten Nordheim
9777fd0257 broadcast{receiver,sender}: update meta info
Change-Id: I864de05a766fa4e5b9b7fdec7c2b95ac2b576c26
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-12 11:29:55 +02:00
Mårten Nordheim
bec7c39950 DnsLookup: add some documentation
Just to make it show up in the docs.

Change-Id: I22e9a1eb7dd040e76ee68f3f63053b030733b33d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-12 11:29:54 +02:00
Mårten Nordheim
42022f8b38 ipc common: move end-of-namespace into same scope as start
To avoid issues building with shared memory & system semaphore disabled.

Pick-to: 6.6
Change-Id: I525abe97f82266b8cca0e4f1847849054c016a4b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 11:29:53 +02:00
Mårten Nordheim
d3526c166c securesocketclient: Update meta info
Change-Id: I34b11cd73c80dc3033de8731bd8edc0db3ed4a12
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-12 11:29:28 +02:00
Mårten Nordheim
f89bf4f25d securesocketclient: Replace the screenshot
Change-Id: I73658fef13ac4fdc046011f6aa68b6f97555546a
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-12 11:29:25 +02:00
Mårten Nordheim
d34952a3d1 securesocketclient: Replace QLatin1Char with char16_t literal
Change-Id: I3efebe12e3a46c35e6c1775226e9ba424811cc30
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-07-12 11:29:22 +02:00
Yaroslav Isakov
929d9a4ca5 Allow OpenGL to be found on X11-less Linux systems (using libOpenGL)
Cmake supports finding OpenGL, even if there is no GLX (for glvnd) or
old-style libGL. This change keeps old behavior, but in case, if
X11-related OpenGL libraries cannot be found on Linux, it adds logic
to check for (and link with) libOpenGL, if it is present.

[ChangeLog][QtGui] Allow OpenGL to be found on X11-less Linux systems
(using libOpenGL)

Change-Id: Iccfeba83292a14081544c64ea8ce24fb52d1ee2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-12 11:25:23 +02:00
Timothée Keller
87bfd33082 Windeployqt: also add internal modules to module list
Not adding internal modules to the windeployqt module list makes it
give off nonsensical warnings, and can force the deployment of debug
libraries despite a --release tag. Add them in to prevent this, and
shave off the "Private" part of the module name if it exists to maintain
compatibility.

Fixes: QTBUG-114854
Pick-to: 6.6 6.5
Change-Id: I884fdc495f340ad20ba6257587da170d6c1a1415
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-07-12 11:24:30 +02:00
Amir Masoud Abdol
70fc6b4581 Disable vcpkg detection/integration by default
We should not automatically enable vcpkg as soon as we find it on the
system. With this change, we disable the automatic
detection/integration.

[ChangeLog][configure] Vcpkg detection/integration is now disabled by
default, and it can be enabled by either passing `-vcpkg` to the
configure script, or by passing `-DQT_USE_VCPKG=ON` to cmake.

Change-Id: I4f098db670f11373064c071f1c3204e2e183d3db
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-07-12 11:24:15 +02:00
Marc Mutz
25f5983ea8 Normalize signal/slot signatures [1/2]: non-QPair
This is the result of running util/normalize, dropped some false
positives:

- it removed the space after "d, " in Q_PRIVATE_SLOT(d, foo())

- it removed spaces in moc text streaming of "SLOT(" << ... << ")"

In addition, the tool replaces QPair with std::pair. This is
surprising and therefore performed in a separate commit.

Pick-to: 6.6
Change-Id: If4e3815d7c0840defc1b82bcbf41a8265acda0d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 10:29:45 +02:00
Marc Mutz
97ec1d7d8e QAtomicScopedValueRollback: fix CTAD for Q(Basic)AtomicPointer
We need deduction guides to turn the AtomicPointer template argument
(the pointee) into a pointer:

    QAtomicPointer<int> → QAtomicScopedValueRollback<int*>

Extend a test to cover pointers, too.

Fixes: QTBUG-115105
Pick-to: 6.6 6.5
Change-Id: Ib416c6a43e4da480b707a0bf6a10d186bbaad163
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-12 10:29:44 +02:00
Yuhang Zhao
47ee4eae6a Windows style: use correct value for title bar height
The title bar height = caption bar height + resize border thickness.

This calculation is used by many open source repositories for quite
a long time, including Microsoft's own famous products such as
Windows Terminal. And if you use AdjustWindowRectEx() to get the
title bar height, the result is also exactly the same, so this should
be the correct calculation.

Normally, when DPI is 96, it should be 23 + (4 + 4) = 31px.

Pick-to: 6.6
Change-Id: I0a2de3b55d5b62327eacc7e2ff5dc23771b8efdb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-12 05:41:50 +00:00
Giuseppe D'Angelo
95332cc376 Enable QT_NO_CONTEXTLESS_CONNECT in headersclean
Change-Id: I8b21a9666bb273929f740382fb6de8a1bb5ca911
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-12 01:33:16 +02:00
Alexandru Croitor
c45c32af32 CMake: Expose metatypes internal functions for further use in qml
Extract the code that propagates metatypes files into separate
functions, so that they can be used in the qml api to propagate a qml
module backing library's metatype file to its associated plugin.

It's a bit messy due to the tech debt around installation, but the
behavior of the code in qtbase should not change.

Task-number: QTBUG-115152
Change-Id: I85dfcc4c76e9c41239dc0380920e68a3a6400815
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-07-12 00:53:58 +02:00
Bartlomiej Moskal
fdccb66a4e Android: Fix for checking clipboard text mime type
Different mime types are widely used on mobile devices. For example all
text copied from gmail is copied as text/html type.

After 2937cf91c7 commit there is a
regression that makes it impossible to paste any text different than
"text/plain".

To fix it, any "text/*" mime type should be treat as it contains a text
(not only "text/plain"). That will allow to paste different text mime
types.

During this work also tst_qclipboard testset was turned on for Android
and new test (getTextFromHTMLMimeType) was added.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-113461
Change-Id: I3ef9476b8facdc3b61f144bd55222898390127c9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-07-12 00:53:58 +02:00
Thiago Macieira
93b87b5cbf QSocketNotifier: firm up the ordering in unexpectedDisconnection()
The test was relying on the fact that, having written 1 byte to both
writeEnd1 and writeEnd2 (and ensured those bytes were written with
waitForBytesWritten()), both read ends would be activated by the next
event loop. It turns out that this was an unreliable assumption, because
the processing of that 1 byte on the second socket may not have happened
yet. So firm up by waiting that both read ends are readable before even
creating the QSocketNotifiers we will read on.

I'm not entirely sure what this test is attempting to test. Its
documentation says it's testing a QAbstractSocket condition, but the
read ends aren't QAbstractSocket (this test should have been in
tst_QAbstractSocket if so). It may be testing the condition that caused
that QAbstractSocket behavior, but that wouldn't be a good test.

Drive-by remove redundant flush()-after-waitForBytesWritten() calls.

Fixes: QTBUG-115154
Pick-to: 6.5 6.6
Change-Id: I61b74deaf2514644a24efffd17708f8071f707ed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-11 13:44:29 -07:00
Thiago Macieira
5bcacdbd1a QNetworkInterface/Linux: fix mismatch of pointer and pointee
It was hard to see the problem because of the lambda, combined with
reinterpret_cast on the output of non-typesafe C macro. NLMSG_DATA
returns a void*, so use static_cast to be sure not to do something
wrong.

This only affected the code that dealt with unexpected replies from the
Linux kernel, which it doesn't send. So I don't expect this fixes any
improper QNetworkInterface behavior.

Found by CodeChecker.

Pick-to: 6.5 6.6
Change-Id: I61b74deaf2514644a24efffd1770d75e5a4f2636
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-11 13:44:29 -07:00
Giuseppe D'Angelo
536a4299be Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBase
It's clean now, keep it as such.
Enabling it for QtCore is still OK, because it just hides a function
template declared in a header.

Change-Id: I8e7dfae179732ba04241a6a3258c2d722e8259df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-11 22:44:29 +02:00
Axel Spoerl
b476570932 tst_QXmlStream::tokenErrorHandling() - register test directory in CMake
Register the directory tokenError in the build system to expose it to
embedded devices / for cross compiling.
Do not fail the test function, when a test file isn't found. The tested
functionality is platform independent and will be tested on other
platforms.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-11 22:44:28 +02:00
Axel Spoerl
f67a497dbe QXmlStreamReader: Fix variable naming
Replace variable names referring to XML "location" with names referring
to XML context.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5
Change-Id: If00e92dce237d95fa1850f0b45192995724ba99f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-11 22:44:28 +02:00
John Chadwick
1079b53739 Fix transparency in 16 bit and 24 bit ico files
As a result of the fix for QTBUG-75214, Qt inadvertently no longer
reads the AND mask that specifies transparency for 16-bit and 24-bit
ico files. This is because it tries to detect 32-bit icons by checking
icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the
QImage, not the depth of the icon, and 32-bit QImage is used for all of
the non-indexed cases (16-bit, 24-bit and 32-bit.)

This commit instead uses icoAttrib.nbits, which should reliably
determine whether or not the icon is 32-bit. This makes the behavior
consistent with other ico reading software, including Windows.

Also, adds a unit test that verifies correct behavior of icon masks,
checking for both QTBUG-75214 and QTBUG-113319.

Amends 1d128ed1df.

Fixes: QTBUG-113319
Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385
Pick-to: 6.6 6.5 6.2 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-07-11 18:35:41 +00:00
Oliver Eftevaag
417878904b Move palette helper functions to QPalettePrivate
We want to use the bitPosition function in Qt Quick, in order to be able
to unset a bit in the resolve mask for a specific color group and role.

This patch, solves this by adding a new qpalette_p.h header, which
declares QPalettePrivate, allowing those helper functions to be accessed
anywhere internally in the qt framework.

Change-Id: Iecb28b48289d6bcabf0936274964a05d3c44efc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-11 17:42:38 +02:00
Amir Masoud Abdol
ab89b9cab3 Set VCPKG_CHAINLOAD_TOOLCHAIN_FILE to supplied_toolchain_file
Just a minor change, so that it's clear that we are setting the supplied
toolchain as the VCPKG_CHAINLOAD_TOOLCHAIN_FILE.

Change-Id: I10b35f04e7ad684015062066f67117ce4a964c1c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-11 17:32:25 +02:00
Amir Masoud Abdol
044cc7c90b Detect vcpkg after everything else
In order to use multiple toolchain, e.g., when we are cross compiling,
we need to load the detect, and load vcpkg's toolchain after our
toolchain file.

Change-Id: I7f3374363f725a634356788e22ac21835505c4b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-11 17:32:25 +02:00
Axel Spoerl
4b43a329b7 QTabBarPrivate::setupMovableTab() - fix initialization of tab position
The method initialized the tab position with the enum value OnlyOneTab.
=> Change this to the correct initial enum value Moving.

Fixes: QTBUG-115147
Pick-to: 6.6
Change-Id: I4ce04f0a41dac6e93affd300eb424f4087eb7867
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-11 15:32:24 +00:00
Volker Hilsheimer
022657d7d0 Refactor QStyle: const'ify some local variables
Task-number: QTBUG-114473
Pick-to: 6.6
Change-Id: I49483dc9c000fac024c81a8210515c8dd5e35559
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-11 14:31:17 +02:00
Volker Hilsheimer
813bbc515b QStyle: don't use the QPixmapCache when a style sheet is set
If a style sheet is active, then the palette in the QStyleOption might
be a generated, short-lived, temporary QPalette instance. As QPalette's
cacheKey is based on instance-counters of the private data structures,
it will always be unique for such a QPalette, even if the brushes are
the same as in a previous instance.

(QPalette::cacheKey is just a 64bit integer, we cannot possibly encode
the entire QPalette data in it in a collision-free way, and since a
brush in the palette might contain a pixmap or a gradient we couldn't
even generate an efficient string representation for it. We could at
most cache and reuse QPalette instances based on the attributes in the
style sheet rule and in the base palette of the widget. However, this
seems fragile; it might be an opportunity for future optimization.)

Some styles use the QPixmapCache, with a key that includes the
palette's cache key. The key will always be unique if the palette is
based on style sheet rules, and then we fill pixmap cache with pixmaps
that can never be reused, making the cache both useless and wasteful.

To solve this, generate an empty key if we detect that it is for a style
object that is the target of a style sheet. Return an empty cache key
string from QStyleHelper::uniqueName, which will make QPixmapCache
return immediatey when trying to insert or find an object.

This is not pretty, but it makes the change minimal and low-risk.
Refactoring the respective code paths to e.g. consistently use the
BEGIN_STYLE_PIXMAPCACHE helper macro requires larger changes that
can only be verified visually, and so are out of scope for a bug fix.

This requires changes to code that uses QStyleHelper::uniqueName, as we
need to avoid that other key elements are appended to the generated (and
maybe empty) key. As a side effect, this ends up with code that makes
better use of QStringBuilder.

Pick-to: 6.6
Fixes: QTBUG-114473
Change-Id: I011aed0885f105cbf1e8c0bc6b94c46df47761a3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-11 14:31:12 +02:00
Hatem ElKharashy
a11ee31883 Add a private API to capture a graphics frame
This commit provides a minimal API for capturing a graphics
frame, save it and replay it later for debugging. The intention
here is to provide the basic need for future work to allow capturing
through tooling or programmatically from code. This API is
intended to be cross-platform by using Metal Capture Manager on
Apple devices and RenderDoc C++ API everywhere else.

Task-number: QTBUG-114067
Change-Id: If72d92bdef5e5985a0ec2e85e97fd1182da3c53c
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-07-11 15:24:26 +03:00