PDA

View Full Version : Customizing QToolBox:tab



ialnik
5th February 2010, 10:37
Hi all!

I'd like to customize QToolBox. By default, the tab header text is aligned to left. It is necessary to align it to center horizontally. I can't find a way to do it. Is it possible?

high_flyer
5th February 2010, 11:07
I guess using style sheets is the easiest way.
http://doc.trolltech.com/4.5/stylesheet.html

ialnik
5th February 2010, 11:17
I guess using style sheets is the easiest way.
http://doc.trolltech.com/4.5/stylesheet.html

Thanks.:)
I know about style sheets. But it seems that there is no way to set QToolBox:tab text align to center. Please, try to do it and if you find solution, share it with me.

high_flyer
5th February 2010, 12:43
I would try something like:

QToolBox::tab {
text-align: center;
}

ialnik
5th February 2010, 12:57
I would try something like:

QToolBox::tab {
text-align: center;
}

I tried it before. It doesn't work.
If it was so simple, I wouldn't submit this question.
Are there any real expert?

bmhautz
5th February 2010, 18:12
I tried it before. It doesn't work.
If it was so simple, I wouldn't submit this question.
Are there any real expert?

text-align only works with QPushButton and QProgressBar anyways, so that's not going to work. Since ::tab is a sub-control, have you looked at using the subcontrol-origin and subcontrol-position properties? This may just align the tab within the tool box though. The brute force way, though, may have to be manually padding the text and looking at the results unless someone has specifically encountered your problem before.