PDA

View Full Version : QIcon Active-/Normal Mode have no diffrent effect



cic
4th September 2013, 10:49
I packed only one png picture into the QIcon and changed its mode.

the effect of the mode normal and active is visually the same. But with mode disabled, it is clearly differently rendered.

any problem could be?



QIcon icon;
icon.addPixmap(QPixmap(dirPath + tr("options.png")));
icon.addPixmap(QPixmap(dirPath + tr("options.png")));

QLabel* label = new QLabel(this);
label->setPixmap(icon.pixmap(128, 24, QIcon::Active));


Solved:

I should read the manual carefully:



When QIcon is provided with only one available pixmap, that pixmap is used for all the states and modes. In this case the pixmap's icon mode is set to normal, and the generated pixmaps for the normal and active modes will look the same. But in disabled and selected mode, Qt will generate a slightly different pixmap.