Results 1 to 5 of 5

Thread: SetSelection QListView Pyqt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Unix/X11 Windows

    Default SetSelection QListView Pyqt

    Hi, All.

    My name is Chez, I'm new here and this is my first post on these forums, so hope the newbie section is the correct place...I'm an absolute beginner with QT as well.

    I'm using pyqt with Python 2.6 in a deb environment.

    Short Question: How do I select an item in a single column QListView class using setSelection...

    Some details:

    I have a QListView class called listBox. I fill the QlistView with a model (simple list of one column data) called listModel...this is made up of a pure python list.

    I have a python class for my list handling, of which one of the methods deletes multiple occurrences of items in the list. On the pyqt side I am using a Signal for changing selection :

    self.connect(self.listBox.selectionModel(),SIGNAL( "selectionChanged(QItemSelection, QItemSelection)"),self.slot)

    and a method called slot...this is all ok...

    However, long story short, what I want to be able to do is change the selected item in the QListView class listBox after I have deleted items from the model. I have looked at setSelection but I really have no clue what I am doing here, so any help would be useful.


    List = [One, Two, One, Two, Three, One]

    I want to via code select any item in the list....so that it is highlighted.

    Thanks for any help you can provide.

    p.s. A definitive example would be appreciated...
    Last edited by Chez; 28th June 2010 at 18:08. Reason: updated contents

Similar Threads

  1. lineEdit's setSelection - How to show more text?
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 30th January 2010, 17:22
  2. QLibrary in PyQt
    By Urthas in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2009, 18:46
  3. PyQt : Signal like this
    By prashant in forum Qt Programming
    Replies: 5
    Last Post: 2nd October 2009, 20:03
  4. PyQt
    By helvin in forum Newbie
    Replies: 1
    Last Post: 15th April 2009, 08:56
  5. setSelection() in custom view
    By krudio in forum Qt Programming
    Replies: 13
    Last Post: 6th February 2008, 20:03

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.