Commit Graph

60095 Commits

Author SHA1 Message Date
Antti Määttä
c6ba34c7f8 Trace: Autogenerate metadata in qtgui module
Pick-to: 6.5
Change-Id: I300ecb9d25f0ecb7208c643704adf66bdf0a4b56
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-02-10 18:03:35 +02:00
Antti Määttä
c5d4c9345b CTF: Move event metadata generation to the wrapper
This fixes the metadata generation when cross compiling. The metadata
needs to be generated based on the type info of the target. Currently
the metadata is generated in the tool based on the host type info.

Task-number: QTBUG-110270
Pick-to: 6.5
Change-Id: Ibcdcbd690620afc532d6007cf036229342bdcc31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-10 18:03:34 +02:00
Antti Määttä
b652d9753b CTF: Fix plugin cleanup
Handle cleanup of the CTF plugin correctly. The cleanup causes recursive
trace event so the plugin needs to handle this.

Pick-to: 6.5
Change-Id: Id6f4c6efe95e51332a8be97fecdf7886ba173e43
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2023-02-10 18:03:34 +02:00
Tasuku Suzuki
29e739f938 Fix build with -no-feature-textedit
qtbase/src/widgets/styles/qstylesheetstyle.cpp: In function ‘quint64 extendedPseudoClass(const QWidget*)’:
qtbase/src/widgets/styles/qstylesheetstyle.cpp:2577:1: warning: control reaches end of non-void function [-Wreturn-type]
 2577 | }

Pick-to: 6.5
Change-Id: Id53d637d43a8d530a7bdfbd7d5b823162d1399b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-10 15:34:08 +00:00
Tasuku Suzuki
79b8bf983d Fix build with -no-feature-gestures
Disable xcb touchpad gesture when gestures is not available

Pick-to: 6.5
Change-Id: Idd2fec38646fad4cbda20ab1e560949c8e8844ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-11 00:34:08 +09:00
Tasuku Suzuki
3932417dc9 Fix build with -no-feature-toolbutton
Pick-to: 6.5
Change-Id: Id583165602e84ea0fae972c377ced30e4a4d96cb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-11 00:34:08 +09:00
Liang Qi
bb84232b05 fbconvenience: use smart pointer for QFbCursor
Pick-to: 6.5 6.4 6.2 5.15
Fixes: QTBUG-110785
Change-Id: Id82fc300c5716ce68a2609b7fb36195f2d37e322
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-02-10 13:56:34 +00:00
Eskil Abrahamsen Blomfeldt
fc33fea999 Don't do font merging for PUA characters
The "Private Use Area" are subsets of Unicode which are not
considered regular characters, but reserved for fonts to provide
custom glyphs.

If these were used and the main font did not have support for them,
we would look them up in other fonts and sometimes display an
arbitrary selection of glyphs, based on whatever existed on the
platform. This is unexpected and different from how native apps
work on Windows, for instance.

[ChangeLog][QtGui][Text] Font merging (automatic assignment of
alternative fonts) is no longer applied for characters in the
Private Use Areas of Unicode.

Pick-to: 6.5
Fixes: QTBUG-110502
Change-Id: Id2c63786aafda59bf170e0d7263eb78a391fe46d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-10 14:56:34 +01:00
Matthias Rauter
9086bc7fd3 Return transparent background color if no brush is set
Fixes: QTBUG-110751
Pick-to: 6.5
Change-Id: I6fa33ba22b0209da6c9e1022851f84c892a5ae5f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-02-10 14:11:12 +01:00
Antti Määttä
e3fdd9715f Trace: Use includes instead of forward declarations
Some platforms do not work with forward declarations, mainly android.

