Commit Graph

55633 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
979ee48ca1 QObject: add another couple of tests for broken connect()
Connecting to a non-signal should fail, but apparently it doesn't on
Windows+MSVC under certain conditions.

Task-number: QTBUG-101761
Change-Id: I3e014660e4e5b287242e32307f677bb22ab10a39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-17 01:02:15 +00:00
Michal Klocek
2f894293ae Add missing install of pnglibconf.h for static builds
Installing only pngconf.h is not enough.

This commit amends be2745e478

Pick-to: 6.3
Change-Id: I8de1565434c315c7197d4602a8460ead794176d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-16 20:19:22 +01:00
Tatiana Borisova
715420095a Fix has_signaling_NaN usage for INTEGRITY
- The newest GHS compiler versions set the value of has_signaling_NaN to False.
  Add compilation and autotest fix for GHS-compiler 2021/2022 releases.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I45e5da6759a15c60c17f896e565002cbba8524ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 20:09:37 +02:00
Marc Mutz
1977c922e9 QFlatMap: make insertion STL-compatible
That is, insert() doesn't overwrite an existing entry, and range
insert inserts the first of equivalent keys' values, not the last.

This allowed this author to optimize the implementation of
makeUnique() to a O(N) algorithm (was: O(N²)). Said optimization would
have been possible with the old semantics, too, but I wrote the
algorithm first and only then noticed the broken insert() behavior is
present on QFlatMap, too, so I decided not to let good code go to
waste and to fix both problems at the same time.

In order to give users a hint of the changed semantics, make the new
API opt-in until Qt 6.5, so Qt 6.4 ships with the both the old and the
new semantics disabled, where they contradict.

Fixes: QTBUG-100092
Change-Id: Ic96d8bfe6bed9068dbe8c0d7171bd8921050fd95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-16 18:28:27 +01:00
Kai Uwe Broulik
e516a7bcf8 QAction: Add NOTIFY changed declaration to priority property
It already emits the signal and was merely missing the declaration.

This fixes warnings about depending on non-NOTIFYable properties
when binding to the priority property from QML.

Pick-to: 6.3 6.2
Change-Id: Ia91ae5d00d722bdb2fc1f89671c3e7faab4b129f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-16 17:28:27 +00:00
Volker Hilsheimer
58a14d9433 Enable tests to turn off Windows Vista animations
Animations in that style depend on the current time, which makes it
impossible to run baseline tests. Introduce a dynamic property that
allows us to set the time that animations use.

This way, tests can turn the animation off, or control which time should
be used.

To keep performance overhead low, check only once whether the dynamic
property is set at all.

Pick-to: 6.3
Change-Id: I9bc57b9867fb0d852e101570eca4c7609e7fe1a8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-16 15:56:17 +01:00
Kai Köhne
9f5f64e9db Use QDebugStateSaver in example operator<<()
This makes sure that changes in the debug stream - like nospace() -
do not "leak". Also use the example snippet in QDebugStateSaver
documentation.

Pick-to: 6.2 6.3
Change-Id: I934976d2c7c2335abfec68c763526a5cbb0e6f1e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:17 +01:00
Alexandru Croitor
21bffeec90 CMake: Add deployment auto test
Add a cmake test that builds a simple widgets application, installs
it, in a shared Qt build deploys the runtime dependencies and then
runs it to confirm that the app works.
With a static Qt, the installation of the runtime dependencies is
skipped, but the app should still run.

The test is expected to pass only when targeting Windows and macOS
(both when using shared and static Qt).

Pick-to: 6.3
Task-number: QTBUG-98545
Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:17 +01:00
Alexandru Croitor
d1c56073b4 CMake: Don't rely on CMAKE_FIND_ROOT_PATH_MODE_PACKAGE for examples
We shouldn't set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH when
cross-building examples without ExternalProjects.

Instead append the $build_tree_prefix to CMAKE_FIND_ROOT_PATH
and $build_tree_prefix/lib/cmake to QT_EXAMPLES_CMAKE_PREFIX_PATH
to circumvent the usual CMake path-rerooting issue.

