startup optimisation: delay toolbar filling until it is shown on screen.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24977 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-28 10:26:03 +00:00
parent 2ce7c41f03
commit 15b42ccd4a
2 changed files with 28 additions and 12 deletions

View File

@ -842,23 +842,32 @@ void GuiLayoutBox::selected(int index)
GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
: QToolBar(qt_(tbinfo.gui_name), &owner), visibility_(0),
allowauto_(false), owner_(owner), layout_(0), command_buffer_(0)
allowauto_(false), owner_(owner), layout_(0), command_buffer_(0),
tbinfo_(tbinfo)
{
// give visual separation between adjacent toolbars
addSeparator();
// TODO: save toolbar position
// Toolbar dragging is allowed.
setMovable(true);
//
// This is used by QMainWindow::restoreState for proper main window state
// restauration.
setObjectName(toqstr(tbinfo.name));
ToolbarInfo::item_iterator it = tbinfo.items.begin();
ToolbarInfo::item_iterator end = tbinfo.items.end();
restoreSession();
}
void GuiToolbar::fill()
{
ToolbarInfo::item_iterator it = tbinfo_.items.begin();
ToolbarInfo::item_iterator end = tbinfo_.items.end();
for (; it != end; ++it)
add(*it);
}
restoreSession();
void GuiToolbar::showEvent(QShowEvent * ev)
{
fill();
ev->accept();
}

View File

@ -151,6 +151,11 @@ Q_SIGNALS:
private:
// load flags with saved values
void initFlags();
///
void fill();
///
void showEvent(QShowEvent *);
///
QString name_;
///
@ -165,6 +170,8 @@ private:
GuiLayoutBox * layout_;
///
GuiCommandBuffer * command_buffer_;
///
ToolbarInfo const & tbinfo_;
};
} // namespace frontend