Commit Graph

57334 Commits

Author SHA1 Message Date
Yuhang Zhao
8a0e0f8cc1 QtBase: Windows: Replace some deprecated API usages
Microsoft recommends to use CoInitializeEx()
and SetWindowLongPtr()/GetWindowLongPtr() in new code.

Use COINIT_DISABLE_OLE1DDE to avoid overhead of
initializing and using obsolete technology.

Pick-to: 6.4
Change-Id: I9d16943e864d4487dd4f46fd9325579c298c52b9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-08-03 23:24:21 +08:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
15117f84bb CMake: Relax constraint on not having feature values change
Previously if qtbase was built with feature A set to ON, then building
qtsvg, then rebuilding qtbase with feature A set to OFF, trying to
build qtsvg would fail with an error message at configure time saying
that the feature value has changed.

This check was added quite early in the Qt CMake port, presumably to
catch accidental reconfigures that might cause long rebuilds.

This has dubious benefit though. We constantly had people telling us
they get the error without knowing what to do. The usual advice was to
remove CMakeCache.txt and reconfigure.

Instead of forcing people to suffer this dance, relax the constraint
by issuing a warning instead of an error, and make it more clear why
a rebuild might happen (a changed feature value might change
the generated module C++ header file which in turn might be included
by various project sources).

Amends 20633d97ab

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-95834
Change-Id: I992bd61024958869f3b995471b4c7ff75e3a33a0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Joerg Bornemann
97fa1f24b9 CMake: Remove the CLASSNAME argument from qt6_add_plugin
CLASS_NAME should be used instead.

There should be no user projects that use CLASSNAME.  It was only added
for internal use for a transitional period.

Change-Id: I450f912c395907a72e2078b5d458c1c3bd115b8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-03 08:02:41 +02:00
Joerg Bornemann
626c3f56cf CMake: Remove internal __qt_add_plugin_*_args variables
All references to these variables have been removed from Qt
repositories.

Change-Id: Icca4668ec183ff543d04097600f8a8869066f8cc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-08-03 08:02:37 +02:00
Joerg Bornemann
4bda4b30ee CMake: Remove the now unused option __QT_INTERNAL_NO_INSTALL
...from qt6_extract_metatypes.

All usages of this option have been removed.

Change-Id: I82e624ead8292db476c09969addeecf66accce80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-03 08:02:34 +02:00
Maximilian Goldstein
eef5ff0671 QLocale: Expose FormatTime enum via Q_ENUM
Previously it wasn't exposed to the metatypes system.

Change-Id: I096fb505c957ff30a5dc43b30f02530513e5f85a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-02 22:07:21 +02:00
Alexey Edelev
5fc8a377ce Build minimal subset of tests for Android multi-ABI Qt builds
Add an option to limit the number of tests for building and testing
Android multi-ABI configurations in CI. Currently only Core tests
supposed to run.

Change-Id: Ibb8a41d60d108259ef2675ec54bde2482f87c8b2
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-02 21:18:50 +02:00
Laszlo Papp
aa69457533 QAbstractNativeEventFilter: Add a Windows example
Change-Id: Ic378174e7f192abc27524cbcd925705c8bb46502
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-02 19:12:39 +01:00
Sona Kurazyan
357db9ceab qUtf16Printable: avoid creating a copy of a QString
Amends daa7f5375c.

Change-Id: I569efc4556341bfbce452bdf169c50a3b4be9ca7
Pick-to: 6.4 6.3 6.2 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-02 18:18:01 +02:00
Thiago Macieira
777c7a2288 QMetaObject: fix check for void's metatype in metaType()
Pointer comparison is not sufficient on most platforms.

Change-Id: I6f936da6f6e84d649f70fffd1706f8b1f0654a1e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:33 -07:00
Thiago Macieira
a4e0f070ae QMetaObject: fix calling overloaded functions & constructors
The rewrites in a1c34d8bd0,
0f76e55bc4 and in commit
b73ab954df didn't do this right, though no
problem ended up happening. In particular, the constructor one failed to
check if there were even more parameters.

