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. Set Path doesnt work ~ QFileSystemModel
Forum Updated to NodeBB v4.3 + New Features

Set Path doesnt work ~ QFileSystemModel

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 163 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.
  • E Offline
    E Offline
    ELEMENTICY
    wrote on last edited by
    #1

    this is my code

    QString openfolderproj = QFileDialog::getExistingDirectory(this, tr("Open a Project Folder"), "C:/Users/", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
        filemodel = new QFileSystemModel(this);
        filemodel->setRootPath(openfolderproj);
    
        ui->fileExplorer->setModel(filemodel);
    

    i did all,but it still start from the Local (C:)
    (NOTE* openfolderproj is from a class,it is "C:/Users/"

    These forum:
    https://www.qtcentre.org/threads/47359-i-am-unable-to-set-path-in-QFileSystemModel
    https://forum.qt.io/topic/13985/i-am-unable-to-set-path-in-qfilesystemmodel
    I dont understand,thats why i made a new forum.

    Please help me with whole code,thanks alot =)

    Pl45m4P 1 Reply Last reply
    0
    • E ELEMENTICY

      this is my code

      QString openfolderproj = QFileDialog::getExistingDirectory(this, tr("Open a Project Folder"), "C:/Users/", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
          filemodel = new QFileSystemModel(this);
          filemodel->setRootPath(openfolderproj);
      
          ui->fileExplorer->setModel(filemodel);
      

      i did all,but it still start from the Local (C:)
      (NOTE* openfolderproj is from a class,it is "C:/Users/"

      These forum:
      https://www.qtcentre.org/threads/47359-i-am-unable-to-set-path-in-QFileSystemModel
      https://forum.qt.io/topic/13985/i-am-unable-to-set-path-in-qfilesystemmodel
      I dont understand,thats why i made a new forum.

      Please help me with whole code,thanks alot =)

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @ELEMENTICY said in Set Path doesnt work ~ QFileSystemModel:

      i did all,but it still start from the Local (C:)
      (NOTE* openfolderproj is from a class,it is "C:/Users/"

      Because setRootPath does not change the (visible) root directory of your model.
      (stated in your first linked thread as well as here in the Qt documentation)


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      2

      • Login

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