[Interest] Toolbar size and icon color

Sensei senseiwa at gmail.com
Wed May 23 17:16:46 CEST 2012


On 5/23/12 5:02pm, Bill Crocker wrote:

> This works for me:
>
> void
> MyApp::setAllIconSizes( QSize sz ) {
>       foreach( QWidget *wp, qApp->topLevelWidgets() ) {
>           foreach( QToolBar *bp, wp->findChildren<QToolBar*>() ) {
>               bp->setIconSize( sz );
>           }
>           foreach( QToolButton *bp, wp->findChildren<QToolButton*>() ) {
>               bp->setIconSize( sz );
>           }
>       }
> }
>
> I provide 3 sizes for all icons:
>
>       QIcon icon;
>       icon.addFile( QString(":/images/16/hat.png"), QSize(16,16) );
>       icon.addFile( QString(":/images/24/hat.png"), QSize(24,24) );
>       icon.addFile( QString(":/images/32/hat.png"), QSize(32,32) );
>       XXX->setIcon(icon);
>


Thanks! Now I can set smaller icons, using Qt's automatic scaling (I 
load the original 60x60 pixels). My mistake was this: I didn't specify 
the icon size, just the toolbar icon sizes (globally).

Do you have any recommendation for the color problem?

I don't really like the idea of loading multiple icons for each state... 
that means converting my icon set manually (sort of).


Thanks & Cheers!





More information about the Interest mailing list