PDA

View Full Version : why Qicon does not work as I wanted



irmakci
30th July 2008, 22:39
:confused:
Hi, I want to use different icon when I point to my QAction. And I write some simple code for my app.
But When I selected toggled qaction. My QAction object does not show selected icon.
What is problem?



iconToolButtonLeft = new QIcon();
iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/save.png"), QIcon::Normal, QIcon::On );
iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/greenTick.gif"), QIcon::Active, QIcon::On );
iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/cut.png"), QIcon::Selected, QIcon::On );




normalAct = new QAction(*iconToolButtonLeft, tr("&Normal"), editToolBar );
normalAct->setCheckable(true);

editToolBar->addAction(normalAct);


It works for QIcon's normal and active state but does not work in selected state?
But why?
thanks in advance
regards

jacek
30th July 2008, 23:02
Shouldn't you use Normal/Off combination for toggled action?

iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/cut.png"), QIcon::Normal, QIcon::Off );