Popup: resize the dimmer to match the overlay, not the window

The overlay adjusts its size based on the rotation, so it might have
different dimensions than the window. The dimmer should always cover the
entire overlay.

Task-number: QTBUG-115536
Change-Id: Ic9c73dcb3c9bb3e4e2ece281c8437a00961fc9b1
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit eb653882af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit af30efb07e)
This commit is contained in:
Volker Hilsheimer 2023-11-14 15:25:35 +01:00 committed by Qt Cherry-pick Bot
parent a4cc75c3bf
commit 07e269f62f
2 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickanimation_p.h>
#include <QtQuick/private/qquicktransition_p.h>
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
QT_BEGIN_NAMESPACE
@ -231,7 +232,9 @@ void QQuickDrawerPrivate::resizeOverlay()
if (!dimmer || !window)
return;
QRectF geometry(0, 0, window->width(), window->height());
const QQuickOverlay *overlay = QQuickOverlay::overlay(window);
QRectF geometry(0, 0, overlay ? overlay->width() : 0, overlay ? overlay->height() : 0);
if (edge == Qt::LeftEdge || edge == Qt::RightEdge) {
geometry.setY(popupItem->y());

View File

@ -933,8 +933,10 @@ void QQuickPopupPrivate::resizeOverlay()
if (!dimmer)
return;
qreal w = window ? window->width() : 0;
qreal h = window ? window->height() : 0;
const QQuickOverlay *overlay = QQuickOverlay::overlay(window);
qreal w = overlay ? overlay->width() : 0;
qreal h = overlay ? overlay->height() : 0;
dimmer->setSize(QSizeF(w, h));
}