Ok, something REALLY freaky! I edited my source and look at the result.
resize(880, 580);
txt-> move(0,100);
txt->resize(100,30); ////////////////////NOTICE THIS RESIZE
std::cout<<txt->height()<<"::"<<txt->y();
txt->setReadOnly(true);
resize(880, 580);
txt = new QTextEdit("qt", this);
txt-> move(0,100);
txt->resize(100,30); ////////////////////NOTICE THIS RESIZE
std::cout<<txt->height()<<"::"<<txt->y();
txt->setReadOnly(true);
To copy to clipboard, switch view to plain text mode
Ok, after the resize I get a versy small perfectly 30 pixel QTextEdit. (See screenshot below). Also, txt->height() gives the correct output 30. However before I added this resize, txt->height() used to output 30 but the resultant QTextEdit used to look wierdly big for 30 pixel. Anyways, here is the screenshot after I added resize.

What the hell !?!?!?!
Bookmarks