Commit Graph

64188 Commits

Author SHA1 Message Date
Volker Hilsheimer
703614f03b Android: replace QtAndroid::activity/service with QtAndroidPrivate
There's no need for both, and QtAndroidPrivate is a documented namespace.
Replace all calls to QtAndroid::activity/service with QtAndroidPrivate
equivalents, and drop the QtAndroid version. Since we no longer store a
global copy of the activity and service, we can drop the reference right
away.

This comes with a bit of overhead - QtAndroid::activity returned a copy
of a global static QJniObject (62cb5589b3,
after which declared QtJniTypes became QJniObjects), while
QtAndroidPrivate::activity returns a newly created QtJniTypes::Activity
on each call.

This however makes it also safer, as the QJniObject is then associated
with the calling thread's JNI environment, and we can optimize critical
code paths where it's safe to do so later. Also, QtAndroid's activity
object was never updated, while QtAndroidPrivate's activity is updated
in the updateNativeActivity native method.

Change-Id: I36c5b504eac52d9e28b4c6b265daab8fedc877e2
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-27 17:44:35 +02:00
Mårten Nordheim
d44aae1358 QLocal8Bit::convertToUnicode[win]: Drop QVLA in favor of array
We now, instead, resize and copy the data directly into a QString if
we run out of space in the pre-allocated array.

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I1eed5e75f0bd067b4e7d6bff97c4186f3f6ee0ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 17:44:35 +02:00
Mårten Nordheim
3a5339b418 QLocal8Bit::convertToUnicode[win]: Fix indentation
To make future changes easier to read

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I431c83b956c179b1d04c2bf51b744227f8b136be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-27 17:44:34 +02:00
Ahmad Samir
6c234ec1dd QMetaEnum: de-duplicate some code
By using parse_code static helper.

Use views instead of const char*.

Change-Id: I9ccd54d72b831fd963ff3a0092f4829708904659
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
336f6340fd QMetaObject: change typeNameFromTypeInfo() to return a QBAV
typeNameFromTypeInfo() returned a QByteArray, the first if branch used
stringData() which uses QByteArray::fromRawData() so not too bad, but
the second if branch allocated a new QByteArray. Making it return a QBAV
is less confusing and avoids a potential QByteArray allocation.

Also remove rawTypeNameFromTypeInfo(), and use typeNameFromTypeInfo()
instead.

Change-Id: I0c51a093aa47d2691a8f1ac45421ede7bce0a871
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
4ecbe42ff4 QMetaObject: add indexOfEnumerator(QBAV) overload
And remove the indexOfEnumerator(const char *) overload.

Taking by view so that it works with string data that isn't necessarily
null-terminated (e.g. a sliced() or chopped() view).

QMetaObjectPrivate::indexOfEnumerator needs to be a member function
because it usess a private QMetaEnum constructor (QMetaObjectPrivate is
a friend of QMetaEnum).

[ChangeLog][QtCore][QMetaObject] Added indexOfEnumerator(QByteArrayView)
overload. And deprecated indexOfEnumerator(const char *) overload.

Change-Id: Ie2f4f1a9af69373c19a5d7bd92499544e95e9289
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
56b8048ab9 QMetaObject: change static objectClassName() to return a QBAV
QBAV has an operator==(), among other things.

Internally QMetaObject only supports Latin-1, however that is an
implementation detail that shouldn't be exposed in public API. Since
some public methods will be changed to take a view, a QBAV, use QBAV
internally too to keep the code consistent.

Also change QMetaObject_findMetaObject() to take a view, this is more
robust as it can work with other string data that isn't necessarlify
null-terminated (e.g. a sliced() view, which will happen in later
commits).

Change-Id: I346d7910ad8fa30951a7168e9b257f039f016298
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Ahmad Samir
e0573e7364 QTimer: split QSingleShotTimer to a private header
So that it can be used in QTimer and soon-to-added QChronoTimer, this is
less code duplication.

