[PATCH] qmake4 -recursive, root *.pro handling

Thomas Hasart thasart at gmx.de
Sat Jul 28 20:19:45 UTC 2007


On Saturday 28 July 2007 21:53:32 Andreas Pakulat wrote:
> I'm sending this back to the list, so others may see my answers as
> well..
>
> On 28.07.07 17:14:45, Thomas Hasart wrote:
> > On Saturday 28 July 2007 14:16:20 you wrote:
> > > On 28.07.07 04:52:00, Thomas Hasart wrote:
> > > > On Saturday 28 July 2007 02:38:28 Thomas Hasart wrote:
> > > > Index: kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp
> > > > ===================================================================
> > > > --- kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp    (revision
> > > > 693442) +++ kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp   
> > > > (working copy) @@ -155,7 +155,7 @@
> > > >      QPtrListIterator<FileItem> it( files );
> > > >      while ( it.current() != 0 )
> > > >      {
> > > > -        if ( it.current() ->text( 0 ) == file )      //File already
> > > > exists in this subproject +        if ( it.current() ->fileName ==
> > > > file ) //File already exists in this subproject return ;
> > > >          ++it;
> > > >      }
> > > > @@ -213,7 +213,7 @@
> > > >      QPtrListIterator<FileItem> it( files );
> > > >      while ( it.current() != 0 )
> > > >      {
> > > > -        if ( it.current() ->text( 0 ) == filename )      //File
> > > > already exists in this subproject +        if ( it.current()
> > > > ->fileName == filename )      //File already exists in this
> > > > subproject {
> > > >              FileItem * fitem = it.current();
> > > >              files.remove( it );
> > > > @@ -297,6 +297,9 @@
> > > >      // by default excluded is set to false, thus file is included
> > > >      //     excluded = exclude;
> > > >      setPixmap( 0, SmallIcon( "document" ) );
> > > > +    fileName=text;
> > > > +    QStringList tList=QStringList::split("/",text);
> > > > +    setText(0,tList.last());
> > > >  }
> > >
> > > Unless I'm totally mistaken (didn't look at the code for quite some
> > > weeks) this is wrong. It breaks with relative files.
> >
> > This is to show the file name, instead the pathFromPro/filename;
>
> I don't want that, it hides from the user where the file is and thats
> not good.
I think its not usable for users, i have an project with 30 - 50 files in the 
pri files. its terrible to find an file in the tree if everyitem starts with 
the same path.
I think its suffices to show the path in the parent include item. Its like a 
directory tree. On the file items only showed the filename.


>
> > > >  void TrollProjectWidget::emitAddedFile( const QString &fileName )
> > > > @@ -2289,16 +2294,21 @@
> > > >
> > > >  void TrollProjectWidget::runQMakeRecursive( QMakeScopeItem* proj )
> > > >  {
> > > > -    if ( proj->scope->scopeType() == Scope::ProjectScope )
> > > > +    if(m_part->isQt4Project())
> > > >      {
> > > > -        m_part->startQMakeCommand( proj->scope->projectDir() );
> > > > +            m_part->startQMakeCommand(
> > > > proj->scope->projectDir(),true); +    }else{
> > >
> > > Please stick to the existing code style here, i.e. whitespace around
> > > else and { on a new line.
> > >
> > > > Index: kdevelop-3.5/buildtools/qmake/scope.cpp
> > > > ===================================================================
> > > > --- kdevelop-3.5/buildtools/qmake/scope.cpp    (revision 693442)
> > > > +++ kdevelop-3.5/buildtools/qmake/scope.cpp    (working copy)
> > > > @@ -971,6 +971,10 @@
> > > >
> > > >  QString Scope::projectDir() const
> > > >  {
> > > > +    if(scopeType()==IncludeScope)
> > > > +    {
> > > > +       return  parent()->projectDir();
> > > > +    }
> > >
> > > This is not correct I think. A include'd file is always evaluated by
> > > qmake in its directory, not in the directory of the file that includes
> > > it, i.e. if I have
> > >
> > > src/foo.pro
> > > src/f1/f1.pri
> > >
> > > foo.pro: include(f1/f1.pri)
> > >
> > > then all stuff inside f1.pri is evaluated with src/f1 as current
> > > directory.
> >
> > Oh thats new for me, I've tested it without "src/" in pri an it worked.
> > The .pro and .pri for an large project i have create for a time for Qt
> > 4.0.x and there the files are evaluated in the .pro dir (I had tested it
> > at this time, before i changed the pri files in this way). May be that
> > this was changed by newer qt versions, but the other way is also working.
> > Have a look at the qt-sources, there are all pri file SOURCES with path
> > from from pro file.
>
> Hmm, maybe I was wrong. I remembered this from a thread on the
> qt-interest mailinglist... However I can't reproduce this with qmake
>
> >from Qt4 here, i.e. the include() is always evaluated in the context of
>
> the file where it is written in. So for
>
> src/src.pro
> bar/bar.pri
> bar/foo/foo.pri
>
> and include(foo/foo.pri) in bar.pri I get the expected result.
>
> > Without the patch pri filese with path inside not handled correct and
> > with the patch without path inside not handled correct.
> > So it's not easy to correct the handling for both cases because i think
> > the entire filepath is also builded outside from the Scope with
> > projectDir()+$SOURCES....
>
> Hmm, do you have a testcase for both problems? I can't even reproduce
> your original problem here with the above sample, i.e. the
> include(../bar/bar.pri) properly finds bar.pri and the
> include(foo/foo.pri) in bar.pri is also properly visible in qmake
> manager, without any changes from you.


files:
prj.pro
src/src.pri
src/test.cpp

prj.pro
include(src/src.pri)

src/src.pri
SOURCES += src/test.cpp

in this case filename = "src/test.cpp" and project dir of includeScope 
= "$(projectRoot)/src" -> resulting in "$(projectRoot)/src/src/test.cpp" 
which is one "src" to much. thatswhy kdevelop cannot open this file test.cpp 
by clicking it.

Thomas













More information about the KDevelop-devel mailing list