Results 1 to 5 of 5

Thread: How to limit the input text in QPlaintextedit?

  1. #1
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default How to limit the input text in QPlaintextedit?

    Hi all
    I've a Qplaintextedit object. I need the input text limit should be 1000. How to do it?
    i tried with maximumBlockCount(1000) but it didnt help as it will limit blockas only.

  2. #2
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to limit the input text in QPlaintextedit?

    Limit the QPlaintextedit width, compute the number of characters going into one line before line wrap and then you can setMaximumBlockCount( number of lines for 1000 characters).

  3. #3
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to limit the input text in QPlaintextedit?

    Quote Originally Posted by toutarrive View Post
    Limit the QPlaintextedit width, compute the number of characters going into one line before line wrap and then you can setMaximumBlockCount( number of lines for 1000 characters).

    can u plz tell me how to do it programeticaaly? width of plaintextedit is 381.

  4. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to limit the input text in QPlaintextedit?

    Quote Originally Posted by sudhansu View Post
    Hi all
    I've a Qplaintextedit object. I need the input text limit should be 1000. How to do it?
    i tried with maximumBlockCount(1000) but it didnt help as it will limit blockas only.
    means u want to limit the input entry below 1000 ..? if so use QValidator ..http://doc.trolltech.com/3.3/qvalidator.html
    "Behind every great fortune lies a crime" - Balzac

  5. #5
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to limit the input text in QPlaintextedit?

    Quote Originally Posted by wagmare View Post
    means u want to limit the input entry below 1000 ..? if so use QValidator ..http://doc.trolltech.com/3.3/qvalidator.html
    how to use QValidator with QPlaintextedit???

Similar Threads

  1. read text from QPlainTextEdit
    By chs in forum Newbie
    Replies: 2
    Last Post: 21st November 2009, 12:07
  2. QPlainTextEdit and input filtering
    By paul.schwann in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2009, 11:03
  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. QPlainTextEdit reload text
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2009, 14:24
  5. Setting Max Limit in Text Box
    By kenny_isles in forum Newbie
    Replies: 4
    Last Post: 15th August 2007, 08:40

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.