Results 1 to 4 of 4

Thread: Set Maximum Length of QTextEdit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Set Maximum Length of QTextEdit

    Qt Code:
    1. When text in text edit changed
    2. if text length is less than or equal to the maximum length
    3. do nothing <--- REALLY important! Otherwise you might end in an infinite loop
    4. else
    5. 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.

Similar Threads

  1. QTextEdit - how to limit maximum length?
    By Henrikas[MI] in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2010, 20:38
  2. Replies: 33
    Last Post: 10th June 2010, 16:51
  3. Maximum input length for QTextEdit or QPlainTextEdit ??
    By b_ginner in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2009, 20:57
  4. qt4 & xp - QTextEdit length
    By incapacitant in forum Newbie
    Replies: 4
    Last Post: 6th March 2006, 15:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.