D12592: KFileWidget: Prevent places panel width from growing 1px iteratively

Henrik Fehlauer noreply at phabricator.kde.org
Sun Apr 29 06:10:52 UTC 2018


rkflx created this revision.
rkflx added a reviewer: Frameworks.
Restricted Application added a project: Frameworks.
rkflx requested review of this revision.

REVISION SUMMARY
  cc00bbb22010 <https://phabricator.kde.org/R446:cc00bbb22010af94a2eb95d12201fbeceec17681> tried to prevent the places panel from reopening with a
  width reduced by 1px compared to the previous invocation of the file
  dialog.
  
  While the patch worked on the surface when it was applied, the actual
  reasoning was wrong: The difference was not because of "extra resize()
  events", but because of a mismatch between what was read from the config
  (`placesViewWidth`) and what was written to the config (`sizes[0]`).
  
  The actual reason `placesViewWidth` and `sizes[0]` are different is
  because of a previous error: It is assumed that the splitter sizes sum
  up to `availableWidth`, while in reality this width also contains the
  width of the splitter handle. Upon `setSizes`, Qt equally takes away
  width from both sides of the splitter to make everything fit.
  
  While for the Oxygen and Fusion styles (3px and 4px splitter handle
  width, respectively) an adjustment of 1px did the trick, for Breeze with
  its splitter handle width of only 1px this did not work anymore due to
  rounding errors, it resulted in the config entry incrementing by 1px for
  every invocation of the dialog.
  
  To fix the problem for every style, we simply take the width of the
  splitter handle into account and revert the previous fix. While we are
  at it, we refactor to make everything more DRY.
  
  Ref T8552 <https://phabricator.kde.org/T8552>
  
  FIXED-IN: 5.46

TEST PLAN
  Setup monitoring with `watch grep Speedbar ~/.config/kdeglobals`.
  Repeatedly open `kdialog --getopenfilename`, click on Cancel and
  check that the config entry does not change. Test for multiple widget
  styles (e.g. Breeze, Oxygen, Windows and Fusion), as well as for hiding
  the places panel and manually moving the splitter to both ends.

REPOSITORY
  R241 KIO

BRANCH
  fix-places-width-growth (branched from master)

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

AFFECTED FILES
  src/filewidgets/kfilewidget.cpp

To: rkflx, #frameworks
Cc: michaelh, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180429/32539591/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list