This ensures that the build-tree Config files are found by the in-tree
find_package calls when cross-building examples.

Pick-to: 6.2 6.3
Task-number: QTBUG-96232
Change-Id: I4e31f0bf3dbfeb4339823fe09addda3ae83f12c3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:17 +01:00
Alexandru Croitor
c89da21249 CMake: Fix cross-building examples in prefix builds as ExternalProjects
For examples to successfully find not yet installed Config files in a
prefix cross-build, both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH
need to be adjusted when toolchain files set
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY.

Before this change, we lacked two things.

1) If the chain-loaded toolchain file sets CMAKE_FIND_ROOT_PATH
(instead of appending), then the initial value of CMAKE_FIND_ROOT_PATH
that was passed by ExternalProject's initial cache would be
overridden.

2) The prefixes we passed via QT_EXAMPLES_CMAKE_PREFIX_PATH did not
end in lib/cmake, to work around the path re-rooting problem in CMake.

We can handle both of these points by using
QT_ADDITIONAL_PACKAGES_PREFIX_PATH which was introduced for Conan
usage.

Each value assigned to QT_ADDITIONAL_PACKAGES_PREFIX_PATH
gets prepended to CMAKE_FIND_ROOT_PATH by qt.toolchain.cmake AFTER the
original toolchain file is chain-loaded.

And each value also gets lib/cmake appended and assigned to
both CMAKE_PREFIX_PATH and _qt_additional_packages_prefix_paths (used
by Qt6Config.cmake.in to work with find_package + NO_DEFAULT_PATH).

This is exactly what we need to ensure examples build.

Pick-to: 6.2 6.3
Task-number: QTBUG-96232
Change-Id: I11a52457ff795a6661a3a7b68e823e0615d0ce89
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:16 +01:00
Eike Ziller
9943cf7371 QMainWindow: Fix unused separator widgets blocking mouse events
We need to hide separator widgets that are unused, otherwise they block
mouse events from the underlying widgets.

Pick-to: 6.2 6.3
Fixes: QTCREATORBUG-24600
Change-Id: I98c6d4860f683a861b89c4cad042bb734f590000
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-16 09:50:52 +01:00
Robert Löhning
d865129d9e Painting: Fix value check in isUnclipped()
left() == INT_MIN or top() == INT_MIN will still underflow
in QRect's ctor, so the check must be more strict

Pick-to: 6.2 6.3
Change-Id: I12ab148934c8c90865ca9247bd8badeedd4a9f45
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-16 02:31:10 +00:00
Robert Löhning
286a63898f Doc: Fix typos
Pick to: 6.3

Change-Id: Iaea3c0e567ddd6a72db0b2ba1731c416cf85ef47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-16 02:26:56 +00:00
Marc Mutz
e74e27e67e QObject: give some TLC to dumpRecursive()
In no particular order:

- use the variable field width feature of QString::asprintf() to
  generate the indentation implicitly, instead of fill()ing a
  QByteArray with the desired number of spaces

- just default-construct 'flags', don't assign an empty string

- use qUtf16Printable() to avoid funneling UTF-16 data through 8-bit
  encodings

- use a C++11 ranged for instead of a counted loop

- remove a pointless isEmpty() guard (the loop won't execute when the
  children().isEmpty())

- avoid copying object->children() (returns by cref, so it's also ok
  to stuff it directly into the ranged for loop).

Add a test.

Pick-to: 6.3
Change-Id: Ie7314713cb48de7e890cdee0760c0361dd24fd18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 02:26:56 +00:00
Marc Mutz
78891e5390 QString/QByteArray: = default the move ctors
Instead of relying on implicit construction of the d-pointer and then
swapping that with other.d (using overly-generic qSwap(), no less),
simply let the compiler do The Right Thing™ via QArrayDataPointer's
move constructor.

