]> git.sur5r.net Git - minitube/commitdiff
Minor autocomplete fixes
authorFlavio <flavio@odisseo.local>
Sun, 1 Jan 2012 16:05:01 +0000 (17:05 +0100)
committerFlavio <flavio@odisseo.local>
Sun, 1 Jan 2012 16:05:01 +0000 (17:05 +0100)
src/Suggester.h
src/autocomplete.cpp
src/autocomplete.h

index dc30bd8cf59a468d0ff6e010895600d40ac1da6d..d95d026ca4a30fa9df47a62bdfde73a4e7a9a5c9 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SUGGESTER_H
 #define SUGGESTER_H
 
-#include <QtCore>
+#include <QtGui>
 
 class Suggester : public QObject {
 
index a50fe38419da06b338d44297919da693f5dc0bad..33f475aa82474193026d48345d58cf65c1dbc180 100644 (file)
@@ -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();
 }
 
index 46e45253bd56c7810948a05d89a6ddb6e3f225bb..0962770513621d12280e065d559bf7905ea7a5a6 100644 (file)
@@ -25,7 +25,7 @@ public slots:
     void suggestionsReady(QStringList suggestions);
 
 signals:
-    void suggestionAccepted(QString suggestion);
+    void suggestionAccepted(const QString &suggestion);
 
 private:
     QWidget *buddy;