Results 1 to 4 of 4

Thread: line edit mask problem

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

    Default line edit mask problem

    Hi all
    i've a line edit inwhich inputmask is 000.000.000.000. This lineedit will be used as ip input field. But i need that the disatance between "." should be equal. Ive attached a samplecode. plz tel me how to do.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2010
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: line edit mask problem

    You used QTextEdit where you should use QLineEdit. QLineEdit is better for this kind of input.
    The code you need is:
    Qt Code:
    1. ui->lineEdit->setInputMask("000.000.000.000;_");
    To copy to clipboard, switch view to plain text mode 
    All of this is documented in QT. Read about it in the documentation of QLineEdit.

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

    Default Re: line edit mask problem

    Quote Originally Posted by moosa View Post
    You used QTextEdit where you should use QLineEdit. QLineEdit is better for this kind of input.
    The code you need is:
    Qt Code:
    1. ui->lineEdit->setInputMask("000.000.000.000;_");
    To copy to clipboard, switch view to plain text mode 
    All of this is documented in QT. Read about it in the documentation of QLineEdit.
    Oh I'm sorry actually i've used a line edit in my project. but while disaplyaing that line edit i need to display the "." at equal distance. Herewith i've attached the sample code again Please check this. and tell me what should i changed. And also i dont want to show "_" in inputmask. I need empty space.



    Thank you .
    Attached Files Attached Files
    Last edited by sudhansu; 31st March 2010 at 07:13.

  4. #4
    Join Date
    Mar 2010
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: line edit mask problem

    Did you consider changing the QLineEdit font to a font with a fixed width? say "Courier New"?
    something like this:
    Qt Code:
    1. ui->lineEdit->setFont(QFont("Courier New"));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 19:06
  2. Assert problem in line edit
    By grsandeep85 in forum Qt Programming
    Replies: 19
    Last Post: 28th July 2009, 05:30
  3. Problem updating Line edit from a thread
    By raghvendramisra in forum Qt Programming
    Replies: 5
    Last Post: 3rd December 2007, 05:05
  4. Line Edit Controll problem
    By mansoorulhaq in forum Qt Programming
    Replies: 5
    Last Post: 31st October 2007, 08:33
  5. mask line edit
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 3rd July 2007, 10:27

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.