Q:

Line lengths calculation in combination with DEM

I am working in QGIS 2.18.0.
I have a problem regarding calculation of line lengths in combination with raster files, to be precise with DEM raster.
There is not a problem to calculate the line lengths (vector layer), but this calculation assumed the surface to be flat (or not?). By doing this that way I will calculate the length of the "cathetus", and I need the length of the "hypotenuse". 
Is there any add-on or is there any formula to calculate the line length that incorporates the change in the altitude?

A:

There is a SAGA Profiles from lines tool, which is accessible from QGIS Processing Toolbox | SAGA | Terrain Analysis - Profiles.
 
Just give it your DEM (raster) and the line (vector) layers. It will return a new point layer (Profiles) in which attribute table you will find DIST_SURF field. It shows the cumulative length following DEM surface (your "hypotenuse") from the startpoint.

