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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
... 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>
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>
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>
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>
[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>
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>
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>
No longer used, since GCC and Clang always have __attribute__((used)).
Change-Id: I74249c52dc02478ba93cfffd16d2494fa632ea10
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
C++17 inline variables allow us to declare a variable that shall be
merged before linking, which replaces the need for the "comdat" part of
the inline assembly. The GCC attribute "used" tells the compiler not to
discard this variable, like the MinGW case. Additionally, the "retain"
attribute (where supported) tells both the compiler and linker not to
discard, allowing an intermediary, static library to keep this
definition.
This enables support for OSes besides FreeBSD and Linux, where it was
previously available. For example, on macOS:
$ nm libexec/rcc | grep qt_version_tag
U _qt_version_tag_6_4
00000001000ec608 s _qt_version_tag_6_4_use
On Linux, the assembly output before this change (Clang 13) was:
.section .qtversion,"aG",@progbits,qt_version_tag,comdat
.p2align 3
.quad qt_version_tag@GOT
.long 394240
.p2align 3
After this change:
.hidden qt_version_tag_use # @qt_version_tag_use
.type qt_version_tag_use,@object
.section .qtversion,"aGwR",@progbits,qt_version_tag_use,comdat
.weak qt_version_tag_use
.p2align 3
qt_version_tag_use:
.quad qt_version_tag
.quad 394240 # 0x60400
.size qt_version_tag_use, 16
The notable changes here are that there is a symbol and that the section
is writable. The latter is required because we store the pointer to the
qt_version_tag variable instead of just an offset in the GOT. The total
number of relocations in the resulting binary remains the same. We've
actually shrunk the binary by one pointer size.
Change-Id: I74249c52dc02478ba93cfffd16d23951a6bcd784
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Details in the comment in the header. I haven't recently tested with
MSVC, but I designed this originally in 2015 when I did have access to
Visual Studio so I know it works (I've confirmed with Godbolt).
With MinGW, this produces assembly:
.globl qt_version_tag_used
.section .qtversion,"dr"
.linkonce same_size
.align 16
qt_version_tag_used:
.quad __imp_qt_version_tag_6_4
.quad 394240
394240 is 0x060400. The DLL import table contains:
0015f03c 0015f294 00000000 00000000 00165478 0016012c
DLL Name: Qt6Core.t.dll
vma: Hint/Ord Member-Name Bound-To
161318 7 _Z11qt_assert_xPKcS0_S0_i
...
164cf8 6073 qt_version_tag_6_4
Change-Id: I42e7ef1a481840699a8dffff1404f45b13f60ba6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The resulting blurriness is too significant, and it's hard to see where
the difference comes from. Better to encode the screen DPR into the
appearance ID if it's not 1.0, and warn about the comparison not being
done to the baseline images with a 1.0 DPR.
Pick-to: 6.3
Change-Id: Iceab7b0a4cc50627145bd1267cff22344f7d8e5b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Widget tests run in VMs that don't have their own git clone.
Pick-to: 6.3
Change-Id: I20ab32affabfc7ce6dfaa445306b19efb51803e9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Mangling it into the checksum makes it hard to navigate the available
images.
Pick-to: 6.3
Change-Id: I54dcab5681e747ce1c5fe1b141ef6c4441d1f7eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
All callers do in fact pass members of the enum, so just making the
defualt value be LET_Undefined rather than -1 eliminates any need for
it to be an int.
Change-Id: Ic1c9ae1522363666d1208aba60d4b4df5eff6ce0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QByteArray's list of case-implicating functions included three that
don't implicate case and omitted one that does. QByteArrayView lacked
any mention of the liminal nature of these and other methods that
presume any particular semantics to character data.
Pick-to: 6.2 6.3
Change-Id: I928ef2274704584f8a137c0a4a7aa3c3da57718e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously the blacklisting file format only worked with slot:data or
plain slot names for the items to blacklist. However, tests with
global data report themselves with the global data-row tag in the same
way as function-specific ones do; and tests which have both join the
two as slot(global:data) in the test output name, so the reader is apt
to mistake global:data for a data tag. In any case, it is potentially
desirable to be able to blacklist a function with either or both of
global and local data-row tags specified. Add support for that and
remove a blacklisting that was only needed due to the lack of this
support.
For now, make the new parameter to checkBlackLists() optional, so
that qtdeclarative's qmltest framework can adapt to this change.
Fixes: QTBUG-100870
Change-Id: I9125811ebdab75d3fb462ba8b60561f003426502
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The latter didn't do much aside from call the former, which was
private with no other callers. This prepares the way for som tidy-up.
Change-Id: Iff741662365553e719a9c8b1253aff11de96455f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By simply forwarding two QByteArray values (as views, since that
suffices) we can retain knowledge of their sizes and thus avoid the
need to null-terminate in order to forward to a hand-rolled strchr()
that depended on that. Using QBAV::contains() turns out to be quite
expensive, so use memchr() to implement a more efficient check.
In the process, turn a pointlessly repeated check into an assertion.
Change-Id: I316623206e1cf315a59d54cf574649d6acbb5c43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QBA::toPercentEncoding() duplicated a condition to decide whether it
should include a percent-replacement character in its always-encode
list (which might allocate memory), where simply pretesting each
character against the percent achieves the same effect more cheaply.
Change-Id: Ic87a977713207d74b07ee6b811b0ead3b6945ef6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When a percent-replacement present in the exclude list would,
normally, not have been encoded, it was encoded regardless, as
otherwise round-tripping fails. However, when percent or its
replacement would normally have been encoded, its presence in the
exclude list lead to it not being encoded, which duly breaks
round-tripping. It also violates
https://datatracker.ietf.org/doc/html/rfc3986#section-2.4
[ChangeLog][Incompatible behavior change][QByteArray] When
converting to percent-encoding, it was possible to exclude the percent
character (or its replacement, unless this is one of the characters
not normally encoded) from conversion. Doing so would violate RFC
3986 Section 2.4 and break round-tripping of any string that contains
the percent character. The percent character, or its replacement, is
now always encoded, even if mentioned in the exclude list, as the
documentation has always claimed.
Change-Id: I885ce33e05dc6877f1b3700fb0870fa30556a5aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This was not previously tested.
Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
WebGL is stricter than OpenGL ES and require that unused
vertex attribute arrays are disabled. This prevents
errors such as:
WebGL: INVALID_OPERATION: drawElements: no buffer
is bound to enabled attribute
Pick-to: 6.3
Change-Id: I68384a9f6954b6a1960ba6e8afd1fdbdfefe2335
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>