diff options
author | Gehad <gehadelrobey@gmail.com> | 2014-03-20 17:04:29 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-20 09:54:58 -0700 |
commit | cc2369c5f9dbaebb8fae2e652e27f189d0454fc1 (patch) | |
tree | ea6421f8f418a25c9c562c3b4fe946e3bcbfdbd4 /qt-ui | |
parent | 53b5e82411ca81fa110ffb0f1fc678b3cb4c4927 (diff) | |
download | subsurface-cc2369c5f9dbaebb8fae2e652e27f189d0454fc1.tar.gz |
Make esc-key discard the new tag selection
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/tagwidget.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp index 891b66425..a33bd5516 100644 --- a/qt-ui/tagwidget.cpp +++ b/qt-ui/tagwidget.cpp @@ -179,7 +179,19 @@ void TagWidget::clear() void TagWidget::keyPressEvent(QKeyEvent *e) { + QPair<int, int> pos; + QAbstractItemView *popup; switch (e->key()) { + case Qt::Key_Escape: + pos = getCursorTagPosition(); + if (pos.first >= 0 && pos.second > 0) { + setText(text().remove(pos.first, pos.second - pos.first)); + setCursorPosition(pos.first); + } + popup= m_completer->popup(); + if (popup) + popup->hide(); + return; case Qt::Key_Return: case Qt::Key_Enter: case Qt::Key_Tab: @@ -188,7 +200,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e) * closing the QAbstractViewitem */ if (m_completer) { - QAbstractItemView *popup = m_completer->popup(); + popup = m_completer->popup(); if (popup) popup->hide(); } |