QToolButton - doesn't change icons when pressed
I can't seem to get the ToolButton icon to change when pressed.
This is the simple code I use...
btnArrowLeft = new QToolButton;
btnArrowLeft->setObjectName("ArrowLeft");
// make the icon
QIcon iconGif( "icons/iconBack1.gif");
iconGif.addFile( "icons/iconBack2.gif", iconSize, QIcon::Active, QIcon::Off );
//
btnArrowLeft->setIcon( iconGif );
Am I missing some obvious part?
Thanks for any help
andy walsh
Re: QToolButton - doesn't change icons when pressed
It's because "QIcon::Off" is only displayed if the button is disabled. There is no such function out of the box in Qt.
For a solution see this recent thread: http://www.qtcentre.org/threads/28281-Qt-Picture-change. For you it is ":pressed" and mousePressEvent and mouseReleaseEvent.