QTabWidget tabPosition west and text alignment horizontal



  • Hi All,

    I have one query regarding QtabWidget.
    In QTabWidget if tab position is west then text is align to vertical. i want to text to be align in horizontal if tab position is west.

    I have used QTabWidget in my code. and tab position is west and i want to align text in horizontal.

    Can you please give me some example with code or give some useful link.

    Thanks,
    Neel



  • I think you have to create your own subclass of QTabWidget / QTabBar to achive this.



  • Or possibly, a QProxyStyle can do the trick, in which you override the rendering of the tabs.



  • but how to do that .. can you please give me with example ....



  • Both approaches are not trivial. It is not so easy to do, nor to give a simple sample for it. You will have to start digging into the documentation for it. [[doc:QProxyStyle]] could be a place to start.



  • I have reimplemented the paintEvent of QTabBar then i am able to change the text alignment to horizontal.
    But another question i also want to add space between two tabs which configurable property. i have added space by drawControl method in painting but when i add space then after that size of the tab decrease. what is the reason ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.