In this paper, by using the Hamming distance, we establish a relation between quantum error-correcting codes ((N,K,d+1))s and orthogonal arrays with orthogonal partitions. Therefore, this is a generalization of the relation between quantum error-correcting codes ((N,1,d+1))s and irredundant orthogonal arrays. This relation is used for the construction of pure quantum error-correcting codes. As applications of this method, numerous infinite families of optimal quantum codes can be constructed explicitly such as ((3,s,2))s for all si≥3, ((4,s2,2))s for all si≥5, ((5,s,3))s for all si≥4, ((6,s2,3))s for all si≥5, ((7,s3,3))s for all si≥7, ((8,s2,4))s for all si≥9, ((9,s3,4))s for all si≥11, ((9,s,5))s for all si≥9, ((10,s2,5))s for all si≥11, ((11,s,6))s for all si≥11, and ((12,s2,6))s for all si≥13, where s=s1⋯sn and s1,…,sn are all prime powers. The advantages of our approach over existing methods lie in the facts that these results are not just existence results, but constructive results, the codes constructed are pure, and each basis state of these codes has far less terms. Moreover, the above method developed can be extended to construction of quantum error-correcting codes over mixed alphabets.