summaryrefslogtreecommitdiffstats
path: root/qt-ui/tagwidget.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-19 15:29:13 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-20 09:47:57 -0700
commit30770f5d8567e99b5b3c1c6c812ee00e19f67d9c (patch)
tree48b70cdb4b76e81f512e9d0ff425c6e7f256c6ab /qt-ui/tagwidget.cpp
parent3d83c48c496388586408fc418f027b726bf8d184 (diff)
downloadsubsurface-30770f5d8567e99b5b3c1c6c812ee00e19f67d9c.tar.gz
Do not copy strings when you don't need it.
This patch removed the use of copy-constructors on the QString to use the const-references. Even knowing that the QString is a refcounted class, let's not get that bad habit. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/tagwidget.cpp')
-rw-r--r--qt-ui/tagwidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 4c71c5fac..53643648f 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -138,13 +138,13 @@ void TagWidget::reparse()
}
}
-void TagWidget::completionSelected(QString completion)
+void TagWidget::completionSelected(const QString& completion)
{
completionHighlighted(completion);
emit textChanged();
}
-void TagWidget::completionHighlighted(QString completion)
+void TagWidget::completionHighlighted(const QString& completion)
{
QPair<int, int> pos;
pos = getCursorTagPosition();
@@ -152,7 +152,7 @@ void TagWidget::completionHighlighted(QString completion)
setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
setCursorPosition(pos.first + completion.length());
} else {
- setText(completion.append(", "));
+ setText(completion + QString(", "));
setCursorPosition(text().length());
}
}
@@ -164,7 +164,7 @@ void TagWidget::setCursorPosition(int position)
blockSignals(false);
}
-void TagWidget::setText(QString text)
+void TagWidget::setText(const QString& text)
{
blockSignals(true);
GroupedLineEdit::setText(text);