Results 1 to 8 of 8

Thread: clearing a list.....

  1. #1
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default clearing a list.....

    after clearing a list cant i append new items next tim???

  2. #2
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: clearing a list.....

    you can... Create items using QTableWidgetItem and create a row using insertRow() and set the items.

  3. #3
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: clearing a list.....

    nooo i m askin about a Qlist....not table....

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: clearing a list.....

    yes you can.
    try this
    Qt Code:
    1. ...
    2. QList<int> ints;
    3. ints << 1 << 2 << 3;
    4. qDebug() << ints;
    5. ints.clear();
    6. ints << 4 << 5 << 6;
    7. qDebug() << ints;
    8. ...
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    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: clearing a list.....

    Quote Originally Posted by reshma View Post
    after clearing a list cant i append new items next tim???
    Of course you can!
    Qt Code:
    1. QList<int> list;
    2. list << 1 << 2 << 3;
    3. qWarning() << list; // (1, 2, 3)
    4. list.clear();
    5. list << 4 << 5;
    6. qWarning() << list; // (4, 5)
    To copy to clipboard, switch view to plain text mode 
    Where's the problem?

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: clearing a list.....

    Quote Originally Posted by Lykurg View Post
    Of course you can!
    Qt Code:
    1. QList<int> list;
    2. list << 1 << 2 << 3;
    3. qWarning() << list; // (1, 2, 3)
    4. list.clear();
    5. list << 4 << 5;
    6. qWarning() << list; // (4, 5)
    To copy to clipboard, switch view to plain text mode 
    Where's the problem?
    cool! almost the same code.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    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: clearing a list.....

    Reminds me of the german saying "Zwei Dumme, ein Gedanke." (In English it is I think: Great minds think alike.)...

  8. #8
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: clearing a list.....

    okay got it...

    well i use append function as my QList is like this...
    QList<QPair<QString, int> > instructionList; to add items...i hope its correct

Similar Threads

  1. QFtp hidden files/folder's list
    By jay in forum Qt Programming
    Replies: 1
    Last Post: 26th December 2008, 12:12
  2. Replies: 2
    Last Post: 19th September 2008, 05:21
  3. Single slot for multiple list boxes
    By Sheetal in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 06:53
  4. Replies: 1
    Last Post: 22nd October 2007, 02:04
  5. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25

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.