<table><tr><td style="">rjvbb created this revision.<br />rjvbb added a reviewer: ngraham.<br />rjvbb added a project: Frameworks.<br />rjvbb requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18380">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>File dialog detailed view columns were made fixed-size in commit #e504bc1fd56412ee7e9748a0dfafa537977ec1b5, leading to bug 401506.</p>

<p>This patch restores the interactive mode users expect in detailed file list views but preserves the "ideal" column sizing.</p>

<p>Qt doesn't allow combining modes (<tt style="background: #ebebeb; font-size: 13px;">QHeaderView::Stretch|QHeaderView::Interactive</tt>) 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:</p>

<p>1 A slot is connected to <tt style="background: #ebebeb; font-size: 13px;">QHeaderView::sectionResized</tt> when a Polish event is received, and state member variables are initialised.<br />
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(?)).<br />
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.</p>

<p>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.</p>

<p>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.</p>

<p>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).</p>

<p>BUG: 401506</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>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).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18380">https://phabricator.kde.org/D18380</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/filewidgets/kdiroperatordetailview.cpp<br />
src/filewidgets/kdiroperatordetailview_p.h</div></div></div><br /><div><strong>To: </strong>rjvbb, ngraham<br /><strong>Cc: </strong>kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>