[ChangeLog][QtCore][QStringList] Added indexOf() overloads that take
QString/QStringView/QLatin1StringView, and a Qt::CaseSensitivity
parameter. Prior to this using QStringList::indexOf() called the methods
inherited from the base class.
Task-number: QTBUG-116918
Change-Id: Ibc42130b6509f6ecfe7de0d6be378f226ae61982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now that users can pass a QStringMatcher to do the matching, change the
existing overload to not use QStringMatcher.
Thanks to Giuseppe D'Angelo for the idea of passing a QStringMatcher to
filter instead of using a magic number to decide whether to use
QStringMatcher or not.
Results of running filter() and filter_stringMatcher, times are in msecs
and this was compiled with gcc -O3:
Without With QStringMatcher
list10 0.00022 0.000089
list20 0.00040 0.00014
list30 0.00058 0.00018
list40 0.000770 0.00023
list50 0.00094 0.00027
list70 0.0012 0.00037
list80 0.0014 0.00041
list100 0.0018 0.00050
list300 0.0054 0.0014
list500 0.0091 0.0023
list700 0.012 0.0032
list900 0.016 0.0041
list10000 0.17 0.045
Drive-by change: optimize tst_QStringList::populateList().
[ChangeLog][QtCore][QStringList] Added filter(const QStringMatcher &)
overload, which may be faster for large lists and/or lists with very
long strings.
[ChangeLog][Possible Performance Changes][QtCore][QStringList] Changed
the implementation of filter(QStringView) overload to not use
QStringMatcher by default. Using QStringMatcher adds overhead, so it is
beneficial/faster when searching for a pattern in large lists and/or
lists with long strings, otherwise using plain string comparison is
faster. If using QStringMatcher makes a difference in your code, you can
use the newly added filter(QStringMatcher) overload.
Change-Id: I7bb1262706d673f0ce0d9b7699f03c995ce28677
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Invalid are usually those mounted on a filesystem we can't access:
$ df /run/user/0/gvfs
df: /run/user/0/gvfs: Permission denied
$ ./qstorageinfo /run/user/0/gvfs
Could not get info on /run/user/0/gvfs
df already doesn't include it by default:
$ df | grep -c gvfs
0
But we were:
$./qstorageinfo | sed -n '1p;/gvfs/p'
Filesystem (Type) Size Available BSize Label Mounted on
gvfsd-fuse (fuse.gvfsd-fuse) RW 0 0 0 /run/user/0/gvfs
Note also how this is showing a total size of 0, which is usually the
type of filesystem we exclude. It's actually -1 but got rounded down to
0 when we divided by 1024.
Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d7e4f9dc13b24
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This function is only called with the name of a file coming from
QFileInfo::fileName() so it's usually already detached anyway. And if
there's nothing to decode, pass the string through without even
attempting to modify it.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787651437074d35
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Instead, create a (flat) map of the entries that we can seek on while
creating the list of mountedVolumes(). On my machine, that went down
from 14 times to 1.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd17875458541f28f9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Instead of the previous realpath() comparison resulting from the symlink
processing. parseMountInfo() was extracting the device number from
/proc, so this information was already readily available.
We must take care of anonymous block devices (major == 0). Certain
filesystems, such as btrfs, always use them, so we must still stat() the
device path to get the real block device.
This implementation assumes that udev only creates entries in the
/dev/disks/by-label directory that are symlinks to real devices, but
that must already be the case because they are in /dev in the first
place. An alternative implementation would be to compare the inode and
host device (st_dev) of the entry, if different /dev entries could have
different labels. I don't think that's possible. But multiple /dev
entries for the same device is definitely possible.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787552af3d09676
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This fixes a similar problem as the previous commit. Because Linux
allows one to mount over non-empty paths, it's possible to make
mountpoints unreachable, and yet they will still be present in the
/proc/self/mountinfo listing. Because we have the device ID from the
scan, we can confirm that the mountpoint matches the MountInfo.
# mkdir -p /tmp/foo/bar
# mount -t tmpfs /tmp/foo/bar
# mount -t tmpfs -o size=1M /tmp/foo
# mkdir /tmp/foo/bar
$ ./tests/manual/qstorageinfo/qstorageinfo | awk 'NR==1 || /tmp\/foo/'
Filesystem (Type) Size Available BSize Label Mounted on
tmpfs RW 1024 1024 4096 /tmp/foo
Change-Id: I79e700614d034281bf55fffd178f8b99b10a8b69
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Linux allows admins to mount new filesystems over non-empty paths
(though I managed to do so on FreeBSD and macOS too), so we must find
the most recent mount that applies to this path instead of the longest
matching mountpoint. We do that by scanning the /proc/self/mountinfo
list backwards and thus any matching isParentOf() must be the correct
one.
# mkdir -p /tmp/foo/bar
# mount -t tmpfs tmpfs /tmp/foo/bar
# mount -t tmpfs -o size=1M tmpfs /tmp/foo
$ ./tests/manual/qstorageinfo/qstorageinfo /tmp/foo/bar
Filesystem (Type) Size Available BSize Label Mounted on
tmpfs RW 1024 1024 4096 /tmp/foo
But we must guard against an earlier mount still being (somehow)
accessible. We've seen this in the CI, where /run is earlier than / but
still somehow accessible -- I guess this is one or a pair of mount
--move.
An additional benefit is that don't even attempt to compare to the
virtual filesystems mounted by the system early after boot, if what
we're looking for isn't the root.
See next commit for a fix for QStorageInfo::mountedVolumes().
Change-Id: I79e700614d034281bf55fffd178f8befc5e80edb
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
When a child window is made visible without its parent having been
created yet, we defer creating and making the child visible until
the parent is created.
But if a child window is explicitly created, we create the parent
first. And creating the parent will in turn apply visibility to
all children that had their visibility deferred. Which includes
creating the child.
This results in child -> parent -> child creation recursion,
which means that when we return from creating the parent window
we already have a platform window for our child, and should
bail out.
Pick-to: 6.6 6.5
Change-Id: I11dc4864b57f031de2cca70b79cdfc057d4fbd0d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The existing pattern() method always returns a QString, which means that
if the matcher was constructed using a QStringView, pattern() would
uncoditionally convert it to a QString.
This is useful to check if a match is exact:
auto pattern = matcher.patternView();
if (pattern.size() == needle.size() && matcher.indexIn(needle) == 0)
....
This may be needed for a later change in QStringList::contains();
regardless of that, this change makes sense on its own.
Change-Id: I49018551dd22a8f88cf6b9f878a5166902a26f58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
errno should be queried immediately after a libc function call fails,
calling it later on in QSystemError::stdString() may be too late.
Part of the goal of this, and similar, changes is removing the default
value of the stdString() method's parameter, to signify to users of that
method that errno should be stored ASAP if there is an error.
If there is any intervening code that may call a system/libc function
store errno in a local int var, otherwise use it directly in the
QSystemError::stdString() call, which takes by value.
Task-number: QTBUG-115199
Change-Id: If3f601a023ed0014e260089771220668dad88be8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Amends 1399b3ccce -- this one just slipped through the cracks.
Change-Id: I72c6c93b85cc609546fbd2af7c9a80f3ac360ee2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When running on operating systems that don't offer modern APIs, we need
to round up to ensure we don't under-sleep and wake up before the timers
actually expire. In most cases, this is not a big deal because we'd go
right back to sleep and then wake up again.
The problem is that this new sleep would be for a duration of 0
milliseconds, so we'd end up busy-waiting until the timers do expire.
It's for less than 1 ms, but it's still power-consuming.
It's also perceptible when someone uses processEvents(), because we
could end up saying we didn't process anything, despite waiting for more
events. Since that violates the guiding rule for processEvents() (don't
ever use it), I don't consider this a big deal.
Fixes: QTBUG-118199
Pick-to: 6.5 6.6
Change-Id: I79e700614d034281bf55fffd178f0611be96bfa7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Simplify removeAnimation by directly passing the pointer to remove to
the function instead trying to figure them out later on and relying on
QObject::sender().
Change-Id: I9de3a138c60b0da8dd1ab23fe8521798b7f4c13c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Use pmf-style connect in QCommonStyle and remove the unused function
animationTargets() as a drive-by
Change-Id: I60e361ab00429a95eeab8799743996cea3f1469a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Use pmf-style connect in QStyleSheetStyle. styles subdir is now
old-style connection free.
Change-Id: I926ff308a823212b0512328b96dd6779d6cb30fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The !enabled branch does nothing so it can be safely removed. Also
remove the unneeded documentation since it's a simple reimplementation
from the base class.
Change-Id: Iea6e77ab42b09a30f73ae2f1f671eb4198a31c41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove superfluous explicit function prototypes in documentation, and
remove the unused QJniScopedLocalRefPrivate specialization of
QScopedPointer<_jobject>.
Change-Id: I6407522746bc9756cdaceea8e0e0a32d0830eeee
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Amend 80d4d55e25. It should not be
possible to convert a QJniArray<jobject> to e.g. a QJniArray<jstring>,
so SFINAE out any construction that would convert between unconvertible
element types. To prevent the fall-back to constructing from QJniObject,
make those constructors explicit, which they should have been anyway.
Change-Id: I17fd9dfcea425a7bfa34d7bef736bab2be42a536
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Add an overload for fontTable (we can't deprecate the const char *
overload as it will be used for string literals, even if the tag-
overload would work), and use the tag type in the test instead of
QByteArray.
Task-number: QTBUG-117046
Change-Id: I104f11a25e9c453a5d1081b6cf320bdc186b7e80
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Replace the local MAKE_TAG macro definition with QFont::Tag's support
conversions to and from big endian byte ordering.
Also replace the incorrect usage of the big-endian-producing MAKE_TAG
macro in the DirectWrite implementation. The IDWriteFontFace
documentation suggests to use the DWRITE_MAKE_OPENTYPE_TAG macro for
producting the tag, which is equivalent to the LittleEndian
implementation of QFont::Tag::value.
Task-number: QTBUG-117046
Change-Id: I1e522c1c6006b8bcf66110bd74a36a42ed28f7e4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Instead of overloads and generic string literals with runtime checks,
use a dedicated Tag type for specifying the font feature. The Tag type
can only be instantiated with a string literal of exactly 4 characters
(plus the terminating null)l; longer or shorter literals result in a
compile time error.
Constructing a Tag from any other string type is possible through the
named fromString constructor, in which case we can only check the length
and warn at runtime.
The type's API is almost completely constexpr so that we can use it to
calculate e.g. enum values.
Task-number: QTBUG-117046
Change-Id: I31038c7c6fd2b843a105b032f021e506b0b60822
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
... by checking if SECBUFFER_APPLICATION_PROTOCOLS is defined.
In this case, we assume that the current environment supports ALPN.
Then we no longer do a blanket block for all mingw configurations.
Pick-to: 6.6
Change-Id: I2eedb813a5bdc3b1a5097053b04aa45d25d175aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Partly because it also saves to CBOR, but also because our guidelines
say to avoid using "Example" in the title.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id858475a6b0474228cfe8044e188cc763f56e3a8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Since these functions perform the same operation as the base class
QAbstractProxyModel, we can use the counterparts of the basic class
directly to keep the implementation clean.
Change-Id: Ie16a988f5ad25eb202351713e6aee73df266209b
Reviewed-by: David Faure <david.faure@kdab.com>
Same problem, and same solution, as in
0f0371c830.
Pick-to: 6.6
Change-Id: I79e700614d034281bf55fffd178f56772b09cf25
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Use the new function to convert into a QVLA instead of first
converting to a QString and then to a QByteArray. One conversion and
one buffer instead of two each.
Pick-to: 6.6
Change-Id: Ieaa24c8ef325797b5a89e8da0ca4310667c00fa7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Define color groups used for shading and in order to render specific
inactive texts, e.g. menu item text.
Found-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Pick-to: 6.6 6.5
Change-Id: I736f5aff1ff5379ce3f78b53e547b0b5f552779f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Instead of creating a temporary QJniEnvironment for each access to the
array, reuse the one stored in the QJniObject. This is much more
efficient, and also protects against invalid access to the array from
multiple threads.
Change-Id: Id253a51ca64d4b3af333b14ec62ae176e1663604
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
While a minor issue, it's possible to use them in a way requiring
a definition, triggering a linker error. We can either make them
inline or constexpr.
Pick-to: 6.6 6.5
Fixes: QTBUG-118170
Change-Id: Ia3dede91b989b295c3e792691d534648581a27c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Calling std::mutex::try_lock() when the mutex is already owned by
the thread casuses undefined behavior.
Change-Id: I024ced271cad8a034bebf80b48e31e7e7461c560
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
[ChangeLog][Android][Deployment Changes] Now the auxillary mode
of androiddeployqt also copies the templates and the stdcpp lib
file without building the APK.
Fixes: QTBUG-115241
Change-Id: I3d4647277e7f62f079c683645443462ef8026948
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
For those that simply repeat or skip a whole calendar day, life is
fairly simple. However, Alaska's 24-hour transition at 15:30 LMT Sitka
(incidentally combined with a change of calendar) is a bit trickier.
Also fix a typo I noticed in passing.
Write tests to determine what the actual behavior is and document
enough to make the actual behavior seem unsurprising once encountered,
without trying to go into all the excruciating details. Naturally, MS
time-zone data lacks the data on the historic transitions involved in
these tests, so MS (when not using ICU's time-zone data) is excluded.
It seems Cupertino believes Alaska was always in the USA, too.
Change-Id: Ia638c04d2ffc3a956a70a2a85badb7bbfdbb791c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, requesting a time that got repeated - on the given date,
due to a fall-back transition - would get one of the two repeats,
giving the caller (no hint that there was a choice and) no way to
select the other. Add a flags parameter that captures the available
ways to resolve such ambiguity or select a suitable time near a gap.
Add such a parameter to relevant QDateTime methods, including
constructors, to enable callers to indicate their preference in the
same way. This replaces DST-hint parameters in various internal
functions, including QTimeZonePrivate's dataForLocalTime(). Adapted
tst_QDateTime to test the new feature.
Adapt to gap-times no longer being invalid (by default; or, when they
are, no longer having a useful toMSecsSinceEpoch() value). Instead,
they don't match what was asked for. Amend documentation to reflect
that. Most of the code change for this is to QDTParser and QDTEdit.
[ChangeLog][QtCore][QDateTime] Added a TransitionResolution parameter
to various QDateTime methods to enable the caller to indicate, when
the indicated datetime falls in a time-zone transition, which side of
the transition to fall or whether to produce an invalid result.
[ChangeLog][QtCore][Possibly Significant Behavior Change] When
QDateTime is instantiated for a combination of date and time that was
skipped, by local time or a time-zone, for example during a
spring-forward DST transition, the result is no longer marked invalid.
Whether the selected nearby date-time is before or after the skipped
interval may have changed on some platforms; unless overridden by an
explicit TransitionResolution, it is now a date-time as long after the
previous day's noon as a naive reading of the requested date and time
would expect. This was the prior behavior at least on Linux.
Fixes: QTBUG-79923
Change-Id: I11d5339abef9e7125c4e0dc95a09a7cd4f169dab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's only called in exceptional circumstances, so the compiler should
optimize it for size, not speed, and paths leading up to calls to this
functions should be automatically marked as [[unlikely]].
Marking the function as cold accomplishes both.
GCC 11 seems to have had this figured out by itself, possibly
backtracking from the unconditional qWarning() in the first line of
the function, but it did have a (very small) effect on Clang 15, so
leave it in, if only as documentation.
Pick-to: 6.6 6.5 6.2
Change-Id: Ie8e9049300825a3aae2f9678a2907ceea0b21d1c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QPalette specifically has quite a large amount of output (1363
characters) when toString
is called on it. We should make sure that we can fit that in our
failure messages. This patch does that by increasing the limit from
1024 characters to 4096.
Fixes: QTBUG-5903
Fixes: QTBUG-87039
Pick-to: 6.5 6.6
Change-Id: I1dc5078ad05858bb6542c3a06c6b84711af79e4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We will use it without holding an instance later. And there's
no reason it is not static already.
Change-Id: I06d455bb2852244c8a4993ea75ceda4e1cb679fb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Previously, it was left to the caller to guess.
Change-Id: Icc22b8c874046de78e16253cf0cc3ba2f334362b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The tooltip text doesn't show with right palette when application runs
in dark mode using gtk3 theme.
This patchset removes explicitly setting ToolTipText palette in
gtk3theme.
Pick-to: 6.6 6.5
Change-Id: Id90626a377733814c3f32f0bf7e5539097b76dd6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QNetworkAccessManager may fail to finish with Windows apps that are
running with low integrity level sandboxing.
The root cause is that such applications are not allowed to open ROOT
system certificate store with write privileges. This causes the
CertOpenSystemStore helper function to fail, because it attempts to open
certificate stores with the option of adding or deleting certificates.
We only use the CertOpenSystemStore with the intent of fetching
certificates from the certificate store, so we do not need write access.
The fix for this issue is threfor to open the system certificate store
as read-only by using the lower-level CertOpenStore function.
The CERT_SYSTEM_STORE_CURRENT_USER flag is provided to CertOpenStore to
keep the documented behavior of CertOpenSystemStore, which states "Only
current user certificates are accessible using this method, not the
local machine store."
Fixes: QTBUG-118192
Pick-to: 6.5 6.6
Change-Id: I529b760398f84137a0e95c8088a71b293d302b54
Reviewed-by: Fredrik Orderud <forderud@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Documentation for the other functions refer to seat(), but that itself
isn't documented
Pick-to: 6.6
Change-Id: I9a628e87153b687b2fa444798de1af74e6251eee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
To allow building and developing from Android Studio and get rid of
warnings.
Change-Id: I5f896a270917120f98eefd2f4aa449714451f994
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This check for error code is never reached, the error code is
always set to 0 in startApp() and then check for in loadApplication()
while the latter method is only called by
startApp().
Task-number: QTBUG-114593
Task-number: QTBUG-115016
Change-Id: I762009d76567cc1d090fe29048c35220d433dd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
The variable m_optionsMenuIsVisible is assigned but never
used.
Task-number: QTBUG-114593
Change-Id: Ie4b61b37f2bc05d8d2a348dcad7487eb8fa1ac00
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Clean the long lines on the code, extract into smaller methods where
appropriate, and some small naming or logic clarifications. Some of the
deeper code might use some simplification but that's for another patch
with better debugging to avoid potential regressions.
Task-number: QTBUG-118077
Task-number: QTBUG-114593
Change-Id: I8964b87727819b4846c51f5fa5febfa8caae4f8d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
To further simplify the code and logic of the delegate, move keyboard
input code to separate class. Make an input delegate available under the
QtActivityDelegate to allow classes like QtNative and the Activity to
access that. For now, it's okay to leave access from QtNative to that,
but for future even that should be simplified and the Activity should be
accessing that directly.
For the case where the QtInputDelegate needs access to
QtActivityDelegate, for now namely updateFullScreen(), a new Listener
is implemented to be implemented under QtActivityDelegate.
Along the way use newer JNI APIs under C++ QtAndroidInput.
Don't make them static methods, so that it can be possible later to
do various keyboard operations to specific activity and not a global
one.
Task-number: QTBUG-114593
Task-number: QTBUG-118077
Change-Id: I110b897f6f16d0ae5f5a645551b4a82e8ad3f2fb
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
If a QJniObject method that uses the stored JNIEnv pointer is called
from a different thread than the one the object was created in, then a
FATAL abort of the JNI runtime is likely, but hard to debug (the error
messages from JNI are visible in the logcat log of adb).
In debug mode, compare the stored JNIEnv pointer with the one provided
for the current thread, and emit a critical runtime warning if they do
not match, as this indicates a race condition to the underlying JAVA
object.
Change-Id: Ief578f445bcfab1939ddbe95c6ba796279be9115
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Almost all operations on a QJniObject require a QJniEnvironment,
including the construction and destruction of a QJniObject. Instead of
instantiating a temporary QJniEnvironment object in each call, store the
one from the constructor in the private, and reuse it.
Pass the stored environment through to other functions needing it, and
add a checkAndClearExceptions() wrapper.
Static class members still need their own QJniEnvironment, but we can
reuse the one we have to get both jclass and jmethodID rather than
creating new QJniEnvironments in several wrappers.
As a drive-by, clean up nullptr usage in the test that failed when
shortcutting isSameObject for the trivial cases.
Change-Id: Ibadbd2be8a0ec9ab62daf285608ee7fe0a3c8852
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Our signature mapping treats both e.g. bool and jboolean as "Z", and it
is allowed to pass a bool variable as an argument to a function expecting
a jboolean. Except for fields and callMethod return values, where we only
allowed the JNI primitive types.
Fix this by comparing the signatures and size of the type we have with
the JNI types that there are explicit functions for. Cast from and to
the JNI type in both directions to address narrowing (e.g. jboolean is an
unsigned char and converting to bool would be narrowing, even though
both are 8bit types).
This way we can get boolean fields using getField<bool>, and int fields
using getField<int> etc.
Change-Id: I2f1ba855ee01423e79ba999dfb9d86f4b98b1402
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
While we can probably deprecate this function, with the change of
Q_DECLARE_JNI_CLASS'ed types to be QJniObjects we need to correctly
translate from e.g. jobject to QJniObject.
Amends 62cb5589b3.
Change-Id: Id3c23fc0724e2eff895029b694d418481abcb8e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Since QWasmIDBSettingsPrivate is only supported on JSPI now, there is
no need to maintain the isReadReady flag anymore. This lets us simplify
the class a lot.
Change-Id: I67322389463af13b5110091a4f8433f08da19925
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The header uses QPointer in-name-only, so it doesn't need to include
the class' header file. A forward-declaration suffices.
[ChangeLog][Potentially Source-Incompatible Changes] The headers
qevent.h and qfuture.h no longer include the header qpointer.h.
Change-Id: I8d3c3b56f5928a0745a523abf5df3b8106dc15ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Simplify addIconFiles() by passing an initializer list instead an
c-array + size
Task-number: QTBUG-118122
Change-Id: Id54bbe8436a9106e59b6fede81e31c3065623b4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Dont't checks before call QCursorData::initialize().
The inside of QCursorData::initialize() already checks initialized.
Change-Id: I4b34218132df9decf7d04dcc31e873daf300ffe6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Instead of a sequential and thus predictable counter. This improves the
performance of when you keep creating and trashing the same file base
name. The previous algorithm would try all occurrences from 0 to however
many trashings have happened.
This could have been any random number, but the source file's inode is
"random" enough for us.
strace of the second file's trashing:
openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = -1 EEXIST (File exists)
newfstatat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", {st_mode=S_IFREG|0644, st_size=16, ...}, 0) = 0
openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 4
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, st_size=2852, ...}, 0) = 0
write(4, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
renameat2(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/files/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891", RENAME_NOREPLACE) = 0
close(4) = 0
Change-Id: I9d43e5b91eb142d6945cfffd1786d73459c2eb3d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
So we can more easily get any errors from attempting to write the file.
It is possible to get them with QFile, by either doing .flush() or using
QIODevice::Unbuffered, but using the C API is a definite sure way. Plus,
since this is QFileSystemEngine, this avoids the possibility that QFile
may choose to use a different file engine than the native one, for some
reason. And it reduces overhead.
This allows us to more easily detect why the file creation failed and
therefore stop looping if the error wasn't EEXIST. That will avoid an
infinite loop in case the necessary directories exist but aren't
writable.
It's also moved above the renaming, such that the failure to populate
the info file prevents the renaming too. Both operations can have the
same likely errors, ENOSPC and EIO. The likelihood of EIO is very low,
for both; but for ENOSPC it's far more likely for writing the
file. Avoiding the ENOSPC error for the renaming is handled in a later
commit.
Change-Id: I9d43e5b91eb142d6945cfffd1786d417142ac728
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
QStorageInfo is great, but rather expensive, so this introduces a faster
check by stat()ing the source file and $HOME, to see if they are the
same device, saving us two or three QStorageInfo constructions. That is
a necessary condition: if they aren't the same device, we know rename()
into $HOME/.local/share/Trash will fail.
But it's not a sufficient condition: they need to be the same mount
point and that's something only QStorageInfo will give us. Strictly
speaking, the only way to be sure that you can rename() into the trash
path is to, well, attempt it (as usual, something for a later commit).
Change-Id: I9d43e5b91eb142d6945cfffd1786c474cac25083
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This is not a security issue because we still use QIODevice::NewOnly
(O_EXCL) and loop again. But because we do so, we don't need to check
for existence with QFile::exists() in the first place.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c98a39781517
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Make it receive the QSystemError so it can set the error condition
properly in case the suitable location for this input file can't be
found. This also includes the case when the input file does not exist in
the first place, which I moved into the function because upcoming
commits will imply this check anyway.
Change-Id: I9d43e5b91eb142d6945cfffd1786c6e59d3b0204
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The m_children container isn't used at all, so remove it. Spotted by
Volker Hilsheimer.
Change-Id: I79db1f77c0e4caf8ebab1573a82e07396a6a806b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Instead, check the macro that we're about to use. This is also done in
qprocess_unix.cpp
Pick-to: 6.5 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Extract the information about the relation between invalid and valid
datetimes into a snippet, and include it in the documentation of
every relational operator.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We need to re-apply the application badge when the color scheme changes;
when a task bar button is being created for the fist time; or after Explorer
has crashed and re-started.
But we should only do that if the user has set an application badge
via our APIs. Otherwise we might end up clearing an existing badge
that was set via the native APIs directly.
Fixes: QTBUG-118117
Pick-to: 6.5 6.6
Change-Id: I1f1fecba44c118d4e3f7ef4119139c3ebd23f047
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The SWP_NOCOPYBITS flag helps suppress some jittering during resizes.
At the moment this is called even for plain moves with no window
resizing. Make sure that the window geometry has changed before applying
the SWP_NOCOPYBITS flag
Fixes: QTBUG-115992
Pick-to: 6.6 6.5
Change-Id: Ic0cb32d9eb3b557bf2b2ef5b6ba80d34e27c5c19
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
When the -executable parameter is specified, macdeployqt uses
@loader_path instead of @rpath. This case was not handled in
getBinaryDependencies() used for the code signing.
Fixes: QTBUG-118075
Pick-to: 6.6
Change-Id: Ie1e0d0781305e1849df9ec0d5fb1c3ce6713a62b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Add two overloads to QNetworkAccessManager to support GET requests
with body.
Modify QNetworkReplyHttpImpl as well as these requests should not
be cached.
If the request is redirected it is possible that its type changes
from POST/PUT to GET and in this case the message body is deleted.
However, if a GET request has a body it should keep it after it has
been redirected - modify QNetworkReplyHttpImpl to keep the message
body after it has been redirected.
Fixes: QTBUG-112871
Change-Id: Ib01898638ed94238a98291870a5c51d56030868a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
The m_edges container isn't changed after it's initialized in the
constructor; so make it const.
This amends commit 641bccce2a.
Change-Id: I387eb2562475bc4910700d48f67303b0a5f80ccd
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
`QVFuncList` and `QStartUpFuncList` are identical typdefs
(`QtCleanUpFunction` and `QtStartUpFunction` are identical typedefs):
typedef QList<QtCleanUpFunction> QVFuncList;
typedef QList<QtStartUpFunction> QStartUpFuncList;
So from the compiler's POV QVFuncList and QStartUpFuncList can be used
interchangeably, but from a code reader's POV, this is confusing.
Use IILE to make the local variable const.
This amends commits 9429226524 and
a887891271.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Saves us from having to create a lambda functor object.
Change-Id: I5e790e693b57ae414ac6d6be84f18b76b3e8185c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Mostly applying clang-format and clang-tidy fixits for:
- Redundant code (e.g. bool == true/false)
- Use member initializer list
- std::move for parameters taken by copy
Change-Id: I3b9a7f01db67291f889b42346a95c55ad74f054c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Slightly improves performance in the new benchmark
Change-Id: I2d71143ff7bc1f32ebb172f20be1843dec123e6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When the Command key is pressed AppKit seems to do key equivalent
matching using a Latin/Roman interpretation of the current keyboard
layout.
For example, for a Greek layout, pressing Option+Command+C produces a
key event with chars="ç" and unmodchars="ψ", but AppKit still treats
this as a match for a key equivalent of Option+Command+C.
We can't do the same by just applying the modifiers to our key map,
as that too contains "ψ" for the Option+Command combination. What we
can do instead is take advantage of the fact that the Command modifier
layer in all/most keyboard layouts contains a Latin layer. We then
combine that with the modifiers of the event to produce the resulting
"Latin" key combination.
If the unmodified key is outside of Latin1, we also treat that as a
valid key combination, even if AppKit natively does not. For example,
for a Greek layout, we still want to support Option+Command+ψ as a key
combination, as it's unlikely to clash with the Latin key combination
we added above.
However, if the unmodified key is within Latin1, we skip it, to avoid
these types of conflicts. For example, in the same Greek layout, pressing
the key next to Tab will produce a Latin ';' symbol, but we've already
treated that as 'q', thanks to the Command modifier, so we skip the
potential Command+; key combination. This is also in line with what
AppKit natively does.
Fixes: QTBUG-96371
Fixes: QTBUG-79493
Task-number: QTBUG-112736
Change-Id: I30d678c1c7860642d3eed29c7757133ff74c6521
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
An incoming key event with a set of modifiers can potentially match
a range of key combinations, depending on how the event's modifiers
are combined to produce "intermediate" representations of the event.
For example, given a normal US keyboard layout, the virtual key
23 combined with the Alt (⌥) and Shift (⇧) modifiers, can map
to the following key combinations:
- Alt+Shift+5 (Fully expressed combination)
- Alt+% (Shift consumed to produce %)
- Shift+∞ (Alt consumed to produce ∞)
- fi (Shift and Alt consumed to produce fi)
But in other cases the intermediate modifier combinations
produce the same key/symbol as other modifier combinations.
For example, pressing Alt (⌥) and Shift (⇧) with the 'c'
key on a US layout will produce:
- Alt+Shift+C (Fully expressed combination)
- Shift+Ç (Alt consumed to produce Ç)
- Ç (Shift and Alt consumed to produce Ç)
In this case, we don't want to reflect the standalone 'Ç',
as that has already been reflected in the more direct form
via Shift+Ç. Consuming the additional Shift modifier does
not produce any additional symbols.
The same can happen without the number of modifiers being
different, in case two modifiers produce the same symbol.
In this case we want to prioritize Command over Option
over Control over Shift.
There is similar logic in the Windows and XKB key mappers,
and the implementation in the Apple key mapper has been
adapted from the Windows key mapper.
Task-number: QTBUG-67200
Task-number: QTBUG-38137
Change-Id: I4f1aeebac78a5393f8da804b53cf588f7c802c1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
If the native method contains a jfloat parameter, I get
the warning/error:
Second argument to 'va_arg' is of promotable type 'JNITypeForArg<float>'
(aka 'float'); this va_arg has undefined behavior because arguments will
be promoted to 'double'
Change-Id: I8e8ee256b9bea01585b5f70554ba2fc537e2c94d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amend 1aba24a2ed and add check for the
EGL_DRM_MASTER_FD_EXT now used as older egl headers might not have it.
Pick-to: 6.6 6.5
Change-Id: I98b860d05396c24b8eb0e73172ac395c89da8628
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Alex Bu <alex.bu@qt.io>
It's explicitly undefined behavior to pass release/acq_rel
memory_order to load(), so don't.
This is private API, so no ChangeLog needed.
Reported-by: Fabian Kosmale <fabian.kosmale@qt.io>
Task-number: QTBUG-115107
Pick-to: 6.6 6.5
Change-Id: Iee119303d790c31937238ef92d900a25020e9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
... by making it thread_local.
It is written and read by multiple threads at the same time, so it needs
to be protected. Since signal emission start and end happens in a single
thread, keep it thread_local rather than using an atomic.
Pick-to: 6.6 6.5
Change-Id: I98fc5438c512b45f936318be31a6fccbe5b66944
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
... by making it thread_local.
As a natural (and welcome) side-effect, this makes output look sane in
multithreaded scenarios.
As for why it should be thread_local instead of an atomic:
Since signal emissions and slot invocations on one thread are not
necessarily correlated with another thread, they should not affect
one another's indentation level. As in, emitting QIODevice::readyRead
on a background thread should not make QEventLoop::aboutToBlock on the
main thread be indented. The only exception to this is BlockingQueued,
where one thread is directly tied to another (QTBUG-118145). But slot
invocations are anyway not currently printed for Queued connection
(see QTBUG-74099.)
Pick-to: 6.6 6.5
Change-Id: Iea1fc522d37626df14af419a3455a732729edf74
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QT_NO_OPENGL is defined in qtgui-config.h so we should include it before
checking the definition.
Fixes: QTBUG-115446
Pick-to: 6.5 6.6
Change-Id: I29b9d7d89fe4c079ca0cf767a1b1a63cc5621623
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We were using the .remove(Key) API on the map instead of
erase(iterator), so we were removing any reply of the same priority that
had not yet been popped from the queues.
Rewrote to drop loop and only work with iterators.
This issue was there since SPDY days, so not picking all the way back to
5.15, where HTTP2 anyway is not enabled by default.
As a drive-by, drop the #ifndef QT_NO_SSL, which was also there from
SPDY times, which was TLS-only.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-116167
Change-Id: Id7e1eb311e009b86054c1fe3d049c760d711a18a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Implements an iterator API and other standard member access functions
for sequential containers so that we can use ranged-for over an object
that is a jarray. Provides read-only access to individual elements
(which is mostly relevant for arrays of objects), or the entire data()
as a contiguous memory block (which is useful for arrays of primitive
types).
QJniObject call functions can return QJniArray<T> when the return type
is either explicitly QJniArray<T> or T[], or their Qt equivalent (e.g.
a jbyteArray can be taken or returned as a QByteArray). If the return
type is a jarray type, then a QJniObject is returned as before.
Arrays can be created from a Qt container through a constructor or the
generic fromData named constructor in the QJniArrayBase class, which
implements the generic logic.
Not documented as public API yet.
Added a compile-time test to verify that types are mapped correctly.
The function test coverage is added to the QJniObject auto-test, as
that already provides the Java test class with functions taking and
returning arrays of different types.
Change-Id: I0750fc4f4cce7314df3b10e122eafbcfd68297b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
And some of them are not needed at all.
Pick-to: 6.6
Change-Id: Ia4778c7016573eff3eefc2f6838e458008161da6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Make the QT_D3D_NO_FLIP env.var. have an effect again.
This env.var. has the following effects:
- SwapEffect is set to DXGI_SWAP_EFFECT_DISCARD
- Scaling is set to DXGI_SCALING_STRETCH (no other option with the
blitting legacy model)
- Alpha works without having to deal with DirectComposition, the dcomp
code path is therefore skipped completely in legacy mode
- Requesting a HDR mode behaves incorrectly (there's an unwanted
conversion to SDR or something like that)
- Different window resizing artifacts. Instead of the big black/white
bars, that is typical with the modern, efficient flip swapchains in
non-Qt applications as well, there is a bit of shimmering on the
right side esp. when resizing on the left side. The option of using
the legacy is model provided mainly for users where this is
important.
- Reduced performance due the using the old blitting model, although
that probably won't be visible for many typical Qt applications on
desktop PCs.
Only for D3D11, because D3D12 does not support non-flip swapchains.
Note: this is incompatible with QT_QPA_DISABLE_REDIRECTION_SURFACE.
The reason to reintroduce this option is to provide a way, even if
just as a developer-focused environment variable, to get a behavior
that is identical to other frameworks and non-Qt applications that
still use D3D11 with the legacy swapchain modes in their rendering
engines. This applies first and foremost to window resizing, where
the visual artifacts common with flip model swapchains may be
misunderstood to be caused by Qt. Having a way to opt-in to the
legacy model allows avoiding/clarifying Apples-to-Oranges
comparisons.
Pick-to: 6.6 6.5
Change-Id: I04e46f71a96fa56cace38703e0e9b93b43bfebc7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Previously we had some inline c-string literals. But since the parameter
for those is const-ref QString it has to actually allocate the storage
and convert the string to UTF-16.
By putting it as a function that returns a QString constructed
with u""_s, we instead create a cheap non-owning QString that just
refers to the string somewhere in memory.
As a drive-by: move other string-literals into functions as well.
Change-Id: I2f2ca5b979cfa772665fa83689837f991b0c656d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
There's nothing wrong with device labels starting with a dot. Whether
udev would encode those as \x2e is unknown, but we may as well not tempt
fate in case it has changed or changes in the future.
Also including QDir::System in case udev places the actual device nodes
in /dev/disks/by-label instead of a symlink.
As a nice and intentional side-effect, QDirIterator no longer performs a
stat() in each of the entries, removing the double stat'ing that started
happening with the previous commit.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787681b4cf2bb58
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In addition to what parseMountInfo() filtered, we also filter entries
with zero total bytes (other than the root filesystem). This avoids
creating yet another QStorageInfoPrivate that may not be used, but most
importantly it avoids calling root() for that check, which would call
parseMountInfo() again.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787538dd3f285d0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Mine has 41 lines, of which 22 are returned by parseMountInfo with
filtering. That meant the file was parsed once to get the listing, then
22 times more to create a QStorageInfo for each entry. Now
QStorageInfo::mountedVolumes() opens the file and parses it only once.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178752ef6c2122f2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Nothing here is empty and even if anything were, QStringBuilder properly
handles empty strings.
In static member function ‘static void QConcatenable<QByteArrayView>::appendTo(QByteArrayView, char*&)’,
inlined from ‘static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = char; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:398:37,
inlined from ‘T QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> >::convertTo() const [with T = QByteArray; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:117:54,
...
qstringbuilder.h:178:19: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [1, 5] is out of the bounds [0, 1] of object ‘QByteArray::_empty’ with type ‘const char’ [-Werror=array-bounds=]
QStringBuilder::convertTo() creates the target as
const qsizetype len = QConcatenable< QStringBuilder<A, B> >::size(*this);
T s(len, Qt::Uninitialized);
We know len can't be zero because GCC is complaining about a memcpy()
when the offset has been changed from 0, meaning QByteArray was given a
non-zero size and therefore its data pointer is not &QByteArray::_empty.
Fixes: QTBUG-116763
Pick-to: 6.5 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178af437984080fb
Reviewed-by: Shawn Rutledge (away) <shawn.rutledge@qt.io>
Use the pre-existing MSVC code path, which uses UCRT.
warning: 'tzname' is deprecated: Only provided for source compatibility; this variable might not always be accurate when linking to UCRT. [-Wdeprecated-declarations]
Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178dc618f1a8f034
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
The current example shows a minimal implementation. However, neither
this example nor the documentation explains what happens without the
guard. Although it's not mandatory, the large majority of the time
it's a good practice to have it. This patch improves this part.
Change-Id: I411a9d66bd7d8ba16aac87e28b5cab219fd71a5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This base class implementation for COM objects provides IUnknown
interface implementation with reference counting which will allow to
keep all this functionality and implementation in the same place.
Pick-to 6.6 6.5
Change-Id: I8ec597b1040ac33295317e06338ffdcb61b78f85
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Mention that QtMessageHandler needs to be reentrant,
as well as other caveats. Mention QLoggingCategory,
so people do know that they don't have to necessarily
implement their own handler to filter messages (and that
not all messages reach the handler). Also mention
qFormatLogMessage().
Finally, give a more useful example for a custom
message handler that logs to a file. Note that the example
leaks a file handle at exit, but that is arguably not that
bad.
Pick-to: 6.5 6.6
Change-Id: I5be44167b266c9bbdbb0e94806bb024c9b352a32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8840 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `multi-config` builds too.
A possible error message before this commit when `qt6_extract_metatypes()` is called with a newer
or equal version than `3.28` `CMake` and `Ninja Multi-Config`.
```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```
Amends 8042bfba47305352627d910930e52da496904c17
Pick-to: 6.2 6.5 6.6
Change-Id: Ib404bd058d5f4c75501fb714c2ad9608d6852822
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Queued signals from main thread were not handled if enqueued on
a different thread. This is because qt_jspi_can_resume_js was
called on a thread (worker), where the Module object does not have
the property used for determining whether JSPI is suspended.
Change-Id: Icbc4dbfcf46c1091eb71b23c7de50760c8a339ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Fix some issues for QProgressBar with fusion style:
- no progress text was shown in vertical mode
- the color change for the text was not correct in rtl mode
- the two rounded rects were not drawn correctly in some modes
Also simplify the code by also using a QTransform for rtl mode and not
only for the vertical mode.
Fixes: QTBUG-117904
Change-Id: I1dd89daf34e8808417750f2ca714252afdab1416
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
On some configs (e.g. using Snap) the NetworkManager service is not
available without some manifest or similar. In this case, the
_interface_ we have is still valid but we can't connect to the
service. So we need to mark the interface as invalid in this case, so
that we can avoid trying to use this plugin.
Pick-to: 6.6 6.5
Fixes: QTBUG-117490
Change-Id: I3c5ebb492f9ca4dfdf4353d77705ba993279eb69
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The previous attempt to record a dependency on the
IntegrityPlatformGraphics target for the Gui target was insufficient.
Aside from a qt_find_package(PROVIDED_TARGETS) call, we also need to
use qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
to ensure the dependency is written into the Qt6GuiDependencies.cmake
file.
Replace the target_link_libraries call with qt_internal_extend_target,
and remove the qt_find_package all together. A qt_find_package call
in src/gui/configure.cmake already exists, so the one in
CMakeLists.txt is redundant and can be removed.
Finally the
qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
call will also result in a
target_link_libraries(Gui INTERFACE
$<LINK_ONLY:IntegrityPlatformGraphics::IntegrityPlatformGraphics>)
because Gui is a static library when building on Integrity, so the
transitive requirement will still be passed along to user projects.
Amends c03eb94c8a
Amends 8116fdde1c
Pick-to: 6.6
Fixes: QTBUG-118051
Task-number: QTBUG-102883
Change-Id: Ic962df94a20071d3f2459e705dbafaca0319a638
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.
Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.
For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.
The documentation for `QDBusReply::value` make
use of this possibility by not stating a return type.
Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.
On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.
To avoid the issue, a return type is now added to the relevant `\fn`
commands.
Task-number: QTBUG-111580
Change-Id: Ia70404c7ad548cb1e144bec99943cf72c990bb83
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.
Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.
For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.
The documentation for the various `QRgbaFloat::fromRgba*` make use of
this possibility by not stating a return type.
Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.
On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.
To avoid the issue, a return type is now added to the relevant `\fn`
commands.
Task-number: QTBUG-111580
Change-Id: Id9d8a713caf7d6cbb4d2de1040ce5ea5092f7b14
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Otherwise it incorrectly changes to a white-ish color when the window
becomes inactive, when native apps keep the accent color.
Fixes: QTBUG-116826
Change-Id: I3837e7ca93a494e60dbe5f1b7f8607b3dd16d29e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.
Generally, `\fn` commands that do not represent correct C++ code with are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.
For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.
The documentation for the various overloads for QList::assign and
QVarLenghtArray::assign makes use of this possibility by not stating a
return type.
Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.
On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.
To avoid the issue, a return type is now added to the relevant `\fn`
commands.
Change-Id: Ic1434aaf71c39840c64ce04fbd503c4542dc4f42
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Makes it clearer what members depend on arguments to the ctor. And
what the initial value of all the members are.
Change-Id: Ie1cd2361955053eaf4c4e6887d23ac245738288d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
We have code in the protocolHandlers that tries to handle this case, but
if we have an error before we create protocolHandler (read: proxy
complains about something) we will assert in debug, or
deref nullptr in release.
Pick-to: 6.6 6.5 6.2
Change-Id: I4bde9c8af0fa96dc11f77ca4d4b5cb84c31b54fa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
These source files have been ported away from Q_FOREACH but weren't
blacklisted, so un-blacklist them by removing "#undef QT_NO_FOREACH",
and removing them from NO_PCH_SOURCES.
These are the last remnants of the Q_FOREACH blacklisting in QtWidgets.
Task-number: QTBUG-115803
Change-Id: Ib73d668687f64d39fa48397d75a0f342e525c1ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
These two QSetS are local to the function, the loop bodies don't modify
them but they can't be made const due to the way they're filled. So use
std::as_const and ranged-for.
Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing
the source file from NO_PCH_SOURCES.
Change-Id: I49b852aa865b0321d3e2f617466557d77143a32b
Task-number: QTBUG-115803
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
getGestureTargets() first parameter is a QSet created locally at the
call site in deliverEvents(); and the loop body doesn't change it.
Change-Id: I3484f7ecc9d85b22b45a123ccf75316d5316e031
Task-number: QTBUG-115803
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Those QSetS are local to the function, make them const, proving that the
loop bodies didn't change them, and the copy Q_FOREACH took wasn't
needed.
Task-number: QTBUG-115803
Change-Id: Iec2fc31fc060c59760a84dc45baf8fa16f62eb6d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The "conflictedGestures" QHash is local to the function, and the code in
the loop body doesn't change it. The "gestures" QList (the value in the
QHash key/value pair) isn't changed in the loop (both the enclosing
for-loop and the for-loop iterating over the QList itself):
- the QGestureEvent constructor takes by const& so it couldn't have
changed the QList
So use a const QList& instead of a copy.
Task-number: QTBUG-115803
Change-Id: I4d7f2f833fe0119b9c1ffa91b0cdba9561025382
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The enclosing iterator-based loop: the loop body doesn't modify the
`m_objectGestures` QMap (the original loop was using const_iterators),
so port to ranged-for by using asKeyValueRange().
The foreach loop: the loop body doesn't modify the `gestures` QList, so
a simple port to ranged-for.
Task-number: QTBUG-115803
Change-Id: I92ba7ff6ef878d7e4b7115a8fab87e95a6d93182
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
The loop doesn't modify the QHash while iterating over it, so use
std::as_const.
Drive by change: Use asKeyValueRange() to get a key/value pair:
- No need to allocate a QStringList to hold the keys
- Prevent double lookup which happened when hash.value(key) was used
inside the loop body
Task-number: QTBUG-115803
Change-Id: Ic0473c0971089f6ca75d3397209fe1c909e975a1
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
The loop body doesn't change the QHash, so use asKeyValueRange() and
ranged-for.
Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing
the source file from NO_PCH_SOURCES.
Task-number: QTBUG-115803
Change-Id: I22924d2addeed75867edf9f6cac53f1c6f266dcc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
It was weird that they were missing. Now that C++23 added them to
std::span, add them to QSpan, too.
Pick-to: 6.6
Change-Id: I4a9b1fdeda66bc7b133c8f7b3b269656e5faffa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Overload the binary QSet operators |, &, + and - for rvalue LHSs, so
chained operations like e.g. in qgesturemanager.cpp:
QSet<QGesture *> endedGestures =
finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;
become as efficient as chained op+= calls.
Make the operators hidden friends as a drive-by.
[ChangeLog][QtCore][QSet] The binary operators &, |, + and - are now
hidden friends, and chaining them has been made a lot more efficient.
Change-Id: I55d2247b11d088eb1ef88608f89d2bf9e1daeb58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
All these TUs relied on transitive includes of qpointer.h, maybe to a
large extent via qevent.h, though, given that qevent.h is more or less
the only public QtBase header that includes qpointer.h, something else
seems to be at play here.
Said qevent.h actually needs QPointer in-name-only, so a forward
declaration would suffice. Prepare for qevent.h dropping the include.
The algorithm I used was:
If the TU mentions 'passiveGrabbers', the name of the QEvent function
that returns QPointers, and the TU doesn't have qpointer.h included
explicitly, include it. That may produce False Positives, but better
safe than sorry. Otherwise, in src/, add an include to all source and
header files which mention QPointer. Exception: if foo.h of a foo.cpp
already includes it, don't include again.
Task-number: QTBUG-117670
Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Follow-up patch for 39d486171b - don't
create a temporary container for the connections but add them directly
into the final one.
Task-number: QTBUG-117698
Change-Id: I6ea3b1a5a834f2581f3929cca13c53f47b8c9805
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When QDoc reads an `\fn` command it saves it to a file to parse it with
Clang, with the objective of using the produced AST to perform certain
sanity checks on the documented element.
Generally, `\fn` commands that do not represent correct C++ code are
accepted as long as Clang is still able to build an AST Node that QDoc
can work with, not resulting in any issue in the output documentation.
For example, an `\fn` that doesn't state a return type might be able to
be parsed correctly enough by Clang to produce a sensible Node for the
function that QDoc is interested into.
The documentation for `QPromise::emplaceResult/emplaceResultAt` make
use of this possibility by not stating a return type.
Up to Clang 15 this was not an issue, and a correct-enough AST was
produced when the `\fn` commands for those methods were parsed.
On Clang 16, Clang chokes on the missing return type, being unable to
recognize the function definition and produce an AST that QDoc can work
with.
This has the effect of losing those documented element in the output
documentation.
To avoid the issue, a return type is now added to the relevant `\fn`
commands.
Task-number: QTBUG-111580
Change-Id: I7d41fc52720ff8762bf2cce229969b7250e44754
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This changes takes Qt for Android Java code away from the Delegate
classes that uses heavily Java reflection to invoke Activity/Service
calls and overrides. So instead of that, now, we have a QtActivityBase
and a QtServiceBase classes which handle the override logic needed for
Qt directly without reflection.
These Base classes extend Android's Activity and Service directly, and
are inside the internal Qt android package (under Qt6Android.jar).
For example, to handle onConfigurationChanged, instead of the current
way where we need this in QtActivityDelegate:
public void onConfigurationChanged(Configuration configuration)
{
try {
m_super_onConfigurationChanged.invoke(m_activity, configuration);
} catch (Exception e) {
e.printStackTrace();
}
handleUiModeChange(configuration.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
}
And then this in QtActivity:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
if (!QtLoader.invokeDelegate(newConfig).invoked)
super.onConfigurationChanged(newConfig);
}
public void super_onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
And having to keep it's Method handles around and then use Java
reflection
to call the override behavior done by Qt and the superclass methods.
instead of that, we can do it now in QtActivityBase like:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
handleUiModeChange(newConfig.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
}
Then, we would still have our user facing QtActivity class which extends
QtActivityBase and benefit from the same implementation of Qt logic done
in the base class.
An additional benefit to this approach is that now QtActivity will be
very lightweight and doesn't need to have all the boilerplate code as
before.
[ChangeLog][Android] Simplify Qt for Android public bindings
(QActivity, QtService and QtApplication) by implementing base
classes which use the delegate implementions directly and avoid
reflection.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Ie1eca74f989627be4468786a27e30b16209fc521
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
The m_activityObject and m_serviceObjects are no longer plain
jobjects. Instead they are constructed with a jobject.
The constructor makes it a global ref, which the destructor
then frees. The destruction happens when the stdlib exit()
is called.
However, since the terminateQt() function already had released the
global ref, the destruction of the objects crashes the
application with a JNI APPLICATION ERROR in Android logs.
In addition since the the code only ever freed the reference to
a reference, the actual reference was leaked.
Change-Id: I6bb637dba2de59e89436685a9d63950d36438fa5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Various constant keys were duplicated in QtActivityDelegate,
QtServiceDelegate and QtLoader classes, and this de-duplicates that.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: I3479fbb58293b26b7625f8653289c6b6d987a59f
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Following the previous change in the chain, this removes override calls
that have no implementation under Qt Delegates, so they can be removed
and
the default behavior would persist.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Ia7c76e9b56c63cba935cb3d2ae3b6260d3462e51
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Those overrides are deprecated and will print a warning during Gradle
build, moreover, these calls don't have any implementation by Qt that's
being triggered by the Qt Delegates classes, so they don't need to be
kept in the Activity/Service main classes' implementations.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: If0c241206652c1a52e2396a24ec7ab63236e6308
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
These forward calls to QtNative don't need to be present inside the
QtActivity implementation, all those calls are invoked by the Delegate
classes.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Id1bfa694687af3edc4e9b82b09cf13e1f8eba1de
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Move QtLoader classes outside of the bindings package and into
the internal Android Java package (Qt6Android.jar that is), to simplify
Qt for Android project templates. This is because QtLoader classes are
used to trigger Qt libs loading and the users don't need to necessarily
know about it or find it in the project's source files.
The classes in question: QtLoader, QtActivityLoader, and
QtServiceLoader.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: I61f68abf6ee83fc45bc47ed9af7457db4f7deabc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
When building non-qtbase tqtc repos in CI, we don't load a lot of
Plugin Config files in static builds due to project names having a
tqtc- prefix. This is similar to the issue and workaround that was
done in 4c6292686259e4e232f29cb6fd6c79065e9fa96d for qtserialport.
The specific issue here is the following error:
CMake Error at Qt6Gui/Qt6GuiTargets.cmake:61 (set_target_properties):
The link interface of target "Qt6::Gui" contains:
IntegrityPlatformGraphics::IntegrityPlatformGraphics
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/home/qt/work/install/target/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:52
(include)
/home/qt/work/install/target/lib/cmake/Qt6/Qt6Config.cmake:157
(find_package)
CMakeLists.txt:15 (find_package)
To work around the issue, explicitly record a dependency on the
IntegrityPlatformGraphics target for Gui when building on INTEGRITY.
The underlying issue is sadly still not fixed.
Change-Id: I9a9cff05d036f224aab8083ad6bc8b8e568abd8b
Pick-to: 6.6
Task-number: QTBUG-102883
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
We need access to bitPosition in order to check if a role was set.
This fixes the following build error:
[...] qwindowstheme.cpp(1150): error C2220: the following warning is treated as an error
[...] qwindowstheme.cpp(1150): warning C4506: no definition for inline function 'QPalette::ResolveMask QPalettePrivate::bitPosition(QPalette::ColorGroup,QPalette::ColorRole)'
Amends 417878904b.
Task-number: QTBUG-116826
Change-Id: I815c7e961198ab93b6ed6132badc2ec693522472
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Check if QCoreApplication::instance() and print a warning if not instead
creating and assertion later on.
Fixes: QTBUG-117621
Change-Id: Iffb4f7097edbbaf19cb584bff6e5ba1535bf88a0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
It's not needed, and might trigger -Wshadow on some compilers. Only
the public QSpan class has the `extent` static data member, everything
else uses the template argument, `E`, directly.
Amends f82cf6333e.
Pick-to: 6.6
Change-Id: If378119aff1e352d1e90854b570720444cd532a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
The previous ones no longer lead to the
corresponding documentation.
Pick-to: 6.6 6.5
Change-Id: I3f56ad71fa3f936898a25f20f718c7f65a0385a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
Use QSV more to avoid manual memcpy
Also port loop to range-based for
Change-Id: I06f4b424853a4b3ee245c66ccc650d87740e2cb8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QFuture::then() uses QtPrivate::Continuation::create(), which in turn
uses private API from an inline function:
f->d.setContinuation(ContinuationWrapper(std::move(continuation)), fi.d);
f->d is QFutureInterfaceBase (a public class), but its setContinuation()
takes QFutureInterfaceBasePrivate by pointer. Our ELF versioning scripts
mark everything that uses that class as private, resulting in:
4806: 0000000000287d70 365 FUNC GLOBAL PROTECTED 16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6_PRIVATE_API
This commit adds an exception for this symbol, causing it to go back to
the regular "Qt_6" ELF version:
5629: 00000000003d6a16 366 FUNC GLOBAL PROTECTED 16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6
This solution can probably be cleaned up a bit by moving the marker into
the header files parsed by syncqt, so they follow code motion without
having to remember to update the CMakeLists.txt. That requires some
surgery with syncqt, so not suitable for cherry-picking.
As a drive-by, fix the target_type check
for the _qt_extra_linker_script_content genex property
Fixes: QTBUG-117514
Pick-to: 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178b92e73dbe11de
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It noted that an unspecified function claimed the offset it was
checking should be +1, while testing it against that or -1. The
function turns out to be QDateTime::addDays(), whose doc did indeed,
misleadingly, say that it lands after a gap it would have hit. It in
fact overshoots the gap in the direction of its change. Amend its
docs, likewise those of addMonths() and addYears(), to reflect the
true behavior.
Amend the test to look at the direction of the step its taking and
anticipate that the adjustment will be in the same direction; then
compare the actual adjustment to that.
Change-Id: I9ab918fac0ab2195ef014983f37fccc435bf0498
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The implementation previously worked for non-short date-times, where
the offset has been remembered since construction. This included the
case of zoned times (and local times more than 2^55 msec away from the
start of 1970) that hit a spring-forward's gap; but excluded local
times that did the same (within 2^55 msec of the epoch).
This precluded an offset check in a spring-forward test, now added.
We can in fact determine the offset whenever we got a valid date and
time (we do so in the course of initializing the object, and when
asked for toMSecsSinceEpoch(), even when invalid), and we should not
use the value of the recorded offset if we didn't get a valid date and
time, so amend to always return 0 if we didn't get valid date and time
and always report the correct offset otherwise.
In the process, amend offsetFromUtc()'s computation to directly
resolve the date-time, rather than doing so via toMSecsSinceEpoch(),
which has to repeat decision-making offsetFromUtc() has already done
by the time it calls it. Also amend toMSecsSinceEpoch() to return 0 if
we didn't have a valid date and time to begin with, so it only
attempts to produce a useful result in the case where construction
attempted to resolve the date-time.
Change-Id: I6574e362275ccc4fbd8de6f0fa875d2e50f3bffe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The resolution selects a point in time outside the gap, which will be
represented by toMSecsSinceEpoch()'s return, despite the QDT object's
isValid() returning false. Previously we retained the
originally-calculated msecs, so as to keep date() and time() matching
what was asked for. However, this required adjusting offset, which was
not remembered for local times within 2^55 milliseconds of the start
of 1970. This lead to an inconsistency between the offset from UTC
reported for the resolution for a local time further from the epoch,
or for a time-zone, and the actual offset from UTC at the time
indicated by the return from toMSecsSinceEpoch().
Instead, retain the actually calculated offset (even if we aren't
going to remember it) and adjust the msecs to the value that ensures
toMSecsSinceEpoch() will get the selected resolution. This
incidentally means that, when toMSecsSinceEpoch() has to re-resolve
(for a local time within 2^55 msecs of the epoch), it avoids
revisiting the complications of hitting the gap.
In passing, change internal stateAtMillis() to take the QTimeZone it
is passed by const reference, to save a copy (noticed during debug).
Also tweak a comment in a test to be explicit about a default value.
[ChangeLog][QtCore][Possibly Significant Behavior Change] When
QDateTime is instantiated for a combination of date and time that was
skipped, by local time or a time-zone, for example during a
spring-forward DST transition, the invalid result's time() - and, in
rare cases, date() - no longer match what was asked for. Instead,
these values and offsetFromUtc() now match the point in time
identified by toMSecsSinceEpoch().
Change-Id: Id61c4274b365750f56442a4a598be5c14cfca689
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Pass the pointer to the QWidget the icon is painted on to
QStyle::standardIcon/Pixmap().
Change-Id: If9dbc3acb621fb60152f2e12fc0080f354397a99
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The slider handle has a small bug not painting the underlying rectangle
with the correct direction which lead to a small visual glitch only
visible with a high-dpi screen.
Change-Id: Ie75e034b85542228ed7a8372dc7b9a419731630d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In gtk3 theme, the inactive color group had been set with incorrect
palette or not been set for some cases, which leads to glitch when
moving application window. This is because inactive group palettes were
applied during window movement and its expected to be set with correct
palettes.
This patch fixes this issue by setting correct palette for inactive
color group.
Fixes: QTBUG-112879
Pick-to: 6.6 6.5
Change-Id: I6658843626f322fee0ef99dfafb550956e3e0aee
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
clang-format and the optimized SIGNAL/SLOT notation are not
good friends.
Change-Id: Id07936b4654e567b59af5a8b1d7baad000484931
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
If a QShortcut is registered with a QWindow as its parent, but QApplication
is used, we end up in QApplicationPrivate::createShortcutPrivate(), and
create a QtWidgetsShortcutPrivate that implements shortcut context matching
via qWidgetShortcutContextMatcher.
The problem is that qWidgetShortcutContextMatcher expects the windows
to be QWidgetWindows, which meant that plain QWindow based shortcuts
would always fail.
This can happen for example if a QApplication is used in Qt Quick
to provide dialog fallbacks, but QShortcuts are otherwise used
with plain QWindows, or QQuickWindows e.g.
We now defer the check of whether there's an active (widget) window,
and fall back to QtGui's simpleContextMatcher in case we don't find
a QWidget, QAction, or QGraphicsWidget shortcut owner to handle
the matching for.
Note: We don't support shortcut matching for QAction in QtGui,
but this is left for another day. There is also a discrepancy
between how QtGui and QtWidgets handles Qt::ApplicationShortcut.
The former will treat it as a match even if there is no active
QWindow, while the latter requires that there's an active widget
window.
Fixes: QTBUG-116221
Change-Id: I487995f2e660a40f6556828b84a521d81a58f1b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends 39294317e0, after which class names have to be slash-separated.
Change-Id: I5b8415b711f4deed9b6134eccd3232f299b1ef4d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Q_GUI_EXPORT the private header to access it from outside Gui.
Task-number: QTBUG-116826
Pick-to: 6.6
Change-Id: I6aaabe2df7ebebd7b53662f47a52c748344067bc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Amends ef9fe7a99a and fixes some rare
cases where the macro argument wasn't a single token, such as what was
found in PySide code:
qCDebug(*category, "%s", %2);
Fixes: QTBUG-117153
Pick-to: 6.5 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178a51023648f244
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Amends da95ad91b3. Caught by CodeChecker:
std::move of the const expression has no effect; remove std::move()
I'll instead remove the const.
Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178ccec9fcc38e9c
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The documentation above says it's intentionally not const and that's how
I had designed it. It was added by accident on with the noexcept
qualifier on commit c129362b4d ("Add a
couple of noexcept").
Change-Id: I8f3ce163ccc5408cac39fffd178c7fd237c6e079
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Testing for Standard Library features with compiler version macros was
incorrect. This commit fixes that to check the correct macros. That
fixes the use of Clang-cl / ICX because Microsoft STL doesn't have
support for 128-bit integers (because Microsoft's compiler doesn't) but
Clang does.
Amends 104a0a9ecd.
Fixes: QTBUG-117870
Pick-to: 6.6
Change-Id: I85599ea5ca7a4b79a8bbfffd178b9688e7c1bf42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Generalized from the logging used in the Apple key mapper.
Change-Id: I61cc120e31b72995071756961d36f6a7fae14553
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Having the explicit type instead of the opaque int makes it clearer
what we're dealing with.
Task-number: QTBUG-116873
Change-Id: I19e42ed329e15ab25a958602ecfb99b1c9d52a99
Reviewed-by: Liang Qi <liang.qi@qt.io>
Several places already did, and it reads better, so be consistent.
Change-Id: Ic272b2d342cec06ec657c3d0995258b975e0bf87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's possible, as was (and still is) documented, at least on Windows,
for the backend to determine the system local time zone's properties
but not its IANA ID. (That involves an update to Windows introducing a
Windows zone ID unknown to the CLDR with whose data Qt was compiled.)
Formerly this lead to systemTimeZoneId() and systemTimeZone().id()
being inconsistent. Furthermore, either in this case or when the
system zone can't be determined, passing the return from
systemTimeZoneId() to the constructor got a valid QTimeZone that did
not faithfully represent the system's local time or the return from
systemTimeZone().
[ChangeLog][QtCore][QTimeZone] When unable to determine the IANA ID of
the system's local time zone, QTimeZone::systemTimeZoneId() now
returns empty instead of the "UTC" it formerly, and misleadingly,
returned. Passing the return to the QTimeZone constructor now
consistently produces the same as calling QTimeZone::systemTimeZone(),
whose id() now matches the return from QTimeZone::systemTimeZoneId().
This is independent of whether QTimeZone::systemTimeZone() is valid.
Change-Id: I55bbe3ea407ca38343a09da353d9336708747bf1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Windows are not always fullscreen: e.g. the widget gallery example main
window isn't maximized, and a popup window may open anywhere on the
screen. So we always needed to offset by the window position. But it's
better to use QPlatformWindow::mapFromGlobal() since we are working with
native coordinates here.
Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-109025
Change-Id: Id3d139fad610bbbc67a394599570a309196ae64c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The factory cache registration functionality should belong to the
cppwinrt feature, so guard it with appropriate QT_FEATURE_ guard.
Change-Id: Icbadaa7ffb32a4e47fe3bbab90c37303fd787344
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously, windeployqt would recurse into subdirectories when copying
QML modules, even if those subdirectories were a nested QML module that
was not needed for deployment.
Since most QML modules are nested in the QtQuick and QtQml modules, the
old code effectively always copied *all* QML modules.
This patch adds guards that prevent recursing into subdirectories if
those subdirectories represent QML modules.
These nested modules will still be deployed, but only if referenced from
the QML application (as determined by qmlimportscanner).
Fixes: QTBUG-117459
Pick-to: 6.6
Change-Id: I4c0dfc15956ff40a0e8caec3fa334df10cc92ccd
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse
stylus, eraser) goes up. Without handling this action in these
cases, the table event remains in 'down' state (misses the
QEvent::TabletRelease) and as a consequence when it is next put on the
screen, eg. a line will be drawn to the new position (in case of a drawing
application).
In addition use getActionMasked() to get the action; non-masked
events would contain the index of the pointer too, and wouldn't
match with ACTION_POINTER_UP whose numeric value is 6. Rather the
actions would be in the lines of:
261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked()
517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked()
And so on.
Pick-to: 6.6 6.5
Fixes: QTBUG-86297
Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This reverts commit 530d092eae.
Reason for revert: Moving transient children as a whole is too broad, and forces unrelated windows to have their position completely dependent on a transient parent.
Fixes: QTBUG-117779
Pick-to: 6.6 6.5
Change-Id: I01312e26e95c8144c392eca33aec41f54aaa40b0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We don't use va_list and don't have variadic functions in this file.
[ChangeLog][Potentially Source-Incompatible Changes] The header
qbytearray.h no longer includes the header stdarg.h.
Change-Id: I8f3ce163ccc5408cac39fffd178c7fb49d12b739
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The local qreal to string conversion would fail and produce
unsyntactic output if the integer part exceeded the range of an
unsigned int. Introduce check for that, and fall back to just output a
0 value instead in such cases.
Testing indicates that there is no point in supporting values beyond
4G, as pdf readers do not seem to accept higher values anyway.
As a driveby, also extend the check to catch all non-finite real
values, not only nan.
As a second driveby, simplify the splitting of a qreal into integer
and fraction parts by just using the std library function for that.
Fixes: QTBUG-117740
Pick-to: 6.6 6.5
Change-Id: I247b0612bd565fb2e6f47a182e74f19b8bb0d683
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
.data() in both classes has a null pointer check so it will return non-
null even if the object is storing a null pointer, for compatibility
with Qt 5 (controlled by QT5_NULL_STRINGS). We don't need this in
first()/last()/sliced()/chopped(), so we can skip the test and pass
whatever pointer it is directly to the class constructor. Both of them
handle null pointers creating an isNull() object.
This is a minor performance optimization and interestingly makes these
functions now retain isNull() with the result. I'm not adding test for
that as I don't want to hardcode that they will do so.
Change-Id: Ifeb6206a9fa04424964bfffd17888d14ec8244ec
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The palette mapping table (as read from gtk widget) maintained in
QGtk3Storage misses information of QPalette::Button and
QPalette::ButtonText role for QPalette::Disabled color group. This
cause disabled button widget to be rendered with incorrect palette
(such as in dark color scheme, light palette had been used).
This patch fixes this issue by extending palette mapping in
QGtk3Storage for disabled color group of button role.
Fixes: QTBUG-113486
Pick-to: 6.6.0 6.6 6.5
Change-Id: Ied4b2650c92cc1cda58be69257945991013b276f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Remove or replace links to examples that were removed or moved under
manual tests.
Replace code snippets that were quoting the now-missing examples.
Fix documentation of QSet::removeIf().
Fix typo in documentation macro: Unknown command '\examplecateogry'.
Add qtopengl, qtshadertools dependencies to Qt Widgets documentation
project to enable correct linking to those topics.
Mark all documentation sets in qtbase as free of warnings.
Pick-to: 6.6 6.5
Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Mention the modules using it instead of claiming it is not used
in Qt.
Pick-to: 6.6 6.5
Change-Id: I8c9490dfd89444509961c73eeff2f8584e0c5df4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Include moc must be outside the namespace.
Pick-to: 6.6 6.5
Change-Id: Ibdd539b5fdd8ab4aeb0019bcbb62d5702c310065
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Since it hides QFile's overloads this was not supported for
QTemporaryFile.
[ChangeLog][QtCore][QTemporaryFile] Added support for passing
std::filesystem::path to rename and createNativeFile.
Change-Id: I909ff1d5b9c586824c9901d7dad278dfad09ffc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Destructing the QWindowsScreenManager might result in a
WM_DISPLAYCHANGE, at which point our QWindowsContext instance
is likely gone. We need to guard against that.
Fixes: QTBUG-117473
Pick-to: 6.6 6.5
Change-Id: If32941c5c11231f7c27e9dde54f4315f18da1100
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
We were already doing this for a key combination without modifiers,
but now we do the same for e.g. Control+Unknown. This matches the
behavior we have for QKeySequencePrivate::decodeString(), where
we return Qt::Key_Unknown if we can't resolve the key, even if
we have resolved some valid modifiers, e.g. "Meta+Trolls" as in
the tst_QKeySequence::parseString() test.
Change-Id: I238e29276e6ce356ae60c67585739587fa388f07
Reviewed-by: Liang Qi <liang.qi@qt.io>
Being explicit about whether we're dealing with QKeyCombination or
a plain Qt::Key helps understand the code.
Keys are still stored as ints though.
Change-Id: I2cb7bf2c5fabcecbd4dd3e99ba6240fb1910dcc7
Reviewed-by: Liang Qi <liang.qi@qt.io>
The functionality is available in QKeySequencepPrivate still, if needed.
Change-Id: Iefa2e5b31a550fd2a419d2aee028ce4c1ddfb7a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
Fix capitalization of setIncludesSubDomains(). While a it,
make the links explicit, so that qdoc generates warnings if they fail.
Pick-to: 6.5 6.6
Change-Id: I74542c288083ec58f866a616da32bd40fcb3f40a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
clang-cl can correctly handle runtimeobject.lib for quite some time
already, no need to special case for it anymore.
Change-Id: I87aa98134ad847808b3129c5629ccf8fa1dce253
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The loop doesn't change the member container while iterating over it,
but handleReparent() is called from eventFilter() and changeEvent(), so
take a copy to iterate over.
Task-number: QTBUG-115803
Change-Id: I58ff5bddf99f07a46348b7802432e0899b3170df
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
The m_edges container isn't changed after it's initialized in the
constructor (in a later commit I'll make this container const, so as to
keep this commit backport-able), and it isn't changed by the loop. Port
all loops over m_edges to ranged-for.
Remove "#undef QT_NO_FOREACH" from the source file, as that was the only
usage of foreach in it. And remove that source file from NO_PCH_SOURCES.
Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.
After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.
Pick-to: 6.5 6.6
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
We know what engine we're using, so don't go the long way around via
QFileInfo and QFSFileEngine to get back to QFileSystemEngine in order to
calculate an absolute and clean path.
Since we're doing that, we may as well use QFileSystemEntry's ability to
give us the file name portion of this absolute path without having to go
via QFileInfo and QDir again. We just need to make sure that a dir name
isn't ending in a slash: absoluteName() would remove that for us, but
only if the entry isn't already absolute and clean.
Change-Id: I9d43e5b91eb142d6945cfffd17871389d359e750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
qnativesocketengine_win.cpp: don't check if timeout is < 0, because
remainingTimeAsDuration() doesn't return negative values.
All the changes done in one go, not function by function, as that causes
the least churn. You can think of them as a couple of very similar
changes repeated various times.
Drive-by change: replace `forever {` with `for (;;)`
Task-number: QTBUG-113518
Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We usually compile without exceptions, so the try..catch is a noop.
So, if the `new` fails we would crash (or get UB) anyway. Instead
of that, use the nothrow version of `new` and check the result.
Pick-to: 6.6 6.5
Change-Id: I1902b717c70afcc44c1f3237370aae346262452a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Use a stack buffer instead of a QByteArray to hold the 16 bytes for
the QUuid serialisation, replacing toRfc4122() with toBytes() and a
memcpy().
As drive-bys, drop the needless cast from char* to uchar*
(qToLittleEndian() has void* arguments, so char* is fine) and drop {}
around single-line if body.
Pick-to: 6.6
Change-Id: I6ffabcf07fc9a730a782e20e113999a0dcf15067
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It contains no implementation. Proof: it includes no headers.
Pick-to: 6.6 6.5
Change-Id: I64b42ce799eec05a0faff2021e2b60460695e192
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
The Q_DECL_{IMPORT,EXPORT} macros change with the configuration, so the
lack of our configuration this ended up producing inconsistent builds.
Amends 43ec3d8d01.
Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17892394d19e648f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When a dock widget is closed while floating, it still reports being
floating even though the QWidget::windowHandle()->isVisible() returns
false. This is documented behavior and will not be changed.
c153066baa relied on the isFloating() to
return false, if the dock widget is closed. When the window title was
changed by setWindowTitle(), the change was overridden by reading the
old value from the window handle.
=> Amend the patch and add a windowHandle()->isVisible() as a condition.
In c153066baa, an autotest for the title
propagation (QTBUG-113591) was added to floatingTabs().
=> Harden the setWindowTitle() test function. Move the tests related to
QTBUG-113591 and QTBUG-117764 to this function.
Fixes: QTBUG-117764
Pick-to: 6.6 6.5
Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Qt a11y(ATSPI) support only depends on DBus and ATSPI, it should
also work fine on Wayland when xcb was disabled.
Task-number: QTBUG-117535
Pick-to: 6.6 6.5
Change-Id: Ibd7ebb32b94de1888920f0fe2b85ae3bd4d2c77a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This amends 6802065da8 .
Pure Wayland runtime and build envs without X11/xcb are more common.
Need to find solution for ATSPI_MODIFIER_SHIFTLOCK on Wayland later.
Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I65d41546e3dbb86c3a939a496ed43ac1737cf539
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
These methods return a struct which is implicitly convertible to
QString/QByteArray respectively. Don't hide the return type from QDoc,
this simplifies telling users what those methods return exactly.
Fixes: QTBUG-117705
Pick-to: 6.6 6.5
Change-Id: Ibb22a1e54fffce8f5f20aaabe47983870ccfba1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QIODevice is owned by the caller of data(), so we should have
freed it.
Amends a6776de0c7
Fixes: QTBUG-117787
Pick-to: 6.6 6.5 6.2
Change-Id: Ic5575649038480f52cc13ee229980ee1c7cee728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Misc cleanup for the PostgreSQL driver:
- use constexpr instead const for some constants
- use new signal/slot syntax
- unconditionally call PQfinish() - check is done inside the function
Change-Id: I47b83ef3436225f698fca24c68e5c9cde32c1163
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The QKeyMapper class never got a platform integration companion.
As we might be adding more functionality here in the future, let's
fix that now, instead of adding more hooks directly to the platform
integration class.
The QKeyMapper will soon update its possibleKeys signature to
return QKeyCombination, but for now transform the result.
Change-Id: I88ef498180b2a8a7937a74627b7eb6b5156e872a
Reviewed-by: Liang Qi <liang.qi@qt.io>
All platforms except Wayland fail to check for input direction change
when the locale changes, and only emitLocaleChanged.
We can simplify this for the platforms by checking if the new
locale caused a change in input direction, and if so emit
inputDirectionChanged on their behalf.
Change-Id: I84d8df9392db5e716f5c277d0cc9e17e5a21783f
Reviewed-by: Liang Qi <liang.qi@qt.io>
Change "qpaths" to "qtpaths" since the former is not a valid option.
Fixes: QTBUG-117817
Pick-to: 6.6 6.5
Change-Id: Ib8c8c80f31c1c54747340442c6bf3185c7c69001
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
in top level, which are in used very common for KDE and GNOME.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117488
Change-Id: I88fe7b4afe44e4ac8f07e60e990cbe68498e98d9
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
- remove unused includes / replace with qabstractitemdelegate.h
- replace references in the documentation with QStyledItemDelegate
- adjust the examples and tests to use QStyledItemDelegate
Pick-to: 6.5 6.6
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
and add QChar overload to reduce allocations
Also port tests from char* literals to char16_t literals
Change-Id: I99381a2da08d9d35e6135c48bd92bd8d72533065
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
in Qt::mightBeRichText, Qt::convertFromPlainText
and emitFrameStyle to support large strings
Pick-to: 6.6 6.5 6.2
Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Don't call resize on QVLA, just wrap pointers in QSV
As drive-by, fix typo in comment
Change-Id: Id90236cfb53d861b8bd57fa9452aba4b8d9b20bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Construction from nullptr wasn't, before, because it was using the
QPointer(T*) constructor, which cannot be constexpr. Add a constexpr
QPointer(std::nullptr_t) constructor to enable this use-case.
This requires to mark the (T*) constructor as Q_WEAK_OVERLOAD,
otherwise legacy construction from a literal 0 would be ambiguous.
No documentation changes needed, as the set of valid expressions
(apart from constinit'ing) has not changed. Mention the nullptr ctor,
though, without \since.
Add a test to confirm that contruction from derived still works.
Change-Id: If9d5281f6eca0c408a69f03fecba64a70a0c9cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Initializing QPointer with nullptr is currently still going through
the (T*) ctor, which is not constexpr, so is initialized at runtime.
This will change in Qt 6.7, but that doesn't help the older branches.
Use the default constructor, which is constexpr, and assert that no
runtime initialization happens by using Q_CONSTINIT.
Amends f929756578.
Not picking to 6.2, 5.15 because, while affected, they're in too
stable a mode for this, and they also lack Q_CONSTINIT.
Pick-to: 6.6 6.5
Change-Id: I41bb6f36d529effda008f166fd05a8896157edc9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The last QPointer user was removed in commit
07d6d31a4c. Prune the include.
Change-Id: Id48ffd2f8f5c1790bbdc54d66ac0c404b0af9cd2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It's currently its only user, so drop the extra code and inheritance.
Change-Id: I6e525a9629b7289cc770133936e089683b763289
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The std types do that on their smart pointer types, so while it's not
100% correct (the function has the precondition !isNull()), follow
upstream and mark this operator noexcept, too.
Change-Id: Ie688598215afe2db4c0c26fcfa192fc7c8e22150
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Mark almost all public functions of the clas as noexcept.
Exceptions:
- assignment and construction from T*: allocates an ExtraData in
QObjectPrivate
- dereference: the std types do that, but it's not 100% correct, so
not proposed in this patch
As a drive-by, remove pointless inline keywords.
Change-Id: Ice91dfc429a4268546c0b8275da329be05f4edcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
We don't support or implement state restorations via the AppKit
state restoration APIs, but if we did, we would/should support
secure state restoration. This is the default for apps linked
against the macOS 14 SDK, but as we target versions below that
as well we need to return YES here explicitly to silence a runtime
warning.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117745
Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
All operations they perform (copy/move construction + swap()) are
noexcept, so these functions should be noexcept, too.
Amends 93019dc0dee3dd3d568775250e3fae8eda072850 and
(FIXME)93019dc0dee3dd3d568775250e3fae8eda072850(ONCE MERGED).
Change-Id: I9010f87f93ce3efcefd8b28d848a3eadd6e74542
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When 6c504f2519 added the conversion
copy-constructor to fix an ambiguity, its commit message argued at
length why a move-assignment conversion operator was not possible. But
we actually have the existing converting move and copy ctors, so we
can just use copy-and-swap and move-and-swap, so do that.
As a drive-by, make the copy-assignment operator use copy-and-swap.
[ChangeLog][QtCore][QPointer] Added missing converting move-assignment
operator. This is forwards-compatible with Qt 6.6.0: compiling against
6.6.0 will just use the lvalue overload.
This is BC and SC, forwards and backwards (inline code, and going back
in time will just use the lvalue overload), so picking to 6.6.
Pick-to: 6.6
Change-Id: Ibbefb0927c08d8c716a952c6c592a02df2a89008
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We have to single QString out because of the isNull/isEmpty distinction.
Still, we can avoid having a constructor template on it constrained on
the argument being precisely QString. This is a historic remnant; in Qt
5 the constructor also worked with QStringRef.
Change-Id: I5457a83d5b77887f57ea9910a826f729ec276d28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QVulkanInstance must outlive the QRhi (if Vulkan is used).
Otherwise subtle problems may pop up upon application exit.
Pick-to: 6.6
Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Canonical way is compare result of std::find_if against end by != operator, not <
Change-Id: Ifffbaf11416ea0738a1ccbb2f2f8482193390070
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The whole Q_DECLARE_METATYPE part is superfluous in these two examples,
as QVariant works with any type as long as it is copy-constructible.
And QVariant will call the equivalent of qRegisterMetaType, so that
doesn't need to happen, either.
Showing how to integrate the type with qDebug is fine in theory, but
also a repetition of content that can be found in other places.
Given that there isn't much else being shown in these two examples, it's
better to remove them from examples and move them to manual tests.
Some parts of "Custom Type Example" were used as snippets in other
documentations under qtbase/src/corelib. So, they were added in
customtypeexample.cpp file in the snippets folder.
Fixes: QTBUG-117001
Pick-to: 6.6 6.5
Change-Id: I45b16338912e3f7394cbb5169642bd31af32d5e1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>