Commit Graph

46146 Commits

Author SHA1 Message Date
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