Diffusion KIO 248941a0f4b4

Fix KFilePreviewGenerator::LayoutBlocker

Authored by fvogt on Jan 11 2018, 9:07 PM.

Description

Fix KFilePreviewGenerator::LayoutBlocker

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 true 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.

Reviewers: Frameworks, dfaure

Reviewed By: dfaure

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D9830

Details

Committed
fvogtJan 12 2018, 8:54 AM
Reviewer
dfaure
Differential Revision
D9830: Fix KFilePreviewGenerator::LayoutBlocker
Parents
R241:39cd5846e1cb: SVN_SILENT made messages (.desktop file) - always resolve ours
Branches
Unknown
Tags
Unknown