If $X$ is a quadratic field, there exists $x\in K$, $x$ is not in $Q$, since $[K:Q]=2$, there exists $a,b,c\in Q, a+bx+cx^2=0$, $c\neq 0$ otherwise $x\in Q$, we can assume $c=1$ by dividing by $c$. We have $(x+{b\over 2})^2-b^2/4+a=0$, this implies that $(x+{b\over 2})^2={{b^2-4a}\over 4}$, this implies that $x=\sqrt{e\over f}, e,f \in Z$, remark that $f\sqrt{e\over f}=\sqrt f\sqrt f\sqrt{e\over f}=\sqrt{ef}$ and $\sqrt{e\over f}={1\over f}\sqrt{ef}$, this implies that $Q(\sqrt{e\over f})=Q(\sqrt{ef})$. Remark that without restricting the generalitiy, we can replace $ef$ by a square free integer $d$, $Q(\sqrt d)\subset K$ and $[K:Q]=[Q(\sqrt d):Q]=2$ we deduce that $K=Q(\sqrt d)$. This shows that every quadratic field is of the form $Q(\sqrt d)$.
Suppose that $Q(\sqrt d)=Q(\sqrt d')$ where $d$ and $d'$ are square free integers, this implies $\sqrt d'=a+b\sqrt d$, suppose $a=0$, we deduce that $d'=b^2d$. Contradiction since $d'$ is square free. $b\neq 0$ since $\sqrt d'$ is not in $Q$, we deduce that $a,b\neq 0$. we have: $d'=a^2+db^2+2ab\sqrt d$, this implies that $2ab\sqrt d\in Q$ and $\sqrt d\in Q$ contradiction since $d$ is square free, this establishes the requested bijection.