Important: Please read the Qt Code of Conduct -

CheckBox in QTableView with custom model

  • Hi!

    I am creating my custom model for QTableView. I want one column to be checkable. I have implemented
    flags function:
    if (index.column()==0) return QAbstractTableModel::flags(index)|Qt::ItemIsUserCheckable|Qt::ItemIsEditable;
    also I have implemented data funtion:
    else if (role==Qt::CheckStateRole)
    if (index.column()==Name) return Qt::Checked;

    But i still don't see checkboxes in QTableView in my "Name" column. Any ideas?

Log in to reply