Georg Baum wrote:
> Peter Kümmel wrote:
>
>> The original lyx/Qt3 logic was:
>> 1. create QtView in start
>> 2. in the QtView ctor: resize and setMainWidget,
>> thus geometry option is applied if there is any
>> 3. back in start check if (posx != -1 && posy != -1)
>> is true if yes move widget
>> (init() does not call any geometry functions)
>
> That logic was wrong, too, since the lyxrc values overrode the geometry
> option.
>
>> Is 'if (posx != -1 && posy != -1)' really the right way to
>> check if lyx wqas called with the geometry option?
>
> No. It has nothing to do with the geometry option. The geometry option is
> handled internally by the frontend libs (qt, xforms and gtk), we never see
> it. 'if (posx != -1 && posy != -1)' tests for stored geometry values in
> lyxrc.
> Please read the documentation of QApplication::setMainWidget(), AFAIK the
> only way to not overwrite the geometry option with lyxrc values requires to
> set the lyxrc defaults before calling setMainWidget().
>
>
> Georg
>
>
Ok, now setMainWidget is the last call which could change the geometry.
I could not test Qt3 lyx.
Qt4 is different because there is no setMainWidget.
Index: qt3/lyx_gui.C
===================================================================
--- qt3/lyx_gui.C (revision 14125)
+++ qt3/lyx_gui.C (working copy)
@@ -233,12 +233,16 @@
QtView & view = *view_ptr.get();
view.init();
-
+
+ // restore saved lyxrc-geometry values
if (posx != -1 && posy != -1) {
view.setGeometry(posx, posy, width, height);
if (maximize)
view.setWindowState(Qt::WindowMaximized);
}
+
+ // set -geometry values if any
+ qApp->setMainWidget(&view);
view.show();
Index: qt3/QtView.C
===================================================================
--- qt3/QtView.C (revision 14125)
+++ qt3/QtView.C (working copy)
@@ -58,8 +58,6 @@
QtView::QtView(unsigned int width, unsigned int height)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
- qApp->setMainWidget(this);
-
bufferview_.reset(new BufferView(this, width, height));
menubar_.reset(new QLMenubar(this, menubackend));