Results 1 to 2 of 2

Thread: list of strings in a namespace

  1. #1
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default list of strings in a namespace

    Hi,

    I would like to have (any kind of) a predefined list of strings in a namespace. The purose would be that it should be iterated e.g. to see what we have. I could use an array but in that case I can't tell safely how long it is. If I want to use eg. QStringList or the list<T> from the STL than I cannot fill it with the wanted values because there is no such constructor.

    So this one works:
    namespace myn
    {
    QString qs[] = {"first","second"};
    }
    but I cannot get the info how large my array is. What can I use instead?
    Szilvi

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: list of strings in a namespace

    Untested but should work:
    Qt Code:
    1. QStringList list = QStringList() << "foo" << "bar";
    To copy to clipboard, switch view to plain text mode 

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

    szisziszilvi (5th August 2011)

Similar Threads

  1. Replies: 5
    Last Post: 19th July 2011, 12:31
  2. QTM namespace
    By Aman607 in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2011, 08:00
  3. QTest Namespace
    By chandan in forum Newbie
    Replies: 2
    Last Post: 4th October 2010, 09:45
  4. QTSoapMessage namespace
    By ken123 in forum Qt Programming
    Replies: 0
    Last Post: 26th July 2010, 21:36
  5. namespace problem
    By mhoover in forum Qt Programming
    Replies: 4
    Last Post: 11th July 2006, 22: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.