PDA

View Full Version : Maximum input length for QTextEdit or QPlainTextEdit ??



b_ginner
22nd August 2009, 17:22
Hello....
Does anyone knows how to set up the maximun number of characters a QTextEdit can hold ?
I mean, besides of installing a key eventFilter to count all the key pressed .....
I wanna have an text input area for users but limit the length, including CR/LF, to 500 characters...

Or if my direction is wrong... Please tell me.. this is going to drive me nuts... :crying:

caduel
22nd August 2009, 19:17
there is QTextDocument::setMaximumBlockCount(), I am not aware of a character-limit;
QLineEdit has one - but probably you want more than 1 line

b_ginner
22nd August 2009, 20:57
there is QTextDocument::setMaximumBlockCount(), I am not aware of a character-limit;
QLineEdit has one - but probably you want more than 1 line
Thanks caduel....
But actually the concept of "Block" is not going to help here .. I already tried....
The Block in QT means a "phrase" or a consecutive of character.
So the effect MaximumBlockCount is not what I want.....