Close completer popup on clear

This commit is contained in:
ballessay 2017-04-28 01:48:21 +02:00 committed by C. Balles
parent a8418e3b53
commit bdd308d183
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,8 @@
#include <QStringListModel>
#include <QCompleter>
#include <QShortcut>
#include <QAbstractItemView>
Omnibar::Omnibar(MainWindow *main, QWidget *parent) :
QLineEdit(parent),
@ -84,6 +86,15 @@ void Omnibar::showCommands()
completer->complete();
}
void Omnibar::clear()
{
QLineEdit::clear();
// Close the potential shown completer popup
clearFocus();
setFocus();
}
void Omnibar::on_gotoEntry_returnPressed()
{
QString str = this->text();

View File

@ -20,6 +20,7 @@ private slots:
public slots:
void showCommands();
void clear();
private:
void setupCompleter();