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

时间:2015-01-22 13:58:13

标签: c++ qt

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

我已经阅读了documentationthis example,但都没有说出完全保存的内容。我也尝试在source code中查找,但没有找到实现。

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

1 个答案:

答案 0 :(得分:1)

herehere保存以下数据:

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