Skip to content

fix issues in Minimal Overlapping Window Placement caused by mixing qreal and int in computations

Yifan Zhu requested to merge (removed):fix into master

Avoid accidental mixing of qreal and int

The code for placeSmart uses ints to store coordinates and dimensions, but the various methods of QRectF return qreal types, which can be non-integers under fractional scaling, causing multiple issues.

This commit explicitly converts the needed quantities to ints, avoiding the issues.

Previously, the code relied on the assumption that y = area.y() + area.height(); implies !(y < area.y() + area.height()). This doesn't always hold when mixing qreals and ints, causing infinite loops under fractional scaling when attempting to open large windows, as reported in BUG 477820.

This commit also extends the fix in 5502ce9a to fractional scaling scenarios. The ceiling of client widths and height is used, instead of the implicit floor, which caused BUG 477886.

BUG: 477820 BUG: 477886

@teams/qa

Edited by Yifan Zhu

Merge request reports

Loading