If a foreign window becomes or loses focus window status, we should
let QGuiApplication know about it.
Pick-to: 6.7
Task-number: QTBUG-119287
Change-Id: I550d72fa13e1c38c9b89880857db9f9cbd7f6568
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The NSWindow becomes the "key window" when it's the window that currently
receives keyboard events. This happens when switching activation between
windows of the same app, or when the app is made active, restoring the
key window status.
Since the keyWindow property only applies to top level windows we were
skipping child windows when processing the event callback, but we then
proceeded to pass the top level window() to handleFocusWindowChanged,
instead of the QWindow of the key window's first responder (the view
that receives key input sent to the top level key window).
To fix this, we let each platform window send its own focus change
event, if it's the first responder, instead of relying on the top
level window to send it on behalf of possible child windows. This
decoupling ensures that we also send focus changes when we're not
part of a view hierarchy Qt controls.
Task-number: QTBUG-119287
Fixes: QTBUG-119054
Pick-to: 6.7 6.6 6.5
Change-Id: Iac06fe800291e243432335169c52db7685e173df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Emscripten documents that preRun should be an array
of functions, but also accepts setting it to a single
function.
qtloader.js was accidentally using this feature, which
works as long as qtloader is the single user, but breaks
if other code expects an array. A typical error in this
case is:
"Module.preRun.push is not a function"
Fix this by creating and maintaining preRun as an array.
Pick-to: 6.6 6.7
Change-Id: Ie1382695f3f25839cb971ab4adc81984fc8c53ca
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
As the comment says, this allows us to skip the check for non-detached
strings and for null ones. We know that the one we've just created isn't
either, so long as len != 0. All QConcatenable::appendTo() calls do
nothing if len == 0, including not calling memcpy() at all.
Moreover, because it no longer references the QByteArray::_empty
variable, the GCC -Warray-bounds warning should be gone too.
Task-number: QTBUG-116763
Pick-to: 6.7 6.6 6.5
Change-Id: Ica7a43f6147b49c187ccfffd179eba2897ce2aff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Amends a7f227f56c.
It doesn't support that anywhere except i386, and even there it has a
different syntax than what we're using here. This code assumed ARM was
only ued with GCC-like compilers.
qglobal.c.obj : error LNK2019: unresolved external symbol asm referenced in function tst_qYieldCpu
tests\auto\corelib\global\qglobal\tst_qglobal.exe : fatal error LNK1120: 1 unresolved externals
Note: if we're getting here, it means the _YIELD_PROCESSOR() generic
macro was not used, which means there is no ARM YIELD being emitted for
MSVC on ARM for C code (for C++, the macro appears to be working). This
is likely to be a performance issue, which will need to be fixed by
someone who has an interest in improving performance on those
conditions.
Fixes: QTBUG-119881
Pick-to: 6.7
Change-Id: Ica7a43f6147b49c187ccfffd179f04e1ab643302
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QDoc generates a <code> element adjacent to function/property signatures
with information on when something was introduced or deprecated.
The location and attributes of this code element are changed in 6.7 -
adjust CSS accordingly.
Task-number: QTBUG-117152
Change-Id: I64523f38ece4f5ea7663f86769bb0e73de3e7fe6
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Makes it possible to add new unpremultiplied formats later.
Change-Id: Id998a2674ca9067a0e2a5f85c7baf04bcd9a9912
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
When the current item in an item view has changed,
only send an accessible focus event when the item view
actually has focus.
Sending a focus event when the item doesn't actually
have focus is incorrect and breaks focus tracking in
assistive technology, like the Orca screen reader.
With this change in place, the focus event for the
newly selected item/child still gets sent when
changing the item using the keyboard or
by clicking on it using the mouse (since the item
view has focus in those cases), but not
when it gets changed programmatically
while the keyboard focus is somewhere else.
Fixes: QTBUG-118800
Pick-to: 6.7 6.6 6.5
Change-Id: I5540cdfce6d0ed076d4bb871e5862fddcdf05941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
No functional change, yet. Just dissociating the data name from type
name, so we can add tests for FP types in a follow-up step.
Pick-to: 6.7 6.6 6.5
Change-Id: I98fdebb49cca614ab27db146c4bacafd190e7d9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
std::string is a nice value_type for when you want to track short
strings (because of its SSO). Check that it works, incl. in case
the implementation falls back to QSet in the absence of std::pmr
support in the stdlib.
Pick-to: 6.7 6.6 6.5
Change-Id: I2406258355295c2b1300c4ae8001cead59bb27d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows us to use it in QTypedArrayData<T>::AlignmentDummy, which is
used in __builtin_assume_aligned() as a hint to the compiler. This
increases the value we were passing as the compiler hint from 4 to 8 on
32-bit platforms and from 8 to 16 on 64-bit platforms. We actually do
align to a bit higher than even that, but that's not an ABI guarantee
we're making.
However, it looks like GCC on 32-bit platforms is buggy, so we work
around it. Commit r240248 ("Make max_align_t respect _Float128.",
63012d9a57edc950c5f30242d1e19318b5708060 in Git) increased
std::max_align_t to 16 bytes on all platforms, saying "Such an increase
is of course an ABI change" and "I think glibc malloc alignment should
also increase to 16-byte 32-bit x86", but such a change to glibc was
never implemented. Moreover, there are systems that don't use glibc,
such as when using GCC on other OSes.
This is not a change in Qt behavior anywhere. i386 does not (usually) do
alignment checks, so most code wouldn't notice this at all.
Pick-to: 6.7
Change-Id: I79e700614d034281bf55fffd178fa0aee2344307
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This makes the two most-often used QTypedArrayData::allocate() -- the
ones for char (for QByteArray) and char16_t (for QString) -- go to
specialized versions, which have much simpler code. After all,
multiplications by 1 are quite trivial.
I didn't check whether an LTO compiler was const-propagating the sizes
in inlined calls from qstring.cpp and qbytearray.cpp. But not everyone
uses LTO, so this benefits everyone, in a very hot path, for minimal
cost.
Pick-to: 6.7
Change-Id: Ifa1111900d6945ea8e05fffd177dd1ce659b3fd5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Should be qint128, not quint128.
[ChangeLog][QtCore][QtEndian] Fixed return type of qbswap(qint128)
(was: quint128).
No tests for this exist, so no wonder it fell through. Added them.
Amends befda1acca.
Pick-to: 6.7 6.6
Change-Id: Ibf87724b1d500081caca46af1c598975964e04c0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
With the new provisioning scripts the QtSql plugin for Mimer SQL can now
be built in universal binary mode on macOS
Fixes: QTBUG-111219
Pick-to: 6.7 6.6
Change-Id: Iefc45b510bd17822aa7782a2c42860941eb19fc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Unfortunately we can not rely on the file dialog panel for this,
via the directoryURL property, as that property has not yet been
updated during a panel:directoryDidChange: callback, resulting in
the directory reported to the user being the previous directory.
Since we already have to store the current directory for the case
where we haven't yet created the file dialog panel we re-use this
variable as the single place to store the current directory.
It's not clear whether we still need to normalize the strings
we get from the NSSavePanel, but the code has been left in,
even if the old callback code didn't normalize the path that
we then emitted as directoryEntered().
Fixes: QTBUG-119371
Pick-to: 6.7 6.5 6.6 6.2
Change-Id: I379a47053302e73d5e06a2b941f40365c17390d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
For some directories, such as the 'Recents' entry in the native file
dialog, the panel:directoryDidChange: callback will report a NSNull
for the NSString path, which results in an exception when trying to
compute the length of this null entry.
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Ic9cddb54ea713b8fbdcaf0f4fb506ac96e90c9fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is a "regression" (voluntary, known) from commit
c27d2a57a4 which changed
QAbstractProxyModel::itemData() to call the source model's itemData(),
so our data() reimplementation is no longer used.
Of course this only matters if itemData() is actually called, which
isn't the case in Qt itself. People will likely skip this if they don't
care - but if itemData() is used in the project, then this shows how
to reimplement it correctly.
Pick-to: 6.7 6.6
Change-Id: I3acea16c05d30d7526bac32fd6cce42b5ad4b617
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If qtpaths cannt be found windeployqt should complain about that fact.
Previously it complained about "Unsupported platform".
Pick-to: 6.7 6.6 6.5
Change-Id: I4db954633c31ceac69c4d3c0e55cbe942c3272fd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When the test was written, we didn't have support for either int128
literals or proper QCOMPARE failure printing (QTest::toString()), so
the code awkwardly constructed literals from 64-bit ones using
arithmetic and QCOMPAREed the high and low 64-bit halves separately.
Now that we have added support for both, simplify the test code
accordingly.
Change-Id: Icdee7bb01f6e4bd3de74233b4fb992b0590ddafd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Replace the ad-hoc implementation of QTest::toString() in
tst_qglobal.cpp with a QDebug stream operator, so the
QTest::toString() fall-back to QDebug::toString() kicks in.
Since the ABI issues revolving around the new int128 types are not
known, yet, avoid baking the types into the ABI by a) making the
operators constrained templates¹ and b) passing though void* to the
exported helpers. These functions return an error message if Qt was
compiled without support for int128.
Use the Thiago Trick™ (leaving obviouly dead code around for the
compiler to remove without warning) to expose more code to more
compilers. This appears to work elsewhere in Qt, so I hope it does
here, too.
This completes the minimum qint128 support so we're able to debug code
and write tests that use these types.
¹ Templates, unlike inline member functions of wholly-exported
classes, never² become part of the ABI.
² <insert here the convoluted scenario under which this is false>
Fixes: QTBUG-117011
Change-Id: Ia4e56d26c6ffd18b7d69a7ceaed65b2211d258b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The class stores all data inline, and most member functions are inline
already with trivial arithmetic operations on those data members. So we
can make the class almost completely constexpr. This includes member
functions that construct or use QVector3D/4D, as those types are also
fully constexpr.
Almost all inline (and now constexpr) member functions can then also be
made noexcept, with the exception of the division operators that don't
check the divisor for 0. qFuzzyCompare(float, float) is not noexcept,
but it has no preconditions and never throws, so we can make the
QQuaternion overload noexcept.
Remove const from values returned by arithmetic operators, and fix
whitespace style in prototypes (also the few that are not already
touched by the other changes).
Prepare unexporting the class wholesale in Qt 7; we only have to
export out-of-line functions, but can't make that change in Qt 6,
as the implicitly defined special member functions are exported (at
least on MSVC).
Change-Id: I3e43232bf66009352e8de937c07b2985147fb33c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
QPixmapIconEngine as base class of QAbstractFileIconEngine implements
isNull() by checking if there are pixmaps available. As
QAbstractFileIconEngine does it's own caching mechanism, that check is
failing. Since we can assume that the os returns a valid icon for every
file, QAbstractFileIconEngine::isNull() can always return false.
Pick-to: 6.6 6.5
Fixes: QTBUG-119797
Task-number: QTBUG-118667
Change-Id: I713a3cda6a4d14bb3dea374b40d8e8219278e5db
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I4cfb8e86dd9a305ff47df672ebf8637c64418fd0
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Found a problem on GCC 9.4 where asan/ubsan seems to break
std::numeric_limits<int128>::min():
runtime error: negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself
This is the -i _after_ we've already checked for ::min() two lines
above. It works with Q_INT128_MIN, though, so use that.
Pick-to: 6.6
Change-Id: I778980baf4e7eea9f8de06697d792241314acacd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QComboBox implicitly selects the first item that gets inserted into the
model. This happens in response to the model's rowInserted signal, at
which point the item view might not have handled the rowInserted signal
yet. Because of that, the view couldn't update the accessibility bridge,
so informing accessibility about a row being selected that doens't exist
in the bridge's representation of the table yet will result in data
being out of sync, and depending on the bridge implementation trigger
asserts.
Fix this by explicitly updating the accessibility bridge before
implicitly selecting the first row.
Fixes: QTBUG-119526
Fixes: QTBUG-118585
Pick-to: 6.6 6.5
Change-Id: I2830c00751b3f18feb5d9252b23823c80229fed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Do not use rounded value for conversion, which gives inaccurate result.
Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi,
the old code was using rounded point value of 8, which produces an
incorrect result:
8 / (72.0 / 600) = 67 pixels
The correct margin is of course:
8.4 / (72.0 / 600) = 70 pixels
Pick-to: 6.6
Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This update addresses an issue in converting page size from points to
device pixels. Previously, rounding the result could lead to an
overflow beyond the physical pixel capacity.
Example case: A4 paper size at 600 dpi:
- points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667
However, the physical pixel height for an HP printer:
- GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016
This fix prevents pixel size from exceeding the physical print area,
avoiding unprinted pixels.
Pick-to: 6.6
Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
This patch corrects the miscalculation in point unit conversion,
ensuring correct margin updates.
Previously, non-pt units were rounded to two decimal places. When
converting back to pt, rounding was to zero decimals, making the result
always less than the original. This could result in margins falling
below the minimum allowed.
Example:
original_points = 8.4
multiplier = 2.83464566929
mm: qRound(8.4 / multiplier * 100) / 100 = 2.96
new_points: qRound(2.96 * multiplier) = 8 // wrong!
The fix rounds back-converted values up to two decimals, ensuring they
are never less than the original and thus stay above minimum margins.
new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4
Also, remove unused function qt_convertPoint.
Pick-to: 6.6
Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8
Reviewed-by: David Faure <david.faure@kdab.com>
... so QDebug e.g. stringyifies it automatically.
Requires making QNetworkRequest a Q_GADGET.
Task-number: QTBUG-114647
Change-Id: Idb4f3ecd98f79c1e28596c7be763898aba4b6562
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
[ChangeLog][QtGui][QKeySequence] Ctrl+Shift+S is now the standard
shortcut for Save As... on every platform.
Fixes: QTBUG-72916
Change-Id: Ic1815646651573c07994c4cd9df8f658e4a806b6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
As opposed to QTest::qWaitForWindowActive, which checks if the window
is active, which is not a guarantee that the window has focus.
Task-number: QTBUG-119287
Change-Id: I9fe65b0474095389f6518ebaaf07c71143b6f459
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of introducing the nested class InheritsQUntypedPropertyData
as a sentinel class for inheritance check, we can use BinaryTypeTrait
to handle the check. By doing this, we no longer need to maintain the
nested class.
Change-Id: Ie3aae976015d5fae6b6d072cad6ee52cd30b769d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
GCC at some point decided that it wouldn't include the full namespace
expansion in __PRETTY_FUNCTION__ for any type that is in the same
namespace as the template function being expanded (that is, the
QtPrivate) namespace. I don't know how long this behavior has been in
place, but it can be seen with GCC 13, where the expansion of that macro
inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is:
constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex]
This can be easily worked around by using a different namespace.
Fixes: QTBUG-119650
Pick-to: 6.6 6.5 6.2
Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
qfloat16 implemented comparison with int, but not with other integral
types. As a result, comparing qfloat16 vs qint64 or short was
ambiguous, because the compiler had (at least) two options:
* qint64 -> int
* qint64 -> float
Fix it by explicitly introducing comparison operators for other integral
types.
Use the new compare helper macros for that, and implement helper methods
as templates restricted on integral types.
Note that we have to manually extend the std::is_integral type trait
because libstdc++ only treats __{u}int128_t types as integral when
compiling in -std=gnu++XX mode, and we compile Qt in -std=c++XX mode.
Fixes: QTBUG-117637
Change-Id: Id0c074af1e9ccc2c2492eb2cc4ee62a4a7131b07
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This replaces all the other helper macros which were used to
generate the relational operators before, and also gains support for
operator<=>() in C++20 mode.
Change-Id: I40cec3cb5a5c42523787414d610e00afe6fc86f8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
[ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and
QWaylandWindow native interfaces are now available on QScreen to
provide a handle to the underlying platform screen.
Task-number: QTBUG-113795
Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Amend f54393ba70 by trying more font file
candidates, and don't try to download fonts if the query is pointing at
a resource.
Change-Id: I3fffc6fb3faa45b95540ebdf6cdf8ee4a49ebd78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The layout is a ViewGroup, and should be created in the Android UI
thread, while for ease of use on C++ side we should be able to
construct the Java object in the platform window constructor to
avoid later calls not having a valid object reference. Trying to
make a blocking call to Android thread from Qt thread can lead to
dead locks, so move only the creation of the layout itself into
Android thread, making the QtWindow a wrapper for it, which we can
immediately return to C++/Qt thread. Most of the calls made to
QtWindow are anyway already passed to the Android UI thread.
As a drive by, add a missing QtNative.runAction() to
bringChildToFront().
Change-Id: Ib2495ddda8267384656557cbe40be5da869f82c3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Update the manual test case for embedded windows to have
native window on Android.
There are still some sharp corners, for example:
* The windows are implemented with SurfaceViews, which makes
z-ordering with multiple of them a bit tricky. The Surfaces
they instantiate are basically z-ordered to either be below
everything, with a hole punched in the window, or on top of
everything, with the Surfaces created later on top of the
ones created earlier. Also, with the foreign views it looks
like the native view is on top of the Surface, because it
is created later. And since the child windows create their
Surfaces before the parent, they would be behind the parent
window, currently circumventing this with letting the
parent be z-ordered behind everything, and the children
on top of everything. A follow up commit addresses this by
changing the native view class to TextureView when multiple
windows are present.
* Parent window always gets the touch events - fixed in
a follow up commit
* If a child window has a text edit, it does not receive
focus when clicking on it
Task-number: QTBUG-116187
Change-Id: I32188ec5e3d3fce9fd8e3a931e317d1e081f691c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Each QAndroidPlatformWindow has its own QtLayout,
instead of one for the whole app/screen. This paves the
way for addition of child windows.
Task-number: QTBUG-116187
Change-Id: I36c68cea1a5f27ded3696bcfc2fbc04d9a8ce79e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
To avoid any potential resizes during append looping
Task-number: QTBUG-119002
Change-Id: I8f4c391f05b5c5bd0b48a4f17b11996652006508
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It is somewhat common HTTP method with RESTful use cases
(partial updates on resources)
Task-number: QTBUG-114637
Change-Id: Id252d3f4b54c3ebb8df5c93259e64a4af2d0ca2f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Added to both QNetworkRequestFactory and QRestAccessManager
Task-number: QTBUG-114717
Change-Id: Ibca55bba548a034a0da7ea60550642c150b63dc2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>