how to edit the orientation of tab text of a QTabWidget
-
Hi,I have a QTabWidget, the tab is at the left of the QTabWidget. the text orientation should be horizontal but the default orientation is vertical. I have to use css file
like this.Can I realize it with css file? I have tried ui->tabWidget->tabBar()->setStyle(new CustomTabStyle); but nothing happened. -
TradeSettingForm QTabBar::tab {
text-orientation: sideways;
min-width: 150px;
}
I run such code,the width is set successfully but the text is still shown vertical -
It can only be vertical if
tabPosition
is set to be East/West.
You can't change that without reimplementing the painting part yourself.
I would rather useQStackedWidget
with a group ofQPushButton
s as the tabs instead ofQTabWidget
, that's much easier to get what you want. -
@yangyanhui4 said in how to edit the orientation of tab text of a QTabWidget:
text-orientation: sideways;
Where did you get this from? Qt only understands a subset of CSS as documented at https://doc.qt.io/qt-6/stylesheet-reference.html, and I do not see any
text-orientation
mentioned there, so I would presume Qt does not support it.Meanwhile I see @Bonnie has posted to help you further.