mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
9052035548
commit
f262ed69cc
1 changed files with 9 additions and 1 deletions
|
@ -152,6 +152,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
switch (e->key()) {
|
switch (e->key()) {
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
|
case Qt::Key_Tab:
|
||||||
/*
|
/*
|
||||||
* Fake the QLineEdit behaviour by simply
|
* Fake the QLineEdit behaviour by simply
|
||||||
* closing the QAbstractViewitem
|
* closing the QAbstractViewitem
|
||||||
|
@ -162,6 +163,13 @@ void TagWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
popup->hide();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue