If you are using 4.15. This code connected two buttons by line.
If you use blueprints then look here UMG getting the screen position of a child widget - UI - Epic Developer Community Forums comment by Rudy Triplett Mar 27 '17 at 4:12 PM
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Blueprint/SlateBlueprintLibrary.h"
void UWidgetResearch::NativePaint(FPaintContext& InContext) const
{
Super::NativePaint(InContext);
const FGeometry& geom = pUButtonResearch->GetCachedGeometry();
FVector2D Pos1 = geom.AbsolutePosition;
Pos1.Y += geom.GetDrawSize().Y / 2;
FVector2D PixelPosition, ViewportPosition;
USlateBlueprintLibrary::AbsoluteToViewport(AGod::GODRef->GetWorld(), Pos1, PixelPosition, ViewportPosition);
const FGeometry& geom2 = pUButtonResearchDependent->GetCachedGeometry();
FVector2D Pos2 = geom2.AbsolutePosition;
Pos2.X += geom2.GetDrawSize().X;
Pos2.Y += geom2.GetDrawSize().Y / 2;
FVector2D PixelPosition2, ViewportPosition2;
USlateBlueprintLibrary::AbsoluteToViewport(AGod::GODRef->GetWorld(), Pos2, PixelPosition2, ViewportPosition2);
UWidgetBlueprintLibrary::DrawLine(InContext, ViewportPosition, ViewportPosition2);
}