Results 1 to 2 of 2

Thread: CheckStateRole and TriState

  1. #1
    Join Date
    Jun 2012
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: CheckStateRole and TriState

    Qt 4.7.3
    PySide 1.1.0

    My QTreeView has a QSortFilterProxyModel and in the flags I've added ItemIsUserCheckable and ItemIsTristate. When the tree displays, it displays correctly, some boxes are unchecked, some checked, and some partially checked.

    Problem: When clicking through a checkbox's states, it will successfully go from partially checked, to checked and from checked to unchecked. However, when clicking an unchecked box, the setData method prints that is is trying to set a QtCore.Qt.Checked value instead of partially checked. Therefor I am unable to set an item back to a partially checked state.

    What would prevent the click from sending a partiallychecked value in the signal?


    Added after 1 13 minutes:


    To answer my own question (again), I had to browser the API for QAbstractButton and found this in the nextCheckState method:

    This virtual handler is called when a button is clicked. The default implementation calls setChecked(!isChecked()) if the button isCheckable(). It allows subclasses to implement intermediate button states.
    So I merely have to implement the setData method to accommodate.
    Last edited by BreakBad; 6th September 2013 at 19:54.

  2. #2
    Join Date
    Sep 2013
    Location
    Portugal
    Posts
    1
    Thanked 1 Time in 1 Post

    Default Евгений Удод


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

    neuronet (18th July 2014)

Similar Threads

  1. tristate
    By mickey in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2014, 09:37
  2. CheckStateRole: multiple checkstates and click events
    By BreakBad in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2012, 06:27
  3. Replies: 6
    Last Post: 12th March 2012, 10:06
  4. Tristate Flag ignored in QListWidgetItem
    By ghoust26 in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2008, 08:21

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.