How is the moment due to pressure distribution calculated?
If you calculate "component of pdS perpendicular to OQ" you get

$$ dM= (p dS) (cos \theta ~ x_Q + sin \theta ~ y_Q) $$ 
The pressure times the surface (gives you a force), splited in the two perpendicular forces(along axis) and applied at the $x_Q$ and $y_Q$ distances. Set $y_Q$ to 0 (negligible thickness) and you get the book formula.