summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolsreuse.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2011-07-08 09:56:02 +0200
committerLeandro T. C. Melo <leandro.melo@nokia.com>2011-07-08 14:50:26 +0200
commit23decd9d34dc1e4445e87960784edd8bd782f29d (patch)
treee874fe98d608641eb8c6ca505b0afed2d89bc2a1 /src/plugins/cpptools/cpptoolsreuse.cpp
parentb260bf1e733cb812ad14b99244a8aa6996bbd3b7 (diff)
downloadqt-creator-23decd9d34dc1e4445e87960784edd8bd782f29d.tar.gz
C++ editor: Improve type hierarchy widget
Now the type hierarchy widget will also show the classes derived from the selected one. For consistency the way the base classes are shown was changed too. The diagram below is an example from Creator's code when openining the type hierarchy for BaseTextEditorWidget: Bases +QObject +QWidget +... BaseTextEditorWidget +QPaintDevice +... BaseTextEditorWidget Derived +BaseTextEditorWidget +VCSBaseEditorWidget GitEditor MercurialEditor ... GLSLEditorWidget CppEditorWidget QmlJSTextEditorWidget ... Depending on the project and on the selected class the hierarchy widget might take a bit to be constructed. This should be improved later. Change-Id: Ifbdd1cbbba955a0bdf03297ff0e7620351b12dc5 Reviewed-on: http://codereview.qt.nokia.com/883 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cpptoolsreuse.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolsreuse.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp
new file mode 100644
index 0000000000..ed97b67739
--- /dev/null
+++ b/src/plugins/cpptools/cpptoolsreuse.cpp
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "cpptoolsreuse.h"
+
+#include <QtGui/QTextDocument>
+#include <QtGui/QTextCursor>
+
+namespace CppTools {
+
+void moveCursorToEndOfIdentifier(QTextCursor *tc) {
+ QTextDocument *doc = tc->document();
+ if (!doc)
+ return;
+
+ QChar ch = doc->characterAt(tc->position());
+ while (ch.isLetterOrNumber() || ch == QLatin1Char('_')) {
+ tc->movePosition(QTextCursor::NextCharacter);
+ ch = doc->characterAt(tc->position());
+ }
+}
+
+} // CppTools