rjvbb created this revision.
rjvbb added a reviewer: ngraham.
rjvbb added a project: Frameworks.
rjvbb requested review of this revision.

REVISION SUMMARY
  File dialog detailed view columns were made fixed-size in commit 
#e504bc1fd56412ee7e9748a0dfafa537977ec1b5, leading to bug 401506.
  
  This patch restores the interactive mode users expect in detailed file list 
views but preserves the "ideal" column sizing.
  
  Qt doesn't allow combining modes 
(`QHeaderView::Stretch|QHeaderView::Interactive`) so a bit of a ruse is 
required to activate interactive mode after the definitive sizes have been set. 
This patch achieves that as follows:
  
  1 A slot is connected to `QHeaderView::sectionResized` when a Polish event is 
received, and state member variables are initialised.
  2 The handler (slot) stores new, positive sizes for individual columns 
(sections) under condition that the QTreeView contains entries. No attempt i 
made to change the QHeaderView settings directly from here. All this happens 
before the widget will be drawn (evidently(?)).
  3 The state information is checked just before the widget is to be drawn 
(when the 1st Paint event is received); if sizing information is available the 
corresponding columns are resized to their respective stored sizes explicitly, 
and the entire QHeaderView is set to interactive resize mode.
  
  In my testing the first paint event always comes after the final column sizes 
have been determined, and it is not too late to change resize mode here.
  
  Currently the handler slot from 1) is a lambda insteead of a member function. 
A member function could be disconnected once the required information is 
obtained and acted upon but handler overhead is negligible and file dialogs are 
typically not long-lived.
  
  Possible and welcome future development: save and restore user-defined column 
sizes. The resize handler would have to remain in place for that (and track new 
sizes signalled when resizeMode==Interactive).
  
  BUG: 401506

TEST PLAN
  Works as intended on Mac and Linux/X11 with FW. 5.52.0 and Qt 5.9.7 (I see no 
reason why this would behave differently on different platforms).

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D18380

AFFECTED FILES
  src/filewidgets/kdiroperatordetailview.cpp
  src/filewidgets/kdiroperatordetailview_p.h

To: rjvbb, ngraham
Cc: kde-frameworks-devel, michaelh, ngraham, bruns

Reply via email to