Commit Graph

63935 Commits

Author SHA1 Message Date
Thiago Macieira
ae03ffaffd tst_QStorageInfo::{tempFile,caching}: try a to find a non-btrfs storage
These tests skip when we're writing to a btrfs filesystem because, for
some reason, the amount of free space does not update synchronously with
file writing. But instead of giving up if $TMPDIR is a btrfs, let's try
and use the $XDG_RUNTIME_DIR, which is usually a tmpfs.

This will work in the CI for the openSUSE set ups, where / is btrfs,
/tmp is not a separate tmpfs, but /run/user/1000 is available.

FAIL!  : tst_QStorageInfo::tempFile() The computed value is expected to be different from the baseline, but is not
   Computed (free)                : 25510780928
   Baseline (storage2.bytesFree()): 25510780928
   Loc: [tst_qstorageinfo.cpp(234)]

Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d7af1c67ec988
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-18 10:01:45 -07:00
Kai Köhne
bef5d486d5 Doc: Highlight 5 network examples
Pick-to: 6.5 6.6
Task-number: QTBUG-117222
Change-Id: I5d18a1c86201404609cbc58fd127f001cdc32478
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-10-18 19:01:45 +02:00
Mikolaj Boc
0607c25f3e Make WASM IDB settings use the fallback mechanism correctly
Change-Id: Ibb65efc0faa5ec6e6c60782747c9295e4fc5ff21
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-18 19:01:45 +02:00
Ahmad Samir
8a6a9295eb tst_QStringList: refactor a unittest to be table-driven
Change-Id: I9a102a42eba42f1bec71cc680f6de6dbeaf7ad58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-18 20:01:45 +03:00
Edward Welbourne
37142571ae Update QTZ::transitions() doc to say what the atUtc values mean
Previously, it was left to the caller to guess.

Change-Id: Icc22b8c874046de78e16253cf0cc3ba2f334362b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-18 17:20:14 +01:00
Dimitrios Apostolou
474aa52638 sanitizer-testrunner.py: be verbose about FAILs being ignored
Pick-to: 6.5 6.6
Change-Id: I8753b8793c744d4fe2cae8d7293abf6961c60601
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-18 18:20:14 +02:00
Santhosh Kumar
756857b5d0 Fix tooltip palette issue in gtk3 theme
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>
2023-10-18 16:26:57 +02:00
Jøger Hansegård
4d11ba66de Fix QNetworkAccessManager hang with low integrity level sandboxing
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>
2023-10-18 16:26:57 +02:00
Nicolas Fella
255f6b67b8 Add missing documentation for QWaylandApplication::seat()
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>
2023-10-18 16:18:26 +02:00
Assam Boudjelthia
2e69cb8132 Android: update Android Jar build.gradle file to AGP 8
To allow building and developing from Android Studio and get rid of
warnings.

Change-Id: I5f896a270917120f98eefd2f4aa449714451f994
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-18 17:18:26 +03:00
Assam Boudjelthia
17ef5be087 Android: remove code path that's never reached in QtLoader
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>
2023-10-18 16:54:32 +03:00
Assam Boudjelthia
ac8c27bb1d Android: remove unused member m_optionsMenuIsVisible
The variable m_optionsMenuIsVisible is assigned but never
used.

Task-number: QTBUG-114593
Change-Id: Ie4b61b37f2bc05d8d2a348dcad7487eb8fa1ac00
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-18 16:54:31 +03:00
Assam Boudjelthia
820cf7fbc8 Android: Cleanup QtInputDelegate reformat and divide into sub methods
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>
2023-10-18 16:54:31 +03:00
Assam Boudjelthia
ac7f22ed0a Android: move input handling from QtActivityDelegate to separate class
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>
2023-10-18 16:54:31 +03:00
Volker Hilsheimer
ed2fbed479 JNI: emit warning in debug mode in case of JNI environment conflicts
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>
2023-10-18 15:02:23 +02:00
Volker Hilsheimer
944200b5a9 JNI: Reduce amount of temporary QJniEnvironment instantiations
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>
2023-10-18 15:02:22 +02:00
Volker Hilsheimer
b7a7351767 JNI: treat equivalent C++ types as the same JNI types as well
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>
2023-10-18 15:02:22 +02:00
Volker Hilsheimer
872f7b0b4e JNI: convert to and from JNI types for callObjectMethod as well
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>
2023-10-18 15:02:22 +02:00
Mikolaj Boc
322e2a2821 Simplify QWasmIDBSettingsPrivate
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>
2023-10-18 15:02:22 +02:00
Marc Mutz
381d6210c2 qevent.h: don't include <QPointer>, fwd-declare it
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>
2023-10-18 14:41:33 +02:00
Kai Köhne
3aa6f0b396 CMake: Use stored compiler only for qt-cmake-private
Change the heuristic only to use the stored compiler if we
are  building qt itself, like with qt-cmake-private
/ qt-configure-module. qt-cmake is also used by end-users,
where the heuristic to change the compiler default base on
paths is surprising, and can go wrong.

