Git commit 5c8330ff68651ce59c22b292eca4ae794b23dc86 by Andreas Hartmetz. Committed on 12/11/2016 at 18:19. Pushed by ahartmetz into branch 'master'. Make it clearer that all of this is just about the name column. M +6 -10 src/filewidgets/kdiroperatordetailview.cpp M +1 -1 src/filewidgets/kdiroperatordetailview_p.h http://commits.kde.org/kio/5c8330ff68651ce59c22b292eca4ae794b23dc86 diff --git a/src/filewidgets/kdiroperatordetailview.cpp b/src/filewidgets/k= diroperatordetailview.cpp index 247f97c..e6becae 100644 --- a/src/filewidgets/kdiroperatordetailview.cpp +++ b/src/filewidgets/kdiroperatordetailview.cpp @@ -63,7 +63,7 @@ void KDirOperatorDetailView::setModel(QAbstractItemModel = *model) resetResizing(); } = - connect(model, SIGNAL(layoutChanged()), this, SLOT(slotLayoutChanged()= )); + connect(model, SIGNAL(layoutChanged()), this, SLOT(expandNameColumn())= ); = QTreeView::setModel(model); } @@ -162,25 +162,21 @@ void KDirOperatorDetailView::disableColumnResizing() m_resizeColumns =3D false; } = -void KDirOperatorDetailView::slotLayoutChanged() +void KDirOperatorDetailView::expandNameColumn() { if (m_resizeColumns) { QHeaderView *headerView =3D header(); headerView->resizeSections(QHeaderView::ResizeToContents); = - // calculate the required width for all columns except the name co= lumn - int requiredWidth =3D 0; + int notNameWidth =3D 0; const int count =3D headerView->count(); for (int i =3D 1; i < count; ++i) { - requiredWidth +=3D headerView->sectionSize(i); + notNameWidth +=3D headerView->sectionSize(i); } = // try to stretch the name column if enough width is available - int oldNameColumnWidth =3D headerView->sectionSize(KDirModel::Name= ); - int nameColumnWidth =3D viewport()->width() - requiredWidth; - if (nameColumnWidth < oldNameColumnWidth) { - nameColumnWidth =3D oldNameColumnWidth; - } + const int oldNameColumnWidth =3D headerView->sectionSize(KDirModel= ::Name); + const int nameColumnWidth =3D qMax(oldNameColumnWidth, viewport()-= >width() - notNameWidth); headerView->resizeSection(KDirModel::Name, nameColumnWidth); } } diff --git a/src/filewidgets/kdiroperatordetailview_p.h b/src/filewidgets/k= diroperatordetailview_p.h index 7945438..25a1ea1 100644 --- a/src/filewidgets/kdiroperatordetailview_p.h +++ b/src/filewidgets/kdiroperatordetailview_p.h @@ -53,7 +53,7 @@ protected: private Q_SLOTS: void resetResizing(); void disableColumnResizing(); - void slotLayoutChanged(); + void expandNameColumn(); = private: bool m_resizeColumns;