It is very simple: I presume JNB DOH is ticketed on 157- (QR) stock and DOH ORD is ticketed on 001- (AA) stock. If so, these are two separate tickets and not a single contract of carriage. The fact that QR happens to operate the second flight is of no relevance.