Fixes: QTBUG-108323
Pick-to: 6.6
Change-Id: I0274e470f214a84711013d77068551f9097f4685
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-18 14:41:33 +02:00
Amir Masoud Abdol
885d87488a Make sure that pkgconf can find HarfBuzz
pkgconf is an alternative implementation of pkg-config, and it is mostly
compatible with pkg-config, but in the case of HarfBuzz, it adds the
`/usr/local/include` to `INTERFACE_INCLUDE_DIRECTORIES` when reports the
include path, and if the path doesn't exist, the configuration fails.

In the case of HarfBuzz, we do some extra work to make sure that we can
always find the library, so, with a bit of modification, we can skip the
faulty pkgconf intervention and create the correct imported target.

Fixes: QTBUG-117905
Change-Id: Id628e4434633534b0d7bfad9e819a8c05da4944d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-18 10:08:27 +02:00
Christian Ehrlicher
7398645292 QCommonStyle: misc cleanup
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>
2023-10-18 06:16:22 +02:00
Christian Ehrlicher
f2c2242c74 SQLite: Update SQLite to v3.43.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.2

Pick-to: 5.15 6.2 6.5 6.6
Change-Id: I50ab6d53ada764e1d9390e4d768f4abf0de5652f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-18 06:16:20 +02:00
JiDe Zhang
518c98cea4 Remove unnecessary code in QCursor
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>
2023-10-18 04:15:03 +00:00
Thiago Macieira
c94bed69b7 moveToTrash/Unix: refactor to use openat()/mkdirat()/renameat()
This ensures much better security against race conditions and attacks,
at the expense of a few more system calls.

