Results 1 to 3 of 3

Thread: QListWidget Insert Items

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Qt products
    Qt4 Qt5
    Platforms
    Windows
    Thanks
    92
    Thanked 16 Times in 16 Posts

    Default Re: QListWidget Insert Items

    wallacesoh

    In class .h file, instead of
    Qt Code:
    To copy to clipboard, switch view to plain text mode 
    do this,
    Qt Code:
    1. QList<QListWidgetItem*> item;
    To copy to clipboard, switch view to plain text mode 
    In .cpp file, do this
    Qt Code:
    1. for(int i = 0; i < strList.size(); i++)
    2. {
    3. item.append(new QListWidgetItem());
    4. ....
    5. ....
    6. }
    7. // Access the item using at operator like this item.at(i);
    To copy to clipboard, switch view to plain text mode 
    This way, you can add QListWidgetItems dynamically without need to predefine the number of items.
    Last edited by rawfool; 24th February 2014 at 07:51.

Similar Threads

  1. Replies: 4
    Last Post: 5th June 2013, 16:24
  2. Replies: 2
    Last Post: 1st April 2011, 10:32
  3. How to insert QProgressbar in a QListWidget?
    By mismael85 in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2010, 07:54
  4. how to insert items in tableWidget
    By roncriss in forum Newbie
    Replies: 3
    Last Post: 24th July 2010, 18:10
  5. Insert an item in an horizontal QListWidget
    By satoshi in forum Qt Programming
    Replies: 8
    Last Post: 19th May 2009, 18:33

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.