开发者

How do I determine the height of a QTextDocument?

开发者 https://www.devze.com 2023-01-02 22:12 出处:网络
Given a specific width, I want to find out the height of a QTextDocument.In other words, if the QTextEdit that contains the QTextDocument is w wide, what is its minimum height h in order to fully disp

Given a specific width, I want to find out the height of a QTextDocument. In other words, if the QTextEdit that contains the QTextDocument is w wide, what is its minimum height h in order to fully display the document without the need 开发者_JAVA技巧for scrollbars?


Set the width for the QTextDocument object to your desired with and then call the function size().height(), this should return the height required for the width you have give it before. Have a look at the size() function documentation of QTextDocument class.

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消