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. QFileDialog or QFileSystemModel with QTreeView

QFileDialog or QFileSystemModel with QTreeView

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    sahara108
    wrote on last edited by
    #1

    Hi,
    I need to do a file dialog like this image !https://dl.dropboxusercontent.com/s/va85z5vv5su3ute/Capture.PNG?token_hash=AAEL8eGrHVz65EcpDyQ0-CzNhsqmMsc6nXs99LuM9Yos9g&dl=1!
    But, here is my custom dialog !https://dl.dropboxusercontent.com/s/in7qqeh4nbj0430/Capture1.PNG?token_hash=AAFGufowG5qcXSzs3XxJAmqkUAFb901DsL1veL4S8nYHvg&dl=1!

    I am using QFileSystemModel as a model of a QTreeView. I tried to use a custom QItemModel @MultiModel *myModel = new MultiModel(this);

    QFileSystemModel *fsm1 = new QFileSystemModel(this);
    fsm1->setRootPath(desktop);
    fsm1->setFilter(QDir::Dirs);

    QFileSystemModel *fsm2 = new QFileSystemModel(this);
    fsm2->setRootPath(libraries);
    fsm2->setFilter(QDir::Dirs);

    QFileSystemModel *fsm3 = new QFileSystemModel(this);
    fsm3->setRootPath(home);
    fsm3->setFilter(QDir::Dirs);

    myModel->addModel(fsm1);
    myModel->addModel(fsm2);
    myModel->addModel(fsm3);

    QTreeView *tree = ui.treeView;
    tree->setModel(myModel);
    tree->setSelectionMode(QTreeView::ExtendedSelection);
    tree->setSelectionBehavior(QTreeView::SelectRows);
    int count = myModel->columnCount(QModelIndex());
    for (int i = 1; i < count; i++)
    {
    tree->setColumnHidden(i, true);
    }@
    No help at all. I am now try to use QSortFilterProxyModel but dont know how to do. Could you show me how to do this? Any help would be appreciated.

    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