Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to create File dialog with Tree view?
QtWS25 Last Chance

How to create File dialog with Tree view?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mathi77in
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Woody
      wrote on last edited by
      #2

      Have you looked into it yourself?

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

      File not found. Nobody leave the room!

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sam
        wrote on last edited by
        #3

        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"

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved