]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/IconPalette.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / IconPalette.cpp
index f156cca1c955f1cc9090d5e79b2a33418b501bbf..325a96e881fb9bac92f2c48c7136312770680d5b 100644 (file)
@@ -29,7 +29,7 @@
 namespace lyx {
 namespace frontend {
 
-TearOff::TearOff(QWidget * parent) 
+TearOff::TearOff(QWidget * parent)
        : QWidget(parent)
 {
        highlighted_ = false;
@@ -111,8 +111,6 @@ void IconPalette::addButton(QAction * action)
        QToolButton * tb = new QToolButton;
        tb->setAutoRaise(true);
        tb->setDefaultAction(action);
-       QToolButton * pb = qobject_cast<QToolButton *>(parentWidget());
-       tb->setIconSize(pb->iconSize());
        // trigger tooltip (children of popups do not receive mousemove events)
        tb->setMouseTracking(true);
 
@@ -121,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);
@@ -190,7 +189,7 @@ void IconPalette::showEvent(QShowEvent * /*event*/)
 
        QRect r = rect();
        r.moveTo(gpos.x() + hoffset, gpos.y() + voffset);
-       setGeometry(r); 
+       setGeometry(r);
 }
 
 
@@ -213,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();
@@ -266,4 +265,4 @@ void ButtonMenu::updateParent()
 } // namespace frontend
 } // namespace lyx
 
-#include "IconPalette_moc.cpp"
+#include "moc_IconPalette.cpp"