You may subclass QPushButton and reimplement enterEvent() and leaveEvent(). The first one is invoked when the mouse pointer gets over the button and the second one when it goes away from it, so you may change the icon to the big one in the first method and reset back to normal in the second one. Don't forget to call the methods from the superclass! It might be something like this:
void MyPushButton
::enterEvent(QEvent *event
) {
this->QPushButton::enterEvent(event);
setIcon
(QIcon(":/icons/bigbutton.png"));
}
void MyPushButton
::leaveEvent(QEvent *event
) {
this->QPushButton::leaveEvent(event);
setIcon
(QIcon(":/icons/smallbutton.png"));
}
void MyPushButton::enterEvent(QEvent *event)
{
this->QPushButton::enterEvent(event);
setIcon(QIcon(":/icons/bigbutton.png"));
}
void MyPushButton::leaveEvent(QEvent *event)
{
this->QPushButton::leaveEvent(event);
setIcon(QIcon(":/icons/smallbutton.png"));
}
To copy to clipboard, switch view to plain text mode
Bookmarks