[Qt-creator] How to put individual classes to sub dir

Jakov dkymail at gmail.com
Tue Aug 17 01:33:23 CEST 2010


Hello Alan,

I'm editing the pri files. I search the old archive, and find out that
whenever I include a .pri file, Qt Creator "creates" a virtual directory (a
node) in the Projects window (on the left side).

The main .pro file will include the frames.pri, so it would "create" the
Frames node in the window:
+ ex1.pro: include( Frames/Frames.pri)
+ frames.pri:
I think the frames.pri should do the same:
include(Frames/Frame1/frame1.pri), but it doesn't work... So I left
frames.pri empty.

At this step, if I put a class in Frames dir, the project works fine. But I
do want to make a lower level: adding Frame1 and Frame2 directories (which
include their own classes) within Frames.

There's no link line yet, Alan.

Thanks for your quick reply!

Jakov


On Tue, Aug 17, 2010 at 6:20 AM, <alan.westbrook at nokia.com> wrote:

> Ahh, I see.
>
> What does the first .pri file look like?
>
> Do you see the frame.cpp files compile from the compiler output?
>
> What does your link line look like?
>
> Alan
>
> On Aug 16, 2010, at 3:54 PM, ext Jakov wrote:
>
> Dear Adam,
>
> Thanks for your reply. I remove the subdirs already, to make it a normal
> app project. I "try-and-error" many ways, but the layout is not as expected.
> Could you please suggest me the config or give me the document of using .pro
> and .pri file? The idea is, I want to group individual classes (.h, .cpp,
> .ui) in a separate directory (to have a better look, easy to
> find/edit/manage...) within the main project dir, or even at the same
> directory level with main project dir.
>
> I'd like to thank Alan, but there's no libs yet. They're just pure UI
> classes, just at lower directory level, as compared to main project
> directory. I'll not include every single .h, .cpp, and .ui in the HEADERS,
> SOURCES, FORMS in the main .pro, as those files will be included in
> corresponding nodes (Headers, Sources, Forms) separately.
>
> I'm looking forward to your guide... In the meantime, I'll try-'n-error
> again. I look at demo and examples in Qt SDK, but there's no helpful
> examples... Thank you again.
>
> BR,
> Jakov
>
>
> On Mon, Aug 16, 2010 at 9:31 PM, Coda Highland <coda at bobandgeorge.com>wrote:
>
>>  First off, don't use a subdirs project for that. Just use a normal
>> "app" project and use relative paths in the .pro file. If you want to
>> organize the .pro file you can use include() with some .pri files --
>> Creator knows how to sort this out. (Note that .pri files consider
>> paths relative to the main .pro file, not to itself.)
>>
>> Second, "INCLUDEPATH += Frames" in the main .pro file (or possibly in
>> frames.pri) so that "Frame1/Frame1.h" can be found inside of the
>> "Frames" directory.
>>
>> /s/ Adam
>>
>> On Mon, Aug 16, 2010 at 8:51 AM, Jakov <dkymail at gmail.com> wrote:
>> > Hello Group,
>> >
>> > I have a question about organizing subdir/nested classes in Qt Creator.
>> I
>> > intend to use dozens classes (inherit from QFrame), to be promoted
>> later. I
>> > want to have each of them grouped in a separate folder (dir). Like this:
>> >
>> > <PROJECT_ROOT>
>> > ----- Frames
>> > --------- - frames.pro
>> > --------- - Frame1
>> > ---------------- frame1.h
>> > ---------------- frame1.cpp
>> > ---------------- frame1.ui
>> > ---------------- frame1.pri
>> > -------- - Frame2
>> > ---------------- frame2.h
>> > ---------------- frame2.cpp
>> > ---------------- frame2.ui
>> > ---------------- frame2.pri
>> > ----- ex1.pro
>> > ----- ex1.h
>> > ----- ex2.cpp
>> >
>> > File frame?.pri indicates HEADERS, SOURCES, FORMS
>> > File frames.pro simply includes those *.pri files.
>> > File ex1.pro:
>> > + TEMPLATE = app subdirs
>> > + SUBDIRS     += Frames
>> >
>> > That's it. The problem comes when I'm trying to use frame1, frame2 in
>> the
>> > main project (ex1). Although I specify INCLUDEPATH += Frames/Frame1 in
>> the
>> > ex1.pro, ex1 can "see" frame1.h, but it doesn't know about frame1.cpp,
>> so an
>> > error thrown: undefined reference to `TFrame1::TFrame1(QWidget*)'
>> >
>> > I'll try to summary the problem: how to put individual classes in subdir
>> > freely?
>> >
>> > Please help me.
>> >
>> > Thank you in advance!!!
>> >
>> > Best regards,
>> >
>> > Jakov
>> >
>> > _______________________________________________
>> > Qt-creator mailing list
>> > Qt-creator at trolltech.com
>> > http://lists.trolltech.com/mailman/listinfo/qt-creator
>> >
>> >
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>>
>
> <ATT00001..txt>
>
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100817/ed11f9a8/attachment.html 


More information about the Qt-creator-old mailing list