For second countable discrete quantum groups, and more generally second countable locally compact quantum groups with trivial scaling group, we show that property (T) is equivalent to every weakly mixing unitary representation not having almost invariant vectors. This is a generalization of a theorem of Bekka and Valette from the group setting and was previously established in the case of low dual by Daws, Skalski, and Viselter. Our approach uses spectral techniques and is completely different from those of Bekka–Valette and Daws–Skalski–Viselter. By a separate argument we furthermore extend the result to second countable nonunimodular locally compact quantum groups, which are shown in particular not to have property (T), generalizing a theorem of Fima from the discrete setting. We also obtain quantum group versions of characterizations of property (T) of Kerr and Pichot in terms of the Baire category theory of weak mixing representations and of Connes and Weiss in terms of the prevalence of strongly ergodic actions.