Change-Id: I6f936da6f6e84d649f70fffd1706f827ba635584
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:30 -07:00
Thiago Macieira
5643b16684 QMetaObject: improve methodMatch() to include the stored metatypes
This methodMatch() function needs a rewrite.

Change-Id: I36b24183fbd041179f2ffffd1702278920c54e94
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:26 -07:00
Thiago Macieira
59065a8530 QMetaType: fix void* parameters
Commit 3695b35dfc accounted for pointer to
other incomplete types, but pointer-to-void was missed. This caused an
inconsistency in the stored metatype for void*, which is a built-in type
(QMetaType::VoidStar) but no pointer was recorded.

The test in tst_moc hadn't been enabled because the functions in
questions weren't extracted by moc. That is fixed in this commit.

Change-Id: I6f936da6f6e84d649f70fffd1706f613517a75fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:22 -07:00
Fabian Kosmale
3410b1dc9c QProperty: optimize non-recursive notification logic
Previously, we were storing all binding-observers in a list, so that we
can later revisit them during the notification loop.
However, there is no point in doing that when the binding did not
actually change.

Pick-to: 6.4
Change-Id: I0b3343cc442eca2586c7c6a10c31d780f04730e6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-01 13:01:44 +00:00
Laszlo Agocs
61806a058a eglfs: Fix screen cloning when atomic is enabled
The problem was introduced in the atomic code path only, the legacy
one has always specified the correct crtc id.

Amends 56149c0fbb.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ie3a99ec4bc24901e1303631097a395fde8dbe110
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-01 12:40:45 +02:00
Laszlo Agocs
5b334729d3 rhi: gl: Avoid magic adjustments to the context/window format
...by removing the entire adjustedFormat() helper.

Qt Quick has never used this, which indicates it is not that
useful. Same goes for Qt Multimedia or Qt 3D. Ensuring depth and
stencil is requested is already solved by using
QSurfaceFormat::setDefaultFormat() or by adjusting the formats
everywhere as appropriate.

The helper function's usages are in the manual tests that use it as a
shortcut, and in the GL backend itself. Remove it and leave it up the
client to set the depth or stencil buffer size, typically in the
global default surface format. (which in fact many of the mentioned
manual tests already did, so some of calls to
window->setFormat(adjustedFormat()) were completely unnecessary)

