When using OpenFile portal and passing a file descriptor, we open the
file with qt_safe_open() which by defaults make the file descriptor
writable. However we didn't specify in options that the FD is writable
which leads into rejection on xdg-desktop-portal side as there is a
mismatch between writable FD and read-only request.
Pick-to: 5.15
Change-Id: I7a430339a9615f0a054e777e0f3de56e219d1706
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This was the case on Android, and caused a crash
Fixes: QTBUG-83916
Pick-to: 5.15
Change-Id: Iabc17237498091d815241730a2b14ece5a45d0b9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Failure to copy m_inputEvent and m_pointerEvent actually left them
uninitialized, and resulted in random behavior in Qt Quick when
Flickable clones a pointer event for later replay.
Remove the comment about copying events being a "bad idea" in Qt 4,
while we're at it. Copying became more common in Qt 5, and we
probably won't be able to stop doing it now.
Change-Id: I40b6ba5ad696e7aaafbeefbca86eca00cab40616
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unlike the 32-bit version, we can't go to a bigger integer type to do
the multiplication with. So instead accept looping. Both libstdc++ and
libc++ implement std::uniform_int_distribution this way anyway, but in a
far more complex way.
There is no looping if the "highest" is a power of two. The worst-case
scenario is when "highest" is one past a power of two (like 65). In that
case, we'll loop until the number is in range. Since all bits have equal
probability of being zero or one, there's a 50-50 chance that the most
significant useful bit will be set[*], in which case we'll need to loop
and we again get the same probability. So on average, we only need two
iterations to get an acceptable result.
[*] There's also a possibility that the other bits are such that the
number is still in range. For 65, we'd need the other 5 bits to be zero
(64 is a valid result), but the probability of that is only 1/2^5 =
3.125%. The bigger "highest" is, the closer we get to zero, so
approximate by saying that never happens and instead calculate that the
most significant useful bit is the controlling one.
[ChangeLog][QtCore][QRandomGenerator] Added 64-bit versions of the
bounded() functions. They are useful in conjunction with Qt 6's 64-bit
container sizes, so code that used to call bounded(list.size()) in Qt 5
will continue to compile and work in Qt 6.
Fixes: QTBUG-86318
Change-Id: I3eb349b832c14610895efffd16356927fe78fd02
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When building tst_qmetatype.cpp, clang generates the warning that
class 'AlignmentDummy' does not declare any constructor to initialize
its non-modifiable members
Turn the class into a struct, which doesn't generate such warnings.
Change-Id: I61013a10418238a11824b18ff1e927bbafa46ec2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And remove the limitation to 8 types from the documentation.
Change-Id: I92c67368e53d69fd851886c621f3f894f638bae9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Selective application of clang-format to follow our coding style where
it is significantly off.
Change-Id: I0ff4ed146fe53922691d5473d0c236f31d478a04
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
...for QT_BUILD_TOOLS_WHEN_CROSSCOMPILING.
qt_internal_export_additional_targets_file now gets two lists of target
names when run from qt_export_tools:
- TARGETS containing actually existing targets, and
- TARGET_EXPORT_NAMES containing the target names as they appear in the
additional target info file.
Operations that require actual targets are run on the TARGETS, in the
additional target info file only TARGET_EXPORT_NAMES are written.
This distinction is required for the case where the host Qt lacks a
tool that is built in the target Qt.
Example: host Qt is built with DEVELOPER_BUILD=OFF, target Qt is built
with DEVELOPER_BUILD=ON. Then the host Qt lacks qmljs, but it is built
in the target Qt. TARGETS contains qmljs_native, and
TARGET_EXPORT_NAMES contains qmljs.
Fixes: QTBUG-87693
Change-Id: I615aed996bfcbe654274defcda8c1cb2cc4b7b4e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
block is added to avoid warnings from the build system's sanity
check.
As a drive-by, fix the include guards in the QtGui/QActionGroup header.
Change-Id: Ie10e7830c3b00a3548123f58498def49b194c7aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Modern syntax for type aliases looks much nicer and is easier to read.
Additionally, QDoc is able to generate better documentation for 'using'
based aliases. Also, aliases are simplified for QDoc
Task-number: QTBUG-86553
Change-Id: I44932fbd94f32c1463eafedd1b48c1e840b697e3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Inherit a class from QPointingDevice with a shared pointer
to the data for a physical cursor.
As a drive-by, keep the event time in QWindowsTabletSupport
for leave proximity events that do not have a time associated.
The previous code was relying on QWindowSystemInterface for
this, which may be at odds with the tablet's time.
Refactor and streamline the code a bit.
Task-number: QTBUG-46412
Change-Id: I2f4fab25a49a9d9f1befbd7fc040e8eb23be71ff
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
As a result of b5af140809 the link dependency to the
mingw32 static library was ordered after the entrypoint
library, which resulted in the WinMain symbol not being
found during linking due to how the static linker processes
archives.
Fixes: QTBUG-87725
Change-Id: I8e075f91f7f06dcdc618a4e0ae6d9c1d832888c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This saves duplicating them with its own flags.
Task-number: QTBUG-85700
Change-Id: I9e938322fd787282cfd9f941f83af8c0d76aaa9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Qt for Python can be linked with \externalpage QDoc command
Task-number: QTBUG-87158
Change-Id: I68acc028f89af09cbd069e098a0fbbfa72234cdc
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
As requested by a ### Qt 6 comment. This then implied a few other
functions weren't constexpr, which broke some tests.
Task-number: QTBUG-85700
Change-Id: I6522a9b2d7a74e117442121400a1d7198d323967
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a bit more tricky than expected because we support passing
references to objects that are into the list itself (for instance,
list.removeAll(list.front())). For those objects we have to take
copies. This is fine, but the moment we make the function generic,
that's going to fail when passing arguments of types that cannot
be copied, such as arrays (e.g. stringList.removeAll("hello")).
For those, keep a reference, as they cannot be aliases into the
list anyhow.
[ChangeLog][QtCore][QList] The removeAll and removeOne methods
now take an object of any datatype -- and not just the
list's own value type. This allows for heterogenous removal inside
QLists.
Change-Id: I0c447770bbc7ff0ff4bb4c0e35081414c5ff963e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since a single-point event (such as a QMouseEvent) only carries one
point, it only has one grabber, so we can have a normal Q_PROPERTY.
It's named exclusivePointGrabber to avoid shadowing the
QPointerEvent::[set]exclusiveGrabber functions that take QEventPoint&.
Change-Id: Ie18f1c1849ed057b98f229de7b17b7fc3f3eea36
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We need to ignore this option in qt_configure.prf.
This amends 077ea0c633.
Task-number: QTBUG-87049
Change-Id: If05b16a95d0830df9ca63961576981f8983820cc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
The box font engine was passing in alpha values in the blue
channel instead of alpha channel to QImage::setPixel(), probably
assuming that setPixel() accepts the input in the format of the
QImage. But the whole point of setPixel() is that it converts
the input. If we just want to set the alpha value, we can do
it directly on the QImage::bits().
[ChangeLog][Text] Fixed showing boxes for glyphs when there are
no fonts available in the font database.
Pick-to: 5.15
Change-Id: I7ae067c26b9ecba6aaa046e7e4b9ae520c4b3d23
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Document new conversion functions and how the new
public API (rounding) effects QHighDpiScaling operation.
Change-Id: I801fc065cdb4904811a009510b08cac630b83fe7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Move the factor() test, drop scale() which should be
covered already.
Change-Id: Id2079536a91c7e9f7199960bdf6b33489d0a6670
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Use the new screen config feature of the offscreen
platform plugin to run tests on virtual screen setup.
This has the benefit that we can auto-test the QHighDpiScaling
implementation (as well as its usage in QtGui) on any platform
with a fixed mock screen setup which does not rely on physical
screen configuration.
Test the following configurations:
- three screens: 96 DPI. (reference)
- three screens: 192 DPI
- three screens: mixed (high) DPI
Change-Id: I2fac889d896cf30ab2a79c306cee22177ad8f4ac
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(This code is required to handle corner cases such as a QWindow
covering multiple screens, where the normal code path does not
give correct results.)
Move the map[to|from]Global implementation from qhighdpiscaling.cpp,
and implement it in terms of [to|from]NativeGlobalPosition. These
functions implement the required screenAt()-type searching.
The implementation strategy for both mapping functions is to first
map to the native coordinate system, perform the globalPos addition
or subtraction, and then map the result back to device independent
coordinates.
Task-number: QTBUG-81695
Change-Id: I44e9e68651634650964e839b1e564b50f434553f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Keep (requested) geometry and screen in sync, which
is required for correct high-dpi scaling. The platform
plugin can still override with new geometry (and screen),
as usual.
This has previously been fixed/worked around for QDialog,
see QTBUG-52735. That fix can now be removed in favor
of this change in QWindow.
Change-Id: Ieadb1bfee5fb966c5c2052e9daa5ba124a87f3cd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Add functions which scales window geometry:
framNativeWindowGeometry()
toNativeWindowGeometry()
These correctly handles top-level and child windows,
where top-level window positions scale around the screen
origin while child window positions scale around (0, 0).
Modify call cites to use the new functions. We no longer
need the isTopLevel checks at the call site.
Change-Id: I0158672d46a3f52dfc7d37d021fc5cebd7859200
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Add functions for scaling global coordinates:
toNativeGlobalPosition()
fromNativeGlobalPosition()
These correctly handle the cases where a window spans several
screens.
Change-Id: I268762499cd8d86a3c417342ddaf2fb6dab4dd20
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Implement support for using the screen at a given position
when determining the scale factor and origin.
Add QHighDpiScaling::screenForPosition(), which searches
for a screen at the specified device independent or native
coordinates. The function returns the QScreen or nullptr
if no screen was found.
Add QHighDpiScaling::Point, used for representing
an invalid, device independent, or native point.
Change-Id: I58e4e3eebb8cdd5171e59f97833a00e7f8d9ecd6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Make fromNativePixels() use QWindow:screen() for determining
which screen's scale factor to use, even if the point-to-be-scaled
is on a different screen.
We'll add API for handling the window-on-multiple-screens
case in subsequent commits.
Task-number: QTBUG-81695
Change-Id: Ib9f40a5a636b2487204c14301ad0190727dcf4ac
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
I'm not sure why this hasn't been flagged so far, probably
we don't have this warning enabled on MSVC.
Task-number: QTBUG-87713
Change-Id: I97c65079c8f8e439645ff7fe75eede9b01b26166
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This way we can actually modify the container. Previously the interface
was rather useless.
Change-Id: I278aae46999862ada115c9066a010d7de5cde4ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The high-level iterable interfaces should coerce the types of most
QVariants passed to the expected ones. To do this, move the type
coercion code into qvariant.{h|cpp} so that it is available to the
QVariantRef specializations.
The exception are variants passed to the find() functions of associative
iterables. Here, we should not coerce values we cannot convert to the
default-constructed keys. Instead we return end() in such cases.
Fixes: QTBUG-87687
Change-Id: I0bd4e5c4e4e270dd3bf36cb3fb115794828077f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It also makes it easier to find the definition when looking at the declaration.
Change-Id: Idae18d3881f3cf8ba6c6c7e48201ec925815013e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Clarify that the "minus sign" is a plain ASCII U+002D dash, not U+2212
minus sign; and, for symmetry, that the underscore is U+005F.
Change-Id: I7250959d36e56f960dac24a739a1a8826a6bc578
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
QString::toUpper() now insists we use its return, so the benchmark
won't compile unless we do so. Also document the helper macro used by
the tests, to explain why it's even there at all.
Change-Id: I830f121d92867bcd09277ecdeb1c764413b34fa6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It was always called in pairs, first with likely sub-tags added, then
with the base that started from. So doing a likely sub-tag lookup
inside the function was redundant for the former while making the
latter redundant - and it's needed.
Task-number: QTBUG-84669
Pick-to: 5.15
Change-Id: I18bf1d4976a51d9436efd20d1a84a36cfc60f618
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test macro's first three parameters were given a QLocale:: prefix
by the macro, but the last three weren't. Save uses of the macro the
need to repeat the prefix in all parameters, thereby making the test
cases easier to read. Also, we can compare enum values, rather than
casting them to int; and, when a test fails, reporting the enum name
is far more informative than reporting the integer that represents it.
Change-Id: Ib0360c51049333b4a00ea84e271c99db6724334f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>