Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

remove display role in a tableview



  • Hi,everybody. Is it possible to remove the display role of a cell in tableview, while keeping the checkbox and the decoration role.



  • @Yue-JIN
    What does "remove the display role" mean? You can't stop e.g. Qt view code from asking for it from the model's data() method. Though you can return whatever you wish from there (e.g. ""?) if that's what floats your boat (and it doesn't have any unforeseen side-effects)....



  • Setting a null variant does the trick
    view->model()->setData(view->model()->index(row,column),QVariant(),Qt::DisplayRole);


Log in to reply