A compound of formula (II) or a pharmaceutically acceptable salt thereof, wherein Q is heteroaryl; R 1 is heterocycle which is substituted with one substituent selected from R X ; R 2 is C 3-10 cycloalkyl; R 3 is selected from hydrogen, C 1-6 alkyl and C 3-10 cycloalkyl; R 4 is selected from hydrogen, C 1-6 alkyl and C 3-10 cycloalkyl; R 5 is independently selected from hydrogen and halogen; each R X is independently selected from heterocyclyl, which is unsubstituted or substituted with at least one substituent, such as one, two, three, or four substituents, independently selected from R Y , wherein, in R X , the heterocyclyl is selected from: 1-pyrrolidinyl, 2-pyrrolidinyl, 2,4-imidazolidinyl, 2,3-pyrazolidinyl, 1-piperidinyl, 2-piperidinyl, 3-piperidinyl, 4-piperidinyl, 2,5-piperazinyl, 1,4-piperazinyl, and 2,3-pyridazinyl, as numbered from the linkage position assigned priority 1, and morpholinyl, each R Y is independently selected from halogen, OH, CN, amino, C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-10 cycloalkyl, C 1-6 alkoxy, C 1-6 alkoxyalkyl, C 3-10 cycloalkoxy, C 1-6 alkylthio, C 3-10 cycloalkylthio, C 1-6 alkylamino, C 3-10 cycloalkylamino, di(C 1-6 alkyl)amino, or each R X is independently selected from piperidinyl N-oxide, morpholinyl-N-oxide, 1-oxo-1-thiomorpholinyl, and 1,1-dioxo-1-thiomorpholinyl; m is selected from 0, 1, 2 and 3. or a pharmaceutically acceptable salt thereof, wherein Q is heteroaryl; R 1 is heterocycle which is substituted with one substituent selected from R X ; R 2 is C 3-10 cycloalkyl; R 3 is selected from hydrogen, C 1-6 alkyl and C 3-10 cycloalkyl; R 4 is selected from hydrogen, C 1-6 alkyl and C 3-10 cycloalkyl; R 5 is independently selected from hydrogen and halogen; each R X is independently selected from heterocyclyl, which is unsubstituted or substituted with at least one substituent, such as one, two, three, or four substituents, independently selected from R Y , wherein, in R X , the heterocyclyl is selected from: 1-pyrrolidinyl, 2-pyrrolidinyl, 2,4-imidazolidinyl, 2,3-pyrazolidinyl, 1-piperidinyl, 2-piperidinyl, 3-piperidinyl, 4-piperidinyl, 2,5-piperazinyl, 1,4-piperazinyl, and 2,3-pyridazinyl, as numbered from the linkage position assigned priority 1, and morpholinyl, each R Y is independently selected from halogen, OH, CN, amino, C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-10 cycloalkyl, C 1-6 alkoxy, C 1-6 alkoxyalkyl, C 3-10 cycloalkoxy, C 1-6 alkylthio, C 3-10 cycloalkylthio, C 1-6 alkylamino, C 3-10 cycloalkylamino, di(C 1-6 alkyl)amino, or each R X is independently selected from piperidinyl N-oxide, morpholinyl-N-oxide, 1-oxo-1-thiomorpholinyl, and 1,1-dioxo-1-thiomorpholinyl; m is selected from 0, 1, 2 and 3. 1-pyrrolidinyl, 2-pyrrolidinyl, 2,4-imidazolidinyl, 2,3-pyrazolidinyl, 1-piperidinyl, 2-piperidinyl, 3-piperidinyl, 4-piperidinyl, 2,5-piperazinyl, 1,4-piperazinyl, and 2,3-pyridazinyl, as numbered from the linkage position assigned priority 1, and morpholinyl, each R Y is independently selected from halogen, OH, CN, amino, C 1-6 alkyl, C 2-6 alkenyl, C 2-6 alkynyl, C 3-10 cycloalkyl, C 1-6 alkoxy, C 1-6 alkoxyalkyl, C 3-10 cycloalkoxy, C 1-6 alkylthio, C 3-10 cycloalkylthio, C 1-6 alkylamino, C 3-10 cycloalkylamino, di(C 1-6 alkyl)amino, or each R X is independently selected from piperidinyl N-oxide, morpholinyl-N-oxide, 1-oxo-1-thiomorpholinyl, and 1,1-dioxo-1-thiomorpholinyl; m is selected from 0, 1, 2 and 3. <EOS>