PDA

View Full Version : set a regular expression on QTextEdit



mattia
27th March 2008, 07:45
Hello, is there a way to set a regular expression on QTextEdit?
I'd like to set a maximum row number as row limit of text entred by the user.
Is it possible?
thx

jpn
27th March 2008, 08:47
From QTextEdit docs:

If you want to limit the total number of paragraphs in a QTextEdit, as it is for example open useful in a log viewer, then you can use QTextDocument's maximumBlockCount property for that.

mattia
27th March 2008, 10:10
but if i want to allow the user to entry just, for example, 50 characters...is there a way?

jpn
27th March 2008, 10:16
You can always override keyPressEvent() and call the base class implementation only if certain condition is fulfilled.