A decomposition method for solving q-difference equations