Important: Please read the Qt Code of Conduct -

How to create File dialog with Tree view?

  • Tree view directory selection dialog use following code @QFileDialog::getExistingDirectory(this, tr("Open Directory"),
    | QFileDialog::DontResolveSymlinks);@

    But This dialog was display in center of the PC manitor. So i write Qfiledialog class with treeview option

    @QFileDialog dialog(this->ui.tabWidget);
    dialog.setWindowTitle("Select "+ui.label_3->text());
    QFileSystemModel *model = new QFileSystemModel(this);
    model->setResolveSymlinks(true);QTreeView *tree = new QTreeView();

    i select directory on File dialog box. But File dialog box have display from Tree view style.

  • Have you looked into it yourself?

    I don't really know what you mean. Do you want a list of directories in a QTreeView?

  • Hi,

    If can look int "QDirModel": and "QFileSystemModel": examples. But your question is still not clear what exactly is your requirement. If you have implemented some code then kindly provide it so that it will be more clear for us to understand .


    EDIT: Thanks for the code previously it was just displaying "KK"

Log in to reply