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. QTableWidget and setting height
Qt 6.11 is out! See what's new in the release blog

QTableWidget and setting height

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 1.1k 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.
  • K Offline
    K Offline
    Kris Revi
    wrote on last edited by
    #1

    is it at all possible to set the height of the Header in a QTableWidget?

    JonBJ 1 Reply Last reply
    0
    • K Kris Revi

      @JonB ff367ed6-c214-46e4-9d3a-34169e933808-image.png

      will setRowHeight() set the height for these or just the ROW and not column?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #6

      @Kris-Revi
      If you are asking how to make that horizontal header higher, purely at a guess (don't know if there is anything better) what does

      ui->tableWidget->horizontalHeader()->setMinimumHeight(int minh);
      

      do?

      K 1 Reply Last reply
      1
      • K Kris Revi

        is it at all possible to set the height of the Header in a QTableWidget?

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

        @Kris-Revi
        Don't know exactly what you want, but are you aware you can access the header via QHeaderView *QTableView::verticalHeader() const, does that let you do what you want?

        K 1 Reply Last reply
        0
        • JonBJ JonB

          @Kris-Revi
          Don't know exactly what you want, but are you aware you can access the header via QHeaderView *QTableView::verticalHeader() const, does that let you do what you want?

          K Offline
          K Offline
          Kris Revi
          wrote on last edited by
          #3

          @JonB let me try and explain!

          With a QTableWidget you can do

              ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
              ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Custom);
              ui->tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Custom);
              ui->tableWidget->setColumnWidth(0, 48);
              ui->tableWidget->setColumnWidth(4, 45);
          

          to make the Header stretch horizontaly and also set Width on each column! but is there a way to set Height?

          JonBJ 1 Reply Last reply
          0
          • K Kris Revi

            @JonB let me try and explain!

            With a QTableWidget you can do

                ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
                ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Custom);
                ui->tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Custom);
                ui->tableWidget->setColumnWidth(0, 48);
                ui->tableWidget->setColumnWidth(4, 45);
            

            to make the Header stretch horizontaly and also set Width on each column! but is there a way to set Height?

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

            @Kris-Revi
            In above code you can also use verticalHeader() for horizontalHeader() and setRowHeight() for setColumnWidth(), so what else are you looking for?

            K 1 Reply Last reply
            0
            • JonBJ JonB

              @Kris-Revi
              In above code you can also use verticalHeader() for horizontalHeader() and setRowHeight() for setColumnWidth(), so what else are you looking for?

              K Offline
              K Offline
              Kris Revi
              wrote on last edited by
              #5

              @JonB ff367ed6-c214-46e4-9d3a-34169e933808-image.png

              will setRowHeight() set the height for these or just the ROW and not column?

              JonBJ 1 Reply Last reply
              0
              • K Kris Revi

                @JonB ff367ed6-c214-46e4-9d3a-34169e933808-image.png

                will setRowHeight() set the height for these or just the ROW and not column?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #6

                @Kris-Revi
                If you are asking how to make that horizontal header higher, purely at a guess (don't know if there is anything better) what does

                ui->tableWidget->horizontalHeader()->setMinimumHeight(int minh);
                

                do?

                K 1 Reply Last reply
                1
                • JonBJ JonB

                  @Kris-Revi
                  If you are asking how to make that horizontal header higher, purely at a guess (don't know if there is anything better) what does

                  ui->tableWidget->horizontalHeader()->setMinimumHeight(int minh);
                  

                  do?

                  K Offline
                  K Offline
                  Kris Revi
                  wrote on last edited by
                  #7

                  @JonB THANK YOU!!!!!!!!! <3

                  1 Reply Last reply
                  0
                  • K Kris Revi 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