┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-04-23 00:23:45 +0200
committerPeter Penz <[email protected]>2012-04-23 00:24:40 +0200
commitcbf83085bed04638833eab52e39cf61a9f2c42a6 (patch)
tree63e698f223f4357e9c3fd170873d33d49b0c91d6 /src/kitemviews/kitemlistview.cpp
parent007907be20cc63e4c12320b0406cc255286e7792 (diff)
Details mode: Fix wrong required column-width calculation
BUG: 298577 FIXED-IN: 4.9.0
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index ae86b2842..6d2d98e93 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -693,6 +693,10 @@ void KItemListView::setStyleOption(const KItemListStyleOption& option)
m_layouter->markAsDirty();
doLayout(animate ? Animation : NoAnimation);
+ if (m_itemSize.isEmpty()) {
+ updatePreferredColumnWidths();
+ }
+
onStyleOptionChanged(option, previousOption);
}
@@ -1461,6 +1465,11 @@ void KItemListView::setModel(KItemModelBase* model)
this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+
+ const int itemCount = m_model->count();
+ if (itemCount > 0) {
+ slotItemsInserted(KItemRangeList() << KItemRange(0, itemCount));
+ }
}
onModelChanged(model, previous);
@@ -2130,7 +2139,7 @@ void KItemListView::applyAutomaticColumnWidths()
// Stretch the first column to use the whole remaining width
firstColumnWidth += availableWidth - requiredWidth;
m_headerWidget->setColumnWidth(firstRole, firstColumnWidth);
- } else if (requiredWidth > availableWidth) {
+ } else if (requiredWidth > availableWidth && m_visibleRoles.count() > 1) {
// Shrink the first column to be able to show as much other
// columns as possible
qreal shrinkedFirstColumnWidth = firstColumnWidth - requiredWidth + availableWidth;