Expose QWidgetRepaintManager's data structures so that we can write
unit tests, and verify that they are correct after moving opaque
widgets (which triggers the accelerated move code path).
Improve the compareWidget logic to not rely on screen grabbing
(which requires permissions), but instead use QPlatformBackingStore's
toImage function, which is faster and more reliable, and also doesn't
require us to show the UI we want to grab full screen in order to
avoid issues with overlapping windows etc.
Change-Id: Iff2ea419f03a390ab6baca26814fef6ff45f7470
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Introduce a flag to QWindowsWindow which forces the cursor to be applied
after restoring override cursors.
Fixes: QTBUG-98856
Pick-to: 6.2 5.15
Change-Id: Id62cdc2dd01f45324503a542446b1c11a1fe6f44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
The background for this is that when running Wayland, the
Mesa driver has an issue which makes it crash if we call
eglDestroySurface() while we are rendering to it. This is
not according to the documentation, and it only seems to
happen on Mesa and only on Wayland, so it is probably
related to something in the Wayland implementation in the
driver.
Since this driver is very popular, we want to work around it,
which can easily be done using existing locking mechanisms
in the Qt Wayland QPA plugin. But in order to do so, we need
reliable callbacks for the start and end of a frame. The RHI
already has this, so we just need to channel the information
to the QPA plugin.
Having beginFrame/endFrame hooks in the QPlatformOpenGLContext
could be useful in other cases as well, especially knowing that
there are OpenGL implementations that require some extra thread
protection.
QPlatformSurface would be a more general location for these
hooks, but since the issue is only seen on OpenGL and
multi-threading is handled more explicitly in other APIs,
we don't want to expose this API in a more general location
than necessary.
Task-number: QTBUG-92249
Change-Id: I97ce7d4f744c4b28eec457e919d1c9652ff00079
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Remove obsolete check for valid sourceRect, we never get into the
accelerated code path if it's not.
Pick-to: 6.2
Change-Id: I872685fca8cba3a09ed856d727d5baafddee161b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Functionality is being added in other repos which require finalizers
to be run for non-static builds. That means we now need to ensure
finalizers always run even with CMake versions before
cmake_language() was added. The fallback method of writing to a file
and including it is slower, but that's better than missing important
functionality altogether.
Task-number: QTBUG-98545
Pick-to: 6.2
Change-Id: Ic8668c91c26d0c30de084b1b803032088c10fcf4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When checking if the apk is being deployed from system partition,
account for possibility of the apk not being installed directly under
/system/app or /system/priv-app, but in a directory of its own.
Otherwise, system applications that are not directly under system app/
priv-app directories will not be recognized as system apps, meaning
they will not use the system library path to load their libraries.
Pick-to: 6.2
Change-Id: I1e778b18cae3c0406e087b8c78fd31d521f7be73
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
[ChangeLog][wasm] Recommended emscripten version is now 3.0.0
Change-Id: I9ae082509415d8f00b8e9970b730ad4a472da310
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
When recursively checking children in QAbstractItemModelTester,
the currentDepth of recursion was incorrectly increased.
This patch fixes it.
Pick-to: 6.2 5.15
Change-Id: Ia79508f358e2fcb6b90780a79baec053522e871c
Reviewed-by: David Faure <david.faure@kdab.com>
If the in-place constructor throws, the old code had already updated
the container's size(). Fix by delaying the update to after the
in-place construction.
[ChangeLog][QtCore][QVarLengthArray] Fixed a bug whereby a failed
append() would leave the container with an inconsistent size().
Pick-to: 6.2 5.15
Change-Id: Ief1e668d945149bd8ba96c8af1398baaa7876880
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
On some platforms, such as X11 and Wayland with some compositors,
QMenu could be a popup window, which should be set a transient parent
to get relative position, which is requested by Wayland.
Added transientParentWindow() for QMenuPrivate like QDialogPrivate.
Fixes: QTBUG-68636
Pick-to: 6.2
Change-Id: I6d8880cb008ecf61a4c005898b38e3953379a13d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
switchLed writes to the device, and so O_RDONLY cannot be correct.
Change-Id: If79814804bcd3c6fb01617be9f1a73e54b9563bd
Pick-to: 6.2 5.15
Fixes: QTBUG-80653
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This reverts commit d62e9d3c5b.
Reason for revert: The -Wstringop-overread option was introduced in
gcc 11. This fixes the build for gcc 9 and 10.
Change-Id: I96ab5f917d6200cb1681fe6236f1fd4630ef4f7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since Qt5.1 (80fa4b6c8e) expandAll() emits expanded() but within this
change, the comment in itemExpanded() was forgotten.
Pick-to: 6.2
Pick-to: 5.15
Change-Id: Ic487e5f8999d6af27a4747b861464058faf03889
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is implemented in two passes, first we try the older and
always available DeviceIoControl() function. This works most of
the time, though it might fail for example for storage devices
attached via USB. In this case, we try to dynamically load the
newer NtQueryVolumeInformationFile kernel function. Since this
is probably more expensive, we do this as fallback.
[ChangeLog][QtCore][QStorageInfo] The QStorageInfo::blockSize()
will now report the physical block size of a storage device under
Windows. Network mapped drives are not supported.
Fixes: QTBUG-93976
Change-Id: I08b5b879e5bf79c025e2e305196ec5c5fce8b20f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Add support for Clipboard API
Add clipboard manual test
Also includes these fixes:
- improve clipboard use for chrome browser
- make QClipboard::setText work
- html copy and paste
- image copy/paste
Chrome browser supports text, html and png
To use the Clipboard API, apps need to be served from
a secure context (https). There is a fallback in the
case of non secure context (http)
- Firefox requires dom.events.asyncClipboard.read,
dom.events.asyncClipboard.clipboardItem and
dom.events.asyncClipboard.dataTransfer to be
set from about:config, in order to support the
Clipboard API.
Change-Id: Ie4cb1bbb1dfc77e9655090a30967632780d15dd9
Fixes: QTBUG-74504
Fixes: QTBUG-93619
Fixes: QTBUG-79365
Fixes: QTBUG-86169
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
When the widget we are moving in was previously outside of its parent's
clip rect, then we cannot use the accelerated move code path, as there
are no pixels to bitBlt from the previous to the new area.
Pick-to: 6.2
Task-number: QTBUG-26269
Task-number: QTBUG-98151
Change-Id: I324c6111de27cdd14cf8de8632a980aa351cc123
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Added to QWidgetRepaintManager test case, which is the only place where
the function is used.
Includes a helper that creates a complex scene with opaque children,
which will be used in additional unit tests.
Change-Id: I0e0188dd560923a552a8967d8e992dc17cc849d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Touch event processing might still be ongoing even after the screen
has been disconnected. If that screen was also the primary screen, we
would dereference nullptr.
Check for nullptr to avoid potential crashes during shutdown.
Fixes: QTBUG-95192
Pick-to: 6.2 5.15
Change-Id: I49ccd30c4126fe12cf5bb675e532e6e59b40b9c1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
There seems to have been no-one that checked a simple empty()/isEmpty()...
Pick-to: 6.2 5.15
Change-Id: I7fa567f556532dfa21db759719f1303a768a9732
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QVarLengthArray is neither implicitly shared, nor does it feature a
magic resize() on out-of-bounds.
Therefore, data() doesn't detach(), so 't' remains stable.
The only reason for the copy, then, would be if T wasn't
self-assignment-safe, but we don't support such types.
Remove the copy.
Change-Id: I8dd12e1c9b8131ae17d641354fe362554062b78d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The functions aren't const so begin() will return a mutable
iterator. The function arguments, however, are const_iterators.
It doesn't matter for QVLA, which isn't implicitly shared, but code
hygiene suggests to use cbegin() instead, to compare const_iterators
to const_iterators.
Change-Id: I9bfa993780ee4b68d13f6b6410772b0f1ccedad3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In preparation of splitting the class into QVLABase and
QVLAStorage.
Task-number: QTBUG-84785
Change-Id: Ic0da6c2e110a5b979b78989616b9a2cb0f27463b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If one destroys a running QThread, so far the behavior has been to crash
(à la std::thread) -- assuming the thread hasn't already signalled that
it has finished. This behavior is hostile to solutions such as using
QThread::create(), which always require a wait() before destroying the
thread object.
We can use the opportunity to change the behavior without breaking any
valid code. Instead of crashing, inside QThread's destructor we can ask
the new thread to quit, and then join it (à la std::jthread). This
simplifies the implementation of long-living runnables and the code that
manages them.
Deploying this solution for the whole QThread class may not be entirely
painless. While no correct code would work differently with the proposed
changes, incorrect code that deletes a running thread would no longer
crash "loudly" -- instead, it might deadlock "quietly", have memory
corruptions, etc.
Hence I'm limiting this approach to only the threads created by
QThread::create(), at least for the time being. This also side-steps
perhaps the biggest problem of generalizing the approach, which is that
placing such interrupt+join logic into~QThread's destructor would cause
it to be run _after_ a QThread subclass' own destructor has run,
destroying the subclass' data members too early. This might create
an antipattern if one chooses to subclass QThread. With create(), a
subclass in question exists, and it indeed has NSDMs, but it's entirely
under our control (in fact, I'm placing the logic just in its dtor).
[ChangeLog][QtCore][QThread] Destroying a QThread object created by
QThread::create() while the thread that it manages is still running will
now automatically ask that thread to quit, and will wait until the
thread has finished. Before, this resulted in a program crash. See the
documentation of QThread::~QThread() for more details.
Change-Id: Ib268b13da422e277ee3ed6f6c7b2ecc8cea5750c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The PRINT_2ARD_TEMPLATE macro expansion alone is responsible for about
50% of the compile time and RAM requirements of tst_qmetatype.cpp. By
factoring it into its own TU, we reduce the maximum memory load on my
machine from 4.0GiB to 2.5GiB, provided we don't parallelize the
build, then we take 0.5GiB more.
This is a quick-fix for the QNX build problems currently plaguing the
CI. Going forward, we should probably have a better solution, whatever
that may be.
Task-number: QTQAINFRA-4669
Change-Id: I2732b4c25b369b15cce1c7afe222d041ecb6795a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
it avoids global conan configuration in conan.conf
or via environment variables
Pick-to: 6.2
Change-Id: Ia54cbfe95e0864e7107ea3bb53ff9ba4f1df7b60
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
This reverts the QtWidgets changes made in commits
22634e0079 and
5b09346cf4 while keeping the auto tests
introduced in the former commit.
Both commits introduced rendering errors when moving widgets out of
or into areas in which they are obscured. Before we apply any further
optimizations to this code we need thorough auto test coverage.
Task-number: QTBUG-98151
Task-number: QTBUG-26269
Pick-to: 6.2
Change-Id: I9cb82b73776daed59ea0e9f51ff7ddef1c7265b6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
remove(i) is the same as remove(i, 1), and the extra 'n' argument is
of trivial type, so it's ok to default it instead of overloading.
Change-Id: Id926cd63fde518e002684a41e055edc1004247a4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... so it can be used by multiple .cpp files.
Task-number: QTQAINFRA-4669
Change-Id: I7212b9b08cd3bfa44ee741ee4789d1d0024e4708
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Previously, only the printf-style overloads were marked as such.
Saves ~7KB in QtCore text size on Linux AMD64 GCC 11 C++ 20 builds.
Change-Id: I4ed480e48060b87968f3d15bb5a84bdbcf70a647
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Currently the compositor draws the Qt logo by default;
check if the window has an icon and draw that instead
if set.
Fixes: QTBUG-86052
Pick-to: 6.2
Change-Id: Ia4f9c03562c15993c86cb8717f27e47ab669353d
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Factor the assertions relating to sizes and indexes into an inline
function, verify(). This hopefully reduces the string data generated
for assertions to the bare minimum.
Change-Id: Iad5c2e587ad189e7e1a62b9ca61ada4282c44f51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When deleting the last item in a chain, without it being the last item
in the chain, then we re-use the iterator which was passed in as an
argument. This is wrong if we detached earlier in the function, and
means we return an iterator to the previously shared data.
Pick-to: 6.2
Change-Id: I7da6309e23a32073da59e7da0cbfd1d16734f1ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Last pieces of code guarded by these defined were cleaned up back in 2016.
Task-number: QTBUG-98650
Change-Id: I52d971c2b476b7d8d362be7807b71b71e657c70b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Open the file only if matching on content is needed.
Use QFileInfo::filePath() instead of QFileInfo::absoluteFilePath() in
QMimeDatabase::mimeTypeForFile(). filePath() does much less work, and so
is faster. Thiago Macieira helpfully explained in a review comment why
the absolute path is not useful for correctness here: "Nothing needs
absolute paths within the same application that would resolve the
relative path to absolute. You only need an absolute path if you're
communicating with another application that may be in a different
directory."
QMimeDatabase::mimeTypeForFile() checks fileInfo.isDir(), so the
fileName.endsWith(QLatin1Char('/')) check in
QMimeDatabasePrivate::mimeTypeForFileNameAndData() was redundant when
called from this function. The other two callers of that function now
check this condition before opening IO devices. This improves
performance of the two QMimeDatabase::mimeTypeForFileNameAndData()
overloads in the corner case.
Refactor and optimize QMimeDatabasePrivate::findByFileName() and its
usages. Previously each caller constructed a QFileInfo object and passed
QFileInfo::fileName() into this function. Now the callers simply pass an
absolute or relative path to a file into this function, which then uses
QFileSystemEntry::fileName() to exclude the path. Constructing QFileInfo
is relatively expensive, so this change slightly improves performance.
Optimize QMimeDatabasePrivate::loadProviders() by calling static
QFileInfo::exists() instead of constructing a QFileInfo object and
calling the non-static QFileInfo::exists() overload. Note that the
QFileInfo object was always created, even if QFileInfo::exists() under
an `if` and an `#if` was never called.
The following table contains the average results of the added benchmark
tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before
and at this commit. The numbers denote milliseconds per iteration.
data row tag before at
MatchDefault:
archive 0.029 0.016
OpenDocument Text 0.029 0.015
existent archive with extension 0.039 0.025
existent C with extension 0.033 0.020
existent text file with extension 0.033 0.020
existent C w/o extension 0.076 0.074
existent patch w/o extension 0.11 0.105
existent archive w/o extension 0.069 0.066
MatchExtension:
archive 0.012 0.0115
OpenDocument Text 0.0115 0.011
existent archive with extension 0.017 0.016
existent C with extension 0.011 0.011
existent text file with extension 0.011 0.011
existent C w/o extension 0.016 0.0155
existent patch w/o extension 0.013 0.012
existent archive w/o extension 0.013 0.012
MatchContent:
archive 0.019 0.012
OpenDocument Text 0.019 0.012
existent archive with extension 0.053 0.051
existent C with extension 0.056 0.0545
existent text file with extension 0.058 0.056
existent C w/o extension 0.0605 0.059
existent patch w/o extension 0.10 0.099
existent archive w/o extension 0.057 0.054
Change-Id: Idb541656e073a2c4822ace3f4da412f29f2351f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Amend 97cfd49401, which resulted in
incorrectly laid out tables in Text elements.
Reported by the baseline test for the scenegraph. Not reproducible using
a QtWidget text widget, so no unit-test added here.
Pick-to: 6.2 5.15
Task-number: QTBUG-86671
Task-number: QTBUG-97463
Change-Id: I607b1fea3fb5923f81f05a3646bafebec3dcf3b5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This reverts commit 064c3d35e6.
Reason for revert: Causes crashes on querying. Better to endure the non-NULL representations of null QDateTime values.
Change-Id: I33dd3b95ab35d8e3accb864aec13d21764b1270d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
After the windows font engine was no longer marking everything as
scalable we started limiting the font size of requests to the maximum
of Courier when it was requested. This was a regression from 5.8 and not
in agreement with our documentation.
The problem is that we would only make the switch from Courier to
Courier New after having already gone through the foundry-lookup and
found a closest-available font size for Courier.
With this sanitization step in the backend we can make these changes
early enough that we haven't yet adjusted e.g. the font size.
Pick-to: 6.2 5.15
Fixes: QTBUG-58995
Change-Id: I319e93e6b78c7c3c5539964ac5ab4e05f8902ab6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
- GHS compiler is not fully compliant with iec559. Therefore we need
to update is_iec559 checking for GHS case.
Pick-to: 6.2
Change-Id: Ia094509d26bf5f0109f2937547a056267019cffb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
When running a test using -callgrind, we recurse into a child process,
run under valgrind, to which we pass -callgrindchild; and we only want
the output from the child process, since the parent won't actually be
running any tests. We also won't be using the global data table for
the test in the parent process. So bypass the set-up and tear-down of
both logging and the global data table in the parent process.
Prior to commit 3ee6d8d336, these parts
of the set-up and tear-down were skipped in the callgrind parent
process, but that refactoring split qExec() up into qInit(), qRun()
and qCleanup() to enable QtQuick to recombine them to implement an
equivalent of qExec(), calling qRun() once for each built-in style. It
needs these pieces of set-up to happen in qInit(), and of tear-down in
qCleanup(), to avoid repeating them for each style. Leave a comment in
qExec() that might help future readers to understand why it's done the
way it is.
Change-Id: Ieaca9a125c713b8fcf8dec8f9be0c024a798d504
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Its twoHundredMillionInstructions() test has #if-ery to limit it to
gcc and x86; however, it was testing only __i386 for the x86 part,
where gcc defines __x86_64 instead on modern 64-bit systems. In the
process, invert the condition and the branches it controls - positive
tests are easier to comprehend.
Change-Id: I8e906c606c48aa5034e02e3ed5d042fbb1f2ecbc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Development web server for web applications. Supports
http and https. Sets COOP and COEP headers.
The web server script supports certificate generation using
mkcert (github.com/FiloSottile/mkcert). Briefly, mkcert
supports generating server certificates for the current
local ip address(es), using a certificate authority
which can be installed on devices where the app should
run.
The COOP and COEP headers are required to enable the
SharedArrayBuffer API, which is required for Emscripten’s
pthreads implementation.
The server serves the current directory on localhost
by default. Use the “-a” argument to bind to an additional
address, or "--all” to bind to all IPv4 addresses found on
local network interfaces. Change the directory by passing
it as a positional argument.
Task-number: QTBUG-79087
Change-Id: Id0cba649e42af53ed8106e336a77e78398bcf901
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>