| | |
| | | #include <QFileDialog> |
| | | #include <QDebug> |
| | | |
| | | #pragma execution_character_set("utf-8") |
| | | |
| | | FileDialogDelegate::FileDialogDelegate(QObject *parent):QItemDelegate(parent) |
| | | { |
| | | |
| | | } |
| | | |
| | | QWidget *FileDialogDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| | | { |
| | | QFileDialog *fd = new QFileDialog(parent); |
| | | return fd; |
| | | } |
| | | //QWidget *FileDialogDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| | | //{ |
| | | // QFileDialog *fd = new QFileDialog(parent); |
| | | // return fd; |
| | | //} |
| | | |
| | | void FileDialogDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| | | { |
| | |
| | | { |
| | | QString fn = ((QFileDialog *)editor)->getOpenFileName(); |
| | | qDebug()<<index<<fn; |
| | | index.model()->setData(index,fn); |
| | | //index.model()->setData(index,fn); |
| | | model->setData(index,fn); |
| | | } |
| | | |
| | | void FileDialogDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const |