From: Peter Kümmel Date: Fri, 23 Jun 2006 10:19:31 +0000 (+0000) Subject: * frontends/qt3/QtView.C: use QRect ctor, coding style X-Git-Tag: 1.6.10~13073 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0afff7f598138ae53ce079659924e4a249bbff5b;p=features.git * frontends/qt3/QtView.C: use QRect ctor, coding style * frontends/qt4/lyx_gui.C: coding style * frontends/qt4/GuiView.C: use QRect ctor, coding style git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14183 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt3/QtView.C b/src/frontends/qt3/QtView.C index ca7953d52e..e79be58db6 100644 --- a/src/frontends/qt3/QtView.C +++ b/src/frontends/qt3/QtView.C @@ -58,7 +58,7 @@ int const statusbar_timer_value = 3000; QtView::QtView() - : QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this) + : QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this) { qApp->setMainWidget(this); @@ -157,36 +157,35 @@ bool QtView::hasFocus() const return qApp->activeWindow() == this; } + void QtView::initFloatingGeometry(QRect const & g) { floatingGeometry_ = g; maxWidth = QApplication::desktop()->width() - 20; } + void QtView::updateFloatingGeometry() { if (width() < maxWidth && frameGeometry().x() > 0) - { - // setX/Y changes the size! - floatingGeometry_.setX(x()); - floatingGeometry_.setY(y()); - floatingGeometry_.setWidth(width()); - floatingGeometry_.setHeight(height()); - } + floatingGeometry_ = QRect(x(), y(), width(), height()); } + void QtView::resizeEvent(QResizeEvent *) { maxWidth = std::max(width(), maxWidth); - - updateFloatingGeometry(); + + updateFloatingGeometry(); } + void QtView::moveEvent(QMoveEvent *) { updateFloatingGeometry(); } + void QtView::closeEvent(QCloseEvent *) { updateFloatingGeometry(); diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index 840c406b10..07b77b3c72 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -111,6 +111,7 @@ void GuiView::updateMenu(QAction *action) menubar_->update(); } + void GuiView::setWindowTitle(string const & t, string const & it) { QMainWindow::setWindowTitle(toqstr(t)); @@ -175,22 +176,20 @@ bool GuiView::hasFocus() const return qApp->activeWindow() == this; } + void GuiView::updateFloatingGeometry() { - if (!isMaximized()) { - // setX/Y changes the size! - floatingGeometry_.setX(x()); - floatingGeometry_.setY(y()); - floatingGeometry_.setWidth(width()); - floatingGeometry_.setHeight(height()); - } + if (!isMaximized()) + floatingGeometry_ = QRect(x(), y(), width(), height()); } + void GuiView::resizeEvent(QResizeEvent *) { updateFloatingGeometry(); } + void GuiView::moveEvent(QMoveEvent *) { updateFloatingGeometry(); @@ -243,6 +242,7 @@ void GuiView::busy(bool yes) const QApplication::restoreOverrideCursor(); } + QMainWindow* GuiView::mainWidget() { return mainWidget_; diff --git a/src/frontends/qt4/lyx_gui.C b/src/frontends/qt4/lyx_gui.C index e1d8ce12ed..32ef21f94f 100644 --- a/src/frontends/qt4/lyx_gui.C +++ b/src/frontends/qt4/lyx_gui.C @@ -203,10 +203,8 @@ void start(string const & batch, vector const & files, view.init(); // only true when the -geometry option was NOT used - if (width != -1 && height != -1) - { - if (posx != -1 && posy != -1) - { + if (width != -1 && height != -1) { + if (posx != -1 && posy != -1) { #ifdef Q_OS_WIN32 // FIXME: use only setGeoemtry when Trolltech has // fixed the qt4/X11 bug