The present invention relates to a quinazoline compound and a preparation method, an application, and a pharmaceutical compostion thereof. The present quinazoline compound is represented by the formula (I), is a phosphatidylinositol 3-kinase (PI3K) inhibitor, and can be used for preventing and/or treating diseases related to PI3K activity, such as cancer, immunological disease, cardiovascular disease, viral infection, inflammation, metabolic/endocrine function disorders or neurological disease.