]> git.lyx.org Git - lyx.git/commitdiff
Delay IconPalette construction.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 17 Jan 2008 08:42:28 +0000 (08:42 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 17 Jan 2008 08:42:28 +0000 (08:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22610 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiToolbar.cpp

index 04c761754604dfad31393648a5ce1718bff16184..3269d20c2f4231a629d3c7880af371d308cd7eb8 100644 (file)
@@ -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)