Where does role variable for setData() functions get determined? (for debugging)
-
Please correct me if i'm wrong. From what i've figured out so far, it seems to me that the Qt::ItemFlags returned by the flags() function determine the role for the setData() function. As a result setData() not receiving Qt::CheckStateRole indicates that something's wrong with the flags() function. Is this correct?
If so, how could i possibly debug this.
-
@andi456 said in Where does role variable for setData() functions get determined? (for debugging):
result setData() not receiving Qt::CheckStateRole indicates that something's wrong with the flags() function. Is this correct?
No. Flags don't have something to do with setData().
When you want to have a user-checkable checkbox in your view, flags() has to return Qt::ItemIsUserCheckable and data() should return something meaningful for Qt::CheckStateRole.
-
@andi456 said in Where does role variable for setData() functions get determined? (for debugging):
result setData() not receiving Qt::CheckStateRole indicates that something's wrong with the flags() function. Is this correct?
No. Flags don't have something to do with setData().
When you want to have a user-checkable checkbox in your view, flags() has to return Qt::ItemIsUserCheckable and data() should return something meaningful for Qt::CheckStateRole.
@Christian-Ehrlicher Well, maybe I expressed myself a little bit clumsily, but it was indeed my implementation of the flags() function which caused the problem - a momentary lapse of reason, so to say. If i understand you correctly, then there's one more step involved: from flags() to data() to setData().