Results 1 to 5 of 5

Thread: string handling

  1. #1
    Join Date
    Mar 2006
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default string handling

    Hi All

    I am vijay very new to QT , using Vs 2005 with Qt 4. What i want is , I should enter email Id and password in the text fields. But it should be

    Username (email address): 128bytes up to the @ and 128 bytes after the @
    Password: 128 bytes

    this is simple one, but really i dont know what to do. Can you help me

    Thanks and regards
    vijay

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: string handling

    I suggest that you use a regular expression using the QRegExp class.

  3. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: string handling

    Quote Originally Posted by vijay anandh
    Hi All

    I am vijay very new to QT , using Vs 2005 with Qt 4. What i want is , I should enter email Id and password in the text fields. But it should be

    Username (email address): 128bytes up to the @ and 128 bytes after the @
    Password: 128 bytes
    let me get this right, you want to restrict the size of your input or you want to check the validity of the input (use QRegExp as said above for validation)

    this is what you can do :
    Qt Code:
    1. QString username=user_name_lineEdit->text(); //get text into the string
    2. int size=username.size();
    To copy to clipboard, switch view to plain text mode 

    but is this what you want? I request you to be more clear with your requirements

    Nupul

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: string handling

    You can restrain the size with a regexp too... Something like that should be used as a validator: QRegExp(".{1,128}@.{1,128}").

  5. #5
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: string handling

    You also can use simpler way: use 3 lineedits(username,domain,pass),with setting needed maxLenght for everyoen.Look in the attachment
    Attached Images Attached Images
    • File Type: png 1.png (2.1 KB, 3 views)
    a life without programming is like an empty bottle

Similar Threads

  1. Replies: 0
    Last Post: 18th February 2009, 13:31
  2. String operations, printing to stdout
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 20th January 2009, 15:30
  3. Reading from sockets in a multithreaded program
    By KoosKoets in forum Qt Programming
    Replies: 9
    Last Post: 4th April 2007, 20:43
  4. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 14:40
  5. Create pixmap image from string
    By Morea in forum Qt Programming
    Replies: 5
    Last Post: 17th November 2006, 16:38

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.