Use QFileInfo to extract the last path component.