diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp
index 86c7ffb78b92a0246b10e22fd58e8819bbdb37e6..a1a5bfbf376848720643f3ea55cc91dbfd3ad911 100644
--- a/src/libs/utils/fancylineedit.cpp
+++ b/src/libs/utils/fancylineedit.cpp
@@ -29,6 +29,8 @@
 **************************************************************************/
 
 #include "fancylineedit.h"
+#include "historycompleter.h"
+#include "qtcassert.h"
 
 #include <QEvent>
 #include <QDebug>
@@ -97,7 +99,8 @@ enum { margin = 6 };
 namespace Utils {
 
 // --------- FancyLineEditPrivate
-class FancyLineEditPrivate : public QObject {
+class FancyLineEditPrivate : public QObject
+{
 public:
     explicit FancyLineEditPrivate(FancyLineEdit *parent);
 
@@ -109,12 +112,14 @@ public:
     bool m_menuTabFocusTrigger[2];
     IconButton *m_iconbutton[2];
     bool m_iconEnabled[2];
+
+    HistoryCompleter *m_completer;
+    QString m_historyKey;
 };
 
 
 FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
-    QObject(parent),
-    m_lineEdit(parent)
+    QObject(parent), m_lineEdit(parent),  m_completer(0)
 {
     for (int i = 0; i < 2; ++i) {
         m_menu[i] = 0;
@@ -298,6 +303,19 @@ bool FancyLineEdit::hasAutoHideButton(Side side) const
     return d->m_iconbutton[side]->hasAutoHide();
 }
 
+void FancyLineEdit::setHistoryKey(const QString &historyKey)
+{
+    QTC_ASSERT(!d->m_completer, return);
+    d->m_historyKey = historyKey;
+    d->m_completer = new HistoryCompleter(this, historyKey);
+}
+
+void FancyLineEdit::setSpecialCompleter(QCompleter *completer)
+{
+    QTC_ASSERT(!d->m_completer, return);
+    QLineEdit::setCompleter(completer);
+}
+
 void FancyLineEdit::setAutoHideButton(Side side, bool h)
 {
     d->m_iconbutton[side]->setAutoHide(h);
diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h
index c9ff559f7930f34d020aadd7d77f1f37ba66be96..e03084dea028db5aa09e829bec4a1551b30e0225 100644
--- a/src/libs/utils/fancylineedit.h
+++ b/src/libs/utils/fancylineedit.h
@@ -94,6 +94,12 @@ public:
     void setAutoHideButton(Side side, bool h);
     bool hasAutoHideButton(Side side) const;
 
+    // Enable a history completer with a history of entries.
+    void setHistoryKey(const QString &historyKey);
+
+    // Sets a completer that is not a history completer.
+    void setSpecialCompleter(QCompleter *completer);
+
 signals:
     void buttonClicked(Utils::FancyLineEdit::Side side);
     void leftButtonClicked();
@@ -107,6 +113,10 @@ protected:
     virtual void resizeEvent(QResizeEvent *e);
 
 private:
+    // Unimplemented, to force the user to make a decision on
+    // whether to use setHistoryKey() or setSpecialCompleter().
+    void setCompleter(QCompleter *);
+
     void updateMargins();
     void updateButtonPositions();
     friend class Utils::FancyLineEditPrivate;
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index 079221ea182551f99c265b193ecb109b7cdefc06..46cbc7ba76b9f7d1d37ec39d883923a40d73be3c 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -213,8 +213,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
     d->localExecutablePathChooser = new PathChooser(this);
     d->localExecutablePathChooser->setExpectedKind(PathChooser::File);
     d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable"));
-    d->localExecutablePathChooser->lineEdit()->setCompleter(
-        new HistoryCompleter(d->localExecutablePathChooser->lineEdit(), QLatin1String("LocalExecutable")));
+    d->localExecutablePathChooser->lineEdit()->setHistoryKey(QLatin1String("LocalExecutable"));
 
     d->arguments = new QLineEdit(this);
     d->arguments->setCompleter(
@@ -223,8 +222,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
     d->workingDirectory = new PathChooser(this);
     d->workingDirectory->setExpectedKind(PathChooser::ExistingDirectory);
     d->workingDirectory->setPromptDialogTitle(tr("Select Working Directory"));
-    d->workingDirectory->lineEdit()->setCompleter(
-        new HistoryCompleter(d->workingDirectory->lineEdit(), QLatin1String("WorkingDirectory")));
+    d->workingDirectory->lineEdit()->setHistoryKey(QLatin1String("WorkingDirectory"));
 
     d->runInTerminalCheckBox = new QCheckBox(this);
 
diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp
index 9357520aca401415a5350b0e361c69e8ebc9f12f..c9e8bf9c0ecd281f77acb80859711ef07ed1b7bc 100644
--- a/src/plugins/find/findtoolbar.cpp
+++ b/src/plugins/find/findtoolbar.cpp
@@ -105,8 +105,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
 
     m_findCompleter->setModel(m_plugin->findCompletionModel());
     m_replaceCompleter->setModel(m_plugin->replaceCompletionModel());
-    m_ui.findEdit->setCompleter(m_findCompleter);
-    m_ui.replaceEdit->setCompleter(m_replaceCompleter);
+    m_ui.findEdit->setSpecialCompleter(m_findCompleter);
+    m_ui.replaceEdit->setSpecialCompleter(m_replaceCompleter);
 
     QMenu *lineEditMenu = new QMenu(m_ui.findEdit);
     m_ui.findEdit->setButtonMenu(Utils::FancyLineEdit::Left, lineEditMenu);
diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp
index 60e2f9e8dac1bb5ed8b66c0e844296d5b1c2461f..f37d4593b522449c99a2f28c6e87d1ca750b167a 100644
--- a/src/plugins/find/findtoolwindow.cpp
+++ b/src/plugins/find/findtoolwindow.cpp
@@ -65,7 +65,7 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin, QWidget *parent)
     connect(m_ui.searchTerm, SIGNAL(textChanged(QString)), this, SLOT(updateButtonStates()));
 
     m_findCompleter->setModel(m_plugin->findCompletionModel());
-    m_ui.searchTerm->setCompleter(m_findCompleter);
+    m_ui.searchTerm->setSpecialCompleter(m_findCompleter);
     m_ui.searchTerm->installEventFilter(this);
     QVBoxLayout *layout = new QVBoxLayout;
     layout->setMargin(0);
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index 136a30a98e58f004fb18520a3c167db8011c1cf5..62695770b94b02e8093b7e0e814cc8e1b1c4cab3 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -120,7 +120,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
     m_queryModel->setStringList(m_parameters->savedQueries);
     QCompleter *completer = new QCompleter(this);
     completer->setModel(m_queryModel);
-    m_queryLineEdit->setCompleter(completer);
+    m_queryLineEdit->setSpecialCompleter(completer);
     filterLayout->addWidget(queryLabel);
     filterLayout->addWidget(m_queryLineEdit);
     filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));