]> git.lyx.org Git - features.git/commitdiff
startup optimisation: delay toolbar filling until it is shown on screen.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 28 May 2008 10:26:03 +0000 (10:26 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 28 May 2008 10:26:03 +0000 (10:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24977 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiToolbar.cpp
src/frontends/qt4/GuiToolbar.h

index 6fc2d1ae7912ac43b3f9ca496a6fe88778f5630a..3dd58a73ce02417c2835ae43170a860db86d2400 100644 (file)
@@ -842,26 +842,35 @@ 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();
-       for (; it != end; ++it)
-               add(*it);
-       
        restoreSession();
 }
 
 
+void GuiToolbar::fill()
+{
+       ToolbarInfo::item_iterator it = tbinfo_.items.begin();
+       ToolbarInfo::item_iterator end = tbinfo_.items.end();
+       for (; it != end; ++it)
+               add(*it);       
+}
+
+
+void GuiToolbar::showEvent(QShowEvent * ev)
+{
+       fill();
+       ev->accept();
+}
+
+
 void GuiToolbar::setVisibility(int visibility)
 {
        visibility_ = visibility;
index caa50156e72ea18848fcd6ccdb7da53b5d90fd50..095be20f90438682b0b54c7510b8553f960478f5 100644 (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