[Interest] Toolbar size and icon color

Sensei senseiwa at gmail.com
Thu May 24 11:43:00 CEST 2012


On 5/23/12 4:12 PM, Konstantin Tokarev wrote:
>
> You can set up any icon pairs for active and inactive states.
>


I am trying to make this pair work... without success.

For simplicity, I am using one pixmap, inverting its colors.

This is my code:

     QImage dir("image.png");
     QImage inv(dir);
     inv.invertPixels();

     QIcon the;
     the.addPixmap(QPixmap::fromImage(dir), QIcon::Active);
     the.addPixmap(QPixmap::fromImage(inv), QIcon::Selected);

     QAction *xxx;
     xxx = menu->addAction(the, tr("Yes!"));
     connect(xxx, SIGNAL(triggered()), this, SLOT(doit()));
     tool->addAction(xxx);


I may be missing the point here. Selected isn't what I'm looking for, 
since the icon won't appear inverted as I click on it.

The inversion works just fine, and if I only add inv to the icon, I see 
the inverted one.


Cheers!



More information about the Interest mailing list