summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2010-07-28 16:33:44 +0200
committerLeandro Melo <leandro.melo@nokia.com>2010-07-28 16:37:28 +0200
commit28be7bc4b49b4afda96fdf16c8a0edeaea991a1d (patch)
treeb4087d56c06af552d245fdac34a4eef716298e40 /src/plugins/cppeditor/cpphoverhandler.cpp
parent62e33d0e7ace9893ba84deed0980bc8eeb54c624 (diff)
downloadqt-creator-28be7bc4b49b4afda96fdf16c8a0edeaea991a1d.tar.gz
C++ tooltip: Make sure to get the correct list of base classes.
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index a004df02e7..3a9ad4b093 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -60,6 +60,8 @@
#include <QtGui/QToolTip>
#include <QtGui/QTextCursor>
+#include <algorithm>
+
using namespace CppEditor::Internal;
using namespace CPlusPlus;
using namespace Core;
@@ -95,11 +97,14 @@ namespace {
const QList<Symbol *> &symbols = baseClass->symbols();
foreach (Symbol *baseSymbol, symbols) {
if (baseSymbol->isClass()) {
- hierarchy->back().append(overview.prettyName(
- LookupContext::fullyQualifiedName(baseSymbol)));
- buildClassHierarchyHelper(baseSymbol, context, overview, hierarchy);
- hierarchy->append(hierarchy->back());
- hierarchy->back().removeLast();
+ const QString &qualifiedName = overview.prettyName(
+ LookupContext::fullyQualifiedName(baseSymbol));
+ if (!qualifiedName.isEmpty()) {
+ hierarchy->back().append(qualifiedName);
+ buildClassHierarchyHelper(baseSymbol, context, overview, hierarchy);
+ hierarchy->append(hierarchy->back());
+ hierarchy->back().removeLast();
+ }
}
}
}
@@ -476,6 +481,10 @@ void CppHoverHandler::generateDiagramTooltip(const bool extendTooltips)
qSort(m_classHierarchy.begin(), m_classHierarchy.end(), ClassHierarchyComp());
+ // Remove duplicates (in case there are any).
+ m_classHierarchy.erase(std::unique(m_classHierarchy.begin(), m_classHierarchy.end()),
+ m_classHierarchy.end());
+
QStringList directBaseClasses;
foreach (const QStringList &hierarchy, m_classHierarchy) {
if (hierarchy.size() > 1)