Commit Graph

61283 Commits

Author SHA1 Message Date
Edward Welbourne
7d75039482 Make default local time a static const
QDateTimeParser::fromString(), when parsing a date-time, uses the
start of 1900, in local time, as its default date-time. (This is a bad
choice and steadily getting worse.) This turns out to be somewhat
expensive for some client code, so make it a static const so that we
only compute it on the first call, as for getM{in,ax}imum().

The potential downside is that a change to system time zone won't be
reflected in this value. However, any sane parse-format should require
over-writing all fields of this initial value, in any case, so the
issue is less severe for this default value than for the existing
getM{in,ax}imum() statics.

Change-Id: Iacfd827fe76c4e5fbdc5e5b6efefed13bc673af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:08 +02:00
Edward Welbourne
4c93b9c1d0 Refactor QGregorianCalendar::julianFromParts to return std::optional
It's a private static used to optimize internal use, so we can freely
get rid of its out parameter this way.

Change-Id: Id62612987f10ecbbd9702610fd172286adbfd442
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:07 +02:00
Edward Welbourne
22909abeae Split out a helper function for QLocalTime
Packaged calls to QGregorianCalendar::julianFromParts(), to convert a
struct tm's date fields to a Julian Day number: the tmToJd() function
hopefully makes it clearer what's going on.

Change-Id: Icdbd9d4d915a053ab49dabee645582523ac826c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 14:06:07 +02:00
Alexey Edelev
4fa6cd8cea Normalize paths using std::filesystem::weakly_canonical
std::filesystem::weakly_canonical resolves symbolic links in paths.
This allows syncqt to work with paths that are symbolic links and
real paths.

Fixes: QTBUG-113295
Pick-to: 6.5
Change-Id: Ie7478b4accf279e8abf9f3849d18807cee99f085
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 12:53:23 +02:00
Amir Masoud Abdol
a0923d5d3a Resolve symbol ambiguity when building with Unity Build
In unity build, we may get `error: reference to 'detail' is ambiguous`
between the `detail` namespace defined in `qpropertyprivate.h`, and
`qflatmap_p.h`. For now, this causes an issue during the compilation of
`qcalendar.cpp` and it may occur in other places where qflatmap is
included.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ie4bbb66543d26a5db58488e924333d98ce0adebf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 12:53:23 +02:00
Marc Mutz
038c1c5978 QString/QByteArray::op>>: don't assume clear() makes the container isNull()
This is something we may want to change at some point, so be explicit
and assign a null container instead of relying on clear().

Add a comment that was present in the QString, but missing in the
QByteArray implementation.

Pick-to: 6.5
Task-number: QTBUG-31283
Task-number: QTBUG-60745
Change-Id: I10d82b8a0c67fff314af526c7b7e0f247c3405fd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-05-04 12:53:23 +02:00
Eskil Abrahamsen Blomfeldt
151287fb51 Update harfbuzz to version 7.2.0
Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113352
Change-Id: I134f5b49c2ae5bef31edfc5cd87f0ff62d6c18b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-04 11:48:29 +02:00
Volker Hilsheimer
1af36eb230 Doc: fix warnings in QTimer
Amends recent changes that added std::chrono support by making
the duration type of QTimer::singleShot a template parameter.

Change-Id: If3b5f0ad99304cb292412bb8467ba6852e47654f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 10:33:27 +02:00
Allan Sandfeld Jensen
178c123a6f Match deadcode elimination with cpu feature check
We check for Haswell, so don't just check for AVX2 when removing
possible dead-code.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-113315
Change-Id: Id341aebcef99065f4b6a96ad0f60b9de40ed55ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 10:33:26 +02:00
Marc Mutz
fd6ecd8561 Q{Any,Utf8,}StringView: fix docs of generic Container ctor
For QAnyStringView, the docs were missing completely.

For QUtf8StringView and QStringView, they weren't updated following
the rewrite of the std::basic_string ctors into generic Container
ones.

Amends 9e1dc1e8a9 and
2c9529e158.

Pick-to: 6.5 6.2
Task-number: QTBUG-112746
Change-Id: I6eef2294db01e35f1a085df7fc76c25c6003530d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-04 07:07:08 +02:00
Lorn Potter
263e0b899f wasm: Fix permissions
Trying to get a tracks list on a MediaStream without setting
the src will generate an error in the callback and
muck up the permissions handling.