Change-Id: Icc5f2028d776a34c06ba20fe41f571cd3821c64c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 18:44:34 +03:00
Assam Boudjelthia
6f1449c7ae Android: fix ClassLoader warning
The Dex value provided is an empty string which leads
to this system warning when initiating an instance of
the ClassLoader

 W System  : ClassLoader referenced unknown path:

This patch fixes it by providing a valid path.

Task-number: QTBUG-115016
Change-Id: I6dcd396a07337278224e07b0271f49bb829ea0ce
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Assam Boudjelthia
db91947eb0 Android: remove redundant QtNativeLibrariesDir class
This class is now not used anywhere after QtLoader refactoring.

Task-number: QTBUG-115016
Change-Id: I3399ba68fe85396f88766e9547cdfefc30baf6ed
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Assam Boudjelthia
3a505a859a Android: modularize and simplify QtLoader classes
The Qt loader is now expected to work in the following way:

QtActivity.onCreate()
--| QtActivityBase.onCreate()
----| Initiaze the delegate
----| Creates QtActivityLoader()
------| Creates QtLoader()
--------| Initialize the class loader
--------| Initialize static classes context
--------| Initialize Context Info
------| Sets common environment variables and parameters from metadata
------| Setup style extraction
------| Sets Activity specific metadata
--| Handles Activity themes
--| Call QtLoader.loadQtLibraries()
----| Fetch and load Qt native libraries
----| Fetch and load the app's main library
--| Start the Qt Native C++ app via the delegate

Few things are done in patch to simplify the Qt loader mechanism:

1)
Get rid of some unused methods, and move the loader instances
to be local instead of global.

2)
Split the awfully long methods in QtLoader into smaller methods for
readability and as preparation for next simplifications.

3)
Refactor Qt libraries loading code from the Delegate classes to
the Loader classes where it makes more sense to be at. At the same
time simplify some code into smaller logical blocks.

4)
The same boilerplate code for loading (with System.load()) Qt libs
and the main library was done twice between the Activity and Service
loaders, that is now done directly under the QtLoader. Same story
for initializing static Java classes with activity/service/context.

With this change All relevant Qt library loading logic is now under
QtLoader classes, and the latter have clear loader responsibilities
reflected in the code.

Task-number: QTBUG-115016
Change-Id: Ib76621d8beff4917c932456c5401ea4586942213
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-10-27 17:22:59 +03:00
Volker Hilsheimer
7c59c5ed13 Examples: remove OpenGL code paths from painting examples
The extra code for using the OpenGL paint engine is significant enough
to be distracting from what the examples are supposed to show. If we
want to show how to use QPainter on an OpenGL widget, then we can make
dedicated and documented examples for that, in the OpenGL category. And
we have such examples in the Qt OpenGL module anyway.

As is, the examples feel more like manual tests of the OpenGL paint
engine; if we need more coverage there, then we can add it there.

Change-Id: I7b56ea6d08c02cd0a1050ab03991656a0538498d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-10-27 16:22:59 +02:00
Dimitrios Apostolou
333650c596 Increase Coin timeout for ctest command under sanitized testruns
Reason is that after changing the sanitized testruns to quiet, we
have been hitting the 15min output-inactivity timeout.

Set it to the same value as the total workitem timeout, effectively
disabling it.

Pick-to: 6.6 6.5
Change-Id: I13c2d97b25cf338873bb89ef1ed45d58e3cdd170
Reviewed-by: Toni Saario <toni.saario@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2023-10-27 13:46:37 +00:00
Cajus Pollmeier
ac039776a6 Avoid ${...} to be replaced by configure_file
When running configure_file without @ONLY, the exit code details get
stripped out by CMake. This leads to an empty application exit status
shown on the boiler plate HTML.

Fixes: QTBUG-117997
Pick-to: 6.6
Change-Id: I4ab25960412da17c9509a66c1019c3b2b71ed108
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-27 13:48:53 +02:00
Edward Welbourne
58fd829cdf Use localized time-zone abbreviations or offset
The actual formatting of date-time strings is handled by the calendar
backend, but the code's in qlocale.cpp as it uses some of its tools.
When feature timezone is unavailable, we're stuck (as before) with
using QDateTime::timeZoneAbbreviation(), but when it's available we
can use QTimeZone::displayName() to get the localized form of the
abbreviation and offset string.

