Re: KRect and KRectF proposal

Thiago Macieira <[email protected]> Fri, 10 Apr 2026 09:56:01 -0700
Newsgroups gmane.comp.kde.devel.general
Message-ID <2927328.Hq7AAxBmiT@tjmaciei-mobl5>
On Thursday, 9 April 2026 00:43:13 Pacific Daylight Time Vlad Zahorodnii wrote:
> The issue is that QRectF::toRect() trying to be helpful is what caused
> the issues in the first place. When looking into fractional scaling
> issues ourselves, we looked for a way to make ::toRect() work for us. It
> just can't, both gaps+overlaps and disappearing elements cannot be
> addressed by toRect() alone. If you want something to look uniform or
> prevent from disappearing, it needs to be addressed an abstraction layer
> higher, for example when computing the layout. That's what web browsers
> do (e.g. to ensure borders have consistent thickness, they snap logical
> pixels to the device pixels) and that's also what we do with our
> decorations.

That's fair and I do agree. But also orthogonal as to how floating-point 
rounding should work when context is absent.

> And as I said previously, we also need a function whose behavior is well
> understood and that produces predictable values. I see the reasoning
> behind the current implementation of ::toRect(), but it's not exactly
> what we want in practice.

Agreed again, but still orthogonal. I am arguing for a predictable result with 
*less* surprise than what you've implemented.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEECozPt7VWsJgFlTT/jR/izwvmghcFAmnZK6EbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJEI0f4s8L5oIXK48P/jILBjCaSzSXR0tJ4PLv
Ci+Fv1hlLjrRhPNUZ29FBPBYu9JOIRWGXB9Khsu9frfAES2FLPmYK5SmzEqrac+b
hfrOv4qaLTKVRlkqeq02joZaTGyRTAGo2m3M/sR1RE6HY5fr1ILyvdoirLBDzwKq
CppdZH9MYuKsPzbesso3fVEzNgeNlGs+bDOQ/YKy0xQT4n3Qqk4SkJ/6gzCi/L5W
wRcJvmyaG+VE6HZoV71akL7UJApCy1qx5KGd3OcnDAER76kaY3ktltZ8pp6Sn+cM
SIg8SNIOsP2WdnsZtmwJvfyWm1DmEzqQyv8rBCL5ikI5ptHLlrKraiTFg1dnyD1S
BaUnj0vzVQhuHQwn+98K0aGWgiOSbxWZRvYcgEqMwEAwUG9fHkM+W3/bmDvfSI88
+pmSnxoBiIsBwzqRJ3Jbp6ut7JX4Z3o5h/KKHPtMOH3mfqkvPmjZ1Qts3dzTzmjV
RIFxu7aHabvSFbOZOEk83XGDHq0BzSUYo7Zk074qJckPmMBhkUk8+V0eJXCMcvqX
81LM8Z4+GRxV2KrVnF/emPhu6uTlzZ3CWZeTFXPTiL6SMwmxRLBeDeLg/XEztMpy
b1x79BQ79MKN/WjmlIYUmiF69yvs7Rmu983SG6c1KT54IT1IDWOw2UL/wi7Zgero
yr0axVZtJexeUXz4U6ZdygWn
=nV7G
-----END PGP SIGNATURE-----