Pick-to: 6.5
Fixes: QTBUG-112901
Change-Id: Ide3a7336597fd0a08764e303dcc8f58755ba915d
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-04 13:01:35 +10:00
Tor Arne Vestbø
5c05eb3ea0 macOS: Don't clam to support action messages from non-Qt menu items
As described in 3bedeb837e, the way
menu items on macOS are typically set up they have an action, e.g.
copy:, but no target, and the system then takes care of finding the
right target at runtime, starting with the first responder, walking
the responder chain, and then moving on to other NSWindows, before
ending up in the NSApplication and its delegate.

As we (still) don't have a mechanism in Qt to forward generic
actions, such as the cut/copy/paste, or selectAll, so we rely on
mapping the actions back to QCocoaNSMenuItem that we can trace
back to a QPlatformMenuItem that we in turn emit activated() for.

Normally this works fine, but in the case where the Qt app is embedded
in a native UI, which has its own menu items with cut/copy/paste,
we'll get callbacks into QNSView for actions triggered by a generic
NSMenuItem.

In that case, we need to bail out, but we want to do so in a way
that lets AppKit continue to walk the responder chain. This is
possible by implementing supplementalTargetForAction:sender:,
where we have access to the sender. If sender doesn't match
the expected QCocoaNSMenuItem we let AppKit find a better match
up the chain.

Since the target we return needs to ultimately respond to the
selectors and/or forward them, we can't point the target back
to ourselves, nor can we point it to the application delegate
directly, as the menu items need to be validated in the context
of the view, so a new per-view QNSViewMenuHelper class has been
added to take the role of forwarding the menu actions.

The logic for forwarding the resulting actions to the application
delegate has been simplified and hardened a bit as well.

A possible scenario with this new approach is that the Qt app
has a line edit focused, and the user tries to activate the
menu item for Paste, but the item is grayed out because we
can not support the action. This is of course confusing for
the user, but less so than having an active menu item that
then doesn't do anything when activated.

Another scenario is that a responder later in the chain does
respond to the paste action, and the menu item will end up
pasting into something that is not the first responder.
This might also be confusing for the user, but it's generally
recommended that implementers of actions like paste only
allow the action if the view is the first responder, and
this is something views have to deal with anyways, so it
doesn't change anything that we're now bailing out earlier
in not accepting the paste.

One benefit of allowing AppKit to find a better target for the
action is that if no target is found, and the user presses the
key equivalent of the disabled menu item, the key event will
be delivered as a normal keyDown to our QNSView, which we do
forward, allowing the Qt app to respond to the action, even
though the action came from a generic menu item. With our old
approach this would not happen, as we would claim to support
the action for our QNSView, but then drop it on the floor when
AppKit tried to deliver it to us.

Change-Id: I609db42df6a107a49e287f435e8808812c83d43e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-05-04 01:03:52 +02:00
Friedemann Kleint
7d542e1daf Brush up the container code snippets
- Bring iterator loops into a consistent form using auto and
  creating and end variable, use cbegin()/cend() where suitable
- Use (std::)endl instead of Qt::endl for iostreams
- Fix removed container conversion API (QList::fromSet, QSet::toList())
- Use range-based for instead of foreach
- Use initializer lists
- Use qPrintable(QString) for output to std::ostream
- Use qsizetype
- Remove some unused snippets

Complements f6b137bdc4.

Pick-to: 6.5
Change-Id: I8a167099cdb224f45b984fa834d46269144a7ef0
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 01:03:51 +02:00
Ahmad Samir
5c71312ba3 Suppress a redundant GCC warning
The test is accessing an out of bounds index into an array on purpose.

Change-Id: I23cce4093fdfabd177eb34639f26fcd6752c8b34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-04 02:03:51 +03:00
Marc Mutz
87e90a265f QVarLengthArray: simplify / optimize assign(It, It)
After many failed attempts at addressing my dissatisfaction with the
if (n) checks, I finally realized that the problem is the

    while (first != last && end != end())

loop, which, when exited, gives no indication as to _why_ it was
exited. Any attempt to re-construct the exit condition must needs
re-check something that should be known already.

To fix, then, use a while (true) loop and react on first == last and
dst == end() separately.

As a drive-by, cache end().

