From 297733634b24046385418721aa9918f2dd9be7a6 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Tue, 8 Nov 2016 11:37:57 +0000 Subject: [PATCH] Use a more reasonable dynamic default for the window size (90% x 90%). Fixes #1939 --- runtime/BrowserWindow.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/runtime/BrowserWindow.cpp b/runtime/BrowserWindow.cpp index f5f6df7d1..95234cd7d 100644 --- a/runtime/BrowserWindow.cpp +++ b/runtime/BrowserWindow.cpp @@ -125,9 +125,20 @@ BrowserWindow::BrowserWindow(QString url) m_mainWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); #endif - // Restore the geometry + // Restore the geometry, or set a nice default QSettings settings; - restoreGeometry(settings.value("Browser/Geometry").toByteArray()); + + QSize availableSize = qApp->desktop()->availableGeometry().size(); + QSize defaultSize(availableSize.width() * 0.9, availableSize.height() * 0.9); + + QRect defaultGeometry = QStyle::alignedRect( + Qt::LeftToRight, + Qt::AlignCenter, + defaultSize, + qApp->desktop()->availableGeometry() + ); + + restoreGeometry(settings.value("Browser/Geometry", defaultGeometry).toByteArray()); restoreState(settings.value("Browser/WindowState").toByteArray()); // Set the initial zoom