]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToolbar.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / GuiToolbar.cpp
index 6fc2d1ae7912ac43b3f9ca496a6fe88778f5630a..7ecd0b60ab5c53390ba751fafed5c9bae68dfce5 100644 (file)
@@ -842,26 +842,38 @@ 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), filled_(false)
 {
-       // 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()
+{
+       if (filled_)
+               return;
+       ToolbarInfo::item_iterator it = tbinfo_.items.begin();
+       ToolbarInfo::item_iterator end = tbinfo_.items.end();
+       for (; it != end; ++it)
+               add(*it);       
+       filled_ = true;
+}
+
+
+void GuiToolbar::showEvent(QShowEvent * ev)
+{
+       fill();
+       ev->accept();
+}
+
+
 void GuiToolbar::setVisibility(int visibility)
 {
        visibility_ = visibility;