Results 1 to 9 of 9

Thread: QListWidget selected item Row id.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QListWidget selected item Row id.

    Qt Code:
    1. tagidnames.append(QString("TAGID_%1").arg(NewLISTLW->row((const QListWidgetItem *)item1)));
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: QListWidget selected item Row id.

    hello sir i compiled the code but i don't get the desired out put in QDebug..
    this is what i am getting in case i selected name1 to name3 and name5 to name7 ..
    Qt Code:
    1. QVector("TAGID_-1", "TAGID_-1", "TAGID_-1", "TAGID_-1", "TAGID_-1", "TAGID_-1", "TAGID_-1")
    To copy to clipboard, switch view to plain text mode 

    sir i read in qt assistant , i think we won't get the actual row value from this

    QList<QListWidgetItem *> QListWidget::selectedItems () const
    Returns a list of all selected items in the list widget
    since i am coping all selected list from the NewLISTLW, can i get the actual index pointer so that i can use that to print the TAGID_ for the relevant selected sequence in the List.
    QList<QListWidgetItem *>item = NewLISTLW->selectedItems();
    thank you
    Last edited by nagabathula; 20th December 2010 at 16:48.

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QListWidget selected item Row id.

    Try this:
    Qt Code:
    1. tagidnames.append(QString("TAGID_%1").arg(NewLISTLW->row(item.at(kfast))));
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. The following user says thank you to high_flyer for this useful post:

    nagabathula (20th December 2010)

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

    Default Re: QListWidget selected item Row id.

    thank you so much sir.. problem is solved this worked.. i think i understand what we are doing here.. but i din't understand the previous suggestion.
    thanks for your time you helped me solve my problem..

    Regards

Similar Threads

  1. popupmenu for QTreeWidget's item when a particular item selected.
    By vinod sharma in forum Best Practices in Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 10:45
  2. Replies: 1
    Last Post: 20th January 2010, 08:38
  3. How to set selected item of a QListWidget?
    By Lawand in forum Qt Programming
    Replies: 9
    Last Post: 5th April 2009, 11:23
  4. Replies: 1
    Last Post: 5th June 2008, 14:02
  5. QListWidget/QTreeWidget, etc selected item color
    By Arthur in forum Qt Programming
    Replies: 4
    Last Post: 15th May 2006, 16:50

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.