Results 1 to 3 of 3

Thread: replace string in QList<QStringList>

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question replace string in QList<QStringList>

    Good day,

    I created a functional matrix using a pointer to QList<QStringList>.
    I'm having a problem to exchange an item of my QStringList. I am trying:

    Qt Code:
    1. QString s = "test";
    2. listparc->at(0).replace(0, s);
    To copy to clipboard, switch view to plain text mode 

    The listparc is pointer to QList<QStringList>.

    But I error in the compilation:
    error: passing 'const QStringList' as 'this' argument of 'void QList<T>::replace(int, const T&) [with T = QString]' discards


    What is the best way to do that?

    Thanks
    Marcelo E. Geyer
    Brazil

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

    Default Re: replace string in QList<QStringList>

    Qt Code:
    1. QStringList slist = listparc->at(0);
    2. slist.replace(0, s);
    3. listparc->replace(0, slist);
    To copy to clipboard, switch view to plain text mode 

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

    hakermania (11th September 2011)

  4. #3
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: replace string in QList<QStringList>

    Yes, before this your hint, I find the solution, the same this.
    Thanks,

    Marcelo E. Geyer

Similar Threads

  1. Replies: 5
    Last Post: 10th January 2008, 14:26
  2. Reading from sockets in a multithreaded program
    By KoosKoets in forum Qt Programming
    Replies: 9
    Last Post: 4th April 2007, 21:43
  3. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 15:40
  4. string to char*?
    By nass in forum General Programming
    Replies: 3
    Last Post: 2nd January 2007, 16:47
  5. Create pixmap image from string
    By Morea in forum Qt Programming
    Replies: 5
    Last Post: 17th November 2006, 17:38

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.