Results 1 to 3 of 3

Thread: QListWidget string increment

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    100
    Thanks
    38
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default QListWidget string increment

    Hello, i am trying to populate a QListWidget with the names Somename_1 to Somename_300.. But the problem is the names start with Somename_300 and decrement down to Somename_1 in the QListWidget.. How can i make it insert from Somename_1 and increment to Somename_300.
    Qt Code:
    1. for( int i=0 ; i<300; i++ )
    2. {
    3. listWidgetdata += QString("SOmename_%1").arg(i) + (i==299 ? "" : "");",");
    4. }
    5. for(int j=0; j < listWidgetdata.count();j++)
    6. {
    7. QListWidgetItem(item[kfast]->text());
    8. ParamsLW->insertItem(kfast,listWidgetdataat(j)); // kfast =0; at the start of the program
    9. ksast++;
    10. }
    To copy to clipboard, switch view to plain text mode 
    ParamsLW is the object name for the QListWidget.
    what is going wrong why is the counter starting the names from 300 instead of 1.

    thank you
    Last edited by nagabathula; 20th December 2010 at 06:45.

Similar Threads

  1. Increment and Decrement Program
    By priya in forum Qt Programming
    Replies: 3
    Last Post: 3rd February 2010, 13:27
  2. QSqlQuery: Getting an Auto Increment value
    By Al_ in forum Qt Programming
    Replies: 3
    Last Post: 23rd December 2009, 22:15
  3. std:string how to change into system:string?
    By yunpeng880 in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2009, 08:51
  4. Replies: 4
    Last Post: 9th May 2008, 17:02
  5. Custom spinner - fast increment/decrement
    By MrGarbage in forum Qt Programming
    Replies: 2
    Last Post: 11th October 2007, 17: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.