Commit Graph

46261 Commits

Author SHA1 Message Date
Axel Spoerl
efc4bf5e63 QDockArealLayoutItem: recurse subinfo in QDebug operator<<
A subinfo has its own item list. Recurse into it when debugging.

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

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

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

Fixes: QTBUG-115058
Pick-to: 6.6 6.5 6.2
Change-Id: Ifb8e2450e91a7c78decc06f592e160631ca2faf5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-15 10:47:28 +02:00
Axel Spoerl
ccd8a496cf QXmlStreamReader::readNextStartElement() - return false on document end
The method reads the next element in a loop, as long as valid elements
exist. Within the loop, it returns
- false if the end of an element has been reached
- true if a new element has started

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Found in API review.

Pick-to: 6.6
Change-Id: I7faafd3ebf522fb2b0e450112fb95d643fece5ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-14 20:13:54 +00:00
Marc Mutz
5d8db914c9 QHostInfo: port lookupHostImpl() to SlotObjUniquePtr internally
Avoids the manual deref'ing.

Pick-to: 6.6 6.5
Change-Id: I1a51a468dfa704986f050b29322a424dc6fcd7b7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-14 21:30:44 +02:00
Axel Spoerl
4c7cac682f QPlainTextEdit: update placeholder text when document is empty
When the placeholder text is changed after having been displayed, it
doesn't get updated on the screen any more, unless the entire viewport
is updated, e.g. because of a document change or a focus event.

This patch simplifies QPlainTextEditPrivate::updatePlaceHolderVisibility()
to update the visibility if the text document is empty.
It replaces the member QPlainTextEditorPrivate::placeholderVisible
by the function isPlaceHolderTextVisible(). It returns true, if the
document is empty and a placeholder text exists, and otherwise false.
It adapts and corrects tst_QPlainTextEdit::placeHolderVisibility():
- usage of new member function instead of data member.
- do not expect an empty placeholder to be visible.

Fixes: QTBUG-115831
Pick-to: 6.6 6.5 6.2
Change-Id: Ic4427ce7f7f1b8cde89957b9de0b978bd34ba923
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-08-14 17:11:27 +00:00
Alexey Edelev
0e3815a7a8 Fix the android paths check
Expand the prop_name.

Amends 575b8a7fa2

Fixes: QTBUG-116007
Task-number: QTBUG-115119
Pick-to: 6.6
Change-Id: I66537a6dbb97c89fdff1f721d091eae1d02907e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-14 18:05:43 +02:00
Eirik Aavitsland
3cc693d256 Revert "Add QBezier methods for computing a quadratic curves approximation"
Were added for 6.6, but turns out they were not quite ready, and also
live better together with the quadpath class in the curve renderer.
This reverts commit aaccd50224.

Pick-to: 6.6
Change-Id: I58399f8e280d5353cb9c3102e8a8e15dcfa4484a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-08-14 18:05:43 +02:00
Eirik Aavitsland
f8f23c43fe Avoid compiler warning
Under some configure options, gcc13 emits an intractable warning on
this line. This patch works around it.

Fixes: QTBUG-115809
Pick-to: 6.6 6.5 6.2
Change-Id: Ib63f2ad81ebdb1f609a7f42c25119c5ae29f08bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-08-14 18:05:43 +02:00
Timothée Keller
f56fc425f9 Windows QPA: also consider child windows for setting WS_EX_LAYERED
Child windows on Windows cannot have a frame, so checking only for
Qt::FramelessWindowHint is not sufficient. Add an additional check
to see if the window is a native child (has the WS_CHILD flag).

Pick-to: 6.6 6.5
Change-Id: Ib5cbec0f6157da687a5585e12a6c4c6935919538
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-14 18:05:43 +02:00
Mårten Nordheim
2f839a55ed QRhi[d3d]: fix missing include compile error
Presumably it passes elsewhere due to pch or unity builds

Pick-to: 6.6
Change-Id: I69b52751765b12d2d4dd701c2e022c9014d6c16f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-08-14 15:05:36 +00:00
Axel Spoerl
e66cbdf684 Harden QMenuPrivate::hideMenu() against menu argument becoming stale
QMenuPrivate::hideMenu() hides a menu and reposts events in case a new
action has become the active one. For that purpose, it waits 20ms and
60ms for visual effects to be rendered.
If the last action has been triggered, the menu's deleteLater slot has
been called before hideMenu(). In that case, it gets deleted while
events are processed during the waiting periods.
Subsequently, menu becomes stale.

This patch replaces the QMenu * argument with a QPointer. Early returns
are inserted after waiting. QSignalBlocker is replaced by manual signal
blocking, to prevent the signal blocker from recovering the state of a
stale object, when it goes out of scope.

An auto test is not added: The error scenario occurs, when a menu is
triggered by keyboard input, while a mouse event is sent to the main
window from outside the menu. Such a test scenario is complex to match
and exposed to flakiness.

Fixes: QTBUG-115597
Pick-to: 6.6 6.5 6.2
Change-Id: I4f937fe66fb1b5cf78ebee70fd0006712172cb12
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-14 17:05:36 +02:00
Laszlo Agocs
0270543514 rhi: Expand lastCompletedGpuTime docs
Change-Id: Ic66796a5be2dc5c8feca504e68ede2046491bd76
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-08-14 17:05:36 +02:00
Laszlo Agocs
4580003341 rhi: gl: Implement lastCompletedGpuTime()
Only for OpenGL 3.3+ (not ES).

Change-Id: I016ba934d7f5038b3d56f8d0c62e72b3921d86c6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-08-14 17:05:36 +02:00
Laszlo Agocs
72a453c6a8 Add QRhiWidget
Task-number: QTBUG-113331
Change-Id: I8baa697b4997b05f52acdee0e08d3c368fde5bc2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-08-14 17:05:36 +02:00
Mate Barany
85e2f79e9e Make QNetworkInformation thread safe
The current implementation is not thread safe - it is possible
to update and query the network information without any locking.

Protect the internals of the backend with a lock and move the
object to the main thread.

Task-number: QTBUG-115748
Change-Id: I9511fc3522ae82cffca42abc54eb79cb156397c4
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-08-14 16:24:46 +02:00
Axel Spoerl
be3b9b2ab1 QAndroidPlatformInputContext: send composition text and cursor jointly
QAndroidPlatformInputContext::focusObjectStopComposing() sends an input
event for each character newly added by the Android virtual keyboard.
It then sends a second input event to notify that the cursor has
advanced to the position after the new character.
The implicit assumption is, that the receiver of the input event does
not change the text.

If e.g. QLineEdit::setText() is called in the QLineEdit::textEdited
slot, the text does change. If the change implies a cursor change,
QLineEdit notifies the platform input context about it.
However, by sending the second input event, QAndroidPlatformContent
returns the cursor back to the position after the last character added
by the virtual keyboard.

This patch joins the composed text and the cursor position into one
single input method event. A new cursor position, set by the receiver
of the input method event, is no longer overridden.
The patch adds test functionality to tst_QLineEdit::setText().

Fixes: QTBUG-115756
Pick-to: 6.6 6.5 6.2
Change-Id: I85ffac5d6bab93ccb144be0f5b8083258a270550
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-14 16:24:45 +02:00
Piotr Wierciński
592f8630c6 CI: Enable tests under corelib/serialization for Wasm platform
Add more tests on WebAssembly platform for better tests coverage.

Change-Id: Iaaaa824ae6058a9ae5dba4c4038a7f687bfc17e0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-08-14 16:08:32 +02:00
Fabian Kosmale
8eca7fffa3 Modernize snippet
It referenced QDeclarativeComponent, which has been gone for a very long
time. Also replace the foreach with a proper for loop.

Change-Id: I7f30ca10a235137dbdf34b7684e2c38610242b17
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-08-14 12:05:32 +00:00
Alexandru Croitor
47b879aa0b CMake: Place resources into static libraries, not object libraries
Take 2.
Re-land previously reverted commit, due to not handling resource names
that are not valid c++ identifiers. Now we sanitize the resource names
just like rcc does by replacing non-alphanumeric characters with
underscores.

Original commit message.

During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.

This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.

It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.

We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.

This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.

To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.

It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.

For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.

The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.

A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.

This reverts commit bc88bb34ca.

Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: Idce69db0cf79d3e32916750bfa61774ced977a7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-14 14:05:32 +02:00
Marc Mutz
574aa256cf Mark QNX plugin as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses is high here, too high for this author
to tackle in a short amount of time. But they're concentrated in just
a few TUs, so pick a different strategy:

Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. Since the TUs are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too).

Task-number: QTBUG-115839
Change-Id: I42c26cb5d95add115e57cc484a0e1a93ed368ddd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2023-08-12 22:03:19 +02:00
Jøger Hansegård
73fd7f2d4a Fix key truncation logic for Windows QSystemSemaphore::platformSafeKey
The QSystemSemaphore::platformSafeKey was intended to truncate oversized
keys on Windows, but didn't. The fix is to make sure MAX_PATH is defined
when compiling on Windows.

Change-Id: I03f3bee901203d901bda05a841451c8a2d2f3924
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-12 01:28:49 +02:00
Ievgenii Meshcheriakov
8a3330be38 Revert "QDbus: Avoid memory leak in registerComplexDBusType"
This reverts commit 4c1df115ec.

We cannot guarantee that there are no more QMetaType
instances that reference the interfaces being destroyed.
All such instances will become invalid after the interface
destruction with no way to verify that.

Pick-to: 6.6 6.5
Change-Id: Iad17fe88753143734b8b817dda184e3c3818575c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 22:30:30 +02:00
Ievgenii Meshcheriakov
df485fff26 QDBusMetaType: Check that Q_GLOBAL_STATIC is not destroyed before using it
Combine the lock and the custom types list into one struct
so that the check code does not have to be duplicated.

Pick-to: 6.6
Task-number: QTBUG-58732
Change-Id: Ib61d5be3a3cb6465acc5834e5dcbc735fb8b4d8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-11 22:30:00 +02:00
Axel Spoerl
a27cc5d727 Pull QWidget::setTabOrder(std::initializer_list...) behind ABI boundary
Found in API-review.

Pick-to: 6.6
Change-Id: I261aa450d25288e7a3e8caa033ce5000e5dd77f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-11 18:54:03 +00:00
Edward Welbourne
ffaa1281d4 Clear the _X version of alongside the enum deprecator
When QT_NO_DEPRECATED_WARNINGS is defined, we undefine
Q_DECL_ENUMERATOR_DEPRECATED as it's used raw (rather than via an
intermediary or version-variant). The same is true of its _X()
variant, so do the same for this - which involves redefining it to a
still function-like macro, so that its parameter gets ignored.

This amends commit 59b03992ab (and shall
get conflicts on older branches, before the defines in question moved
to qtdeprecationmarkers.h in 6.5).

Pick-to: 5.15 6.2 6.5 6.6
Change-Id: If85c135cddbb33e93cb90f400af123c74e0298ac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-11 19:01:56 +02:00
Ahmad Samir
b67ebbe3a0 Remove redundant qelapsedtimer.h #includeS
Change-Id: I0b7c861d87d15a498ee3203ee6e5aca0380c6d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 16:45:53 +03:00
Ahmad Samir
c4865c3596 QEventDispatcherUNIX: clarify some code with a comment
Change-Id: I8bb6c39f4764b530a407ad6d68bf09bb8742ac4c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 16:45:49 +03:00
Ievgenii Meshcheriakov
90e0c6693b QtDBus: Remove assertion inside qDBusAddTimeout()
The assertion is triggered when a timer cannot be started. This
is normal occurrence when an application exits before all pending
D-Bus calls are processed. And there is a code handling such failure
in the same function. Qt also prints a warning message in this
case:

    QEventDispatcherGlib::registerTimer: invalid arguments

Task-number: QTBUG-58732
Pick-to: 6.6
Change-Id: I37859443fa90ae1bf7da1572ac9b02a54c8e1b99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 15:45:45 +02:00
Ievgenii Meshcheriakov
86d801e352 Q_APPLICATION_STATIC: Assert existence of a QCoreApplication instance
Add asserting verifying that a QCoreApplication exists when
the application static variable is dereferenced. This is a
requirement described in the documentation. Added assertion
makes invalid use much more visible. Without the assertion
only a message about invalid nullptr used with QObject::connect()
is emitted. This message is much less informative and does
not cause tests to fail.

Pick-to: 6.6
Change-Id: Id9d4a34679ca5aca93ee45ca2318d4ccf849887b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-11 15:45:32 +02:00
Ahmad Samir
3ca6e7e6c7 QTimerInfoList: change timerWait() to return std::optional<ms>
QEventDispatcherGlib: it used the out-parameter timespec to set a
timeout in milliseconds, making timerWait() return milliseconds is more
straightforward. Also timerWait() returns the time rounded to
milliseconds, so the code in QEventDispatcherGlib that rounded up the
timespec::tv_nsec part was no-op, tv_nsec was always 0 IIUC.

In QEventDispatcherGlib, guard against overflow with qt_saturate.

Change-Id: Ie6f78374d00cbe8a6adf7b50ed67c8c86ab4d29d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 16:45:28 +03:00
Ahmad Samir
99c6190bdf QGestureManager: prevent double-lookup in a QHash
First lookup with value(key), second lookup with remove(key). Use
constFind() to get an iterator and use that instead.

Pick-to: 6.6 6.5
Change-Id: Idce585ad2269be91eda0381aeb2f2d164033f71f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 16:45:24 +03:00
Ievgenii Meshcheriakov
52a464bad0 QtDBus: Encapsulate hooks addition and invocation into QDBusSpyHookList
This makes the rest of the code slightly cleaner.

Change-Id: I67606b369f00d54fc24f7d6f41c004a728d37b5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 15:45:18 +02:00
Ievgenii Meshcheriakov
50aba545ff QtDBus: Make access to spy hook list thread safe
Introduce a mutex that protects access to the spy hooks list.

Also don't pass around raw pointers to the spy hook list,
those can change when new hooks are added and storage is
reallocated. Change the type of the hooks list to QList
to take advantage of copy-on-write in common case.

Check whether the global static is destroyed in qDBusAddSpyHook().

Change-Id: I440a88ce088d6fb5817660c8e1e02901281b842f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 15:45:14 +02:00
Dennis Oberst
3c38efbfe4 QByteArray: use new assign() in operator=(const char *)
operator=(~) and assign(~) share similar names but, until now, have not
shared the same functionality. This patch introduces the usage of
QByteArray::assign() within the non-sharing assignment operator to
effectively boost efficiency by reusing the available capacity.

Since these assignment operators are frequently used in many places,
both within Qt and non-Qt code, this patch comes with benchmarks.

The preview of the benchmark results are compared with this patch and
before this patch. The findings indicate a slight enhancement in
performance associated with the assignment operator. Despite the results
displaying only a minor improvement, progress has been made. Therefore
use assign(QByteArrayView) as replacement.

