forked from qt-creator/qt-creator
Fix ui completion for new projects
The UI_DIR and MOC_DIR weren't added to the includepath for new projects, since at the time of parsing the directories don't exist yet. We now always add UI_DIR and MOC_DIR to the include path, without caring whether they exist. Task-Nr: QTCREATORBUG-1064 Reviewed-By: ossi
This commit is contained in:
@@ -1169,8 +1169,8 @@ void Qt4ProFileNode::applyEvaluate(bool parseResult, bool async)
|
|||||||
|
|
||||||
newVarValues[DefinesVar] = m_readerExact->values(QLatin1String("DEFINES"));
|
newVarValues[DefinesVar] = m_readerExact->values(QLatin1String("DEFINES"));
|
||||||
newVarValues[IncludePathVar] = includePaths(m_readerExact);
|
newVarValues[IncludePathVar] = includePaths(m_readerExact);
|
||||||
newVarValues[UiDirVar] = uiDirPaths(m_readerExact);
|
newVarValues[UiDirVar] = QStringList() << uiDirPath(m_readerExact);
|
||||||
newVarValues[MocDirVar] = mocDirPaths(m_readerExact);
|
newVarValues[MocDirVar] = QStringList() << mocDirPath(m_readerExact);
|
||||||
newVarValues[PkgConfigVar] = m_readerExact->values(QLatin1String("PKGCONFIG"));
|
newVarValues[PkgConfigVar] = m_readerExact->values(QLatin1String("PKGCONFIG"));
|
||||||
newVarValues[PrecompiledHeaderVar] =
|
newVarValues[PrecompiledHeaderVar] =
|
||||||
m_readerExact->absoluteFileValues(QLatin1String("PRECOMPILED_HEADER"),
|
m_readerExact->absoluteFileValues(QLatin1String("PRECOMPILED_HEADER"),
|
||||||
@@ -1330,20 +1330,20 @@ QStringList Qt4ProFileNode::updateUiFiles()
|
|||||||
return toUpdate;
|
return toUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Qt4ProFileNode::uiDirPaths(ProFileReader *reader) const
|
QString Qt4ProFileNode::uiDirPath(ProFileReader *reader) const
|
||||||
{
|
{
|
||||||
QStringList candidates = reader->absolutePathValues(QLatin1String("UI_DIR"),
|
QString path = reader->value("UI_DIR");
|
||||||
buildDir());
|
if (QFileInfo(path).isRelative())
|
||||||
candidates.removeDuplicates();
|
path = QDir::cleanPath(buildDir() + "/" + path);
|
||||||
return candidates;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Qt4ProFileNode::mocDirPaths(ProFileReader *reader) const
|
QString Qt4ProFileNode::mocDirPath(ProFileReader *reader) const
|
||||||
{
|
{
|
||||||
QStringList candidates = reader->absolutePathValues(QLatin1String("MOC_DIR"),
|
QString path = reader->value("MOC_DIR");
|
||||||
buildDir());
|
if (QFileInfo(path).isRelative())
|
||||||
candidates.removeDuplicates();
|
path = QDir::cleanPath(buildDir() + "/" + path);
|
||||||
return candidates;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Qt4ProFileNode::includePaths(ProFileReader *reader) const
|
QStringList Qt4ProFileNode::includePaths(ProFileReader *reader) const
|
||||||
@@ -1355,7 +1355,10 @@ QStringList Qt4ProFileNode::includePaths(ProFileReader *reader) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
paths.append(reader->absolutePathValues(QLatin1String("INCLUDEPATH"), m_projectDir));
|
paths.append(reader->absolutePathValues(QLatin1String("INCLUDEPATH"), m_projectDir));
|
||||||
paths << mocDirPaths(reader) << uiDirPaths(reader);
|
// paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf
|
||||||
|
// except if those directories don't exist at the time of parsing
|
||||||
|
// thus we add those directories manually (without checking for existance)
|
||||||
|
paths << mocDirPath(reader) << uiDirPath(reader);
|
||||||
|
|
||||||
paths.removeDuplicates();
|
paths.removeDuplicates();
|
||||||
return paths;
|
return paths;
|
||||||
|
@@ -275,8 +275,8 @@ private:
|
|||||||
void createUiCodeModelSupport();
|
void createUiCodeModelSupport();
|
||||||
QStringList updateUiFiles();
|
QStringList updateUiFiles();
|
||||||
|
|
||||||
QStringList uiDirPaths(ProFileReader *reader) const;
|
QString uiDirPath(ProFileReader *reader) const;
|
||||||
QStringList mocDirPaths(ProFileReader *reader) const;
|
QString mocDirPath(ProFileReader *reader) const;
|
||||||
QStringList includePaths(ProFileReader *reader) const;
|
QStringList includePaths(ProFileReader *reader) const;
|
||||||
QStringList libDirectories(ProFileReader *reader) const;
|
QStringList libDirectories(ProFileReader *reader) const;
|
||||||
QStringList subDirsPaths(ProFileReader *reader) const;
|
QStringList subDirsPaths(ProFileReader *reader) const;
|
||||||
|
Reference in New Issue
Block a user