QWidget* EditDelegate::createEditor(
QWidget* parent,
const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
QLineEdit* editor = NULL;
if(index.isValid())
{
editor->resize(50,1000); //this can not work in win7
}
return editor;
}
EditDelegate是QItemDelegate的子类 你们怎么看待这个问题?
答案 0 :(得分:0)
声明QLineEdit
指针后,需要创建类的实例
if(index->isValid()) {
editor = new QLineEdit();
editor->resize(50, 1000);
}