PDA

View Full Version : Nested folders in Qt Creator



rockballad
18th August 2010, 14:50
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,

rockballad
20th August 2010, 00:45
Could anybody help me, please? Is it possible in Qt Creator 2.0.0?

Thanks in advance.

Lykurg
20th August 2010, 07:43
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.

rockballad
20th August 2010, 08:10
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).

Lykurg
20th August 2010, 09:04
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?

rockballad
20th August 2010, 09:37
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!

Lykurg
20th August 2010, 10:06
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.

rockballad
20th August 2010, 11:52
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!

rockballad
27th August 2010, 05:52
Dear Moderator,

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

Thanks so much.