[Qt-interest] Set QToolBar's icons size with a stylesheet

François KUBLER francois at kubler.org
Fri Aug 6 14:38:27 CEST 2010


Hi list,

This was originally posted in a long mail. As André said, it's much more
smarter to seperate each topic.
So, here we go...



The first problem I have with the QToolBar is that the icon size isn't
always respected.
I'm setting it in my stylesheet using :

QToolBar
{
    icon-size: 48px;
}

The first time the bar appears, it's OK. But if I hide it and show it
back, the icon size gets back to what I believe is their default size.
I tried to show/hide the bar with the common show() and hide() method, and
also with the QMainWindow addToolbar() and removeToolbar() ones, without
success.

Setting the size with the QToolBar::setIconSize() method works, but I
would really need the stylesheet thing to work.

Is this a bug ? Am I doing something wrong ?



Less important, I can't get rid of the QToolBar's rounded corner.
Again, I'm trying to do this via stylesheet, with the following statement
:

QToolBar
{
    border-radius: 0;
}

Weird thing is that if I put a value > 5px, it works ! Any idea ?


Thanks again,

-- 
François




More information about the Qt-interest-old mailing list