summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2017-11-12 13:33:25 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2017-11-17 20:28:34 +0000
commitba2f3a156ebc9ce3e6b6e59e231a5c2847163671 (patch)
treea30f85026a2046dd16f7f346da40ee5a5732a65a /src/widgets
parent5c0a9fc532d70ae784cca3e16b5fe59862902815 (diff)
QTreeView: recalculate row heights in hide/showColumn()
When calling QTreeView::hideColumn() the row heights are not recalculated. This can lead to rows which are unnecessarily high due to hidden columns may contain large (e.g. multiline) content. The same applies to showColumn() - there the row might be to small. Hiding columns directly via QTreeView::header()->hideSection() is not covered by this patch since QHeaderView has no way to inform about newly shown/hidden sections. Task-number: QTBUG-8376 Change-Id: I20b1198e56e403ab8cf649af76e5e2280821dd68 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 2abb1a9c14..805b855b9d 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -736,7 +736,10 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
void QTreeView::hideColumn(int column)
{
Q_D(QTreeView);
+ if (d->header->isSectionHidden(column))
+ return;
d->header->hideSection(column);
+ doItemsLayout();
}
/*!
@@ -747,7 +750,10 @@ void QTreeView::hideColumn(int column)
void QTreeView::showColumn(int column)
{
Q_D(QTreeView);
+ if (!d->header->isSectionHidden(column))
+ return;
d->header->showSection(column);
+ doItemsLayout();
}
/*!