X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FIconPalette.cpp;h=aaa8dac0b6023e9254ee8db24a2b8445ff89420a;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=50c4f497db961d4510bb278e757ed1f6dd5ddb80;hpb=5ae54ddafb0f8a9dd1a71d7a26549b31b6516e14;p=lyx.git diff --git a/src/frontends/qt4/IconPalette.cpp b/src/frontends/qt4/IconPalette.cpp index 50c4f497db..aaa8dac0b6 100644 --- a/src/frontends/qt4/IconPalette.cpp +++ b/src/frontends/qt4/IconPalette.cpp @@ -12,7 +12,6 @@ #include "IconPalette.h" #include "qt_helpers.h" -#include "controllers/ControlMath.h" // for find_xpm #include #include @@ -112,6 +111,8 @@ void IconPalette::addButton(QAction * action) QToolButton * tb = new QToolButton; tb->setAutoRaise(true); tb->setDefaultAction(action); + QToolButton * pb = qobject_cast(parentWidget()); + tb->setIconSize(pb->iconSize()); // trigger tooltip (children of popups do not receive mousemove events) tb->setMouseTracking(true); @@ -205,19 +206,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 @@ -225,10 +213,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(); @@ -257,11 +245,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); } @@ -270,4 +266,4 @@ void ButtonMenu::updateParent() } // namespace frontend } // namespace lyx -#include "IconPalette_moc.cpp" +#include "moc_IconPalette.cpp"