By not having the built-in magic that tries to always force depth and
stencil, we avoid problems that arise then the helper cannot be easily
invoked (thinking of widgets and backingstores), and so one ends up
with unexpected stencil (or depth) in the context (where the GL
backend auto-adjusts), but not in the window (which is not under
QRhi's control).

It was in practice possible to trigger EGL_BAD_MATCH failures with the
new rhi-based widget composition on EGL-based systems. For example, if
an application with a QOpenGLWidget did not set both depth and stencil
(but only one, or none), it ended up failing due to the context -
surface EGLConfig mismatches. On other platforms this matters less due
to less strict config/pixelformat management.

Pick-to: 6.4
Change-Id: I28ae2de163de63ee91bee3ceae08b58e106e1380
Fixes: QTBUG-104951
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-01 12:40:45 +02:00
Sona Kurazyan
950d761f81 Remove outdated docs for qOverload()
Change-Id: Ie641b1f7100e7053e1fe0299a0b2b0bd708326af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-01 12:40:45 +02:00
Fabian Kosmale
f1b1773d0a QProperty: Notify observers even when dependency is gone
Problem description:
--------------------
Assume we have two properties, P1 and P2. Assume further that we assign
a binding to P2, so that it depends on P1. Let the binding additionally
capture some (non-QProperty) boolean, and only create the dependency to
P1 if the boolean is true.

The state afterwards is
P1:[p1vaue|firstObserver]
                      |
                      |
                      v
                ---[p2binding]
	       /
P2:[p2value|binding]

If the boolean is set to false, and P1 changes its value, we still
correctly re-evaluate the binding and update P2's value. However, during
binding evaluation we will notice that there is no further dependency
from P2 on P1, and remove its observer.

The state afterwards is
P1:[p1vaue|firstObserver=nullptr]

                ---[p2binding]
	       /
P2:[p2value|binding]

Then, during the notify phase, we traverse the observer's again,
starting from P1's firstObserver. Given that it is nullptr now, we never
reach P2's binding, and thus won't send a notification from it.

Fix:
----

We store a list of all visited binding-observers (in a QVarLengthArray,
to avoid allocations as long as possible). After the binding evaluation
phase, we then use that list to send notifications from every binding
that we visited. As we already have a list of all bindings, we no longer
need to recurse on binding-observes during the notification process;
instead, we only need to deal with static callbacks and ChangeHandlers.

The pre-existing notification logic is still kept for the grouped update
case, where we already have a list of all delayed properties, and should
therefore not encounter the same issue. Unifying its codepath with the
existing logic is left as an exercise for a later patch.

Fixes: QTBUG-105204
Task-number: QTBUG-104982
Pick-to: 6.4 6.3 6.2
Change-Id: I2951f7d9597f4da0b8560a64dfb834f7ad86e757
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-01 12:08:26 +02:00
Axel Spoerl
ebf733c6fb Derive PlaceholderText color from Text color in QPalette
Until Qt 5.15, PlaceholderText color was automatically derived from the
Text color, dimmed by 50% (set alpha to 128, assuming the text color
is fully opaque).

This method has been adapted in the static qt_fusionPalette() method.
No other static method to populate palettes defines a PlaceholderText
color. As a consequence, the Text color is used to render placeholder
text characters.

This patch adds a static method, that sets missing PlaceholderText
colors by deriving them from the corresponding Text color.
It takes a dim factor by which the opacity is reduced versus the
corresponding Text color.

Fixes: QTBUG-105049
Pick-to: 6.4 6.3 6.2
Change-Id: Iebb9d15d56f5d72d7ec68b7a0babdf5825b92665
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-08-01 12:07:08 +02:00
Laszlo Agocs
4fdadd2348 rhi: gl: Reset the buffer bindings on beginExternal
Play nice with old renderers like the OpenGL paint engine for
QPainter.

When combining Qt Quick and QPainter targeting the same GL window,
calling QQuickWindow::beginExternalCommands() is not currently
sufficient to ensure problem-free operation, it also needs a
QQOpenGLUtils::resetOpenGLState() afterwards to get rid of the buffer
bindings. (which is important when using legacy code with client-side
vertex arrays) Which in turn is not what the documentation promises,
so resetting the bindings is now ensured on the rhi level when
Qt Quick calls beginExternal().

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-104801
Change-Id: Ibd82753996768aad0118bff87d4e1f8bcc388c58
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-01 10:07:08 +00:00
Laszlo Agocs
856bb38eaf Evaluate TranslucentBackground when (re)creating the window
The problem is reported in combination with the new 6.4 way of
handling texture-based widgets, but this looks like something that has
always been missing:

Setting WA_TranslucentBackground changes the QWidgetWindow's format,
and this is done upon calling setAttribute(). That's good for most
cases, but the changes to the QWindow's format are lost when the
window is destroyed and then the widget gets another window
later. This is not that common, but can happen.

For example, if a top-level widget is parented under something else,
and then later it is parented to null again, so that it is toplevel
once again, background transparency can be lost because nothing
re-evaluates the WA_TranslucentBackground flag after the initial
setAttribute(), and so the widget's second QWidgetWindow is not set up
accordingly (because this new QWindow may not have alpha specified in
the QSurfaceFormat which may or may not be a problem, depending on the
platform / windowing system)

The simple solution is to evaluate the attribute not just when setting
it, but also when a new QWidgetWindow is created for the widget.

Fixes: QTBUG-104952
Pick-to: 6.4
Change-Id: I92746caea5561544f90395d5473ac28d43143924
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-01 12:07:07 +02:00
Mikolaj Boc
e8e584090b Use the dead Mac path in QWasmEventTranslator::translateDeadKey
The path for is_mac is unused. Use it by querying the platform from the
new WASM plugin web platform API.

Task-number: QTBUG-105213
Change-Id: I9a8922b5e9d215090dbdcc534c056c2cc068c009
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-08-01 07:57:07 +02:00
Sona Kurazyan
947a9d2aaf Extract header qtdeprecationmarkers.h from qglobal.h
Task-number: QTBUG-99313
Change-Id: Ief3d7ddb9dc0962bd3404f1fe61d292f2fe434cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-31 18:19:06 +00:00
Thiago Macieira
f1457b7b47 tst_QMetaType: fix warning that buffer may be unused
We pass a pointer to uninitialized memory to QMetaType::create().
There's no harm because we're using the invalid QMetaType, but GCC is
actually right to complain for any other type.

qtestcase.h:54:25: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
qmetatype.h:454:11: note: by argument 2 of type ‘const void*’ to ‘void* QMetaType::create(const void*) const’ declared here

Pick-to: 6.3 6.4
Change-Id: I3859764fed084846bcb0fffd1703eb7967acf0d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-31 08:00:11 -07:00
Thiago Macieira
e9c9e9225c QVariant: make many more QtCore types nothrow-copyable
All of those are implicitly-shared Qt data types whose copy constructors
can't throw and have wide contracts (there aren't even any assertions
for validity in any of them). These are all types with a QVariant
implicit constructor, except for QCborValue, which is updated on this
list so QJsonValue (which has a QVariant constructor) is also
legitimately noexcept.

