Handle root index changing in RDHeaderView - refresh section sizes

This commit is contained in:
baldurk
2017-11-29 18:17:19 +00:00
parent a563c1668a
commit af7373fb54
2 changed files with 16 additions and 0 deletions
@@ -467,6 +467,21 @@ void RDHeaderView::setColumnStretchHints(const QList<int> &hints)
resizeSectionsWithHints();
}
void RDHeaderView::setRootIndex(const QModelIndex &index)
{
QHeaderView::setRootIndex(index);
// need to enqueue this after the root index is actually processed (this function is called
// *before* the root index changes).
if(!m_sectionStretchHints.isEmpty())
{
GUIInvoke::defer([this]() {
cacheSectionMinSizes();
resizeSectionsWithHints();
});
}
}
void RDHeaderView::headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast)
{
if(m_customSizing)
@@ -67,6 +67,7 @@ public:
void setCustomSizing(bool sizing) { m_customSizing = sizing; }
int pinnedWidth() { return m_pinnedWidth; }
public slots:
void setRootIndex(const QModelIndex &index) override;
void headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast);
void columnsInserted(const QModelIndex &parent, int first, int last);
void rowsChanged(const QModelIndex &parent, int first, int last);