diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qrhiwidget.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/widgets/kernel/qrhiwidget.cpp b/src/widgets/kernel/qrhiwidget.cpp index ca2d6b51a9..bf56263113 100644 --- a/src/widgets/kernel/qrhiwidget.cpp +++ b/src/widgets/kernel/qrhiwidget.cpp @@ -475,14 +475,7 @@ void QRhiWidgetPrivate::releaseResources() void QRhiWidgetPrivate::ensureRhi() { Q_Q(QRhiWidget); - // the QRhi and infrastructure belongs to the top-level widget, not to this widget - QWidget *tlw = q->window(); - QWidgetPrivate *wd = get(tlw); - - QRhi *currentRhi = nullptr; - if (QWidgetRepaintManager *repaintManager = wd->maybeRepaintManager()) - currentRhi = repaintManager->rhi(); - + QRhi *currentRhi = QWidgetPrivate::rhi(); if (currentRhi && currentRhi->backend() != QBackingStoreRhiSupport::apiToRhiBackend(config.api())) { qWarning("The top-level window is already using another graphics API for composition, " "'%s' is not compatible with this widget", diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 812c737633..81c6a6f7d8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1029,6 +1029,14 @@ void QWidgetPrivate::createRecursively() } } +QRhi *QWidgetPrivate::rhi() const +{ + if (QWidgetRepaintManager *repaintManager = maybeRepaintManager()) + return repaintManager->rhi(); + else + return nullptr; +} + /*! \internal Returns the closest parent widget that has a QWindow window handle diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 48461f8c74..b677a7eccb 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -221,6 +221,8 @@ public: void setSharedPainter(QPainter *painter); QWidgetRepaintManager *maybeRepaintManager() const; + QRhi *rhi() const; + enum class WindowHandleMode { Direct, Closest, |