Results 1 to 4 of 4

Thread: How to create line edit or text edit box similar to "Setting IP address in Windows"

  1. #1
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    1

    Default How to create line edit or text edit box similar to "Setting IP address in Windows"

    I have to create a box which will accept text in the form of IP address that is it should show " . . . " at the opening and then it should accept IP address from the user in the form of 192.168.23.54 where it should be in the range of 0 to 255.Anybody having any idea regarding this then please help me....Thank you in advance

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to create line edit or text edit box similar to "Setting IP address in Windo

    Method 1: Use a mask on a QLineEdit
    Method 2: Use four QLineEdit's and have the '.'s as QLabels
    Method 3: Subclass QLinEdit and override paintEvent to nicely align the ip address (you can also do the validation in the subclass too)

    If you want to allow copy/paste of the ip address, you should rule out method 2, but thats the way Windows IP control works (tab doesn't work properly there either).

  3. #3
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    1

    Default Re: How to create line edit or text edit box similar to "Setting IP address in Windo

    Thanx for your help...I have done it using multiple line edit but now i want one more thing that is when three digits are input by user then the cursor should automatically go to next line edit....Can any one help me regarding that.

  4. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to create line edit or text edit box similar to "Setting IP address in Windo

    You could connect to "textChanged()". If 3 digits were entered set the focus to the next QLineEdit.

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. Replies: 1
    Last Post: 1st May 2010, 23:03
  3. Replies: 0
    Last Post: 22nd January 2009, 18:15
  4. Replies: 8
    Last Post: 15th May 2007, 09:21
  5. Can I edit a two - rows "start" menu like XP ?
    By bigbigmoon in forum Newbie
    Replies: 2
    Last Post: 11th September 2006, 01:43

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.