문제

When using a QWidgetItem you can use the function: setDisabled() , to grey out a tree item.

I am struggling to figure out how to do this in the context of QTreeView and QAbstractItemModel ?

I have taken a look at all the qt.ItemDataRoles, but none jump out at me as the one used to disable an item.

Thanks for your help !

도움이 되었습니까?

해결책

This controlled by the flags method of the model. Disabled items don't have the ItemIsEnabled flag set. If you use a QStandardItemModel, the items have a setFlags method.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top