Vladimir Prus wrote:
>>> Personally, I'm quite comfortable with this small extra spacer. Are
>>> you?
>> 
>> Maybe, you can just copy-paste KDE code?
>> 
>>    void KToolBar::setFullSize(bool flag )
>>    {
>>       setHorizontalStretchable( flag );
>>       setVerticalStretchable( flag );
>>    }
> 
> Oops, replying to myself -- that would make the toolbar wide enough, but
> break spacing of buttons. So unless you want to copy KDE's code for
> buttons and spacers, I'm not sure what you can do. Placing a zero-size
> expanding QWidget on the toolbar does not work either -- it's rendered in
> a different color from toolbar. And deriving from QToolButton and
> overriding the sizeHint/minimumSizeHint method to return (0, 0) don't
> work either -- there's the same extra space.
> 
> Looks like your approach is the only one.

Thanks, Volodya. Another alternative would be:

#if 1
//      tb = new QToolButton(toolbar, "");
//      tb->setEnabled(false);
        toolbar->setStretchableWidget(tb);
#endif

Ie, make the final "real" widget stretchable. This appears to affect only
the last toolbar on the line. Of course, at the moment, the button is now
enormous and the pixmap is centrally justified. If we can't resolve these
two problems, then I'd say that my original solution does indeed give us
the best result for the least effort.

Angus (who finds it amusing to discover just who's out there, lurking ;-))


Reply via email to