Results 1 to 5 of 5

Thread: SetSelection QListView Pyqt

Hybrid View

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

    Default Re: SetSelection QListView Pyqt

    Ok, guys, thanks for the pointers, but I managed it a few hours back. Another look at the online manuals, which, take note OT developers, are not as easy to follow as an ageing programmer would like, and I found the solution, simple really:

    1. Create a QModelIndex for your model
    index = self.listModel.index(0, 0, QModelIndex())

    Use the QModelIndex as the first argument to a select for you selectionModel, which can either be the default selection model or another instantiation that can be passed to other views...and then use the same selection model as the second argument but with the Select method...
    2. self.mySelectionModel.select(index, self.mySelectionModel.Select );

    That's a selection I won't forget.

  2. The following user says thank you to Chez for this useful post:

    fschober (25th March 2020)

Similar Threads

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