The Autofields plugin for QGis allows filling automatically the attribute fields of a layer when creating or publishing entities. You can, for example, fill a field with the value of x or y of the point, or the beginning point of a segment, the segment length, etc. You can use this plugin from version 2.12 of QGis and only from version 2.14 if you use the calculations based on the geometry requiring coordinate system transformations.
If you find this plugin useful, I suggest you visiting the page of its creator , German Carrillo, and make a small donation to ensure the sustainability of the development and the portage on future versions of QGis.