[PySide] QTableView.setMinimumSectionSize() not working after model reset
Frank Rueter | OHUfx
frank at ohufx.com
Tue May 22 07:26:29 CEST 2018
Hi all,
I am working with a QAbstractTableModel and a QTableView, and need to
reset the entire model during a sessions.
However, when columns are added they do not honour the
QTableView.horizontalHeader().minimumSectionSize() and turn up too small.
The moment I touch the section divider they snap to the right size
though, so it feels like I’m missing a signal to ensure the
QHeaderView’s update.
Any ideas?
There are so many signals one can emit that I am slightly confused now
about which ones may or may not help.
Here is my test block to reset the QAbstractTableModel, messily emitting
signals left right and center to see which ones could help:
|self.beginResetModel() self.layoutAboutToBeChanged.emit()
self.__collectCellData() # provides all data to rebuild the model
self.endResetModel() self.modelReset.emit()
self.headerDataChanged.emit(QtCore.Qt.Orientation.Vertical, 0,
self.rowCount())
self.headerDataChanged.emit(QtCore.Qt.Orientation.Horizontal, 0,
self.columnCount()) self.dataChanged.emit(self.index(0, 0),
self.index(self.rowCount(), self.columnCount())) self.layoutChanged.emit() |
I also tried connecting to the model's columnsInserted signal but to no
avail.
Cheers,
frank
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>
Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20180522/415c5541/attachment.html>
More information about the PySide
mailing list