Measurement-based formulation of quantum heat engines