Results 1 to 7 of 7

Thread: QString resize() or count()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QString resize() or count()

    Wait a second,are you transmitting data from your device to the database or what? I mean,i don't quite understand succession of actions you take in the code snippet you've shared

    And btw,there is no need to call me (is it?) sir,that's kinda weird

  2. #2
    Join Date
    Nov 2010
    Posts
    100
    Thanks
    38
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: QString resize() or count()

    hello, i am actually receiving data from a embedded system on rs232 which i am retrieving and saving it into sq-lite db. once it is saved i am retrieving back the data from the bulkdb table in which it is present, for data alignment so that i have the actual channel data from the frame which i receive.. Everything is fine, when i retrieve back data the frame id is removed properly but by the time 2nd row in the db starts there is miss in the count and the data is not aligned properly.. so i though i will restrict the size of the QString to hold exactly 2944 chars, One Master frame has so many chars i.e Channel data with Frame id. So that i will have exactly one master frame data every time i do this frame id removing for one whole master frame.

    Qt Code:
    1. datstr.resize(2944);
    2. for(int j = 0; j < rowdata.count(); j++)
    3. datstr.append(rowdata.at(j));
    4.  
    5. newdat.append(datstr.mid(posi, 80));
    6. posi+=92;
    To copy to clipboard, switch view to plain text mode 
    datstr.clear();

    but this code does't help me , after the first row of data aligning there is a problem..

    thank you

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

    Default Re: QString resize() or count()

    You shouldn't be using QString. Use QByteArray instead. QString is for textual Unicode encoded data.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following user says thank you to wysota for this useful post:

    nagabathula (29th December 2010)

Similar Threads

  1. Count number of Characters
    By TJSonic in forum Newbie
    Replies: 7
    Last Post: 14th November 2010, 20:39
  2. QThread count in Qt applications.
    By hashimov in forum Qt Programming
    Replies: 21
    Last Post: 22nd October 2010, 13:41
  3. [QGLWidget] Count FPS
    By Macok in forum Qt Programming
    Replies: 0
    Last Post: 13th April 2009, 14:01
  4. Replies: 4
    Last Post: 31st January 2008, 20:44
  5. Replies: 2
    Last Post: 22nd January 2008, 16:10

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.