Results 1 to 3 of 3

Thread: QSortFilterProxyModel and custom QTreeView-class - selectionChanged not working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QSortFilterProxyModel and custom QTreeView-class - selectionChanged not working

    Hi!

    I have an issue that manifested after changing from using a custom QAbstractItemModel directly, to using QSortFilterProxyModel as a proxy model.
    Now in my custom QTreeView class the reimplemented function "selectionChanged" is never called. This is a new behavior...
    Sorting of my data works at least...
    Also none of the rows in my TreeView are highlighted when I click on them.

    I tried to create a new QItemSelectionModel, setting it to the TreeView and connecting it to a slot I created. But that also didn't work...

    Can it be something I may have forgotten?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel and custom QTreeView-class - selectionChanged not working

    Selection should work independently of the model as long as the item flags allow selection.

    Cheers,
    _

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

    Fenzor (21st October 2016)

  4. #3
    Join Date
    Oct 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel and custom QTreeView-class - selectionChanged not working

    Thanks for the reply!
    It didn't seem like the issue was with my flags. But it made me try to look a little harder at my code.
    I tried to rewrite some of the code and it magically worked...
    Probably something that I missed the first time around.

    Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 7th November 2014, 15:47
  2. Replies: 0
    Last Post: 18th July 2010, 17:53
  3. QSortFilterProxyModel and QTreeView
    By PrimeCP in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2009, 11:50
  4. selectedIems() not working with QSortFilterProxyModel
    By patcito in forum Qt Programming
    Replies: 2
    Last Post: 14th July 2006, 03:54
  5. QSortFilterProxyModel & QTreeView
    By Bear in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 16:04

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.