QtView::QtView()
- : QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this)
+ : QMainWindow(), LyXView(), commandbuffer_(0), frontend_(*this)
{
qApp->setMainWidget(this);
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();
menubar_->update();
}
+
void GuiView::setWindowTitle(string const & t, string const & it)
{
QMainWindow::setWindowTitle(toqstr(t));
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();
QApplication::restoreOverrideCursor();
}
+
QMainWindow* GuiView::mainWidget()
{
return mainWidget_;
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