Proving $\angle QAP=45^\circ$ if $ABCD$ is a square with points $P$ in $BC$, $Q$ in $CD$ satisfying $\overline{BP}+\overline{DQ}=\overline{PQ}$ Here is the problem:

Let $ABCD$ be a square with points $P$ in $BC$, $Q$ in $CD$ satisfying $\overline{BP}+\overline{DQ}=\overline{PQ}$. Prove that $\angle QAP=45^\circ$.

So far I have been trying to show that $\overline{BP}=\overline{DQ}$ so that the sum of angles on both sides of $\angle QAP$ is $45^\circ$
Any hint or guidance will be great, Thanks in advance.

Using the cosine rule:$$|AP|^2+|AQ|^2-2|AP||AQ|cos\alpha=|PQ|^2$$Replacing $|AP|,|AQ|$ and $|PQ|$:$$|AP|=\sqrt{a^2+r^2}$$$$|PQ|=\sqrt{b^2+r^2}$$$$|PQ|=a+b$$
Here is $a=|BP|, b=|DQ|$:$$a^2+r^2+b^2+r^2-2\sqrt{a^2+r^2}\sqrt{b^2+r^2}cos\alpha=(a+b)^2$$$$\implies2r^2-2\sqrt{a^2+r^2}\sqrt{b^2+r^2}cos\alpha=2ab$$Note that $b =\frac{r^2-ar}{r+a}$. Substituting $b$ and simplifying further:$$cos\alpha=\frac{r^2(r+a)-a(r^2-ar)}{\sqrt{a^2+r^2}\sqrt{2r^2(a^2+r^2)}}\implies cos\alpha=\frac{1}{\sqrt{2}}$$$$\implies \alpha=45°$$
