# HG changeset patch # User Chris Cannam # Date 1427722117 -3600 # Node ID 5a978d540d556e37625bbf332aef8cdcf45e09c8 # Parent a61a779d73dfe483c7c0fc2f52c38e6ab3bc49c1# Parent 1c529a22a6a7ae3711c1770a5d3495506da258b4 Merge diff -r 1c529a22a6a7 -r 5a978d540d55 widgets/LevelPanToolButton.cpp --- a/widgets/LevelPanToolButton.cpp Mon Mar 30 14:14:33 2015 +0100 +++ b/widgets/LevelPanToolButton.cpp Mon Mar 30 14:28:37 2015 +0100 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include using std::cerr; @@ -44,7 +46,7 @@ wa->setDefaultWidget(m_lpw); menu->addAction(wa); - setPopupMode(MenuButtonPopup); + setPopupMode(InstantPopup); setMenu(menu); setImageSize(m_pixels); @@ -131,12 +133,18 @@ } void -LevelPanToolButton::paintEvent(QPaintEvent *e) +LevelPanToolButton::paintEvent(QPaintEvent *) { - QToolButton::paintEvent(e); + QStylePainter p(this); + QStyleOptionToolButton opt; + initStyleOption(&opt); + opt.features &= (~QStyleOptionToolButton::HasMenu); + p.drawComplexControl(QStyle::CC_ToolButton, opt); + if (m_pixels >= height()) { setImageSize(height()-1); } + double margin = (double(height()) - m_pixels) / 2.0; m_lpw->renderTo(this, QRectF(margin, margin, m_pixels, m_pixels), false); }