Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个特定的宽度,我想找出 a 的高度QTextDocument。换句话说,如果QTextEdit包含 的QTextDocument是w宽,那么它的最小高度h是多少才能完全显示文档而不需要滚动条?
QTextDocument
QTextEdit
将 QTextDocument 对象的宽度设置为您想要的,然后调用函数 size().height(),这应该返回您之前给它的宽度所需的高度。查看 QTextDocument 类的 size() 函数文档。
希望能帮助到你。