...or QRegExp(".*\\.cpp").

I'm not sure about mapping the slashdot like that, by the way.