Skip to content
Commit 248941a0 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

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
parent 39cd5846
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment