In my project I display a QMenu
with several QAction
objects. I want the QAction
icon to change when the user hovers over it.
Here is my current code:
QPixmap icons(":/icons/platformIcons.png");
QIcon icon;
icon.addPixmap(icons.copy(0, 0, 16, 16), QIcon::Selected, QIcon::On);
icon.addPixmap(icons.copy(0, 16, 16, 16), QIcon::Selected, QIcon::Off);
ui->actionOpen->setIcon(icon);
However the icon doesn't change when the user hovers over the QAction
. I've tried modes Normal
and Active
and the result is the same. If I switch the states, the icon is reversed, but still doesn't change on a hover (or click for that matter).
Thanks for your time.