From 517a797a3ed219632ee1240f32b3d078d0e04f40 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Thu, 2 Oct 2014 07:00:15 +1000 Subject: [PATCH] Remove seemingly unnecessary clearFocus() call (thanks scrawl for help). Fix saving window size on linux. --- apps/opencs/view/doc/view.cpp | 14 ++++++++++++-- apps/opencs/view/settings/settingwindow.cpp | 6 +----- apps/opencs/view/settings/settingwindow.hpp | 2 -- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 744865f1c..8edeeaec7 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -33,12 +33,22 @@ void CSVDoc::View::closeEvent (QCloseEvent *event) else { // save window size first + int width = 0; + int height = 0; + +#ifdef Q_WS_WIN + width = frameGeometry().width(); + height = frameGeometry().height(); +#else + width = geometry().width(); + height = geometry().height(); +#endif CSMSettings::UserSettings::instance().setDefinitions( "Window Size/Width", - QStringList(QString::number(frameGeometry().width()))); + QStringList(QString::number(width))); CSMSettings::UserSettings::instance().setDefinitions( "Window Size/Height", - QStringList(QString::number(frameGeometry().height()))); + QStringList(QString::number(height))); CSMSettings::UserSettings::instance().saveDefinitions(); // closeRequest() returns true if last document diff --git a/apps/opencs/view/settings/settingwindow.cpp b/apps/opencs/view/settings/settingwindow.cpp index 7cdf2bded..590b6f7a5 100644 --- a/apps/opencs/view/settings/settingwindow.cpp +++ b/apps/opencs/view/settings/settingwindow.cpp @@ -19,7 +19,7 @@ void CSVSettings::SettingWindow::createPages() QList connectedSettings; foreach (const QString &pageName, pageMap.keys()) - { + { QList pageSettings = pageMap.value (pageName); mPages.append (new Page (pageName, pageSettings, this)); @@ -129,7 +129,3 @@ void CSVSettings::SettingWindow::saveSettings() mModel->saveDefinitions(); } -void CSVSettings::SettingWindow::closeEvent (QCloseEvent *event) -{ - QApplication::focusWidget()->clearFocus(); -} diff --git a/apps/opencs/view/settings/settingwindow.hpp b/apps/opencs/view/settings/settingwindow.hpp index 2266f130d..11bceee96 100644 --- a/apps/opencs/view/settings/settingwindow.hpp +++ b/apps/opencs/view/settings/settingwindow.hpp @@ -36,8 +36,6 @@ namespace CSVSettings { protected: - virtual void closeEvent (QCloseEvent *event); - ///construct the pages to be displayed in the dialog void createPages();