D9830: Fix KFilePreviewGenerator::LayoutBlocker

Fabian Vogt noreply at phabricator.kde.org
Thu Jan 11 21:12:17 UTC 2018


fvogt created this revision.
fvogt added reviewers: Frameworks, dfaure.
Restricted Application added a project: Frameworks.
fvogt requested review of this revision.

REVISION SUMMARY
  QAbstractItemViews does layout in a timer event handler, to avoid unnecessary
  layout calculations. Changes which cause a relayout only start the timer.
  LayoutBlocker has the restriction that it only works if the event loop is not
  entered during its lifetime. Without an event loop there's no expensive
  relayout anyway, making the LayoutBlocker pointless in such cases.
  LayoutBlocker works by changing the uniformItemSizes property of the QListView
  to false and in the destructor back to the original value again. Those changes
  do not trigger a relayout in QListView, so if the QListView did a layout with
  uniformItemSizes set to true, it stays that way.
  Fix it by triggering a relayout in ~LayoutBlocker.
  
  This got exposed by a change in Qt, which results in QListView doing a relayout
  while the LayoutBlocker is active.
  
  BUG: 352776

TEST PLAN
  kfilewidgettest_gui has proper item sizes now.

REPOSITORY
  R241 KIO

BRANCH
  master

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

AFFECTED FILES
  src/filewidgets/kfilepreviewgenerator.cpp

To: fvogt, #frameworks, dfaure
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180111/92fc0e73/attachment.html>


More information about the Kde-frameworks-devel mailing list