Revert "Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS"
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 1c0a56a2f3300750978f2d6c703b2b917e03e718. Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
cb51ab41e8
commit
4cc84dc31c
@ -540,10 +540,8 @@ static const char scaleFactorProperty[] = "_q_scaleFactor";
|
|||||||
/*
|
/*
|
||||||
Sets a per-screen scale factor.
|
Sets a per-screen scale factor.
|
||||||
*/
|
*/
|
||||||
void QHighDpiScaling::setScreenFactor(QScreen *screen, qreal rawFactor)
|
void QHighDpiScaling::setScreenFactor(QScreen *screen, qreal factor)
|
||||||
{
|
{
|
||||||
qreal factor = roundScaleFactor(rawFactor);
|
|
||||||
|
|
||||||
if (!qFuzzyCompare(factor, qreal(1))) {
|
if (!qFuzzyCompare(factor, qreal(1))) {
|
||||||
m_screenFactorSet = true;
|
m_screenFactorSet = true;
|
||||||
m_active = true;
|
m_active = true;
|
||||||
|
@ -313,10 +313,9 @@ void tst_QHighDpi::environment_QT_SCREEN_SCALE_FACTORS()
|
|||||||
QFETCH(QByteArray, environment);
|
QFETCH(QByteArray, environment);
|
||||||
QFETCH(QList<qreal>, expectedDprValues);
|
QFETCH(QList<qreal>, expectedDprValues);
|
||||||
|
|
||||||
qputenv("QT_SCREEN_SCALE_FACTORS", environment);
|
|
||||||
|
|
||||||
// Verify that setting QT_SCREEN_SCALE_FACTORS overrides the from-platform-screen-DPI DPR.
|
// Verify that setting QT_SCREEN_SCALE_FACTORS overrides the from-platform-screen-DPI DPR.
|
||||||
{
|
{
|
||||||
|
qputenv("QT_SCREEN_SCALE_FACTORS", environment);
|
||||||
std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(platformScreenDpi));
|
std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(platformScreenDpi));
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (QScreen *screen : app->screens()) {
|
for (QScreen *screen : app->screens()) {
|
||||||
@ -328,18 +327,6 @@ void tst_QHighDpi::environment_QT_SCREEN_SCALE_FACTORS()
|
|||||||
QCOMPARE(window.devicePixelRatio(), expextedDpr);
|
QCOMPARE(window.devicePixelRatio(), expextedDpr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that setHighDpiScaleFactorRoundingPolicy applies to QT_SCREEN_SCALE_FACTORS as well
|
|
||||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
|
||||||
{
|
|
||||||
std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(platformScreenDpi));
|
|
||||||
int i = 0;
|
|
||||||
for (QScreen *screen : app->screens()) {
|
|
||||||
qreal expectedRounderDpr = qRound(expectedDprValues[i++]);
|
|
||||||
qreal windowDpr = QWindow(screen).devicePixelRatio();
|
|
||||||
QCOMPARE(windowDpr, expectedRounderDpr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QHighDpi::environment_QT_USE_PHYSICAL_DPI()
|
void tst_QHighDpi::environment_QT_USE_PHYSICAL_DPI()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user