This invention provides a class of quinazoline compounds, as represented by formula (I), and their pharmaceutically acceptable salts,wherein: each of R1 and R2 independently, is selected from H, C1-C6 alkoxy, halo-C1-C6 alkoxy, C1-C6-alkoxy-C1-C6 alkoxy, C3-C8 cycloalkoxy, C3-C8 heterocycloalkoxy containing at least one of heteroatoms selected from N, O, S; Z is —NR4—, C(R5)2, S or —O—, wherein R4 is H or C1-C3 alkyl, R5 is the same or different, selected from H or C1-C3 alkyl; R3 is selected from H, halogen, C1-C6 alkyl, C1-C6 alkoxy or halo-C1-C6 alkyl; n is an integer from 0 to 5. This invention also provides methods of preparation and medical uses of the compounds of formula (I) and their pharmaceutically acceptable salts. These compounds have the activity of inhibiting EGFR-TK, and can be used as drugs for the treatment of protein tyrosine kinase related diseases such as tumors, cancers, etc.