]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToolbar.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiToolbar.cpp
index f41fd2c76b9a3083b517b5477b242ac7d1875c27..a80accdddc11a3cb6b04f5bd32da4d7f8e5577ee 100644 (file)
@@ -32,6 +32,7 @@
 #include "KeyMap.h"
 #include "LyX.h"
 #include "LyXRC.h"
+#include "Session.h"
 
 #include "support/debug.h"
 #include "support/gettext.h"
@@ -53,7 +54,8 @@ namespace frontend {
 
 GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
        : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0),
-         owner_(owner), command_buffer_(0), tbinfo_(tbinfo), filled_(false)
+         owner_(owner), command_buffer_(0), tbinfo_(tbinfo), filled_(false),
+         restored_(false)
 {
        setIconSize(owner.iconSize());
        connect(&owner, SIGNAL(iconSizeChanged(QSize)), this,
@@ -68,6 +70,22 @@ GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
 }
 
 
+void GuiToolbar::setVisible(bool visible)
+{
+       // This is a hack to find out which toolbars have been restored by
+       // MainWindow::restoreState and which toolbars should be initialized 
+       // by us (i.e., new toolbars)
+       restored_ = true;
+       QToolBar::setVisible(visible);
+}
+
+
+bool GuiToolbar::isRestored() const
+{
+       return restored_;
+}
+
+
 void GuiToolbar::fill()
 {
        if (filled_)
@@ -102,8 +120,8 @@ Action * GuiToolbar::addItem(ToolbarItem const & item)
        if (!bindings.empty())
                text += " [" + toqstr(bindings.begin()->print(KeySequence::ForGui)) + "]";
 
-       Action * act = new Action(&owner_, getIcon(item.func_, false),
-               text, item.func_, text, this);
+       Action * act = new Action(getIcon(item.func_, false),
+                                 text, item.func_, text, this);
        actions_.append(act);
        return act;
 }