diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-07 13:40:57 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-07 13:40:57 +0900 |
commit | f262ed69ccebce77808d0904269da3a3d12c2b4d (patch) | |
tree | e4bb274f6d1b13469eeaf3bd992ffb5920eebf02 /qt-ui/tagwidget.cpp | |
parent | 9052035548284362b55576c5605ddc12ed45f926 (diff) | |
download | subsurface-f262ed69ccebce77808d0904269da3a3d12c2b4d.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/tagwidget.cpp')
-rw-r--r-- | qt-ui/tagwidget.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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); + } } |