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

Coda Highland coda at bobandgeorge.com
Mon Aug 16 16:31:33 CEST 2010


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
>
>




More information about the Qt-creator-old mailing list