My code looks somehow like the following:
table = QTableWidget()
table.horizontalHeader().restoreState(settings.value("savedState"))
table.setColumnCount(3)
settings.setValue("savedState", table.horizontalHeader().saveState())
If I run it the first time it there are only 3 column headers. The second time there are 6 and the third 9... The strange thing is table.columnCount()
is always 3. If i remove table.setColumnCount(3)
there are no columns at all.
Why is this happening and is it a bug or intentional?
UPDATE
Adding table.clearContents()
before table.setColumnCount(3)
made it work. I still think it's a bug.