Qt World Summit: Register Today!

How to set width of one column int a QTableView?

  • Now there's a QTableView with 5 columns.The programme will run on different kinds of computers(defferent size of screen),so I hpoe QTableView will has different width when the programme is running.
    The second column of QTableView is a QPushButton that's put on by QStyledItemDelegate.I hope the second column of TableView has fix size,other columns can automtaic change size when the programme run different screen.
    Then,I do like this:


    But It doesn't work,I find in Asistant,the document tell me the fun doesn't work if I use setSectionResizeMode() brfore.
    I hope the width of second column is fixed and other columns is stretch.How to achieve it?

  • Lifetime Qt Champion

  • Thank you....
    I read document not careful enough ,My mistake.....

Log in to reply