Trigger signal after text has changed in QPlainTextEdit
-
Hello, I'm trying to trigger a method after the text inside a QPlainTextEdit has been changed.
I tried to connect the signal textChanged with my method.
However it seems that my method is not called at the end, not once the content of the QPlainTextEdit is changed.Indeed, if I copy/paste a bunch of lines in the QPlainTextEdit and look at the block count inside my method:
document().blockCount() -> it returns the number of blocks before the change.My method should be called after because it is doing some manipulation with the blocks.
I didn't find any signal triggered after the text has been changed.
Do you have any idea how I can achieve such a thing ?
Or is it possible to override a method of QPlainTextEdit to make a new signal doing what I want ?Thanks
-
@Regex
Hello and welcome.Assuming what you say is indeed the case (I haven't tested) then I would assume
QPlainTextEdit::textChanged
is a UI-widget signal emitted as soon as the text is changed but before that is committed to the document. I would then presume you need to look at QTextDocument signals to be emitted as the backing document gets modified, e.g. try void QTextDocument::contentsChanged()?