Pick-to: 6.3 6.2
Task-number: QTBUG-97601
Change-Id: I3be30f99f6fb0e17d3550edbe64cbe80880e604a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-16 03:26:56 +01:00
Mårten Nordheim
156afbc9b8 Fix qt version tagging on windows with namespaces
The libraries linking to QtCore were looking for
__imp_qt_version_tag_6_4 but the exported symbol was
__imp_qt_version_tag_NAMESPACE_6_4 (with the mangled namespace)

Change-Id: Ida7b18bea4b5e7dab9c0efb63279779d1af898cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 01:10:23 +00:00
Kai Köhne
7d5604c194 Deprecate QElapsedTimer::TickCounter
Also remove left-over code paths related to it.

[ChangeLog][QtCore] QElapsedTimer::TickCounter enum is now
deprecated. Qt does not use the Windows API behind this
enum already since Qt 5.9, so it's fair to assume that
any code path relying on the enum is dead code.

Change-Id: I308fe23658835034774e2015a8ee64659102de56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 00:30:34 +01:00
Kai Köhne
aaa3184f8d Doc: Update documentation for QElapsedTimer's in Windows
We only support Windows versions that feature the PerformanceCounter
API (see also 48fd845c61).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-84433
Change-Id: I477f9015ee8c87d31f859f529631f3a6b0215ae6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 00:30:34 +01:00
Kai Köhne
38c7c2ea30 syncqt: Do not print info about generating deprecated headers by default
Do not print information about deprecated headers when running in "quiet"
mode (-quiet argument, the default when configuring Qt modules).

Pick-to: 6.3
Change-Id: I4ea7f9251725527addef6c382b41f639048b8a9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-16 00:30:34 +01:00
Thiago Macieira
cc5cc3225d QHash: Initialize the hash seed as soon as QtCore loads
Instead of lazily initializing (with some platform exceptions, see the
equivalent qsimd.cpp commit). The rationale is the same as for
qCpuFeatures(): this the qHashBits() function is hot and the current
code generation needs to save a lot of state because of the possible
call to the C++ runtime functions to enable the thread-safe
initialization of the hash seed.

[ChangeLog][Important Behavior Changes] QtCore now initializes the QHash
global seed before the main() function is run, so it is no longer
possible to use qputenv() to affect the seed value for the current
process. Disabling the random global seed for the current process should
be done programmatically with by calling either the 6.2 function
QHashSeed::setDeterministicGlobalSeed() or, if compatibility with Qt 5
is required, by calling qSetGlobalQHashSeed() with value 0.

Change-Id: I54f205f6b7314351b078fffd16cf7eae93f9e27e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-03-15 15:05:44 -08:00
Thiago Macieira
41b2c4204b Q_DECL_INIT_PRIORITY: make the initializers actually run
The runtime runs the function pointers located between subsections $XCA
and $XCZ only, so using $QT meant it would never get run.

Change-Id: Ibf4acec0f166495998f7fffd16d8ecb19019ce10
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 15:05:44 -08:00
Thiago Macieira
9eae3e9b60 QString: reorganize the {starts,ends}With implementations
Same as the previous commit, one of the reasons it was done like this
was because of git blame. The qt_{starts,ends}_with functions that are
shared between QtPrivate:: and QString:: are getting inlined so there's
no code benefit.

Pick-to: 6.3
Change-Id: Ib42b3adc93bf4d43bd55fffd16c19a8ed3c94483
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-15 15:05:44 -08:00
Kai Köhne
54e4e42083 Doc: Remove mentioning of Windows 7, Vista from QFont documentation
We only support Windows 10 in Qt 6.

Task-number: QTBUG-84433
Pick-to: 6.2 6.3
Change-Id: I0c5bacac570dbb97a71f5af04b645d69040a5fe6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-03-15 23:05:43 +00:00
David Faure
fd4672d020 QShader: fix memory leak in detach()
qAtomicDetach() does   d = new T(*d);  which calls the copy constructor.
Since there was no copy constructor declared for QShaderPrivate,
the compiler generated one which copied the refcount over, instead of
setting it to 1 in the detached instance. As a result, the destructor
didn't delete the QShaderPrivate.

Nothing was calling this constructor that takes a pointer, so clearly
this was a typo for a copy constructor.

