diff options
Diffstat (limited to 'src/widgets/widgets/qeffects.cpp')
-rw-r--r-- | src/widgets/widgets/qeffects.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index 5cb8bb3c50..1f2d3517e8 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -54,6 +54,15 @@ QT_BEGIN_NAMESPACE +static QWidget *effectParent(const QWidget* w) +{ + const int screenNumber = w ? QGuiApplication::screens().indexOf(w->screen()) : 0; + QT_WARNING_PUSH // ### Qt 6: Find a replacement for QDesktopWidget::screen() + QT_WARNING_DISABLE_DEPRECATED + return QApplication::desktop()->screen(screenNumber); + QT_WARNING_POP +} + /* Internal class QAlphaWidget. @@ -98,12 +107,9 @@ static QAlphaWidget* q_blend = nullptr; /* Constructs a QAlphaWidget. */ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED // ### Qt 6: Find a replacement for QDesktopWidget::screen() QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) - : QWidget(QApplication::desktop()->screen(QDesktopWidgetPrivate::screenNumber(w)), f) + : QWidget(effectParent(w), f) { -QT_WARNING_POP #ifndef Q_OS_WIN setEnabled(false); #endif @@ -383,7 +389,7 @@ static QRollEffect* q_roll = nullptr; Construct a QRollEffect widget. */ QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient) - : QWidget(nullptr, f), orientation(orient) + : QWidget(effectParent(w), f), orientation(orient) { #ifndef Q_OS_WIN setEnabled(false); |