forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -518,7 +518,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
if (exprTy->isReferenceType())
|
||||
exprTy = exprTy->asReferenceType()->elementType();
|
||||
|
||||
if (m_completionOperator == T_LPAREN && completeFunction(exprTy, resolvedTypes, context)) {
|
||||
if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(exprTy, resolvedTypes)) {
|
||||
return m_startPosition;
|
||||
} else if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) &&
|
||||
completeMember(resolvedTypes, context)) {
|
||||
@@ -551,7 +551,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
foreach (const TypeOfExpression::Result &result, results) {
|
||||
if (result.first->isClassType()) {
|
||||
FullySpecifiedType exprTy = result.first;
|
||||
if (completeConstructors(exprTy->asClassType()))
|
||||
if (completeConstructorOrFunction(exprTy, QList<TypeOfExpression::Result>()))
|
||||
return m_startPosition;
|
||||
break;
|
||||
}
|
||||
@@ -563,18 +563,29 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
||||
const QList<TypeOfExpression::Result> &resolvedTypes,
|
||||
const LookupContext &)
|
||||
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy,
|
||||
const QList<TypeOfExpression::Result> &resolvedTypes)
|
||||
{
|
||||
if (Class *klass = exprTy->asClassType()) {
|
||||
completeConstructors(klass);
|
||||
} else {
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
Overview o;
|
||||
o.setShowReturnTypes(true);
|
||||
o.setShowArgumentNames(true);
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
Overview o;
|
||||
o.setShowReturnTypes(true);
|
||||
o.setShowArgumentNames(true);
|
||||
|
||||
if (Class *klass = exprTy->asClassType()) {
|
||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||
Symbol *member = klass->memberAt(i);
|
||||
if (! member->type()->isFunctionType())
|
||||
continue;
|
||||
else if (! member->identity())
|
||||
continue;
|
||||
else if (! member->identity()->isEqualTo(klass->identity()))
|
||||
continue;
|
||||
if (TextEditor::CompletionItem item = toCompletionItem(member)) {
|
||||
item.m_text = o(member->type(), member->name());
|
||||
m_completions.append(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QSet<QString> signatures;
|
||||
foreach (TypeOfExpression::Result p, resolvedTypes) {
|
||||
FullySpecifiedType ty = p.first;
|
||||
@@ -594,6 +605,10 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
||||
}
|
||||
}
|
||||
|
||||
// If there is only one item, show the function argument widget immediately
|
||||
if (m_completions.size() == 1)
|
||||
complete(m_completions.takeFirst());
|
||||
|
||||
return ! m_completions.isEmpty();
|
||||
}
|
||||
|
||||
@@ -887,30 +902,6 @@ void CppCodeCompletion::completeClass(const QList<Symbol *> &candidates,
|
||||
}
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeConstructors(Class *klass)
|
||||
{
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
Overview o;
|
||||
o.setShowReturnTypes(true);
|
||||
o.setShowArgumentNames(true);
|
||||
|
||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||
Symbol *member = klass->memberAt(i);
|
||||
if (! member->type()->isFunctionType())
|
||||
continue;
|
||||
else if (! member->identity())
|
||||
continue;
|
||||
else if (! member->identity()->isEqualTo(klass->identity()))
|
||||
continue;
|
||||
if (TextEditor::CompletionItem item = toCompletionItem(member)) {
|
||||
item.m_text = o(member->type(), member->name());
|
||||
m_completions.append(item);
|
||||
}
|
||||
}
|
||||
|
||||
return ! m_completions.isEmpty();
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
|
||||
const QList<TypeOfExpression::Result> &results,
|
||||
const LookupContext &context,
|
||||
|
@@ -86,9 +86,8 @@ private:
|
||||
void addMacros(const CPlusPlus::LookupContext &context);
|
||||
void addCompletionItem(CPlusPlus::Symbol *symbol);
|
||||
|
||||
bool completeFunction(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
bool completeConstructorOrFunction(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &);
|
||||
|
||||
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
|
@@ -40,6 +40,7 @@ public:
|
||||
enum ToolChainType
|
||||
{
|
||||
GCC,
|
||||
LinuxICC,
|
||||
MinGW,
|
||||
MSVC,
|
||||
WINCE,
|
||||
|
@@ -419,7 +419,7 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
|
||||
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
|
||||
} else if(t == ToolChain::WINCE) {
|
||||
m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform());
|
||||
} else if(t == ToolChain::GCC) {
|
||||
} else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) {
|
||||
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
||||
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
||||
Environment env = Environment::systemEnvironment();
|
||||
@@ -457,8 +457,12 @@ void Qt4Project::updateCodeModel()
|
||||
const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
|
||||
|
||||
ToolChain *tc = toolChain(activeBuildConfiguration());
|
||||
QByteArray predefinedMacros = tc->predefinedMacros();
|
||||
QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
|
||||
QByteArray predefinedMacros;
|
||||
QList<HeaderPath> allHeaderPaths;
|
||||
if (tc) {
|
||||
predefinedMacros = tc->predefinedMacros();
|
||||
allHeaderPaths = tc->systemHeaderPaths();
|
||||
}
|
||||
foreach (HeaderPath headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
|
@@ -1191,6 +1191,8 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const
|
||||
return ProjectExplorer::ToolChain::INVALID;
|
||||
else if (spec.startsWith("wince"))
|
||||
return ProjectExplorer::ToolChain::WINCE;
|
||||
else if (spec.startsWith("linux-icc"))
|
||||
return ProjectExplorer::ToolChain::LinuxICC;
|
||||
else
|
||||
return ProjectExplorer::ToolChain::GCC;
|
||||
}
|
||||
|
Reference in New Issue
Block a user