Commit c58469ce authored by dt's avatar dt
Browse files

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.

Reviewed-By: ossi
parent 9ef11006
......@@ -1169,8 +1169,8 @@ void Qt4ProFileNode::applyEvaluate(bool parseResult, bool async)
newVarValues[DefinesVar] = m_readerExact->values(QLatin1String("DEFINES"));
newVarValues[IncludePathVar] = includePaths(m_readerExact);
newVarValues[UiDirVar] = uiDirPaths(m_readerExact);
newVarValues[MocDirVar] = mocDirPaths(m_readerExact);
newVarValues[UiDirVar] = QStringList() << uiDirPath(m_readerExact);
newVarValues[MocDirVar] = QStringList() << mocDirPath(m_readerExact);
newVarValues[PkgConfigVar] = m_readerExact->values(QLatin1String("PKGCONFIG"));
newVarValues[PrecompiledHeaderVar] =
......@@ -1330,20 +1330,20 @@ QStringList Qt4ProFileNode::updateUiFiles()
return toUpdate;
QStringList Qt4ProFileNode::uiDirPaths(ProFileReader *reader) const
QString Qt4ProFileNode::uiDirPath(ProFileReader *reader) const
QStringList candidates = reader->absolutePathValues(QLatin1String("UI_DIR"),
return candidates;
QString path = reader->value("UI_DIR");
if (QFileInfo(path).isRelative())
path = QDir::cleanPath(buildDir() + "/" + path);
return path;
QStringList Qt4ProFileNode::mocDirPaths(ProFileReader *reader) const
QString Qt4ProFileNode::mocDirPath(ProFileReader *reader) const
QStringList candidates = reader->absolutePathValues(QLatin1String("MOC_DIR"),
return candidates;
QString path = reader->value("MOC_DIR");
if (QFileInfo(path).isRelative())
path = QDir::cleanPath(buildDir() + "/" + path);
return path;
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 << 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);
return paths;
......@@ -275,8 +275,8 @@ private:
void createUiCodeModelSupport();
QStringList updateUiFiles();
QStringList uiDirPaths(ProFileReader *reader) const;
QStringList mocDirPaths(ProFileReader *reader) const;
QString uiDirPath(ProFileReader *reader) const;
QString mocDirPath(ProFileReader *reader) const;
QStringList includePaths(ProFileReader *reader) const;
QStringList libDirectories(ProFileReader *reader) const;
QStringList subDirsPaths(ProFileReader *reader) const;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment