admin管理员组

文章数量:1125898

When I use resizeColumnToContents() on QTableView in PyQt the column is well resized but unfortunately it is also frozen and not resizable/editable on GUI after. I would like to :

  • either be able to make it resizable after calling this function with the mouse cursor,
  • and to be able to set min/max limits for the length (not to make it more than 1000 pixels for example),
  • or simply recode this function with min/max. Thank you very much

Example:

self.tableView.resizeColumnToContents(col_index, min_length=30, max_length=888)

or:

resizeMode = QHeaderView.ResizeMode.ResizeToContents|ResizableAfter
horizontal_header.setSectionResizeMode(resizeMode)

本文标签: