Qt 的 QHeaderView::saveState() 和 QHeaderView::restoreState() 是如何工作的?

How does Qt's QHeaderView::saveState() and QHeaderView::restoreState() work?

我想保存tableview的列顺序以及是否显示每一列。看起来 QHeaderView::saveState() 和 QHeaderView::restoreState() 做了我想要的。

我已经阅读了 documentation and this example, but neither says what is saved exactly. I also tried to look up in the source code,但没有找到实现。

我需要了解下面所做的事情的原因是我正在重构已经保存列顺序和隐藏列首选项的代码。我想确保 QHeaderView::saveState() 和 QHeaderView::restoreState() 做完全相同的事情。谢谢

here and here 保存以下数据:

out << int(orientation);
out << int(sortIndicatorOrder);
out << sortIndicatorSection;
out << sortIndicatorShown;
out << visualIndices;
out << logicalIndices;
out << sectionHidden;
out << hiddenSectionSize;
out << length;
out << sectionCount;
out << movableSections;
out << clickableSections;
out << highlightSelected;
out << stretchLastSection;
out << cascadingResizing;
out << stretchSections;
out << contentsSections;
out << defaultSectionSize;
out << minimumSectionSize;
out << int(defaultAlignment);
out << int(globalResizeMode);
for each sectionSpan:
    out << size;
    out << count;
    out << (int)resizeMode