(Well, what could be a more appopriate forum for Qt questions?)

I have no knowledge why that is, but just two ideas:
1) Randomeness might point to there being two concurrent processes which are not synchronized. For that I would place a small delay (or the traditional QApplication::ProcessEvents()) somewhere to let the system stabilize before checking the height.
2) The actual function you use to get "screen" height might matter -- I'm sure there are alternatives. Showing the actual code (!) is _always_ a good idea.