load and restore correct windows postion

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14102 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-06-14 14:32:39 +00:00
parent c02f6409ec
commit cd53c67f79
2 changed files with 9 additions and 12 deletions

View File

@ -70,14 +70,9 @@ int const statusbar_timer_value = 3000;
} // namespace anon } // namespace anon
QtView::QtView(unsigned int width, unsigned int height, bool maximize) QtView::QtView(unsigned int width, unsigned int height)
: QMainWindow(), LyXView(), commandbuffer_(0) : QMainWindow(), LyXView(), commandbuffer_(0)
{ {
resize(width, height);
if (maximize)
this->setWindowState(Qt::WindowMaximized);
mainWidget_ = this; mainWidget_ = this;
// setToolButtonStyle(Qt::ToolButtonIconOnly); // setToolButtonStyle(Qt::ToolButtonIconOnly);
@ -184,13 +179,15 @@ bool QtView::hasFocus() const
void QtView::closeEvent(QCloseEvent *) void QtView::closeEvent(QCloseEvent *)
{ {
QRect geometry = normalGeometry();
Session & session = LyX::ref().session();
// save windows size and position // save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width())); session.saveSessionInfo("WindowWidth", convert<string>(geometry.width()));
LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height())); session.saveSessionInfo("WindowHeight", convert<string>(geometry.height()));
LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no")); session.saveSessionInfo("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
if (lyxrc.geometry_xysaved) { if (lyxrc.geometry_xysaved) {
LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x())); session.saveSessionInfo("WindowPosX", convert<string>(geometry.x()));
LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y())); session.saveSessionInfo("WindowPosY", convert<string>(geometry.y()));
} }
// trigger LFUN_LYX_QUIT instead of quit directly // trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff // since LFUN_LYX_QUIT may have more cleanup stuff

View File

@ -47,7 +47,7 @@ class QtView : public QMainWindow, public LyXView {
Q_OBJECT Q_OBJECT
public: public:
/// create a main window of the given dimensions /// create a main window of the given dimensions
QtView(unsigned int w, unsigned int h, bool maximize); QtView(unsigned int w, unsigned int h);
~QtView(); ~QtView();