Results 1 to 2 of 2

Thread: get ASCII equivalent data

  1. #1
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default get ASCII equivalent data

    Dear All,
    In my application i need to get the data in ascii format if user types string prefixed by '\' in QLineEdit.

    Ex: if user press '\002' then ASCII equivalent is STX(start of text). which is also equivalent 0x02.

    if user enters normal text, then it should return same.
    Can anyone tell me how can resolve this.???

    How can i achieve this
    Last edited by navi1084; 25th June 2009 at 12:42.

  2. #2
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: get ASCII equivalent data

    I presume that you want to process the data after the QLineEdit object has lost focus.

    If this is the case then I would get the stream of chars input and parse it.

    If line is your QLineEdit Object,
    QString lineData = line.text();
    Recursively look for \ in lineData and if found then parse from there till you find a non numeric character. That process will give you the substring you are looking for.

    To parse you can use lineData.indexOf(QChar('\\')). If found , it will give you the position or -1 if not found.

    Good luck.

Similar Threads

  1. data rate transfer is decreasing in TCP connection
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 16:15
  2. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 22:46
  3. Replies: 7
    Last Post: 29th August 2008, 10:24
  4. Replies: 4
    Last Post: 19th October 2007, 19:47
  5. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53

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.