有没有办法在不使用 QItemDelegate 的情况下做到这一点?我一直有很多麻烦。例如,如果我使用委托:
- 不会有原生对话框。
- 我必须实现自己的图像预览,
由于某种原因,我无法调整窗口大小,因为 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; };