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
This commit is contained in:
Jürgen Spitzmüller 2007-01-08 06:52:20 +00:00
parent a0f2283209
commit c2a35af243
2 changed files with 16 additions and 1 deletions

View File

@ -27,6 +27,7 @@
#include <string>
#include <QCloseEvent>
#include <QKeyEvent>
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();

View File

@ -16,6 +16,7 @@
#include "ui/QCitationUi.h"
#include <QCloseEvent>
#include <QKeyEvent>
namespace lyx {
namespace frontend {
@ -49,6 +50,7 @@ public:
protected:
void closeEvent (QCloseEvent * e);
void keyPressEvent (QKeyEvent * event);
protected Q_SLOTS: