Results 1 to 8 of 8

Thread: How do you return a list of the current project folders and files of your project?

  1. #1
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How do you return a list of the current project folders and files of your project?

    So I posted this on Ask Ubuntu http://askubuntu.com/questions/55394...of-your-curren

    And would love to share any answer there.

    I hope my question is straightforward enough to understand. All I want (best case scenario) is a function that will return a list of the active project's files and folders. I will settle however if a list of all the files in the sidebar are returned.

    Thanks !

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do you return a list of the current project folders and files of your project

    Your question does not indicate where you need that information.
    Are you writing a QtCreator plugin and/or extending an existing one and are asking how to access the project details?

    Cheers,
    _

  3. #3
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How do you return a list of the current project folders and files of your project

    Thanks for your reply!

    I am writing a QtCreator plugin, and I am asking how to access the project details.

    So in essence,

    tools>myPlugin>run

    should return a qstringlist of all the files/folders of my current project. I think from that I should be able to construct the rest of the plugin.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do you return a list of the current project folders and files of your project

    Maybe some approach like this will work:

    - get hold of the project explorer instance
    - ask it for the current project
    - ask that for its file

    Cheers,
    _

  5. #5
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How do you return a list of the current project folders and files of your project

    Any idea of how to get hold of the project explorer instance?

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do you return a list of the current project folders and files of your project

    The PluginManager has an instance() method and several getObject methods.
    The ProjectExplorerPlugin has an instance() method.

    Cheers,
    _

  7. #7
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How do you return a list of the current project folders and files of your project

    I do apologize for not being a terribly apt c++ programmer, but would you mind providing a small code snippet?

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do you return a list of the current project folders and files of your project

    Well, I am not sure you will succeed in your endeavor if you already have difficulties with C++ basics like calling a method.

    Qt Code:
    1. const QStringList projectFiles = ProjectExplorerPlugin::currentProject()->files(Project::ExcludeGeneratedFiles);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. Replies: 9
    Last Post: 25th July 2014, 13:11
  2. Replies: 7
    Last Post: 15th November 2013, 17:20
  3. Qt Creator How do I build project in current directory on Windows?
    By Coolname007 in forum Qt Tools
    Replies: 2
    Last Post: 5th October 2012, 03:48
  4. Qt Creator Project folders
    By Quasimojo in forum Qt Tools
    Replies: 2
    Last Post: 13th January 2011, 00:24
  5. Replies: 1
    Last Post: 3rd December 2009, 23:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.