Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I2ef59684cf297a0222a136ce7b5630037294d000
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We can expand the testing a bit bit verifying that also
created windows work as expected, and that QWindow DPR
is updated when Screen DPI is changed.
Change-Id: I082aac18b6b086c69c16681977b7eaa6c3e54ee0
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
QT_SCREEN_SCALE_FACTORS is in many cases set on behalf of the user,
instead of by the user, so we should apply the standard app
scale factor policies to it, instead of interpreting it
as a user override.
Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.
Users who want to override can set
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
to restore the default Qt rounding behavior.
[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.
Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: I936e96671fe2a0a43c3e8129f0768875cb011103
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The vast majority of in-tree users pass simple and short C string
literals as the value. By porting to QByteArrayView, we document that
we'll accept non-NUL-terminated data, and do the NUL-termination
internally, using SSO'ed std::string, saving memory allocations in the
common case of short strings.
I didn't bother to check which direction std::string takes for
nullptrs these days (there was a change accepted in that area for
C++20 or 23), so play it safe and protect against them.
Follow-up to
Task-number: QTBUG-105302
Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Unblock the qtdeclarative dependency update.
This behavior change is causing a regression for QQmlPreviewHandler's
zoom feature. Back out of the change for now, until we can find a way
to make both use cases work.
This reverts commit 1c0a56a2f3.
Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QT_SCREEN_SCALE_FACTORS in many cases set on behalf of the user,
instead of by the user, so we should make it less sharp and more
in line with standard high-dpi configuration.
Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.
Users who want to override can set
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
to restore the default Qt rounding behavior.
[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.
Pick-to: 6.4
Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: Ibb0aa5cb9d3a356d33429d0efe69d984b2530728
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Test setting both via QGuiApplication property and environment.
Change-Id: Iaccc920adb6294d610b02d4c844aa5b15eb7eecd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
setPos() takes a screen argument, however this argument
indicates which cursor should be moved only and is
not usable as an argument to toNativePixels() since
the position may be on a sibling screen.
Add call to QScreen::virtualSiblingAt to get the target
screen.
Task-number: QTBUG-99009
Pick-to: 6.3 6.2 5.15
Change-Id: I8714ebc93a283c58bc67911315f787c484fb0dd8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Export configuration() and setConfiguration() from the offscreen
platform plugin using QPlatformNativeInterface. tst_qighdpi can
then resolve and make use of them since it always uses the offscreen
platform plugin.
Add screenDpiChange() auto test.
Change-Id: I459b4df5d94ec4991234a346e3a94618cb3485e9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Currently, we test at 1x, 2x, and mixed typical desktop
DPI values. Add android DPI values, with scale factors
in the 2.5 - 3.75 range.
This test currently uses 96 as the base DPI (and so
does the Android platform plugin), so we normalize
the values to use that base DPI.
Change-Id: I25b66f5e16d37c01758d5623b805e4141247a74a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Test the name=factor format and various incorrect spec
strings. We expect that the screen DPI is used if the
scale factor specification is incorrect.
Change-Id: Ia990e70cf71e370dd2bb4b1047a101dfe9e59cb0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QHighDpiScaling has two init/update functions:
- initHighDpiScaling(): called once during QGuiApplication construction
- updateHighDpiScaling(): called whenever (relevant) screen configuration changes
Currently the calls to updateHighDpiScaling() are made from
multiple places including platform code. Simplify by calling
it from two locations:
- QWindowSystemInterface::handleScreenAdded()
- QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange()
Replace comment about early calls to qt_defaultDpi with a
test which calls qt_defaultDpiX/Y with no screens attached.
(Looking at the qt_defaultDpiX() implementation, it is unlikely
that there will be a problem as long as updateHighDpiScaling()
is called before QGuiApplication::primaryScreen() starts returning
a non-null value.)
Change-Id: I447db42894617495843a5cb531a1322b000fed62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Test that setting QT_USE_PHYSICAL_DPI uses physical
DPI instead of logical DPI.
Change-Id: I7f89cf1af5e013454cc3d8ec3559f2719514fea3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Add auto-tests for QT_SCALE_FACTOR and QT_SCREEN_SCALE_FACTORS
Change-Id: I57bffa266be910f2ba26cb1a870e09ae202fcae0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Avoid painting errors with dpr < 1, also for the PassThrough
mode.
This limits the minimum high-dpi scale factor to 1,
for the code path which determines the scale factor
based on screen DPI.
Pick-to: 6.1
Task-number: QTBUG-89948
Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Initialize the offscreen platform plugin with no screens,
create QGuiApplication object.
Not much of the high-dpi related Qt API can be used
in this configuration, but at least Qt should not crash
on startup.
Task-number: QTBUG-71034
Change-Id: I6620843c3bd8b692c5c2419b1ba290e16175ba5b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Android and Wasm do not build the offscreen platform
plugin (see src/plugins/platforms/CMakeLists.txt).
Skip building the tst_qhighdpi test as well in this
case. Remove the BLACKLIST entry.
Task-number: QTBUG-88505
Change-Id: I172198c8c24759b14f73ad07260c449fc6ab893f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Remove the qmake project files for most of Qt.
Leave the qmake project files for examples, because we still test those
in the CI to ensure qmake does not regress.
Also leave the qmake project files for utils and other minor parts that
lack CMake project files.
Task-number: QTBUG-88742
Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Complete search and replace of QtTest and QtTest/QtTest with QTest, as
QtTest includes the whole module. Replace all such instances with
correct header includes. See Jira task for more discussion.
Fixes: QTBUG-88831
Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44
Pick-to: 6.0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Ensure the values are reasonable regardless of screen DPI. Velocity
is supposed to be in logical pixels / second.
Task-number: QTBUG-88252
Task-number: QTBUG-88346
Change-Id: Ic209887f8ed0381c033a9ff04ae48b072c444df4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Tests in tst_qhighdpi are crashing on Android.
Task-number: QTBUG-88505
Task-number: QTBUG-87025
Change-Id: Ie1350e06fb30d90f20c550f91555f4023eee56b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@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>