Columns auto-resize to size of QTableView

前端 未结 4 675
鱼传尺愫
鱼传尺愫 2020-12-08 00:43

I am new to Qt and I have just managed to make a QTableView work with my model. It has fixed 3 columns. When I open a window, it look ok but when i resize the window, the QT

4条回答
  •  鱼传尺愫
    2020-12-08 01:30

    This code equally stretchs each columns so that they fit the table's width.

    table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    

    Docs:

    • QHeaderView::setSectionResizeMode
    • See resize modes here.

提交回复
热议问题