Results 1 to 4 of 4

Thread: QSortFilterProxyModel disables mouse clicking

  1. #1
    Join Date
    Dec 2016
    Posts
    37
    Qt products
    Qt5
    Platforms
    Windows

    Default QSortFilterProxyModel disables mouse clicking

    I've subclassed QSortFilterProxyModel to sort QTreeView. This works fine except when I click on various rows/columns
    of child items in the QTreeView, the clicks are not processed anymore.

    I say anymore because if I take out the sorting code and not use the custom class, the clicks are processed correctly.

    Any ideas?

    Sorry, cannot post the code as it is part of a bigger project.

    n

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSortFilterProxyModel disables mouse clicking

    Any ideas?
    If you are calling QTreeView::setModel() with the proxy model -after- calling QTreeView::setSelectionModel(), the selection model will be replaced with the tree view's default selection model. Reverse the order in which the two methods are called.

    You must also ensure that the QTreeView and QItemSelectionModel are both using the proxy as their source models.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Dec 2016
    Posts
    37
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSortFilterProxyModel disables mouse clicking

    I’ve solved this issue, but I’m running into another issue.

    When I click on a child entry in my tree view, the clicked signal for the tree view sends in the parent’s model index rather than the index of the child that was clicked on. I know this because when I try to get the child data I end up getting the parent data.

    Any idea what’s going on?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSortFilterProxyModel disables mouse clicking

    Any idea what’s going on?
    Why don't you try using the debugger to track what is happening? None of us here are very good at diagnosing code problem when there is no code to diagnose.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. WebView disables touch on entire application
    By JackCity63 in forum Qt Quick
    Replies: 0
    Last Post: 25th September 2015, 18:57
  2. Frame in Designer Disables Enclosed Widgets
    By Henry Blue Heeler in forum Newbie
    Replies: 2
    Last Post: 13th January 2014, 17:12
  3. get to focus with mouse on a GLWidget without clicking
    By yoti13 in forum Qt Programming
    Replies: 4
    Last Post: 29th December 2012, 06:00
  4. Replies: 3
    Last Post: 29th May 2008, 13:50
  5. setting widget as modal, disables button
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2006, 09:49

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.