What's the matter with you?

What were you thinking? / What's the big idea! / What's got into you?


Che cosa ti salta in mente?


Meanings
Strong expression of surprise and disapproval used to question someone's strange behavior 

Examples
What's the matter with you? Creeping up on me like that! You gave me quite a scare
Cosa ti salta in mente? Arrivarmi alle spalle in questo modo! Mi hai fatto prendere un accidente

What's on earth were you thinking? Double parking in the street and then going home for a nap! Are you brain dead or something?
Che cosa ti è saltato in mente? Parcheggiare in doppia fila sotto casa e poi salire a fare un sonnellino. Sei stupido o cosa? 

What were you thinking? You quit your job to travel the world but you don't have a cent to your name!
Ma che cosa ti è saltato in mente? Ti sei licenziato per fare il giramondo, ma non hai nemmeno una lira in tasca!