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. 2 lines in columns headers
Forum Updated to NodeBB v4.3 + New Features

2 lines in columns headers

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 210 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Max
    wrote on last edited by
    #1

    Hello everyone!

    I'd like to know if there is a way to split a sentence into 2 lines (or more...) in a column (or a row...) header in a QTableView.

    Regards,
    Sylvain

    JonBJ 1 Reply Last reply
    0
    • A.A.SEZENA Offline
      A.A.SEZENA Offline
      A.A.SEZEN
      wrote on last edited by
      #4

      For QTableWidget, C++, just put \n where you want to split the header. I haven't tried it for QTableView.

      1 Reply Last reply
      1
      • M Max

        Hello everyone!

        I'd like to know if there is a way to split a sentence into 2 lines (or more...) in a column (or a row...) header in a QTableView.

        Regards,
        Sylvain

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

        @Max
        You would write a QStyledDelegate for its QHeaderView::itemDelegateForColumn(int column) if you want more control on a header item's layout.

        1 Reply Last reply
        2
        • M Offline
          M Offline
          Max
          wrote on last edited by
          #3

          Thanks!
          I think I should read QStyledItemDelegate?
          Back after a try!

          1 Reply Last reply
          0
          • A.A.SEZENA Offline
            A.A.SEZENA Offline
            A.A.SEZEN
            wrote on last edited by
            #4

            For QTableWidget, C++, just put \n where you want to split the header. I haven't tried it for QTableView.

            1 Reply Last reply
            1
            • M Offline
              M Offline
              Max
              wrote on last edited by
              #5

              Thanks! I thought that I tried this and indeed it works fine and saves me time!

              1 Reply Last reply
              0
              • M Max has marked this topic as solved on

              • Login

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