From: Willem Liu Date: Tue, 14 Sep 2010 16:04:01 +0000 (+0200) Subject: Now starting with keyboard opened won't overwrite the QSettings. It will only start... X-Git-Tag: easylist-0.3.8~8 X-Git-Url: https://vcs.maemo.org/git/?p=easylist;a=commitdiff_plain;h=3c384bd26cbbab85e4acd2af9c7775afc7bd427a Now starting with keyboard opened won't overwrite the QSettings. It will only start in landscape, but retain the QSettings value when closed again. --- diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ebec627..991fefa 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -54,12 +54,16 @@ MainWindow::MainWindow(QWidget *parent) : landscape = settings->value("Landscape").toBool(); } settings->setValue("Landscape", landscape); - // If keyboard is opened at start. + // If keyboard is opened at start. We do landscape mode. + // Otherwise we do what's read from the QSettings. if(isKeyboardClosed() == false) { - landscape = true; + setLandscapeMode(true); + } + else + { + setLandscapeMode(landscape); } - setLandscapeMode(landscape); // Auto-detect portrait/landscape mode. Only works on top widget. // setAttribute(Qt::WA_Maemo5AutoOrientation, true); showListWindow(); @@ -97,7 +101,7 @@ bool MainWindow::isKeyboardClosed() void MainWindow::slotKeyboardSlide() { // When keyboard is opened. - if(false == isKeyboardClosed()) + if(isKeyboardClosed() == false) { setLandscapeMode(true); } @@ -251,11 +255,13 @@ void MainWindow::setLandscapeMode(bool landscape) { if(landscape) { + qDebug() << "Landscape"; setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); setAttribute(Qt::WA_Maemo5PortraitOrientation, false); } else { + qDebug() << "Portrait"; setAttribute(Qt::WA_Maemo5PortraitOrientation, true); setAttribute(Qt::WA_Maemo5LandscapeOrientation, false); }