If we don't assume any special boundary conditions, this would not be a "true" symmetry in the true sense of the term in general unless f = 0 or something. Here, Q is a derivation that generates the one parameter group in question. We could have antiderivations as well, such as BRST and supersymmetry.