Created
November 22, 2023 11:34
-
-
Save torarnv/f3cdb8e3428af0e344f481e1b988fccb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git c/src/quick/items/qquickwindowcontainer.cpp i/src/quick/items/qquickwindowcontainer.cpp | |
index 0c3a6cf8258..245145f2b30 100644 | |
--- c/src/quick/items/qquickwindowcontainer.cpp | |
+++ i/src/quick/items/qquickwindowcontainer.cpp | |
@@ -443,6 +443,28 @@ void QQuickWindowContainer::updatePolish() | |
} | |
} | |
+QRectF QQuickWindowContainer::clipRect() const | |
+{ | |
+ Q_D(const QQuickWindowContainer); | |
+ QRectF rect = boundingRect(); | |
+ | |
+ for (auto *viewport = viewportItem(); viewport; viewport = viewport->viewportItem()) { | |
+ if (viewport == this) | |
+ break; | |
+ | |
+ if (viewport->flags().testFlag(QQuickItem::ItemClipsChildrenToShape)) { | |
+ // FIXME: This fails to take into account viewports that override clipRect() | |
+ const auto mappedViewportRect = mapRectFromItem(viewport, viewport->boundingRect()); | |
+ rect = mappedViewportRect.intersected(ret); | |
+ } | |
+ | |
+ if (viewport->viewportItem() == viewport) | |
+ break; // Content item returns itself as viewport | |
+ } | |
+ | |
+ return rect; | |
+} | |
+ | |
// ----------------------- Window updates ----------------------- | |
/* | |
diff --git c/src/quick/items/qquickwindowcontainer_p.h i/src/quick/items/qquickwindowcontainer_p.h | |
index af182ec7eeb..ed41390c7bc 100644 | |
--- c/src/quick/items/qquickwindowcontainer_p.h | |
+++ i/src/quick/items/qquickwindowcontainer_p.h | |
@@ -60,6 +60,8 @@ protected: | |
bool eventFilter(QObject *object, QEvent *event) override; | |
+ QRectF clipRect() const override; | |
+ | |
private: | |
Q_DECLARE_PRIVATE(QQuickWindowContainer) | |
friend class QQuickWindowQmlImpl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment