Qt-interest Archive, January 2007
qmake with subdirectories ?
Message 1 in thread
Hello,
I'm trying to divide my project into subdirectories, (using kdevelop)
I have trouble with .ui file. Here is how it goes
'src'
- main.cpp
- mainwindow.ui
- src.pro
-> 'sub' subdirectory
- subwindow.ui
- subclass.h
- subclass.cpp
Where 'subclass' is a class of its own, used by 'subwindow' class (and
therefore is used in the 'subwindow.ui' file)
What I have in src.pro looks like :
FORMS += mainwindow.ui \
sub/subwindow.ui
HEADERS += sub/subclass.h \
subclass.h <- here is the problem. This is a needed fake
SOURCES += main.cpp \
sub/subclass.cpp
The problem is : Since I use 'subclass' in the .ui file, it needs
the 'subclass.h' file somewhere. And UIC automatically builds everything in
the top 'src' directory. Therefore, it writes #include "subclass.h" in the
ui header file. But unless I make an empty 'subclass.h' file in src, it
will complain it does not exist. (but I have to add anyway the
include "sub/subclass.h" in Designer)
Any clean solution for dealing with this ? (that is : something that can be
handled by kdevelop ...)
Thanks in advance
--
[ signature omitted ]
Message 2 in thread
eb wrote:
> The problem is : Since I use 'subclass' in the .ui file, it needs
> the 'subclass.h' file somewhere. And UIC automatically builds
> everything in the top 'src' directory. Therefore, it writes #include
> "subclass.h" in the ui header file. But unless I make an empty
> 'subclass.h' file in src, it will complain it does not exist. (but I
> have to add anyway the include "sub/subclass.h" in Designer)
I would try to set the INCLUDEPATH[1] qmake variable to include the sub
directory
i.e.
INCLUDEPATH *= sub/
Have a nice Day
- Jan Krämer
[1]
http://doc.trolltech.com/4.2/qmake-variable-reference.html#includepath
--
[ signature omitted ]
Message 3 in thread
Adding
INCLUDEPATH += sub
To the .pro file should do the trick.
Greets,
Ben
> -----Original Message-----
> From: eb [mailto:eb5@xxxxxxxxxx]
> Sent: Saturday, January 13, 2007 2:45 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: qmake with subdirectories ?
>
> Hello,
>
> I'm trying to divide my project into subdirectories, (using kdevelop)
> I have trouble with .ui file. Here is how it goes
>
> 'src'
> - main.cpp
> - mainwindow.ui
> - src.pro
> -> 'sub' subdirectory
> - subwindow.ui
> - subclass.h
> - subclass.cpp
>
> Where 'subclass' is a class of its own, used by 'subwindow' class (and
> therefore is used in the 'subwindow.ui' file)
>
> What I have in src.pro looks like :
>
> FORMS += mainwindow.ui \
> sub/subwindow.ui
>
> HEADERS += sub/subclass.h \
> subclass.h <- here is the problem. This is a needed
> fake
>
> SOURCES += main.cpp \
> sub/subclass.cpp
>
>
> The problem is : Since I use 'subclass' in the .ui file, it needs
> the 'subclass.h' file somewhere. And UIC automatically builds everything
> in
> the top 'src' directory. Therefore, it writes #include "subclass.h" in the
> ui header file. But unless I make an empty 'subclass.h' file in src, it
> will complain it does not exist. (but I have to add anyway the
> include "sub/subclass.h" in Designer)
>
> Any clean solution for dealing with this ? (that is : something that can
> be
> handled by kdevelop ...)
>
> Thanks in advance
--
[ signature omitted ]
Message 4 in thread
Ben Swerts wrote:
> Adding
>
> INCLUDEPATH += sub
>
> To the .pro file should do the trick.
>
> Greets,
>
>
Yes, it did in the end (I had to remove, re insert the ui file int he
project)
Thanks both of you
--
[ signature omitted ]
Message 5 in thread
Sunday 14 January 2007 11:16 eb wrote:
> Ben Swerts wrote:
> > Adding
> >
> > INCLUDEPATH += sub
> >
> > To the .pro file should do the trick.
> >
> > Greets,
>
> Yes, it did in the end (I had to remove, re insert the ui file int he
> project)
>
> Thanks both of you
Don't forget to add "DEPENDPATH += sub" also, or you won't get recompilations
when you change code in the sub dir.
Bo.
--
[ signature omitted ]