Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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)?
by default the icon and text are center aligned. remove text and see if the icon comes to the left or center.
bq. Can each (individual) tab size be changed (width)?
do you mean tab headers or varying width with individual tab pages
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.
To demonstrate I've created a new project with QTabWidget and one icon (no style sheets or aditional code)
try something like this,
extend tab widget, and in the QTabBar, call setTabButton on individual index, with your custom widget
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.
ok sure, but might take sometime as am busy with few other things too :)
As I stated - any help is appriciated. Thank you in advance.
I put up something quickly "here":http://developer.qt.nokia.com/wiki/CustomTabBar, with just one tab button, but something you can extend upon.. is this what you wanted?