Obtaining Q factor formula for RC circuit
Most people know the quality factor from resonant circuits, but one can also define a quality factor for a circuit or component: the ratio of its reactance to its resistance at a given frequency as a measure of its "efficiency".
The higher the Q factor for a component, the closer the component approaches its ideal properties.

The quality factor can be defined as:

$$ Q = 2 \pi \left( \frac{ \text{maximum energy stored in the circuit in one cycle} } { \text{energy dissipated by the circuit in one cycle } } \right) $$

where \$X\$ = capacitive or inductive reactance

Nota bene: "energy stored in the circuit in one cycle" is zero! It should preceeded by "maximum".
For e.g. a sine wave, an ideal capacitor charges during the first quarter and discharges during the second quarter (same for 3rd and 4th), so, no energy is at the end of the cycle. During the cycle there is a maximum of stored energy.

The difference in quality factor depends whether you consider a series or parallel RC circuit.

\$ \color{red}{\text{Parallel }} \$RC circuit (a model of a realistic capacitor)
For a parallel RC circuit, both components see the same voltage. Using this voltage:


  energy stored = C * (Vmax)^2 / 2 and energy dissipated = power(R) * T = T * (Vmax)^2 / (2R)


This is correct.

energy stored is $$ \frac{1}{2}C V^2_{max} $$
energy dissipated per cycle is $$ \frac{ V^2_{RMS} }{R} T = \frac{ V^2_{max} }{2R} T $$

The quality factor therefore is
$$ Q = 2 \pi \left( \frac{ \frac{1}{2}C V^2_{max} } { \frac{ V^2_{max} }{2R} T } \right) = 2 \pi f RC = \omega RC $$

\$ \color{red}{\text{Series }} \$RC circuit 
For a series RC circuit, both components see the same current. Using this current:


  Also, in a book(1) I've found that the energy stored in the circuit (the capacitor) is also Wc = (Imax)^2/(w^2 * C).
  (1) Book is "Electornic Circuits" by J.A. Edminister (addition: see question 12.6, page 295)
  This is almost correct. For clarity, you should add this applies for an ideal capacitor. Moreover, there is missing a factor 2) 


energy stored is $$ \frac{1}{2}C V^2_{max} = \frac{1}{2}C \left( \frac{I_{max}}{\omega C} \right)^2 = \frac{I^2_{max}}{\color{red}{2}C\omega^2} $$ 

energy dissipated per cycle is $$ I^2_{RMS} R T = \frac{1}{2} I^2_{max} R T $$

The quality factor therefore is
$$ Q = 2 \pi \left( \frac{  \frac{I^2_{max}}{2C\omega^2} } { \frac{1}{2} I^2_{max} R T } \right) =  2 \pi f \frac{1}{RC\omega^2} = \frac{1}{\omega R C} $$

Nota bene: the "same" difference in quality factor applies for series and parallel RCL circuits.