Commit Graph

61152 Commits

Author SHA1 Message Date
David Edmundson
4863810065 Call into platform hooks for start and end frames
This closely matches QPlatformOpenGLContext which in turn, where it can
be used by backends to guard low level resources.

Change-Id: Ia44cebced6cdf94497279c47d3c35c0e02e4cb0e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-28 08:37:10 +01:00
Volker Hilsheimer
1c5c1df43e Add a helper for better error messages when functor is incompatible
Amends 207aae5560 to make it easy to
create human-friendly error messages. Since the functor-accepting member
functions are not removed from the API, the first compile error will be
that there is no suitable overload of the makeSlotObject helper, which.
With the assert helper, the first error message is easier to understand.

Change-Id: I4878ec35a44ddfa5dc9d9e358d81c3fd40389c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Volker Hilsheimer
9958edba41 Support move-only functors in invokeMethod and async APIs
Move-only functors must never be passed by value, so fix the
QFunctorSlotObject constructor accordingly.

This then requires adjustments to the various QMetaMethod::invokeMethod
overloads, as those must also perfectly forwad the functor type.

Enable the previously failing test case for move-only functors.

Change-Id: I9c544fd3ddbc5e1da3ca193236291a9f83d86211
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Volker Hilsheimer
bd69821074 Support free functions and const functors as callbacks
Amend 207aae5560, as code checker
complained that we std::move'd a potential lvalue. This warning was
valid if the public API did not accept the functor parameter by value.

Fix this by consistently std::forward'ing the parameters through the
call stack, and add a compile-time test. Writing that test revealed that
the helper API didn't work with free functions, so fix that as well. It
also revealed that QFunctorSlotObject couldn't work with a const
functor, which is also fixed by this change.

We cannot support move-only functors with that change, as it requires
a change to QFunctorSlotObject that breaks the QMetaObject test.

Change-Id: Iafd747baf4cb0213ecedb391ed46b4595388182b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-28 07:45:22 +02:00
Thiago Macieira
10a850f584 QReadWriteLock: don't mark fully-inline classes as exported
We can't remove the export in Qt 6 because of how MSVC ABI works. In all
other compilers, this change is a no-op anyway (inline functions have
hidden visibility).

Change-Id: I3d728c4197df49169066fffd1756dc377b30c504
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-27 19:45:35 -07:00
Allan Sandfeld Jensen
357ca7d90a Tighten template on new QRunnable create method
Only instantiate with object/methods that are invokable with void and
returns void.

Change-Id: Iab2e43bb8e061e3875a6cca8e06ebbfbfa9e6fe8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-27 22:55:28 +00:00
Shawn Rutledge
ebd2fe108a Add flicking behavior hints to xcb platform integration
For now these will be used in QtQuick Flickable.

Task-number: QTBUG-35608
Task-number: QTBUG-35609
Task-number: QTBUG-97055
Pick-to: 6.5
Change-Id: I944d7f0271d535822ceeef610f232f56c85e0938
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-04-28 00:05:52 +02:00
Tasuku Suzuki
7b9e73a921 Doc: add darkmode=0 explicitly
Task-number: QTBUG-72028
Pick-to: 6.5
Change-Id: Ia73dbd4f203ce654e5221f69a65b8c82c2af7d79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-28 03:53:03 +09:00
Laszlo Agocs
2d3cdcce59 rhi: Add enablers for testing reducing the resource update pools
...which comes at the expense of performance. Therefore this is
currently an environment variable-based opt-in solution.

Change-Id: If884de041f619fef0929ac2cfbdd035092723d51
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-27 16:21:46 +02:00
Laszlo Agocs
7a79302e4e rhi: Properly squeeze in trimOpLists
...and improve the comments since it is not directly obvious why
things are done the way they are.

Pick-to: 6.5
Change-Id: I6aa5f09b1b2f7f3fc18f74a4af2977d24278aae6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-27 16:21:42 +02:00
Laszlo Agocs
3d2eb6c191 rhi: Improve nextResourceUpdateBatch docs
Mention something some parts of Qt Quick rely on: that the update
batch objects stay valid across frames.

Change-Id: I2a21c19ceaa0c73a95062cc9b5cc3f4d1020e8a5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-27 16:21:39 +02:00
Laszlo Agocs
a3d3aaeee0 rhi: Add another resource update batch autotest
Exercise the validity of update batches, i.e. that one can
safely commit it in later frames as well, as long as all
related buffers and textures stay valid.

Change-Id: Ia943e4b37141fe17253eeae32010e0f8d92c1583
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-27 16:21:36 +02:00
Tor Arne Vestbø
4db9fdf58e macOS: Avoid memory leak when using NSSlider for style drawing
To fix the broken sliders reported in QTBUG-98093 a workaround was
added by 4bee9cdc0a where we would
call initWithFrame on an already initialized NSSlider.

This breaks the contract of object initialization in Objective-C,
as the class is free to allocate and prepare resources for the
instance without freeing previously acquired resources first.
As noted by the Object Initialization chapter of the Concepts
in Objective-C Programming guide, "Once an object is initialized,
you should not initialize it again.":

    https://tinyurl.com/objc-object-init

And as observed in QTBUG-112899, the additional initialization
resulted in a memory leak.

The other part of 4bee9cdc0a
was that we now called startTrackingAt twice when drawing.
Both from setupSlider, for all consumers, and from
drawComplexControl, and as it turns out, this is the key
thing that "fixes" the pressed knob drawing of NSSlider.

For some reason, NSSlider needs the duplicate startTrackingAt
call both to draw the knob as pressed, and to not let one
drawing pass affect another drawing pass. This would benefit
from further investigation, but for now the removed leak
is an improvement.

Fixes: QTBUG-112899
Task-number: QTBUG-98093
Pick-to: 6.5
Change-Id: Ia7e6ef963910f1858d2fdb10e0323fc5bb3b2eda
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-27 14:30:42 +02:00
Fabian Kosmale
c81e8f8ff2 QVariant: Add support for in-place construction
This avoids constructing an object just to copy (later: move) it into a
QVariant.
ChangeLog will be in a follow-up change adding emplace support.

Task-number: QTBUG-112187
Change-Id: I444e580c7d8927d41b3d21d5a521e7c475119e4c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-27 13:54:59 +02:00
Andreas Eliasson
6e5258b48b Doc: Fix return value for Q_ARG and Q_RETURN_ARG
The macros no longer return QGenericArgument and QGenericReturnArgument
objects. As of 6.5, they return QMetaMethodArgument and
QMetaMethodReturnArgument, respectively.

Fixes: QTBUG-113147
Pick-to: 6.5
Change-Id: I06e0cf8255e6d4fee43048850f1717b1740d4846
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-27 08:44:43 +02:00
Mitch Curtis
2cd7e34fa0 Add more shortcutmap categorized logging output
Show more detail about the checks made against each entry to show why
a shortcut might not get delivered. Specifically, it's useful to know
if the contextMatcher returned true. In the case of Qt Quick Controls,
it can return false if the Shortcut is blocked by a modal popup, or
a popup with a CloseOnEscape policy.

With this patch, combining qt.gui.shortcutmap with
qt.quick.controls.shortcutcontext.matcher makes it possible to see
which popup blocks a shortcut. With only the former enabled, it's
already quite useful:

qt.gui.shortcutmap: Possible shortcut key sequences: QList(QKeySequence("Ctrl+N"))
qt.gui.shortcutmap: - checking entry 0 QKeySequence("Ctrl+N")
qt.gui.shortcutmap:   - matches returned 2 for QKeySequence("Ctrl+N") QKeySequence("Ctrl+N") - correctContext()? false
qt.gui.shortcutmap:   - matches returned 0 for QKeySequence("Ctrl+N") QKeySequence("Ctrl+O") - correctContext()? false
qt.gui.shortcutmap: Found better match ( QList(QKeySequence("Ctrl+N")) ), clearing key sequence list
qt.gui.shortcutmap: Added ok key sequence QList(QKeySequence("Ctrl+N"))
qt.gui.shortcutmap: Returning shortcut match ==  0
qt.gui.shortcutmap: QShortcutMap::nextState(QKeyEvent(ShortcutOverride, Key_N, ControlModifier, text="N")) = 0

