Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 QAbstractTableModel 进行了子类化并覆盖了 flags() 方法,以便某些表格单元格是可编辑的。问题是当我开始编辑时,现有的单元格值被删除了。我想最初选择现有的单元格值。我怎样才能做到这一点?
解决方案是在覆盖 data() 时处理 Qt::EditRole。我以前只处理 Qt::DisplayRole。