PyQt:How do i set different header sizes for individual headers?

后端 未结 2 891
后悔当初
后悔当初 2020-12-30 08:59

I have a list containing lists with two items,a word and a number.This list will be presented using a tablewidget.

My aim is to produce a table with two columns and

2条回答
  •  萌比男神i
    2020-12-30 09:46

    the best solution for this, in Qt5 you have to use setSectionResizeMode instead of setResizeMode:

    tabv = QTableView()
    tabv.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
    

    or

    tabv.horizontalHeader().setSectionResizeMode(1)
    

提交回复
热议问题