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