diff options
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c362530264..143293b589 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1283,10 +1283,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) } - static int paintOnScreenEnv = -1; - if (paintOnScreenEnv == -1) - paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0; - if (paintOnScreenEnv == 1) + static const bool paintOnScreenEnv = qEnvironmentVariableIntValue("QT_ONSCREEN_PAINT") > 0; + if (paintOnScreenEnv) setAttribute(Qt::WA_PaintOnScreen); if (QApplicationPrivate::testAttribute(Qt::AA_NativeWindows)) @@ -2112,7 +2110,7 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt bool alsoNonOpaque) const { Q_Q(const QWidget); - static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); + static int disableSubtractOpaqueSiblings = qEnvironmentVariableIntValue("QT_NO_SUBTRACTOPAQUESIBLINGS"); if (disableSubtractOpaqueSiblings || q->isWindow()) return; @@ -12579,13 +12577,10 @@ int QWidget::metric(PaintDeviceMetric m) const QWindow *topLevelWindow = 0; QScreen *screen = 0; - if (QWidget *topLevel = window()) + if (QWidget *topLevel = window()) { topLevelWindow = topLevel->windowHandle(); - - if (topLevelWindow) { - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(topLevelWindow); - if (platformScreen) - screen = platformScreen->screen(); + if (topLevelWindow) + screen = topLevelWindow->screen(); } if (!screen && QGuiApplication::primaryScreen()) screen = QGuiApplication::primaryScreen(); |