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 set the width of a column on QTableWidget
Forum Updated to NodeBB v4.3 + New Features

How to set the width of a column on QTableWidget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 10.5k 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.
  • G Offline
    G Offline
    gRicky
    wrote on last edited by
    #1

    Hi guys,

    I'd like to set a specific width for a column of the QTableWidget I'm using on my GUI. How can I do that?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      @void QTableWidget::setColumnWidth ( int column, int width ) @
      isn't help?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gRicky
        wrote on last edited by
        #3

        I solved my trouble with this code:

        @
        //configure the rows and the columns on the table
        ui->stepsViewer->setColumnCount(5);
        ui->stepsViewer->setColumnWidth(0, 80);
        ui->stepsViewer->setColumnWidth(1, 80);
        ui->stepsViewer->setColumnWidth(2, 150);
        ui->stepsViewer->setColumnWidth(3, 150);
        //ui->stepsViewer->setColumnWidth(4, 250);
        ui->stepsViewer->horizontalHeader()->setStretchLastSection(true);
        @

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gRicky
          wrote on last edited by
          #4

          thanks for your interest in this matter @qxoz.

          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