1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +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),
mViewTotal (totalViews)
{
QString width = CSMSettings::UserSettings::instance().settingValue
("window/default-width");
int width = CSMSettings::UserSettings::instance().settingValue
("window/default-width").toInt();
QString height = CSMSettings::UserSettings::instance().settingValue
("window/default-height");
int height = CSMSettings::UserSettings::instance().settingValue
("window/default-height").toInt();
width = std::max(width, 300);
height = std::max(height, 300);
// trick to get the window decorations and their sizes
show();
hide();
resize (width.toInt() - (frameGeometry().width() - geometry().width()),
height.toInt() - (frameGeometry().height() - geometry().height()));
resize (width - (frameGeometry().width() - geometry().width()),
height - (frameGeometry().height() - geometry().height()));
mSubViewWindow.setDockOptions (QMainWindow::AllowNestedDocks);