Make matching changes in QDTP so that it recognizes these localized
abbreviations. We now have another candidate for what local time might
be called, to add to those that must be checked.

This naturally implied some changes to tests. It turns out ICU
believes en_US uses GMT+1/GMT+2 for CET/CEST. Replace some MS
QEXPECT_FAIL()s by including the non-abbreviations we do in fact use
on MS in the lists of "abbreviations" to accept.

[ChangeLog][QtCore][QLocale] When a datetime format includes the
timezone (or offset), the appropriately localised form is (to the
extent the timezone backend in use supports this) used where,
previously, a haphazard choice of system and C locale was used. This
applies to both serialization and parsing.

Task-number: QTBUG-115158
Change-Id: I04f9c1055c3b9008320bb8b758490287fd8be5cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 10:52:48 +02:00
Edward Welbourne
4756062828 Have QDTP match longest form it can for local zone name
Previously, three candidates were tried (there shall soon be more) and
the length of the first to match was returned. This could go wrong if
tzname[] = { "GMT", "GMT+1" } and our text starts with the latter; we
would have only matched it to the former.

Change-Id: I8e7b9e6a382bdd527bb98be7c86ea67b11cdc13a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 10:52:44 +02:00
Volker Hilsheimer
bd5c6fab40 QueuedCustomType example: use QThread::requestInterruption
Drop the home-made solution with mutex and bool (which could have been
an atomic, but we have had a ready-made solution in QThread for a long
time).

Pick-to: 6.5 6.6
Change-Id: Id213a021f0ae94215afb28ff874fcb597dd1e6f9
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
Reviewed-by: Ed Cooke
2023-10-27 07:55:42 +02:00
Volker Hilsheimer
ae39b16345 Convert tooltips example to snippets
The important bits from the example are ~10 lines of code, no need
for building a poor-man's version of a graphics or item view.

Pick-to: 6.6
Change-Id: I7874c66765c5b46230c92846ee3de1ee83f47e45
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-27 07:55:34 +02:00
Ahmed Kerimov
70df82a919 Prefer using override instead of virtual in qdbusxml2cpp
In C++ 11 override keyword was introduced to allow overridden functions
to be marked appropriately. Its presence allows compilers to verify that
an overridden function correctly overrides a base class implementation.
This can be useful as compilers can generate a compile time error when:
- The base class implementation function signature changes.
- The user has not created the override with the correct signature.

This commit improves the D-Bus interface code generation.

Change-Id: I0353575c3f70277d04e41b8fa0096c1b2b28058a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-27 00:48:26 +03:00
Christian Ehrlicher
23370ace68 QCommonStyle: cleanup standardIcon()/standardPixmap() [1/2]
Factor out the four code paths for standardIcon() (windows, mac,
application and resource theme) and use those functions also for
standardPixmap() so the returned pixmap is correctly scaled with the
current devicePixelRatio.
Part1: Add QStyle:: scope to switch statements

Task-number: QTBUG-118122
Change-Id: I39c01612c23a0da61c256c682642ae4e75ed8c43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 23:03:45 +02:00
Christian Ehrlicher
a553d00179 SQL: fix doc
Fix the link to QIBase.
This amends 3cb5408e9e

Pick-to: 6.6 6.5 6.2
Change-Id: I99820971e4136b2cbbc6ee37d80394e0e016f444
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-26 23:03:45 +02:00
Thiago Macieira
d5393a936d moveToTrash/Unix: use linkat() to check early for cross-device renames
This ensures that we will succeed in renaming files, because we already
have created a link to it in the right directory. With this, we can
remove the home filesystem check that was using QStorageInfo. The
majority of file deletions we expect applications to perform will use
this code path.

An additional benefit is that we ensure we can't get an ENOSPC when
renaming any more, because we already have the entry in the directory.

This needs a fallback to the existing mechanism for two cases:
* trashing full directories, because you can't hardlink them
* when operating on a volume that isn't a Unix filesystem (e.g., a FAT
  filesystem on a removable device)

