I calculated that $\frac{dP}{dy} = \cos(y) = \frac{dQ}{dx}$
This tells me that the potential function exists, however I can't figure out what it is.
So far I have found that
$\frac{df}{dx} = \sin(y) + 2x \iff f = -x\cos(y) +x^2 + c(y)$
$\frac{df}{dy} = x\cos(y) + 1 \iff f = x\sin(y) = y + c(x)$
But I can't manage to link these two facts together and find out what f(x,y) is.
First of all, when integrating
$$\frac{\partial f}{\partial x} = \sin y + 2x, $$
you should get (just treat $y$ as a constant)
$$f = x\sin y + x^2 + c(y), $$
differentiate this (with respect to $y$) gives
$$\frac{\partial f}{\partial y} = x\cos y + c'(y) . $$
Comparing this to $Q = x\cos y +1$, we have
$$c'(y) = 1 \Rightarrow c(y) = y +C.$$
Thus you have
$$f(x, y) = x\sin y + x^2 + y +C.$$