On first run (when no trash dir is yet present):

  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", 0700) = 0
  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
  newfstatat(5, "", {st_mode=S_IFDIR|0700, st_size=0, ...}, AT_EMPTY_PATH) = 0
  getuid()                                = 1000
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(5, "files", 0700)               = 0
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 6
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(5, "info", 0700)                = 0
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
  close(5)                                = 0
  openat(7, "tst_qfile.moveToTrashOpenFile.fjYRxv.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
  openat(AT_FDCWD, "/usr/share/zoneinfo/UTC", O_RDONLY|O_CLOEXEC) = 8
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 114
  lseek(8, -60, SEEK_CUR)                 = 54
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 60
  close(8)                                = 0
  write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
  renameat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.fjYRxv", 6, "tst_qfile.moveToTrashOpenFile.fjYRxv") = 0
  close(5)                                = 0
  close(6)                                = 0
  close(7)                                = 0

On subsequent runs:

  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
  newfstatat(5, "", {st_mode=S_IFDIR|0700, st_size=18, ...}, AT_EMPTY_PATH) = 0
  getuid()                                = 1000
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 6
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
  close(5)                                = 0
  openat(7, "tst_qfile.moveToTrashOpenFile.sPjrcA.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
  openat(AT_FDCWD, "/usr/share/zoneinfo/UTC", O_RDONLY|O_CLOEXEC) = 8
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 114
  lseek(8, -60, SEEK_CUR)                 = 54
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 60
  close(8)                                = 0
  write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
  renameat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.sPjrcA", 6, "tst_qfile.moveToTrashOpenFile.sPjrcA") = 0
  close(5)                                = 0
  close(6)                                = 0
  close(7)                                = 0

Change-Id: I9d43e5b91eb142d6945cfffd1787117927650dab
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
25b1990784 moveToTrash/Unix: use the file's inode number as collision avoidance
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>
2023-10-17 19:08:25 -07:00
Thiago Macieira
77c661b275 moveToTrash/Unix: use lower-level API to write the info file
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>
2023-10-17 19:08:25 -07:00
Thiago Macieira
6359e8b8bd moveToTrash/Unix: avoid creating too many QStorageInfo
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>
2023-10-17 19:08:25 -07:00
Thiago Macieira
de24134aa7 moveToTrash/Unix: avoid TOCTOU in creating the unique file name
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>
2023-10-17 19:08:25 -07:00
Thiago Macieira
1c5575f194 moveToTrash/Unix: trust freeDesktopTrashLocation() to find the directory
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>
2023-10-17 19:08:24 -07:00
Ahmad Samir
ba0b4a1dc8 QGraphicsAnchorLayout: remove a redundant member container
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>
2023-10-18 03:05:55 +03:00
Thiago Macieira
dec72d165b QThread/Unix: don't hardcode OSes for PThread cancellation support
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>
2023-10-17 23:52:27 +00:00
Ivan Solovev
9e26f1da0b QDateTime: improve docs about invalid vs valid datetime relation
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>
2023-10-17 23:34:22 +02:00
Tor Arne Vestbø
8f2828683e Windows: Don't re-apply application badge if one has not been set
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>
2023-10-17 23:34:22 +02:00
Tor Arne Vestbø
7152a1d0be Add missing static to constexpr in keyevents test
Change-Id: I9e83876aadca3254042eb48ed51287e403830cf0
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-17 23:34:22 +02:00
Wladimir Leuschner
4f51742ee1 Prevent state change of selected LineEdit in QWindowsVistaStyle when hovering
Hovering over a selected LineEdit gives the selected state precedence
over hover state.

Fixes: QTBUG-117606
Pick-to: 6.5 6.6
Change-Id: Ia52ce94443100bf3fb5d83b8dffa2752818ca33d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-17 22:44:36 +02:00
Timothée Keller
9a64449cc3 Windows QPA: remove SWP_NOCOPYBITS for plain moves
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>
2023-10-17 22:44:36 +02:00
Jonas Kvinge
1eddd7add0 macdeployqt: Fix codesigning with @loader_path
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>
2023-10-17 19:23:42 +00:00
Mate Barany
0345f07dd1 Support body for an HTTP GET request
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>
2023-10-17 21:23:42 +02:00
Ahmad Samir
1097c21748 QGraphicsAnchorLayout: make a member container const
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>
2023-10-17 22:23:42 +03:00
Ahmad Samir
408799de65 QCoreApplication: use the correct typedef of preRList
`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>
2023-10-17 19:23:42 +00:00
Milla Pohjanheimo
5ceb78e8d9 Add binary compatibility file for 6.6.0
Task-number: QTBUG-117583
Pick-to: 6.6
Change-Id: I9b63b916a59ddaeb89d2b819b36ee9dc57851dac
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-10-17 22:23:42 +03:00
Anton Kudryavtsev
18367d0a11 qmimeglobpattern: port some methods to QSV
It's private API, so it's safe

Change-Id: Ibf35262117c4ce4a1e548fff814a6e7bea362309
Reviewed-by: David Faure <david.faure@kdab.com>
2023-10-17 19:23:42 +00:00
Mårten Nordheim
8111a7d08f QNetworkInfo[NetworkManager]: Fix double-lookup
Change-Id: Ia44993fa229b223cfa40ed6cf922c4d5cfd3042b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
14510bac9a Network: Use the new invokeMethod overload
Saves us from having to create a lambda functor object.

Change-Id: I5e790e693b57ae414ac6d6be84f18b76b3e8185c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
45a3fa0101 Clean up qnoncontiguousbytedevice.cpp
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>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
3e6b42ae9d compressEvents: limit iteration
Slightly improves performance in the new benchmark

Change-Id: I2d71143ff7bc1f32ebb172f20be1843dec123e6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-17 21:23:41 +02:00
Tor Arne Vestbø
422880c9db macOS: Enable Latin key combinations when Command (⌘) modifier is pressed
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>
2023-10-17 18:51:17 +00:00
Tor Arne Vestbø
98889c2ffc macOS: Filter out and prioritise key combinations that produce the same key
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>
2023-10-17 20:51:16 +02:00