From: Flavio Date: Sun, 1 Jan 2012 16:05:01 +0000 (+0100) Subject: Minor autocomplete fixes X-Git-Tag: 1.7~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f220274f4dbbd02cac8aae71512ea0c03b9155be;p=minitube Minor autocomplete fixes --- diff --git a/src/Suggester.h b/src/Suggester.h index dc30bd8..d95d026 100644 --- a/src/Suggester.h +++ b/src/Suggester.h @@ -1,7 +1,7 @@ #ifndef SUGGESTER_H #define SUGGESTER_H -#include +#include class Suggester : public QObject { diff --git a/src/autocomplete.cpp b/src/autocomplete.cpp index a50fe38..33f475a 100644 --- a/src/autocomplete.cpp +++ b/src/autocomplete.cpp @@ -26,9 +26,13 @@ AutoComplete::AutoComplete(QWidget *parent, QLineEdit *editor): timer = new QTimer(this); timer->setSingleShot(true); - timer->setInterval(300); + timer->setInterval(600); connect(timer, SIGNAL(timeout()), SLOT(autoSuggest())); +#ifdef APP_MAC connect(parent, SIGNAL(textChanged(QString)), timer, SLOT(start())); +#else + connect(editor, SIGNAL(textEdited(QString)), timer, SLOT(start())); +#endif } @@ -112,12 +116,12 @@ void AutoComplete::showCompletion(const QStringList &choices) { popup->adjustSize(); popup->setUpdatesEnabled(true); - int h = popup->sizeHintForRow(0) * choices.count(); + int h = popup->sizeHintForRow(0) * choices.count() + 4; popup->resize(buddy->width(), h); popup->move(buddy->mapToGlobal(QPoint(0, buddy->height()))); - popup->setFocus(); + // popup->setFocus(); popup->show(); } diff --git a/src/autocomplete.h b/src/autocomplete.h index 46e4525..0962770 100644 --- a/src/autocomplete.h +++ b/src/autocomplete.h @@ -25,7 +25,7 @@ public slots: void suggestionsReady(QStringList suggestions); signals: - void suggestionAccepted(QString suggestion); + void suggestionAccepted(const QString &suggestion); private: QWidget *buddy;