[Qt-interest] changing commom properties on the fly (noob)

william.crocker at analog.com william.crocker at analog.com
Wed Feb 10 14:09:05 CET 2010


> I would like to change, say, the icon size of all buttons ant toolbars 
> at the same time without worriing to know how many and which are the 
> elements that needs to change.
> As far as I could see, this is a stylesheet task, but did not find a 
> clue on how to do that.


I do this.
I wish I could change the size of icons on menus
but does not appear possible with 4.5.3

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


> Thanks a lot
> Francisco
>
> -- 
> "If you have an apple and I have an apple and we exchange apples then 
> you and I will still each have one apple. But if you have an idea and 
> I have one idea and we exchange these ideas, then each of us will have 
> two ideas." - George Bernard Shaw
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list