I'm looking at the following function:
$$K(Q, s) = h\frac{(Q-s)^2}{2Q}+b\frac{s^2}{2Q}+K\frac{\lambda}{Q}+c\lambda,$$ where $Q>0$, $s \ge 0$ and $h,b,c, \lambda, K \ge 0$ and are known.
I want to know/prove that this function is convex.
Calculating the Hessian matrix of $K$, I get
$$ \begin{bmatrix} \frac{s^2(h+b)+2K\lambda}{Q^3} & -\frac{s(h+b)}{Q^2}\\ -\frac{s(h+b)}{Q^2} & \frac{h+b}{Q}\\ \end{bmatrix}. $$
I'm not very proficient in convex optimization theory, but from what I understood is that if this matrix is positive semidefinite, $K$ is convex. I then calculated $x^TAx$, where $x$ $\in \mathbb{R}^2$ and $A$ is my Hessian matrix. I got, after simplification:
$$x^TAx = \frac{x_1^2s^2(h+b)+2K\lambda}{Q^3}-\frac{2x_1x_2Qs(h+b)}{Q^3}+\frac{x_2^2Q^2(h+b)}{Q^3}.$$
Knowing that $h, b, s, K, \lambda$ are all non-negative and $Q$ is strictly positive, to me, this seems like an instance of a square and is therefore always $\ge 0$. Is this enough to prove convexity?
Also, are all functions with a Hessian matrix with a nonnegative diagonal convex? As they are all symetric and show this square instance?
Yes. This is easily seen by factorizing the expression:\begin{align} x^TAx &= \frac{x_1^2s^2(h+b)+2K\lambda}{Q^3}-\frac{2x_1x_2Qs(h+b)}{Q^3}+\frac{x_2^2Q^2(h+b)}{Q^3}\\ &=\frac{(h+b)}{Q^3}\Big(x_1^2s^2-2x_1s\cdot x_2Q+x_2^2Q^2\Big)\\ &=\frac{(h+b)}{Q^3}\Big(x_1s-x_2Q\Big)^2\geq0 \end{align} where the quadratic form is always non-negative as it is a product of non-negative numbers. This is enough to prove convexity. For strict convexity, you need the Hessian to be positive definite, i.e. $x^TAx>0$ for all $x$.
In the case of your second question, no, this is not true in general. A counterexample is $$B=\begin{bmatrix}1&2\\2&1\end{bmatrix}$$ which has positive diagonal elements but is not positive semidefinite, as $\det(B)=-3$ and thus there is an eigenvector such that $x^TBx=-3\|x\|^2<0$.
It might be useful to know that a symmetric diagonally dominant real matrix with nonnegative diagonal entries is positive semidefinite, but this require additional conditions to just the non-negativity of diagonal elements.