Friday, 5 February 2016

Binding between QGIS custom form (Qt Designer) and date/time field in SpatiaLite database table?



For my attribute table I created a custom form in Qt Designer. The table has a date field and a time field.


In Qt Designer there are widgets for entering date and time but what data type is expected for the fields in my attribute table in QGIS?


The values always stays NULL in every case, when I choose date, datetime or text. Under Layer properties when I choose the edit widget "calendar" there is a calendar popup even when I use my custom form.



Answer



You need to edit the properties of yours fields Date and Time in QGIS.



  1. Go to the properties of your layer.

  2. Select the Fields tab.

  3. In the line of your field (date and time), click on Line edit.

  4. Select Date/Time.


  5. And then you can specify the format of your date or time -> it must be the same as defined in Qt Designer!


If the properties are the same in your Qt form and in the fields parameters of your layer, the binding will be done automatically.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...