Qq-bar and Qq2 states and cavity QCD with a background field