From f262ed69ccebce77808d0904269da3a3d12c2b4d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 7 Nov 2013 13:40:57 +0900 Subject: Make the tag widget act more sanely when pressing Tab When dealing with autocompletion, tag usually means "take this, move on". In the tag widget the tab was added to the tag itself (and then stripped when the input line was processed). Not exactly useful. This feels a bit "hackish", but it seems to get the job done. Signed-off-by: Dirk Hohndel --- qt-ui/tagwidget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp index 673242cfa..b0912addb 100644 --- a/qt-ui/tagwidget.cpp +++ b/qt-ui/tagwidget.cpp @@ -152,6 +152,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e) { switch (e->key()) { case Qt::Key_Return: case Qt::Key_Enter: + case Qt::Key_Tab: /* * Fake the QLineEdit behaviour by simply * closing the QAbstractViewitem @@ -162,6 +163,13 @@ void TagWidget::keyPressEvent(QKeyEvent *e) { popup->hide(); } } - GroupedLineEdit::keyPressEvent(e); + if (e->key() == Qt::Key_Tab) { // let's pretend this is a comma instead + QKeyEvent *fakeEvent = new QKeyEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(",")); + qDebug() << "sending comma instead"; + GroupedLineEdit::keyPressEvent(fakeEvent); + free(fakeEvent); + } else { + GroupedLineEdit::keyPressEvent(e); + } } -- cgit v1.2.3-70-g09d2