X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiToolbar.cpp;h=0469db25151c5542926b60ce49d4b9565da55f57;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=3d5722c75e4f76a3648c1c242df529be2219a891;hpb=7215b099d359d9e8a1834a0dd37109dac1ed0c37;p=lyx.git diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 3d5722c75e..0469db2515 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -53,7 +53,7 @@ namespace frontend { GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner) : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0), - allowauto_(false), owner_(owner), layout_(0), command_buffer_(0), + allowauto_(false), owner_(owner), command_buffer_(0), tbinfo_(tbinfo), filled_(false) { setIconSize(owner.iconSize()); @@ -175,7 +175,12 @@ MenuButton::MenuButton(GuiToolbar * bar, ToolbarItem const & item, bool const st setToolTip(label); setStatusTip(label); setText(label); - setIcon(QIcon(getPixmap("images/math/", toqstr(tbitem_.name_), "png"))); + QString const name = toqstr(tbitem_.name_); + FileName const fname = libFileSearch("images/math/", name, "png"); + if (fname.exists()) + setIcon(QIcon(getPixmap("images/math/", name, "png"))); + else + setIcon(QIcon(getPixmap("images/", name, "png"))); if (sticky) connect(this, SIGNAL(triggered(QAction *)), this, SLOT(actionTriggered(QAction *))); @@ -226,12 +231,14 @@ void GuiToolbar::add(ToolbarItem const & item) case ToolbarItem::SEPARATOR: addSeparator(); break; - case ToolbarItem::LAYOUTS: - layout_ = new LayoutBox(this, owner_); + case ToolbarItem::LAYOUTS: { + LayoutBox * layout = owner_.getLayoutDialog(); QObject::connect(this, SIGNAL(iconSizeChanged(QSize)), - layout_, SLOT(setIconSize(QSize))); - addWidget(layout_); + layout, SLOT(setIconSize(QSize))); + QAction * action = addWidget(layout); + action->setVisible(true); break; + } case ToolbarItem::MINIBUFFER: command_buffer_ = new GuiCommandBuffer(&owner_); addWidget(command_buffer_); @@ -296,8 +303,9 @@ void GuiToolbar::update(bool in_math, bool in_table, bool in_review, for (int i = 0; i < actions_.size(); ++i) actions_[i]->update(); - if (layout_) - layout_->setEnabled(lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled()); + LayoutBox * layout = owner_.getLayoutDialog(); + if (layout) + layout->setEnabled(lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled()); // emit signal updated();