Results 1 to 4 of 4

Thread: QLineEdit inputMask and validator

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4

    Default QLineEdit inputMask and validator

    I have a Widget with a LineEdit in it. Input of LineEdit must be restrict special symbol. I used inputMask to do this work.
    But, now I have trouble.
    Qt Code:
    1. ui->lineEdit->setInputMask("N");
    To copy to clipboard, switch view to plain text mode 
    The code above allow me to input only 1 character.
    Qt Code:
    1. ui->lineEdit->setInputMask("NNN");
    To copy to clipboard, switch view to plain text mode 
    The code above allow me to input only 3 character.

    Assumming, the lineEdit allow user input maxlength = 1000, so I have do this:
    Qt Code:
    1. ui->lineEdit->setInputMask("NNNNNNNNNNNNNNNNNN.......N (1000 times)");
    To copy to clipboard, switch view to plain text mode 
    Very stupid. Is there another way to avoid that. How can I solve ????)

  2. The following user says thank you to vhptt for this useful post:

    Hossein (1st September 2012)

Similar Threads

  1. QLineEdit validator
    By pobere in forum Newbie
    Replies: 2
    Last Post: 5th November 2011, 10:16
  2. set cursor position in qlineedit with an inputmask
    By guitar1 in forum Qt Programming
    Replies: 2
    Last Post: 11th March 2011, 17:13
  3. Replies: 2
    Last Post: 25th November 2010, 06:00
  4. Focus problem with QLineEdit and InputMask
    By ttvo in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2009, 13:57
  5. Replies: 10
    Last Post: 12th February 2009, 07:23

Tags for this Thread

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.