有沒有這樣做,而不使用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; };