Comment # 30 on bug 1123424 from
(In reply to Stefan Hundhammer from comment #29)
> I completely agree that the GNOME people should fix that on their level.
> 
> But Qt could also do this a lot more defensively;

It could, but IMO it only makes sense if the majority of toolkits interpret it
in the same way.

I'm not aware of any valid use of non-integer Xft DPI values - it does not make
much sense to me.

> AFAICS it would be a
> really trivial patch to also check for a double if the int conversion fails:
> 
> https://github.com/qt/qtbase/blob/5.12/src/plugins/platforms/xcb/qxcbscreen.
> cpp#L323
> 
> static bool parseXftInt(const QByteArray& stringValue, int *value)
> {
>     Q_ASSERT(value != 0);
>     bool ok;
>     *value = stringValue.toInt(&ok);
>     return ok;
> }
> 
> 
> Maybe something like (untested)
> 
> static bool parseXftInt(const QByteArray& stringValue, int *value)
> {
>     Q_ASSERT(value != 0);
>     bool ok;
>     *value = stringValue.toInt(&ok);
>     if (!ok)
>         *value = round(stringValue.toDouble(&ok)
>     return ok;
> }
> 
> 
> (Even the rounding is already the de luxe version)


You are receiving this mail because: