QBuffer is the in-memory QIODevice you might want.