This reverts commit d7e8d5bb1b.
Reason for revert: Found a working solution for the issue.
Change-Id: Ia720cc63ece9dfb1a24067cdd9c3d79d4edbe3be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When calling a ctor this way, an object is created in the memory pointed
to by _a[0] using the other arguments for the ctor.
This allows separate allocation and initialization of an object through
the metaobject system.
Fixes: QTBUG-108879
Change-Id: Ifb154373ee42faab281cfb62aa14334980ec6b7d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The QChar::toLatin1() args in:
str.replace(index, len, QChar(after[0]).toLatin1())
s2.replace(ch.toLatin1(), after, cs)
will be converted to QChar, so it's always calling the same QString
overload, I argue that we're not testing QChar implicit conversions
here.
Change-Id: I3962cab2b34684f970638575e6bd15dd1067a8c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Windows theme in dark mode set dark palettes for checkbox,
radiobutton, menu, menubar explicitly. The fix added as part of
a2518b4140 (to use light palette for
windows style) overrides only system palette and widget specific
palettes are still with dark palettes.
In this patch, the windows style overwrite dark with light palette
for widgets that are explicitly set with dark palette in windows
theme.
Fixes: QTBUG-110432
Pick-to: 6.5
Change-Id: I2af0e517d62981f062244eeab8f1b5e5442cc451
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
...as suggested by review comments.
Switching to std::function implies that we cannot easily
do the install-remove pattern anymore as there is no way to
compare an std::function to something other than null. Instead
of making it more complicated by returning a key or something
like that, change the remove function to a clear (that now clears
both the legacy VK_EXT_debug_report and the new VK_EXT_debug_utils
callback lists).
Also add a missing call that registers the new-style callbacks that
are installed before create().
Pick-to: 6.5
Change-Id: I66c1dd8e8dcc8eee0f5eb9671f94c2c80319dcaf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Also change isAsciiDigit() to take a char32_t, so that something like
this works:
QChar ch; isAsciiDigit(ch.unicode())
casting char16_t to uchar is narrowing, and gives weird results. C.f.
QSettingsPrivate::iniEscapedKey() and the QSettings unittests which
uses some unicode characters.
Task-number: QTBUG-110403
Change-Id: Id978a6b2874bc6869ae3ffb28d1887d932c37782
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The previous fix attempt at 8ba8d1346a
does not work when C++20 mode is enabled.
MSVC optimizes away the "else" block but triggers warning C4702 on
"return true". Moving the return line into the "else" block ensures that
it is optimized away too.
Change-Id: I9ef02cd3631ff78091530b6fb2b91c2eddcbab5d
Pick-to: 6.5 6.4
Fixes: QTBUG-104836
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
We can always add it back later, but for now, it's pointless overhead
(no Q_PROPERTYs, no Q_INVOCABLEs).
Found in API review.
Pick-to: 6.5
Change-Id: I1e30fbda997e6576a3e94cbae0387a3188c27728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Ensure that the classes using ShortData have the same size (already
done) and alignment (this patch) as classes that just have a
d-pointer.
Pick-to: 6.5
Change-Id: If30352a0bc4beb4b505d6e0eab5077c9c16456ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The fact that read-access is always included makes a bool readWrite
property a little awkward to document and explain. An AccessMode enum
with values ReadOnly and ReadWrite is much easier, and will also lend
itself more easily as a constructor argument than a boolean.
Found in API review.
Pick-to: 6.5
Change-Id: I4f20dbe9f19c7bdb52248a6e544e36d731d5a2ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The previous attempt at fixing QTBUG-110058,
ccad719d2e, was incomplete:
- the if (result.isEmpty()) check at the beginning of finalize() was
not protected, so it raced against the assignment at the end of
finalize(), which was protected
- because the mutex was not locked during the finalization of the hash
algorithm, two threads could perform this operation simultaneously,
which isn't such a bad idea in principle, as it can reduce latency,
but for that to work, the losing thread needs to throw away its own
work and adopt the work of the other thread, but that wasn't done:
both threads would write their result to 'result', just one after
the other, but that's still a data race, since the eventual _reader_
of the result cannot be protected (is outside the class). Besides,
we don't even know whether the algorithm-specific finalization
functions are ok with being called from separate threads on the same
context object
- in addition, the mutex wasn't necessary when finalize() was called
from the static hash() function, as no sharing could possibly take
place there (the state is function-local)
Fix all of the above by largely reverting the first attempt, dragging
the result.isEmpty() check out of finalize() and into resultView() and
instead simply holding the mutex over these two calls in
resultView(). To see why this is sufficient, consider that
resultView() is now idempotent again: the result is written once, the
next thread waits and then finds the work done. All following accesses
to the result are then reads, which happen-after the write at the end
of finalize().
The accesses to 'result' from reset() need no protection, as reset()
is a mutable function, and calling a mutable function on a shared
QCryptographicHash object is already UB. Only two const functions may
be called that way.
Pick-to: 6.5 6.4 6.2 5.15
Fixes: QTBUG-110058
Change-Id: Ia8ac095b785519682090801c1012e9dded6d60b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While PURE_SWAP is the correct one today, this is inline code, so when
we activate the d-pointer, we may have fields that hold non-memory
resources, but it would be too late change existing binary users to
MOVE_AND_SWAP, so do it already now.
Pick-to: 6.5
Change-Id: I18976cffe30eb4e37aa6d471cc6e75015e9b1ee7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Compared to std::shared_ptr, QSharedPointer requires 2x the atomic
operations per copy, and does not support QSharedPointer<void>.
Port to std::shared_ptr, and drop the Pinnable kludge.
Add an optimistic std::move() when we insert into QMultiHash.
Pick-to: 6.5
Change-Id: I2ab004b7e8fa36d9e777cd787ffded4076d2880f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The old function,
bool AlphaCode::operator==(AlphaCode code) const noexcept
is not symmetric: the LHS argument is passed by cref and the RHS one
by (non-const) value. I didn't test, but this asymmetry might actually
make the operator ambiguous with its reversed version in C++20.
Fix by making a hidden friend. Even if it doesn't fix anything, hidden
friend relational operators are still where we want our code base to
migrate to, eventually (QTBUG-87973).
Pick-to: 6.5
Change-Id: Icb74c24802a3fe6c2987c1db86880c0d72a7abdf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The aim is to have fewer files including <windows.h>.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id9cc08f54b5daf6d7e317fad27036dc2efaacbb8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The application height calculation relied on the Display.getMetrics to
obtain the size of the current app window. It works properly on stock
android and Samsung devices, but not on some Huawei and it's unknown on
other vendors. This patch changes the way the height and weight are
calculated by using the provided values.
Task-number: QTBUG-107604
Task-number: QTBUG-109268
Task-number: QTBUG-97503
Task-number: QTBUG-107923
Task-number: QTBUG-109351
Task-number: QTBUG-110501
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I0b0d1a0e4688f10530054afd26e34f55a92ea2da
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
We already fixed the implementation of toSQLTCHAR() in
66767eea46 to not assume that a UTF-8 or
UTF-32-encoded string has the same number of code points as the
equivalent UTF-16 string, but it turns out that users of the function,
as well as other code, also failed to account for this.
This patch fixes callers of toSQLTCHAR() to use
const auto encoded = toSQLTCHAR(s);
~~~ use encoded.data(), encoded.size() ~~~
(except we can't make `encoded` const, because the SQL API isn't
const-correct and takes void* instead of const void*) instead of the
anti-pattern
~~~ use toSQLTCHAR(s).data(), s.size() ~~~
As a drive-by:
- Extract Method qt_string_SQLSetConnectAttr()
- skipping an unneeded .utf16() call (a NUL-terminated string is not
required for calling toSQLTCHAR())
- de-duplicate some code in exec()
- and make a comment there slightly more informative
- replace
- NULL with nullptr
- size() == 0 with isEmpty()
- C-style with constructor-style casts
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I3696381d0a93af8861ce2b7915f212d9e5e9a243
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove clashing enumeration value ColumnCount and exclude
file in snippets.
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Ibd8a72d9d87e3dcbbb221c364d6b4c4f59b315df
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Add option that generates an absolute Python import.
import resources.rc_resources
from a path like
../resources/resources.qrc
assuming the project root is .. .
Add an additional option to specify the import paths, from which
the project root can be determined.
Pick-to: 6.5
Task-number: PYSIDE-2191
Change-Id: Ib444eb666217b8c010dba0079b0ffe9ddbaa3414
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
This is a continuation of commit 5c9d671bfb.
[ChangeLog][QtCore][QStandardPaths] Improved conformance to the
Freedesktop basedir spec by ignoring any relative paths in XDG_*
environment variables.
Fixes: QTBUG-58043
Change-Id: I7c34143ced97d6d3de6ecbf13bccf9e935462d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Otherwise the finalizers won't know which libraries we're linking to.
Pick-to: 6.5
Change-Id: I886c46443b7289d6e2c7d824767ed5e34a0a1fbf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We already have the necessary machinery in qnetworkproxy_darwin.cpp
Pick-to: 6.5
Change-Id: I01d99c825ed794f1ff5ba229e64f9963b819228c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Move types to QtPrivate, fixing errors like:
error: QCalendarWidgetPrivate’ has a field
QCalendarWidgetPrivate::m_model whose type uses the anonymous namespace [-Werror=subobject-linkage]
The error appears in CMake Unity (Jumbo) builds apparently
due to multiple anonymous namespaces per file.
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Id678af4db5633b1b2267425c7751f1312935d5d5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The test function used only the left button to test mouse event
propagation.
This patch adds the right and middle buttons to the test data.
Task-number: QTBUG-110055
Pick-to: 6.5 6.4
Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a
Reviewed-by: Doris Verria <doris.verria@qt.io>
It causes clashes in CMake Unity (Jumbo) builds.
Change the function to be Q_AUTOTEST_EXPORT'ed helpers.
Pick-to: 6.5
Task-number: QTBUG-109394
Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I2e4032e07e1c39432cae1eb2dfff94be33846c09
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QAnimationGroup, QAnimationGroupPrivate uses now qsizetype instead of the int.
Task-number: QTBUG-103530
Pick-to: 6.5
Change-Id: I96053a609bc4fad32adce5616eef1af9a86f4e27
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The QByteArray is assumed to contain an SQLTCHAR string (so, either
UTF-8, UTF-16 or UTF-32-encoded). Only in the UTF-8 case would the
size of the byte array be the same as the size of the SQLTCHAR string
in codepoints, yet the size in bytes is what the code passed to the
QVLA<SQLTCHAR> append() call, causing it to read past the QByteArray
buffer in the UTF-16 and UTF-32 cases.
Fix by properly calculating the string size from the size-in-bytes and
then memcpy()ing into the QVLA. We use memcpy() and not
QVLA::append(T*, n) because the QByteArray buffer need not be aligned
on an alignof(SQLTCHAR) boundary (certainly not since it gained the
prepend "optimization").
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: If3838c3dee89e6aca65541242642315b8e1fa6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
memcmp and openssl callbacks are somewhat of a red flag, so use
CRYPTO_memcmp for the sake of looks.
Done-with: Maximilian Blochberger
Change-Id: I38d038ed96830cfd54c6f5cd684f80bee8d42899
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This flag is properly supported everywhere it is defined. There's no need
to retry any more.
Change-Id: I12a088d1ae424825abd3fffd171d6ad10d18247e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It makes far more sense here, because we can also avoid the need to save
the old key file name.
Change-Id: I12a088d1ae424825abd3fffd171dfaa5dca8a36e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When the match finds a surrogate pair as the first true Unicode character,
then we need to skip both code units of the pair in order to restart the
search. PCRE2 does not allow us to search for individual UTF-16 code
units.
That actually means that counting "." gives us the count of Unicode
characters.
Fixes: QTBUG-110586
Pick-to: 5.15 6.2 6.4 6.5
Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This method correctly ignores relative paths (as per the XDG basedir
spec), but checking the list of dirs is empty should be moved to after
splitting the env var, because even if the env var is not empty, if the
paths in it are all relative the resulting list will be empty.
Drive-by change: Split some code to a static helper, which will be
used in xdgConfigDirs() too.
Change-Id: If894751ba68b24ccc214f9a4bb2099be3f0e4349
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move the helper from qsystemsemaphore.cpp to q20memory.h
to prevent clashes in CMake Unity (Jumbo) builds.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id0127af1f0d51c87a5887090cc90ab232eff8093
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
QStringView::toULongLong() only works with US-ASCII, so:
- Always convert the text to parse to Latin1
- Use qstrntoull and make ParsedInt a typedef of
QSimpleParsedNumber<qulonglong>
The QStringView overload delegates to the QL1SV after converting the
string to latin1.
Change-Id: Iff7ac2c0afe6a180ca1b46a09ef0750e9b882c4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It demonstrates timerEvent() and some QFontMetrics
There are other examples that demonstrates this
Pick-to: 6.5
Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add missing white space to moc output and list all the values of
QMetaObject::Call in the internal documentation.
Change-Id: I57d0c5b88bfaee4ca3f2d4604564751b6d0cbe51
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>