[Qgis-developer] A different behavior in Qt5 beaks a lot of things.

Patrick Valsecchi patrick.valsecchi at camptocamp.com
Fri Oct 7 02:27:25 PDT 2016


Hi,

I was investigating a new bug when editing a feature's attribute with the
current master.
For example, if you don't touch the configuration of a layer containing
integer fields, save the project, exit, re-open the project, when you edit
the attribute of this layer, all the integer fields are forced to 0.

The problem must come from a different behavior with Qt5. Before, the field
config for text was saved like that:
<widgetv2config AllowNull="0" labelOnTop="0" fieldEditable="1" notNull="0"/>

Now, it's saved like that:
<widgetv2config Style="" Min="" AllowNull="0" labelOnTop="0"
constraintDescription="" fieldEditable="1" notNull="0" Max="" Step=""
constraint=""/>

See? All the non-boolean fields that are not specified are now there with
an empty value.

My guess is that QDomElement::setAttribute was a no-op for QString::null
and now it adds an attribute with an empty string. I don't know. But it's a
mess now. Code in the QgsEditorWrapper will end up not using default values
when they do stuff like:
const QString displayFormat = config( "display_format",
QgsDateTimeEditConfig::defaultFormat( field().type() ) ).toString();

The config entry being always there, but empty when not specified, the
default will never be taken. It's then same for range widget's min and max
values then ends up being 0 (my original bug).

And I'm afraid the edit widgets are not the only ones suffering from those
problems.

Am I the only one seeing that? What do we do, now?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161007/123c23a3/attachment.html>


More information about the Qgis-developer mailing list