(x86_64-little_endian-lp64 shared (dynamic) release build (O3); by
gcc 13.2.1, endeavouros ; 13th Gen Intel(R) Core(TM) i9-13900K

benchmarks executed with -perf -iterations 1000000

  * The last value at the EOL represent the string size.

QByteArray &operator=(const char *ch) (current)
  65    cycles/iter; 317  instructions/iter; 16.0 nsec/iter (5)
  71.7  cycles/iter; 383  instructions/iter; 13.0 nsec/iter (10)
  59.8  cycles/iter; 318  instructions/iter; 10.9 nsec/iter (20)
  70.8  cycles/iter; 340  instructions/iter; 12.9 nsec/iter (50)
  80.2  cycles/iter; 419  instructions/iter; 14.6 nsec/iter (100)
  164.2 cycles/iter; 899  instructions/iter; 29.9 nsec/iter (500)
  260.5 cycles/iter; 1522 instructions/iter; 45.6 nsec/iter (1'000)

QByteArray &operator=(const char *ch) (before)
  66.8  cycles/iter; 317  instructions/iter; 16.9 nsec/iter (5)
  76.5  cycles/iter; 383  instructions/iter; 13.9 nsec/iter (10)
  63.7  cycles/iter; 318  instructions/iter; 11.6 nsec/iter (20)
  71.6  cycles/iter; 344  instructions/iter; 13.0 nsec/iter (50)
  77.5  cycles/iter; 419  instructions/iter; 14.1 nsec/iter (100)
  143.4 cycles/iter; 893  instructions/iter; 26.1 nsec/iter (500)
  270.8 cycles/iter; 1516 instructions/iter; 48.2 nsec/iter (1'000)

Task-number: QTBUG-106201
Change-Id: I0745c33f0f61f1d844a60960cc55f565320d5945
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 14:11:44 +02:00
Marc Mutz
70835a9335 QUuid: add a named fromUInt128() ctor
This makes the API symmetric again (fromBytes()/toBytes(),
fromString()/toString(), fromUInt128()/toUInt128()), but also gives us
the option to remove the QUuid(quint128), should we so choose, because
of its overly-broad argument matching range.

Found in API review.

Pick-to: 6.6
Change-Id: I91bd2450d62ed565ec3b8e46c875f4983bd9dc73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 13:08:52 +02:00
Marc Mutz
7bbd707299 QUuid: make (quint128) ctor explicit
It matches any integral type, any unscoped enum and any FP type, so we
can't allow it to be implicit. In fact, it's probably better to only
have a named contructor, fromUint128().

Found in API review.

Pick-to: 6.6
Change-Id: I9b250e0b5e74a449b6df4efe3ea38b750c9744ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-11 11:08:52 +00:00
Olivier De Cannière
6987aab2ab CompilerDetection: Define Q_UNREACHABLE_RETURN for MSVC
MSVC seems to emit warnings failing the build in some situations where a
return statement comes after a Q_UNREACHABLE. This does not seem to
happen on other compilers. The Q_UNREACHABLE_RETURN macro already exists to deal with this situation. Define it for MSVC.

Change-Id: Iad06f4048e2829b1eac4f78a1053041ef72c21e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-08-11 09:57:28 +00:00
Shreya Pattani
e3925996f1 Add description to the HTML tags using aria-description
Description added to the html tags for accessibility in wasm through the
aria-description property

Change-Id: Ic1976d5c4c64ea45298f24b660807adeda6fdb64
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-11 10:19:17 +05:30
Marc Mutz
4cf51f4616 QHostInfo: use new QMetaCallEvent::create() overload
Move the SlotObjUniquePtr directly into the QMetaCallEvent, without
having to up and down the ref-count.

Pick-to: 6.6 6.5
Change-Id: I029f71c60defce71ac8778547efe999ce0cf7b4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-10 21:50:59 +02:00
Ievgenii Meshcheriakov
9fb3bd05a8 QDBus: Make QObject * argument to generateSubObjectXml() const
Only const members of the object are used inside the function body.

This addresses a review comment for 0f37c47713

Change-Id: I873d87104eb2483c4388929487d750d4a7d44bf3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-10 19:45:51 +02:00
Ievgenii Meshcheriakov
31e414d36e Q_GLOBAL_STATIC: Use Q_FUNC_INFO for assertion contexts
Using Q_FUNC_INFO has an advantage that at least GCC includes
the variable type and name into the string. This makes it much
easier to understand access to which global static is causing
an assertion.

Pick-to: 6.6
Change-Id: Ie6ce992921c0969df262fed22024a22650783f93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-10 19:45:51 +02:00
Axel Spoerl
214016835f QPlainTextEdit: clean up private slot definitions
Private slots connections have been migrated to QObjectPrivate::connect
by 2f3f3eb0d4.

Remove redundant _q_ prefix and Q_PRIVATE_SLOT declarations.

Pick-to: 6.6 6.5
Change-Id: I74075e6a822ecd5b2861aee29a65a5c93e6472a8
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-08-10 18:54:05 +02:00
Tero Heikkinen
de94265169 Add QEXPECT_FAIL to tst_QApplication::sendEventsOnProcessEvents
Test sendEventsOnProcessEvents has been noticed to fail when
qgtk3 (Glib) is loaded - Should be fixed in QTBUG-87137

Moving test from blacklist to use QEXPECT_FAIL as it's more
recommended until test is fixed in the relevant configurations.

QEXPECT_FAIL is selected to use as original investigator
reported also some cases when glib is working. Therefore
this approach is giving us more insight for further
investigation is it always failing with glib or not.

It was also reported linkage to zeroTimer test QTBUG-84291,
but not sure why removing that has affected to this one.

Update to QEXPECT_FAIL documentation to tell in first place
that XPASS is not only marking it as XPASS but also failing
the test. Same is mentioned in different location but it
needs more searching or testing how it works in real test.

Task-number: QTBUG-115155
Change-Id: I7fb4ef28dba8adb7009be528f88fc758a12e9006
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-10 16:42:51 +03:00
Fabian Kosmale
c4bb02ce62 moc: Remove remnants of USE_LEXEM_STORE
Defining USE_LEXEM_STORE breaks compilation, and the commit that
introduce it (in the pre-public history) does not shed any light on its
usage.

Change-Id: Ic616bf9f2584151dab3f654d64025fcdc0ade25c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-10 10:17:45 +02:00
Marc Mutz
5dd29e7835 Mark GTK theme plugin as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses isn't very high here, but at this time,
this author just goes through the code-base and white-lists TUs that
still use Q_FOREACH in order to globally enable QT_NO_FOREACH.

Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TU by #undef'ing QT_NO_FOREACH
locally, at the top of each file. Since the TU is part of a larger
executable, this requires the file to be compiled separately, so add
it to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too).

Task-number: QTBUG-115839
Change-Id: If731d02f65131c94afa8beb51679ed2ff7d2cdaa
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-09 23:57:22 +02:00
Jonas Karlsson
5f72c822d0 Add missing include for Q_ASSERT_X
Pick-to: 6.5 6.6
Change-Id: Ic2a52c6fe1d8a8c17bd722ac7c59a0d715dc8555
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-09 21:31:58 +00:00
Ilya Doroshenko
9316689551 Add stereo support for Dx11 RHI
Change-Id: I10ef8f80b4b4bcb91fc99ab4ab77f2ac031dbd33
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-08-09 21:43:40 +02:00
Edward Welbourne
4694a1b2ae corelib/time/: clean out assorted over-namespacing
QDate's constructor can see maxJd() and minJd() without namespace prefix.

QDateTimeParser::SectionNode's name() inherits visibility from
QDateTimeParser of its Section enum's members.

Change-Id: I6315c4ede8875ef725d5b778eebac1e2027cd8b1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-09 21:43:40 +02:00
Edward Welbourne
9c07faed2c QLocale: clean out assorted over-namespacing
The code of a class doesn't need that class's prefix to access members
of the class.

Change-Id: I4cc2f72c90cff48b331dc12d390c45c0639606b3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-09 21:43:40 +02:00
Ahmad Samir
006fecc824 QTableView: add an operator<<(QDebug, SpanList)
Simplifies the code at the call site.

Even though QDebug has support for streaming std::list (SpanList), the
format of the output would be different than what's already used here,
hence the custom operator<<().

Drive-by, port from Q_FOREACH to ranged-for

Task-number: QTBUG-115803
Change-Id: I30953c92e0c9febc01497c1117fa472b4718820e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-09 22:43:40 +03:00
Edward Welbourne
2ec8acf611 Change enumdata.py names so comments read more naturally
Now that the "and" is only seen in enumdata.py and comments, we can
s/And/and/ in all the various territory names that used it.

Change-Id: Ic376d5904b6f5ab54931f96230c1dd5b7f357b8d
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-09 17:53:45 +02:00
Edward Welbourne
1ae24f8b50 Use CLDR's names in QLocale::*ToName() for language, script, territory
Various comments need to continue using the enumdata.py names, as they
associate data with particular enum members, but we can now correctly
use the en.xml versions of their names when we report them, rather
than the enum-friendly names we use in the code. Since this now means
the data may stray outside plain ASCII - it'll be UTF-8-encoded - this
implies replacing the QLatin1StringView()s of the code that formerly
read this data with QString::fromUtf8().

Fixes: QTBUG-94460
Change-Id: Id3b08875a46af58c0555c3e303b0e15a19441509
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-09 17:53:42 +02:00
Edward Welbourne
afd7d68244 Revise enumdata.py's names to more closely match CLDR's
We could already use dashes in some, rather than spaces, and now no
longer need to capitalize each word. This changes the *_name_list[]
entries for affected languages to more closely match what CLDR gives
as their names. It also amends various comments. Added tests for the
QLocale::*ToString() functions to cover the entries changed.

Task-number: QTBUG-94460
Change-Id: I0163795cb282881f15a97be00a5311c1936c3a09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-09 17:53:36 +02:00
Alexey Edelev
4f686b7b78 Fix typo in core animation docs
Pick-to: 6.2 6.5 6.6
Change-Id: I9fdab0e3969a4d89695c70c4e44a8018a141c6bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-09 16:40:57 +02:00
Alexey Edelev
91f5f44b13 Fix typo in QUntypedPropertyBinding docs
Pick-to: 6.2 6.5 6.6
Change-Id: Id279760a40be56bea6456e57404348bd2619f64b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-09 16:40:57 +02:00
Alexey Edelev
d55c5e2a43 Disable the 'openssl-hash' feature by default
Since the feature breaks Qt build in some configurations, disable it
by default and make private, so users should enable it explicitly and
make sure that openssl libraries are accessible for linking at build
time by either PATH or LD_LIBRARY_PATH.

Fixes: QTBUG-114783
Pick-to: 6.6
Change-Id: I6eb53c43ed937ec1c0164025bc8953cc5170dc44
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-09 15:53:07 +02:00
Edward Welbourne
1b5e13c8d9 Fix QMimeType::comment()'s use of UI languages and default
The MIME database appears to use underscore to join its locale tags,
where QLocale::uiLanguages() uses dashes. This meant that lookups by
anything but the raw language were failing even when there was an
entry in the MIME database for the desired locale. Also, since 6.5,
the uiLanguages() list always does contain the locale's own name, so
don't add it to the list again.

At the same time, the search was putting the "default" key (used by
the MIME database parser for the entry with no locale specified) at
the end of the list but macOS (at least) uses that for the "en_US"
version, omitting "en_US" itself from the locale-specific data, with
the result that those using en_US as locale, but with some other
languages later in the list, got the translation for one of those
languages instead of the en_US one, since they were found before
"default" was reached.  So insert "default" after the first block of
en-entries in which en_US appears, if it does, rather than at the end.

As a drive-by, amend a comment about using "pt" as fall-back for
"pt_BR"; as it happens, for pt_BR, uiLanguages() will contain "pt" in
any case, as pt_BR is the default for "pt". (Like en, pt anomalously
defaults to a territory other than the one the language is named
after.) So use de_CH -> de as example, instead (and place the comment
where the decision is taken).

Fixes: QTBUG-105007
Pick-to: 6.6 6.5
Change-Id: I1f4835190748256ce53a51321a94ae450ab7f61e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-09 15:53:07 +02:00
Eskil Abrahamsen Blomfeldt
e7507d6cb7 doc: Make docs for ElideNone a bit more precise
ElideNone was originally introduced as a way of modifying behavior
of specific widgets, such as QTabBar. The text would previously
always be a elided and an ellipsis character would be added somewhere
to indicate this to the user. Given that context, it makes sense
that the documentation says the effect of ElideNone is that ellipsis
does not appear in the text, since the text would still be elided
if it were too long, given that the painter would draw it clipped to
the widget.

When QFontMetrics::elidedText() was introduced later, this became more
confusing. In the context of this function, you would expect the text
to be returned truncated to the width but without the ellipsis character.
Instead it just returns the full string.

Since this has been the effect of ElideNone since the start and multiple
places use it as a way of disabling the truncation of the string, we
simply update the documentation to make this more clear.

Pick-to: 5.15 6.2 6.5 6.6
Fixes: QTBUG-40315
Change-Id: If037430da6260020b1d99be7bd43e622f8afa844
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-09 15:53:07 +02:00
Edward Welbourne
c801e837a6 Remove spurious early return from QTZPrivate::stateAtZoneTime()
A zone may have transitions, none of which is for daylight-savings;
notably, Kiritimati has never done DST but did make a whole-day
transition to move the international date line from its west to its
east. (It also has, before that, the usual transition out of LMT and a
rounding transition from an initial UTC-10:40 offset to UTC-10.)

Change-Id: I5779e965d677cf9698b403d6a11242c9edeac864
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-09 15:53:07 +02:00
Marc Mutz
c63c46037d Mark QtWidgets as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses is high here, too high for this author
to tackle in a short amount of time. But they're concentrated in just
a few TUs, so pick a different strategy:

Mark the whole library with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. For TUs that are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115803 to keep track of
this.

Task-number: QTBUG-115803
Change-Id: Ib5d6192632d98bdcc6625a9a14e05d13bb7f759b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-09 09:38:48 +02:00
Tor Arne Vestbø
ba2d109c5f macOS: Add qnswindow_cast helper function
Pick-to: 6.6
Change-Id: If4394e4fbee271c926c0c1c32de1f9783319d994
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-09 09:18:21 +02:00
Alexandru Croitor
bc88bb34ca Revert "CMake: Place resources into static libraries, not object libraries"
This reverts commit ce8874fc3b.

Reason for revert: Doesn't handle resource names that are invalid identifiers

Change-Id: Idf24bd9797284ce9de382a8e233d56c799a09099
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-09 00:34:15 +00:00
Thiago Macieira
27a9ce0a16 QString: mark qustrchr() and qustrlen() Q_NEVER_INLINE
Those are "public-ish" and exported functions (qstringalgorithms.h), so
one wouldn't expect that they get inlined most of the time. But they can
be inlined by other code inside qstring.cpp and if QtCore is compiled
with LTO.

More importantly, we want the compiler to inline qustrXXX_avx2() into
it, instead of tail-calling into qustrXXX_avx2(). This may seem like a
no-op but has one very important difference: backtraces will point to an
exported, function instead of an internal symbol. This will then allow
us to create valgrind suppressions.

Before unstripped:
==12492== Invalid read of size 32
==12492==    at 0x53142EE: qustrchr_avx2(QStringView, char16_t) [clone .lto_priv.0] (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==12492==    by 0x54A7AE6: QString::indexOf(QChar, long long, Qt::CaseSensitivity) const [clone .constprop.0] (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==12492==    by 0x5218EC4: treatAsAbsolute(QString const&) (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==12492==    by 0x5218FBA: QDir::filePath(QString const&) const (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)

Before, stripped:
==19477== Invalid read of size 32
==19477==    at 0x5314395: ??? (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19477==    by 0x54A7AE6: ??? (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19477==    by 0x5218EC4: ??? (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19477==    by 0x5218FBA: QDir::filePath(QString const&) const (in /home/tjmaciei/obj/qt/installed/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)

After:
==19692== Invalid read of size 32
==19692==    at 0x53143C5: QtPrivate::qustrchr(QStringView, char16_t) (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19692==    by 0x54ABA46: ??? (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19692==    by 0x5218824: ??? (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19692==    by 0x521891A: QDir::filePath(QString const&) const (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19692==  Address 0x741919e is 2 bytes before a block of size 32 alloc'd
==19692==    at 0x4843794: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==19692==    by 0x54A8A84: ??? (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)
==19692==    by 0x531EB1C: QString::fromLatin1(QByteArrayView) (in /home/tjmaciei/obj/qt/qt6-release/qtbase/lib64/glibc-hwcaps/x86-64-v3/libQt6Core.t.so.6.7.0)

Recommended suppressions:
{
   qustrchr_avx2
   Memcheck:Addr32
   fun:_ZN9QtPrivate8qustrchrE11QStringViewDs
}
{
   qustrchr_avx2-with-debuginfo
   Memcheck:Addr32
   fun:UnknownInlinedFun
   fun:UnknownInlinedFun
   fun:_ZN9QtPrivate8qustrchrE11QStringViewDs
}

Change-Id: Ib84fc618ac204205bf7afffd1772b1d87343dfd0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-08-08 10:44:56 -07:00
Edward Welbourne
c5515f5eb1 Fix digit grouping: m_grouping_top doesn't mean what I thought it did
I'd previously understood CLDR's minimumGroupingDigits to mean the
most significant group must have that many digits. It turns out to
mean only that the first grouping separator doesn't get added unless
the more significant group has this many. Once we have one separator,
more can be added that do isolate a single digit.

In the process, I discover some of the prior arithmetic is incorrect;
it is now fixed. Added some basic testing, amended some existing
tests. In the process, fixed naming of some double validator tests.

Pick-to: 6.6 6.5
Fixes: QTBUG-115740
Change-Id: Ia6ce011ba72e72428b015ca22b97d815ebf751b2
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-08 19:44:56 +02:00
Antti Määttä
7f5d2262c1 CTF: Remove channel from channel list when it is destroyed
Prevents using the channel after it was destroyed.

Change-Id: I5d65fcde0d451dd8ce2c56f403e0bd1f41510382
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-08 17:03:28 +03:00
Marc Mutz
a4d968adc0 Mark ios plugin as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses is high here, too high for this author
to tackle in a short amount of time. But they're concentrated in just
a few TUs, so pick a different strategy:

Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. Since the TUs are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too). I'm aware that Objective-C/C++ files are
currently probably implicitly NO_PCH_SOURCES, but don't rely on that.

Task-number: QTBUG-115839
Change-Id: If451501f3cb7cc3a182854a94bc5d27c907f6161
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-08 16:03:28 +02:00
Eirik Aavitsland
3498baef76 Update bundled libjpeg-turbo to version 3.0.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.0.0

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I960c4bfdef268eced93317ded814e2c84befa451
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-08-08 15:06:51 +02:00
Alexey Edelev
b4a55e6db6 Remove explicit use of QT_USE_QSTRINGBUILDER
Since we enabled QT_USE_QSTRINGBUILDER by default for all plugins
it doesn't make sense to add this definition explicitly.

Change-Id: I22ad0b1fb567e12a842df4299231a5697ab9216d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-08-08 09:47:39 +02:00
Kai Köhne
3883b0a7b6 Doc: Fix warning about undocumented parameter
Fixes
 (qdoc) warning: Undocumented parameter 'enable' in QSqlQuery::enablePositionalBinding()

Amends the documentation introduced in e532933a2a

Change-Id: I638cf7e1dc1c9af911f6ca52bc27e6072fae1035
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-08-08 09:12:16 +02:00
Christian Strømme
0bdd01b7f7 Update to Freetype 2.13.1
The build fix applied to the 2.13.0 update has also been applied to
this update.

Pick-to: 6.6 6.5 5.15
Fixes: QTBUG-115340
Change-Id: I970b560948af3472b222690019a85a79c537b7d9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-08-08 07:02:39 +00:00
Marc Mutz
a2c8524ad7 QHostInfo: de-inline -Result and -Runnable dtors
These classes are not exported, so we don't run into duplicate vtables
here, but the header is included in a few TUs other than qhostinfo.cpp
(all, when building with PCH), so make sure we compile dtors only once.

Pick-to: 6.6 6.5
Change-Id: I51f6a6d27fc084ad469f82dc7aef3327bdd9a906
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-07 23:56:11 +02:00
Marc Mutz
32cfe18120 TinyCbor: port away from Q_FOREACH
Upstream change: https://github.com/intel/tinycbor/pull/238

Says it in the upstream commit message:

> Unfortunately, the container's initialization code doesn't exactly
> lend itself to making the container const (not even IILE
> (Immediately-Invoked Lambda Expression) would help here, due to the
> interdependency with len), so the idiomatic solution would be to use
> std::as_const()/qAsConst().
>
> The former is available from C++17, which we don't require, yet, and
> the latter is not available under QT_NO_AS_CONST (the default for Qt
> these days), so grab the nettle and implement a t17::as_const() that
> switches between a manual implementation of std::as_const and the
> real thing, depending on __cpp_lib_as_const. The t17 here mimicks
> the qNN (q20::remove_cvref_t/q23::forward_like/etc) mechanism used
> in Qt itself for backports, with s/q/t/ because ... _T_inyCbor.
>
> The t17 implementation is local to tst_encoder.cpp, but can easily
> be extracted into a separate header once more users emerge.

Task-number: QTBUG-115839
Change-Id: I200ae6abbb6173fa9d4b9964be66501c2145f066
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-07 23:56:11 +02:00
Tor Arne Vestbø
774095ed9a Don't keep around old dirty region when entire window is invalidated
QPaintDeviceWindowPrivate::markWindowAsDirty() is used to signal that
the entire window needs repaint, for example when the window is being
resized. If multiple resize events come in before we have a chance to
redraw the window, we'll end up redrawing the window based on the
window's current size and exposed region, as we should, but we'll
still have a dirty region, because we didn't redraw the window at
any of its old (larger) sizes. Resetting the dirty region instead
of appending to it should be enough.

Pick-to: 6.6 6.5
Change-Id: I37443cc1044779f847348a2303a6cebc1a8f3bcb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-08-07 22:29:06 +02:00
Marc Mutz
aa48e212d7 Normalize signal/slot signatures [2/2]: QPair
This is the result of running util/normalize. In this second patch,
the tool replaces QPair with std::pair. This is a bit surprising, and
suggests we should replace all QPair with std::pair in our headers
soon.

Pick-to: 6.6
Change-Id: Iea0a2fb460a5da66fb534b3787c97d8300a04ca9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 22:29:05 +02:00
Edward Welbourne
a0c5a7c483 Wrap CLDR-derived time-zone ID tables to within a 100-column margin
Ugly display in code-review bugged me ...

Change-Id: If9243907973cad49f1a5c8d78ff23c14fab2d4b4
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-07 19:51:09 +02:00
Edward Welbourne
c84d78d105 Update QTimeZone data to CLDR v43
Ran the script, no new IDs to add. Revised tests of Central Standard
Time: America/Ojinaga has joined Matamoros for it, in Mexico.

Pick-to: 6.6 6.5
Fixes: QTBUG-115732
Task-number: QTBUG-111550
Change-Id: I9b41d8c0156b9fbe3961dbe9a35d55493fc55501
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-07 19:51:09 +02:00
Tor Arne Vestbø
4eb1275062 macOS: Use [QNSWindow closeAndRelease] for closing and releasing
Unifies code paths that end up closing and releasing the window.

Pick-to: 6.6
Change-Id: Ie041079a22bbae0912df0406291c8146f02d0cd7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Tor Arne Vestbø
cc761c85ed Add note about Qt::SubWindow not being the same as a child window
Task-number: QTBUG-115729
Change-Id: Icd0b2006a828fd02b60e047d066e8a2e3095b93d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Tor Arne Vestbø
ed7c7a1458 iOS: Implement QPlatformWindow::setMask() for masking rendering and input
Same implementation as for macOS.

[ChangeLog][iOS] QWindow::setMask() is now supported for masking the
rendering and touch input of child windows.

Pick-to: 6.6
Change-Id: I2f9429f0f8fa278fdd8edc15c7b242c7c6bc0ff0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Ivan Solovev
f50e295680 QJniObject: remove unused private methods
These three private methods were introduced in
4e60681c87 together with the QJniObject
class.
Digging through the whole git log for the qjniobject.h header shows
that the functions were never used. Not in template or inline methods,
and not even in the out-of-line methods.
Considering all the above, removing these methods would not cause BiC
or SiC issues, so just do it.

Pick-to: 6.6
Change-Id: Iaeeefbc2f1002e9413fd16651abd71381362a536
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-07 13:37:29 +02:00
Kai Köhne
f350f69abe Doc: Remove link to removed example
Example got removed to tesets/manual in
8937169c19

Pick-to: 6.5 6.6
Change-Id: Ica1470b6b478f49e318ea51f244c599cd12bf5a3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-07 13:16:37 +02:00
Marc Mutz
a9982a3b63 Add copy(SlotObjUniquePtr), use it in QHostInfoResult & SlotObjSharedPtr
It's a free function, because a) it rhymes with move(ptr) and, of
course, SlotObjUniquePtr being a std::unique_ptr, b) we can't add
member functions to it (and no, inheriting from a type whose dtor is
neither protected nor virtual is nothing you will catch yours truly
doing).

Pick-to: 6.6 6.5
Change-Id: I2026126857a7bba204d683bad118e8a2c5cb2924
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-06 11:33:03 +00:00
Mårten Nordheim
5bb4020cbe QHostInfo: use SlotObjUniquePtr
Drops the direct deref'ing.

Pick-to: 6.6 6.5
Change-Id: I9f159244d50572659fa8e9cabfbef47e769ac54e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-06 09:05:03 +02:00
Marc Mutz
d7dc4d3ebb macdeployqt: port away from Q_FOREACH and mark the tool free of it
As a drive-by, fix a detach attempt in an existing ranged for-loop by
making the container const, and don't re-construct the same QDir three
times, just once, at beginning of the function.

Change-Id: I5031c4b63dd939ae93dd119b01d1cad5e655f733
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-05 22:42:20 +02:00
Marc Mutz
a631fef20f QtWidgets: use NO_PCH_SOURCES instead of manual no-pch handling
This is how all other libraries handle this, so use it here, too.

Amends 0c8b98774c and
09d1196281.

Pick-to: 6.6 6.5
Change-Id: Id3b8fa1b834e2bebe5e6ddc1f67e43c66ccd9aab
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-05 20:21:16 +02:00
Thiago Macieira
81685b0ac0 QEXTRACTTESTDATA: include the errorString() in case of failure
In case we fail to copy or set the permissions, get the error string
from QFile. This necessitated fixing QFile so it would copy the error
from QTemporaryFile in case the latter failed to open.

Drive-by use %ls to avoid going through the locale codec in QtTest.

Change-Id: Ifbf974a4d10745b099b1fffd1777c7e6e00c25af
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-05 08:22:20 -07:00
Shawn Rutledge
17f61ddc63 QMutableEventPoint::update(): update the touchpoint uniqueId too
Most touch events don't have uniqueIds, but it happens with TUIO
fiducial objects.

Fixes: QTBUG-115758
Change-Id: Ibacce255898ce63090bc5b888c12242838603dd5
Pick-to: 6.5 6.6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-04 21:11:22 +02:00
Marc Mutz
693c9e6b1b QHostInfo: fix remaining slotObj leaks
We failed to delete the slot object when lookUpHost() was called in
these (exceptional) circumstances:

- on a thread with no event dispatcher

- after application shut-down, when the QHostInfoLookupManager
  Q_APPLICATION_STATIC was destroyed already

Fix by adding the missing destroyIfLastRef() calls into these code
paths, too.

Amends ad5eb297e1.

This would be so much easier if we had SlotObjUniquePtr...

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-115263
Change-Id: Ief8bf125bc196742c0ce59c1fd87ab93242fc0da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 19:49:32 +02:00
Marc Mutz
47a0282707 [docs] Link from QtConcurent::run() to QThreadPool::start(Callable&&)
The latter is a better choice if you don't need the result QFuture.

Describe the QThreadPool::start() overload in prose, since the
signature changed in 6.6 from std::function<void()> to Callable
auto&&. The chosen wording is compatible with both.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-111875
Change-Id: I9f67c2f7e4b221602bf1c35b72e5d38898a4f0c9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 19:49:32 +02:00
Marc Mutz
edcb8e901b Drag qstring.h out of the qstringbuilder.h guard
qstringbuilder.h needs qstring.h completely parsed. Without this
change, we won't be able to include qstringconverter.h even at the end
of qstring.h (needed for QTBUG-114208).

Picking back to 6.5 to reduce the diff with our LTS going forward.

Task-number: QTBUG-114208
Pick-to: 6.6 6.5
Change-Id: I83d5bcc0939b698209481793f60a0199aa95a06e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 16:56:58 +02:00
Alexey Edelev
674134f08d Consider BUILD_SHARED_LIBS when adding libraries using _qt_internal_add_library
It does look safe to consider the value of BUILD_SHARED_LIBS in
_qt_internal_add_library. Current behavior might confuse users that
specify BUILD_SHARED_LIBS explicitly but get the library types
according to Qt build type.

[ChangeLog][CMake] qt6_add_library now considers the value of the
BUILD_SHARED_LIBS variable. If the variable is DEFINED it has
higher priority than the library type detecting logic in
qt6_add_library when adding the library targets.

Change-Id: I1c40e887c4e481424a596c870a8ff2784b08fcbb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-04 14:36:50 +02:00
Alexandru Croitor
ce8874fc3b CMake: Place resources into static libraries, not object libraries
During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.

This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.

It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.

We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.

This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.

To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.

It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.

For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.

The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.

A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.

Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: I39c325aac91e36d53c3576a39f881949c3b21e3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 14:15:05 +02:00
Axel Spoerl
86fe84f5f7 Fix link to platform window in QAndroidPlatformBackingStore::flush()
The Android QPA implementation requires a 1:1 link between a platform
window and a platform backing store, to correctly flush a backing
store to the screen. QAndroidPlatformBackingStore has a bool member
m_backingStoreSet, to remember if this link exists. It defaults to
false and is set to true, when setBackingStore() is called in the
constructor. It falsely remains true, when a platform window is
deleted, e.g. because a QWindow has been hidden. When the QWindow is
shown again, a new Android platform window is created. With
m_backingStoreSet still being true, this new platform window will
never be associated with a backing store. As a consequence, it will
never be displayed on the screen.

The 1:1 relationship of an Android platform window and an Android
backing store is neither ideal, nor in line with other QPA layers
(e.g. XCB). Changing the Android QPA implementation is complex and a
short term fix is  necessary.

This patch removes the member m_backingStoreSet. Instead of it,
QAndroidPlatformBackingStore::flush() directly checks, if the platform
window corresponding to the QWindow argument is associated to a backing
store. If that is not the case, setBackingStore() is called.

QTBUG-97482 has been fixed with another approach, which this patch
reverts.

The following commits are effectively reverted by this patch:
9a39ad8dfb
f91588923b
a4ca9e8065
dbb072eb28
959a8b3967

Fixes: QTBUG-97482
Pick-to: 6.6 6.5 6.2
Change-Id: Ic4344f8df2e954c057dd2705340f11dfd2d4c6fe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-04 10:40:05 +02:00
Thiago Macieira
01f58d7794 CMake: remove TEST_syslog but not FEATURE_syslog
This feature was already in AUTODETECT OFF. That means we only enabled
syslog() support if the user explicitly asked for it, which reasonably
means they have the API. The API is also POSIX.1-2001 and 4.2BSD, so
everyone has it.

Saves 350 ms of CMake time, because the test was compiled even though
AUTODETECT was OFF.

Change-Id: Ifbf974a4d10745b099b1fffd1777572e74a90043
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-03 18:47:33 -07:00
Thiago Macieira
5a51c2e8b5 CMake: remove check for statx() and replace with STATX_BASIC_STATS
We were already using this in qfilesystemengine_unix.cpp. In fact, the
only place where we had QT_CONFIG(statx) was in minimum-linux_p.h.

Saves 350 ms of CMake time.

Change-Id: Ifbf974a4d10745b099b1fffd177756e2edf2bf3e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-03 18:46:57 -07:00
Thorbjørn Lindeijer
233e7e6be3 Fix memory leak in QGtk3Interface::themeName
Pick-to: 6.6 6.5
Change-Id: Ib8c90f7ef66c095f0c1fc04f4cc72bf5eea72ddb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-03 21:15:55 +02:00
Edward Welbourne
c5ef6e1e68 Wrap QLocale's CLDR-derived string data tables to a 100-column margin
The string data tables have a mix of digit-length tokens, up to
four-digit hex; we can fit 12 of those per line within our margins.
Leave the one-row-per-locale tables as they are, though, despite long
lines.

Change-Id: I655fddecf24133c26d16187b7a5a8fbc25553e07
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-03 19:16:27 +02:00
Marc Mutz
15ff5bafa0 Don't protect qstringbuilder.h indirect includes
It's a) not needed, because qstringbuilder.h simply just defines op%
and not op+ when these defines are not set and b) surprising for users
that they have to include <qstringbuilder.h> if they want to use op%
without also setting one of these defines. Finally, it just throws
readers of the code off the track for no good reason.

So, drop the external guards for qtringbuilder.h in qstring.h and
qstringconverter.h.

Task-number: QTBUG-114208
Pick-to: 6.6 6.5
Change-Id: I00b3e405d905d319437c32a7253b39de1625d096
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2023-08-03 18:36:41 +02:00
Ievgenii Meshcheriakov
8d89b4ef21 qdbuscpp2xml: Support MEMBER field of Q_PROPERTY
Emit properties with MEMBER field specified with 'readwrite'
access. Previously only READ and WRITE filed where used
for deriving the access value.

Add a property using MEMBER to the test class used by
tst_qdbuscpp2xml.

Fixes: QTBUG-115631
Change-Id: I12351985a9fafd934ccc5e0b805077a9e44b6608
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00
Tor Arne Vestbø
3f3b2be870 macOS: Ensure foreign windows can be reparented via QWindow::setParent()
In b64b0c7947 we bailed out from
QCocoaWindow::recreateWindowIfNeeded() for foreign windows, as
we should not manage any NSWindows on their behalf.

Unfortunately QCocoaWindow::recreateWindowIfNeeded() also took care
of adding the view as a subview to the potential non top level view,
which we do want for foreign views.

Ideally we'd move the reparenting out of recreateWindowIfNeeded()
and into QCocoaWindow::setParent(), but this is a more intrusive
change, so for now just restore the original missing logic.

Pick-to: 6.6 6.5
Change-Id: Ic35ebf94d4adc2f19cedb1cb6a5d0215a1c9c2b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-03 16:09:17 +02:00
Laszlo Agocs
547b9da7ad rhi: Enhance the hdr info struct and add a manual test
...while sharing the related code between the d3d backends.

The isHardCodedDefaults flag is not used in practice and is
now removed. Add the luminance behavior and SDR white level
(for Windows) to help creating portable 2D/3D renderers that
composite SDR and HDR content. (sadly the Windows HDR and Apple
EDR behavior is different, as usual)

The new test application is expected to run with the command-line
argument "scrgb" or "sdr". It allows seeing SDR content correction
(on Windows) in action, and has some simple HDR 3D content with
a basic, optional tonemapper. Also shows the platform-dependent
HDR-related screen info. With some helpful tooltips even.

Additionally, it needs a .hdr file after the 'file' argument.
The usual -d, -D, -v, etc. arguments apply to select the 3D API.

For example, to run with D3D12 in HDR mode:

hdr -D scrgb file image.hdr

The same in non-HDR mode:

hdr -D sdr file image.hdr

Change-Id: I7fdfc7054cc0352bc99398fc1c7b1e2f0874421f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-03 12:17:25 +02:00
Paul Wicking
78bc1a9a25 Doc: Move \target command to inside table cell
`\target`s generate a span where they occur. If they occur outside a
table cell, QDoc generates illformed html. Fix such instances by moving
the offending line into the table cell they target.

Task-number: QTBUG-115247
Pick-to: 6.6 6.5
Change-Id: I677e909ec73a6d0af8195d88d23581d8dd97c6e5
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
2023-08-03 12:15:40 +02:00
Fabian Kosmale
4c1df115ec QDbus: Avoid memory leak in registerComplexDBusType
QMetaType does not own the interface from which it is constructed.
Consequently, we end up with a memory leak.
This is not a huge issue, given that the map of meta-types is static,
and the application is about to be close when can discard it anyway, but
it causes avoidable sanitizer warnings, which are annoying when
debugging more severe memory leaks.

Pick-to: 6.6 6.5
Change-Id: Ifee3f4e19835536f4a6cfa4f6866ab621581ad4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 11:28:38 +02:00
Antti Määttä
74dd646e82 CTF: Add streaming support
Implement TCP server to stream trace data. Use the QTRACE_LOCATION
environment variable to configure the server address and port.

The rest of the configuration is done in the client TraceRequest.
The user can configure the compression level, buffer size and
whether the server is buffering when client doesn't have connection.

The server responds with basic response and then begins sending packets
until the client disconnects or the app closes.
Each packet contains stream name, stream data and whether to overwrite
the stream, which is used with metadata streams.

Task-number: QTBUG-105976
Change-Id: I41c708a4c7988666d59f0c6093dd41e8ccd88441
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-03 08:23:36 +03:00
Antti Määttä
c6ab516f71 CTF: Clear output location at startup
Remove old files from the output location before saving new ones.

Pick-to: 6.6 6.5
Change-Id: I75181126c6c920e13951e9a46a6be1c666d457fe
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-03 08:23:30 +03:00
Ahmad Samir
7fe1198f6e QAbstractSocket: remove a redundant stack variable
Just use the static const int directly.

Change-Id: Icf37ac5db4457bbc8631659e175d038cfeed46e4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-03 02:12:22 +03:00
Ahmad Samir
8ed2bc9194 QByteArray: change append(QByteArray) to match QStringBuilder behavior
I.e. concatenating a null byte array and an empty-but-not-null byte
array should result in an empty-but-not-null byte array.

This matches the behavior of QString::append(QString) too.

Fixes: QTBUG-114238
Pick-to: 6.6
Change-Id: Id36d10ee09c08041b7dabda102df48ca6d413d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:22 +03:00
Ahmad Samir
c168172ea9 qstringalgorithms: make trimmed_helper_positions [[nodiscard]]
Change-Id: Ic3a3ed29b2472487634715ee7b447b36d04b377f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:21 +03:00
Marc Mutz
f141108887 Port QCoreApplication::requestPermission() to SlotObjUniquePtr internally
Well, except that the ownership of the slot object here is actually
shared between the PermissionReceiver and the lambda passed to
QPermission::Private::requestPermission(), which eventually may hand
ownership over to QMetaCallEvent, so we can't really use
SlotObjUniquePtr.

While we can, of course, manually copy and call ref(), even if the
slot-object is stored in a SlotObjUniquePtr, unfortunately, the lambda
is subsequently stored in a std::function, which infamously cannot
hold move-only objects, so we actually need something copyable.

So grasp the nettle and implement a SlotObjSharedPtr.

I was originally planning to just make this a typedef for
QIntrusiveSharedPointer, but that's not in dev, yet, let alone 6.5, to
which we're picking this, and there was always this nagging impedance
mismatch between the QIntrusiveSharedPointer behavior, inherited from
it's Q(Explicitly)SharedPointer roots, on the one hand, to always
ref() in the constructor from raw pointer, and, OTOH, QSlotObjectBase
starting its life with a ref-count of one (1) (not zero (0), like
QSharedData).

I eventually found the (elegant, if I may say so myself) solution to
just not provide a constructor from raw pointer, only one from
SlotObjUniquePtr, which, granted, has the same issue, but which is, by
now, probably, hopefully, more fully grasped by QtCore regulars, and so
we can piggy-back on that for SlotObjSharedPtr's constructor
semantics.

Add a comment nevertheless.

Inside the lambda, we could theoretically move the slotObj into
QMetaCallEvent::create(), after adding such conversion to
SlotObjSharedPtr, but that would require making the lambda mutable,
and seeing as it's stored in a std::function and copied around, I was
not ready to make that change just yet.

As a drive-by, make PermissionReceiver's constructor explicit.

Pick-to: 6.6 6.5
Fixes: QTBUG-115330
Change-Id: I4e0cec13d19a19eeec31e4101ce289d07c92ce46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 22:11:12 +02:00
Marc Mutz
902063628f QSlotObjectBase: fix return value of ref()
QAtomicInt::ref() returns bool, not int, so do the same in our ref().

As a drive-by, drop the superfluous inline keyword.

Pick-to: 6.6 6.5
Change-Id: I60712df3640b67dfd857355d364e0fc5a3a40650
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 22:10:33 +02:00
Thiago Macieira
3e2b3c094e CMake: remove TEST_glibc
Commit aa82d295c8 changed from using
minimum-linux.S to qlibraryinfo.cpp, so we no longer need this. Saves
350 ms of CMake time.

Change-Id: Ifbf974a4d10745b099b1fffd177754aa5a4096ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-02 12:36:18 -07:00
Thiago Macieira
4a5f3c8b93 CMake: remove check for cxx11_future
Everyone must have this by now. This test was 1193 ms of CMake time.

Since this was a PUBLIC feature, I've left it around with a constant
condition.

Change-Id: Ifbf974a4d10745b099b1fffd177754538bbff245
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 12:36:18 -07:00
Thiago Macieira
f44072ca43 CMake: remove test for cxx11_random
Everyone has it, without exception. QRandomGenerator uses the Mersenne
twister without checking, so you can't have Qt without this. This test
was here only to produce an error at CMake time instead of at build
time, but that test costs 650 ms for everyone running CMake without
cached results.

Change-Id: Ifbf974a4d10745b099b1fffd177753b6d4fc89d4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 12:36:18 -07:00
Dennis Oberst
d7d15c1a47 Use new QBA::assign in QXcbMime::mimeDataForAtom
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Pick-to: 6.6
Change-Id: I5e5114064c8aaa23892e95c235335632d7c5cd0a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-02 17:11:45 +02:00
Dennis Oberst
da5f2fc6be QFreeList: Resolve symbol ambiguity in unity build
Remove 'qfreelist.cpp' from the NO_UNITY_BUILD_SOURCES section
and fix the underlying problem of the clashing symbols with
'qabstracteventdispatcher.cpp', by wrapping the unnamed enum in
a namespace.

Amends: a07426d23a.

Task-number: QTBUG-109394
Pick-to: 6.6 6.5
Change-Id: I585ab06a33d46a11a48220f504c53a5f4fa91d7e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-02 15:11:45 +00:00
Mikolaj Boc
63b64084cd Make more of tst_settings pass on WASM
Missing parts of local storage backend implemented:
- fallback mechanism
- removal of all child keys for groups
- variant decoding instead of string decoding
- report AccessError when organization is empty in settings' ctor

Some WASM-specific adjustments to tst_qsettings have also been
introduced.

Task-number: QTBUG-115509
Fixes: QTBUG-115037
Change-Id: I02cde965b11d98a64fc1ecb261d74838c508afd6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-02 15:43:45 +02:00
Shreya Pattani
6341e0d201 Implement text update in wasm apps during accessibility
Implementation for QAccessibleEditableTextInterface is pending for texts
in qml accessibility, adding accessibile role check for text to be
updated when accessibility feature is on in wasm

Change-Id: Ic24ebf6942e50a5952126e312afa633ed4fbe9ce
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-08-02 13:43:45 +00:00
Marc Mutz
f91588923b QPlatformWindow: add a macro when setBackingStore() is virtual
This is the only way to detect, and act upon, the addition of the
virtual function in other Qt modules.

Amends a4ca9e8065.

Pick-to: 6.6
Task-number: QTBUG-97482
Task-number: QTBUG-115691
Change-Id: Id32fdd3d8af1fced17983dd104318645a5578b8c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-02 14:02:33 +02:00
Marc Mutz
c91146b9ef eglfs plugin: port away from Q_FOREACH
Mark the module are Q_FOREACH-free, so it stays that way.

These two instances are risk-free, because the loop is over local
variables that the loop bodies clearly do not touch, so the safety
copy that Q_FOREACH takes is not required here.

Pick-to: 6.6
Change-Id: Ida3c1d51c661d77a59a2ad105e080c3c9b66c53f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-08-02 14:02:33 +02:00
Edward Welbourne
9237908327 Update QLocale to CLDR v43
Ran the scripts, added the new enum members to docs.
Updated tests:
* Two of the new languages are right-to-left,
* Canada has replaced a silly date format with a sensible one.

Fixes: QTBUG-111550
Change-Id: Ie6f1e6e94477167c9e2b5c67e6518ca0f6a7e7fb
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-02 09:38:34 +02:00
Thiago Macieira
ee593cdde6 QDBusXmlParser: downgrade property name mismatches to warnings
This has happened before: there's a disagreement on whether property
names need to be identifiers or not. In Qt, we insist they are, and if
this code had been around before, other specifications from other teams
in freedesktop.org and gnome.org would have adhered to this rule. But it
wasn't, so such properties exist (see [1]).

Commit bcc93850fc converted the check that
had bene here all along as a proper error for qdbusxml2cpp. So downgrade
it a warning and move on.

An alternative implementation would keep on going and install this
property with the invalid name, but qdbusxml2cpp and other generators
may want to ignore such property names later on. I'm not implementing
this in a bug fix (or at all).

[1] https://fprint.freedesktop.org/fprintd-dev/Device.html

Fixes: QTBUG-115596
Task-number: QTBUG-2597
Pick-to: 6.6
Change-Id: Ifbf974a4d10745b099b1fffd1776fb8cc9239125
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-01 21:52:55 -07:00
Axel Spoerl
d35e8ad754 Implement private visualRect() in QTreeView and QAbstractItemView
QTreeView::visualRect() returns a given model index's visual rectangle.
The method is used to toggle the background during hovering.
The previous implementation included the row indicator, when the first
row section was hovered. When it was unhovered, the row indicator
remained highlighted, until the mouse had left the view port.

The reason is, that the highlighting implementation changed the
rectangle returned for the first section, to include the row indicator.
The implementation for neutralising a highlighted section relies on
QAbstractItemViewPrivate::setHoverIndex() and
QAbstractItemView::update(). These methods don't know about the row
indicator to be included, and therefore do not update() its rectangle.
As a consequence, the correct background gets painted but not updated
on the screen.

This patch moves the calculation of the visual rectangle to a new
QTreeViewPrivate::visualRect_impl(). In addition to the model index,
the new method expects an enum argument, representing the calculation
rule:
- SingleSection: Calculate the rectangle of the given section.
- FullRow: Returns the rectangle of the entire row, regardless of the
index's column.
- AddRowIndiCatorToFirstCulumn: Adds the row indicator to the rect,
if the model index points to the first column.

The patch updates all calls within QTreeView, to use the private method
with the right calculation rule for the use case at hand. It elminates
manual (and repeated) modifications of the return value.

The patch implements QAbstractItemViewPrivate::visualRect(), which
returns QAbstractItemView::visualRect(). It is overridden in
QTreeViewPrivate, so that QAbstractItemViewPrivate::setHoverIndex()
and QAbstractItemView receive the rectangle including row indicator.

As a drive-by, several local variables have been constified and/or
renamed to indicative variable names.

Fixes: QTBUG-115149
Pick-to: 6.6 6.5
Change-Id: I4838bcf744f87d8cfb259c5d8758fb65e091e9fe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-01 19:25:06 +02:00
Dennis Oberst
5e2d95db97 Use new QBA::assign in QCoreApplication::applicationFilePath()
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Pick-to: 6.6
Change-Id: Ieeb254afd94e26f1b425795feb53c59ebb2322c6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-01 14:15:39 +02:00
Dennis Oberst
b40bb99a60 Use new QBA::assign in QStorageInfoPrivate::retrievePosixInfo
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Pick-to: 6.6
Change-Id: Ic51fc57eb0f84d3624ad3447c93a74241ab3612b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-01 13:22:39 +02:00
Ivan Solovev
eb0abd9789 Use QT_SUPPORTS_INT128 macro to handle 128-bit integral types
Introduce QT_SUPPORTS_INT128 and QT_NO_INT128 marcos to handle 128-bit
types. These macros allow to undef Qt's own 128-bit types and the
related code, but keep the compiler definitions unchanged.

This is required for Qt Bluetooth, where we need to use
QT_BLUETOOTH_REMOVED_SINCE to get rid of the APIs using
QtBluetooth-specific struct quint128 which clashes with the 128-bit
types. The idea is to use QT_NO_INT128 in Qt Bluetooth's
removed_api.cpp instead of directly undef'ing __SIZEOF_INT128__,
because the latter is UB.

This commit amends befda1acca.

Pick-to: 6.6
Change-Id: Ia2c110b5744c3aaa53eda39fb44984cf5a01fac2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-01 10:30:51 +02:00
Antti Määttä
8cedef62cf CTF: Simplify writing endianness to metadata
Pick-to: 6.5 6.6
Change-Id: Ie10533dc22746c31941d5d60d2cc7aa81436fee0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-01 09:05:01 +03:00
Antti Määttä
cc3f18e5e9 CTF: Use wfopen in windows
Pick-to: 6.5 6.6
Change-Id: If54fe2b0af32a097cac6f485900ec5e353d92dd9
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-01 09:04:52 +03:00
Thiago Macieira
cff13c2417 QMetaType: fix recursive detection of std::optional operators
Commit ca54b741d6 used the internal
has_operator_equal (and commit 01d94760d8
copied that for has_operator_less_than) instead of using the recursive
expander that was being used here. That assumed that the contained type
in std::optional would always be the last final check, which is an
incorrect assumption.

Fixes: QTBUG-115646
Pick-to: 6.6 6.5
Change-Id: Ifbf974a4d10745b099b1fffd177702934bec27ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-31 18:43:55 -07:00
Laszlo Agocs
c6fce818db rhi: Guard QRhiVulkan more in qrhi_platform.h
Replicate qvulkaninstance.h's logic. The idea being to allow
to compile code that uses QRhi (so includes qrhi.h) with a pre-built
Qt that was built with Vulkan support, but there is no Vulkan SDK
(and so vulkan.h) on the developer's system. Normally this is not
something we care about, e.g. compiling an application using
QVulkanInstance or any other Vulkan functionality implies one has
to have the SDK installed or at least the headers available in one
way or another.

However, including qrhi.h (and so qrhi_platform.h) happens in some
cases in applications that do not themselves initialize a QRhi,
i.e. they do not care about the QRhiVulkan* structs, because
they only ever use a QRhi retrieved e.g. from the QQuickWindow.
Design Studio is one example. To allow building DS against a Qt
that is Vulkan-enabled (e.g. the official Qt releases) but in
an environment that has no Vulkan headers, we skip the QRhiVulkan*
stuff when there is no vulkan.h available.

Pick-to: 6.6
Change-Id: Ic81250e6c90939a38f79cab1438fbb9f483f56df
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2023-08-01 00:58:22 +02:00
Marc Mutz
c1a95d1d0c QtConcurrent::run: point return value ignorers to QThreadPool::start(Callable&&)
Use the new Q_NODISCARD_X macro to point users that ignore the QFuture
returned from QtConcurrent::run() to QThreadPool::start(), which does
the same thing, but doesn't return a future, so is better suited for
the fire-and-forget use-case the OP of and commentators on
QTBUG-111875 cited.

Can't pick to older branches, since Q_NODISCARD_X is 6.7+.

Task-number: QTBUG-111875
Change-Id: If0bf920ecc0fb59b9a9a9931ea9dc30f7abff1b7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-31 20:09:03 +00:00
Marcin Zdunek
f8cb42e391 Redefinition of root on qstorageinfo_stub.cpp
Change-Id: If35fddc8f23a1f8f610a318472d2f59cae81f144
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-31 19:57:15 +02:00
Axel Spoerl
9a39ad8dfb Remove assertion in QAndroidPlatformScreen::addWindow()
QAndroidPlatformScreen::addWindow() asserted the existence of a backing
store, when a window is added. But QQuickWindow neither needs nor has a
backing store.

This patch removes the assertion, which was introduced in
dbb072eb28

Task-number: QTBUG-97482
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ifb43f83d39e16b972754e86d0ff9633f58dac3f8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-07-31 16:19:48 +00:00
Edward Welbourne
2e9d33e534 Use correct index for QLocale::system()'s static
Nothing prevents client code from calling QLocale::setDefault() before
we ever instantiate QLocale::system() - aside from some quirks that
mean setDefault(), currently, does instantiate QLocale::system() to
force initialization of defaultLocalePrivate - so using defaultIndex()
could set the system QLocalePrivate instance's index incorrectly.

In any case, even if the index is initially set correctly, a
subsequent change to the system locale would change the correct index;
and nothing outside QLocale::system() has access to the instance that
would then be remembering an out-of-date index.

Actually tripping over that inconsistency took some deviousness, but
was possible. The index is (currently) only used for month name
lookups and those special-case, for the Roman-derived calendars, the
system locale, to only use the index if the system locale offers no
name for a month. Meanwhile, updateSystemPrivate() uses the fallback
locale's index for its look-up of which CLDR data to copy into the
fallback QLocaleData for the system locale.

None the less, a non-Roman calendar's lookup will go via the index to
get at the CLDR data for that calendar, thereby exposing the system
locale's index to use; and, sure enough, a setDefault() could lead
that to produce wrong answers.

In QLocale::system() there's a cached QLocalePrivate, whose index we
need to ensure stays in sync with the active system locale. So pass
its &m_index to systemData(), which will now (when passed this) ensure
it's up to date. Since we always have called systemData(), to ensure
it is up to date, we can skip that update in the initialization of the
cached private and use m_index = -1 to let systemData() know when it's
in the initial call, thereby making the static cache constinit.

Amended a test to what proved the issue was present.

Change-Id: I8d7ab5830cf0bbb9265c2af2a1edc9396ddef79f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-31 17:16:14 +02:00
Ievgenii Meshcheriakov
ee43dacbea QDBusPendingCallPrivate: Remove declaration of fromMessage()
The member function is never implemented.

Change-Id: Iee93c7d24df40b48b897d937889bb9556b8feb1a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-31 16:01:22 +02:00
Liang Qi
552e3b9b78 xcb: guard a pointer before usage
in QXcbAtom::initializeAllAtoms().

See also the example in
https://manpages.debian.org/testing/libxcb-doc/xcb_intern_atom_reply.3.en.html

Fixes: QTBUG-115599
Pick-to: 6.6 6.5 6.2
Change-Id: I6590fe1aa11deec7fef7ce6d8f5c49a71d636648
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-31 13:40:27 +02:00
Laszlo Agocs
cdae120f7f Handle Null rhi backend in backingstore
Was missing for some reason when this got added in 6.4.

Pick-to: 6.6 6.5
Change-Id: I4f8b780c7119649688d8d8a197e8ef59730b0b61
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:41 +02:00
Laszlo Agocs
d907f1aa92 rhi: Run cleanup callbacks before the pending deletes
If a callback deleteLaters a QRhiResource that should still be
handled and not left unreleased. Swap the order.

Pick-to: 6.6 6.5
Change-Id: I8419a28a9db5bb59f768ab5820dfaf593464d6d2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:41 +02:00
Laszlo Agocs
84873c898c rhi: Enable registering cleanup callbacks with a key
And the ability to deregister.

Going to be required by QRhiWidget.

Change-Id: If185cbed2faa042098ac1f6bb1d6daaffd834377
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:40 +02:00
Laszlo Agocs
f9d473ac72 rhi: vulkan: use the clamped api version for vma
caps.apiVersion is inst->apiVersion() limited by the version the
physical device reports. Therefore, use caps.apiVersion when
setting up the memory allocator, like it is done everywhere else.

This is expected prevent vma init failures on lavapipe in some Linux
distros.

Pick-to: 6.6 6.5
Change-Id: I4e693820c95a5e0174846afb20e42aadd56034d6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:40 +02:00
Laszlo Agocs
108b101441 Handle rhi init failures better in rhi backingstore flush
One may very well force a 3D API not functional. In this case there will
be no QRhi. A bunch of warnings will be printed (which is good), but
then flush() should not do anything, and that was not handled before.

Pick-to: 6.6 6.5
Change-Id: I82139070311152c959d39a553842f4462d8e7811
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:40 +02:00
Laszlo Agocs
e98ee5f6f4 rhi: metal: Centralize command buffer creation
...and add a single toggle that can be used to switch between
regular (auto-retaining) and unretaining command buffers.

Change-Id: I9ef4b149f172415733e590e8320165358e29fa16
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-07-31 12:38:40 +02:00
Laszlo Agocs
eb99d19cc4 rhi: d3d12: Implement lastCompletedGpuTime via timestamp queries
Change-Id: I5f2588268cf4d52025f9b1c8d94cdcd9a742531c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-31 12:38:40 +02:00
Jens Trillmann
7012bea614 Improve Intent source app detection
Activity.getReferrer does not only return app IDs but also URLs if
Intent.EXTRA_REFERRER is set on the Intent. In the case of Chrome the referrer
is set to the website triggering the Intent. To improve the detection of the
calling app we check first if the browser specific
Browser.EXTRAS_APPLICATION_ID is set. If it is not set we fall back to
Intent.getReferrer.

Pick-to: 6.6 6.5
Change-Id: I33d1edd52de98486d9616713e531ea20ada87bcb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-07-31 09:38:56 +02:00
Ahmad Samir
b902b152af QObject: replace _q_reregisterTimers with a lambda
- Pass the QList by value, no heap allocation and no plain new/delete
- A lambda means that there isn't runtime string-based lookup to find
  the member method in QObjectPrivate

The code is only a couple of lines and used in a single place, so might
as well move the code from _q_reregisterTimers to the local lambda.

Modify tst_moc to account for the numer of methods in QObjectPrivate
changing. The test had hardcoded numbers.

Change-Id: I07906fc7138b8e601e4695f8d2de1b5fdd88449c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-31 01:52:25 +03:00
Laszlo Agocs
e8e9c287ec doc: Fix QVulkanFunctions code snippet
Showing code that cannot possibly compile is bad practice.
(vkAllocateCommandBuffers is in QVulkanDeviceFunctions, not
QVulkanFunctions)

Rather use a member function that is actually in QVulkanFunctions.

Pick-to: 6.6 6.5 6.2
Change-Id: I3063a8a229152144ce866e915eb4c14ecc58e9ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-07-30 20:12:20 +02:00