Don't set margin on offscreen window if it has a parent

Offscreen platform had window frame margins set to 2 by default unless
Qt::FramelessWindowHint had been set. Margins must not be set to 2 if
the window has a parent. This change fixes two tests in
tst_QWindowContainer for offscreen platform.

Change-Id: Ib1577c301ea3a3b240bfa7c46ff12510dd2bcef0
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
bb10
Sami Nurmenniemi 2017-03-30 11:58:37 +03:00 committed by Paul Olav Tvete
parent c50f6a8329
commit 0624085b73
1 changed files with 5 additions and 2 deletions

View File

@ -157,10 +157,13 @@ QMargins QOffscreenWindow::frameMargins() const
void QOffscreenWindow::setFrameMarginsEnabled(bool enabled)
{
if (enabled && !(window()->flags() & Qt::FramelessWindowHint))
if (enabled
&& !(window()->flags() & Qt::FramelessWindowHint)
&& (parent() == nullptr)) {
m_margins = QMargins(2, 2, 2, 2);
else
} else {
m_margins = QMargins(0, 0, 0, 0);
}
}
void QOffscreenWindow::setWindowState(Qt::WindowState state)