* 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
This commit is contained in:
Abdelrazak Younes 2007-09-27 14:35:12 +00:00
parent 49388f6abd
commit 83b63b2c53
2 changed files with 29 additions and 1 deletions

View File

@ -15,6 +15,10 @@
#include "qt_helpers.h"
#include "frontends/LyXView.h"
#include <QCloseEvent>
#include <QSettings>
#include <QShowEvent>
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

View File

@ -18,6 +18,9 @@
#include <QDialog>
#include <QObject>
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();