From 9a0570de4a8088b3984769b74ff26f79c9a03a6d Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Wed, 16 Jan 2008 20:36:45 +0000 Subject: [PATCH] initialize iconpalettes only when the user asks for them git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22605 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToolbar.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 77039830ba..9bb1d33a79 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -413,12 +413,17 @@ public: setCheckable(true); connect(this, SIGNAL(clicked(bool)), panel_, SLOT(setVisible(bool))); connect(panel_, SIGNAL(visible(bool)), this, SLOT(setChecked(bool))); + ToolbarInfo const * tbinfo = + toolbarbackend.getDefinedToolbarInfo(tbitem_.name_); + if (tbinfo) + // use the icon of first action for the toolbar button + setIcon(getIcon(tbinfo->items.begin()->func_, true)); } - void showEvent(QShowEvent * e) + void mousePressEvent(QMouseEvent * e) { if (initialized_) { - QToolButton::showEvent(e); + QToolButton::mousePressEvent(e); return; } @@ -432,15 +437,11 @@ public: } ToolbarInfo::item_iterator it = tbinfo->items.begin(); ToolbarInfo::item_iterator const end = tbinfo->items.end(); - for (; it != end; ++it) { - if (!getStatus(it->func_).unknown()) { + for (; it != end; ++it) + if (!getStatus(it->func_).unknown()) panel_->addButton(bar_->addItem(*it)); - // use the icon of first action for the toolbar button - if (it == tbinfo->items.begin()) - setIcon(getIcon(it->func_, true)); - } - } - QToolButton::showEvent(e); + + QToolButton::mousePressEvent(e); } };