* 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
This commit is contained in:
Peter Kümmel 2006-06-23 10:19:31 +00:00
parent 0d3d439195
commit 0afff7f598
3 changed files with 18 additions and 21 deletions

View File

@ -58,7 +58,7 @@ int const statusbar_timer_value = 3000;
QtView::QtView() QtView::QtView()
: QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this) : QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this)
{ {
qApp->setMainWidget(this); qApp->setMainWidget(this);
@ -157,24 +157,21 @@ bool QtView::hasFocus() const
return qApp->activeWindow() == this; return qApp->activeWindow() == this;
} }
void QtView::initFloatingGeometry(QRect const & g) void QtView::initFloatingGeometry(QRect const & g)
{ {
floatingGeometry_ = g; floatingGeometry_ = g;
maxWidth = QApplication::desktop()->width() - 20; maxWidth = QApplication::desktop()->width() - 20;
} }
void QtView::updateFloatingGeometry() void QtView::updateFloatingGeometry()
{ {
if (width() < maxWidth && frameGeometry().x() > 0) if (width() < maxWidth && frameGeometry().x() > 0)
{ floatingGeometry_ = QRect(x(), y(), width(), height());
// setX/Y changes the size!
floatingGeometry_.setX(x());
floatingGeometry_.setY(y());
floatingGeometry_.setWidth(width());
floatingGeometry_.setHeight(height());
}
} }
void QtView::resizeEvent(QResizeEvent *) void QtView::resizeEvent(QResizeEvent *)
{ {
maxWidth = std::max(width(), maxWidth); maxWidth = std::max(width(), maxWidth);
@ -182,11 +179,13 @@ void QtView::resizeEvent(QResizeEvent *)
updateFloatingGeometry(); updateFloatingGeometry();
} }
void QtView::moveEvent(QMoveEvent *) void QtView::moveEvent(QMoveEvent *)
{ {
updateFloatingGeometry(); updateFloatingGeometry();
} }
void QtView::closeEvent(QCloseEvent *) void QtView::closeEvent(QCloseEvent *)
{ {
updateFloatingGeometry(); updateFloatingGeometry();

View File

@ -111,6 +111,7 @@ void GuiView::updateMenu(QAction *action)
menubar_->update(); menubar_->update();
} }
void GuiView::setWindowTitle(string const & t, string const & it) void GuiView::setWindowTitle(string const & t, string const & it)
{ {
QMainWindow::setWindowTitle(toqstr(t)); QMainWindow::setWindowTitle(toqstr(t));
@ -175,22 +176,20 @@ bool GuiView::hasFocus() const
return qApp->activeWindow() == this; return qApp->activeWindow() == this;
} }
void GuiView::updateFloatingGeometry() void GuiView::updateFloatingGeometry()
{ {
if (!isMaximized()) { if (!isMaximized())
// setX/Y changes the size! floatingGeometry_ = QRect(x(), y(), width(), height());
floatingGeometry_.setX(x());
floatingGeometry_.setY(y());
floatingGeometry_.setWidth(width());
floatingGeometry_.setHeight(height());
}
} }
void GuiView::resizeEvent(QResizeEvent *) void GuiView::resizeEvent(QResizeEvent *)
{ {
updateFloatingGeometry(); updateFloatingGeometry();
} }
void GuiView::moveEvent(QMoveEvent *) void GuiView::moveEvent(QMoveEvent *)
{ {
updateFloatingGeometry(); updateFloatingGeometry();
@ -243,6 +242,7 @@ void GuiView::busy(bool yes) const
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
QMainWindow* GuiView::mainWidget() QMainWindow* GuiView::mainWidget()
{ {
return mainWidget_; return mainWidget_;

View File

@ -203,10 +203,8 @@ void start(string const & batch, vector<string> const & files,
view.init(); view.init();
// only true when the -geometry option was NOT used // only true when the -geometry option was NOT used
if (width != -1 && height != -1) if (width != -1 && height != -1) {
{ if (posx != -1 && posy != -1) {
if (posx != -1 && posy != -1)
{
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
// FIXME: use only setGeoemtry when Trolltech has // FIXME: use only setGeoemtry when Trolltech has
// fixed the qt4/X11 bug // fixed the qt4/X11 bug