示例#1
0
QWidget * FEDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & option, const QModelIndex & index) const {
	//qDebug("FEDelegate::createEditor");

	if (index.column() == COL_FILE) {
		FileChooser * fch = new FileChooser(parent);
		fch->setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::DontResolveSymlinks); // Crashes if use the KDE dialog
		fch->setText( index.model()->data(index, Qt::DisplayRole).toString() );
		return fch;
	} 
	else 
	if (index.column() == COL_NAME) {
		QLineEdit * e = new QLineEdit(parent);
		e->setText( index.model()->data(index, Qt::DisplayRole).toString() );
		return e;
	}
	else {
		return QItemDelegate::createEditor(parent, option, index);
	}
}