How can I use external generated quarterion values to rotate an actor?

Hi, I am generating quaterion x.y.z, w values from an external c++ code, I want to apply these to an actor within unreal.

I found this code, but would like to understand how I can modify it for all my quaterion values, x,y,z,w so my actors rotation is rotated.

void ATestActor::Tick(float DeltaSeconds)
 {
     Super::Tick(DeltaSeconds);
 
     auto rot = GetActorRotation();
 
     FQuat q1 = FQuat(rot); // Current rotator to quaternion
     FQuat q2(FVector(1,0,0), 0.2*DeltaSeconds); // rotate around axis (1,0,0) on angle 0.2*DeltaSeconds
     FQuat qr = q2*q1; // Get result quaternion
 
     SetActorRotation(qr.Rotator()); // Set quaternion to object
 }

hi is there anyone who can help??

Is there anyone who can help?

Like this?

   void ATestActor::SetActorRotationToExternalQuaternion(float x, float y, float z, float w)
    {
        FQuat ExternalQuat(x, y, z, w);
        FRotator NewRot(ExternalQuat);
        SetActorRotation(NewRot);
    }

.h:

public:
void SetActorRotationToExternalQuaternion(float x, float y, float z, float w);

Thank you, I’ll try your code