mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
* GuiSpellchecker:
- implement event filter and allow selection of suggestions with the keyboard (second part of bug 6460). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33069 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
75988e1752
commit
56b2ee289b
@ -41,6 +41,7 @@
|
||||
#include "support/textutils.h"
|
||||
|
||||
#include <QListWidgetItem>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "SpellChecker.h"
|
||||
|
||||
@ -77,6 +78,8 @@ GuiSpellchecker::GuiSpellchecker(GuiView & lv)
|
||||
this, SLOT(on_replacePB_clicked()));
|
||||
|
||||
d->ui.wordED->setReadOnly(true);
|
||||
|
||||
d->ui.suggestionsLW->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +95,24 @@ void GuiSpellchecker::on_closePB_clicked()
|
||||
}
|
||||
|
||||
|
||||
bool GuiSpellchecker::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == d->ui.suggestionsLW && event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *e = static_cast<QKeyEvent *> (event);
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
on_suggestionsLW_itemClicked(d->ui.suggestionsLW->currentItem());
|
||||
on_replacePB_clicked();
|
||||
return true;
|
||||
} else if (e->key() == Qt::Key_Right) {
|
||||
on_suggestionsLW_itemClicked(d->ui.suggestionsLW->currentItem());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// standard event processing
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
||||
void GuiSpellchecker::on_suggestionsLW_itemClicked(QListWidgetItem * item)
|
||||
{
|
||||
if (d->ui.replaceCO->count() != 0)
|
||||
|
@ -62,6 +62,8 @@ private:
|
||||
/// show count of checked words at normal exit
|
||||
void showSummary();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
struct Private;
|
||||
Private * const d;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user