Detected in an ASAN build, the qsb tool exited in error.

Pick-to: 6.3 6.2 5.15
Change-Id: Idbe659b52d2600ac7c11b09142a6aa5b25310df9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-03-15 21:08:21 +01:00
Mårten Nordheim
d8d202a3ba Fix remaining uses of deprecated QScopedPointer::take
Change-Id: I804aef0aabc1c1bccdf92ff8da7b6c2f5377252a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-15 21:08:21 +01:00
Andreas Buhr
50f6356f8e Repair some of tst_qtableview tests on Android
The test task191545_dragSelectRows relied on the fact
that the view is not scrolling. But on a small screen,
it scrolls automatically.

Fixes: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: I691361c965ab03d8a012f2b83715c7c96d990ec5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Marc Mutz
bbae5c891b QFileSystemEngine: fix potential formatting error
It's not immediately clear that trashedName doesn't contain %1 or %2,
in which case the subsequent .arg() would replace that instead of the
intended %2.

Fix by using QString::asprintf(), which doesn't perform multiple
interpolation passes.

Pick-to: 6.3 6.2 5.15
Change-Id: Ib6c24bfea01db4cdc80f7547c8269cce3f815158
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-15 20:05:31 +00:00
Marc Mutz
f3c340c276 QStringTokenizer::toContainer(): allow more types of target containers
The previous constraint called for the value_type of the container to
exactly match the value_type of the tokenizer, which means
toContainer() could only ever work on containers of views. But there
is value in allowing QStringList, even though it works only on QL1S
needles (QStringView -> QString isn't implicit). But users may have
other types that for better or worse implicitly convert from views, so
we shouldn't over-constrain the function.

[ChangeLog][QtCore][QStringTokenizer] toContainer() now works on
containers whose value_type can be constructed from the tokenizer's
value_type. It no longer requires an exact match.

Fixes: QTBUG-101702
Change-Id: Ie384cd1c4b51eaa57675f2a014141ceec8651c81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Mårten Nordheim
6eda249402 Fix deprecated use of QBA/Q*String::count
'Use size() or length() instead'

Change-Id: I284fce29727c4c1ec9ea38a4e8ea13a9e0af5390
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-15 20:18:56 +01:00
Alexander Volkov
e494b39b33 Unix: Correctly update options pane for PDF printer
Update printer and m_currentPrintDevice before calling
QPrintDialogPrivate::selectPrinter() to show values for
PDF printer instead of the previously selected printer.

Pick-to: 6.3 6.2 5.15
Change-Id: Iacc34ca4460ec4de0b4b373cd875628733df01bd
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2022-03-15 19:18:55 +00:00
Andreas Eliasson
7c12eb1706 Doc: Revise Qt Core module landing page
Use new global include snippets for the 'Using the Module' section and
reorganize the sections structure. The sections should follow this
order:

- Using the Module
- Articles and Guides
- Examples
- (API) Reference
- Module Evolution
- Licenses and Attributions

Task-number: QTBUG-100369
Pick-to: 6.3
Change-Id: I239bcf53719f0036867ac1d513dc74e1bfa7bc8b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-03-15 18:00:10 +01:00
Andreas Eliasson
dc5a9eacf5 Doc: Revise Qt GUI module landing page
Move some of the sections into an overview page and reorganize the
contents structure. In addition, provide links to the different sections
that are covered in the overview.

Task-number: QTBUG-100369
Pick-to: 6.3
Change-Id: I46eb3df4a09e57f5778002ce694decf134b65e83
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-03-15 17:00:10 +00:00
Andreas Eliasson
31e78d51ef Doc: Use new global include snippets in Qt Network landing page
Task-number: QTBUG-100369
Pick-to: 6.3
Change-Id: I985d49640dbd63d48e4614063309a8130225ff57
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-03-15 18:00:10 +01:00
Assam Boudjelthia
a818885a3d Android: expect QPlainTextEdit::canPaste() to fail after clipboard clear
Android 9 introduce an API call to clear the clipboard, before that
it wasn't possible to do that, the test QPlainTextEdit::canPaste()
should expect that to fail.

Pick-to: 6.3 6.2
Task-number: QTBUG-100470
Change-Id: Ie2d8aabf77672c62b3a6c72a080a4e37f1696303
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-03-15 16:09:04 +02:00
Assam Boudjelthia
6696134644 Android: guard against potential null pointer access
androidPlatformIntegration might be called before
setAndroidPlatformIntegration() is called, and also all other
uses of androidPlatformIntegration is already guarded in our
code.

Pick-to: 6.2 6.3
Task-number: QTBUG-100470
Change-Id: Ifd7d36ba7f2f3b55652466825d7fd84c87ec5e19
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-03-15 16:09:04 +02:00
Eirik Aavitsland
f46db29d8c Painting: fix overriding and combining different clip types
In a recent improvement (6de36918c0) the
last set clip region or path was stored in separate variables, in
order to be set again if the aliasing mode changed. That solution was
too simplistic, as it would break down as soon as more than one clip
area was set, with the latter either replacing or intersecting the
first. It was also unnecessary to introduce new storing of clip areas
and transforms, as those are already recorded in the clipInfo stack in
the painter state. This patch hence reverts much of that implementation.

However the basic idea of setting the clip area again after AA change
is good, so that part is kept, implementated instead by calling a
pre-existing function to replay the clipInfo stack.

One of the baseline test cases is extended to excercise the
combination of clip areas. As a driveby, support for setClipRectF is
added to the painting baseline test scripts, and the build of the
manual lance tool is fixed.

Fixes: QTBUG-101474
Pick-to: 6.3 6.2
Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 12:45:46 +01:00
Volker Hilsheimer
1822550529 QFormLayout: Fix assert when showing with hidden rows
Amends a74cdf778c, after which the
initialization of items in invisible rows is skipped. Since data members
in QFormLayoutItem were lazily initialized, this resulted in out-of-bounds
access of QList entries.

Use member initialization for all QFormLayoutItem fields, and check that
vLayoutIndex is valid before using it to access the list entry. Skip
labels and fields for which it is not initialized.

Add test case. As a drive-by, silence the test's provoked warning
messages via ignoreMessage.

Change-Id: I374b414a51df20b9af3087a2676061fc6b7f23e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 12:45:46 +01:00
Joerg Bornemann
7d00e72677 cmake_automoc_parser: Fix issue found by CodeChecker
Fix exp63-cpp by assigning fresh values to mocEntries and mocIncludes to
get them out of the moved-from state.

Change-Id: I9ad36c0ebd922bc6a0c9e61c15be02cb987c1edb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-15 12:45:46 +01:00
Marc Mutz
0aaada0ddc QString::asprintf: check that passing field widths as arguments works
Pick-to: 6.3 6.2 5.15
Change-Id: Ifb36179b9c26ce15378f10c2947c8cb1e38e10d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
0d064328b2 De-pessimize Windows version of QSystemLocalePrivate::measurementSystem()
Don't create a QString from a wchar_t array to check that the array
contains "1\0". Just do character-by-character comparison.

Change-Id: I7e5c2348c24af6a9b046c91423a52f756ceb9eb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 10:36:09 +00:00
Marc Mutz
9da4c6bfb7 QObject: port setObjectName() to QAnyStringView
... while keeping the QString overload for users that pass actual
QStrings (e.g. QStringLiteral).

However, QString and QAnyStringView cannot be overloaded (they're
ambiguous for most arguments), so we need to make one of them a
Q_WEAK_OVERLOAD.

Normally, we'd make the new function weak and keep the old function
as-is, but, here, that would be beside the point, because all callers
would continue to resolve to the QString overload, and nothing would
call the QAnyStringView one.

So we really want the old function to be the Q_WEAK_OVERLOAD, so that
the QString overload is only selected when actual QStrings are
passed. That means we need to leave the old function in a compat build
(compiled in, but not visible in the public header). Since
Q_WEAK_OVERLOADs cannot be (easily) exported (they're templates), make
it call a private function (which can be, and is, exported).

Reviewers may questions whether one can overload

   setObjectName() and
   template <typename = void> setObjectName()

The answer is that we can, because templates mangle differently from
normal functions. We can even call the template function (with
explicit template arguments), as seen in removed_api.cpp.

This adapts the interface of the function to how most users use it:
They pass QLatin1String or just const char[]. Only very few passed
QStringLiteral, which, ignoring that fact that it produces a ton of
code for the temporary QString's destructor that's never executed,
would have been, and continues to be, the optimal way of passing data,
modulo plugin bugs (QTBUG-51602, QTBUG-49061).

[ChangeLog][QtCore][QObject] Added setObjectName() overload taking
QAnyStringView.

Fixes: QTBUG-101393
Change-Id: I1243545614754b4978d4c8641460980b6b293c1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 11:36:09 +01:00
Marc Mutz
6313a1adf5 Extract Method QObjectPrivate::ensureExtraData()
... to centralize the creation of QObjectPrivate::extraData.

Change-Id: I04e97779ceb0168fa7660e77e0dab2ed3e1ad03e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
de699decb4 QFSFileEngine: don't call QFileSystemEntry::filePath() twice
Cache the result. Clean up the return statement as a drive-by.

Change-Id: Ic1bebd4ad4dd970202701be60fbcd286b9924df5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
Marc Mutz
3636325946 QLibrary: fix possible arg() format clobbering
The fileName could potentially contain the string "%n", n ≤ 5, in
which case the following .arg() calls would interpolate their
arguments at the wrong position.

Fix by interpolating fileName last.

Pick-to: 6.3 6.2 5.15
Change-Id: I1a75a7671cbfe85ba3b2df240c3ef74482fc848d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
ce83a03cfd QColor: deprecate isValidColor, setNamedColor, string-ish ctors
[ChangeLog][QtGui][QColor] The constructors from string-ish type, as
well as the setNamedColor() and isValidColor() functions, have been
deprecated effective Qt 6.6 in favor of fromString() and
isValidColorName(), resp.

Fixes: QTBUG-101389
Change-Id: I002646bd48c1e4340dc6842fd136fc9f35bb9b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 10:36:09 +00:00
Heikki Halmet
ee0908228f Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"
This reverts commit d3a297c0ab.

Reason for revert: Unnecessary blacklisting

Task-number: QTBUG-101332
Change-Id: I1e2c94585e719199724695347b243dffcde49259
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-03-15 07:32:32 +00:00
Christian Heimlich
7f3c68316e QVersionNumber: Make documentation period display style consistent
In the current documentation for this class there are two ways that the
period character is referred to.

Code Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString
Quote Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString-1

The code-style version is significantly clearer and clean looking, while
the quote-style version is easy to misinterpret, especially when
followed by an additional period at the end of a sentence.

This change updates the documentation so that the nicer style is used in
all locations to improve clarity and consistency.

Change-Id: I11a6d82accb923e24c00b93728ea084d27efd06d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 02:48:44 -04:00
Giuseppe D'Angelo
9b8015ed8d QMutexLocker: add isLocked()
It's basically for free.

[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.

Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 03:32:14 +01:00
Thiago Macieira
07b176ce70 qversiontagging: merge the qt_version_tag symbols
The symbols all still exist, but they all have the same address. For
example, in my Linux debug build:

 $ eu-readelf --dyn-syms lib/libQt6Core.t.so | grep qt_version_tag
 4352: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_0@@Qt_6
 4356: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_1@@Qt_6
 4358: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_2@@Qt_6
 4362: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_3@@Qt_6
 4364: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_4@@Qt_6
 6458: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@@Qt_6.4
 6460: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.0
 6462: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.2
 6463: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.3
 6466: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.1

(The part after the @ is the ELF version; two @ indicates the default
version)

Saves N bytes where N is the Qt minor version number. The exclusion of
Darwin (macOS) is because clang says that it has the "alias" attribute,
but then fails when you use it.

Change-Id: I74249c52dc02478ba93cfffd16d249d77d6f7565
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 18:26:13 -08:00