Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to edit the orientation of tab text of a QTabWidget
Forum Updated to NodeBB v4.3 + New Features

how to edit the orientation of tab text of a QTabWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yangyanhui4
    wrote on last edited by
    #1

    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 pic.png
    like this.Can I realize it with css file? I have tried ui->tabWidget->tabBar()->setStyle(new CustomTabStyle); but nothing happened.

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yangyanhui4
      wrote on last edited by
      #2

      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

      JonBJ 1 Reply Last reply
      0
      • B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #3

        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 use QStackedWidget with a group of QPushButtons as the tabs instead of QTabWidget, that's much easier to get what you want.

        1 Reply Last reply
        0
        • Y yangyanhui4

          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

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved