开发者

What event (if any) does QTextEdit fire when the size of its content changes?

开发者 https://www.devze.com 2023-01-03 00:36 出处:网络
As the title says, how can I receive notification whenever a multi-line QTextEdit changes the size of its content?

As the title says, how can I receive notification whenever a multi-line QTextEdit changes the size of its content?

(Note: content size is different from the control size, i.e. I want to know when lines were added or removed, or change开发者_如何学运维d height because of a font change).


QTextEdit has a textChanged() signal which will do what you want. From the docs:

"This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied."

I wasn't sure if formatting included font changes but I tested it and it does.

0

精彩评论

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