How to create File dialog with Tree view?



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

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

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

    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":http://qt-project.org/doc/qt-4.8/qdirmodel.html#details and "QFileSystemModel":http://qt-project.org/doc/qt-4.8/qfilesystemmodel.html 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 .

    Regards
    Soumitra

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.