1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Fix OpenCS window opening issue when config file doesn't exist

It would attempt to create a zero-sized window (or even negative-sized, after subtracting the frame dimensions).
This commit is contained in:
scrawl 2015-01-15 02:49:54 +01:00
parent 7cc1ebc05b
commit b39cc0c8c8

View File

@ -375,17 +375,20 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), : mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1),
mViewTotal (totalViews) mViewTotal (totalViews)
{ {
QString width = CSMSettings::UserSettings::instance().settingValue int width = CSMSettings::UserSettings::instance().settingValue
("window/default-width"); ("window/default-width").toInt();
QString height = CSMSettings::UserSettings::instance().settingValue int height = CSMSettings::UserSettings::instance().settingValue
("window/default-height"); ("window/default-height").toInt();
width = std::max(width, 300);
height = std::max(height, 300);
// trick to get the window decorations and their sizes // trick to get the window decorations and their sizes
show(); show();
hide(); hide();
resize (width.toInt() - (frameGeometry().width() - geometry().width()), resize (width - (frameGeometry().width() - geometry().width()),
height.toInt() - (frameGeometry().height() - geometry().height())); height - (frameGeometry().height() - geometry().height()));
mSubViewWindow.setDockOptions (QMainWindow::AllowNestedDocks); mSubViewWindow.setDockOptions (QMainWindow::AllowNestedDocks);