[QScintilla] Changing text during textChanged signal.

Phil Thompson phil at riverbankcomputing.com
Thu Mar 15 17:32:42 GMT 2007


On Wednesday 14 March 2007 12:01 pm, T. Schweitzer wrote:
> Hi there.
>
> I have a problem with updating the text shown in QScintillas editor widget.
> The situation: I catch the signal "textChanged" and read QScintillas
> current text with QScintillas::text(). On this I receive the text with the
> new typed in character and the widget itself is not yet updated, so not
> displaying the new character. During handling the "textChanged" signal, I
> want to change the text QScintalla contains and set it by calling
> QScintilla::setText(). But it doesn't accept the new text. Is there some
> read only mechanism, while still in the "textChanged" signal? How else
> could I realize it?

QScintilla ensures that the document is read/write during the call to 
setText(). It's possible that the underlying Scintilla code is doing 
something as there is obvious scope for infinite recursion.

Another approach is to update the text next time round the event loop (using 
QTimer.singleShot() with a 0 timeout).

If you can produce a short, complete example that demonstrates the problem 
then I can take a closer look.

Phil


More information about the QScintilla mailing list