Commit Graph

48654 Commits

Author SHA1 Message Date
Shawn Rutledge
0e5bbf3507 Make QEvent::setAccepted() virtual; set QEventPoints state the same
In Qt Quick, when we deliver an item-specific QTouchEvent that contains
only the subset of eventpoints that are inside the Item's bounds,
traditionally the Item can accept the event to tell the delivery logic
that the event is handled and doesn't need to be delivered further.
But an Item cannot be expected to have total scene awareness; so now,
the delivery is "done" only when all eventpoints in the original event
are accepted.  This behavior has been working well enough already due to
logic in QQuickWindow that iterates the points and accepts them if the
event is accepted; but it seems appropriate to move this enforcement
into QPointerEvent itself.  Making setAccepted() virtual gives us a
useful degree of freedom.

Event-handling code should alternatively use QEventPoint:setAccepted()
or QPointerEvent::setExclusiveGrabber() to take resonsibility for only
a subset of the touchpoints.

Another way to put it is that we treat QPointerEvent::setAccepted() as a
convenience method: accepting the QEventPoints is what counts (at least
in Qt Quick).

Change-Id: Icec42dc980f407bb5116f5c0852c051a4521105a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-22 04:54:17 +00:00
Volker Hilsheimer
3310e13a17 Don't show QPushButton as hovered unless the mouse is within the bevel
Previous fixes made QPushButton correctly respect the style sheet boxing
model (as it's documented to do), ignoring clicks that were within the
margin area of the button (ie outside the bevel). However, a hover state
selector in the style sheet would still be used for the entire widget.

Turn on mouse tracking for widgets that have a hover state selector, and
handle mouseMoveEvent to set an explicit hovered state only when the mouse
hits the button. Use that state to initialize the style option.

Fixes: QTBUG-87706
Change-Id: I2f423b760c85cfab9faac4be44a5c7dcf2ba1c23
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-10-22 02:43:40 +02:00
Volker Hilsheimer
875a7fad52 Fix a bunch of compiler warnings in event handling test cases
Leave the normalizedPos warnings, there is no equivalent function.

Change-Id: I50c72ab24b4855e36941aafdee30cdb0e94c1684
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-22 02:43:26 +02:00
Volker Hilsheimer
34943a6f70 Turn warning about missing xcodebuild into notice
On a mac that can build all of Qt with CMake, Ninja, and command line tools,
there should be no warning just because a build tool that
won't get used is not available.

Turn the warning into an informative message instead so that IDE
integrations (such as VSCode's CMake integration) don't flag warnings.

Change-Id: I250c0e5dd0633b36ff2b690a52ba7ce3ceb22218
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-22 02:43:17 +02:00
Andreas Buhr
dd0647b17a Fix to make g++-10.2 happy
g++-10.2 fails to compile qregion.cpp in RelWithDebInfo configuration,
with error message:
qregion.cpp:3617:12: error: ‘ET.EdgeTable::ymax’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
g++ is right here, for Count==1, 'ET' is not initialized but used.
This patch fixes this by Q_ASSUMEing Count > 1.

Pick-to: 5.15
Change-Id: I3b9f1f58de9f3811c60640a08334487e3f8f2b23
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-22 01:23:46 +02:00
Giuseppe D'Angelo
5d4c0accc1 QList docs: fix signature of removeAll
Change-Id: Ic52b6d9ab4b250dc931c650c6def35c18803ba43
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-22 00:51:40 +02:00
Andreas Buhr
5872a89474 name our glib event sources to ease debugging
glib event sources can have a name, but it is not required.
Internal to glib, it is common to give them a name, see for example
https://git.io/JTZ8g .
This patch gives a name to each glib event source created in qtbase.

Task-number: QTBUG-84291
Change-Id: I4f04526dcec082242312e3a66da2adf37a22e626
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-22 00:51:26 +02:00
Allan Sandfeld Jensen
ff776a3059 Whitespace cleanup in corelib/global
Change-Id: I087d7d949cfd43e48e8a008621a4eeaa9d104ceb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 21:15:17 +02:00
Tor Arne Vestbø
33617c03a4 cmake: Sync FbSupport module name with pro file
Change-Id: I5374618a34811d516eb8fd12c1429b851fd108c4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-21 17:56:48 +02:00
Andrei Golubev
a17e05bf20 Fix strange capacity check in tst_QString::append_special_cases
We cannot rely on "QString a; a.insert(0, u'A');" to give
a.capacity() >= 3, this is clearly an implementation detail. Changed
the check to a meaningful one

Task-number: QTBUG-87416
Change-Id: I2e017c1292d360e32b85b903361027485c08ea74
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 17:56:48 +02:00
Edward Welbourne
e69b81101c Fix locale look-up when language is unspecified
Looking up a locale with unspecified language got the C locale, due to
taking a short-cut that would make sense if no locale were found for a
specified language. Stop assuming the language was specified.

Task-number: QTBUG-74287
Pick-to: 5.15 5.12
Change-Id: I8b3c232da584fb187ebb6c190729c377d0083808
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-21 17:56:48 +02:00
Helio Chissini de Castro
c67ea659e5 Fix compilation when using -no-mimetype-database
Change-Id: I4f706a26d73f61e4a6022338e0fc0be48627e4a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2020-10-21 13:26:20 +00:00
Allan Sandfeld Jensen
f7f1a71ea4 Make QPoint*, QSize*, and QRect* binary operators hidden friends
Moves them to class scope, which will avoid them showing up as
possibilities in error messages for missing operators.

Also consolidates how they are compared, so QRectF and QSizeF act
similar to QPointF.

Change-Id: I1e12cb7e5a5c65e85c32281878da03c6136c17de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-21 10:52:39 +00:00
Stanislav Yelenskiy
b39b018f4a QTabBar: update index of last visible tab in insertTab
Index of the last visible tab was not updated, if a new tab was inserted
after the current tab and before the last tab.

When the new tab is inserted before the last visible tab, the index of
the last tab increments by one.
When the new tab is inserted after the last visible tab, then the newly
inserted tab becomes the last visible.

Fixes: QTBUG-86898
Change-Id: I2f4b7f705261ec35a5aa7b883ecdddba25f007b7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-21 07:19:36 +00:00
Stanislav Yelenskiy
9f9275f82f QTabBar test: refactor: extract checkPositions helper function
Extract checkPositions helper function to re-use in the new test.


Task-number: QTBUG-86898
Change-Id: I5c8241b5701cd8c8c3e21607c385217d4b75e728
Reviewed-by: Jordi Pujol Foyo <jordi@vikingsoftware.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-10-21 07:18:28 +00:00
Piotr Mikolajczyk
a02ea26b46 [Android] Make sure expose events are emitted after window resize
Expose event would not be sent when window was resized

Fixes: QTBUG-69155
Pick-to: 5.15
Change-Id: I81bf2d54f830a0dabf15398e1f25b55ff7ff4479
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2020-10-21 07:08:54 +00:00
Allan Sandfeld Jensen
1be271713e Whitespace cleanup in corelib/ mimetypes, plugin and thread
Done with selective application of clang-format

Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 08:53:38 +02:00
Jan Grulich
3e09ac369d OpenFile portal: use "writable" option to specify our FD is writable
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>
2020-10-21 08:38:15 +02:00
Jan Arve Sæther
2a5afb88db Do not crash if QPA plugin does not support cursors
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>
2020-10-21 08:37:15 +02:00
Allan Sandfeld Jensen
05685708b7 Whitespace cleanup in corelib/tools
Change-Id: Ibe796c398a8e5488b7203abb07aa54740744f1ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 08:26:38 +02:00
Shawn Rutledge
9aba868571 QEvent copy constructor: copy the type flags too
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>
2020-10-21 08:22:36 +02:00
Thiago Macieira
21d3916817 QRandomGenerator: add 64-bit bounded() versions
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>
2020-10-20 22:45:06 -07:00
Volker Hilsheimer
74bf2cd21d Fix compiler warning from uninitialized members
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>
2020-10-21 07:43:51 +02:00
Friedemann Kleint
97c3266c6f Auto tests: Fix some MSVC warnings about integer conversions
Change-Id: Ibab8028ccdb9a4b02cadc6d2e85e8a0472f0d96f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 07:31:27 +02:00
Volker Hilsheimer
43738cfdaf Fix qdoc warnings from QMutex and QMutexLocker
Change-Id: I25faab16ad2df3682e6c6b55d4aaff1c20402995
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 07:31:26 +02:00
Volker Hilsheimer
58060e7b6b Fix qdoc warnings in QtDBus
And remove the limitation to 8 types from the documentation.

Change-Id: I92c67368e53d69fd851886c621f3f894f638bae9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-21 07:31:26 +02:00
Allan Sandfeld Jensen
b6cd3bca28 Whitespace cleanup in corelib/io
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>
2020-10-20 21:09:00 +02:00
Joerg Bornemann
80a2878e20 CMake: Fix additional target info files
...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>
2020-10-20 20:59:21 +02:00
Volker Hilsheimer
f1af51fd81 Add forwarding headers for classes moved from QtWidgets to QtGui
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>
2020-10-20 19:27:04 +02:00
Andrei Golubev
301ed73487 Convert QList alias definitions to 'using'
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>
2020-10-20 19:22:16 +02:00
Andrei Golubev
bf73495a66 Fix QDoc warnings for QList/QVector
Task-number: QTBUG-86553
Change-Id: Iac944c78640bfcfb6ee137c0ef3dd89387700b4c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-20 19:22:12 +02:00
Friedemann Kleint
8ba59441fc Windows QPA/WmPointer: Register tablet devices of pointer handler
Task-number: QTBUG-46412
Change-Id: Ib9b5fd6056a5474ce46c7bde53be7a12c1494611
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-20 19:21:50 +02:00
Friedemann Kleint
abb5f0d376 Windows QPA/wintab: Register tablet devices
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>
2020-10-20 17:21:18 +00:00
Allan Sandfeld Jensen
e8873003f0 Fix crash in tst_QSystemTrayIcon::lastWindowClosed()
Handle null QIcons. Note this was already fixed in 5.15 separately,
see 6c8adfaf5d.

Fixes: QTBUG-87729
Change-Id: Ia759fbe95fafcea9451d393dc1aa077f5651919b
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-10-20 16:45:15 +00:00
Tor Arne Vestbø
bb71abdfbd QWindowsXPStyle: Remove unused variables
Change-Id: Ide3880114bf8d779571b7cf1235ae95524950e5d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-20 15:12:44 +00:00
Tor Arne Vestbø
4ad464461f Fix linking of non-console application on mingw
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>
2020-10-20 17:12:44 +02:00
Werner Lemberg
0948846b42 CVE-2020-15999: Heap buffer overflow in freetype
Manual cherry-pick of fix in freetype:
Fix heap buffer overflow (#59308).

This is CVE-2020-15999.

* src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier.

Pick-to: 5.15 5.12.10
Change-Id: I23824074f134802b3e4f737877d144b59e6b8151
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-10-20 10:43:10 +00:00
Edward Welbourne
5e43997a70 Use qmetaobject_p.h's MetaObjectFlag in QMetaObjectBuilder
This saves duplicating them with its own flags.

Task-number: QTBUG-85700
Change-Id: I9e938322fd787282cfd9f941f83af8c0d76aaa9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-20 12:03:44 +02:00
Jerome Pasion
0ce1865ffa Add link to Qt for Python as external page
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>
2020-10-20 11:30:35 +02:00
Edward Welbourne
83cae7c9e3 Drop constexpr from QAtomicTraits::isLockFree()
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>
2020-10-20 10:49:30 +02:00
Giuseppe D'Angelo
141fae112a QList::removeOne: make it generic as well
Change-Id: I0c50b2ae76f9d0f053b3d5b1ab98d12e0524e419
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-20 09:32:24 +02:00
Giuseppe D'Angelo
3c74ba1f8b QList::removeAll: make it generic
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>
2020-10-20 09:32:22 +02:00
Shawn Rutledge
5683c0afda Add QSinglePointEvent::exclusivePointGrabber convenience property
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>
2020-10-20 09:17:35 +02:00
Joerg Bornemann
6089888d1d Make configure -qmake actually work
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>
2020-10-20 09:16:27 +02:00
Eskil Abrahamsen Blomfeldt
dc6c263667 Fix output with box font engine
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>
2020-10-20 07:40:12 +02:00
Morten Johan Sørvig
ed43f89f8d Update QHighDpiScaling internal documentation
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>
2020-10-20 07:27:10 +02:00
Morten Johan Sørvig
3df2448f63 Merge existing tst_qhighdpiscaling into tst_qhgihdpi
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>
2020-10-20 07:27:04 +02:00
Morten Johan Sørvig
d023da8639 Add high-dpi auto test
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>
2020-10-20 07:26:57 +02:00
Morten Johan Sørvig
f4a66e5c4c QPA offscreen: make platform plugin configurable
Add ability to load a json config file containing screen
configuration at startup. The config file location
is specified using platform options:

    -platform offscfreen:configfile=/path/to/file

Config file format example:
{
    “screens”: [
        {
        "name", "screen-1",
        "x", 0,
        "y", 0,
        "width", 640,
        "height", 480,
        "dpi", 96,
        "dpr", 1,
        },
        …
    ]
}

Change-Id: Iac21aaafa6d0f361bdd6f6e9168b7e68db6ae011
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-20 07:26:46 +02:00
Morten Johan Sørvig
0ab89881c5 high-dpi: Re-implement mapToGlobal and mapFromGlobal
(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>
2020-10-20 07:26:38 +02:00