Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Editor 尝试在QTableView中编辑单元格时调用QFileDialog_Editor_Qtableview_Qitemdelegate_Qfiledialog - Fatal编程技术网

Editor 尝试在QTableView中编辑单元格时调用QFileDialog

Editor 尝试在QTableView中编辑单元格时调用QFileDialog,editor,qtableview,qitemdelegate,qfiledialog,Editor,Qtableview,Qitemdelegate,Qfiledialog,有没有一种不使用QItemDelegate的方法?我一直有很多麻烦。例如,如果我使用委托: 不会有本机对话框 我必须实现自己的图像预览 由于某些原因,我无法调整窗口大小,因为setGeometry无法工作,等等 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const { Q_UNUSED(opti

有没有一种不使用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;
    };
    
    QWidget*createEditor(
    QWidget*父项,
    常量QSTYLEOPTION视图项和选项,
    常数QModelIndex和索引
    )常数{
    Q_未使用(选项);
    Q_(指数);
    QFileDialog*编辑器=新建QFileDialog(父级);
    编辑器->设置过滤器(“*.png”);
    编辑器->设置目录(mResources);
    编辑器->设置几何体(0,01000500);
    
    editor->exec()//确定,因此editor->setGeometry方法必须进入QItemDelegate的重写方法setEditorData


    是否有人知道使用setItemDelegate在QFileDialog中绘制图像缩略图预览的示例代码?

    确定,因此编辑器->setGeometry方法必须进入QItemDelegate的重写方法setEditorData


    有人知道使用setItemDelegate在QFileDialog中绘制图像缩略图预览的示例代码吗?

    实际上,更改小部件几何图形的所有内容都会转到UpdateDirectorGeometry函数。重写它以避免尝试将原始对话框放在表的单元格中。

    I在实践中,所有更改小部件几何图形的操作都会转到updateEditorGeometry函数。重写它以避免尝试将原始对话框放在表的单元格中