0
votes

FingerTabs is very handy for showing horizontal text in east or west tabs! Thanks Lego. See it here: How to change text alignment in QTabWidget?

Question: how would you go about vertically centering the tabButton widget created by setTabButton()?

The only options for the ButtonPosition argument are Left or Right. In fingertabs, these button widgets show up offset vertically from the tab itself.

ButtonPosition=QTabBar.LeftSide: enter image description here

ButtonPosition=QTabBar.RightSide: enter image description here

I would like the button widget to be centered vertically in the tab. (If the tabBar is on the north or south of the tabWidget, the text is already horizontally aligned and this centering already happens as expected.) If ButtonPosition had a 'center' setting, all would (potentially) be swell.

Seems like this would just be a case of re-implementing setTabButton, but, I'm not clear on what the code would look like. Any ideas?

This is for PyQt5, python 3.4.2, Qt 5.4.

1

1 Answers

0
votes

Knew this one would be pretty obscure. Stumbled upon a solution, but, I'm not exactly sure why it works:

just add padding-bottom (any value) to the QTabBar::tab stylesheet.

QTabBar::tab {
  padding-bottom:0px;
}

will result in a vertically centered tabButton.

If anyone can explain why that is, I would be grateful!