PDA

View Full Version : QToolBox Formatting



cwalsh
7th January 2006, 20:15
Hi folks,

Here's a basic QToolBox:

http://www.qtcentre.org/forum/attachment.php?attachmentid=12&stc=1&d=1136664547

How do I bring down the spacing between the tabs to zero? For example the gap between ToolBox Item 1 and ToolBox Item 2

I know this is basic, but I can't find it!

Ta,
C.

axeljaeger
7th January 2006, 20:28
I think this depends on the style. You'll have to alter the style. Did you tried other styles?

cwalsh
8th January 2006, 12:49
Thanks Axel,

When I use the '-style plastique' flag it does produce that nicer "tab" style tab:

http://www.qtcentre.org/forum/attachment.php?attachmentid=13&stc=1&d=1136724318

But what I had in mind was something more like:

http://www.qtcentre.org/forum/attachment.php?attachmentid=14&stc=1&d=1136724418

Not so much the colours and shading style, but the inter-tab spacing. Any ideas?

Thanks
Chris

axeljaeger
8th January 2006, 13:08
Use a proxystyle to replace the code for handling the toolbox with your own code. Proxystyle is explained here:

http://doc.trolltech.com/qq/qq09-q-and-a.html#style

cwalsh
8th January 2006, 16:59
Thanks Axel, so it's not quite as trivial as I'd hoped...:eek:

wysota
8th January 2006, 17:45
Oh, the (in)famous "outlook nav bar issue" again :D

We found it easier to implement such a widget using a set of buttons (or frames), splitter and a stacked widget instead of a QToolBox. The buttons just cause the stacked widget page to change.

cwalsh
9th January 2006, 21:03
Hi again

Boredom and foolishness led me to try re-implementing QToolBox, to see if I could make something with easier access to it's layout. By some miraculous good fortune it worked, check out the pic:

20

If anyone wants the source I'll put it up here later.

Thanks!
Chris

axeljaeger
9th January 2006, 21:04
Of course we are interested in the source.

cwalsh
9th January 2006, 23:08
Here it is,

In summary:
I've put the QToolBoxButton into a seperate ToolBoxButton class, and moved all the internal QToolBoxPrivate stuff into the ToolBox class where I could get at it's bits. Then it was just a case of putting a
layout->setSpacing(0); in the constructor.

Cheers!
Chris
21