Important: Please read the Qt Code of Conduct -

Allow user to resize column to contents in QTableWidget

  • Hello,

    I have a QTableWidget with a bunch of rows and 4 columns. Table is added with rows when data comes (at periodic intervals) from a backend server. All the column display text data, however there are times when the text is long enough to get truncated.

    Is there way that I can allow the user to click on the edge of a column and drag it so that the cells get resized? This something similar to what we see in a spreadsheet application.

  • Lifetime Qt Champion


    Take a look at QHeaderView::setResizeMode

    Hope it helps