Results 1 to 4 of 4

Thread: A list of qstring

  1. #1
    Join Date
    Jun 2009
    Posts
    44
    Qt products
    Qt4
    Platforms
    Windows

    Default A list of qstring

    Hey,

    I'm trying to do a list of strings. I have added the strings like this:

    QList <QString> list;
    list.insert(0,"text0");
    list.insert(1,"text1");
    list.insert(2,"text2");
    list.insert(3,"text3");
    list.insert(4,"text4");
    list.insert(5,"text5");
    list.insert(6,"text6");
    list.insert(7,"text7");
    list.insert(8,"text8");
    list.insert(9,"text9");

    Now in depends on what number I introduce, i have to see in a text Edit, one text of the string of another.
    to get this i have done the following one,but it doesn't work:

    ui.textEdit->show(list.at[0]);

    do you know why?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: A list of qstring

    Try calling QTextEdit::setPlainText() instead of show().
    (Who/what suggested you to use show()? Show() does not take an argument and just tells the (any) widget to become visible. See the docs of QWidget and QTextEdit for details.)

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: A list of qstring

    and better use QStringList instead of QList<QString>

  4. #4
    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: A list of qstring

    Quote Originally Posted by MrDeath View Post
    and better use QStringList instead of QList<QString>
    ...only if you really need some functions provided by QStringList (and not by QList itself). If not there is no need for that since QStringList inherits QList<QString>...

Similar Threads

  1. Qy 4.4.3 MySQL driver failed
    By pamalite in forum Installation and Deployment
    Replies: 2
    Last Post: 23rd January 2010, 01:09
  2. File rename detection
    By bunjee in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2009, 15:22
  3. Replies: 12
    Last Post: 22nd March 2009, 11:22
  4. Replies: 1
    Last Post: 22nd October 2007, 02:04
  5. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59

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.