Results 1 to 4 of 4

Thread: set a regular expression on QTextEdit

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default set a regular expression on QTextEdit

    Hello, is there a way to set a regular expression on QTextEdit?
    I'd like to set a maximum row number as row limit of text entred by the user.
    Is it possible?
    thx
    Last edited by mattia; 27th March 2008 at 08:35.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: set a regular expression on QTextEdit

    From QTextEdit docs:
    If you want to limit the total number of paragraphs in a QTextEdit, as it is for example open useful in a log viewer, then you can use QTextDocument's maximumBlockCount property for that.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    mattia (27th March 2008)

  4. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: set a regular expression on QTextEdit

    but if i want to allow the user to entry just, for example, 50 characters...is there a way?

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: set a regular expression on QTextEdit

    You can always override keyPressEvent() and call the base class implementation only if certain condition is fulfilled.
    J-P Nurmi

Similar Threads

  1. Regular Expression for QDate [YYYY/MM/DD] format
    By bera82 in forum Qt Programming
    Replies: 6
    Last Post: 3rd August 2019, 09:40
  2. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  3. Regular expression in QLineEdit?
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 1st October 2007, 10:58
  4. Find with Regular Expression?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2007, 14:44
  5. How to get a QString from a file (use regular expression)
    By fengtian.we in forum Qt Programming
    Replies: 16
    Last Post: 31st May 2007, 11:06

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.