PDA

View Full Version : Restricting TextEdit Data to less than 1MB size while pasting form clipboard



keshab
18th December 2006, 06:24
I want to paste data from some file to textEdit. The problem is the size should be less than 1MB. How to get the size of data from clipboard and handle in which signal of TextEdit?
actually am using a designer and qtextEdit is not sub-classed. so is there any other way of doing it?

wysota
18th December 2006, 11:40
reimplement the QTextEdit::paste() method. Contents of the clipboard can be fetched using QClipboard::text(), when you have it, just check its QString::size() and QString::truncate() it.