Nek*_*nto 37
到subclussing替代QItemDelegate是继承你的模型和覆盖data()方法.
QVariant MyModel::data(const QModelIndex& index, int role) const {
if (index.column() == yourCellIndex && role == Qt::TextAlignmentRole) {
return Qt::AlignLeft;
} else {
return QAbstractTableModel::data(index, role);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23338 次 |
| 最近记录: |