Pick-to: 6.5
Change-Id: Ie34a30ecb8554d77c1bea4b65a752d63ba819af9
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-02-10 12:39:48 +02:00
Antti Määttä
63b164aa2f Trace: Convert qtwidgets module to use tracepointgen tool
Pick-to: 6.5
Change-Id: Iaa993387ecbaeab66c1bd226a85c9ab6d876b157
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-02-10 12:39:48 +02:00
Antti Määttä
4d359e2bec Trace: Convert qtopengl module to use tracepointgen tool
Pick-to: 6.5
Change-Id: I441455a4d49a559fb591ea5c8cffb97af66fb2b1
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-02-10 12:39:48 +02:00
Antti Määttä
4ce1c1d932 Trace: Convert qtcore module to use tracepointgen tool
Pick-to: 6.5
Change-Id: I379896280a16cd0b94d7ee9d0cfcca4afe64b9fe
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-02-10 12:39:47 +02:00
Antti Määttä
59aa9e86c6 Tracepointgen: Parse metadata from include files
The tracepointgen tool needs to know the enumeration/flag names
and values in order to generate metadata for the tracepoints
in order to pass this information when tracing.

Currently the metadata needs to be provided to the tracepointgen by
hand. This implements metadata parsing from header files.

Task-number: QTBUG-110598
Pick-to: 6.5
Change-Id: Ibb2cc6e724fd2defca4e301af2285b0fdbe8e7f7
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-02-10 12:39:47 +02:00
Samuli Piippo
991c321f39 IPC/QSharedMemory: add missing include
Include header defining MAP_FAILED for SysV sharedmemory to fix:

