1
0
mirror of https://git.lyx.org/repos/lyx.git synced 2025-01-08 18:19:42 +00:00

Refactorize GuiView::showView.

This way we get rid of pop-uping of widgets when ~/.config/LyX is re-created
and yet we still have title and enabling status correct when widgets are
restored from session.
Some details in bug .

This is candidate for branch too.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30144 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2009-06-16 17:22:43 +00:00
parent 65f641ac1d
commit a45c849f3b
3 changed files with 18 additions and 6 deletions

View File

@ -153,7 +153,7 @@ void Dialog::apply()
}
void Dialog::showView()
void Dialog::prepareView()
{
// Make sure the dialog controls are correctly enabled/disabled with
// readonly status.
@ -165,7 +165,14 @@ void Dialog::showView()
QSize const hint = w->sizeHint();
if (hint.height() >= 0 && hint.width() >= 0)
w->setMinimumSize(hint);
}
void Dialog::showView()
{
prepareView();
QWidget * w = asQWidget();
if (w->isVisible()) {
w->raise();
w->activateWindow();

View File

@ -121,9 +121,12 @@ public:
/// Hide the dialog from sight
void hideView();
/// Create the dialog if necessary, update it and display it.
/// Prepare dialog and display it.
void showView();
/// Prepare dialog before view.
void prepareView();
/// Decide wether the dialog should grab thekeyboard focus when shown.
/// This method defaults to true, override if a different behaviour
/// is wanted.

View File

@ -378,6 +378,7 @@ bool GuiView::restoreLayout()
if (!settings.contains(icon_key))
return false;
//code below is skipped when when ~/.config/LyX is (re)created
setIconSize(settings.value(icon_key).toSize());
#ifdef Q_WS_X11
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
@ -393,11 +394,12 @@ bool GuiView::restoreLayout()
// Allow the toc and view-source dock widget to be restored if needed.
Dialog *d;
if ((d = findOrBuild("toc", true)))
// see bug 5082
d->showView();
if ((d = findOrBuild("toc", true)));
// see bug 5082. At least setup title and enabled state.
// Visibility will be adjusted by restoreState below.
d->prepareView();
if ((d = findOrBuild("view-source", true)))
d->showView();
d->prepareView();
if (!restoreState(settings.value("layout").toByteArray(), 0))
initToolbars();