[Development] Fixing QRect::width() / height()

Marc Mutz marc.mutz at kdab.com
Tue Mar 15 16:19:26 CET 2016

On Tuesday 15 March 2016 14:48:52 Иван Комиссаров wrote:
> We can also validate rect on construction and allow to create rects no
> bigger than QRect(*, *, MAX_INT, MAX_INT) rects?

No. The ctors are constexpr nothrow now. We must maintain the wide contract. 
In Qt 6, I'd normalise on construction, then we can at least assume that x1 >= 
x1 - 1 in the implementation, which allows to use 32-bit arithmetic in more 
cases than now, if we want to avoid branches.

Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts

More information about the Development mailing list