diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-10-04 15:07:36 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-10-04 15:07:36 -0300 |
commit | 834800a1794f1ed92f447a2995767ce820473fed (patch) | |
tree | 0ad0c953bc4413f1a37fbcab6fcc905e91be7670 /qt-ui/mainwindow.cpp | |
parent | 3c97cc5b6aef9dad9b8a9067b8c3e207a67ab314 (diff) | |
download | subsurface-834800a1794f1ed92f447a2995767ce820473fed.tar.gz |
Fix display sane values on subsurface at first time opening.
This patch fixes some unsane values that was being retrieved
by the ui-files on first time opening. it creates a basic layout
of the application using the current desktop size.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 4b296aa14..bbacc74a1 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -506,9 +506,28 @@ void MainWindow::initialUiSetup() settings.beginGroup("MainWindow"); QSize sz = settings.value("size", qApp->desktop()->size()).value<QSize>(); resize(sz); - ui.mainSplitter->restoreState(settings.value("mainSplitter").toByteArray()); - ui.infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray()); - ui.listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray()); + + if (settings.value("mainSplitter").isValid()){ + ui.mainSplitter->restoreState(settings.value("mainSplitter").toByteArray()); + ui.infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray()); + ui.listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray()); + } else { + QList<int> mainSizes; + mainSizes.append( qApp->desktop()->size().height() * 0.7 ); + mainSizes.append( qApp->desktop()->size().height() * 0.3 ); + ui.mainSplitter->setSizes( mainSizes ); + + QList<int> infoProfileSizes; + infoProfileSizes.append( qApp->desktop()->size().width() * 0.3 ); + infoProfileSizes.append( qApp->desktop()->size().width() * 0.7 ); + ui.infoProfileSplitter->setSizes(infoProfileSizes); + + QList<int> listGlobeSizes; + listGlobeSizes.append( qApp->desktop()->size().width() * 0.7 ); + listGlobeSizes.append( qApp->desktop()->size().width() * 0.3 ); + ui.listGlobeSplitter->setSizes(listGlobeSizes); + } + settings.endGroup(); settings.beginGroup("ListWidget"); |