Hi,
I want to set maximum limit of input text in QtexEdit.It is done by typing or by patsing only 1000 charcters should allowed.
Please suggest
Hi,
I want to set maximum limit of input text in QtexEdit.It is done by typing or by patsing only 1000 charcters should allowed.
Please suggest
Qt Code:
When text in text edit changed if text length is less than or equal to the maximum length do nothing <--- REALLY important! Otherwise you might end in an infinite loop else Truncate the text to the maximum length <--- this will fire the textChanged signal again!To copy to clipboard, switch view to plain text mode
You will be looking at textChanged(), toPlainText(), truncate(), setPlainText() and size() or length()
Last edited by tbscope; 1st July 2010 at 15:18.
Thanks for response.
My Text is richedit.If I used toplaintext() and setplaintext() then my text property will lost.And with toHTML i am not able to truncate properly as they contail HTML tags
Please suggest
Your case is very specific.
You could use the plain text to check the length.
Then do something to find where to cut off the text.
Then use the html text and find that place in your html text and cut off the text.
Be carfull to close the tags too
Bookmarks