Angus Leeming wrote:

>> 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.

I doubt that problem can be solved. Looking at the code, QToolButton
directly passes its rect() to QStyle so there's no layout we can control.

As another try, using

  toolbar->boxLayout()->addStrech()

fails to work in two ways:

  - stretch is added *before* buttons
  - the toolbar is not resized to full width.

The thing I hate about Qt is that sometimes things just don't work and it's
extra hard to figure out what to do.

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

;-)

- Volodya




Reply via email to