Straight Lines from Label to Feature in QGIS?

You could use an expression for to create line between label and geometry

enter image description here

Expresion:

CASE 
 WHEN (label_x IS NOT NULL AND label_y IS NOT NULL) THEN
  make_line(centroid($geometry),make_point(label_x -2,label_y), make_point(label_x ,label_y))
ELSE
  NULL
END

And this should the result:

enter image description here


Carlos' answer makes a horizontally aligned leader at the label end altough only one less point in the geometry generator gives straight lines. In my example, I moved the labels manually using the labeling toolbar in QGIS 3.0.3. Note that the technique can be found in question 232709.

The only changes I needed to make are the x,y values in my expression:

CASE
   WHEN ("auxiliary_storage_labeling_positionx" IS NOT NULL AND "auxiliary_storage_labeling_positiony" IS NOT NULL) THEN
        make_line(centroid($geometry),make_point("auxiliary_storage_labeling_positionx","auxiliary_storage_labeling_positiony"))
   ELSE
      NULL
END

As for the leader lines themselves, the symbology tree goes like this:

  • Fill
    • Geometry generator
      • Line
        • Marker line
          • Marker
            • Simple marker
          • Simple line

To make sure the leaders end at the label center, just edit the values in the labels' data defined alignment to 'Center' for horizontal and 'Half' for vertical. To style the line to whatever you need, use the simple line nested in the marker line.