QTemporaryFileName required a small change to allow non-absolute paths.

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
linkat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.MuahmK", 6, ".eRPdPI", 0) = 0
openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
close(5)                                = 0
openat(7, "tst_qfile.moveToTrashOpenFile.MuahmK.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
[../etc/localtime..]
write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
renameat(6, ".eRPdPI", 6, "tst_qfile.moveToTrashOpenFile.MuahmK") = 0
unlink("/home/tjmaciei/tst_qfile.moveToTrashOpenFile.MuahmK") = 0
close(5)                                = 0
close(6)                                = 0
close(7)                                = 0

Change-Id: I9d43e5b91eb142d6945cfffd1786d714fc24f161
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 11:36:46 -07:00
Thiago Macieira
935562a77b QTemporaryFile(Name): don't make the path absolute on generation
I need to use QTemporaryFileName in a context where absolute paths are
not allowed because they change the behavior of the system call (the
-at() POSIX system calls); see next commit. This required a fix to a
seemingly unrelated test, which depended on the absolute path, because
QPluginLoader and QLibrary assume a file name with no path components
imply "search the standard places".

[ChangeLog][Important Behavior Changes][QTemporaryFile] This class will
now return relative file paths in fileName() if the file template was
also a relative path (it used to always return an absolute path). The
temporary files are still created in the same directory; this change
only affects the length of the path the function returns.

Change-Id: I79e700614d034281bf55fffd178f65f2b3d602d8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-26 11:36:46 -07:00
Volker Hilsheimer
84e70976f3 JNI: Tolerate threading mismatches and improve diagnostics
Amend 944200b5a9. We have code paths
in Qt that result in a global QJniObject being called from multiple
threads (QtActivity instance, possibly the QAndroidSystemLocale),
so we need to tolerate that until we understand better under which
circumstances this should be allowed, and what tools we can use to
control this better.

Don't instantiate QJniEnvironment to check the JNIEnv, but use raw
JNI calls so that we don't implicitly attach a thread to the JVM
when checking. Use categorized logging to emit log output if we
have an environment/threading mismatch, including the name of the
class we are trying to call, and fall-back to the thread-local JNI
environment pointer instead of the one stored in the QJniObject's
private.

Also, give the threads that we attach to the JVM the name of the
QThread instances if we can, resulting in better logcat output on
the device.

This still results in less overhead than the code had prior to
944200b5a9, as we don't instantiate
multiple temporary QJniEnvironment objects on the stack for each
call.

Change-Id: I98b92edd29162dccfc5c34e6261d4de219b59531
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-10-26 20:04:51 +02:00
Volker Hilsheimer
f419a8d67f Android: add an appless test that recreates QGuiApplication
Make sure this works and doesn't cause any QJniEnvironment or other
JNI object lifetime issues.

Change-Id: I08b55982266dfb1821517449f6eb9f2796cea9b7
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-10-26 20:04:51 +02:00
Jarkko Koivikko
beeb531c32 print: Use transient parent for native print dialog if provided
Pick-to: 6.6
Change-Id: I6703784d57dab732e5d501cec0d1231b564a065e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-26 21:04:51 +03:00
Edward Welbourne
1e74f67e54 Work round ICU disagreeing with TZDB about zone transitions
Since the TZ backend resorts to ICU for display names, we got
inconsistent results if they disagree about when transitions happened.
Also, ICU uses the current (or only recent history) names for the
zone, so one currently not doing DST (Africa/Tripoli) doesn't get a
report of its DST name at a historical time when it did DST (but ICU
doesn't know about it). Since the ICU backend, in any case, doesn't
override the displayName(qint64, ...), we can simply use the QTZP base
version instead of overloading in the TZ back-end, so we only delegate
to ICU when it might actually help. This also saves duplicating some
locking and lazy-initialization code.

In the process, turn a unique lock into a scoped lock within a
suitable scope. Also, make a comment more grammatical and less
verbose.

Change-Id: Iaaed1fb6a380be8b4258c43cbc4bacd5784345fb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-26 19:56:07 +02:00
Giuseppe D'Angelo
358745d7de QSP/QWP: introduce owner_before, owner_equal, owner_hash
While at the moment we don't have aliasing support in QSharedPointer,
introduce owner-based comparisons and hashing. This also fulfills some
use cases in lieu of operator== for QWeakPointer (which got deprecated
by bb23a05905).

I'm using C++26/P1901's spelling of owner_equal, instead of
Boost.SmartPtr's spelling (owner_equal*s*). Given the niche use case,
the lack of interoperability with Qt's own containers, as well as the
Standard comparison objects' semantics (std::owner_less,
std::owner_equal), I don't think we should be giving these a Qt-ish name
as it would be pretty useless.

[ChangeLog][QtCore][QSharedPointer] Added owner_before, owner_equal,
owner_hash.
[ChangeLog][QtCore][QWeakPointer] Added owner_before, owner_equal,
owner_hash.

Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I8b792ae79f14cd518ba4a006edaa17786a8352a0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-26 19:24:40 +02:00
Amir Masoud Abdol
1dcc14f2d0 Use adaptive LaunchScreen on iOS
On iOS, we can use system color variables to adjust the background color
of the LaunchScreen based on user's system preference. In addition, we
can remove the app name labels, since new Xcodes don't add it anymore.

Fixes: QTBUG-118191
Change-Id: I95fef6216f1373c749ea31ff4ed085435e8998f1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-26 17:12:18 +02:00
Edward Welbourne
4650a4433b Suppress deprecation warnings in test of QDTE::timeSpec property
The tests are suitably #if-ed to be omitted once the property is gone,
but the compiler can still warn.

Change-Id: I20efcf9bb40fe6d7ad7e21b64e5400f71c0a0b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 16:57:01 +02:00
Edward Welbourne
31dc17c13a Rework massaging of time zone offsets in formatted date-times
Add a missing std::move() and rearrange comments.

Change-Id: I2d93e88f7b9b6f62e7d1cca5cacf794d2fef53b5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 16:57:01 +02:00
Kai Köhne
b7b2375751 Doc: Highlight some Widgets examples for Desktop category
Pick-to: 6.5 6.6
Task-number: QTBUG-117208
Change-Id: I499b5141cc930c1f61a608bd734ef4982bd2ee0f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-26 13:22:55 +00:00
Amir Masoud Abdol
9e4e52a9b3 Make qt-internal-configure-tests aware of Vcpkg's OpenSSL packages
The currently provisioned OpenSSL for Android, i.e.,
`prebuilt-openssl-3.0.7-for-android-ndk-r25b.zip` has a different
structure compared to what Vcpkg installed directory has. This patch
makes sure that we are considering the Vcpkg structure as well.
CMAKE_ANDROID_ARCH_ABI should be translated to Vcpkg's triplet target
name, and we add a `-dynamic` suffix to them because we are building
android artifacts with a custom triplets with similar names.

Change-Id: Id48a8ad351a64ab18001f729d948fbf1b7e47b29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-26 14:31:57 +02:00
Piotr Wierciński
4f168621d2 wasm: Fix test runner for asynchronous tests
Test runner was not properly handling tests which
return the control back to browser event loop.
It was treating such tests as if they exited with
code 0, marking them as succesfull even if they were
eventually failing or hanging.
This commit adds a callback to TestCase so the runner
is notified when a test truly has finished.
As a side effect, two tests need to be disabled for now
as they are failing for wasm, which was not properly
detected previously.

Change-Id: I0eb9383e5bb9cd660431c18747b9e94413629d1e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-26 13:43:39 +02:00
Anton Kudryavtsev
d1f40ea087 QString: remove isSimpleText method
It's legacy method marked as internal.
There are zero occurrences of "isSimpleText"
anywhere in Qt or Qt Creator other than qstring.*

Change-Id: I4961b7b2539fb6552484e77fbea58ba0e6656921
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 13:40:51 +03:00
Axel Spoerl
e3d34d2fdb qsystemdetection.h: Update WASM in comments
WASM has been added as a definition.
Add it in the comment section as well.

Pick-to: 6.6 6.5
Change-Id: Id86520cad4c12d83234cc71a00cd3e484e2895dc
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-26 12:40:51 +02:00
Michał Łoś
3f8de9d327 Define PN_XNUM if not defined in elf.h
VxWorks elf.h (nor any other header in its SDK) doesn't contain
definition of PN_XNUM, which meaning is the limit of program headers in
ELF structure, related to `e_phnum` field of `Elf{32,64}_Ehdr`
structures. Since these fields have identical type and seemingly
identical meaning, we can safely assume that its maximum value will be
the same on both systems.

Define PN_XNUM if it's not defined with `0xffff` value taken from
Linux and Solaris related headers.

Fixes: QTBUG-118135
Change-Id: I5a0dab1d1d18e165d01e80823a02f7df644fc7e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-26 10:57:31 +02:00
Joni Poikelin
799bfe94e8 Fix smooth scaling of Format_Mono and Format_MonoLSB
Fixes: QTBUG-117713
Pick-to: 6.6 6.5 6.2
Change-Id: I2fb071a4d2229da50dfacb0a92c51c3e4ea57a74
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-10-26 07:48:02 +03:00
Tor Arne Vestbø
c5d9e4a7a7 Teach QMessageDialogOptions about default and escape buttons
There's logic in QMessageBox to resolve the default and escape button
if not set by the user. And the user may of course override these.

We now propagate the resulting buttons via the dialog helper, and
pick them up in the macOS native dialog backend. The only common
information we have between the standard buttons and custom buttons
is the button identifier, which for standard buttons is the enum
value, and for custom buttons is an auto generated identifier.
The same identifier is used when reporting the clicked button
from the native dialog helper.

Fixes: QTBUG-118308
Pick-to: 6.6 6.5
Change-Id: I5ca45604b51f0bbf74e56134d7b55bb8911f3563
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 01:20:44 +02:00
Tor Arne Vestbø
d44413d526 Explicitly focus automatic default button in QDialogButtonBox inside dialog
QDialogButtonBox has logic to automatically resolve a default button,
in case one is not already set via QPushButton directly, or via e.g.
QMessageBox::setDefaultButton().

Unfortunately, this default button can in some cases be overridden by
the first button in the dialog button box. The reason this happens
is that the first button is the focus proxy of the button box, so
when the button box gains focus, it will transfer it to the first
button. And since QPushButtons inside a QDialog have their autoDefault
property set to true by default, this focus transfer will also reset
the default button to the focused button.

This arbitrarily happens for any role that happens to be earlier in
the QDialogButtonBox::ButtonLayout than the AcceptRole, and can be
very confusing for the user, so we try to avoid the situation by
explicitly setting the automatic default button as the focus
widget of the button box, unless one is set already.

This is also what QMessageBox::setDefaultButton() does internally.

The only case we're not covering is when the user sets a push button
as default via QPushButton::setDefault(), but we conservatively
assume that the user then also calls setFocus() on the button.

Pick-to: 6.5 6.6
Change-Id: Ibdac0a51ba9439321d4fd7a1dac1ed695e11d693
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
b0ddca18d7 QMessageBox: Do last minute setup in setVisible instead of showEvent
The native message dialogs are shown in QMessageBox::setVisible,
instead of plumbed via e.g. QWidgetPrivate::show_sys (which is not
virtual). And we try to show the native dialog before we call the
base class QDialog::setVisible(), where we end up sending the show
event.

As the native dialogs might rely on the last minute setup of adding
an OK button or detecting the escape button, we need to do it in
setVisible instead.

We can not switch the order of showing the native dialogs after
calling the base class setVisible (and getting showEvent), as
we need to know whether the native dialog could be shown or not
to decide whether to show the fallback widget dialog.

The part from showEvent that added the detailsButton has been
removed, as we're already doing that in setDetailsText().

Pick-to: 6.5 6.6
Change-Id: I23f1d87d542d9dadfd71924f8119c22720f4b276
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-26 00:14:33 +02:00
Michael Weghorn
1b0e76f514 a11y atspi: Don't restrict top-level window to 2 a11y roles
So far, only accessible interfaces of roles QAccessible::Dialog
and QAccessible::Window were taken into account when trying to
find the top-level window in order to calculate the window-relative
coordinates relative to that one.

However, an app doesn't necessarily need to have any such widget/
window as it's top-level object, but can have any widget there.
Therefore, consider any a11y object that is a direct child of the
application's a11y object a top-level window as well.

For example, in the spinboxes example
(qtbase/examples/widgets/widgets/spinboxes/spinboxes), the top-level
widget is a QGroupBox, which has an accessible role of QAccessible::Client,
which maps to ATSPI_ROLE_FILLER for AT-SPI on Linux.

Since that's the top-level widget, window-relative coordinates
should be calculated relative to it.
(Without this change in place, screen coordinates would be
used for the window-relative coordinates as well, as found by
the script attached to QTBUG-106527.)

Also deduplicate a bit and just have a single loop instead
of the extra check on the interface itself at the beginning.

Fixes: QTBUG-106527
Pick-to: 6.6 6.5
Change-Id: I8d2a00bcc22c71d696e4f48233afddc80e93bc1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
78cb91c5ca macOS: Avoid adding modal session for window that's already added
Investigating QCocoaWindow::setVisible idempotence revealed that our
QCocoaEventDispatcherPrivate::beginModalSession() implementation would
happily add the same window multiple times, resulting in trying to
re-start a modal session for the same window when the window was
closed, confusing AppKit's logic for choosing the next key window
when a modal window is closed.

We now bail out if we detect this scenario, even if setVisible has
been fixed. Additional logging has also been added.

Pick-to: 6.6 6.5
Change-Id: I07418c12b421fb0b4ebf875050e32f56fdad6197
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Fredrik Ålund
00ed8d7822 Fix datatype mappings for the Mimer SQL QtSql plugin
Some of the datatype mappings for Mimer SQL are wrong and some are
missing. Also, fix the datatype documentation for Mimer SQL.

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 23:01:56 +02:00
Marc Mutz
fbb1cc234b qmainindowlayout_p.h: make header guard match file name
Pick-to: 6.6 6.5
Change-Id: I922e54f93897ffd82931419afcbba4d148ca5e8d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:56 +00:00
Christian Ehrlicher
bd7c409b9c QCommonStyle: use addIconFiles() to avoid copy'n'paste
Use addIconFiles() instead repeating the addIcon() function with every
size to avoid copy'n'paste errors and make the whole stuff more
readable.

Task-number: QTBUG-118122
Change-Id: I71ab5ca0526024c6f96e20871018b4af43dac3bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:58 +02:00
Thiago Macieira
2fefc8c63c QString/QByteArray: add lvalue and rvalue overloads of left/mid/right
The first/last/sliced API may be what we suggest users use, but the vast
majority of the installed codebase uses left/mid/right because they've
been available since time immemorial.

An additional benefit of this is to make left() and right() available as
inline methods.

Change-Id: Ifeb6206a9fa04424964bfffd1788383817ed906c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
1cce2cceff QString/QByteArray: make the sliced(pos) overload call the other sliced
Complements 00c1c04bd5.

Change-Id: I8f3ce163ccc5408cac39fffd178c543d594cf64f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-25 12:01:58 -07:00
Thiago Macieira
f4101f9953 QString/QBA: add lvalue and rvalue overloads to first/last/sliced/chopped
Those ought to have been the original implementation, when they were
added in commit 38096a3d70, for Qt 6.0.

Because these classes are exported, we need to provide the previous only
implementations for MSVC. All other compilers would provide inline or
emit local, out-of-line copies.

Change-Id: Ifeb6206a9fa04424964bfffd178836a2ae56157d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
2fd0996324 QArrayDataPointer: add an allocating constructor
It's by far the most common use, so having to call two things is just
cumbersome.

Change-Id: I79e700614d034281bf55fffd178f454c4e31929e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00