src/corelib/ipc/qsharedmemory_systemv.cpp:175:25: error: ‘MAP_FAILED’ was not declared in this scope; did you mean ‘AF_FILE’?
  175 |     if (self->memory == MAP_FAILED) {
      |                         ^~~~~~~~~~

Change-Id: Ia30539d90faad911909f2556b655758ddea6efdb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-10 08:08:09 +02:00
Ahmad Samir
b5a54d488c QDir: use QCollator when doing locale-aware sorting
And don't use toLower() as QString::compare() and QCollator::compare()
can compare case-insensitively.

Change-Id: I999d787cb77e10a101da75d1bf0a5baf096a5c9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-10 01:19:21 +02:00
Ahmad Samir
eb60e94020 QString: don't detach in replace_helper()
I.e. don't detach in the replace() overloads that delegate to
replace_helper() if this string is shared, instead create a new string
and copy characters from this string to it, along with the "after"
string, then swap it with this.

Do the same thing if "before" is shorter than "after" and there isn't
enough capacity to do the replacement without reallocating.

Use std::copy* and std::move*, which will both fallback to
memmove/memcpy, but they have C++ API, which is more readable.

[ChangeLog][QtCore][QString] Using replace() on a currently shared
QString is now done more efficiently

Task-number: QTBUG-106184
Change-Id: If74ffa1ed47636dc23d543d6dc123d8f2b21d537
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 22:52:01 +02:00
Friedemann Kleint
fc3a9ee601 QtCore: Add exclusions for Unity builds
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I055fbc29e85cbb58af9c5a423f6f7be4fbb0c40a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 20:12:42 +01:00
Jan Grulich
c2d3d0c0e2 QPasswordDigestor: add OpenSSL 3.0 support to deriveKeyPbkdf2
Use OpenSSL 3.0 in deriveKeyPbkdf2() if it's available. This currently
produces same results, but in the future we will have possibilities to
force some additional compliancy, for example we can enable SP800-132
compliance checks, which are not enabled currently because it would
differ from the original implementation.

Change-Id: Ia7a7cc91ea3f20c9d76e39309daa7c97cd7ad5c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-09 19:30:15 +01:00
Tor Arne Vestbø
92f5836fe8 Prepare for replacing Qt::Appearance with Qt::ColorScheme
Based on discussions in the 6.5 API review, where we concluded that
'appearance' is too general. Instead, we follow the CSS standard
and use the term 'color scheme'.

This patch is a first step, only introducing the new API, so that
submodules can port over. The next step will be to remove the old
API and transition the docs and platform themes.

Pick-to: 6.5
Change-Id: I43cdb6bb1ccb49c535c06b1897821467fd83ca60
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-02-09 18:55:37 +01:00
Mårten Nordheim
0f50145e43 QSysInfo: Work around erroneous warning output from Windows
gethostname is in no way labeled deprecated, but it _tries_ to query
some deprecated functionality, thus some warning like this is printed:

""
LogHr(1) tid(6e14) 8007277C No such service is known.
The service cannot be found in the specified name space.
""

By using GetComputerNameEx we work around that. Bonus side effect is
that it gives us UTF-16 right away so we save a conversion.

Fixes: QTBUG-110468
Pick-to: 6.5
Change-Id: I3a370354d9cce50e3d89d125ce61fc9b619294cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-02-09 18:55:37 +01:00
Mårten Nordheim
08ea2c5dc8 QDateTime: Fix inline use of deprecated ctor
FTBFS with clang-cl. Errors out due to no conversion between
TimeSpec and TimeZone.

Solution is simple: the default is LocalTime, so drop the 3rd argument.

Change-Id: I27307f72680836b0a142aa49e5e9653996a0b2fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-02-09 17:55:37 +00:00
Marc Mutz
da8fa2d08e QRhi: fix potential ODR issue (operators for foreign types)
We mustn't define operators or hash functions for types we don't own,
esp. not in a header file, because when someone else gets the same
idea, we have an ODR violation, unless they get it token-for-token the
same as our implementation.

One option would be to replace the QHash with an STL container. Those
can take per-container Hash and Equal function objects, so we wouldn't
need to declare the global ones.

But let's use a wrapper around the type on which we define the missing
operators instead.

As a drive-by, rename the arguments to the idiomatic lhs/rhs/key, from
a/b/s.

Change-Id: Ibbc2083bcd7423c5d443a0ca1b820cbecb241865
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-09 18:55:37 +01:00
Ahmad Samir
3a3b76e040 QString: don't detach in insert(qsizetype, QUtf8StringView)
If the string is shared, instead of detaching (which would copy the
whole string data before doing the insertion), create a new string and
copy characters to it as needed then swap it with "this".

[ChangeLog][QtCore][QString] Inserting Utf8 data (e.g. a
QUtf8StringView) into a currently shared QString is now done more
efficiently.

Task-number: QTBUG-106186
Change-Id: I832bde1494108685cc2f630750dfe9b38cd96931
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:50:02 +02:00
Ahmad Samir
5f73f48556 QString: optimize insert(qsizetype, QUtf8StringView)
Utf8 data is variable-width, ideally we want to write characters at most
once, so insert directly into the QString buffer if inserting at the end
(by delegating to append(QUtf8SV)), and use an intermediate buffer to
hold the converted data before inserting anywhere else.

Task-number: QTBUG-108546
Change-Id: Iabfaeecaf34a1ba11946bd67951e69a45d954d6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:49:54 +02:00
Ahmad Samir
cc6324665e QString: don't detach in insert()
Instead of detaching when the string is shared, or if the the insertion
would cause a reallocation, create a new string and copy characters to
it as needed, then swap it with "this" string. This is more efficient
than detaching which would copy the whole string before inserting, as
some characters would be copied multiple times.

Use detachAndGrow(), otherwise QStringBuilder unitests fail:
PASS   : tst_QStringBuilder1::initTestCase()
FAIL!  : tst_QStringBuilder1::scenario() 'prepends < max_prepends' returned FALSE. ()
   Loc: [tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp(61)]
PASS   : tst_QStringBuilder1::cleanupTestCase()

The issue is that now when inserting, if the string is going to
reallocated, we create a new string, so the freeSpaceAtBegin()
optimization doesn't work the same way.

void checkItWorksWithFreeSpaceAtBegin(const String &chunk, const Separator &separator)
{
    // GIVEN: a String with freeSpaceAtBegin() and less than chunk.size() freeSpaceAtEnd()
    String str;

    int prepends = 0;
    const int max_prepends = 10;
    while (str.data_ptr().freeSpaceAtBegin() < chunk.size() && prepends++ < max_prepends)
        str.prepend(chunk);
    QVERIFY(prepends < max_prepends);
    ...
    ...

each str.prepend() would have reallocated.

[ChangeLog][QtCore][QString] Calling insert() on a currently shared
string is now done more efficiently.

Task-number: QTBUG-106186
Change-Id: I07ce8d6bde50919fdc587433e624ace9cee05be8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:49:26 +02:00
Ahmad Samir
67108ef8db QString: split some code from insert() overloads to a static helper
A side-effect of this change is that now almost all insert() overloads
will have the prepend-optimization as the QADP grows at the beginning if
inserting at index 0.

Change-Id: I49c0471ddb02cbbe61a13977650f0993e80040fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:49:15 +02:00
Ahmad Samir
4d7dfd29d1 QString: refactor two insert overloads
Namely insert(qsizetype i, QLatin1StringView) and insert(qsizetype,
const QChar *, qsizetype).

Instead of using d->insert(), tell d.detachAndGrow() to grow at the
beginning if inserting at index 0.

The next commit will split the common code between these two overloads
to a static helper. (Done in multiple steps to make it easier for me to
see what is being changed, and easier to git bisect if needed ...etc).

Change-Id: Idf939df10cca49cb13b66a36b3cf155561630959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:49:05 +02:00
Ahmad Samir
26fec96a81 QString, QByteArray: don't detach in removeIf/erase/eraseif()
If the object is shared, instead of detaching, copy characters from
"this" to a new object except for the chacters that would be erased,
this is more efficient than detaching (which would copy the whole data
then erase).

- Extend tst_QString::removeIf() to catch a corner-case (that I saw
  with tst_QByteArray::removeIf()).

- Add q_uninitialized_remove_copy_if, which works like
  std::remove_copy_if but for uninitialized memory like
  q_uninitialized_relocate_n (but copies rather than relocates/moves).
  With the same static_assert from q_relocate_overlap_n that the type
  destructor is non-throwing.

Added q_uninitialized_remove_copy_if in this commit rather than a
separate one so that it's unittested by its usage in eraseIf().

[ChangeLog][QtCore][QString, QByteArray] Removing characters from a
currently shared string or byte array is now done more efficiently

Task-number: QTBUG-106181
Task-number: QTBUG-106183
Change-Id: Icc0ed31633cef71d482b97e0d2d20d763163d383
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-09 16:46:39 +02:00
Alexey Edelev
478a5248f3 Expose files locating in QT_ANDROID_PACKAGE_SOURCE_DIR to IDE
"GLOB_RECURSE" files in the QT_ANDROID_PACKAGE_SOURCE_DIR directory
if it's specified and expose them to IDE.

Fixes: QTBUG-110810
Pick-to: 6.5
Change-Id: I3c4d4fdf0dff8965fd277672ef9d77453839b4cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 12:59:40 +01:00
Alexey Edelev
108424f558 Reset the _qt_expects_finalization flag
Reset the _qt_expects_finalization flag after the qt6_finalize_target
call. Otherwise the dependent functionality will still expect the
finalization.

Change-Id: Ieb10d1ee7b3156443e010f916d68da5f2e5779b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 12:59:37 +01:00
Kai Köhne
8fef0f0400 Doc: Mark new QShortcutEvent constructor with \since
Pick-to: 6.5
Change-Id: I32580a29e3d5bbeca2832c421e07cec094e9576d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-09 12:48:25 +01:00
Joerg Bornemann
6c28528e40 CMake: Fix directory scoping issue for qt6_generate_deploy_script
Consider a Qt target created in a subdirectory and a call to
qt6_generate_deploy_app_script(target) in the parent directory.

Once qt6_generate_deploy_script (called by
qt6_generate_deploy_app_script) is run, the target has already been
finalized. However, qt6_generate_deploy_script needs to run before
finalization, because:
- qt6_generate_deploy_script marks the target as to be deployed
- the finalizer generates plugins information only if the target was
  marked to be deployed

Fix this in qt6_generate_deploy_script by checking whether the target
was already finalized. In that case, generate the plugin deployment
information right away.

Pick-to: 6.5
Fixes: QTBUG-109741
Change-Id: Idf60f9e21f038c1a33843177d9299230857ee70b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 11:27:29 +01:00
Antti Määttä
5ae8417c4f Add Q_TRACE_LOCATION to android support
This is needed for tracing android devices.

Pick-to: 6.5
Change-Id: Ic04e15b43b426bdb1232e671acb4163165eab666
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-02-09 08:43:49 +02:00
Lorn Potter
56068f3a36 wasm: fix multitouch processing
Not all touch points are changed as per emscripten event, so we
do not need to remove or add them to the touch event

Fixes: QTBUG-110941
Pick-to: 6.5
Change-Id: I4799ef0c05750a36361836698eb83e5bf844ece8
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-02-09 14:45:35 +10:00
Marc Mutz
230bc059ae QVarLengthArray: use new q20::construct_at instead of raw placement new
The former is much safer to use in the presence of overloaded operator
new, and forms a tiny step towards a fully C++20-constexpr QVLA in the
future.

Pick-to: 6.5
Change-Id: If1b31c06296a60c39f1c9f9da523e208ecb1248b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-09 05:01:09 +01:00
Amir Masoud Abdol
ed26352a10 Add -unity-build, and -unity-build-batch-size to configure
If -unity-build-batch-size is not given, we default to CMake's default
which is 8. In QtSetup.cmake, we explicitly set the default to avoid
having it set to OFF in case it is missing, just to make sure that we
don't get any unintended behavior.

Task-number: QTBUG-109394
Change-Id: I19849e9baa507b64fb23847c740e20a7adc61b8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-09 04:23:06 +01:00
Volker Hilsheimer
48a1a5564f Examples: move widgets/codeeditor into manual tests
It's not a very well written example, using (largely unneed) hacks to
implement what it does. It's also misleading - the syntaxhighlighter
example is a better showcase for building a useful code editor.

Move it to manual tests.

Fixes: QTBUG-111025
Pick-to: 6.5
Change-Id: I405d41688235bf3e9a08373e716769f26d02fec6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-02-09 00:23:34 +01:00
Volker Hilsheimer
3fe0bf6e1b Move findfiles example into manual tests
The example follows bad and outdated practices:

- running time consuming and I/O heavy workload in the GUI thread
- calling processEvents to keep the UI responsive
- showing results only at the end of a search rather than continuously

Perhaps this example can be rewritten at some point to apply modern
practices (at least use a thread and emit signals), but it seems
to have low overall educational value.

Moving it to be a manual test for now.

Fixes: QTBUG-111002
Pick-to: 6.5
Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-09 00:23:34 +01:00
Volker Hilsheimer
55f2b448b0 Turn elidedlabel example into a code snippet
The example is 90% boiler plate for subclassing QFrame and providing
a bit of GUI to change the size of the label using sliders. The
interesting bit is a block of 25 lines of code, so turn those into a
snippet and add that to the QTextLayout overview documentation.

Fixes: QTBUG-111011
Pick-to: 6.5
Change-Id: I6e97b2ea47b553c8d998ad185cfac006721ef7ee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-02-09 00:23:33 +01:00
Amir Masoud Abdol
31518f1a4e Add some utilities for UNITY_BUILD
- The following commands accepts NO_UNITY_BUILD, and
  NO_UNITY_BUILD_SOURCES arguments to opt out of the unity build, and
  to exclude some source files from unity build, respectively.
  - qt_internal_add_executable
  - qt_internal_add_module
  - qt_internal_add_plugin
  - qt_internal_add_tool
  - qt_internal_extend_target
  - qt_internal_add_common_qt_library_helper
  - qt_internal_add_cmake_library
  - qt_internal_add_simd_part
- Unity build is disabled by default in these:
  - qt_internal_add_test
  - qt_internal_add_test_helper
  - qt_internal_add_benchmark
  - qt_internal_add_3rdparty_library
- qt_update_ignore_pch_source also excludes the files from unity_build

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I5d0e7df633738310a015142a6c73fbb78b6c3467
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-08 23:47:07 +01:00
Christian Ehrlicher
66a1a71f1f Fix QVariant(QString) <-> enum conversion
A QVariant(QString) was not convertible to an enum not registered with
Q_ENUM() which worked fine in Qt5.
The same problem exists for QVariant(enum) to QString.
Fix it by not bailing out when no metatype for the enum was found and
try to convert it to a qlonglong instead (which is then correctly
converted to the enum type).

Fixes: QTBUG-109744
Pick-to: 6.5 6.4
Change-Id: Ie7bb016a860455b69508f0f46b36474c9c294f3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-02-08 23:20:42 +01:00
Christian Ehrlicher
e30ed4d431 SQL/DB2: apply misc changes
Similar to the ODBC changes from 901c86032c

Change-Id: I552b2e43d380080bfac62d61b0e27ba42d13024d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-02-08 23:20:42 +01:00
Dennis Oberst
7cbdc8abbd QVarLengthArray: add STL-style assign()
Implemented assign() methods for QVarLengthArray to align
with the criteria of std::vector, addressing the previously
missing functionality.

Reference:
https://en.cppreference.com/w/cpp/container/vector/assign

[ChangeLog][QtCore][QVarLengthArray] Added assign().

Fixes: QTBUG-106200
Change-Id: If671069808ff561b0f4c77b6c7f7aca360a0c663
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-02-08 21:13:08 +01:00
Friedemann Kleint
65cda1f06a QtGui: Add a header declaring the Windows image conversion functions
The declarations with default parameters cause
conflicts in CMake Unity (Jumbo) builds.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Icf48193498d70dfacadf1b2499cb3359169f72c0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-08 21:13:08 +01:00
Mårten Nordheim
eb585d63ca Move qHash function for a Windows type into global namespace
Otherwise leads to QHash being unable to find it upon usage:
qtbase/src/corelib/tools/qhash.h(64): error C2338: static_assert failed: 'The key type must have a qHash overload or a std::hash specialization'
qtbase/src/corelib/tools/qhash.h(665): note: see reference to function template instantiation 'size_t qt::QHashPrivate::calculateHash<D3D12_SAMPLER_DESC>(const T &,size_t)' being compiled

Since we rely on ADL for qHash the qHash overload should live in the
same scope as the original type.

Change-Id: I701447c49076980a1aed47d64ba8ac3358cf8b1c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-02-08 20:07:41 +01:00
Mikolaj Boc
a1867208a6 wasm: Don't grab menu bar item shortcuts on Mac
On Mac there's no concept of menu bar alt+key shortcuts. Therefore we
cannot expect users on Mac, even when in a web application, to be
familiar with those. Additionally, alt+key combinations yield special
characters on Mac so that is the behavior we should support in WASM apps
on Mac.

To disable the menu bar item shortcuts, a new platform style hint
UnderlineShortcut was created. Shortcut grabbing was disabled exactly
the same as on regular Mac builds, i.e. through
qt_set_sequence_auto_mnemonic.

Task-number: QTBUG-76587
Change-Id: Ice6ed123c01e46b58d6d2c3e639813161b5a9a40
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-02-08 20:07:40 +01:00
Volker Hilsheimer
d3dfe5a3b7 Silence some qdoc warnings
\internal needs to be on its own line, otherwise qdoc doesn't know what
\a means.

Pick-to: 6.5
Change-Id: Ie7bd2fd779540b8d7ea92f9d1dd94e73a771d2b6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-02-08 20:07:40 +01:00
Marc Mutz
ac6e8b3b21 savegame ex.: fix include order [2/2]: game.h
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.

This example didn't follow that guideline. Fix.

Amends 88e8094f18.

Task-number: QTBUG-108857
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-08 18:24:17 +01:00
Marc Mutz
fa55d46e1f savegame ex.: make Level ctor explicit
A QString is not a full representation of a Level, so the
Level(QString) ctor should be explicit.

Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-108857
Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-08 18:24:16 +01:00