From 83b63b2c537715abadff232684d9df3b573811b2 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 27 Sep 2007 14:35:12 +0000 Subject: [PATCH] * GuiDialog: Initial Window geometry session support. Inheriting class will have to be be modified to make use of that. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20539 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiDialog.cpp | 21 +++++++++++++++++++++ src/frontends/qt4/GuiDialog.h | 9 ++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index b53877bd9d..f2eb9086a4 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -15,6 +15,10 @@ #include "qt_helpers.h" #include "frontends/LyXView.h" +#include +#include +#include + using std::string; namespace lyx { @@ -237,6 +241,23 @@ void GuiDialog::setController(Controller * controller) } +void GuiDialog::showEvent(QShowEvent * e) +{ + QSettings settings; + string key = name_ + "/geometry"; + restoreGeometry(settings.value(key.c_str()).toByteArray()); + QDialog::showEvent(e); +} + + +void GuiDialog::closeEvent(QCloseEvent * e) +{ + QSettings settings; + string key = name_ + "/geometry"; + settings.setValue(key.c_str(), saveGeometry()); + QDialog::closeEvent(e); +} + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index 1628efd16a..da51ee9244 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -18,6 +18,9 @@ #include #include +class QCloseEvent; +class QShowEvent; + namespace lyx { namespace frontend { @@ -75,7 +78,11 @@ public: virtual void applyView() {} /// default: do nothing virtual void updateContents() {} - + /// + void closeEvent(QCloseEvent *); + /// + void showEvent(QShowEvent *); + protected: /// Hide the dialog. virtual void hideView(); -- 2.39.2