Results 1 to 10 of 10

Thread: Problem retrieving data from class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Problem retrieving data from class

    would changing it to QStringList work?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Problem retrieving data from class

    Maybe, but that depends on your requirement; do you want one string containing all the ids joined together, or a list of ids?

  3. #3
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Problem retrieving data from class

    a list of ID's there will be others added to another list containing picture file names as strings so a list would be perfect

    so in the list i would like

    ID 1
    ID 2
    ID 3
    ID 4

    and another list

    file1.png
    file2.png
    file3.png
    file4.png

    EDIT

    I have a QMap why not use a QMapIterator but how would i iterate over in taxi.cpp ?
    Last edited by prophet0; 4th March 2012 at 01:58.

  4. #4
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Problem retrieving data from class

    Any suggestions ? been on youtube and google for the past few days

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Problem retrieving data from class

    Your initial problem; use a QStringList as the return value of getClientID() and type of sClientID, and QStringList::append() or operator<<() at line 119 of the parse.cpp listing.

  6. #6
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Problem retrieving data from class

    Well awesome its working so far

    Qt Code:
    1. QStringList sClientIdData;
    2. sClientIdData = _myParse->getClientID();
    3.  
    4. for ( QStringList::Iterator it = sClientIdData.begin(); it != sClientIdData.end(); ++it )
    5. {
    6. qDebug() << *it;
    7. }
    To copy to clipboard, switch view to plain text mode 

    output

    Qt Code:
    1. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    2. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    3. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    4. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    5. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    6. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    7. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    8. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    9. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    10. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    11. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    12. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    13. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    14. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    15. "3bddfb03c36b4221eee8ff59dd2f5d7e.avi"
    16. "fb0648859ad59e6c954a042376a054e4.avi"
    17. "fb0648859ad59e6c954a042376a054e4.avi"
    18. "fb0648859ad59e6c954a042376a054e4.avi"
    19. "fb0648859ad59e6c954a042376a054e4.avi"
    20. "fb0648859ad59e6c954a042376a054e4.avi"
    21. "fb0648859ad59e6c954a042376a054e4.avi"
    22. "fb0648859ad59e6c954a042376a054e4.avi"
    23. "fb0648859ad59e6c954a042376a054e4.avi"
    24. "fb0648859ad59e6c954a042376a054e4.avi"
    25. "fb0648859ad59e6c954a042376a054e4.avi"
    26. "fb0648859ad59e6c954a042376a054e4.avi"
    27. "fb0648859ad59e6c954a042376a054e4.avi"
    28. "fb0648859ad59e6c954a042376a054e4.avi"
    29. "fb0648859ad59e6c954a042376a054e4.avi"
    30. "fb0648859ad59e6c954a042376a054e4.avi"
    31. "fb0648859ad59e6c954a042376a054e4.avi"
    32. "fb0648859ad59e6c954a042376a054e4.avi"
    33. "fb0648859ad59e6c954a042376a054e4.avi"
    To copy to clipboard, switch view to plain text mode 

    there are only 2 files but duplicated ? why is this doing that ?

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Problem retrieving data from class

    Single step through your code in your debugger. It will be far more informative than us guessing.

  8. #8
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Problem retrieving data from class

    I add a break point in line #4 of message #8 of this thread and the output for loop is making it add 33 items to the QStringlist

    going to try another way will report back what i am able to accomplish


    Added after 33 minutes:


    Well it was because i was using a while loop and it kept running and running so i think my problem is solved and learned a valuable lesson using loops :P thanks again
    Last edited by prophet0; 11th March 2012 at 08:14.

Similar Threads

  1. Replies: 4
    Last Post: 7th April 2010, 23:09
  2. Data class concept
    By qtDave in forum General Programming
    Replies: 2
    Last Post: 19th December 2009, 09:41
  3. Many Data Memebers For a Class
    By MIH1406 in forum Qt Programming
    Replies: 2
    Last Post: 22nd September 2009, 20:00
  4. QT Class to decode PDU data
    By cutie.monkey in forum Newbie
    Replies: 0
    Last Post: 4th July 2009, 05:52
  5. default on class' public data
    By baray98 in forum General Programming
    Replies: 2
    Last Post: 29th July 2008, 02:04

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.