Change-Id: I6e96c94a8b62823553837eda3ef2764ca21775c4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-27 09:38:15 +08:00
Thiago Macieira
4ff074a67e QApplicationStatic: document the thread-safety guarantees
Change-Id: Idd5e1bb52be047d7b4fffffd17531331df25c18c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 20:40:32 -03:00
Thiago Macieira
af95ec4b7b QApplicationStatic: enforce acquire-release semantics on creation
On systems with weak memory ordering, it was possible for the
storeRelaxed(Initialized) to be observed by another thread performing a
loadRelaxed() without observing the contents of the object itself. The
mutex *does* release the contents of the object to memory, but without
the corresponding mutex acquisition, we couldn't guarantee that the
object's contents would be observed. Now we can.

We don't need to fix the load inside the mutex because the mutex will
have acquired everything from either a previous call to pointer() or to
reset(). The store inside reset() need not be storeRelease() either
because the effect of observing the Uninitialized state will be to lock
the mutex.

None of this is used to protect the data as it is being mutated by the
user in multiple threads, or their access simultaneously with reset()
(which is why the load outside the mutex was removed).

Thanks to litb on Slack for noticing this and bringing to my attention.

Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd1752df5b4d9b2e3f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 16:40:31 -07:00
Volker Hilsheimer
207aae5560 Simplify the creation of APIs that take a callback
Functions in Qt that take a callback need to support callables with or
without context objects, and member functions of an object. The
implementation of those overloads follows a pattern that ultimately
results in a QSlotObjectBase implementation being created and
passed to an implementation helper that takes care of the logic.

Factor that common pattern into a new helper template in QtPrivate
that returns a suitable QSlotObjectBase after checking that the
functor is compatible with the specified argument types.

Use that new helper template in the implementation of
QCoreApplication::requestPermission and QHostInfo::lookupHost.

The only disadvantage of centralizing this logic is that we cannot print
a more detailed error message indicating which argument types the
caller expects. However, that information is visible from the detailed
compiler errors anyway.

Change-Id: I24cf0b2442217857b96ffc4d2d6c997c4fae34e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 22:06:31 +02:00
Christian Ehrlicher
1f27dc6871 QSqlField: add move ctor & move operator
Add the move ctor and move operator for QSqlField

Task-number: QTBUG-109938
Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 19:56:07 +00:00
Christian Ehrlicher
204f1764ca QSqlRecord: use QSharedData for private class
Use QSharedData for the private class instead a home-brew version.

Change-Id: Id3625bb0eb8f81c9caa672e2453dab3d44b15ea9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 19:56:07 +00:00
Edward Welbourne
f291575d95 Relocate two helpers from QLocalTime to an anonymous namespace
When I broke them out from functions in the QLocalTime namespace I
didn't notice that's where I was putting them; they don't belong
there.

