How do I get a reference to the keys bound to a specific action?

Hello, I’m trying to make it so that an action is only fired when the key has been held down for a specified amount of time. To do this, I used the GetInputKeyTimeDown function on an axis event, so that if the player holds down the key the function will be called continuously until the key has been held long enough, like so:

float timeHeld = GetWorld()->GetFirstPlayerController()->GetInputKeyTimeDown(EKeys::Q);
if (timeHeld >= 1) {....

My problem is that I don’t want to hard-code which key I’m using, I would like to be able to get a reference to the key that is bound to this action. I tried GetWorld()->GetFirstPlayerController()->PlayerInput->GetKeysForAxis("ActionName"), but that doesn’t seem to work because the PlayerInput object is incomplete. Is there a simple way to find a reference to the key(s) that this action is bound to?

The most common pattern for events based on how long a key is held down is to instead have two events, one firing on key pressed and one firing on key released. This is specified when setting the bindactions, e.g.

void APWNPlayerController::SetupInputComponent()

    if (InputComponent != nullptr)
        // Move
        InputComponent->BindAction("InputMoveForward", EInputEvent::IE_Pressed, this, &APWNPlayerController::InputMoveForwardStart);
        InputComponent->BindAction("InputMoveForward", EInputEvent::IE_Released, this, &APWNPlayerController::InputMoveForwardStop);

The key pressed event then starts a timer when it fires and the key released event responds accordingly, i.e. take action if key was down for long enough and then reset the timer.

In this way you still specify the keymappings as normal (no hard-coding).