Use a more reasonable dynamic default for the window size (90% x 90%). Fixes #1939

This commit is contained in:
Dave Page 2016-11-08 11:37:57 +00:00
parent 6e5683064e
commit 297733634b

View File

@ -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