forked from qt-creator/qt-creator
HistoryCompleter: Fix current text() handling
Can be seen in the Debugger's "Command:" input: Selecting a history entry with "Return" properly executes the selected item, but put something else into the line edit. Change-Id: I2efa05374d9c31e8a80219794f2dbaaf50a01f9b Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -299,8 +299,20 @@ bool FancyLineEdit::hasAutoHideButton(Side side) const
|
||||
void FancyLineEdit::setHistoryCompleter(const QString &historyKey)
|
||||
{
|
||||
QTC_ASSERT(!d->m_historyCompleter, return);
|
||||
d->m_historyCompleter = new HistoryCompleter(this, historyKey, this);
|
||||
d->m_historyCompleter = new HistoryCompleter(historyKey, this);
|
||||
QLineEdit::setCompleter(d->m_historyCompleter);
|
||||
|
||||
// Hitting <Return> in the popup first causes editingFinished()
|
||||
// being emitted and more updates finally calling setText() (again).
|
||||
// To make sure we report the "final" content delay the addEntry()
|
||||
// "a bit".
|
||||
connect(this, SIGNAL(editingFinished()),
|
||||
this, SLOT(onEditingFinished()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void FancyLineEdit::onEditingFinished()
|
||||
{
|
||||
d->m_historyCompleter->addEntry(text());
|
||||
}
|
||||
|
||||
void FancyLineEdit::setSpecialCompleter(QCompleter *completer)
|
||||
|
||||
Reference in New Issue
Block a user