PDA

View Full Version : QToolButton margins



bjoernbg
23rd January 2008, 13:38
Hello everyone,

I'm trying to display the QToolButtons in my QToolBar in a specific way. To achieve the look I want I need to set the spacing between toolbuttons to 0. However, I don't know how to do that, I always get a 1px space between each QToolButton.

Anyone know a solution?

Cheers!

marcel
23rd January 2008, 16:22
I guess you could try with:


toolbar->layout()->setSpacing(0);

but I'm not sure if it works.

bjoernbg
24th January 2008, 08:56
I guess you could try with:


toolbar->layout()->setSpacing(0);

but I'm not sure if it works.

Unfortunately, it doesn't work. I see no changes.

Any other ideas?

bjoernbg
24th January 2008, 10:28
ok, I found the solution myself, though it's not perfect. As you cannot change the layout for the toolbar itself, you add a QWidget with a layout of your choice (spacing = 0 in my case) to the toolbar and add your toolbar items to that widget... it breaks the functionality to dock the toolbar horizontally and vertically though.