这里也发现这个问题了。不知道是不是函数真的有问题。
http://trolltech.com/developer/task-tracker/index_html?id=132870+&method=entry132870 - setItemDelegateForColumn does not work
DescriptionsetItemDelegateForColumn and tableView.setItemDelegateForRow does not work.
Reproducible with the qspinbboxdelegate example and replacing the main function with:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStandardItemModel model(4, 2);
QTableView tableView;
tableView.setModel(&model);
SpinBoxDelegate delegate;
//does not set a spin box delegate for colum or row
tableView.setItemDelegateForColumn(2,&delegate);
tableView.setItemDelegateForRow(2,&delegate);
//this does work as expected
// tableView.setItemDelegate(&delegate);
tableView.setWindowTitle(QObject::tr("Spin Box Delegate"));
tableView.show();
return app.exec();
}