To ensure we haven't made a mistake, the Private constructor checks
again.

Change-Id: I3859764fed084846bcb0fffd17044d8319a45e1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-30 07:27:56 -07:00
Thiago Macieira
3fcb0237dc QVariant: update the noexcept content for a few types
Commit 2f0a625fd4 added noexcept for
these, but didn't verify that the operation itself was noexcept. And it
wasn't on 32-bit systems, because sizeof(void *) is only 4 bytes, making
QVariant and QVariant::Private a mere 12 bytes. That's insufficient for
QUuid and for almost all geometric types when qreal==double.

We can't use sizeof() in qvariant.h because most of those classes are
only forward-declared.

Change-Id: I6f936da6f6e84d649f70fffd1705ce948891d06a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-30 07:27:55 -07:00
Giuseppe D'Angelo
e540d4a864 QRegularExpression: introduce (global)matchView
QRegularExpression::match (and globalMatch) is currently overloaded
for QString and QStringView. This creates a subtle API asymmetry:

  QRegularExpression re;

  auto m1 = re.match(getQString());       // OK
  auto m2 = re.match(getStdU16String());  // Dangling

This goes against our decision that every time that there's a possible
lifetime issue at play, it should be "evident". Solving the lifetime
issue here is possible, but tricky -- since QRegularExpression
is out-of-line, one needs a type-erased container for the input
string (basically, std::any) to keep it alive and so on.

Instead I went for the simpler solution: deprecate match(QStringView)
and introduce matchView(QStringView) (same for globalMatch). This
makes it clear that the call is matching over a view and therefore
users are supposed to keep the source object alive.

Drive-by, remove the documentation that says that the QString
overloads might not keep the string alive: they do and forever will.

[ChangeLog][QtCore][QRegularExpression] Added the matchView()
and globalMatchView() functions that operate on string views.
The match(QStringView) and globalMatch(QStringView) overloads
have been deprecated.

Change-Id: I054b8605c2fdea59b556dcfea8920ef4eee78ee9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:27 +02:00
Sona Kurazyan
8d6b274fa4 Extract header qtversionchecks.h from qglobal.h
Task-number: QTBUG-99313
Change-Id: Iaaa6a055367e861d095b92e3e85e5bc340e6bbc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:21 +02:00
Sona Kurazyan
908d048e4f Extract header qenvironmentvariables.h from qglobal.h
qcontainerfwd.h was relying on the forward declaration of QByteArray in
qglobal.h, so add the missing forward declaration there.

Additionally, had to move the implementations of qTzSet() and qMkTime()
to qenvironmentvariables.cpp along with environmentMutex.

