Important: Please read the Qt Code of Conduct -

[SOLVED] Qt Creator : How to list files and directories to Tree widget which placed in a stacked widget page

  • Hi all,
    I'm a newbie to the Qt creator. I'm using Qt creator version 3.0.1 (Based on Qt 5.2.1 (GCC 4.6.1, 64 bit)).
    Now come to my question. I'm writing an application which have multiple pages (stacked widget application). I wish to show folder list (folders and its files) in one of the page. So I chose "TreeWidget" for that purpose. But, I don't know how I can show the folder list in the TreeWidget that, placed in one of the page of the stacked widget.
    Could anyone please help me to solve this. It would be better if you can showcase this with an example or a code snippet.
    Looking forward to your reply...
    PS: I have tried some google-ing and experiment but nothing shows the directory list as I wish :(
    Thank you in advance,
    Ajith P V

  • Lifetime Qt Champion


    Wouldn't a QTreeView + QFileSystemModel combo do the trick ?

  • @SGaist Thank you for your support. QTreeView + QFileSystemModel combo will surely do the trick. But, how I can call this one to show the directory list inside a stacked widget page? I'm pretty confused in this case.
    Please let me know how I can achieve the QTreeView + QFileSystemModel combo to show inside a stacked widget page.

    Thank you in advance,
    Ajith P V

  • @SGaist Thank you once again!
    Now, I can manage to display the folder list inside the stacked widget page using QTreeView + QFileSystemModel combo!