1. Make the ctor unable to construct a QByteArrayView from
array literals other than 'char'.
With the new behavior it would either be (very likely) unintended to
pass e.g. a std::byte array to the ctor. And it would be confusing
because you would get different sizes based on signed-ness.
2. Introduce fromArray
Only supports array literals. Constructs a view of the full size.
Explicit so it shouldn't be surprising.
Change-Id: Ifdb55eb21057dfe7053b2561bd81e2c9825e9bc6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
For HTTP connections, QNAM defaults to opening its TCP socket in
unbuffered mode. This means that Qt will send the data written
into the socket right to the kernel, queueing only if the kernel
says it doesn't want more data for the moment being.
QNAM itself then uses separate write() calls to write the HTTP
headers and the body of the request (like POST or PUT). These 2+
writes result in headers and body being sent over different TCP
segments -- even if, in principle, a POST with a few bytes of data
(e.g. a HTML form, or a REST or SOAP request) could fit in the same
segment as the request.
Multiple writes like this interact extremely poorly with other
TCP features, e.g. delayed ACKs, Nagle's algorithm and the like.
In a typical scenario, the kernel will send a segment containing just
the headers, wait for the ACK (which may be delayed), and only then
send the body (it wasn't sent before because Nagle was blocking it).
The reply at this point is immediate (because the server can process
the request and starts replying), but the delayed ACK is typically
40-50ms, and documented up to 500ms (!). If one uses QNAM to access a
service, this introduces unacceptable latency.
These multiple writes to the OS should be avoided.
The first thing that comes into mind is to use buffered sockets.
Now, there are good reasons to keep the socket unbuffered, so we
don't want to change that. But the deal breaker is that even buffered
sockets won't help in general: for instance, on Windows, a buffered
write will immediately detect that the socket is ready for write and
flush the buffer right away (not 100% sure of why this is necessary;
basically, after populating the QTcpSocket write buffer, Qt enables
a write socket notifier on the socket -- notifier that fires
synchronously and immediately, without even returning to the event
loop, and that causes the write buffer flush).
Linux of course offers the perfect solution: corking the socket via
TCP_CORK, which tells the kernel not to send the data right away but
to buffer it up to a timeout (or when the option gets disabled
again, whichever comes first). It's explicitly designed to support
the case of sending headers followed by something like a
sendfile(2). Setting this socket option moves the problem to
the kernel and we could happily keep issuing multiple writes.
Ça va sans dire, no other OS supports that option or any other
similar option.
We have therefore to deal with this in userspace: don't write in the
socket multiple times, but try and coalesce the write of the headers
with the writing of the data. This patch implements that, by storing
the headers and sending them together with the very first chunk of
data. If the data is small enough, this sends the entire request
in one TCP segment.
Interestingly enough, QNAM has a call setting TCP_NODELAY
currently commented out because Qt doesn't combine "HTTP requests"
(whatever that means). The call comes all the way back
from pre-public history (before 2011) (!). This patch doesn't
touch it.
Fixes: QTBUG-41907
Change-Id: Id555d14e0702c9f75c3134b18277692eb3659afe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
That XML was parsed over and over again, because the QMimeXMLProvider
was re-created instead of re-used.
Pick-to: 5.15
Change-Id: I07ff005d3f238afc1490b69a58cf4815e67d418c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt Quick Pointer Handlers depend on this behavior:
QQuickPointerHandler::onGrabChanged() receives only the grabber that
was losing the grab or the one that is receiving it, not both at the
same time. UngrabExclusive means the original grabber simply
relinquished the grab by setting the exclusive grabber to null.
CancelGrabExclusive means the new grabber took over the grab that the
old grabber had before.
Task-number: QTBUG-86729
Change-Id: Iefca6fe91b11fcb03d2c6ac3598841c924facb22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The recently added check to avoid negative-bitshift ub ignored that
the algorithm will sometimes use a negative bitcount value as a
flag. This caused reading failure for some frames.
Pick-to: 5.15 5.12
Fixes: QTBUG-86702
Change-Id: I4c247a7eb6102f9b51cc8ac708c60db80d609e38
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Any but the last /MERGE:from=to option passed to QMAKE_LFLAGS was
ignored. Now, the first options gets a <MergeSections> tag and all
further options are added as AdditionalOptions, because vcxproj files /
the VS property editor do not support multiple MergeSections entries.
Pick-to: 5.15
Fixes: QTBUG-86062
Change-Id: I65bddf0b8c7ed6c162008d6ad1b58c2aba2d07d9
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
We must use the LIBRT location instead of LIBRT_FOUND which is not set anywhere.
I failed to replace this one in my previous patch.
Change-Id: I6e2df82c31e29018d99afec1eecfb80a321fddd4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The documentation for [NSWindow performWindowDragWithEvent:] only
mentions mouse-down events, but starting a drag from move and drag
events works too, so include them as well.
Pick-to: 5.15
Fixes: QTBUG-85105
Change-Id: Ib6c29ed4035bfccc61d50a7f95f564fb3d56fcf6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Check the reference count before deleting. Patch
as contributed on bug report.
Pick-to: 5.15 5.12
Fixes: QTBUG-86547
Change-Id: I2cb197e3eeda7ade2442c23f6b4f1ae6ff2ff810
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This makes it easier to know which values to use in BLACKLIST files
for a flaky test, for example.
Pick-to: 5.15
Change-Id: I12af99d68f97e016aa42be9ae9d70de5fc0a58ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Utility for visualizing and debugging high-dpi rendering
using QPainter, at different (fractional) scale factors.
In addition contains prototype code for mitigating
painting artifacts such as drawing outside the clip
rect when scaling.
Change-Id: I44f39315ad9674790d51413dddf41e3a51043da6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
DprGadget displays the devicePixelRatio for the current
screen using a large friendly font, as well as the
platform and environment inputs used for determining
the DPR.
Change-Id: Id619edad181eb7717f18eb98af341d6582a843a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Simplified the logic around reconciling hour12, ampm and hour in the process.
Mindless coding-style tidy-up.
Change-Id: I0b7cabc57539d0d7201fef33e0120b84f4bb4994
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Updated QFuture docs to be more precise about QtFuture::Launch::Sync
policy.
Change-Id: Ic267c71f858e04a47ea1fc0996ea342d5eae7744
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In fact, this variable can take only two values: 0 and 1. By
interpreting its value as boolean, we can use relaxed store operations
instead of atomic increments. This is safe, because it's guarded by
'activateEventNotifiersPosted' variable, which already provides a
release/acquire semantic.
Change-Id: If9adb7d022f1500ee7e8b61f336d8732f9b88d4c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
[ChangeLog][QtCore][QByteArray] QByteArray is a prepend optimized
container similar to QList.
Task-number: QTBUG-84320
Change-Id: I45ed1cb75414930f5998be58bfcfe343b1790331
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
As OpenGL ES and Vulkan ruin the day with the spec mandated minimum
value for max threads per threadgroup being only 128, clients need
a way to decide if their compute shader (local_size_*) is suitable
for use at run time.
Change-Id: I72b4fc97032406340623add82ea4d9544ebe9fdc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The recently introduced overflow check for 8 bit images was too
aggressive, causing the last pixel on each line to be rejected.
As a driveby, add the same (fixed) overflow check also for 32bit
images.
Pick-to: 5.15 5.12
Fixes: QTBUG-86691
Change-Id: I62e4d5884e314f1171cb5a3e2c48657ce7259676
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This code, after applying it to linguist, didn't compile.
Change-Id: I25011a44ca059a149f041f8f07848232883140cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
After we started defaulting to high-dpi enabled, it was discovered
that it does not work correctly with the placeholder screen. Since
the placeholder screen has no physical size, and the default
implementation of logicalDpi() divides by the physical size, we
got a scale factor of NaN in the high-dpi code.
The effect of this was that the nooutput test in Qt Wayland would
fail, because it did not get the events it was expecting, since
the window geometry was never set to a valid rect in the
resize() call.
Task-number: QTBUG-86698
Change-Id: I7ee68db9a13446b414502ae0f26fd214531c673a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The non-deprecated one called the deprecated one :-(
Inline the deprecated one and simplify, given the null pointer passed down.
Change-Id: I5b99053357fc3be109e61ccf1161835bf527b686
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The reason for this bug is that after the TextItem loses focus,
the focusItem in QGraphicsScene is already empty.
When QGraphicsScene responds to the inputMethodEvent event again,
since focusItem is already empty,focusItem will no longer deliver events.
Fixes:QTBUG-85088
Pick-to:5.15
Change-Id: I329054333c2adec133d35318761612aca3afcf0d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Use QVERIFY in test functions, and (void)tr.load outside.
Change-Id: I18d2eb3aeaf00f9f2bbe75d0a2d8b12569b541e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
These states correspond well with ScrollPhase, and this abstraction
makes it possible to handle wheel events the same way as mouse events
in Qt Quick: on "begin" we deliver to all Items and Handlers until
all points (the only point) are accepted; on "update" and "end" we
deliver only to the exclusive grabber, if there is one, and to any
passive grabbers.
Change-Id: I702dbd4f2c1bf5962eb3dbb9e4b725300a00a887
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
These docs are not part of the generated docs due to QRhi being private,
but nonetheless keep it useful.
Change-Id: Ic46aaa4cd329535c37fffcd514ba354dff4bfb5c
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Do not qHashBits on the whole data that is at least 260 bytes, a big
part of it often unused. Just hash binding/stage/type and the first
resource pointer.
Change-Id: If9b3dc9acf36edf225302b1216d91e87b652b8ef
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
When we know the spec already, we can route to the correct branch of
the check directly. This also prepares the way for avoiding
duplicating the expensive check for LocalTime during
setMSecsSinceEpoch().
In the process, move duplicated code into massageAdjustedDateTime()
from its callers, to avoid adding verification to the duplication; and
clean up refresh{now: Zoned}DateTime().
Change-Id: I04d7a417110109d1f246a891b5aa94945821804b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Various places in moc relied on the magic behavior of QByteArray, that
provided a non-null pointer to a null byte when the byte array was
null, resulting in crashes when QT5_NULL_STRINGS is turned off. Fixed
them to cope with this (and optimised out some pointless effort, when
empty QByteArrays are involved, in the process).
Change-Id: I617a878eb2e9ac8be244080efa1f0de4ac9a68a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use ternary operator form, or boolean algebra, for the short returns.
Handling invalid differently from valid isn't symmetric, they're
qualitatively different branches.
Skip a fatuous default-initialization.
Change-Id: I01a8a06055c315ecf08fc87d208808c0fe71eb31
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is lossy, so should be requested explicitly, using a dedicated
fromPixmap factory function.
Deprecate the constructor and assignment operator, and make the
constructor explicit.
[ChangeLog][QtGui][QBitmap] Implicitly constructing and assigning
to a QBitmap from a QPixmap has been deprecated, and the respective
constructor has been made explicit. Use the fromPixmap factory
function instead.
Change-Id: I68ce85b26c901415137b664a1db687021d48bae0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QToolButton::initStyleOption is const. Apply some DRY while at it.
Change-Id: If29a52e828bbc2aa58df2852c4c434545acfef3e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Allow Gradle builds to run using JVM daemon, this will improve the
current build time noticeably for clean builds and hugely for
incremental builds.
This will bring the Gradle build to comparable speed with a normal
Gradle build in Android Studio.
Task-number: QTBUG-86674
Pick-to: 5.15
Change-Id: Icc4267223802e4c9350b48099236650c023f868d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
There were a small typos about those methods and fixed with correct ones.
Fixes: QTBUG-86635
Change-Id: Ib853e502fdcdafdf3ddf7ef6d25d368ebc2a631f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Adjust to changes to QIcon::pixmap, QMetaType::type, and
QAbstractItemView::itemDelegate.
Change-Id: I9eb0331ef899131afc86c33f27feeee76331ffc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
...not with the given point. Since QEventPoint has a constructor that
takes an id, it's possible to write something like
pointerEvent->setExclusiveGrabber(pointId, object)
which will construct a QEventPoint on-the-fly, containing only an id.
(That was unintentional, but perhaps useful sometimes.)
setExclusiveGrabber() looks up the persistent point, but if we emit the
signal with the given point, it is missing the device. A handler
connected to that signal might reasonably assume that the point is a
complete instance; so we'd better emit the complete instance that we
found. (OTOH if the given point was a detached instance, it might also
be unexpected that the signal emits the persistent instance instead of
the given instance.) Amends 2692237bb1
Change-Id: Iee16363dcb22c1dc07b0cc0a81930218e22fa19e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Because of these lines in the Linux kernel (kernel/fork.c, see [1][3]):
if (clone_flags & CLONE_VFORK)
trace = PTRACE_EVENT_VFORK;
else if (args->exit_signal != SIGCHLD)
trace = PTRACE_EVENT_CLONE;
else
trace = PTRACE_EVENT_FORK;
Without CLONE_VFORK (which we can't use), if the exit signal isn't
SIGCHLD, the debugger will get a PTRACE_EVENT_CLONE, which makes it
think the process we're starting is a thread, not a new process. Both
gdb and lldb remain attached to the child and when it later performs an
execve(), they get mightily confused. See gdb bug report[5].
The idea of not having an exit_signal was so that no SIGCHLD would be
delivered to the parent process in the first place. That way, some
misguided SIGCHLD handler (*cough* GLib *cough*) wouldn't reap our
processes. Unfortunately, what I didn't realize was that the kernel
sends SIGCHLD anyway (see [2][4]), so this defensive measure didn't
actually work. Consequently, we can pass SIGCHLD to clone() and get the
debuggers working again.
[ChangeLog][Linux] Fixed an issue that would cause debugging a Qt
application that uses QProcess to confuse both gdb and lldb if
the Linux kernel was version 5.4 or higher. Behavior outside of
a debugging session was not affected.
[1] https://code.woboq.org/linux/linux/kernel/fork.c.html#_do_fork
[2] https://code.woboq.org/linux/linux/kernel/signal.c.html#do_notify_parent
[3] https://elixir.bootlin.com/linux/v5.8/source/kernel/fork.c#L2432
[4] https://elixir.bootlin.com/linux/v5.8/source/kernel/signal.c#L1925
[5] https://sourceware.org/bugzilla/show_bug.cgi?id=26562
Fixes: QTBUG-86319
Pick-to: 5.15
Change-Id: I2fc68c725ba649218bd9fffd1633863613537d42
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
Our CI cross-compiling arm qemu builds have issues in tests that use
QProcess, due to user-space qemu seemingly not supporting pidfds
properly.
Add a 'forkfd_pidfd' configure.json feature, which can be manually
disabled when configuring Qt, causing QProcess to do a regular fork
instead of using the new pidfd kernel feature.
This will help us avoid the regression of multiple tests failing on
the new Ubuntu 20.04 CI host images when they are run via qemu.
Task-number: QTBUG-86285
Task-number: QTBUG-86187
Task-number: QTBUG-86198
Change-Id: Ib2209d7e95126e0fb738bf59e39070d5a62c482f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qt_add_test supports now QT_TEST_SERVER_LIST, which will add the test
servers as docker test fixtures.
The docker server will be started before the test is run, and stopped
after the test is run.
Running the tests in parallel is not supported.
Docker tests are currently only supported on Linux hosts.
Task-number: QTBUG-85034
Change-Id: If3cefe05c5dec19c14b05d2fa8b01a0b6d95e259
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Create a colormap per visual, not per window.
Pick-to: 5.15
Change-Id: I97d94618f159b4beaffd4a1afe0611233ced6676
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This is in accordance to the examples from harfbuzz docs:
https://harfbuzz.github.io/ch03s03.html
The fix is because `pkg-config --cflags harfbuzz` returns
the subdirectory as include path, for example:
-I /usr/local/include/harfbuzz
and this caused the system-harfbuzz not to be found when
/usr/local/include was not included by default (recent change on
macOS) and the code was doing #include <harfbuzz/hb.h>.
Fixes: QTBUG-85568
Change-Id: I12a34638e8ad5e3085768828457f0bfa1a2c68ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Use -source 8 and -target 8 for javac by default.
Task-number: QTBUG-86282
Change-Id: I291beab4df166468972138822ca26f01c9666985
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>