break;
default:
- qDebug() << keyEvent->text();
+ // qDebug() << keyEvent->text();
editor->setFocus();
editor->event(ev);
popup->hide();
}
void GSuggestCompletion::preventSuggest() {
+ // qDebug() << "preventSuggest";
timer->stop();
enabled = false;
popup->hide();
}
void GSuggestCompletion::enableSuggest() {
+ // qDebug() << "enableSuggest";
enabled = true;
}
#include "googlesuggest.h"
ClearButton::ClearButton(QWidget *parent)
- : QAbstractButton(parent)
+ : QAbstractButton(parent)
{
setCursor(Qt::ArrowCursor);
setToolTip(tr("Clear"));
QColor color = palette().color(QPalette::Mid);
painter.setBrush(isDown()
? palette().color(QPalette::Dark)
- : palette().color(QPalette::Mid));
+ : palette().color(QPalette::Mid));
painter.setPen(painter.brush().color());
int size = width();
int offset = size / 3.5;
};
SearchButton::SearchButton(QWidget *parent)
- : QAbstractButton(parent),
- m_menu(0)
+ : QAbstractButton(parent),
+ m_menu(0)
{
setObjectName(QLatin1String("SearchButton"));
setCursor(Qt::ArrowCursor);
void SearchLineEdit::returnPressed()
{
- completion->preventSuggest();
- emit search(lineEdit()->text());
+ if (!lineEdit()->text().isEmpty()) {
+ completion->preventSuggest();
+ emit search(lineEdit()->text());
+ }
}
void SearchLineEdit::enableSuggest() {
void SearchLineEdit::preventSuggest() {
completion->preventSuggest();
}
+
+void SearchLineEdit::focusInEvent(QFocusEvent * /* event */) {
+ enableSuggest();
+}