PDA

View Full Version : QToolButton outside of QToolBar



dictoon
15th February 2016, 21:27
I'm stuck with Qt 4.8.6 for now.

I'm using QToolButton controls without placing them inside a QToolBar. This seems to work well, except for one thing: icons for the "active" (hover) state are not shown. In other words, the icon of the QToolButton doesn't change when the mouse cursor is hovering above it. It works fine if I place the QToolButton inside a QToolBar, but in my case the styling of the QToolBar is undesirable and it doesn't look like I'm fully able to cancel it.

Any help would be very much appreciated!

d_stranz
15th February 2016, 22:02
The toolbar most likely has a slot that is connected to the QAction::hover() signal, and it is in this slot where the button's state icons are changed.

dictoon
15th February 2016, 22:23
Thanks for your answer. This is intriguing! Does that mean I could somehow connect the QAction's hover signal to the QToolButton and manually change the its icon?

Added after 7 minutes:

It seems like enabling autoraise on the QToolButton solves the problem!