Rework QSimpleParsedNumber to store a qsizetype whose sign serves as
ok flag (positive is ok, zero and negative are not) and magnitude is
the number of characters used. This replaces an endptr that was set to
null to indicate !ok, but that deprived us of end-of-parse
information, which is needed for number-parsing. In particular, JS's
parsing of numbers accepts overflow (where qstrntod() flags it as
invalid) as infinity; so qstrntod() does need to say how long the
overflowing (but JS-valid, none the less) number-text was.
Modify all callers of functions using this (recently-introduced) type
and add tests that fail without this fix.
Fixes: QTBUG-108628
Change-Id: I416cd213e1fb8101b1af5a6d43615b970a5db9b4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
CMake tests have own workflow and way they run. Most of binaries
produced by these tests are either no-op or check if build was
successful. It doesn't make much sense to check these binaries for
memory leaks, so disabling ASAN leak check.
Fixes: QTBUG-108817
Change-Id: I95984e1049d6bfd691ff854e15bdf98c71c921db
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
tst_QOpenGLWidget fails on Linux when other windows on the desktop grab
focus. That can happen on CI VMs.
This patch blacklists the test on Linux as a temporary solution
Task-number: COIN-966
Change-Id: Ibdd7e626f92d2da692bd7c44741e0ca4c9dbd1a8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_gestures flakes in MacOS arm and Linux when delivering a gesture to
a screen. The problem cannot be narrowed down to specific test
functions. When two test functions with gesture delivery to a screen
are called, the second fails.
This patch temporarily blacklists OpenSuSE for tst_gestures.
Task-number: QTBUG-104496
Task-number: QTBUG-106244
Change-Id: I3bc3c9b82567478784a84006d27f5cbed39d9c9a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Swap the definition of the nested mock_object out of the QFlatMap body
into a namespace scope and replace it with a template alias.
This way, there's _one_ mock_object<U> for every U, not one for every
QFlatMap<K, V, Comp, KeyC, ValueC>::mock_object<U> ("SCARY").
Should reduce compile times, but I didn't measure.
Change-Id: I37f7413a49d0424e06ef4e78d65dea5962599e79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In general, we can't make the qNN types behave exactly like their
C++NN std counter-parts, because their exact semantics and
implementation may depend on C++NN language features, while qNN are
back-ports to C++ standards older than NN.
Adjust the warning message accordingly.
Thanks to Eddy for noticing.
Pick-to: 6.4
Change-Id: I8533214549f2140a99e2216e3bcd979263fe100c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is improved version of previous fix
013c346a8d that was reverted because it
broke some tests for Quick Text. The problem was that it did not work
correctly in the case the text was wrapped to a fixed width.
To deal with this we'll accumulate current line full width (as if it
hadn't been wrapped) in layout data (layoutData->currentMaxWidth).
Then when the next line is explicitly wrapped by line or paragraph
separator, this accumulated width will be used to adjust layout's
maximum width.
Change-Id: Iad7119d9808e1db15fe1fbc5db049c3db928529f
Fixes: QTBUG-89557
Fixes: QTBUG-104986
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
...and update the documentation for how we detect post-C++11 features,
as proposed on the mailing-list:
https://lists.qt-project.org/pipermail/development/2022-November/043248.html
According to https://en.cppreference.com/w/cpp/compiler_support,
<version> is available from
- libstdc++ from GCC 9
- libc++ from LLVM 7
- MSVC 19.22 = VS 2019 16.2
- AppleClang 10 = Xcode 10.0 beta (10L176w), 10.0 (10A255), 10.1 (10B61)
It is _not_ available on
- GHS 22.1.4
- GCC 8.3.0 (as used by QNX 7.1, but the default is libc++)
Pick-to: 6.4
Task-number: QTBUG-108228
Change-Id: I61e0727573d1b4559228e3f5bd58d73e86a9256e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Only affect MSVC anyway. For all the others, since everything is inline,
there's nothing to import or export.
Change-Id: Id8e48e8f498c4a029619fffd17288befde9b5f83
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Fix up deprecated macOS keyword while we're at it.
Change-Id: I6f6ba21bde161d3dd3ac6c243f1b5f7c16ef3228
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The logic was added in b0016ea9a6b225757e3ee06b50e8f7d05463ddf7,
but the test-case in the bug report works fine without this logic.
As sending events from a runloop observer is dubious, and causes
problems since it's not tied to the quite complex machinery of
the general event processing, it's better to remove it.
The original issue is already tested by sendEventsOnProcessEvents
in tst_QCore/GuiApplication.
Task-number: QTBUG-4521
Change-Id: I857519a09a13a72b7434727c0229606403be7ed3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This patch adds a getter for the current platform theme's name.
It is populated by QPlatformThemeFactory::create() if a plugin has been
loaded successfully.
Change-Id: I2c891c46e7dfcc262c35e32e345ae3dc2623e3a5
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Wasm shell used to call the function QtLoader instead of constructing
a new QtLoader. Change this.
Also change the doc to recommend using the constructor.
Change-Id: I57c52eab389aa82449c7db3f4c646ffb234df778
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Also implement in QGenericUnixTheme/QKdeTheme/QGnomeTheme/QGtk3Theme.
On Wayland, there is wl_cursor_theme_load() and etc in wayland-cursor.h.
On X11/xcb, cursor theme and size are common, either in XCURSOR_THEME
and XCURSOR_SIZE envs, or in gsettings for gtk/gnome world.
On Windows, cursor theme is part of theme file, see SetWindowTheme in
https://learn.microsoft.com/en-gb/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme .
For system settings, for example on Windows 10, Mouse Settings,
Additional mouse options, Pointers Tab, Scheme.
On macOS, it looks like cursor theme is deprecated.
Change-Id: I5821377d966c281fb8330da1f5baa7f0ddf86a9f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
zlib 1.2.13 has been available since October 13, 2022.
Also fixes CVE-2022-37434.
[ChangeLog][Third-Party Code] zlib was updated to version 1.2.13.
Fixes: QTBUG-108130
Pick-to: 6.4 6.2 5.15
Change-Id: Iaa2a9486f1cbbcd6a23d48df632e01bc05b414d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
For regular windows, the size should not be allowed to be empty. This
emulates system-wide minimum size setting on various operating systems.
Change-Id: I515fff8c9bfd14762dcfe88fb923ab10d8edd5c1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This is what we promote also in the documentation.
Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This reverts commit e36abea63b.
Reason for revert: QTBUG-108470
Change-Id: If9aeae8be67594320d00dcdb42c993eda7acaeef
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
There might not be a window at the pointer event position on a WASM
screen, especially when the main window is not fullscreen.
Change-Id: I29aac8c410fdf2bf97cd1ed12433d87e18b4a354
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
we are running out of enum values for the flags.
Pick-to: 6.4
Change-Id: Idd7cabb0c46c0c95eb4a87d047defb15ddeef024
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
When a dock widget is moved between high DPI screens, it's native
position is calculated and applied. The calculation falls back to a
mapping without high DPI, if the dock widget's initial position cannot
be mapped to a QScreen.
A warning was emitted in that case, to inform the user about a
potential screen misconfiguration (e.g. a physical screens not being
mapped exactly next to each other, leaving a gap). Despite of the
warning, the position calculation safely falls back to non high DPI.
The warning also kicks in when the dock widget's top left position
is located outside a screen, hence being invisible.
Since calculating an invisible top left position is possible without
high DPI mapping, this patch replaces the warning with a
debug message.
Fixes: QTBUG-108311
Pick-to: 6.4
Change-Id: I692034e5aeb5f7a94cca519ce055795fa72ea216
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
QIBusPlatformInputContext re-creates various objects on ibus restart,
but never deletes them.
Sometimes this leads to multiplied input
(the same character entered multiple times).
Pick-to: 6.4 6.2 5.15
Change-Id: I34a898bfe56b19f9d76752c649e3aa64c77ae11a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- If this string is not shared, modify it directly
- If this string is shared, instead of detaching copy the characters
from this string, except the ones that are going to be removed, to a
new string and swap it. This is more efficient than detaching, which
would copy the whole string including the characters that are going
to be removed.
This affects:
remove(const QString &str, Qt::CaseSensitivity cs)
remove(QLatin1StringView str, Qt::CaseSensitivity cs)
Adjust the unittests to test both code paths.
[ChangeLog][QtCore][QString] Improved the performance of
QString::remove() by avoiding unnecessary data copying. Now, if this
string is (implicitly) shared with another, instead of copying
everything and then removing what we don't want, the characters from
this string are copied to the destination, except the ones that need to
be removed.
Task-number: QTBUG-106181
Change-Id: Id8eba59a44bab641cc8aa662eb45063faf201183
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a repeat of commit 885ae61c63,
which applied a direct QString-to-Latin1 conversion to integral parsing
to avoid going through the expensive QLocale::numberToCLocale. But we
also need to lowercase the input.
Change-Id: Ieba79baf5ac34264a988fffd1726762a411e3bd6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The implementations are identical. Just reuse them. And move the two
QStringView functions closer, instead of where they are today which
lacks apparent motivation.
Pick-to: 6.4
Change-Id: Ieba79baf5ac34264a988fffd172675ac3584f94b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Repeat the last commit, now for floating point parsing (and without the
benchmarking). Like the last commit, removes one category of parsing,
when we would return an advanced parsing pointer and still fail.
Change-Id: Ieba79baf5ac34264a988fffd1726759a2359828d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
That is, return everything in the return argument. On the SysV ABI, that
means everything gets returned in registers, in both 32- and 64-bit
platforms (unlike QtPrivate::ParsedNumber). There's a minor but
perceptible performance improvement in parsing strings and byte arrays.
Before:
Parsed string "42" "1234" "-1548860221"
Clock (ns) 16.673 18.878 25.517
CPU cycles 46.548 52.704 71.243
Instructions 201 233 331
After:
Parsed string "42" "1234" "-1548860221"
Clock (ns) 15.577 17.998 24.198
CPU cycles 43.491 49.942 67.552
Instructions 179 211 308
On my Core i7-1165G7 @ 2.80 GHz, the 22-23 instruction gain per
iteration results in half the expected clock gain in runtime (22 /
2.8 GHz = 7.8 ns) because of a slightly lower instruction per cycle
rate. That's acceptable because we need less speculative execution.
Pick-to: 6.4
Task-number: QTBUG-107788
Change-Id: I07ec23f3cb174fb197c3fffd17220fd64d473cc0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
In Qt 5, QWin(dows)Mime and QMacMime lived in the respective Extras
modules, which were removed and partially folded into the relevant
modules in Qt. QWindowsMime and QMacMime continued to provide the
abstraction for implementing built-in support for native clipboard
formats and UTIs within Qt, but only as private APIs.
After the recent clean up of those APIs and respective infrastructure,
we can now bring them back as public converter interfaces. Application
developers can subclass those and instantiate an instance of their
implementation to add support for platform or application specific
data formats.
These interfaces are not in the QNativeInterface namespace, as
applications don't call into Windows or macOS using those interfaces.
I.e. there is no class on which an application would call
auto *converter= nativeInterface<QWindowsMimeConverter>();
Also, since applications override those converter types, we do want to
guarantee binary and source compatibility.
[ChangeLog][QtGui][QWindowsMimeConverter] Reintroduced to allow
applications to add support for conversion from and to Windows-native
clipboard formats to MIME-encoded data.
[ChangeLog][QtGui][QUtiMimeConverter] Reintroduced to allow
applications to add support for conversion from and to clipboard data on
macOS and iOS to MIME-encoded data.
Fixes: QTBUG-93632
Change-Id: Iebd909c3970015d203f59d5ab15e306b3d312f6e
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This way we can run the test on macOS with the version 2.1
OpenGL context.
Amends 85a1663eb1
Change-Id: I8ec122fefaab54b35613e226e3937f4b51a7ea5a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The previous if checks it.
Change-Id: I03321da3d6886e1788ad48433d451a5cc643f8dd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
There is no need to copy the string from the container.
Change-Id: Idebe6a40e6f76ea22d8a8dc6d5d65f3fa277b9d9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Use std::copy() instead of memmove(), cppreference.com docs mentions that
it will use memmove() internally, I confirmed that by following the code in
gdb, I did see that it uses:.
__builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
in /usr/include/c++/12/bits/stl_algobase.h
std::copy is more readable / easier-to-use API than memmove.
Change-Id: Iccb2fa1dc9897fd6a922ef96bc25308493d39eac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For now this plumbs the QPixmap directly, but as a follow up we should
teach QMessageBox to deal with QIcons instead, and rejig the plumbing
correspondingly.
Change-Id: I51dee4240082abf0acb33b6ade553327295a99bd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Unlike a regular QWidget or QDialog, a QMessageBox is initialized
to be application modal by default. Make sure we document this quirk
for both of the QMessageBox constructors, and tell the user that it's
possible to override this default.
Add a note about open() and exec() coming with their own set of
semantics when it comes to window modality.
Change-Id: I37a429633cefec94f790d3b0b30d0a8995ef60ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Currently QtBase contains multiple implementation of how to get the Win32
and COM error messages, and they are almost exactly the same, what's worse,
Qt already has a private QSystemError class to do such things, so we are
re-inventing the wheel in many places. This patch removes all other custom
error message implementations besides the QSystemError one. And since there
are a lot of places need the COM error message, move the implementation to
QSystemError so that it can handle both Win32 error and COM error.
Since I'm touching these lines anyway, break them into short lines if they
are above the length limit.
Change-Id: I1067c874011800303f0f114b5cb8830ac6810fc0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Test causes integrations on macOS to fail.
Temporary solution, fixing of auto test required.
Task-number: QTBUG-108402
Change-Id: I9ceef8ec425cdd5131bce0cfffcb4daf739e674d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Scale samples up by periodically repeating the bit pattern of each value to fill
up the lower bits instead of padding them with 0.
Vice versa truncate samples that exceed the bit depth of QRgb.
Change-Id: I777519e359932f52e54a33073a1ff297a76f620c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
We go from non-template toInt/toLongLong/etc. to template
QString::toIntegral_helper<T>, then to non-template
QString::toIntegral_helper, then back to template ::toIntegral().
I could maybe use QtPrivate::to{Signed,Unsigned}Integer, which operate
on QByteArrayView, but its use of QtPrivate::ParsedNumber as a return
type is slightly worse.
Change-Id: I3d74c753055744deb8acfffd1723cbc567837483
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The original implementation of the toIntegral_helper() called these two
functions, before we added the out-of-line non-template
toIntegral_helper() overloads taking QStringView for Qt 5.15 in commit
f1cbc3c9d2. They should have been inlined
in Qt 6.0, but no one noticed this.
Change-Id: Id8e48e8f498c4a029619fffd172795aaba2d815b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>