Fix broken previews for small selection

Review Request #129135 - Created Oct. 9, 2016 and submitted

Peter Wu

The use of QGraphicsDropShadowEffect in KSImageWidget enables opacity.
When the previous format is RGB32, it can be converted directly to
ARGB32 with no data changes (assuming that the pixel data really has the
format 0xffRRGGBB).

Apparently the data returned by XCB has varying values (including zero)
for the alpha channel which violates the RGB32 format and results in
fully transparant pictures. Explicitly set the bits to fix this.


Small selection, large selection, tall/lengty, they all seem to give a proper preview now.

Also managed to reproduce this with a small Qt program with varying opacity levels. Disabling the graphics effect makes the problem go away but also removes the nice drop shadow.

Tested with Qt 5.7.0 on Arch Linux with Intel graphics.

Boudhayan Gupta
Peter Wu
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 45751d7d8bc2a24abf75644d010018875c17daef by Peter Wu to branch master.