align icon on a tab (QTabWidget) & tab widths
Defaut is left aligned. Cannot change this through style sheets – I want it center aligned. Is there any sample code for this?
Can each (individual) tab size be changed (width)?
7 replies
I don’t have any text. Only icons which are definately left aligned (Qt4.6). I added the icons in QtCreator UI and in code, same thing. In style sheets there are no alignments.
Width: Individial tab (with an icon in it). If I set the width of the icon, every tab width changes to the same value. For instance: If there are 5 tabs – each 20px wide. If width of any tab is changed, all tabs reset to the same width.
edit:
To demonstrate I’ve created a new project with QTabWidget and one icon (no style sheets or aditional code)
http://i38.tinypic.com/zj8pll.jpg [i38.tinypic.com]
If I understand correctly you are saying I should subclass QTabWidget so I have access to the tabBar, then create a custom widget (ie QLabel static casted to button) and add it through “setTabButton”?
Either way I’m quite new at Qt – could you help me out with a sample code maybe? I’d appriciate it.
I put up something quickly here [developer.qt.nokia.com], with just one tab button, but something you can extend upon.. is this what you wanted?
You must log in to post a reply. Not a member yet? Register here!


