summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodecompletion.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-05-27 17:02:35 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-05-28 11:00:33 +0200
commit653757e78140ca463b9e5a4233b21558916d35ff (patch)
tree29149e05717c755fa3507a53fb7e92d2f920233f /src/plugins/cpptools/cppcodecompletion.cpp
parent8c45eb57fb5954a3926f1ed89765712a396e2209 (diff)
downloadqt-creator-653757e78140ca463b9e5a4233b21558916d35ff.tar.gz
Fixed HTML escaping issues in the function argument widget
HTML escaping was moved out of the TypePrettyPrinter since it interferes with other logic there. Instead, the region to mark is now available from the Overview and used by the FunctionArgumentWidget to put the current argument in bold.
Diffstat (limited to 'src/plugins/cpptools/cppcodecompletion.cpp')
-rw-r--r--src/plugins/cpptools/cppcodecompletion.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp
index bc324f9451..384058685b 100644
--- a/src/plugins/cpptools/cppcodecompletion.cpp
+++ b/src/plugins/cpptools/cppcodecompletion.cpp
@@ -66,6 +66,7 @@
#include <QtGui/QLabel>
#include <QtGui/QToolButton>
#include <QtGui/QVBoxLayout>
+#include <QtGui/QTextDocument> // Qt::escape()
using namespace CPlusPlus;
@@ -382,13 +383,23 @@ bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e)
void FunctionArgumentWidget::updateHintText()
{
Overview overview;
- overview.setRichText(true);
overview.setShowReturnTypes(true);
overview.setShowArgumentNames(true);
- overview.setMarkArgument(m_currentarg + 1);
+ overview.setMarkedArgument(m_currentarg + 1);
Function *f = currentFunction();
- setText(overview(f->type(), f->name()));
+ const QString prettyMethod = overview(f->type(), f->name());
+ const int begin = overview.markedArgumentBegin();
+ const int end = overview.markedArgumentEnd();
+
+ QString hintText;
+ hintText += Qt::escape(prettyMethod.left(begin));
+ hintText += "<b>";
+ hintText += Qt::escape(prettyMethod.mid(begin, end - begin));
+ hintText += "</b>";
+ hintText += Qt::escape(prettyMethod.mid(end));
+ setText(hintText);
+
m_numberLabel->setText(tr("%1 of %2").arg(m_current + 1).arg(m_items.size()));
m_popupFrame->setFixedWidth(m_popupFrame->minimumSizeHint().width());