Results 1 to 9 of 9

Thread: Nested folders in Qt Creator

  1. #1
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Nested folders in Qt Creator

    Hello,

    I have many single classes in a project. I want them to be grouped like this:

    - Project
    ......|__Animal (folder)
    ..............|__ Dog (folder)
    .....................|__ files (.h, .cpp, .ui)
    ..............|__ Cat (folder)
    .....................|__ files (.h, .cpp, .ui)
    ....-prj files (main.cpp, .ui, .h, .cpp)

    This project has 2 classes (Dog, Cat), are placed in sub folders of Animal (folder, not project). So I think project include file (.pri) should help. But I don't know how to config in Qt Creator 2.0.0. Could you help me?

    Thanks so much.

    Best regards,

  2. #2
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Nested folders in Qt Creator

    Could anybody help me, please? Is it possible in Qt Creator 2.0.0?

    Thanks in advance.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Nested folders in Qt Creator

    you don't need a pri file simple put the relative path in the pro file. If you create a new file in qt creator you can select the directory and Qt Creator handles all the stuff for you.

  4. #4
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Nested folders in Qt Creator

    Hello Lorenz,

    It's glad to see you here again!

    Yes, I did as you said. But I just can add a new class, not a folder. So I realize the real problem is:

    * We can't add a new folder physically in QtCreator (1)

    Once Qt Creator enables us to do that, my problem should be solved.

    Currently, I have to add new folder manually. Then I use .pri file to add it logically to the Project window. But it doesn't display the folders as nested.

    Could you take a minute to try the model above? An empty folder Animal, that includes 2 folders: Dog and Cat. Each of them contains a Qt Designer Form Class.


    BR,
    Quynh

    P/S: Thank you for your nice plugin. Hopefully I can contribute to its development (maybe next month, when I have more time).

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Nested folders in Qt Creator

    Hi Quynh,

    it is true you don't have the possibility to create a new folder only. But you can create one if you create any new file. Since I don't have the English menu names they may appear different:
    Goto File->New... then choose any template e.g. C++ => "C++-class" in the dialog you find the path, behind that there is a button "select" if you click it, you get a file dialog where you can add new folders.

    Or did I get you wrong and you want something different?

  6. #6
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Nested folders in Qt Creator

    Yes, I did as you said:

    - I make 3 additional directories in my current project location: Animal, Animal/Dog, Animal/Cat
    - [File] > [New file or project...] > C++ > C++ class
    - Add Cat class in Animal/Cat; Dog class in Animal/Dog.

    I expect that the Project tree would have Animal node, with 2 subnodes Dog, Cat. Each of them has 2 subnodes: Headers, Sources
    But Qt Creator doesn't support, or I did something wrong: Animal node, with 2 subnodes: Headers, Sources. Each of them has 2 subnodes: Dog, Cat. I don't like this.

    It'd be clear if you take several minutes to try it yourself

    Thanks for your reply!

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Nested folders in Qt Creator

    Quote Originally Posted by rockballad View Post
    I expect that the Project tree would have Animal node, with 2 subnodes Dog, Cat. Each of them has 2 subnodes: Headers, Sources
    But Qt Creator doesn't support, or I did something wrong: Animal node, with 2 subnodes: Headers, Sources. Each of them has 2 subnodes: Dog, Cat. I don't like this.
    Ok, now I get you. With the project tree it is not possible since it parses the files and arrange them in the virtual folders sources/headers... If you want a file system representation you can chage the view to it. But you then will see all other files also. (And also no tree structure.)

    So back to the original question: You can't have it right out of the box. Also I don't know a comftable way to create pri file in creator. But also then, Qt Creator is parsing the pri content in virtual folders. So the only possibility is to write a plugin, that displays the file system in a tree model.

  8. #8
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Nested folders in Qt Creator

    Thank you. I tried many times but got no success. At least I know it's impossible now. Or I may ask Qt Creator team to think about it :-)

    You have a nice day!

  9. #9
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Nested folders in Qt Creator

    Dear Moderator,

    Please move my thread to http://www.qtcentre.org/forums/3-Qt-Tools

    Thanks so much.

Similar Threads

  1. Qt Creator doesn't load nested plugin
    By skepticalgeek in forum Qt Tools
    Replies: 0
    Last Post: 9th January 2010, 21:10
  2. Nested Layout
    By starcontrol in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2008, 12:47
  3. nested tables
    By Jeroen van der Waal in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2007, 17:12
  4. Nested signals and slots
    By vishva in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2006, 09:47
  5. Nested Plugins
    By Luis Rodriguez in forum Qt Programming
    Replies: 1
    Last Post: 10th March 2006, 22:00

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
  •  
Qt is a trademark of The Qt Company.