From c2a35af24325fc905ddcc31c671ca410b4d3a868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 8 Jan 2007 06:52:20 +0000 Subject: [PATCH] Fix rest of bug 3068. * src/frontends/qt4/QCitationDialog.[Ch]: - implement KeyPressEvent, catch ESC key and clear params there as well git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16594 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/QCitationDialog.C | 15 ++++++++++++++- src/frontends/qt4/QCitationDialog.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/QCitationDialog.C b/src/frontends/qt4/QCitationDialog.C index 068de2d0ca..77915b13d2 100644 --- a/src/frontends/qt4/QCitationDialog.C +++ b/src/frontends/qt4/QCitationDialog.C @@ -27,6 +27,7 @@ #include #include +#include using std::vector; using std::string; @@ -46,7 +47,7 @@ QCitationDialog::QCitationDialog(Dialog & dialog, QCitation * form) setWindowTitle(toqstr("LyX: " + getTitle())); - selectedLV->setModel(form_->selected()); + selectedLV->setModel(form_->selected()); availableLV->setModel(form_->available()); connect(citationStyleCO, SIGNAL(activated(int)), @@ -75,6 +76,18 @@ QCitationDialog::~QCitationDialog() } +void QCitationDialog::keyPressEvent(QKeyEvent * event) +{ + if (event->key() == Qt::Key_Escape) { + form_->clearSelection(); + form_->clearParams(); + event->accept(); + close(); + } else + event->ignore(); +} + + void QCitationDialog::closeEvent(QCloseEvent * e) { form_->clearSelection(); diff --git a/src/frontends/qt4/QCitationDialog.h b/src/frontends/qt4/QCitationDialog.h index 73fc0eaf02..ff5200e5e1 100644 --- a/src/frontends/qt4/QCitationDialog.h +++ b/src/frontends/qt4/QCitationDialog.h @@ -16,6 +16,7 @@ #include "ui/QCitationUi.h" #include +#include namespace lyx { namespace frontend { @@ -49,6 +50,7 @@ public: protected: void closeEvent (QCloseEvent * e); + void keyPressEvent (QKeyEvent * event); protected Q_SLOTS: