QToolButton Arrow is behind text in Instant popup mode. Can I get rid of it?
I am using a QToolButton on a toolbar to bring up a menu.
According to the documentation, if you use ToolButtonPopupMode::MenuButtonPopup it shows an arrow. I discovered that the arrow must be clicked in order to actually show the menu. I didn't want that so I used ToolButtonPopupMode::Instant instead.
However, the arrow is still there. Only now it is just to the right of the text in the place a period would be if I put it after the text... except that the part of the arrow stretches behind the text. I don't mind an arrow showing where it was with MenuButtonPopup but I do not want to have to click the arrow in order for the menu to show. And I CERTAINLY don't want it at the bottom of the button where it is half covered up by the text.
Can I make the arrow disappear/Get rid of the arrow entirely and still have it be a menu button?
I use something like that:
// remove when issue 210047 from Trolltech Task Tracker will be solved
class ToolButtonWorkarounded : public QToolButton
ToolButtonWorkarounded( QWidget* _parent = 0 );
void paintEvent( QPaintEvent* _paintEvent );
}; // class ToolButtonWorkarounded
ToolButtonWorkarounded::ToolButtonWorkarounded( QWidget* _parent )
: QToolButton( _parent )
} // ToolButtonWorkarounded::ToolButtonWorkarounded
ToolButtonWorkarounded::paintEvent( QPaintEvent* _paintEvent )
QToolButton::initStyleOption( &styleOption );
styleOption.features &= ~QStyleOptionToolButton::HasMenu;
QPainter painter( this );
style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter, this );
} // ToolButtonWorkarounded::paintEvent
Thanks! That worked great. How do I get to the Trolltech task tracker to find that issue?
It's so old that I don't think it would ever be fixed. It was reported using previous bugs database, now it's QTBUG-2036.