How to change flight track/stop flight in real time in QGroundControl?

We’re building a drone that will search a specified area for an apriltag. Once it’s detected it should route its way to it. How can we make QGC stop the search based on a real-time command instead of it completing searching the entire area without need?