有没有这样做,而不使用QItemDelegate?我一直有很多麻烦。例如,如果我使用委托人:当试图编辑QTableView中的单元格时调用QFileDialog
- 不会有本机对话框。
- 我会实现我自己的图像预览,
出于某种原因,我不能改变窗口大小的原因setGeometry不工作,等等等等
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const { Q_UNUSED(option); Q_UNUSED(index); QFileDialog* editor = new QFileDialog(parent); editor->setFilter("*.png"); editor->setDirectory(mResources); editor->setGeometry(0,0,1000,500); editor->exec() // <--- big file dialog; return editor; // <--- tiny file dialog; };