Task-number: QTBUG-99313
Change-Id: I233aff305c2fedaf0a48362cc99ff2d6f6c0ee54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-29 23:04:21 +02:00
Sona Kurazyan
349e74c06c Move the check for -fPIC compile flag to qcompilerdetection.h
Task-number: QTBUG-99313
Change-Id: I9072b73a75599381f5f2be0799bca5bf149122de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:21 +02:00
Sona Kurazyan
ff8de321e2 Extract header qoverload.h from qglobal.h
Task-number: QTBUG-99313
Change-Id: Id827f95b5aa5d4e0d57dcc1060a0746bcaa34db3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:21 +02:00
Sona Kurazyan
19454b05c2 Extract header qtranslation.h from qglobal.h
As a drive-by, fixed the sorting order of header includes.

Task-number: QTBUG-99313
Change-Id: I731e397f8488460657b31839c49f07ff3c476c66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:21 +02:00
Alexandru Croitor
ea8645d846 CMake: Deprecate _add_app/executable/test/tool PUBLIC_LIBRARIES option
Warn projects not to use it because PUBLIC_LIBRARIES don't make
sense for executable targets and it also led to some issues in the
internal functions where some of them did not expect to receive
PUBLIC_LIBRARIES.

To ensure builds don't needlessly break, treat PUBLIC_LIBRARIES values
as regular LIBRARIES. In the future we might add an error instead.

Using PUBLIC_LIBRARIES in qt_internal_add_app, etc, accidentally
worked because the option name and the values following it were
parsed as values of the "previous" option, like SOURCES or
INCLUDE_DIRECTORIES or LIBRARIES, and when those got
passed through to qt_internal_extend_target, things magically worked.

We have a lot of projects using PUBLIC_LIBRARIES, mostly due to the
way qmake pro files were written and how pro2cmake converted them.
We'll have to clean up each repo.

Change-Id: I69e09d34afdf98f0d47c08d324643fc986f8131c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-29 18:33:00 +02:00
Volker Hilsheimer
2ffab52a4f Windows: Implement dark mode palette and accent color support
Use the WinRT API to read the basic colors, and construct a usable
palette from those. None of the Windows.UI.ViewManagement.UISettings
APIs returns a full set of usable colors -UIElementColors returns the
old system colors, or useless values. And UISettings::GetColorValue only
gives access to a basic palette, where e.g. the background color is
just black, which doesn't match what Windows itself uses.

However, we know if we want to be dark or light, and can construct a
palette from the basic colors. The most relevant color to read from the
system is the accent color.

In the course of doing that, refactor and clean up the code somewhat to
standardize the handling, and remove hardcoded color values as much as
possible.

This is opt-in: unless the application is started with the QPA darkmode
parameter set to 2, nothing changes.

Pick-to: 6.4
Task-number: QTBUG-72028
Change-Id: If603bb34c8f7478a05aafef2552a67e1e3460d29
Reviewed-by: Marius Kittler <mariuskittler@gmx.de>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-07-29 17:18:19 +02:00
Sona Kurazyan
6d95408f1a Remove the unused forward declaration for QDataStream from qglobal.h
The comment suggests that there should be function declarations that
need QDataStream, but there are none. It's probably a leftover from the
old code.

Change-Id: Iacefccc6b862d9a4ec111ebac8970b1ef01bcf39
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-29 13:00:25 +02:00
Thiago Macieira
1425ad2cce QVariant: move d.get() into qNumVariantToHelper
Until we've checked the stored meta type, we don't know what the Private
contains. We only formed a reference to said value, so we should be
safe, but why tempt it?

Change-Id: I6f936da6f6e84d649f70fffd1706095fc6228755
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
2022-07-28 22:08:07 -07:00
Alexandru Croitor
d528e96e73 CMake: Rename tests to be unique for top-level builds
Pick-to: 6.4
Task-number: QTBUG-105238
Change-Id: I6c0276d14b4d90046b0fcfd281e198f59318e804
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-28 21:33:26 +02:00
Volker Hilsheimer
f387bb55d4 Revert "CUPS: Add support for accessible IPP printers"
This reverts commit 2f5f276b4a,
after which valid printers are no longer listed anymore.