Change-Id: If4c9d996b3e46b3b46a29a97d0bcc2cac72c91ab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 21:11:01 +02:00
Joerg Bornemann
aad3b1f063 CMake: Fully rebuild dirty configure-time executables
Problem: "ninja clean" does not fully clean the build directories of
configure-time executables (e.g. syncqt). This can lead to problems when
building with compiler and linker launchers: on configure time, the
launchers are not used (compare CMake issue #20762). After a "ninja
clean", the executable might be removed but the object files are still
there. This leads to a situation where the object files have been
created without the compiler launcher but are linked with the linker
launcher. We encountered a situation however, where the linker launcher
requires the usage of the compiler launcher.

The configure-time executable has a ${target}_build custom command that
runs "cmake --build" and creates a timestamp file to track when to build
the target. To circumvent the problem of stale object files we add the
"--clean-first" argument to that target to fully rebuild configure-time
executables if the timestamp file is out of date.

The performance this imposes is negligible, because
1. Those configure-time executables are seldom out of date.
2. They are supposed to be "tiny executables with system dependencies
only" anyway.

Pick-to: 6.5
Change-Id: I701f9089f5ad941ffdf235aeccc3119b68c4e3e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-26 20:09:38 +02:00
Alexey Edelev
be4de03b37 Add message if syncqt is crashed without any output
If syncqt process crashed due to the incompatibility with the standard
library CMake doesn't produce any useful output. This adds the message
that will give short explanation and possible solutions to fix this
behavior.

Pick-to: 6.5
Task-number: QTBUG-112747
Change-Id: Ib51aec19e3fcacf07515a3d20d72f89753bcdc33
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 20:00:33 +02:00
Ivan Solovev
5ddb5d1fee Rework imagescaling example to avoid potential crashes
Creating a continuation with QtFuture::Launch::Async policy does not
work well with the example, because it still needs to update the UI
once the async continuation is finished. If the user decides to
close the application while the async continuation is executed,
the next continuation will be accessing data from the destroyed
Images object.

Fix it by using QtConcurrent::run() to do the "heavy" work in a
separate thread, and use a QFutureWatcher to handle the results of
the async execution. Update the example documentation accordingly.

After this patch the example still shows the usage of continuations
and onCanceled()/onFailed() handlers. However, it now does not
illustrate the usage of different launch policies and continuation
contexts. It might not be a big issue, because the QFuture
documentation describes these topics rather extensively.

Fixes: QTBUG-103514
Pick-to: 6.5
Change-Id: I8142535064ff7a4e8007a5c0a8fe7709d6d942ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-04-26 19:27:30 +02:00
Leena Miettinen
3abfd4aa7c Doc: Use qt_add_executable() not add_executable() in snippets
Changes code snippets that are visible in the docs.

Task-number: QTBUG-113116
Pick-to: 6.5
Change-Id: If743234bfe6947acf02307bf1144daad4fba5d73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 17:25:50 +02:00
Kai Köhne
e51274d8c3 Fix license info for import shell scripts
Use SPDX-License-Identifier also for shell scripts. Also change
license to LicenseRef-Qt-Commercial OR GPL-3.0-only, which makes
arguably more sense than LGPL.

Pick-to: 6.5
Change-Id: I3a46468f264747916aacbf206f5ccba28b6c6593
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 16:36:18 +02:00
Kai Köhne
576c29df83 Clarify license of SHA-1 algorithm
SPDX/reuse does not feature any generic 'public domain' license
identifier. So far we claimed CC0, which is however not entirely correct.
Now that we have LICENSES directory, let's correctly claim this as
a specific license.

Also, remove the LGPL in-code claim. The adaptations for Qt code is
minor so it doesn't make much sense to claim a different license.

Pick-to: 6.5
Change-Id: I4e943a45baae192b54c38184e8eb85fc6d4035e5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-26 16:36:18 +02:00
Bartlomiej Moskal
c27d5eca6a Android-example: add missing properties in AndroidManifest.xml
After changing android target SDK version to 31, some missing values has
to be defined in AndroidManifest.xml.

AndroidManifest.xml template was updated in qtbase in:
56dee3de5e commit. In case when example
uses its own AndroidManifest.xml file, it need to be updated separately.

* android:exported="true": because the manifest sets an intent-filter,
and it then has to explicitly to avoid the warning [1].
* android:allowBackup="true": this has to be explicitly set, we set it
to the default value here [2].
* android:fullBackupOnly="false": SDK 23+ use this to deteremine to
user auto backup or not, we set it to the default value here [3].

[1] https://developer.android.com/guide/topics/manifest/activity-
element#exported
[2] https://developer.android.com/guide/topics/manifest/application-
element#allowbackup
[3] https://developer.android.com/guide/topics/manifest/application-
element#fullBackupOnly

Fixes: QTBUG-112816
Pick-to: 6.5 6.2 5.15
Change-Id: Ia48007a84009901be508d6cc087790d574227ad7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-04-26 13:47:43 +00:00
Laszlo Agocs
d587d3fecd rhi: Improve deferred delete docs
Change-Id: I533e44d73ad1aebf72ef2e28c90c51f5effb8977
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 15:47:43 +02:00
Dmitry Shachnev
dca0304c26 Fix capitalization error in auto-generated qdbusmacros.h include
https://bugs.launchpad.net/bugs/2016703

Pick-to: 6.5 6.2 5.15
Change-Id: I521c7b66d6c1c27ea790f0564b175cccb0027802
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-26 13:47:43 +00:00
Volker Hilsheimer
ca15f650a1 QTabBar: don't scroll when laying out the tabs
QTabBar lays out the tabs when the bar's size or content changes,
often lazily. This should not change the scroll offset of the tabbar,
which is controlled by the user, or at most when a tab needs to be made
visible (e.g. when it becomes the current tab).

Move the logic of updating the scoll offset into the makeVisible
function, so that the scroll is only adjusted to either leave no gap
between the last tab and the right edge of the widget of there is still
a scroll; or to reset it to 0 if there is enough space for the entire
tab bar. Since layoutTabs does show and hide the scroll buttons, we
cannot skip this when the buttons are invisible. However, the
normalizedScrollRect helper now needs to return the entire widget rect
if there are no visible scroll buttons.

Add a test case that simulates the previously broken behavior where
the scroll got unnecessarily reset to 0 when resizing.

Fixes: QTBUG-113140
Pick-to: 6.5
Change-Id: Ic19fbb82821ea09cc5e7646dcbce3aa7607909c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-04-26 12:50:49 +02:00
Ivan Solovev
0198a74b72 QBluetoothPermission: introduce fine-grained permissions
This commit introduces fine-grained Bluetooth permissions control to
the QBluetoothPermission class.
For now the fine-tuning of the permissions is only supported on
Android. On Apple enabling any of the permissions is equivalent to
requesting full Bluetooth control.

Task-number: QTBUG-109964
Change-Id: Ie7ac6577cf6a21419b73b33f8cf7e87bc3f8cf43
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-26 12:46:06 +02:00
Antti Määttä
346dcc696b Create unique names for QSize and QRect types for lttng
Task-number: QTBUG-113161
Pick-to: 6.5
Change-Id: Icc47af16b73dd9ad4e203c3bd55833587435be5c
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 13:46:06 +03:00
Antti Määttä
bb8aada627 Fix crash at exit when tracing
The crash is caused by the cleanup sending trace messages when the
plugin has already been destroyed. Add shutdown callback to the plugin
to indicate this has happened. We can't use signals since that also
generetes trace event.

Pick-to: 6.5
Change-Id: I2e490fc51c2aaa97c240c1496a528a6ff6077bd0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 10:46:06 +00:00
Antti Määttä
257b3161c5 tracegen: Add common prologue
Add common prologue and add error message when tracing is used in a
module that doesn't have Q_TRACEPOINT enabled, but tracing is enabled.

Pick-to: 6.5
Change-Id: I64ca074942f6e89b4f5b5e3b6048b2b713c06df8
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 13:46:06 +03:00
Axel Spoerl
55a51e1909 Implement QXmlStreamReader::hasStandaloneDeclaration()
This patch implements a public getter for the hasStandalone attribute.
It returns true, if standalone has been explicitly declared in an XML
header and false otherwise.

As this is no longer necessary it removes accessing QXmlStreamPrivate
from QDomParser.

[ChangeLog][QtCore][QXmlStreamReader] added hasStandaloneDeclaration()

Change-Id: Iaaa0a728a6f7186e40637186077f7b49c112f7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
2023-04-26 12:46:06 +02:00
Marc Mutz
b85a9d0ee1 Move QZipReader/Writer from QtGui to QtCore
These classes depend only on Core, not Gui.

This allows dropping the dependency of tst_qxmlstream and tst_qzip on
QtGui, and prevents a tst_qxmlstream FTBFS when building with
QT_NO_TEXTODFWRITER.

Symbols move from QtGui to QtCore, but the classes are private API, so
not under BC constraints.

The classes are not used outside qtbase, so no other in-tree users
need porting.

Task-number: QTBUG-3897
Change-Id: Ifa148f43ec139d7f9ac1f3893e2fcf4640e3c60c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-26 12:01:05 +02:00
Thiago Macieira
cd800da526 QString::insert: replace duplicated code with a recursion
Just call itself after copying the buffer, thus avoiding instantiating
insert_helper() for QVarLengthArray.

The other two cases of QtPrivate::q_points_into_range + QVLA in
qstring.cpp are not worth changing.

Change-Id: I9671dee8ceb64aa9b9cafffd1742fa7bb4cbebd8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 07:55:47 +00:00
Thiago Macieira
b9394b48c1 tst_QCoreApplication: ensure that theMainThread has expected states
The expected states are:
- nothing sets theMainThread before main()
- theMainThread is reset when the last QObject (the QCoreApplication in
  the test) is destroyed

The GUI version of this test appears to leak a lot of QObjects. By the
time this function runs, theMainThread's QThreadData still has a
refcount of 66 on Linux/XCB. The Windows non-GUI version also
failed. Neither situation was investigated to see why objects are
getting leaked.

Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17507d9e6ef08743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-26 04:55:47 -03:00
Yuhang Zhao
ebd27ff654 windeployqt: improve debug detection
MSVC binaries can also be stripped and according to my
experiments they still work normally. So we should not
limit this check to MinGW only.

Change-Id: I026d75a38b94f309ad695cf8f700ed3ac160dd87
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-04-26 02:21:08 +00:00
Thiago Macieira
6e99922234 tst_QProcess: don't link non-Qt helpers to QtCore
Change-Id: Icfe44ecf285a480fafe4fffd174d481f5e548c7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-25 18:53:30 -07:00
Thiago Macieira
956b249528 QProcess/Unix: don't overwrite openChannels() error message
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d0fa4701b0076
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-25 21:53:30 -04:00
Thiago Macieira
67431e4168 QMutex/Unix: remove the pthread_mutex_t-based content
For our purposes, the sem_t code is better, so we've preferred it since
commit c7ab816af1 (5.7). Olivier wrote in
that commit's message, "It makes tst_QMutex::contendedQMutex with no
msleep 8 times faster".

That's true because QMutex didn't lock the underlying pthread_mutex_t in
QMutex::lock(), as we used the inlined atomic code for the uncontended
case.

It is probably possible to merge the qmutex_mac.cpp and qmutex_unix.cpp
code now (both are based on semaphores), but I won't do that for two
reasons:
 1) At best, the PThread functions are going to be thin-wrappers around
    the code we already have, like FreeBSD's are around usem (see [1])
 2) Darwin has a private API that resembles futexes so we may want to
    go that way eventually (see [2])

