[Interest] Toolbar size and icon color

Bill Crocker william.crocker at analog.com
Wed May 23 17:02:05 CEST 2012


On 05/23/2012 10:51 AM, Sensei wrote:
> On 5/23/12 4:12pm, Konstantin Tokarev wrote:
>
>> Are your icons large enough for your size? They won't be scaled up.
>
> Actually, I'm trying to use smaller icons.
>

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);

> I have the original 60x60 icons, and I scaled them to 48, 36, and 28.
> I'd like to see which size is visually better.
>
> However, I always end up with the same toolbar size.
>
>>> Is it possible to "whiten" them on mouse clicks?
>>
>> You can set up any icon pairs for active and inactive states.
>
>
> Do you mean creating different ad-hoc pixmaps for each state? If this is
> the case, I'm hoping for something more out of the box, as with normal
> non-black icons.
>
> Thanks&  Cheers!
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>




More information about the Interest mailing list