Task-number: QTBUG-106200
Change-Id: Ic873774451df4102163e6e65d93c35e5dcbbb037
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-03 20:13:25 +00:00
Marc Mutz
5a3ac484db savegame ex.: revamp the way we (de)serialize JSON
JSON, unlike, say, QDataStream, allows building up objects independent
of some central object, and combining them into a QJsonDocument
later. This suggests returning QJsonObjects from a toJson() const
method instead of having the caller supply a QJsonObject. Doing it
this way enables transparent move semantics to kick in, too.

For deserialization, use a fromJson() named constructor for value-like
classes (where identity doesn't matter, only equality). Keep using
read(), too, and add a note to explain when to use which form.

Also, avoid the triple lookup from

   if (json.contains("key") && json["key"].isSoughtType())
      mFoo = json["key"].toSoughtType();

by using C++17 if-with-initializer and showing the trick with
Undefined never being of isSoughtType():

   if (const QJsonValue v = json["key"]; v.isSoughtType())
      mFoo = v.toSoughtType();

Adjust the discussion to match the new code, up the copyright years
and rename some qdoc snippet markers from nondescript [0]/[1] to
[toJson]/[fromJson].

Task-number: QTBUG-108857
Pick-to: 6.5 6.4 6.2
Change-Id: Icaa14acc7464fef00a59534679d710252e921383
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 21:36:14 +02:00
Tobias Koenig
a7d92f809f Schannel: Remove deprecated SCHANNEL_CRED based code path
Since the required minimum version of Qt is Windows 10 (1809),
the deprecated SCHANNEL_CRED code path to initialize TLS
connections can be removed and the SCH_CREDENTIALS based
path is used for all connections.

Change-Id: I2aef919a45373e55ae96405b7c6f2264378f4464
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 19:36:13 +00:00
Thiago Macieira
6d30e7da3d QProcess: remove the note that it freezes threads on QNX
The notes were added in commit e3363fd945
by Rafael, because at the time QNX 6.5.0 did not support fork() in
multithreaded applications. We had to use posix_spawn(3) and that
doesn't support setting the child's working directory, so we needed to
freeze the application while chdir(2)ing in doSpawn().

doSpawn() was removed in commit 005a8bfbf0
for Qt 5.7, because fork() works since QNX 6.6.0. But the comments were
accidentally left behind.

Fixes: QTBUG-112990
Pick-to: 5.15 6.2 6.5
Change-Id: I3b169860d8bd41e9be6bfffd17577276eaabb855
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-03 11:40:37 -07:00
Amir Masoud Abdol
edabd36cbb Introduce QT_ALLOW_SYMLINK_IN_PATHS flag
`QT_ALLOW_SYMLINK_IN_PATHS` disables the
`qt_internal_check_if_path_has_symlinks` command. This allows people of
Homebrew to get their build working without having to patch the entire
function, as they currently do.

Pick-to: 6.5
Change-Id: I4fed3ca497684364eaabbdbc44f1e148e3f28bd7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-05-03 19:44:45 +02:00
Dennis Oberst
4d404c2936 QVarLengthArray: remove unnecessary exception check
The previous check for a non-throwing copy constructor at:

    if constexpr (IsFwdIt && noexcept(T(*first)))

is not necessary as std::uninitialized_copy provides strong exception
safety.

Additionally, change the phrasing of the overload-resolution \note,
since we're not requiring C++20 std::input_iterator, but the older
C++17 definition.

Amends 7cbdc8abbd.
Amends 2457dd8bd0.

Change-Id: Ie36c8d70dc61aa8cc2a30c9d4110d1beb0d1c2fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-05-03 15:07:13 +00:00
Volker Hilsheimer
6e2bba71bb Pass functor through as references until stored
Amends 642f799fc6 to avoid unnecessary
copies in between the calls to the QFunctorSlotObject construcotr. We
can't use a univeral reference in the QFunctorSlotObject constructor
as the call is not deduced. So provide two overloads for lvalue and
rvalue references instead.

The compile check in the test now no longer fails as we delay the
storage until one level later, but that's acceptable.

Change-Id: Ide95b4a73c70f6f47698dd1e95138aa5d48ee95d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-05-03 14:02:28 +02:00
Alexey Edelev
b523a655c8 Do not use REALPATH when collecting Qt header files
CMake doesn't resolve REALPATH for the non-existing files.
This limitation blocks the use of REALPATH when collecting the
generated module header files. The real path should be resolved
by syncqt implicitly and CMake scripts should rely on ABSOLUTE paths
only, which should be consistent for any files including the generated
files.

Task-number: QTBUG-113295
Pick-to: 6.5
Change-Id: I0219c7bf34ef6a6589c6d5fade4c2ed3f8036ef0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-05-03 13:22:22 +02:00
Alexey Edelev
0d3fb82535 Remove duplicated syncqt arguments from the rsp file
syncqt_args is initialized with common_syncqt_arguments, so no need
to append the same values one more time.

Pick-to: 6.5
Change-Id: I1588ed438b7df0b0533ad3963ca96960dd5a8dbb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-05-03 13:22:22 +02:00
Laszlo Agocs
c5e0c2e3f8 rhi: gl: Skip useless glEnable for point sprites in core profiles
Might fail with invalid enum in core profile contexts. The behavior
is the same regardless.

Pick-to: 6.5 6.2
Fixes: QTBUG-113289
Change-Id: I5e5764494be3c5f37537f5f9b3b5311d9c49def4
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-05-03 13:22:21 +02:00
Yuhang Zhao
14458cc59b QMake: fix build with clang-cl
We need to enable or disabled exception handling for this library explicitly when using clang-cl, otherwise clang-cl will throw an error and stop compiling.

Pick-to: 6.5
Change-Id: I2b2a9e5eb009cb8ce264f2de58f8bb4fdb2339c1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-03 07:48:08 +00:00
Jan Grulich
03cbcba7b2 OpenFile portal: do not use O_PATH fds
Using O_PATH requires correctly specifying whether the fd is writable or
not. Stating that the fd is writable without it actually being writable
results into rejection on xdg-desktop-portal side. Other implementations
like xdg-open or gtk have also moved away from O_PATH fds so this will
make a matching implementation and avoid possible rejections from xdp.

Fixes: QTBUG-113143
Pick-to: 6.5 5.15
Change-Id: Icc171752d73ee091282b7c655f71da3cb59179b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-03 07:22:52 +02:00
Volker Hilsheimer
02cac26ef5 Small improvements to QObject unit test
Remove duplicate test and outdated comment about move-only functors,
and include return value in move-only functor test.

Change-Id: I58dffe0ccf3ec12e7e05e2c9588303da4a7e75ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 22:06:18 +02:00
Marc Mutz
106c2fd19d QTimer: fix compilation with C++20
Implicit capture of *this by [=] is deprecated in C++20, and the
replacement [=,this] is not available in C++17. We also can't use [&],
because of QueuedConnection, so need to bite the bullet and list all
captured variables separately.

Amends 87535e4e43.

Change-Id: I5b3a713bf9220746d10d594d1a248028157ad170
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-05-02 18:32:01 +02:00
Edward Welbourne
51bcad8a61 Move some repeated constants from tests into tst_QDate
Making them static constexpr class constants is tidier than
duplicating them in diverse tests.

Change-Id: I5a24c10d6db6f946581fa0523d28bdc80358e95e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 17:03:27 +02:00
Edward Welbourne
79340518d7 tst_QDateTime::springForward(): adapt tests for midnight transitions
The second pass through each test case, going via UTC, applied an
adjustment to the time; however QTime wraps around modulo the day, so
applying a negative adjustment to a time too near the start of the day
could produce a time at the end of the day. I'm preparing to add some
test-case variants for which the transition's UTC date differs from
the date in the zone doing it, which trigger this. Combine the time
with the date before applying the adjustment, so that the date gets
decremented to match the time's wrap-around and conversion from UTC
duly gets back to the correct place, not a day later. The new test
cases (in an imminent commit) thus pass.

Change-Id: I1bd5f191c7673a56ac3fbfc69eab0bc03c9e40b3
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-02 17:03:27 +02:00
Edward Welbourne
c888153655 Fix problem with Australasian zones in fromSecsSinceEpoch() test
It seems glibc's extrapolation of existing DST-rules cuts off at some
point in the distant future, where the IANA DB gives no end-time for
such rules, leading QTimeZone to keep applying them.  This lead to
tst_QDateTime::fromSecsSinceEpoch() not getting an invalid date in one
of its bounds-probing tests, due to a within-bounds datetime getting
glibc's offset and then the out-of-bounds one falling back to the IANA
rule's offset that put it back within the bounds.

This directly affected Australasian zones (which glibc locks into
daylight-saving time in this distant future) which were fixed by using
the IANA DB's offset; but the relevant date is in August so other
zones, north of the equator, that glibc locks into standard time, then
had the reverse problem, so we have to take the minimum of the two
sources' offsets to get all zones on board.

Change-Id: I0c94af2ba108dea31bee46aafa4a8cca8d373a5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-02 17:03:27 +02:00
Edward Welbourne
6aea6c25a5 QLocalTime: get offset from correct local time minus UTC time
In mapLocalTime(), we've constructed tmLocal from localSeconds, so
that's the local time mktime()'s returned utcSecs corresponds to.  So
use that, rather than freshly dividing the original local milliseconds
by 1000 (now rounding down, instead of towards zero), which could lead
to an off-by-one error. The intermediate offset miscomputed this way
was only used in overflow cases, before being replaced by a more
reliable result, but this saves some computation as well as getting
those right.

Change-Id: Ie34cf53cd2191e277835388fcd62dcf68eaf39c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 17:03:27 +02:00
Edward Welbourne
55fe3ee5e7 Replace runic XSLT with a python script and tidy cbordump code
Filters records on having value < 256, or an RFC, previously hacked
into the XSLT to produce the last update, with a bit of hand-editing.
Using a python script makes it easier to control the formatting and
other details; for example, severl entries previously had descriptions
that mentioned their RFC, with specific section, to which the XSLT was
adding a redundant mention of the RFC. It is also possible to exploit
C++ string juxtaposition to get tidily-presented string literals,
without having to resort to raw strings.

Task-number: QTBUG-111228
Change-Id: Ibd1c93dc1c88689e78b2b13a6bcb59a003f4df0f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 17:03:26 +02:00
Yuhang Zhao
4fcb348154 fix wrong and strange indentation
Change-Id: I803d85eb83ec8e6ea532095c34fa8b0ae104705d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 14:40:26 +00:00
Kai Köhne
9f9ff18ba9 Examples: Use versioned CMake targets for Qt modules
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.

Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: Ib4373036092163518a611bd5c688591d18096d7e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-05-02 16:20:08 +02:00
Kai Köhne
df862a940e Add reference location for positioning examples
Pick-to: 6.5
Change-Id: I4f58544cac439f2ad768032e3d54d5ab51fe0755
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-05-02 14:20:08 +00:00
Ievgenii Meshcheriakov
3ef514f8d3 QtDBus: Use QMetaObject::invokeMethod instead of QTimer::singleShot
Change-Id: I1a9ecdcb8df7804d13fdcf676fc12b1e0f6bddae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 12:54:20 +00:00
Ievgenii Meshcheriakov
90d3c5b951 QDBusServer: Fix potential crash when private pointer is null
Check that the private pointer is not null before attempting
to dereference it. This can happen, for example, when
a QDBusServer instance was constructed with an empty string
as address. Attempting to destroy an object constructed
this way was causing a segmentation fault on Linux.

Add a test case that attempts to construct a QDBusServer
object with an empty string as address to check that this
does not cause a segmentation fault anymore.

Pick-to: 6.5 6.2
Change-Id: I5fe63134026e2a9f509b61d452285891b1ec624d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 14:54:19 +02:00
Topi Reinio
38bb088a26 Doc: Add 'Mobile' category to Qt Android Notifier example
The example demonstrates accessing native Android APIs in Qt applications,
tag it with 'Mobile' category.

Pick-to: 6.5
Task-number: QTBUG-112378
Change-Id: I5f936409aafb22175eab59fdb210ecd03fecb1f3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-05-02 12:54:19 +00:00
Morten Sørvig
827e010233 QGuiApplication: Propagate wheel event accepted state
Propagate the accepted state from the QtGui event to
the QWindowsSystemInterface event. This makes it possible
for the platform plugins to propagate rejected wheel events
to the native OS.

Pick-to: 6.5
Task-number: QTBUG-107441
Change-Id: Ifa90ed2430e56120a1a04b6a5872a153d26aa6bc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-05-02 12:54:19 +00:00
Morten Sørvig
3c23d701a7 wasm: build with -no-feature-accessibility
Add #ifdefs around the accessibility implementation.

Fixes: QTBUG-111509
Pick-to: 6.5
Change-Id: I9a600781b4bf9545f046efa75f962cc40fe196a6
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-05-02 14:54:19 +02:00
Marc Mutz
b6d04c8a82 QMetaProperty: add writeOnGadget() overload taking rvalue QVariant
The writeOnGadget() function is implemented in terms of write() (UB,
btw, due to the cast to QObject*), which was recently overloaded for
rvalue QVariants.

Add a corresponding writeOnGadget() overload, too.

[ChangeLog][QtCore][QMetaProperty] Added writeOnGadget() overload
taking an rvalue QVariant.

Amends 968250ee14.

Task-number: QTBUG-112762
Change-Id: I7fc686fcab293159f5a0d76dd6c8e23d5779c96c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-02 14:51:01 +02:00
Marc Mutz
426b5fbce4 D-Bus: use move() on QVariants in writeProperty()
The writeProperty() function takes the QVariant value by value, so we
can move from it, using the newly-added QMetaProperty::write() rvalue
overload.

As a drive-by, replace a copy-assignment with a move.

Task-number: QTBUG-112762
Change-Id: I6d5361830b4874fa846be513882ede4ab881246b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-05-02 14:51:01 +02:00
Bartlomiej Moskal
1bf8c1e23d Examples doc: Remove not needed android tag
There are two examples for Camera in Multimedia module. One of them is
using widgets, while the second one is QML based.
In such case the QML example is preferred for Android platform. That is
why only QML example should have android tag.

This commit remove android tag from qtMultimedia Widget Camera example.

Fixes: QTBUG-113238
Change-Id: I9d2c072fcc18e8e5a5a44a9a2da887a7b6660b46
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-05-02 11:01:03 +00:00
Christophe Marin
b53bf18280 CMake: Fix a typo in QtModuleHelpers.cmake
Rename is_staitc_lib_during_static_qt_build to
is_static_lib_during_static_qt_build.

Pick-to: 6.5 6.2
Change-Id: Iec0f4d5d025e07a857a086e960eaf7b6fa2638a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-02 12:26:26 +02:00
Thorbjørn Lund Martsum
29b2506e8c Allow disable native messagebox dialog
The native style may not match the program style and it
makes sense to give an option rather than forcing native style.

Before it could only be done with setting AA_DontUseNativeDialogs
on the app, but it is reasonable to use native file dialogs and
Qt styled messageboxes - and it is extremely cumbersome - especially
since messageboxes often can start save dialogs.

It can look a bit strange that these introduced options has just one
option (DontUseNativeDialog) and four functions, but this way it works
similar to QColorDialog, QFileDialog and QFontDialog.

[ChangeLog][QWidgets][QMessageBox] Added options functionality to
QMessagebox. The currently only option available is DontUseNativeDialog.

Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-02 10:37:17 +02:00
Volker Hilsheimer
642f799fc6 Merge QSlotObject and QFunctorSlotObject, and use helpers to deduplicate
Now we can use QFunctorSlotObject for any kind of callable - free
function, functor, or PMF. This allows us to fold the various overloads
of QObject::connect together, removing duplicate code and error handling
logic.

Change-Id: I8842f5ddd29e86be07a422647a8fc1678fd534b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-02 06:28:56 +02:00
Volker Hilsheimer
76e25bdfdf Remove QStaticSlotObject, use QFunctorSlotObject instead
The two slot object types are identical as long as we use a universal
reference and perfect forwarding in the respective connect overloads.

Change-Id: I999d71707dd045a17156e3bfecd371da7979beb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 06:28:51 +02:00
Volker Hilsheimer
ee308018f3 Use QSlotObject helper to drastically simplify QTimer
Change-Id: Iaeef5dcb5282eef834df62c7db09d05851bd7c2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 06:28:46 +02:00
Volker Hilsheimer
2cd2789a40 Respect expected return type in QSlotObject helper
When making asynchronous functions, then the return type is not ever
going to be anything but void, but this makes this helper symmetrical
with QObject::connect logic, where we can then use it to simplify
the code.

Change-Id: I9e1b8bfffb726bb3d6d7282c87e07dc7e9ede5d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-02 06:28:36 +02:00