Results 1 to 3 of 3

Thread: Tipical newbie question

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Talking Tipical newbie question

    Hi, I have a QStringList and I need to consult the string in a specified position various times (2 or 3 times). Do you think that's more eficient copying it in an auxiliar string variable or its fater consult the specified position in the list everytime because it doesn't need to do the copy?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,713
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Tipical newbie question

    1. Please use descriptive subjects - a "Tipical newbie question" does not describe any problem
    2. It will be faster to query the list directly.

  3. The following user says thank you to high_flyer for this useful post:

    Dark_Tower (24th March 2006)

  4. #3
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Tipical newbie question

    If you're only accessing the string two or three times, I wouldn't worry about it. But even if you do it a lot, QStringList is a QList, which is implemented internally as an array. There if very little overhead to calling mystringlist.at[n], for example. Sometimes I will use a reference to a QList item, for readability purposes, but it isn't necessary for efficiency.

  5. The following user says thank you to Brandybuck for this useful post:

    Dark_Tower (24th March 2006)

Similar Threads

  1. Y-Axis Scale Spacing - Newbie Question
    By Rick108 in forum Qwt
    Replies: 3
    Last Post: 13th October 2009, 08:20
  2. Newbie question about QT Eclipse integration.
    By akasi in forum Installation and Deployment
    Replies: 4
    Last Post: 18th September 2008, 09:51
  3. Newbie question regarding multi platform development
    By bronkopavel in forum Installation and Deployment
    Replies: 2
    Last Post: 15th September 2008, 10:08
  4. Newbie question about special characters in QLabel
    By WinchellChung in forum Newbie
    Replies: 4
    Last Post: 3rd April 2008, 21:39
  5. Replies: 1
    Last Post: 15th March 2007, 20:45

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.