Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.1
-
None
Description
Steps to reproduce the issue:
1. To have a widget that is capable to display an integer value;
2. To link this widget with an integer field in database table via QDataWidgetMapper;
3. Select table row where given field has NULL value.
Result:
Nothing will happen.
Expected result:
QDataWidgetMapper should update widget with 0 value (It isn't possible to convert NULL into valid integer so 0 should be set by analogy as empty string '' is set for text widgets).
I attach an example which does following:
1. It has 2 widgets - one is of QString type and another of int type.
String widget will display "TEST" as initial value and integer widget will display 999 as initial value.
2. In-memory database is created with 1 table of 2 fields: field1 is string, field2 is int.
3. Widgets are connected with corresponding fields with help of QDataWidgetMapper.
4. On button push data are selected from the database and QDataWidgetMapper is pointed to the first row of the table.
As result you will see that first widget will display nothing because it was updated with empty string by QDataWidgetMapper, but 2nd widget will keep value 999 because it was not updated (It is visible from debug output also - you may see that only line NEW STR VALUE: "" is printed in console - i.e. method CustomIntEdit.setValue() isn't called in this case at all).
You may uncomment line #65 to make a test when both fields have valid values.
In this case you will see that both widgets are updated by QDataWidgetMapper and 2 lines are printed in console debug output:
NEW STR VALUE: "aaa"
NEW INT VALUE: 111