Support this both for parameters and return types, in all template
functions for calling methods or accessing fields.
To manage the life-time of the temporary objects, create a local stack
frame in the JVM around the calling function. Popping that implicilty
releases all local refernces, so that we don't have to worry about
doing so explicilty. Adding a local reference to the temporary jstring
objects is then enough for the object to live as long as it's needed.
The LocalFrame RAII-like type needs a QJniEnvironment to push and pop
the frame in the JVM, so we don't need a local QJniEnvironment anymore.
Reduce code duplication a bit as a drive-by, and add test coverage.
Change-Id: I801a1b006eea5af02f57d8bb7cca089508dadd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Those are never used, and removing this causes no problems.
Change-Id: Icae334d2d80197c4a416018e435e588a9c76d843
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
With all submodules ported, we can remove the old template functions
that prevented us from partial specialization for containers.
Change-Id: I78467b6b343b779270e6f49d7db4ac5deb1a0b95
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Add compile-time testing to make sure that we can declare a JNI
class String that maps to java/lang/String.
Change-Id: I2b68b2b46112e56b279f3fcddc3d71847a005924
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Move from a manually managed d-pointer to QESDP. This is a long overdue
change (QPen is one of the few classes still with manual management).
At the same time: it's also one of the central classes, and in order
to keep the impact minimal (and binary compatible), I'm not switching to
something more sophisticated.
As a drive-by: drop QPenData, a remnant only used by QPen itself, which
nowadays is simply a typedef for QPenPrivate.
Change-Id: I38834116d7d383f29bb69ff20b0a46dfe951bb53
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QlistWidgets with sorting enabled do not sort stable. A re-sort is
triggered when any Qt::ItemDataRole is changed and not only when
Qt::DisplayRole is changed. Due to an unstable optimization, the changed
element gets inserted at the beginning of their respective "equivalence
group".
This patch disables the optimization and ensures stable sorting
with std::stable_sort. Sorting is only performed, if the subset of
changed items in the range [begin, end] is not already sorted in the
whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check.
Limits / side effect:
The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets.
Task-number: QTBUG-113123
Pick-to: 6.5 6.6
Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Following a vmaCreate* it makes sense to test for
VK_ERROR_OUT_OF_DEVICE_MEMORY and print the allocator statistics
in order to give an idea of the application's (video) memory
usage.
For instance when running on a Raspberry Pi 4, this helps to indicate
that the application is just too big for the device, and is more
informative then just a Failed to create image: -2 message.
Pick-to: 6.6 6.5
Change-Id: I666e2358303894efab9d12d2b3a3d98f0bd3a5b6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Application deployment must know whether the Qt installation is a
debug_and_release build - or more generally, a multi-config build with a
debug configuration. Store the following information in
QtDeploySupport.cmake that's read at installation time:
- whether Qt was built multi-config with a debug configuration
- the postfix for debug libraries
Task-number: QTBUG-109444
Pick-to: 6.5 6.6
Change-Id: I96a2120ba1a2b03125661cc829498653e37dfb0f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>,
even if X* is convertible to T*, actually doing the conversion
requires access to the pointee's vtable in case of virtual inheritance.
For instance:
class Base { virtual ~Base(); };
class Derived : public virtual Base {};
Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is
implicit (it's a public base), but the compiler needs to dereference
`ptr` to find out where the Base sub-object is.
This access to the pointee requires protection, because by the time we
attempt the cast the pointee may have already been destroyed, or it's
being destroyed by another thread. Do that by going through a shared
pointer. (This matches the existing code for the converting assignment.)
This requires changing the private assign() method, used by QPointer, to
avoid going through a converting move assignment/construction, because
one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer.
Given it's the caller's responsibility to guard the lifetime of the
pointee passed into assign(), I can simply build a QWeakPointer<T> and
use ordinary (i.e. non-converting) move assignment instead.
Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1
Pick-to: 6.5 6.6
Fixes: QTBUG-117483
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When using css the size for the sort indicator is not honored correctly
and therefore the header view text overlaps the sort inidcator.
This patch reduces the available with for the text when (and only when)
there is a sort indicator shown), also for the size hint.
Fixes: QTBUG-115486
Pick-to: 6.6 6.5
Change-Id: Ic865bceaf98cd303490d821ecfb033abb8d6ba2a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Fix the code snippets to match the Qt coding style.
Change-Id: Id65d2253e620d217fa3ada7b82e28f4939336543
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Don't use QMap for parsing. Indroduce local enum and use it with std::array
Change-Id: I60fed6991ac415e4ff3827ae621f2c9b5071dcbe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reuse the existing QList container, but instead of holding
QAbstrictItemModel* now it holds a
struct{model,std::array<Connections>}.
Use std::array since the number of connections is known at compile time.
Drop the _q_ prefix from method names, it was used to mark them as being
used in Q_PRIVATE_SLOT().
This is similar to c609b8dba0, so a
similar performance improvement is expected.
Drive-by change, fix narrowing by using qsizetype instead of int in
a for-loop.
Change-Id: Iac70dcbff0a949c72daa6dae52e3f752c2ee0557
Reviewed-by: David Faure <david.faure@kdab.com>
to avoid needless tmp list
Change-Id: I5f6bc9c3edd17c04e5293feb0aad86cd5ed49695
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
for making url to improve readability
Change-Id: I743f183b64f2ed9c9363ea4fd2bdb8588fd84547
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
- use range based for more
- replace QSL with _s
Change-Id: I81b41d674e5976a62a52955abdb55c1f208a90cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QAbstractItemView installs the delegate as an event filter on the
editor, so the delegate will get the focusOut event (and other
events) before the editor does. QAbstractItemDelegate will then
emit commitData, signaling that the "updated" data should be
written back to the model.
In the case where the editor of a delegate (QAbstractItemDelegate)
is a QSpinBox with keyboardTracking set to false, the value of
the spinbox won't be updated while typing, but only when the
spinbox's text edit focus is lost. In this case, the delegate's
commitData will be emitted before the spinbox has had a chance
to update the value in its handling of the focusOut event.
To fix, make sure to update the value before the data is
committed to the model in the delegate's tryFixup method.
Fixes: QTBUG-116926
Pick-to: 6.5 6.6
Change-Id: I68540964342407d23387e4404a0fe3f00d80eb5f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
While this platform plugin does not have full multi-screen support,
it at least has the ability to choose the one to use via env.vars.
This currently does not work. What's more, it looks like it chooses
the last display by default, instead of the first.
Fix the display/display-mode logic. This now allows QT_VK_DISPLAY_INDEX
to work correctly, for example on a RPi4 with two screens connected.
Fixes: QTBUG-117416
Change-Id: Ia5ac8fde5827b3a2e1945e8e4f04fb8dd90704e2
Pick-to: 6.6 6.5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
It is impossible to see otherwise what is going on.
What's worse, it prints the screen geometry (that does not
include the virtual desktop adjustment), which is incredibly
confusing.
Change-Id: Ie67a4d8110a0b5c9cb75e6290f06c857a980d2c8
Pick-to: 6.6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Because it's a validation error with old ones, but required
in some cases from 1.3.216 on (MoltenVK). Ridiculous.
Amends 7fbc741d10 and
b018bc6e2d.
Fixes: QTBUG-117412
Pick-to: 6.6 6.5
Change-Id: I9b4cacbe611d4e557ee1c156527142eb919d6b77
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.
MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.
If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.
Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.
Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We can't use QFileSystemEngine::fillMetaData() because there's no bit in
QFileSystemMetaData to indicate the sticky flag, so we must make a at
least one stat() or lstat() call ourselves. Given that we need to know
if $root/.Trash is a symlink, that system call must be lstat(). And it
turns out that system call provides everything we need to confirm its
suitability.
This avoids QDir overhead just to manipulate strings.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c5e54199ecb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
d026fad3d9 added converting constructors
for QPointer. This however made converting _assignments_ ambiguous,
introducing a regression for users coming from Qt < 6.6.
This code:
QPointer<Base> base;
QPointer<Derived> derived;
base = derived;
used to convert `derived` to `Derived *` (using the implicit conversion
operator from `QPointer<Derived>` to `Derived *`), and then the
assignment operator for `QPointer<Base>` that took a `Base *`.
The introduction of the conversion constructor in 6.6 makes it possible
to convert `QPointer<Derived>` to `QPointer<Base>`, and then fall back
to the compiler-generated assignment operator for `QPointer<Base>`.
The result is that the code above is now ambiguous and stops compiling.
Fix this by adding a converting assignment operator for QPointer.
I'm only adding the const-lvalue overload because the implementation
requires going through the private QWeakPointer::assign helper. We
cannot copy-assign or move-assign the inner QWeakPointer, as those
assignments require lock()ing the QWeakPointer and that's not possible
on a QObject-tracking QWeakPointer (but cf. QTBUG-117483).
Assigning from a rvalue QPointer would mean calling assign() on
the internal QWeakPointer _and_ clear the incoming QPointer,
and that's strictly worse than the lvalue overload (where we just call
assign()).
Change-Id: I33fb2a22b3d5110284d78e3d7c6cc79a5b73b67b
Pick-to: 6.6 6.6.0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QObject::disconnect(connection) already sets connection.d_ptr to
nullptr, and the default constructor only does that:
QMetaObject::Connection::Connection() : d_ptr(nullptr) {}
So calling disconnect() suffices in this case.
Pick-to: 6.6 6.5 6.2
Change-Id: Icd5f9a15c83939eeecd9efb474ac3b38c0f2dfe4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
To follow latest Play Store requirement.
Pick-to: 6.6.0 6.6 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
It was used twice, in both cases to create a QFileSystemEntry, so the
two results were equal. Therefore, just use the first result to create
the second.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d45d20485f40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We have other variables whose name start with 'info' in this function,
so infoPath is misleading: it's not the path to infoFile and it isn't
related to the infoFileName. Instead, it's the path to the file being
trashed which will be saved in the info file.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d358a0e02dfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Makes it easier to locate later which test may be leaking stuff.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QDir::mkdir() followed by QFile::setPermissions() is a race condition
because an attacker could enter the directory before we set the
permissions. QDir::mkdir() got an overload with the permissions in 6.3,
but I decided to go a level lower and use QFileSystemEngine directly
here.
Pick-to: 6.5 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c338e21c129e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The moveToTrash tests, on XDG platforms, would be trashing to
~/.local/share/Trash. Unlike Windows and Apple systems, the XDG trash
spec creates two files and these tests weren't deleting both of them, so
we had a slow increase of left-over files in ~/.local/share/Trash/info.
Cleaning up ~/.qttest is left as an exercise for the users. For example,
$ cat ~/.config/user-tmpfiles.d/qttest.conf
#Type Path Mode User Group Age Argument
e %h/.qttest 0700 - - 1w
Pick-to: 6.6 6.5 6.2
Change-Id: I9d43e5b91eb142d6945cfffd1786aeff91d34fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The project has been superseded by Qt for WebAssembly and was
never supported in Qt 6.
Pick-to: 6.6 6.5
Change-Id: I36682cfe3ce6adac76a307b0faba97dcb7c655cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Android APIs use integer constants like enum values, so they are mapped
to one of the integeral types (jint, jshort, jlong etc) on the C++ side.
Enable C++ code to declare an equivalent enum (scoped or unscoped), and
to use that enum as a type in JNI calls by treating it as the underlying
type in the signature() generator.
Add a helper type trait that maps enums to their underlying type and
other integral types to themselves (we can't use std::underlying_type_t
on a non-enum type). Add tests.
Note: Java Enums are special classes with fields; this change does not
add any special support for those.
Change-Id: Iec430a1553152dcf7a24209aaebbeceb1c6e38a8
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
For some reason mdls fails to resolve the kMDItemVersion for Qt
Creator in some cases, even if the Info.plist has the required
version keys, and the version shows up fine in Finder.
Work around it by manually reading the version from the Info.plist
Fixes: QTBUG-117204
Change-Id: I60d57fb728608e139a4540fabf1006fc2681d0a7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
If loading the lldbbrige fails, we'll continue on to the next
Qt Creator version if we find one. It makes more sense to report
that we're about to load from a given version, so that any error
messages from lldbbridge are output with that context in place.
Change-Id: Icbab6f7d39333ce76d729fd0769cfdb44f05a2f0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
When the raster window is resized, we need to resize the backingstore,
and make sure we repaint the entire window. We defer the backingstore
resize to beginPaint, in case multiple resize events come in before
we have a chance to paint, but we can't defer the invalidation of the
paint device window, because QPaintDeviceWindowPrivate::paint() has
already subtracted the paint region from its dirty region at this
point. Invalidating yet again will result in the dirty region of
window not clearing fully until after the final resize, and when
that happens we will also repaint the window with the wrong dirty
region, based on the window's original size.
My moving the window invalidation to the resize event, while keeping
the deferred backingstore resize we avoid this problem.
Pick-to: 6.5 6.6
Change-Id: I44662778f5b1bcd259b20ca86124e6487561ef4f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If there is a reason to static_cast to `const QAIM*` then cast away the
const, I failed to see it. QObject::sender() returns a non-co.
Change-Id: Ibf8c8613c3de1584b426269c1ffba94db75d26d6
Reviewed-by: David Faure <david.faure@kdab.com>
Create QString at compile time using the literal operator""s instead of
using pointer to characters. This way, no conversion or allocation will
occur at runtime.
Task-number: QTBUG-117425
Pick-to: 6.6 6.5
Change-Id: I2a19d4fe1150aad7908d0c2a7215099bc0814e8d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>