]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/IconPalette.cpp
Improve wording (#10670)
[lyx.git] / src / frontends / qt4 / IconPalette.cpp
index 2593882e826da0a2648a8fc696d9e65f0070c4c5..47373e8b7b7802062797bfe2f8bd0952a9438ffa 100644 (file)
@@ -119,6 +119,7 @@ void IconPalette::addButton(QAction * action)
        QToolBar * toolbar = qobject_cast<QToolBar *>(parentWidget()->parentWidget());
        connect(toolbar, SIGNAL(iconSizeChanged(const QSize &)),
                tb, SLOT(setIconSize(const QSize &)));
+       tb->setIconSize(toolbar->iconSize());
 
        int const i = actions_.size();
        int const ncols = qMin(6, i);
@@ -204,19 +205,6 @@ void IconPalette::hideEvent(QHideEvent * event )
 }
 
 
-void IconPalette::updateParent()
-{
-       bool enable = false;
-       for (int i = 0; i < actions_.size(); ++i)
-               if (actions_.at(i)->isEnabled()) {
-                       enable = true;
-                       break;
-               }
-
-       parentWidget()->setEnabled(enable);
-}
-
-
 void IconPalette::paintEvent(QPaintEvent * /*event*/)
 {
        // draw border
@@ -224,10 +212,10 @@ void IconPalette::paintEvent(QPaintEvent * /*event*/)
        if (fw && !tornoff_) {
                QPainter p(this);
                QRegion borderReg;
-               borderReg += QRect(0, 0, fw, height()); //left
-               borderReg += QRect(width() - fw, 0, fw, height()); //right
-               borderReg += QRect(0, 0, width(), fw); //top
-               borderReg += QRect(0, height() - fw, width(), fw); //bottom
+               borderReg += QRegion(QRect(0, 0, fw, height())); //left
+               borderReg += QRegion(QRect(width() - fw, 0, fw, height())); //right
+               borderReg += QRegion(QRect(0, 0, width(), fw)); //top
+               borderReg += QRegion(QRect(0, height() - fw, width(), fw)); //bottom
                p.setClipRegion(borderReg);
                QStyleOptionFrame frame;
                frame.rect = rect();
@@ -256,11 +244,19 @@ void ButtonMenu::add(QAction * action)
 void ButtonMenu::updateParent()
 {
        bool enable = false;
+       // FIXME: so this is commented out for speed considerations
+       // true fix is to repair the updating mechanism of the toolbar
+#if 0
        for (int i = 0; i < actions_.size(); ++i)
                if (actions_.at(i)->isEnabled()) {
                        enable = true;
                        break;
                }
+#else
+       // we check only the first action to enable/disable the menu
+       if (!actions_.isEmpty())
+               enable = actions_.at(0)->isEnabled();
+#endif
 
        parentWidget()->setEnabled(enable);
 }
@@ -269,4 +265,4 @@ void ButtonMenu::updateParent()
 } // namespace frontend
 } // namespace lyx
 
-#include "IconPalette_moc.cpp"
+#include "moc_IconPalette.cpp"