Fixes: QTBUG-105242
Pick-to: 6.2 6.3 6.4 5.15
Change-Id: I6a388acff2a8033ad1052319edcf7e41a2f72c8f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-07-28 20:50:18 +02:00
Robert Griebl
f7d42e6b0c cmake: add support for EXCEPTIONS to qt_internal_add_app
Change-Id: I79088f6647496ed455573cab9d403bd8a3f26c76
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-28 20:50:18 +02:00
Thiago Macieira
0b701ec0cd QMetaObject: move QMetaMethodPrivate into an unnamed namespace
So the compiler doesn't feel like it must emit these functions. They're
not used outside of qmetaobject.cpp.

Change-Id: I36b24183fbd041179f2ffffd170228c6e94b5f9b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:18 -07:00
Thiago Macieira
8bde91bc2a QMetaObject: simplify printMethodNotFoundWarning() a little
We don't need to copy the candidate name into the QVarLengthArray buffer,
we just need that buffer for the parameters.

Change-Id: I36b24183fbd041179f2ffffd17021ba2fd2b8251
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:18 -07:00
Thiago Macieira
7f640aa2eb QMetaObject: merge the findMethodCandidates() into the warning function
It's only used there anyway.

Change-Id: I36b24183fbd041179f2ffffd17021b6768055bfa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:17 -07:00
Thiago Macieira
0ed2c60fea QMetaObject: move the warning from invokeMethod() to a new function
Which we can mark Q_DECL_COLD_FUNCTION.

Change-Id: I36b24183fbd041179f2ffffd17021b1362404f95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:17 -07:00
Thiago Macieira
b73ab954df QMetaObject: rewrite newInstance()
Like in the previous commit, use QMetaMethodPrivate::invokeImpl() to
avoid having to reconstruct the method signature.

Change-Id: I36b24183fbd041179f2ffffd17021c7a0bfa48c0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:17 -07:00
Thiago Macieira
0f76e55bc4 QMetaObject: rewrite invokeMethod()
Use the QMetaMethodPrivate::invokeImpl() function we added in the last
commit, without recreating the method signature. Instead, only do a
comparison on the method name and allow invokeImpl() to decide whether
this method can be called with the given arguments. This will allow
invokeImpl() to have more flexibility in deciding if the arguments match,
using the stored metatype information.

Change-Id: I36b24183fbd041179f2ffffd17021a86484bfab6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:16 -07:00
Thiago Macieira
a1c34d8bd0 QMetaObject: rewrite QMetaMethod::invoke
This adds an internal method to QMetaMethodPrivate to do the work of
actually placing the call on a given meta method. This rewrite should
make the code clearer, but make no otherwise perceptible difference in
behavior.

The next commit will rewrite QMetaObject::invokeMethod to use this new,
internal function to avoid doing a lot of string allocations.

Change-Id: I36b24183fbd041179f2ffffd170219c0deaaf7f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:12 -07:00
Mikolaj Boc
0881b5d75c Modernize QWasmCompositor::windowAt
Use a well-known idiom for finding a matching window in the window stack
(std::find_if)

Change-Id: I677ef6ad8ee88bbd9eee1405be592ec2527ca3b9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-28 15:45:07 +02:00
Alexandru Croitor
ea668ff163 CMake: Export package name and 3rdparty flag for 3rd party libraries
Needed to get rid of warnings like

 CMake Warning at cmake/QtFindPackageHelpers.cmake:406
 (message): Could not find target Qt6::BundledLibYaml to query
 its package name. Defaulting to package name Qt6BundledLibYaml.
 Consider re-arranging the project structure to ensure
 the target exists by this point.

which were introduced with the integration
of dffcc2370e in qtbase.

This happened because we never set and exported the package names
for 3rd party bundled libs.
So export the package name as well as "is 3rd party lib" value.

Amends 6235f7fa62

Pick-to: 6.4
Task-number: QTBUG-104998
Change-Id: I25fc1ffef766198974025e0097bced1cca4dd28d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 15:11:54 +02:00
André Klitzing
d1dd944239 Fix race condition with QTest::ignoreMessage
If another spawned thread will log at the same time
a crash was possible because IgnoreResultList
was not thread-safe.

Task-number: QTBUG-104840
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I251c83bb28cb75e55d477706bf2524c061a6eab7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-28 13:11:54 +00:00