From ff588411afb644e0fc06dcce58a23f17ac404ef5 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 17 Jan 2008 08:42:28 +0000 Subject: [PATCH] Delay IconPalette construction. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22610 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToolbar.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 04c7617546..3269d20c2f 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -396,7 +396,6 @@ class PaletteButton : public QToolButton private: GuiToolbar * bar_; ToolbarItem const & tbitem_; - IconPalette * panel_; bool initialized_; public: PaletteButton(GuiToolbar * bar, ToolbarItem const & item) @@ -408,11 +407,7 @@ public: setText(label); connect(bar_, SIGNAL(iconSizeChanged(QSize)), this, SLOT(setIconSize(QSize))); - panel_ = new IconPalette(this); - panel_->setWindowTitle(label); 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) @@ -435,11 +430,16 @@ public: lyxerr << "Unknown toolbar " << tbitem_.name_ << endl; return; } + IconPalette * panel = new IconPalette(this); + QString label = qt_(to_ascii(tbitem_.label_)); + panel->setWindowTitle(label); + connect(this, SIGNAL(clicked(bool)), panel, SLOT(setVisible(bool))); + connect(panel, SIGNAL(visible(bool)), this, SLOT(setChecked(bool))); ToolbarInfo::item_iterator it = tbinfo->items.begin(); ToolbarInfo::item_iterator const end = tbinfo->items.end(); for (; it != end; ++it) if (!getStatus(it->func_).unknown()) - panel_->addButton(bar_->addItem(*it)); + panel->addButton(bar_->addItem(*it)); QToolButton::mousePressEvent(e); } @@ -450,7 +450,6 @@ class MenuButton : public QToolButton private: GuiToolbar * bar_; ToolbarItem const & tbitem_; - IconPalette * panel_; bool initialized_; public: MenuButton(GuiToolbar * bar, ToolbarItem const & item) -- 2.39.2