Results 1 to 3 of 3

Thread: extract item from QListWidget

  1. #1
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default extract item from QListWidget

    In Qt3 I had a QListView and
    Qt Code:
    1. connect( lbCurrentList, SIGNAL( selected( int ) ), this, SLOT( slotFromListBox( int ) ) );
    To copy to clipboard, switch view to plain text mode 
    Now I have a QListWidget in Qt4 and I want to extract either the index of an item or the item itself with a dbl mouse click on the item.

    I am overwhelmed by all the documentation.

    Help would be appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: extract item from QListWidget

    Use QListWidget::itemDoubleClicked( QListWidgetItem * item ) signal --- it will give you a pointer to the clicked item.
    Qt Code:
    1. connect( lbCurrentList, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ), this, SLOT( slotFromListWidget( QListWidgetItem* ) ) );
    To copy to clipboard, switch view to plain text mode 

    PS. QListWidget from Qt4 is an equivalent of QListBox from Qt3, you probably want to use QTreeWidget instead.

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

    impeteperry (13th May 2006)

  4. #3
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: extract item from QListWidget

    Thanks for very rapid responce, much appreciated.
    Will look at QTreeWidget as you suggest.

Similar Threads

  1. Help on QListWidget InternalMove item signal
    By tho97 in forum Qt Programming
    Replies: 3
    Last Post: 14th February 2009, 01:13
  2. QListWidget and selecting an item
    By invictus in forum Newbie
    Replies: 4
    Last Post: 19th June 2007, 11:59
  3. Replies: 1
    Last Post: 19th April 2007, 22:23
  4. Reg - add item in QListWidget
    By suresh in forum Newbie
    Replies: 1
    Last Post: 1st September 2006, 17:52
  5. keypress while editing an item in QListWidget
    By Beluvius in forum Qt Programming
    Replies: 3
    Last Post: 4th April 2006, 09:56

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.