Don't block Key_Back in file dialog

Update the 10 year old FIXME hack to allow Key_Back (which will
close the dialog on Android). Also clean up nearby code that has
been dead for seven years.

Task-number: QTBUG-35784
Change-Id: I609858afb2caefe7025e421406288ae56717fea5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Paul Olav Tvete 2014-03-13 15:11:22 +01:00 committed by The Qt Project
parent 61f865be00
commit 08ba111719
2 changed files with 2 additions and 7 deletions

View File

@ -3904,13 +3904,8 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
int key = e->key(); int key = e->key();
QLineEdit::keyPressEvent(e); QLineEdit::keyPressEvent(e);
if (key != Qt::Key_Escape) if (key != Qt::Key_Escape && key != Qt::Key_Back)
e->accept(); e->accept();
if (hideOnEsc && (key == Qt::Key_Escape || key == Qt::Key_Return || key == Qt::Key_Enter)) {
e->accept();
hide();
d_ptr->currentView()->setFocus(Qt::ShortcutFocusReason);
}
} }
#ifndef QT_NO_FSCOMPLETER #ifndef QT_NO_FSCOMPLETER

View File

@ -286,7 +286,7 @@ private:
class QFileDialogLineEdit : public QLineEdit class QFileDialogLineEdit : public QLineEdit
{ {
public: public:
QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), hideOnEsc(false), d_ptr(0){} QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), d_ptr(0){}
void setFileDialogPrivate(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; } void setFileDialogPrivate(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
bool hideOnEsc; bool hideOnEsc;