FancyLineEdit: Do not overwrite content with non-existing history data

Change-Id: Ia51417b599e0e3847a0ade54ab5633c87c2ab48c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-01-21 17:44:12 +01:00
parent 1fe621ca27
commit 754da1031d
2 changed files with 2 additions and 1 deletions

View File

@@ -302,7 +302,7 @@ void FancyLineEdit::setHistoryCompleter(const QString &historyKey, bool restoreL
{
QTC_ASSERT(!d->m_historyCompleter, return);
d->m_historyCompleter = new HistoryCompleter(historyKey, this);
if (restoreLastItemFromHistory)
if (restoreLastItemFromHistory && d->m_historyCompleter->hasHistory())
setText(d->m_historyCompleter->historyItem());
QLineEdit::setCompleter(d->m_historyCompleter);