From 5903d9276c3085ab891ff874dacf9597879221d6 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Fri, 24 Mar 2023 09:07:44 +0100 Subject: Compute initial size for assistant main window correctly Resizing to 4/5 of screen dimensions was previously followed by calling adjustSize(), which immediately overrides the size assigned to the minimum size that accommodates child widgets. Reversing the calls makes us both not start outside the screen as intended and sets the correct size of 4/5 of screen real estate. Fixes: QTBUG-112220 Change-Id: I7439ee35bb07f448372fbf2f3943475db7095ac5 Reviewed-by: Friedemann Kleint (cherry picked from commit e0dfb89e316811131e16e37022d65c6fadfd9bba) Reviewed-by: Qt Cherry-pick Bot --- src/assistant/assistant/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index b84addad7..4ed2f211a 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -193,9 +193,9 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) tabifyDockWidget(bookmarkDock, searchDock); contentDock->raise(); const QRect screen = QGuiApplication::primaryScreen()->geometry(); - resize(4*screen.width()/5, 4*screen.height()/5); - adjustSize(); // make sure we won't start outside of the screen + resize(4 * screen.width() / 5, 4 * screen.height() / 5); + move(screen.center() - rect().center()); } -- cgit v1.2.1