[1] https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/sem_new.c
[2] https://codereview.qt-project.org/335849

Change-Id: Idd5e1bb52be047d7b4fffffd175369b13ba47bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-25 18:53:30 -07:00
Mårten Nordheim
825a37da66 tst_QSslCertificate: Make it easier to check which backend is used
Instead of having one member signaling !openssl
let's just add booleans for openssl, schannel and securetransport.
The latter two of which are not currently used but may be in the future.

As a drive-by, make a compile-time check into a runtime one.

Change-Id: Id2f51f5396383a3f5836ac708996bfce8ae35c91
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-25 23:39:24 +02:00
Morten Sørvig
15dab565d0 wasm: rework local font support
Populate a subset of the font families at startup if the local fonts
access API is supported, and the access permission has been given.

Since this code runs at app startup there is no opportunity to request
font access. That should be done in response to user action, for
example by having a "load local fonts" button in the application.

Pick-to: 6.5
Change-Id: Ib6826deeec06ee3def0e793dd1462977710462be
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
2023-04-25 21:38:08 +00:00
Hatem ElKharashy
c10c66e552 Support float_type arrays when using lttng
lttng ctf_array does not support float types which
causes compilation error when a float type is passed
to the function. A solution is to pass the array
elements one by one to TP_FIELDS.

Fixes: QTBUG-112761
Pick-to: 6.5
Change-Id: I30e7049d9eda1141298145897df372213145c1b4
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-25 20:57:43 +00:00
Timothée Keller
21e4116874 Windows QPA: Fix restore geometry after dragging from maximised
Start tracking the window geometry before a mouse drag, so that we can
revert back to that geometry when we restore from maximised. Previously,
when dragging from maximised to maximised, the restore geometry would
end up being the final drag place before snapping to maximised, instead
of where the window was before the first maximised.

Fixes: QTBUG-112814
Pick-to: 6.5 6.2
Change-Id: Ic2ddf29d6c4abdc9e8b0c5161b17aa6ee9474ea3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-25 22:57:43 +02:00
Amir Masoud Abdol
eec5a016d3 Remove an unnecessary None definition
We should be able to just pass `0L` and avoid defining a None macro.

Pick-to: 6.5
Change-Id: I513d726120454523627a1e66515a5a533c0238b1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-25 22:57:42 +02:00
Mikolaj Boc
07a736db6a Remove FileReader callbacks before assigning new ones
This fixes the assert raised on overwriting event handlers

Fixes: QTBUG-113041
Change-Id: Ie2afe09f4111ea542297b82a51382f1eb04ec960
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
2023-04-25 22:57:42 +02:00