textbrower character limit
-
@KOHAK You could subclass QTextBrowser and overwrite https://doc.qt.io/qt-5/qtextbrowser.html#keyPressEvent There you can count the number of characters and remove old characters if needed.
-
@KOHAK Do you mean if the text is set via https://doc.qt.io/qt-5/qtextedit.html#setText for example? You can do this also if you subclass QTextBrowser and override setText() and the other set*() methods.
Alternative would be to connect a slot to https://doc.qt.io/qt-5/qtextedit.html#textChanged signal and handle your requirement there.
-
From my experience, these kind of modifications are better done using QTextDocument. Every QTextEdit has an underlying QTextDocument. The document class has a lot more signals/slots you can connect to and control the overall behaviour of the content.